Hacker News new | ask | show | jobs
by yawaramin 2481 days ago
BuckleScript (ReasonML's-to-JavaScript compiler) has an annotation that automatically creates functions from variant constructors. E.g.:

    [@bs.deriving {accessors}]
    type msg =
    | Increment
    | Decrement
    | Reset
    | Set(int);

    let action = set(2);