[Haskell-cafe] Incorrectly inferring type [t]

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Thu Dec 30 04:16:56 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/29/10 22:05 , william murphy wrote:
> I've spent a lot of time trying to write a version of concat, which
> concatenates lists of any "depth":
> So:
> concat'' [[[1,2],[3,4]],[[5]]]               would return: [1,2,3,4,5]

You can't do that, at least with a normal type signature.  There might be
some evil that can do it, but (as you found) if you try to do it naively you
will get an error which amounts to "this type can't represent both an item
and a list of that item at the same time".

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0b+Z0ACgkQIn7hlCsL25WFCQCeNkSf0+1pyJI+rpBWtk3uBsv5
qosAoIRQQyg78IPlHuQiiVleqmYUdQD+
=lOjO
-----END PGP SIGNATURE-----



More information about the Haskell-Cafe mailing list