Skip to content

Instantly share code, notes, and snippets.

type CarsController() =
inherit ApiController()
let values = [| { Make = "Ford"; Model = "Mustang" }; { Make = "Nissan"; Model = "Titan" } |]
/// Gets all values.
member x.Get() =
let ok = x.Ok(values)
let badRequest (msg:string) = x.BadRequest(msg)
async {

There is a great purely functional streaming/IO library in Scala called scalaz-stream. It is itself based upon a Haskell library called machines. They provide powerful abstractions to express compositional effectful computations. These libraries rely on certain type system features in both Scala and Haskell which are unavailable in F# - namely existential types and higher kinds. Higher kinds allow the monad representing the side-effects to be abstracted over. If however we specialize this to a specific monad, we can get around the lack of existentials as well.

Tomas Petricek created a type called asynchronous sequence which provides similar capabilities. The F# AsyncSeq type is declared as follows:

type AsyncSeq<'a> = Async<AsyncSeqInner<'a>>

and AsyncSeqInner<'a> = 
    | Nil
 | Cons of 'a * AsyncSeq&lt;'a&gt;
#time "on"
#load "Bootstrap.fsx"
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open Akka.TestKit
// #Using Actor
cinst 1password
cinst 7zip
cinst 7zip.install
cinst AdobeAIR
cinst adobereader
cinst Atom
cinst markdownpad2
cinst autohotkey.portable
cinst beyondcompare
cinst curl
@TonyAbell
TonyAbell / Boxstarter
Last active August 29, 2015 14:13
Boxstarter Script
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst fiddler4
cinst git.install
cinst git-credential-winstore
cinst console-devel
cinst sublimetext3
cinst atom

Keybase proof

I hereby claim:

  • I am tonyabell on github.
  • I am tonyabell (https://keybase.io/tonyabell) on keybase.
  • I have a public key whose fingerprint is 01E2 3F4C D477 91D6 2DE6 C236 4DD6 0F21 174B D818

To claim this, I am signing this object:

I'll try to illustrate the process for doing this by describing what I do.
First, you get your fork of Akka.NET - everything is cool.
Next, you clone it to your machine. Right now your "origin" is set to your local fork.
If Github for Windows doesn't do this for you automatically, you'll need to add a second remote to your local copy of your Akka.NET repository - one that points to the main repository (akkadotnet/akka.net)
git remote add upstream git@github.com:akkadotnet/akka.net.git
Now let's say you want to add a new feature - first thing you need to do is create a new feature branch. Don't work directly off of dev.
# Insert code here to change to directory where you wish to download videos if you so desire
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://s.ch9.ms/Events/dotnetConf/2015/RSS/mp4high"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = "- " + $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
$file = $file.trim()
@TonyAbell
TonyAbell / suave-on-service-fabric.fs
Last active August 29, 2015 14:27 — forked from isaacabraham/suave-on-service-fabric.fs
Hosting Suave in Azure Service Fabric
open Microsoft.ServiceFabric.Services
open Suave
open Suave.Http.Successful
open Suave.Web
open System.Fabric
open System.Threading
open System.Threading.Tasks
type SuaveService() =
inherit StatelessService()
@TonyAbell
TonyAbell / AlgorithmW.fs
Last active September 5, 2015 23:28 — forked from praeclarum/AlgorithmW.fs
Algorithm W - or Hindley-Milner polymorphic type inference - in F#
module AlgorithmW
// HINDLEY-MILNER TYPE INFERENCE
// Based on http://catamorph.de/documents/AlgorithmW.pdf
type Lit =
| LInt of int
| LBool of bool
type Exp =