3 ms·
I mostly agree about mutually recursive types, but I really hate having to keep my files ordered in the project honestly. It might be my least favorite thing a
by algorithmsRcool 8y ago
I mostly agree about mutually recursive types, but I really hate having to keep my files ordered in the project honestly.
It might be my least favorite thing about F# (Except that Option<T> is a class not a struct)
- piaste 8y ago> Except that Option<T> is a class not a struct There is ValueOption<T> now. It's a mouthful and you'll still have to deal with all the standard library, or other third-party libraries, which produces and consumes Option<T>, but you can address that with some aliases and conversion operators if you want to go all-in: type 't voption = ValueOption<'t> type VOption<'t> = ValueOption<'t> let inline (!) opt = if System.Object.ReferenceEquals(opt, null) then ValueNone else match opt with None -> ValueNone | Some x -> ValueSome x let inline (?) vopt = match vopt with ValueNone -> None | ValueSome x -> Some x;; // usage let x = !(List.tryFind (fun x -> x = 0) [1]);; // [<Struct>] val x : int voption = ValueNone
- konamicode 8y agoThere is Mechanic (https://github.com/fsprojects/Mechanic https://github.com/fsprojects/Mechanic), an OSS project that's meant to take away some of the pain, though I don't have any experience using it and I'm not aware of how useful it is in practice.