
4 Aug
2010
4 Aug
'10
12:25 p.m.
On Tue, Aug 3, 2010 at 8:33 PM, Claude Heiland-Allen
{-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-} import Language.Haskell.Djinn (djinnD) $(djinnD "maybeToEither" [t|forall a b . a -> Maybe b -> Either a b|]) main = print . map (maybeToEither "foo") $ [Nothing, Just "bar"]
This is very cool (as is Djinn itself), but for me the ideal syntax would be maybeToEither :: a -> Maybe b -> Either a b maybeToEither = $(derived) Is something like this possible in TH? The splice would have to know its declared (even inferred?) type. --Max