[Haskell-cafe] Data structure containing elements which are instances of the same type class

Antoine Latter aslatter at gmail.com
Sat Aug 11 21:01:38 CEST 2012

It should be pretty easy to write an adapter function of type "String ->
(Show a => a)".
On Aug 11, 2012 12:34 PM, "Patrick Palka" <patrick at parcs.ath.cx> wrote:

> On Sat, Aug 11, 2012 at 4:14 AM, <oleg at okmij.org> wrote:
>> I'd like to point out that the only operation we can do on the first
>> argument of MkFoo is to show to it. This is all we can ever do:
>> we have no idea of its type but we know we can show it and get a
>> String.
> That's not all you can do: you can also pass the first argument of MkFoo
> to a function that expects a Show a => a argument, like the function
> 'print'. Can you do that with just a String (that represents show x for
> some x)?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120811/d8cf6d0b/attachment.htm>

More information about the Haskell-Cafe mailing list