[Haskell-cafe] Signature of a function
Dmitri Pissarenko
mailing-lists at dapissarenko.com
Tue Jan 11 09:49:48 EST 2005
Hello!
I have a function activityIndicator, which has an argument of class Customer
and should return a numeric value.
The module is defined as follows.
<module-definition>
data Purchase = Purchase { price, rebate :: Double }
deriving (Show, Eq)
data Customer = Customer { id :: Int, purchases :: [Purchase] }
activityIndicator :: Customer -> Num
activityIndicator (Customer id purchases) = length purchases
</module-definition>
When I try to load this module into GHCi, I get this error:
<error-message>
Class `Num' used as a type
In the type: Customer -> Num
While checking the type signature for `activityIndicator'
</error-message>
When I remove the line
activityIndicator :: Customer -> Num
the error disappears.
What is wrong in the signature above?
TIA
Dmitri Pissarenko
More information about the Haskell-Cafe
mailing list