[Haskell-cafe] Who generates Haskell code and uses type information
at runtime?
Martin Hofmann
martin.hofmann at uni-bamberg.de
Wed Mar 18 05:48:39 EDT 2009
I try to modify Haskell code, parsed from an external source, at
runtime. Therefore I need type information about this code. Sometimes to
this is referred to as treating "data as code" and "code as data". In
homoiconic languages such as Lisp this would be less cumbersome, but in
Haskell this seems to be not trivial.
Therefore I would like to know how other people solved this. Do you, for
example,
* use ghc-as-api and manipulate the code snippet in GHC's core
language?
* use Language.Haskell.Syntax or Language.Haskell.TH and get your
type information via IO (from Hint or ghc) as a String?
* use your own language representation for code and type and use a
tailored type inference/unification algorithm?
* use your own language representation combined with Data.Typeable
and Data.Dynamics, but what about polymorphic types?
* ...?
Thanks a lot,
Martin
More information about the Haskell-Cafe
mailing list