[Haskell-cafe] Signature of a function
jules at jellybean.co.uk
Tue Jan 11 10:08:08 EST 2005
On 11 Jan 2005, at 14:49, Dmitri Pissarenko wrote:
> activityIndicator :: Customer -> Num
> activityIndicator (Customer id purchases) = length purchases
> When I try to load this module into GHCi, I get this error:
Hint: Don't put signatures on functions, then. Instead, let the
compiler infer the type for you! If you want to know what the type is,
ask GHCi with :info. And if you think it is helpful documentation, you
can copy-paste the correct signature from ghci into your source code!
There are actually cases when the type inferred will be more general
than you want, and in these cases you will want an explicit signature.
But that will probably be fairly rare.
More information about the Haskell-Cafe