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

Keean Schupke k.schupke at imperial.ac.uk
Thu Feb 24 13:51:11 EST 2005

Benjamin Franksen wrote:

>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 
>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?
Well at the moment this would give an error, but remember the
list is heterogeneous, so you can just not give the list a type, and
simply append the specific function... admitedly this is not as

hUpdateAtLabel field2 someFunction myRecord

Of course if the type of the function is unknown until runtime, we have
to use existential quantification.

It might be possible to automatically wrap such types, but my feeling at
the moment is that it is best left to the programmer.


>Haskell mailing list
>Haskell at haskell.org

More information about the Haskell mailing list