[Haskell-cafe] A backwards-compatible record proposal

Brian Hulley brianh at metamilk.com
Sat Aug 19 16:56:09 EDT 2006


Ooops! ;-)

Brian Hulley wrote:
>    module M (Rec, use) where
> 
>    import DotClasses.Dot_f    -- every class has its own module (*)
> 
>    data Rec' a = Rec a
>    newtype Rec a = Rec (Rec' a)
> 
>    instance Dot__f  (Rec' a) a where

      instance Dot_f  (Rec' a) a where

>        __dot_f (Rec' x) = x
> 
>    use :: Rec a -> (a,a)
>    use (Rec r) = use' r
> 
>    use' :: Rec' a -> (a,a)
>    use' r = (r.f, r.f)

      use' r = (__dot_f r, __dot_f r)




More information about the Haskell-Cafe mailing list