Examples-0.1.0: Haskell code examples
Safe HaskellSafe-Inferred
LanguageHaskell2010

MyFreeMonad

Synopsis

Documentation

type ArithM = Free ArithF Source #

The free monad for the arithmetic language.

data ArithF x Source #

The functor for the arithmetic language.

Constructors

Add Int x 
Sub Int x 
Mul Int x 
Div Int x 

Instances

Instances details
Functor ArithF Source # 
Instance details

Defined in MyFreeMonad

Methods

fmap :: (a -> b) -> ArithF a -> ArithF b #

(<$) :: a -> ArithF b -> ArithF a #

Show x => Show (ArithF x) Source # 
Instance details

Defined in MyFreeMonad

Methods

showsPrec :: Int -> ArithF x -> ShowS #

show :: ArithF x -> String #

showList :: [ArithF x] -> ShowS #

evalArith :: Free ArithF Int -> Int Source #

Evaluate an arithmetic expression.