<div dir="ltr">With ConstraintKinds, ExistentialQuantification, StandaloneDeriving and FlexibleInstances, this works:<br>>>> data Some f = forall a. f a => Some a<br>>>> deriving instance Show (Some Show)<br>
>>> show ([Some [0..10], Some (), Some Nothing, Some "asdf"] :: [Some Show])<br>"[Some [0,1,2,3,4,5,6,7,8,9,10],Some (),Some Nothing,Some \"asdf\"]"<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, May 28, 2013 at 6:04 PM, Magnus Therning <span dir="ltr"><<a href="mailto:magnus@therning.org" target="_blank">magnus@therning.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, May 28, 2013 at 9:36 AM, harry <<a href="mailto:voldermort@hotmail.com">voldermort@hotmail.com</a>> wrote:<br>
> Every OO language which supports generics allows a declaration such as<br>
> List<Show> alist, where Show is an interface. Any type implementing Show can<br>
> be put in alist, and any Show operation can be performed on the alist's<br>
> members. No casts, wrappers, or other special types and plumbing are needed.<br>
><br>
> Why isn't it possible to do this directly in Haskell?<br>
<br>
</div>Just to make sure... I guess you've already read<br>
<a href="http://www.haskell.org/haskellwiki/Heterogenous_collections" target="_blank">http://www.haskell.org/haskellwiki/Heterogenous_collections</a> right?<br>
<br>
/M<br>
<br>
--<br>
Magnus Therning OpenPGP: 0xAB4DFBA4<br>
email: <a href="mailto:magnus@therning.org">magnus@therning.org</a> jabber: <a href="mailto:magnus@therning.org">magnus@therning.org</a><br>
twitter: magthe <a href="http://therning.org/magnus" target="_blank">http://therning.org/magnus</a><br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>