Skip to content

Instantly share code, notes, and snippets.

@panesofglass
panesofglass / frankdsl.fs
Created May 29, 2011 22:12 — forked from Talljoe/frankdsl.fs
DSL notes from ALT.NET Seattle
// Possible DSLs for Frank
// Pattern matching of some sort
// Can't short-circuit the match when a method isn't supported
// Must have a default handler
// Hard to make sensible DSL
"/users/{id}" Resource<User> (fun method ->
match method with
| GET id -> {}
| POST user -> {}
namespace Pipelets
open System
open System.Reflection
open System.Collections.Concurrent
open FSharp.Control
[<AutoOpen>]
module AsyncOperators =
let inline (>>=) m f = async.Bind(m, f)
let inline mreturn x = async.Return(x)
#if INTERACTIVE
#r "Microsoft.CSharp.dll"
#endif
open System
open System.Dynamic
open System.Linq.Expressions
open System.Reflection
open System.Runtime.CompilerServices
open Microsoft.CSharp.RuntimeBinder
module My.Blogs
open System
open System.Collections.Generic
open System.Web
open IntelliFactory.WebSharper.Sitelets
type Id = int
type Html = string
@panesofglass
panesofglass / OwinDraft2.fs
Created December 28, 2010 04:50 — forked from bvanderveen/OwinDraft2.cs
An alternate definition of the OWIN specification based on RFC3875
namespace Owin
open System
open System.Collections.Generic
open System.Threading.Tasks
type Request = IDictionary<string, obj>
type Response = string * IDictionary<string, seq<string>> * seq<obj>
type Application = Func<Request, Task<Response>>
namespace Owin
{
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
public interface IResponseHandler
{
Type TypeToHandle { get; }
@panesofglass
panesofglass / ContinuationMonad.fs
Created October 15, 2010 21:59 — forked from mattpodwysocki/ContinuationMonad.fs
Continuation monad with callCC
type Cont<'a,'r> =
abstract Call : ('a -> 'r) * (exn -> 'r) -> 'r
let private protect f x cont econt =
let res = try Choice1Of2 (f x) with err -> Choice2Of2 err
match res with
| Choice1Of2 v -> cont v
| Choice2Of2 v -> econt v
let runCont (c:Cont<_,_>) cont econt = c.Call(cont, econt)
load_assembly 'System.Core'
load_assembly 'System.CoreEx, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
load_assembly 'System.Reactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
using_clr_extensions System
using_clr_extensions System::Linq
include System
include System::Linq
@panesofglass
panesofglass / WinForms.rb
Created June 10, 2010 04:57 — forked from mattpodwysocki/WinForms.rb
Rx in IronRuby
require 'System.CoreEx, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
require 'System.Interactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
require 'System.Reactive, Version=1.0.2521.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
require 'System.Windows.Forms'
include System
include System::Collections::Generic
include System::Linq
include System::Windows::Forms
module FsJson
open System
open System.Text.RegularExpressions
type Json =
| JsonObject of JsonSlot list
| JsonString of String
| JsonNumber of float
| JsonBool of bool
| JsonNull