back

by eatonphil·10y ago·view on hn ↗
In OCaml, you currently need separate operators to add integers together versus adding floats together:

    (* current compiler *)
    let i8 = 4 + 4;;
    let f8 = 4.0 +. 4.0;;

    (* is possible with extension *)
    let i8 = 4 + 4;;
    let f8 = 4.0 + 4.0;;
Similarly, a separate print function was necessary for printing integers vs strings or floats. With this extension, a single polymorphic function is now possible:

    (* current compiler *)
    print_int i8;;
    print_float f8;;

    (* is possible with extension *)
    print i8;;
    print f8;;
So this extension opens up a whole new level of pretty OCaml code.