You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And then somehow connect the dots. I understand the Router data structure most be homogeneous of course, so maybe type classes could come into this? Have you had to deal with this scenario before, is there an easy way out of this?
For now I'll resort to pattern matching in each class, which makes for some non-sensical code, where my search component might end up with args pointing to an entirely different route.
EDIT: Actually resorting to Partial => ... and unsafePartial in my class is arguably an acceptable middleground:
I haven't come-up with a solution for that and I've been using the same techniques too. There is purescript-trout with type level routing, but with it you loose composability of cofree. We need a typelevel cofree comonad, where each leaf is represented by a different type. Then when implementing this interface you wouldn't need partiality. I am not sure if purescript type level programming allows for this kind of interface, but I'd love to experiment with this.
Currently, each mounted component (as part of
Router
) gets as props thearg
inRouter RouteProps arg
, by virtue ofRouteProps arg
.But if I have an ADT:
Then hook my search route, to my "searchClass" (see below),
Then my
searchClass
receives as thearg
theLocations
type ADT. I wonder if it possible to somehow scope the args into the correct entry of the ADT.So, for arguments sake, I could have:
And then somehow connect the dots. I understand the Router data structure most be homogeneous of course, so maybe type classes could come into this? Have you had to deal with this scenario before, is there an easy way out of this?
For now I'll resort to pattern matching in each class, which makes for some non-sensical code, where my search component might end up with args pointing to an entirely different route.
EDIT: Actually resorting to
Partial => ...
andunsafePartial
in my class is arguably an acceptable middleground:The text was updated successfully, but these errors were encountered: