[Haskell-cafe] Template Haskell newbie questions
Max Vasin
max.vasin at gmail.com
Tue Sep 25 00:46:43 EDT 2007
2007/9/22, Hugo Pacheco <hpacheco at gmail.com>:
> Hi all,
> If I want to write some function that will dynamically create a selection
> function according to its arguments and do something with it.
You cannot dynamically create function, all you can is to create it at
compile-time (that's what TH lets you to do).
> However, is there a possible way to generate Haskell functions from TH
> without having to instanciate its arguments?
First of all, how do you intend to use your fsel function? In fact if
we ignore stage restirctions expression $(sel x y) will have different
types depending on fsel parameters. Even if we can generate code at
runtime, we cannot assign a type to the $(sel x y) expression (except
something like Dynamic, but doubt if it makes sence). Even if we can
assign a type to the $(sel x y) expression, the $(sel x y) (x, y)
expression is well-typed only if $(sel x y) has type (a, b) -> c.
--
WBR,
Max Vasin
JID: maxvasin at jabber.ru
More information about the Haskell-Cafe
mailing list