[Haskell-cafe] Inheritance and Wrappers

Ozgur Akgun ozgurakgun at gmail.com
Thu Feb 3 11:19:37 CET 2011


On 3 February 2011 02:35, Brandon Moore <brandon_m_moore at yahoo.com> wrote:

> Here's one thing to consider:
>
> Can you write a function
>
> f :: (Data a) => a -> String
> f x = termTag x
>
> It would seem the Data a => Term a instance justifies
> this function, and it will always use the default instance.
>
> Now, what happens if "f" is applied to a value of some type
> T which is an instance of Data, but has a custom Term instance?
>

Great point, thanks!

I guess somehow you shouldn't be allowed to write that function "f". I need
to think about this one.

-- 
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110203/e7ff955e/attachment.htm>


More information about the Haskell-Cafe mailing list