{-# 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 :: forall a. Out Chan a -> IO a
yank (ChanOut Chan a
c) = forall a. Chan a -> IO a
readChan Chan a
c
yeet :: forall a. In Chan a -> a -> IO ()
yeet (ChanIn Chan a
c) = forall a. Chan a -> a -> IO ()
writeChan Chan a
c
flex :: forall a. IO (In Chan a, Out Chan a)
flex = do
Chan a
c <- forall a. IO (Chan a)
newChan
forall (m :: * -> *) a. Monad m => a -> m a
return (forall a. Chan a -> In Chan a
ChanIn Chan a
c, forall a. Chan a -> Out Chan a
ChanOut Chan a
c)
type ChurroChan a = Churro a Chan
runWaitChan :: ChurroChan a Void Void -> IO a
runWaitChan :: forall a. ChurroChan a Void Void -> IO a
runWaitChan = forall (t :: * -> *) a. Transport t => Churro a t Void Void -> IO a
runWait
runWaitListChan :: ChurroChan () Void o -> IO [o]
runWaitListChan :: forall o. ChurroChan () Void o -> IO [o]
runWaitListChan = forall (t :: * -> *) a b.
(Transport t, Monoid a) =>
Churro a t Void b -> IO [b]
runWaitList