I think understand the problem with the following code, but I don’t know how to fix it. In the render function I’m trying to use an Effect String as an argument to HH.text which, of course, doesn’t work because the types don’t match. So I tried using H.liftEffect, but get a message that there isn’t a bind instance.
:type window >>= navigator >>= userAgent
Effect String
render :: forall a m. Unit -> H.ComponentHTML a () m
render _ = do
ua <- H.liftEffect $ window >>= navigator >>= userAgent
HH.div_ [ HH.text $ ua]
No type class instance was found for
Control.Bind.Bind (HTML (ComponentSlot HTML () m3 a4))
while applying a function bind
of type Bind t0 => t0 t1 -> (t1 -> t0 t2) -> t0 t2
to argument (apply liftEffect) ((bind ((...) navigator)) userAgent)
while inferring the type of bind ((apply liftEffect) ((bind (...)) userAgent))
in value declaration render
I tried writing an instance, but orphan instances aren’t allowed and I got lost in the newtype wrapper stuff. I have a feeling I’m making this much harder than it really is What’s idiomatic way to do this?
Im running purs 0.13.6 and Halogen v5.0.0-rc.9