[Haskell] Proposal: Allow "\=" for field update in record update syntax

Benjamin Franksen benjamin.franksen at bessy.de
Thu Feb 24 12:55:50 EST 2005


On Thursday 24 February 2005 15:01, Keean Schupke wrote:
> Having looked at the translation on page 10 of Daan's paper, I can see
> no advantage in this
> encoding, nor does it look like it supports higher ranked types in any
> way... (Infact it has the
> disadvantage of requiring a class per record, whereas the records in the
> HList paper require
> only a class per function).
>
> class Name r a | r -> a where
>     get_name :: r -> a
>     set_name :: r -> a -> r
>
> Perhaps you can explain how this does support higher ranked fields?

Sorry, I jumped to conclusions a bit too fast. I thought one could get rid of 
the newtype unwrapper if one "applied it away". But this is nonsense because 
one still has the class constraint involving the newtype. It just doesn't 
work.

I still wonder if your TH generated code can handle higher ranked field types; 
i.e. can I write

$(ttypelift [| data Record = Record {
    field1 :: Int,
    field2 :: (forall a. a-> a) } |] )

or does ghc give me an error?

Ben


More information about the Haskell mailing list