Snippets tagged monad
Uri Parser
A Uri parser using the Cashel library [1]. This implementation is using ArraySegment<byte> as the underlying state, as I'm using it within a server, but it would be trivial to switch it to using a list. Also, note that I am not parsing the Uri into any specific structure, though that, too, would be trivial. For my current purposes, I just needed to validate the Uri. [1] https://github.com/panesofglass/cashel
20 people like this
Posted: 1 years ago by Ryan RileyDisposable computation builder
Computation builder that provides easy way of constructing IDisposable objects. It supports elegant composition of disposable objects using 'do!' which can be used for example when working with 'IObservable' type.
27 people like this
Posted: 1 years ago by Tomas PetricekLazyBuilder
I made LazyBuilder. The synthesis of the lazy function is troublesome. When the call of the Force() method increases, it is ugly. This solves the problem.
8 people like this
Posted: 10 months ago by zeclTiny IO Monad
Haskell-style IO in F#.
6 people like this
Posted: 10 months ago by igetaContinuation Monad with Call/CC
This is an implementation of the Continuation monad using a type, taking an exception handler, and allowing for Call/CC. This specific implementation is mostly Matt Podwysocki's. I have a similar implementation using a purely functional, exception-handler-less version in FSharp.Monad. Until now, I haven't been able to resolve the callCC operator.
3 people like this
Posted: 9 months ago by Ryan RileyMonadic Retry
A Monad for composing computations with retry logic. (Useful when we work with Cloud Services)
6 people like this
Posted: 7 months ago by Nick PalladinosNon-deterministic computation builder
Computation builder for writing non-deterministic computations.
7 people like this
Posted: 6 months ago by Tomas Petricek
Simple typeclass implementation
I learned how to implement this by reading this great good project http://code.google.com/p/fsharp-typeclasses/ But I can't understand why the project needs ternary operator. I used binary operator and seems it's okay.
2 people like this
Posted: 5 months ago by nagat01Polymorphic Maybe monad with default value.
Polymorphic (via generics) Maybe monad/computational expression with default value + Zipper
4 people like this
Posted: 2 months ago by DaniilDelimited Continuation Monad
Oleg's delimited continuation monad [1] and creating an external iterator from an internal iterator using it. [1] http://okmij.org/ftp/continuations/implementations.html#genuine-shift
3 people like this
Posted: 8 months ago by einblickerException Retry Computation Expression
Retry monad: chaining functions together, retrying each one if exceptions are thrown, until the first time a function can no longer be retried
2 people like this
Posted: 2 months ago by Boris KoganSimple builder example: Nullable
Simple Computational expressions / monad / builder -example, using .NET Nullable as demo.
3 people like this
Posted: 28 days ago by Tuomas HietanenTraits, Mixins and Aspect-Oriented Programming in F#
A compositional type system built using generics and monads in F#. It is only a very limited, _toy_ project exploring traits, mixins and aspect-oriented programming.
11 people like this
Posted: 5 days ago by Zach Bray