Skip to content

Instantly share code, notes, and snippets.

open Microsoft.FSharp.Linq.Query
query <@ seq { for c in db.Customers do yield c.CompanyName } @>
type 'a SimpleType= F of (int ->'a-> 'a)
let get a = F(fun req -> id)
[<GeneralizableValue>]
let oops2<'T> : SimpleType<'T> = get ""
@mulambda
mulambda / gist:333349
Created March 15, 2010 21:27
Active pattern for working with Nullable in F#
let (|HasValue|Null|) (x:System.Nullable<_>) =
if x.HasValue then
HasValue (x.Value)
else
Null
let f x =
match x with
| HasValue v -> v + 1
| Null -> 0