template haskell (reify bug and existentials)
Re: my two earlier postings: 1) existentials in data declarations. I have a project which needs this, Simon PJ thought it was fairly easy to put in and suggested that Ian Lynagh might implement it. Do I need to persuade people further? Will it get done now? Some feedback as to whether it might get done would be nice... Just to clarify I want to do: $(something [d| data A = forall a . A a |] 2) reification of functions (and other primitives)... want to do something like: reify ''(->) Fails because reify/Info does not support reifying primitives. There is already support in the Type type for primitive types (-> (,,) []) so the obvious way to add this is to alter Info to: data Info = ClassI Dec | ClassOpI Name Type Name Fixity | TyConI Dec | PrimTyConI Type | DataConI ... So what are the chances of getting these changes implemented. I need them for a current project, and would appreciate it if someone who knows the inner workings of template-haskell could implement the changes in the CVS HEAD branch of GHC. Failing that I am prepared to have a go myself, but I want to make sure that nobody else is likely to do it first.
On Sat, Oct 30, 2004 at 03:01:02PM +0100, Keean Schupke wrote:
Re: my two earlier postings:
1) existentials in data declarations. I have a project which needs this, Simon PJ thought it was fairly easy to put in and suggested that Ian Lynagh might implement it. Do I need to persuade people further?
No - I've just got back from a conference with poor 'net access, so have only just read your original message. I should get to this RSN. Thanks Ian
Great! You have no idea how much I have been confusing people by using local universal quantification to stand for existential quantification... Regards, Keean. Ian Lynagh wrote:
On Sat, Oct 30, 2004 at 03:01:02PM +0100, Keean Schupke wrote:
Re: my two earlier postings:
1) existentials in data declarations. I have a project which needs this, Simon PJ thought it was fairly easy to put in and suggested that Ian Lynagh might implement it. Do I need to persuade people further?
No - I've just got back from a conference with poor 'net access, so have only just read your original message. I should get to this RSN.
Thanks Ian
Ian, What are the chances of getting fundeps added to class declarations? I only need to generate them so support in the syntax and pretty-printer is all that is required... Here are the changes I have made to my local copy to get it working. I suppose this breaks existing code! Perhaps you would rather have a new constructor for classes with fundeps? Keean in Syntax.hs: ... type Fundep = ([Name],[Name]) -- add to export list ... | ClassD Cxt Name [Name] [Dec] [Fundep] in Ppr.hs: ... ppr (ClassD ctxt c xs ds fd) = text "class" <+> pprCxt ctxt <+> ppr c <+> hsep (map ppr xs) <+> pprFd fd $$ where_clause ds ... pprFd :: [Fundep] -> Doc pprFd fds@(_:_) = char '|' <+> hsep (punctuate comma $ map (\(l,r) -> (hsep $ map ppr l) <+> text "->" <+> (hsep $ map ppr r)) fds) pprFd _ = empty in Lib.hs ... classD :: CxtQ -> Name -> [Name] -> [DecQ] -> [Fundep] -> DecQ classD ctxt cls tvs decs fd = do decs1 <- sequence decs ctxt1 <- ctxt return $ ClassD ctxt1 cls tvs decs1 fd Ian Lynagh wrote:
On Sat, Oct 30, 2004 at 03:01:02PM +0100, Keean Schupke wrote:
Re: my two earlier postings:
1) existentials in data declarations. I have a project which needs this, Simon PJ thought it was fairly easy to put in and suggested that Ian Lynagh might implement it. Do I need to persuade people further?
No - I've just got back from a conference with poor 'net access, so have only just read your original message. I should get to this RSN.
Thanks Ian
[Existentials should work in the CVS head now] On Tue, Nov 02, 2004 at 12:18:51PM +0000, Keean Schupke wrote:
Ian, What are the chances of getting fundeps added to class declarations? I only need to generate them so support in the syntax and pretty-printer is all that is required... Here are the changes I have made to my local copy to get it working. I suppose this breaks existing code! Perhaps you would rather have a new constructor for classes with fundeps?
We have so far taken the attitude that it is better to get a cleaner interface than to protect old code, so I think the same principle should apply here.
in Syntax.hs: ... type Fundep = ([Name],[Name]) -- add to export list
Experience has suggested that data Fundep = FunDep [Name] [Name] is more convenient as it allows you to make class instances for it.
| ClassD Cxt Name [Name] [Dec] [Fundep]
I think ClassD Cxt Name [Name] [Fundep] [Dec] is nicer as it matches the concrete syntax order. Has anyone got any objections to this (in particular the breaking existing code aspect)? Thanks Ian
participants (2)
-
Ian Lynagh -
Keean Schupke