News for hackers. Stuff that matters.
Re:Get rid of boolean function parameters by dklsf on Monday June 15, 2015 @07:32AM (#9718678)
Ocaml can do this

  let do_something (thing : Thing.t) (logging : [`With_logging | `No_logging])  =
  ...
Even better, it can even infer the type based on you using it (for example matching on it):

  let do_something thing logging =
    let logging_as_bool = 
      match logging with
      | `With_logging -> true
      | `No_logging -> false
    in
    ....

There are no comments on this comment yet.