Sunday, 15 January 2012

haskell - Continuation Monad and Asynchronous Responses -



haskell - Continuation Monad and Asynchronous Responses -

assume have 3 synchronous functions info on http (these api calls internally):

lookupuser :: string -> io userid lookupusercity :: userid -> io city lookuplocation :: city -> io location

so, monadic composition lookuplocation <=< lookupusercity <=< lookupuser location of user. but, since each of these calls block, prevent rest of programme running.

apparently, continuations help solve this, can't find real examples of it. think signatures rewritten a -> contt r io b, don't see how accomplish callback-like pattern this. if show me (1) how write transform :: (a -> io b) -> (a -> contt r io b) or (2) link real illustration of doing this, grateful.

continuations pattern of working functions, have nil asynchronicity.

what need forkio or more high level abstractions presented libraries async.

haskell asynchronous continuations

No comments:

Post a Comment