File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1706,6 +1706,7 @@ Other minor changes
1706
1706
1707
1707
whenJust : Maybe A → (A → IO ⊤) → IO ⊤
1708
1708
untilJust : IO (Maybe A) → IO A
1709
+ untilRight : (A → IO (A ⊎ B)) → A → IO B
1709
1710
```
1710
1711
1711
1712
* Added new functions in ` Reflection.AST.Term ` :
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ open import Level
12
12
open import Codata.Musical.Notation
13
13
open import Data.Bool.Base using (Bool; true; false; not)
14
14
open import Agda.Builtin.Maybe using (Maybe; nothing; just)
15
+ open import Data.Sum.Base using (_⊎_; inj₁; inj₂)
15
16
import Agda.Builtin.Unit as Unit0
16
17
open import Data.Unit.Polymorphic.Base
17
18
open import Function.Base using (_∘′_; const; flip)
@@ -128,3 +129,8 @@ untilJust : IO (Maybe A) → IO A
128
129
untilJust m = bind (♯ m) λ where
129
130
nothing → ♯ untilJust m
130
131
(just a) → ♯ return a
132
+
133
+ untilRight : {A B : Set a} → (A → IO (A ⊎ B)) → A → IO B
134
+ untilRight f x = bind (♯ f x) λ where
135
+ (inj₁ x′) → ♯ untilRight f x′
136
+ (inj₂ y) → ♯ return y
You can’t perform that action at this time.
0 commit comments