Anonymous records. A solution to the problems of record-system.

Nikita Volkov nikita.y.volkov at gmail.com
Mon Oct 14 21:01:40 UTC 2013


> It is still impossible write
>
>    type Person = (lastName::Sting, name :: String)
>    type Image = ( name :: ByteString, sizeX :: Int, sizeY :: Int )
>
>  name :: (b ~ Stirng)       => (a,b)    -> b
>  name :: (a ~ ByteString) => (a,b,c) -> a
>

I think, you misunderstood the primary part: in this proposal record fields
are accessed not with functions, but more like fields in OO languages. So
the problem of function sharing does not exist as such. E.g.:

namesOfPersonAndImage :: Person -> Image -> String
namesOfPersonAndImage person image = person.name ++ ", " ++ show image.name
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-prime/attachments/20131015/506bc1d3/attachment.html>


More information about the Haskell-prime mailing list