[Haskell] Proposal: Allow "\=" for field update in record update
syntax
Benjamin Franksen
benjamin.franksen at bessy.de
Wed Mar 2 19:11:57 EST 2005
On Thursday 24 February 2005 23:27, Keean Schupke wrote:
> Benjamin Franksen wrote:
> > Automatic wrapping is easy. What is not so easy and I think not even
> > possible, is automatic _un_wrapping, so that the wrapping isn't exposed
> > at all to the programmer.
>
> One way to do this is to replace the type with a pair:
>
> data Wrap a = Wrap {unwrapA :: a}
>
> wrap a = (unwrapA,Wrap a)
>
> so to unwrap do:
>
> unwrap a = (fst a) (snd a)
This is extremely cool. The type of unwrap is indeed general enough.
Unfortunately, it doesn't help, because the result type of wrap
Wrap (forall a. a -> a)
still isn't accepted in an instance declaration. Neither is the pair
(unwrap, Wrap (forall a. a -> a))
Or maybe I have not quite understood what you proposed to do with these
definitions.
Ben
More information about the Haskell
mailing list