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