Re: [Haskell-cafe] Incorrectly inferring type [t]

2010-12-30 Thread Henning Thielemann
On Wed, 29 Dec 2010, william murphy wrote: Hi All, 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 nicely solve this problem in Haskell 98 using a Tree

[Haskell-cafe] Incorrectly inferring type [t]

2010-12-29 Thread william murphy
Hi All, 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] The code is: concat'' :: [a] - [b] concat'' ((y:ys):xs) = (concat'' (y:ys)) ++ (concat'' xs) concat'' []

Re: [Haskell-cafe] Incorrectly inferring type [t]

2010-12-29 Thread Brandon S Allbery KF8NH
-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

Re: [Haskell-cafe] Incorrectly inferring type [t]

2010-12-29 Thread Lennart Augustsson
First, what type would such a function have? Certainly not [a]-[b], because that type say that it can take a list of any type and turn it into a list of any other type, e.g., [Int]-[Bool]. On Thu, Dec 30, 2010 at 4:05 AM, william murphy will.t.mur...@gmail.comwrote: Hi All, I've spent a lot