Re: using [d| class or fun |] and only substituting names?
Marc Weber <[email protected]> Wed, 3 Sep 2008 21:07:06 +0200
| Newsgroups | gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Sep 03, 2008 at 07:33:07PM +0200, Alfonso Acosta wrote: > On Wed, Sep 3, 2008 at 7:11 PM, Marc Weber <[email protected]> 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