TT types and values, some text manipulation, basics of Core
Showing the changes to src/Control (1 of 18 files). Show all
Unified · Split
| @@ -0,0 +1,26 @@ | ||
| 1 | +||| Utilities functions for contitionally delaying values. | |
| 2 | +module Control.Delayed | |
| 3 | + | |
| 4 | +%default total | |
| 5 | + | |
| 6 | +||| Type-level function for a conditionally delayed type (`Lazy` or `Inf`). | |
| 7 | +public export | |
| 8 | +delayed : DelayReason -> Bool -> Type -> Type | |
| 9 | +delayed r False a = a | |
| 10 | +delayed r True a = Delayed r a | |
| 11 | + | |
| 12 | +||| Type-level function for a conditionally infinite type. | |
| 13 | +public export | |
| 14 | +inf : Bool -> Type -> Type | |
| 15 | +inf = delayed Infinite | |
| 16 | + | |
| 17 | +||| Type-level function for a conditionally lazy type. | |
| 18 | +public export | |
| 19 | +lazy : Bool -> Type -> Type | |
| 20 | +lazy = delayed LazyValue | |
| 21 | + | |
| 22 | +||| Conditionally delay a value. | |
| 23 | +export | |
| 24 | +delay : (d : Bool) -> a -> delayed r d a | |
| 25 | +delay False x = x | |
| 26 | +delay True x = Delay x | |