This file contains hidden or 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
module Krow.Regex.ActivePatterns | |
open System.Text | |
let (|Regex|_|) (pattern:IRegex) input = | |
if input = null then | |
None | |
else | |
try | |
let match' = RegularExpressions.Regex.Match(input, pattern |> Regex.evaluate) |
This file contains hidden or 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
[<AutoOpen>] | |
module IO = | |
type IO<'a> = | |
private | |
| Return of (unit -> 'a) | |
| Suspend of (unit -> IO<'a>) | |
let rec run x = | |
match x with | |
| Return v -> v() |
This file contains hidden or 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.IO | |
type State<'s, 'a> = State of ('s -> ('a * 's)) | |
module State = | |
let inline run state x = let (State(f)) = x in f state | |
let get = State(fun s -> s, s) | |
let put newState = State(fun _ -> (), newState) | |
let map f s = State(fun (state: 's) -> |