{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE BlockArguments #-}
module Control.Churro.Transport.Unagi where
import Control.Churro.Types
import Control.Churro.Prelude
import Control.Concurrent.Chan.Unagi
import Data.Void
data Unagi a
instance Transport Unagi where
data In Unagi a = ChanIn (InChan a)
data Out Unagi a = ChanOut (OutChan a)
yank :: Out Unagi a -> IO a
yank (ChanOut c) = OutChan a -> IO a
forall a. OutChan a -> IO a
readChan OutChan a
c
yeet :: In Unagi a -> a -> IO ()
yeet (ChanIn c) = InChan a -> a -> IO ()
forall a. InChan a -> a -> IO ()
writeChan InChan a
c
flex :: IO (In Unagi a, Out Unagi a)
flex = do
(InChan a
i, OutChan a
o) <- IO (InChan a, OutChan a)
forall a. IO (InChan a, OutChan a)
newChan
(In Unagi a, Out Unagi a) -> IO (In Unagi a, Out Unagi a)
forall (m :: * -> *) a. Monad m => a -> m a
return (InChan a -> In Unagi a
forall a. InChan a -> In Unagi a
ChanIn InChan a
i, OutChan a -> Out Unagi a
forall a. OutChan a -> Out Unagi a
ChanOut OutChan a
o)
type ChurroUnagi = Churro Unagi
runWaitUnagi :: ChurroUnagi Void Void -> IO ()
runWaitUnagi :: ChurroUnagi Void Void -> IO ()
runWaitUnagi = ChurroUnagi Void Void -> IO ()
forall (t :: * -> *). Transport t => Churro t Void Void -> IO ()
runWait
runWaitListUnagi :: ChurroUnagi Void o -> IO [o]
runWaitListUnagi :: ChurroUnagi Void o -> IO [o]
runWaitListUnagi = ChurroUnagi Void o -> IO [o]
forall (t :: * -> *) o. Transport t => Churro t Void o -> IO [o]
runWaitList