]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Repr/Host.hs
Foldable, Num
[haskell/symantic.git] / Language / Symantic / Repr / Host.hs
1 -- | Interpreter to compute a host-term.
2 module Language.Symantic.Repr.Host where
3
4 -- * Type 'Repr_Host'
5
6 -- | Interpreter's data.
7 newtype Repr_Host h = Repr_Host { unRepr_Host :: h }
8 instance Functor Repr_Host where
9 fmap f (Repr_Host a) = Repr_Host (f a)
10 instance Applicative Repr_Host where
11 pure = Repr_Host
12 (Repr_Host f) <*> (Repr_Host a) = Repr_Host (f a)
13 instance Monad Repr_Host where
14 return = Repr_Host
15 (Repr_Host a) >>= f = f a
16
17 -- | Interpreter.
18 host_from_expr :: Repr_Host h -> h
19 host_from_expr = unRepr_Host