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 | |
type StringToExnClass = StringToExnClass with | |
static member StringToExn (_: ArgumentNullException) = fun (s: string) -> ArgumentNullException s | |
static member StringToExn (_: AccessViolationException) = fun (s: string) -> AccessViolationException s | |
static member StringToExn (_: ArrayTypeMismatchException) = fun (s: string) -> ArrayTypeMismatchException s | |
// etc (need to wrap all relevant types) | |
let inline iStringToExn (a: ^a, b: ^b) = | |
((^a or ^b) : (static member StringToExn: ^b -> (string -> ^b)) 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
// http://homepages.cwi.nl/~ralf/syb3/ | |
let inline gmap f g (x : ^R) : ^R = (f ? (g) <- x) | |
type Data = Data with | |
static member inline ($)(f : ^F, x : ^A) = gmap Data f x | |
static member inline (?<-)(Data, f, x : int) = x | |
static member inline (?<-)(Data, f, x : string) = x | |
static member inline (?<-)(Data, f, x : bool) = x |