[Haskell-cafe] Type Directed Name Resolution
Ozgur Akgun
ozgurakgun at gmail.com
Wed Nov 10 05:59:40 EST 2010
On 10 November 2010 10:56, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
> Using TDNR, it will be possible to write the following code:
>
> data Foo = Foo { name :: String }
> data Bar = Bar { name :: String }
>
> getName :: Either Foo Bar -> String
> getName (Left f) = name f
> getName (Right b) = name b
>
> However, currently you cannot: "Multiple declarations of 'name'"
>
Oh by the way, TDNR doesn't only work for record names, yet its use for
record names is an important motivation. This was just an example. I don't
want to cause any confusion while trying simplify things.
--
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101110/346b83f1/attachment.html
More information about the Haskell-Cafe
mailing list