
9 Mar
2010
9 Mar
'10
6:24 p.m.
Tom Schrijvers wrote:
data EvalDict sem = EvalDict { val :: Int -> sem Int, add :: sem Int -> sem Int -> sem Int }
An alternative option is to capture the structure in a GADT:
data Eval a where Val :: Int -> Eval Int Add :: Eval Int -> Eval Int -> Eval Int
And then write what were instances before as functions Eval a -> whatever. Of course, this makes it harder to combine multiple models. Martijn.