purescript - How to define the type signature on this Affjax call -


i having simple program using affjax , launchaff.

import network.http.affjax affjax import control.monad.aff (launchaff)  test1 = launchaff $ affjax.get "/api" 

this gives me following error

 58  test1 = launchaff $ affjax.get "/api"      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   no type class instance found   network.http.affjax.response.respondable _0   instance head contains unknown type variables. consider adding type annotation.   in value declaration test1   _0 unknown type 

i understand respondable needs be defined here dont how exactly.

any appreciated.

thx

you'll need annotate test1 function let compiler know expect ajax call.

test1 = launchaff   affjax.get "/api" :: affjax _ foreign 

you can choose 1 of these instances return type, or if expect own datatype returned, write respondable instance it.

edit: edited source code. provided codesnippet isn't useful though, since you're not doing ajax response. since affjax operates inside aff can use notation bind result of get call variable , proceed use there.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -