Re: template haskell (reify bug and existentials)

Keean Schupke <[email protected]>
Newsgroups gmane.comp.lang.haskell.template
Message-ID <[email protected]>
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
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.