I understand what get1
does and that is fine
get1 = attempt $ Affjax.get "http://www.google.com"
I think I know what liftAff
does BUT the compiler knows better a
get2 = liftAff $ attempt $ Affjax.get "http://www.google.com"
and gives the following the error message
61 get2 = liftAff $ attempt $ Affjax.get "http://www.google.com"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No type class instance was found for
Control.Monad.Aff.Class.MonadAff ( ajax :: AJAX
| _0
)
_1
The instance head contains unknown type variables. Consider adding a type annotation.
in value declaration get2
where _1 is an unknown type
_0 is an unknown type
Which leaves me scratching my head.
Lets assume that the get "http://somesite.com"
will return a String.
The problem is that the compiler doesn't know which monad you're trying to lift into with
liftAff
; the return type ofAffjax.get
isn't the issue here. What version of the compiler are you using? I think that this error will just go away if you update to one of the more recent versions which includes constraint inference.