[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] makeFields without lenses
From:       Nicola Gigante <nicola.gigante () gmail ! com>
Date:       2014-10-05 10:56:18
Message-ID: EBD5B516-DEA6-4611-89CE-454F5E0F2674 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Il giorno 04/ott/2014, alle ore 20:02, Andrew Gibiansky <andrew.gibiansky@gmail.com> \
ha scritto:

> Nicola,
> 
> Could you be looking for the OverloadedRecordFields[0] extension? This is an \
> extension that I think is slated to be in 7.10, and might do what you want (though \
> won't help you now).  
> If you declare two data types with the same field name (e.g. data A = A { hello :: \
> Int} and data B = B { hello :: Int }), the extension will generate some typeclasses \
> and type families so that you can use `hello` on both data types. 
> (I haven't used this myself, but have been looking forward to it, so if anyone \
> wants to correct me on anything I've said please do so.) 
> [0] https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields


Yes, that extension would be exactly what I want. When GHC 7.10 comes out I’ll use it
for sure! In the meantime I hoped there was a package to overcome this but as
Dan has said, it seems it doesn’t exist.


Thank you everybody for all the answers.

Greetings,
Nicola


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space;"><br><div><div>Il giorno 04/ott/2014, \
alle ore 20:02, Andrew Gibiansky &lt;<a \
href="mailto:andrew.gibiansky@gmail.com">andrew.gibiansky@gmail.com</a>&gt; ha \
scritto:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div \
dir="ltr">Nicola,<div><br></div><div>Could you be looking for the \
OverloadedRecordFields[0] extension? This is an extension that I <i>think</i>&nbsp;is \
slated to be in 7.10, and might do what you want (though won't help you \
now).&nbsp;</div><div><br></div><div>If you declare two data types with the same \
field name (e.g. data A = A { hello :: Int} and data B = B { hello :: Int }), the \
extension will generate some typeclasses and type families so that you can use \
`hello` on both data types.</div><div><br></div><div>(I haven't used this myself, but \
have been looking forward to it, so if anyone wants to correct me on anything I've \
said please do so.)</div><div><br></div><div>[0]&nbsp;<a \
href="https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields">https://gh \
c.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields</a></div></div></blockquote></div><br><div><br></div><div>Yes, \
that extension would be exactly what I want. When GHC 7.10 comes out I’ll use \
it</div><div>for sure! In the meantime I hoped there was a package to overcome this \
but as</div><div>Dan has said, it seems it doesn’t \
exist.</div><div><br></div><div><br></div><div>Thank you everybody for all the \
answers.</div><div><br></div><div>Greetings,</div><div>Nicola</div></body></html>



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic