[Haskell-beginners] let in GHCI
Henry Lockyer
henry.lockyer at ntlworld.com
Sun Dec 11 19:14:56 CET 2011
Hello Haskellers
Why is it that in GHCI I can do, for example,
> replicate 6 5
[5,5,5,5,5,5]
> let my6 = replicate 6
> my6 5
[5,5,5,5,5,5]
but if I do
> sort "bav"
"abv"
this is ok, but
> let mySort = sort
> mySort "bav"
<interactive>:1:8:
Couldn't match expected type `()' with actual type `Char'
Expected type: [()]
Actual type: [Char]
In the first argument of `mySort', namely `"bav"'
In the expression: mySort "bav"
and/or
> mySort [6,5,9]
<interactive>:1:13:
No instance for (Num ())
arising from the literal `9'
Possible fix: add an instance declaration for (Num ())
In the expression: 9
In the first argument of `mySort', namely `[6, 5, 9]'
In the expression: mySort [6, 5, 9]
This is eluding me at the moment..! ;-)
/ Henry
More information about the Beginners
mailing list