On 06/24/2013 08:44 AM, Adam Gundry wrote: > Hi everyone, > > I am implementing an overloaded record fields extension for GHC as a > GSoC project. Thanks to all those who gave their feedback on the > original proposal! I've started to document the plan on the GHC wiki: > > http://hackage.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/Plan > > If you have any comments on the proposed changes, or anything is unclear > about the design, I'd like to hear from you. > > Thanks, > > Adam Gundry > > _______________________________________________ > Glasgow-haskell-users mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users The wiki page says:
The base design has the following distinct components:
* A library class
class Has (r :: *) (f :: String) (t :: *) where
get :: r -> t
* A record declaration generates an instance declaration for each
field. For example
data T a = T1 { x :: a, y :: Bool }
| T2 { x :: a }
would generate
instance (t~a) => Has (T a) "x" t where
get (T1 x _) = x
get (T2 x) = x
instance (t~Bool) => Has (T a) "y" t where
get (T1 _ y) = y
Is this instance for "y" not partial? If it is, is that a problem?
Perhaps I missed something that makes that instance total.
- Ollie
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Glasgow-haskell-users mailing list [email protected] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
