Question abt Num

Thomas L. Bevan thomas_bevan at toll.com.au
Thu Oct 23 15:27:29 EDT 2003


On Thu, 23 Oct 2003 12:20 pm, Pratik Bhadra wrote:
>
> data Expr = Lit1 Int | Lit2 Bool | Var String | BinOp Op Expr Expr
>
> My evaluate code is as follows...
>
> evaluate :: Expr -> Store -> Expr
>
> evaluate ( Lit1 n ) st = n
> evaluate ( Lit2 n ) st = n

A function must match its type signature and the type signature
must be consistent irrespective of the function arguments.

The first line of the evaluation has the type,
	Expr -> Store -> Int

The second line has the type,
	Expr -> Store -> Bool


Tom


More information about the Haskell mailing list