[Template-haskell] using [d| class or fun |] and only
substituting names?
Marc Weber
marco-oweber at gmx.de
Wed Sep 3 15:07:06 EDT 2008
On Wed, Sep 03, 2008 at 07:33:07PM +0200, Alfonso Acosta wrote:
> On Wed, Sep 3, 2008 at 7:11 PM, Marc Weber <marco-oweber at gmx.de> wrote:
> > Is there a way to write something like this?
>
> No, unfortunately only expressions can be spliced. I'm afraid, You'll
> have to build the declaration manually.
Do you think its worth opening a ticket?
I feel this is much harder to read..
Maybe I'm still not used to template haskell
let names = [ "m", "elc", "stc2", "elc3", "st2", "el2", "st2", "el3" ]
[ m, elc, stc2, elc3, st2, el2, st2, el3 ] = map mkName names
in classD []
(mkName $ (classElem ng) n)
names
[funDep [st2,stc3] [st3],FunDep [el2,elc3] [el3]]
[sigD (mkName $ (elemName ng) n)
(ForallT [a,st,el]
[]
(appTn (varT m) [ conT elst, varT elc, conT elst, varT elc, varT stc3, varT elc3, varT a]
)]
Sincerly
Marc Weber
More information about the template-haskell
mailing list