[EMAIL PROTECTED] wrote:
> we might attempt to write
> 
>> testr = either (error) (ev) (typecheck env0 te3)
>>  where ev (TypedTerm t e) = sin (eval e)
> 
> We know that it should work.

If we know it has to be a Double, we can express that:

> testr = either (error) (ev) (typecheck env0 te3)
>  where ev (TypedTerm TDouble e) = sin (eval e)

and this compiles. Of course, we can consider the other types as well:

> testr = either (error) (ev) (typecheck env0 te3)
>   where ev (TypedTerm TDouble e) = Right $ sin (eval e)
>         ev _ = Left "not a Double"

Zun.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to