[Template-haskell] Contexts on Datatype - question/bug?

Derek Elkins ddarius86@hotmail.com
Wed, 12 Feb 2003 17:24:39 -0500


>| On a side note: why not toss up a TH page on the Haskell wiki,
>especially if
>| the answer to my second question is no?
>
>by all means go ahead.

Consider it done: http://www.haskell.org/wiki/wiki?TemplateHaskell
It's pretty sparse now.


>| data (Eq a) => Tree a = Leaf a | Branch (Tree a) (Tree a)
>|
>| main = do output <- runQ $ reifyDecl Tree
>|           putStr $ show output
>|
>| will cause the impossible to happen.
>| I went in and changed DsMeta.hs to pass the cxt for reifyDecl
>(repTyClD for
>| case TyData), which kept the impossible from happening, but then
>realized
>| (at least partially) why it wasn't there before.  THSyntax.Data
>doesn't
>| support contexts.
>|
>| Except that a diagnostic rather than death would be preferable, is
>this an
>| omission, on a todo list, or purposely left out?
>
>I think Contexts in data declarations are a mis-feature of Haskell (i.e.
>they shouldn't be there in the first place).  But I suppose that since
>they are there, TH had better support them.  To do!
>
>Simon

I suspected something like that (hence suggesting purposely left out).  This 
isn't anything that was causing me problems.  If no one else wants it, I'd 
be more than content with just an explanatory warning message: "warning: 
contexts on datatypes not supported just because" ;).  Or just silently 
accept them.

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail