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 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?
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 type-safe.
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.
Keean.
Ben
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell
_______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
