butter-0.1.0.6: Monad Transformer for Asyncronous Message Passing

Safe HaskellNone
LanguageHaskell2010

Distrib.Butter.Lang

Documentation

data ProcessID Source #

Constructors

PID 

Fields

Named 

Fields

data Action (m :: * -> *) next where Source #

Constructors

Lift :: m a -> (a -> next) -> Action m next 
Connect :: Text -> Text -> Int -> next -> Action m next 
Spawn :: Butter m () -> (ProcessID -> next) -> Action m next 
Send :: ProcessID -> ByteString -> next -> Action m next 
Receive :: (ByteString -> next) -> Action m next 
Friends :: ([Text] -> next) -> Action m next 
Self :: (ProcessID -> next) -> Action m next 
Alive :: ProcessID -> (Bool -> next) -> Action m next 
Name :: Text -> next -> Action m next 

Instances

Functor (Action m) Source # 

Methods

fmap :: (a -> b) -> Action m a -> Action m b #

(<$) :: a -> Action m b -> Action m a #

MonadIO m => MonadIO (Free (Action m)) Source # 

Methods

liftIO :: IO a -> Free (Action m) a #

type Butter m a = Free (Action m) a Source #

connect :: Text -> Text -> Int -> Butter m () Source #

name :: Text -> Butter m () Source #

send :: ToJSON a => ProcessID -> a -> Butter m () Source #

lift :: m a -> Butter m a Source #

spread :: (MonadIO m, ForkableMonad m, ToJSON a, FromJSON a) => Text -> Maybe Int -> Butter m a -> m a Source #