News for hackers. Stuff that matters.
Re:OCaml as my primary language by moi2388 on Wednesday August 13, 2025 @02:25PM (#44892011)
If I wanted to program in OCaml, id program in F# instead
Re:OCaml as my primary language by nukifw on Wednesday August 13, 2025 @02:27PM (#44892040)
Hi! Thank you for your interest (and for potentially reading this).

Yes, F# is a very nice language, however, it seems to me that I am making a somewhat forced comparison between OCaml and F# in the following section: https://xvw.lol/en/articles/why-ocaml.html#ocaml-and-f

Re:OCaml as my primary language by Smaug123 on Wednesday August 13, 2025 @02:51PM (#44892306)
You can hack up GADTs in F# - for example, https://github.com/Smaug123/WoofWare.Incremental/blob/9b8181... (which uses https://github.com/G-Research/TypeEquality ). (The other missing features I agree are missing.)
Re:OCaml as my primary language by nukifw on Wednesday August 13, 2025 @02:54PM (#44892346)
Yes, the trick is expanded here: https://libres.uncg.edu/ir/asu/f/Johann_Patricia_2008_Founda... (if you have `Eq a b = Refl : a a eq` you should be able to encode every useful GADTs. But having a compiler support is nice for specifics reason like being able to "try" to detect unreachable cases in match branches for examples.
Re:OCaml as my primary language by debugnik on Wednesday August 13, 2025 @03:08PM (#44892507)
I've used equality witnesses in F# before, they kinda work but can't match proper GADTs. First you'll need identity conversion methods on the witness, because patterns can't introduce type equalities, then you'll realise you can't refute unreachable branches for the same reason, so you still need to use exceptions.
Re:OCaml as my primary language by moi2388 on Wednesday August 13, 2025 @03:42PM (#44892897)
Thanks, that was an interesting read for sure!
Re:OCaml as my primary language by jimbob45 on Wednesday August 13, 2025 @03:26PM (#44892704)
It's always weird when Microsoft pulls an "embrace, extend, extinguish" but the "extinguish" part happens without their involvement or desire and then we're all stuck wondering how Microsoft got left holding the bag.