
16 Feb
2006
16 Feb
'06
5:37 a.m.
Conor McBride
P x y z = C x (y, [z])
Isn't this idea very similar to views, and pattern-guards? For instance, you could rewrite your example thus: data EffectView x = Bang | Bing x | Dull x view :: MyEffect x -> EffectView x view (Comp Nothing) = Bang view (Comp (Just (Prod (Any True), Id x))) = Bing x view (Comp (Just (Prod (Any False), Id x))) = Dull x my_function e | Bang <- view effect = ... | Bing x <- view effect = ... x ... | Dull x <- view effect = ... x ... Regards, Malcolm