[Haskell-beginners] Heterogeneous Lists
Mateusz Kowalczyk
fuuzetsu at fuuzetsu.co.uk
Tue May 28 15:50:21 CEST 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 28/05/13 14:41, harry wrote:
> Magnus Therning <magnus <at> therning.org> writes:
>
>> Just to make sure... I guess you've already read
>> http://www.haskell.org/haskellwiki/Heterogenous_collections
>> right?
>
> Yes, I'm asking why Haskell doesn't allow this directly. I'm
> already using a workaround.
>
>
> _______________________________________________ Beginners mailing
> list Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
Simply because Haskell's lists are a homogeneous data structure by nature.
Consider:
data List a = Nil | Cons a List
It doesn't do heterogeneous lists by default because it was never
meant to. I don't see where the disappointment comes from. It's the
same in majority of typed languages. I don't see why you would expect
to be able to make have a heterogeneous list because you can do it
with interfaces in some other language. To begin with, typeclasses are
not interfaces.
Just so you know, you're probably doing it wrong if you're using `a
workaround' to have a heterogeneous list.
- --
Mateusz K.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iQIcBAEBAgAGBQJRpLYdAAoJEM1mucMq2pqXzGIQAK4YapHZdtTdfUbFCZc90MF6
KbE5NmXswaKfgf+OU5Cs7fGG0dZahmeAEhFpZBVEUlnKXGT9hGiFQj7cm/4hK881
kGHWq5WlqGuzdnD9iTEG+IcLsqXQA1ZArObOFB2VL7dSzQHPhKHpnIshzID4osN6
QBo7fYvQ9H2Ng0sf5Cuo88ck0VGxKxvDPG8cg/6SpjH1EdPg3LlPiEYnZJoKbDnM
G82IFctzANYuFbIXclD/DK6dlv/6newAR1Q5zXCD9ZQJv7y2z0mhA4gjbb4fUNGb
3y0wkj+srC6skC/1g871cQRC6u0aRSdGKYZIs2SwlKKFwUGftLlnq/KQukYuYuWi
HB8H+jm3/tQDZEius9umVlQN6c56pglh+gY8p9bnAqOsw8gfSeM5qlEggSCs5wIh
BpQBEOANMUKZRiRGrmx2FEl8IwdRcf5LUStFiI0EpabZDTpRQVRuG3K/LZpZS0em
UPOfP/X0jDZAhxb/iiR91F+DnpzWrMkteP4mqQ9GpqY2RmXY3jw3B/1uC41mX17v
NWfUULp4rRtcMPn2OvXYn28r3sCCO5D78rcGk2uv7Mmnb2HFq99XiaQG3Q7pzaB0
O4wePLuwFPZqefFuIl8WM68qjYFBeUJkOR3ik3Q1V2SftLMy8kFnDdz80DykOODw
2Sw+0P1Dyxk45ENu+Fry
=rpvr
-----END PGP SIGNATURE-----
More information about the Beginners
mailing list