I have the following programm written with Eff
s and Aff
s. Which runs as expected. That is it prints out the given Int
and it does an asynchronous computation.
type JsonResponse = AffjaxResponse Json
access :: forall e m. Aff (ajax :: AJAX | e) (Either Error JsonResponse)
access = attempt $ get "http://localhost:8080/livesys/Robert"
staging :: forall e. Int -> Eff (console :: CONSOLE | e) Int
staging i = do
liftEff $ log $ ">>" ++ show i
return i
main :: forall a. Int -> Aff (ajax :: AJAX, console :: CONSOLE| a) Int
main state = do
s <- liftEff $ staging state
a <- liftAff access
return s
If I change however the order of calls within main
then something mysterious happens:
main :: forall a. Int -> Aff (ajax :: AJAX, console :: CONSOLE| a) Int
main state = do
a <- liftAff access
s <- liftEff $ staging state
return s
the function staging
is now being called twice! Wut?
Can anybody explain this?
Thanks for your help
liftAff
inmain
? I don't think it's necessary. (Not to excuse this behaviour, which does certainly seem wrong; I'm just trying to diagnose) – hdgarroodpsc-bundle
and upload it to a pastebin? – hdgarroodpsc-bundle
should remove all the dead code. – hdgarrood