[Haskell-cafe] strange error message

Ivan Perez ivanperezdominguez at gmail.com
Thu Mar 27 11:28:33 UTC 2014


Hi,

My two cents:

What is the type of head?
What is the type of length?
What is the type of length.head?
What is the type of r?

Best

Ivan


On 27 March 2014 02:36, Semen Trygubenko / Семен Тригубенко <
semen at trygub.com> wrote:

> Dear Haskell-Cafe,
>
> Every now and then I get error messages when compiling Haskell code :).
> Sometimes of the sort:
>
> test.hs:10:15:
>     Couldn't match type `[[a2]]' with `Int'
>     Expected type: Int -> Int
>       Actual type: [[a2]] -> Int
>     The function `length . head' is applied to one argument,
>     but its type `[[a2]] -> Int' has only one
>     In the first argument of `(==)', namely `(length . head) r'
>     In the expression: (length . head) r == 0
>
> Is the middle part of the error message
>
> (The function `length . head' is applied to one argument,
> but its type `[[a2]] -> Int' has only one)
>
> expected to be confusing like that sometimes?
>
> The line in question, FWIW, is
>
> Right r -> if (length . head) r == 0
>
> It appears as one of the two entries in a case statement, pattern matching
> on Right constructor.
>
> Many thanks,
> S.
>
>
>
> --
> Семен Тригубенко http://trygub.com
>
> _______________________________________________
> 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/20140327/2e1ac90c/attachment.html>


More information about the Haskell-Cafe mailing list