GHC support for the new "record" package

Dan Doel dan.doel at gmail.com
Wed Jan 21 17:36:05 UTC 2015


On Wed, Jan 21, 2015 at 11:48 AM, Simon Marlow <marlowsd at gmail.com> wrote:

> 2) Anonymous records are nice to have, but I don't want to have all
>> records be anonymous (and have to jump through newtype hoops to get back
>> non-anonymous records.)
>>
>
> So right now you have to say
>
> data T = R { a :: Int }
>
> and with anonymous records you could say
>
> data T = R {| a :: Int |}
>
> (or something similar).  That doesn't seem like jumping through hoops,
> it's exactly the same amount of syntax.  If you're worried about the extra
> layer of boxing (quite reasonable) then either (a) use a newtype, if
> possible, or (b) we could consider automatic UNPACKing of records used in a
> constructor argument.
>

​In the first of these declarations, we automatically have: a :: T -> Int

Do we get that automatically in the second? Or do we have to write out all
the field accessors, etc. we want to derive on T (and, can we do that)?

I assume things like that are the concern for "non-anonymous records."

-- Dan​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20150121/9316b343/attachment-0001.html>


More information about the ghc-devs mailing list