3 ms·
> In languages that don’t have typeclasses, you need to take special steps to ensure that you dispatch to the proper variant of the monad. You might want to ta
by munchler 2y ago
> In languages that don’t have typeclasses, you need to take special steps to ensure that you dispatch to the proper variant of the monad.
You might want to take a look at F#, which has no typeclasses (yet) but does have excellent first-class support for monadic syntax via "computation expressions".
https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/computation-expressions https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
- williamcotton 2y agoHere's something I whipped up to show an example of a ResultWriter monad using computation expressions in F#. I'm sure there are some slightly better interfaces than this, and I wouldn't mind a code review if anyone is feeling helpful! https://gist.github.com/williamcotton/95ebc21965e393f4c99a597b0c6f36cf https://gist.github.com/williamcotton/95ebc21965e393f4c99a59...
- fire_lake 2y agoYou can probably use a more efficient data structure than a singly linked list for logs Maybe a “string list list”?