
6 Oct
2007
6 Oct
'07
5:12 p.m.
oleg@pobox.com 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.