
Jacques Carette wrote:
Jason Dagit wrote:
Are you implying that template haskell is not typed?
Indeed. [...]
Compare with metaocaml where if you can compile you meta-program (i.e. code generator), then you are guaranteed that it can only ever produce valid, well-typed code. Not so with TH, where you can easily generate junk -- which GHC will promptly figure out and give you an error.
I'm curious, can metaocaml create new data type definitions, value declarations or type class instances? I usually use TH to get rid of boilerplate that I cannot get rid off in Haskell itself, for instance for creating functional lenses for record types data Foo = Foo { bar_ :: Int, ...} $(DeriveLenses Foo) -- bar :: Lens Foo Int It seems to me that metaocaml is more used as "user annotated" partial evaluation? Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com