type Either<'l, 'r> = abstract cata : ('l -> 'a) -> ('r -> 'a) -> 'a let left x = { new Either<_, _> with member this.cata l r = l x } let right x = { new Either<_, _> with member this.cata l r = r x } System.Console.WriteLine((right "lol").cata (fun _ -> "") id)