Is the documentation for optional parameters incorrect?
newlandsvalley opened this issue · 4 comments
Excellent package and excellent documentation! I wonder, though, whether the description of an optional String parameter for Feed in the documentation is slightly incorrect? You have in the cleanest representation (as well as the less clean ones) :
"Feed": "feed" ? { search: optional }
but for me, this fails to compile, whereas this works:
"Feed": "feed" ? { search: optional <<< string }
What error are you getting? I think the former is how it ideally works, but it might not work because of how the compiler currently handles polymorphic things in row types along with constraints. The optional <<< string
likely works because it makes it monomorphic (Maybe String
instead of Maybe a
).
I'm still using PS 0.12.5 and get:
No type class instance was found for
Routing.Duplex.RouteDuplexBuildParams (Cons "predicate" (RouteDuplex t3 t4 -> RouteDuplex (... ...) (... ...)) Nil)
( predicate :: RouteDuplex t3 t4 -> RouteDuplex (... ...) (... ...)
)
( predicate :: Maybe String
)
()
( predicate :: Maybe String
)
Yeah, you can also try a type signature.
optionalString :: RouteDuplex' String -> RouteDuplex' (Maybe String)
optionalString = optional
OK - to make the function monomorphic. Thanks, Nate.