If we use the (or)
operator as originally defined, it behaves like a normal short-circuiting operator as we would expect:
# true or (failwith "!");;
val - : bool = true
But if we redefine it, it loses its lazy evaluation of the second argument:
# let (or) option default = match option with
| Some value -> value
| None -> default;;
val ( or ) : 'a option -> 'a -> 'a = <fun>
# (Some 1) or (failwith "!");;
Exception: Failure "!".
Anyone know why?