Skip to content

Instantly share code, notes, and snippets.

let rec mkKn (ty: System.Type) =
if Reflection.FSharpType.IsFunction(ty) then
let _, ran = Reflection.FSharpType.GetFunctionElements(ty)
// NOTICE: do not delay `mkKn` invocation until runtime
let f = mkKn ran
Reflection.FSharpValue.MakeFunction(ty, fun _ -> f)
else
box ()
open System.Collections.Generic
type Cache<'T> private () =
static let d = Dictionary<string,'T>()
static member Format(format: Printf.StringFormat<'T>) : 'T =
let key = format.Value
match d.TryGetValue(key) with
| true, r -> r
| _ ->
type A = {aval:int;b:B}
and B = {bval:int;a:A}
let rec a : A = { aval = 0; b = b }
and b : B = { bval = 1; a = a }
@t0yv0
t0yv0 / Test.fs
Created July 11, 2012 15:11
Test
let test () = printfn "OK"
import Data.List
data Rolj = Oficiant
| Povar
| Somelje
deriving (Eq, Show)
data Reshenije =
Reshenije { aristid :: Rolj
, evasio :: Rolj
(*
Copyright (c) 2008-2011 IntelliFactory
GNU Affero General Public License Usage The code
is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero
General Public License, version 3, as published by
the Free Software Foundation.
namespace Website
module Client =
open IntelliFactory.WebSharper
open IntelliFactory.WebSharper.Html
[<JavaScript>]
let SayHello () =
JavaScript.Alert("HELLO!")
let leak1 () =
let thread () =
async {
let x = Array.create 1024 0uy
return ()
}
|> Async.Start
async {
while true do
type Json =
| Array of list<Json>
| Double of double
| False
| Integer of int64
| Null
| Object of list<string*Json>
| String of string
| True
@t0yv0
t0yv0 / SynchronousMessagePassing.fs
Created December 15, 2011 22:31
Demonstrates specializing F# Async for better CML-style channel performance.
(*
Copyright (c) 2008-2011 IntelliFactory
GNU Affero General Public License Usage The code
is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero
General Public License, version 3, as published by
the Free Software Foundation.