This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Provides basic types and syntax for defining XML and HTML fragments | |
/// as a deep EDSL in F#. Design goals: | |
/// | |
/// A. Allow different concrente interpretations, including: | |
/// 1. XML documents and fragments | |
/// 2. HTML(5) documents and fragmetns | |
/// 3. XML or HTML templates with placeholders and/or instructions | |
/// | |
/// B. Provide minimal type safetiy ensuring some sanity but not encoding every | |
/// invariant, which seems not practical with the weak F# type system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import Utf8. | |
Inductive subtype (a b : Set) : Set := | |
| ST : (a -> b) -> subtype a b. | |
Infix ":>" := subtype (at level 50). | |
Definition st {x y} f := ST x y f. | |
Definition unpack {a b : Set} (st : a :> b) := |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.IO | |
type Format<'T> = | |
{ | |
Read : BinaryReader -> 'T | |
Write : BinaryWriter -> 'T -> unit | |
} | |
(* Unions *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.IO | |
type Format<'T> = | |
{ | |
Read : BinaryReader -> 'T | |
Write : BinaryWriter -> 'T -> unit | |
} | |
type FormatUnionPart<'X,'U> = | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Collections.Generic | |
open System.Diagnostics | |
open System.Threading | |
open System.Threading.Tasks | |
[<Sealed>] | |
type Channel<'T>() = | |
let root = obj () | |
let qF = Queue<'T->unit>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Collections.Generic | |
open System.Threading | |
open System.Threading.Tasks | |
[<Sealed>] | |
type Channel<'T>() = | |
let root = obj () | |
let qF = Queue<'T->unit>() | |
let qX = Queue<'T>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Workers | |
open System | |
open System.Collections.Generic | |
open System.Diagnostics | |
open System.Linq | |
open System.Net | |
open System.ServiceModel | |
open System.Threading | |
open System.Threading.Tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// See http://stackoverflow.com/questions/11800168/how-to-implement-the-list-filter-function-in-f-using-primitives | |
#if INTERACTIVE | |
#else | |
module WhatGoesHere | |
#endif | |
[<Sealed>] | |
type Id() = class end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let private isHoliday2011 (dt:DateTime) = | |
match dt.DayOfWeek with | |
| DayOfWeek.Saturday | DayOfWeek.Sunday -> | |
match dt.Month, dt.Day with | |
| 3, 5 -> false | |
| _ -> true | |
| _ -> | |
match dt.Month, dt.Day with | |
| 1, 3 | 1, 4 | 1, 5 | 1, 6 | 1, 7 | 1, 10 | |
| 2, 23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let test () = | |
() |