[Haskell-cafe] code generation

Marc Weber marco-oweber at gmx.de
Tue Oct 21 10:07:44 EDT 2008

On Tue, Oct 21, 2008 at 03:04:27PM +0200, Martin Hofmann wrote:
> We try to learn functional programs from examples, but our system is not
> yet ported to Haskell, though we are working on it. However, we thought
> about using TH.
> Do you have any pointers to papers, etc. ? You'll find our project,
> system and papers here: http://www.cogsys.wiai.uni-bamberg.de/effalip/

I've only had a quick glance at the description however it looks like
you should have a look at derive
( http://hackage.haskell.org/cgi-bin/hackage-scripts/package/derive,
  http://www-users.cs.york.ac.uk/~ndm/derive/ )
which I think tries to do a similar job.

About everything else: try haskell.org, #haskell and there is even a TH
mailinglist. You should know that you can make ghci print a lot of terms
for you. Eg put the following into your ~/.ghci file
        :set -fth
        :m +Language.Haskell.TH
        :m +Language.Haskell.TH.Syntax
then run ghci -package template-haskell and enter

        ghci: Prelude Language.Haskell.TH.Syntax Language.Haskell.TH> runQ [| (*2) |]
        InfixE Nothing (VarE GHC.Num.*) (Just (LitE (IntegerL 2)))

etc.. Also note that there is the module Language.Haskell.TH.Lib which
does a lot of lifting for you automatically..

I hope this does help you getting more productive in addition to reading
some of those existing texts.

Marc Weber

More information about the Haskell-Cafe mailing list