-- | Interpreter to compute a host-term. module Language.Symantic.Interpreting.Host where import Control.Monad -- * Type 'HostI' -- | Interpreter's data. newtype HostI h = HostI { unHostI :: h } instance Functor HostI where fmap f (HostI a) = HostI (f a) instance Applicative HostI where pure = HostI (HostI f) <*> (HostI a) = HostI (f a) instance Monad HostI where return = HostI (HostI a) >>= f = f a -- | Interpreter. host_from_term :: HostI h -> h host_from_term = unHostI hostI0 :: a -> HostI a hostI0 = HostI hostI1 :: (a -> b) -> HostI a -> HostI b hostI1 = liftM hostI2 :: (a -> b -> c) -> HostI a -> HostI b -> HostI c hostI2 = liftM2 hostI3 :: (a -> b -> c -> d) -> HostI a -> HostI b -> HostI c -> HostI d hostI3 = liftM3