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
type Json = | |
| Null | |
| Bool of bool | |
| Number of float | |
| String of string | |
| Array of Json list | |
| Object of (string * Json) list | |
type Bracket = Open | Close |
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 Cont<'T> = | |
abstract Call<'R> : ('T -> 'R) * (exn -> 'R) -> 'R | |
let 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 |