Hacker News new | ask | show | jobs
by innguest 4085 days ago
I was a bit sleepy when I wrote the comment above. Please consider the following function as an example of what I'm talking about, instead of the confused "chevron" function above. This is make-believe C:

  MaybeInt bind (MaybeInt a, (function : int -> MaybeInt a) f)
  {
    if (a.maybe_value == JUST)
      f(a.integer);
    else
      nothing();
  }

  MaybeInt chevron (MaybeInt a, MaybeInt b)
  {
    bind(a, lambda(x){ b });
  }
/* Just 5 >>= (\x -> Just $ x + 1) */ bind( just(5), lambda(x){ just(x+1); } );