[Haskell-cafe] Function that put elements in Left or Right side of Either depending on type

Richard A. O'Keefe ok at cs.otago.ac.nz
Fri Mar 4 05:19:08 UTC 2016


On 4/03/16 4:04 am, Kristoffer Føllesdal wrote:
> I want a function fun :: q -> Either a b where q is of type a or b.  fun shall work in the following way
>
> fun x    gives    Left x     if x :: a
> fun x    gives    Right x   if x :: b

What does "fun 0 :: Either Int Int" do?



More information about the Haskell-Cafe mailing list