For some reason, these two functions have different types.

  fun1 f (Left x)= Left (f x)
  fun1 _ r@(Right x) = Right x

  fun2 f (Left x) = Left (f x)
  fun2 _ r = r

Is there a way to rewrite fun2 so that f has type (a->b)?
In the general case, it seems wasteful to have to destruct and construct values just for type checking reasons, especially if your type has many more constructors than (Either a b).


-Alex-

______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to