Snippets created by Ryan Riley

  • NUnit Sugar

    Some simple functions for writing more idiomatic F# tests with NUnit.

    90 people like this

    Posted: 13 years ago by Ryan Riley

  • Dictionary extensions

    Extensions to dictionaries.

    36 people like this

    Posted: 13 years ago by Ryan Riley

  • Async to IObservable

    Wraps an Async as an IObservable to allow easier consumption by other .NET languages. Many thanks to desco for his help: http://cs.hubfs.net/forums/thread/16545.aspx

    5 people like this

    Posted: 13 years ago by Ryan Riley

  • Composable WCF Web API using Async

    A functional wrapper around the new WCF Web APIs (http://wcf.codeplex.com/). Composition is achieved through the use of the HttpRequestMessage -> Async signature. Pushing the app calls in the MessageHandler intercepts all requests and allows you to take control at the earliest point possible before operation selection occurs. Extending this slightly to call the innerChannel's SendAsync would allow you to create a middleware layer that would work both with this and other, normal Web API services.

    57 people like this

    Posted: 13 years ago by Ryan Riley

  • Iteratee

    An iteratee based on https://john-millikin.com/software/enumerator/ and http://okmij.org/ftp/Haskell/Iteratee/IterateeIO-talk-notes.pdf

    8 people like this

    Posted: 13 years ago by Ryan Riley

  • JoinList

    A JoinList is a variation on the list type that offers a constant time append operation.

    5 people like this

    Posted: 13 years ago by Ryan Riley

  • Continuation 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.

    4 people like this

    Posted: 13 years ago by Ryan Riley

  • F#-friendly SocketAsyncEventArgs

    The name is a bit trying, but the overall callback approach greatly simplifies the mechanism for calling and handling the System.Net.Sockets.Socket Async methods.

    0 people like this

    Posted: 13 years ago by Ryan Riley

  • Fun with Ping and Pong

    Yet another ping pong sample with agents.

    5 people like this

    Posted: 12 years ago by Ryan Riley

  • Async Primitives

    A set of Async primitives as described by Dave Thomas [1] (and derived from Stephen Toub [2]). [1] http://moiraesoftware.com/blog/2012/04/22/back-to-the-primitive-ii/ [2] http://blogs.msdn.com/b/pfxteam/archive/2012/02/11/10266923.aspx

    2 people like this

    Posted: 12 years ago by Ryan Riley

  • ManyProc

    Demonstration of the manyproc sample from Erlang using F# MailboxProcessor.

    3 people like this

    Posted: 10 years ago by Ryan Riley

  • Parallel Sitemap Test Runner

    A sitemap-based url tester that runs in parallel.

    43 people like this

    Posted: 13 years ago by Ryan Riley

  • F# SRTP of Type Classes from OO Perspective

    Similar to http://fssnip.net/7Tr, this implementation translates the Scala from https://functional.works-hub.com/blog/Type-classes-from-OO-perspective but uses statically resolved type parameters to show how something similar could be done with computation expression instances. It's really too bad you have to pass an instance of the implementation. It would be nice to be able to specify a module or class with a static member.

    3 people like this

    Posted: 7 years ago by Ryan Riley

  • EnumerableStream

    A lazy enumerable/stream of bytes.

    9 people like this

    Posted: 13 years ago by Ryan Riley

  • Async TCP Server

    A basic, asynchronous TCP server

    41 people like this

    Posted: 13 years ago by Ryan Riley

  • Uri Parser

    A Uri parser using the Cashel library [1]. This implementation is using ArraySegment 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

    26 people like this

    Posted: 13 years ago by Ryan Riley

  • Sequence Generator from Async

    Generates a sequence using a sequence generator and Async.StartWithContinuations. This is an attempt at modeling the OWIN delegate structure in F#

    6 people like this

    Posted: 13 years ago by Ryan Riley

  • ByteString

    An initial attempt at creating a ByteString type based on the Haskell version.

    4 people like this

    Posted: 13 years ago by Ryan Riley

  • IterateeCPS

    An iteratee that uses continuation-passing style as an optimization. There is no more discriminated union, and the signature should feel familiar to those using Async.StartWithContinuations.

    5 people like this

    Posted: 13 years ago by Ryan Riley

  • Call/CC for Async

    An implementation of call-with-current-continuation for Async.

    2 people like this

    Posted: 13 years ago by Ryan Riley

  • Circular Buffer

    A Circular, or Ring, Buffer that flattens incoming arrays and allows consumers to take arbitrary-sized chunks. Improvements and suggestions welcome. Fork my gist at https://gist.github.com/1648579.

    7 people like this

    Posted: 12 years ago by Ryan Riley

  • Ping and Pong go Chunking Along

    Parameterizing pong allows us to do even more fun things. Here we use a few message types to allow stateful consumption of data sent by ping to its pongs.

    3 people like this

    Posted: 12 years ago by Ryan Riley

  • Fun with FizzBuzz

    Lazily generate fizzbuzz results and provide a test function. Parameterize the inputs and predicates.

    1 people like this

    Posted: 10 years ago by Ryan Riley

  • Web API AsyncApiActionInvoker

    Overrides the standard Web API ApiControllerActionInvoker with one that works with controller actions return F# Async<'T> results.

    5 people like this

    Posted: 9 years ago by Ryan Riley

  • F# version of Type Classes from OO Perspective

    This is the F# translation of the Scala program written for https://functional.works-hub.com/blog/Type-classes-from-OO-perspective. F# doesn't have implicits, so type classes don't work. However, it's interesting to see just how close you can come by passing an instance of the implementation. By flipping the parameters, you can use partial application to create type-specific functions. Here, we follow the use of the interface, but we could also use statically resolved type parameters to structurally infer different implementations.

    4 people like this

    Posted: 7 years ago by Ryan Riley