0 | module Control.Monad.Partial
11 | data Partial : Type -> Type where
12 | Now : a -> Partial a
13 | Later : Inf (Partial a) -> Partial a
17 | Functor Partial where
18 | map f (Now x) = Now (f x)
19 | map f (Later x) = Later (map f x)
23 | Applicative Partial where
26 | Now f <*> x = map f x
27 | Later f <*> x = Later (f <*> x)
33 | Later x >>= f = Later (x >>= f)
43 | data Total : Partial a -> Type where
44 | TNow : (x : a) -> Total (Now x)
45 | TLater : Total (Force x) -> Total (Later x)
51 | runPartial : {x : Partial a} -> (0 _ : Total x) -> a
52 | runPartial (TNow x) = x
53 | runPartial (TLater t) = runPartial t