keen!
I’m not sure how to add a custom type route though… here’s where I got up to: https://ellie-app.com/9WDZnrhbJpta1
type Route
= Blog Int
| Article String Int
| User UserRoute -- this is the new route
| Home
type UserRoute
= About
| Settings
route : UrlCodec (Route -> a) a Route
route =
adt
(\fhome fblog farticle fuser value ->
case value of
Home ->
fhome
Blog i ->
fblog i
Article se i ->
farticle se i
User user_route ->
fuser user_route
)
|> variant0 Home
|> variant1 Blog (comb (s "blog") int)
|> variant2 Article string int
|> variant1 User (comb (s "user") userRoute) -- using a `variant1` feels right, here...
|> buildCustom
userRoute : UrlCodec (UserRoute -> a) a UserRoute
userRoute =
adt
(\fabout fsettings value ->
case value of
About ->
fabout
Settings ->
fsettings
)
|> variant0 About
--|> variant1 Settings userSettings
|> variant0 Settings -- but neither `variant0` or `variant1` feel right here?
|> buildCustom