summaryrefslogtreecommitdiff
path: root/Assistant/Monad.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-05 19:39:08 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-05 19:39:08 -0400
commitd61d6e1f8ae90cb5babbe1334bc7fd13c4eb90eb (patch)
treed8c81de580907c1c09284409f803cfdf56795958 /Assistant/Monad.hs
parentb3d1a85c2068d42d5399fa659dc94735664da579 (diff)
better handling of lifting from XMPP -> Assistant
Diffstat (limited to 'Assistant/Monad.hs')
-rw-r--r--Assistant/Monad.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Assistant/Monad.hs b/Assistant/Monad.hs
index 9f5c42aa3..3b6dfedee 100644
--- a/Assistant/Monad.hs
+++ b/Assistant/Monad.hs
@@ -79,8 +79,8 @@ newAssistantData st dstatus = AssistantData
<*> newBuddyList
<*> newNetMessagerControl
-runAssistant :: Assistant a -> AssistantData -> IO a
-runAssistant a = runReaderT (mkAssistant a)
+runAssistant :: AssistantData -> Assistant a -> IO a
+runAssistant d a = runReaderT (mkAssistant a) d
getAssistant :: (AssistantData -> a) -> Assistant a
getAssistant = reader
@@ -97,23 +97,23 @@ liftAnnex a = do
(<~>) :: (IO a -> IO b) -> Assistant a -> Assistant b
io <~> a = do
d <- reader id
- liftIO $ io $ runAssistant a d
+ liftIO $ io $ runAssistant d a
{- Creates an IO action that will run an Assistant action when run. -}
asIO :: Assistant a -> Assistant (IO a)
asIO a = do
d <- reader id
- return $ runAssistant a d
+ return $ runAssistant d a
asIO1 :: (a -> Assistant b) -> Assistant (a -> IO b)
asIO1 a = do
d <- reader id
- return $ \v -> runAssistant (a v) d
+ return $ \v -> runAssistant d $ a v
asIO2 :: (a -> b -> Assistant c) -> Assistant (a -> b -> IO c)
asIO2 a = do
d <- reader id
- return $ \v1 v2 -> runAssistant (a v1 v2) d
+ return $ \v1 v2 -> runAssistant d (a v1 v2)
{- Runs an IO action on a selected field of the AssistantData. -}
(<<~) :: (a -> IO b) -> (AssistantData -> a) -> Assistant b