News for hackers. Stuff that matters.
Re:Hello Haskell, Goodbye Lisp (2009) by TheCoelacanth on Saturday May 03, 2014 @02:13PM (#7691780)
That's a good question, but the only answer in the thread is something that can easily be implemented in Template Haskell.

    genFoo :: String -> DecsQ
    genFoo name = [d| instance Foo $(return t) where quux = $(return f) |]
      where f = VarE . mkName ("quuxify" ++ name)
            t = ConT (mkName name)

    genFoos :: [String] -> DecsQ
    genFoos = foldl' (liftM2 (++)) (return []) . map genFoo

There are no comments on this comment yet.