Could not deduce (Num int) from the context ()
edwin ancaer
edwin.ancaer at pandora.be
Fri Nov 13 15:29:38 EST 2009
Hello,
I'vo got the following code in leksah:
----------------------------------------------------------------------------
--
-- Module : Main
-- Copyright :
-- License : AllRightsReserved
--
-- Maintainer :
-- Stability :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------
module Main (
) where
firstfunction :: int -> int
firstfunction a = a * a
main = putStrLn (show ( firstfunction 5 ))
Could you please explain why I get the error below, and what does it
mean? I copied the function definition from Yet another Haskell
tutorial, page 45 (it's called square there).
src/Main.hs:20:20:
Could not deduce (Num int) from the context ()
arising from a use of `*' at src/Main.hs:20:20-24
Possible fix:
add (Num int) to the context of
the type signature for `firstfunction'
In the expression: a * a
In the definition of `firstfunction': firstfunction a = a * a
More information about the Leksah
mailing list