File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,6 @@ postulate
2828 iEqIOException : Eq IOException
2929 iExceptionIOException : Exception IOException
3030
31- IOError = IOException
32-
33- postulate
34- userError : String → IOError
35-
3631postulate
3732 AssertionFailed : Set
3833 instance
@@ -66,6 +61,3 @@ assert _ {{False ⟨ _ ⟩}} x = throw oops
6661
6762ioException : @0 {{MayThrow IOException}} → IOException → IO a
6863ioException = throwIO
69-
70- ioError : @0 {{MayThrow IOError}} → IOError → IO a
71- ioError = ioException
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ open import Haskell.Prim.Traversable public
4343open import Haskell.Prim.Tuple public hiding (first; second; _***_)
4444open import Haskell.Prim.Word public
4545
46+ open import Haskell.Control.Exception
47+
4648-- Problematic features
4749-- - [Partial]: Could pass implicit/instance arguments to prove totality.
4850-- - [Float]: Or Float (Agda floats are Doubles)
@@ -127,6 +129,16 @@ lookup : ⦃ Eq a ⦄ → a → List (a × b) → Maybe b
127129lookup x [] = Nothing
128130lookup x ((x₁ , y) ∷ xs) = if x == x₁ then Just y else lookup x xs
129131
132+ -------------------------------------------------
133+ -- Exception handling in the I/O monad
134+
135+ IOError = IOException
136+
137+ ioError : @0 {{MayThrow IOError}} → IOError → IO a
138+ ioError = throwIO
139+
140+ postulate
141+ userError : String → IOError
130142
131143-------------------------------------------------
132144-- Unsafe functions
You can’t perform that action at this time.
0 commit comments