Type safe

This commit is contained in:
Smaug123
2023-12-21 18:56:41 +00:00
parent b646419d6a
commit 46d9ac111a
3 changed files with 120 additions and 57 deletions

View File

@@ -5,11 +5,16 @@ type SealedStepDag<'a, 'plat> = private | SealedStepDag
type Step<'a> = private | Step
type Comp<'a> = private | Comp of (unit -> 'a)
type Comp<'a> =
private
| Thunk of (unit -> 'a)
[<RequireQualifiedAccess>]
module Comp =
let make (x : 'a) : Comp<'a> = Comp (fun () -> x)
let make (x : 'a) : Comp<'a> = Thunk (fun () -> x)
let force (x : 'a Comp) =
match x with
| Thunk x -> x ()
[<RequireQualifiedAccess>]
module StepDag =