{-# LANGUAGE FlexibleInstances #-}
module Simulation.Aivika.Distributed.Optimistic.Internal.IO
(MonadIOUnsafe(..)) where
import Control.Monad
import Control.Monad.Trans
import Simulation.Aivika.Trans
import Simulation.Aivika.Distributed.Optimistic.Internal.DIO
class MonadIOUnsafe m where
liftIOUnsafe :: IO a -> m a
instance MonadIOUnsafe DIO where
liftIOUnsafe :: forall a. IO a -> DIO a
liftIOUnsafe = (DIOContext -> Process a) -> DIO a
forall a. (DIOContext -> Process a) -> DIO a
DIO ((DIOContext -> Process a) -> DIO a)
-> (IO a -> DIOContext -> Process a) -> IO a -> DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process a -> DIOContext -> Process a
forall a b. a -> b -> a
const (Process a -> DIOContext -> Process a)
-> (IO a -> Process a) -> IO a -> DIOContext -> Process a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> Process a
forall a. IO a -> Process a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
instance MonadIOUnsafe (Parameter DIO) where
liftIOUnsafe :: forall a. IO a -> Parameter DIO a
liftIOUnsafe = DIO a -> Parameter DIO a
forall a. DIO a -> Parameter DIO a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadCompTrans t m =>
m a -> t m a
liftComp (DIO a -> Parameter DIO a)
-> (IO a -> DIO a) -> IO a -> Parameter DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DIOContext -> Process a) -> DIO a
forall a. (DIOContext -> Process a) -> DIO a
DIO ((DIOContext -> Process a) -> DIO a)
-> (IO a -> DIOContext -> Process a) -> IO a -> DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process a -> DIOContext -> Process a
forall a b. a -> b -> a
const (Process a -> DIOContext -> Process a)
-> (IO a -> Process a) -> IO a -> DIOContext -> Process a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> Process a
forall a. IO a -> Process a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
instance MonadIOUnsafe (Simulation DIO) where
liftIOUnsafe :: forall a. IO a -> Simulation DIO a
liftIOUnsafe = DIO a -> Simulation DIO a
forall a. DIO a -> Simulation DIO a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadCompTrans t m =>
m a -> t m a
liftComp (DIO a -> Simulation DIO a)
-> (IO a -> DIO a) -> IO a -> Simulation DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DIOContext -> Process a) -> DIO a
forall a. (DIOContext -> Process a) -> DIO a
DIO ((DIOContext -> Process a) -> DIO a)
-> (IO a -> DIOContext -> Process a) -> IO a -> DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process a -> DIOContext -> Process a
forall a b. a -> b -> a
const (Process a -> DIOContext -> Process a)
-> (IO a -> Process a) -> IO a -> DIOContext -> Process a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> Process a
forall a. IO a -> Process a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
instance MonadIOUnsafe (Dynamics DIO) where
liftIOUnsafe :: forall a. IO a -> Dynamics DIO a
liftIOUnsafe = DIO a -> Dynamics DIO a
forall a. DIO a -> Dynamics DIO a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadCompTrans t m =>
m a -> t m a
liftComp (DIO a -> Dynamics DIO a)
-> (IO a -> DIO a) -> IO a -> Dynamics DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DIOContext -> Process a) -> DIO a
forall a. (DIOContext -> Process a) -> DIO a
DIO ((DIOContext -> Process a) -> DIO a)
-> (IO a -> DIOContext -> Process a) -> IO a -> DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process a -> DIOContext -> Process a
forall a b. a -> b -> a
const (Process a -> DIOContext -> Process a)
-> (IO a -> Process a) -> IO a -> DIOContext -> Process a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> Process a
forall a. IO a -> Process a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
instance MonadIOUnsafe (Event DIO) where
liftIOUnsafe :: forall a. IO a -> Event DIO a
liftIOUnsafe = DIO a -> Event DIO a
forall a. DIO a -> Event DIO a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
MonadCompTrans t m =>
m a -> t m a
liftComp (DIO a -> Event DIO a) -> (IO a -> DIO a) -> IO a -> Event DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (DIOContext -> Process a) -> DIO a
forall a. (DIOContext -> Process a) -> DIO a
DIO ((DIOContext -> Process a) -> DIO a)
-> (IO a -> DIOContext -> Process a) -> IO a -> DIO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process a -> DIOContext -> Process a
forall a b. a -> b -> a
const (Process a -> DIOContext -> Process a)
-> (IO a -> Process a) -> IO a -> DIOContext -> Process a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> Process a
forall a. IO a -> Process a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO