I went back and forth on this, but ultimately decided to do a ground up rewrite in F#. This way there can be a clean, idiomatic F# API without having a layer of indirection under the hood and exposing unwanted or duplicate methods from C#. Another advantage I felt was that debugging through Sodium code when necessary can be done without having to leave the language being worked in. Also, the API is a bit cleaner since there is no need for methods like
Transaction.RunVoid, as F# handles
unit returning functions generically.
The implementation is written to behave as similarly as possible to the C# version performance-wise (and functionally identical), but uses native F# types in places where it makes sense (DUs, immutable objects, etc.).
Also, I should point out that there are two ways to use the API. If you only
open SodiumFRP.FSharp, then you can call functions as follows:
Alternatively, you can also
open SodiumFRP.FSharp.Sodium, which brings in unique function names for almost everything in the library as follows:
Function parameter order has been improved as well in this version to support partial application better. Superfluous types from the C# version (
Either<...>, etc.) have also been removed in favor of their F# counterparts (
option, DUs or
Let me know if you run into any issues or have any suggestions. I have ported over most of the tests so far and everything seems to be working well and I am happy with the succinctness and cleanliness of the code that can be written with this version.