Skip to content

Instantly share code, notes, and snippets.

@TonyAbell
TonyAbell / final.tla
Created April 12, 2019 15:45 — forked from hwayne/final.tla
Formal Methods Example Spec
EXTENDS Integers, TLC, Sequences
CONSTANTS Devices
(* --algorithm BatchInstall
variables
AppScope \in [Devices -> {0, 1}];
Installs \in [Devices -> BOOLEAN];
batch_pool = {};
lock = FALSE;
@TonyAbell
TonyAbell / graph.fsx
Created October 15, 2017 19:56 — forked from mathias-brandewinder/graph.fsx
Visualize Azure Function App with F# and GraphViz
(*
Reading out bindings
*)
type Direction =
| Trigger
| In
| Out
type Properties = Map<string,string>
@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 =
@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()
# 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()
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.
cinst 1password
cinst 7zip
cinst 7zip.install
cinst AdobeAIR
cinst adobereader
cinst Atom
cinst markdownpad2
cinst autohotkey.portable
cinst beyondcompare
cinst curl
#time "on"
#load "Bootstrap.fsx"
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open Akka.TestKit
// #Using Actor

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;