[Haskell-beginners] change to wikibook?
Ashley Smith
ashleymariesmith at gmail.com
Sat May 12 22:15:42 CEST 2012
I was wondering if someone could explain this error? I typed in the sample
code from the Haskell Beginning Wikibook to define a function for absolute
value. I have GHC 7.0.4 for OSX. The error went away when I put parentheses
around the negative value, so did the Haskell interpreter think I was
entering - and a second argument, namely 10, when the parentheses weren't
there? Thank you!
*Main> let abs x = if x < 0 then -x else x
*Main> abs 5
5
*Main> abs -10
And got the following error
<interactive>:1:6:
No instance for (Num (a0 -> a0))
arising from the literal `10'
Possible fix: add an instance declaration for (Num (a0 -> a0))
In the second argument of `(-)', namely `10'
In the expression: abs - 10
In an equation for `it': it = abs - 10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120512/1a9acf88/attachment.htm>
More information about the Beginners
mailing list