Skip to content

Commit bb7cd81

Browse files
committed
Move IOError, ioError, and userError to Haskell.Prelude
1 parent 6771965 commit bb7cd81

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/base/Haskell/Control/Exception.agda

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff 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-
3631
postulate
3732
AssertionFailed : Set
3833
instance
@@ -66,6 +61,3 @@ assert _ {{False ⟨ _ ⟩}} x = throw oops
6661

6762
ioException : @0 {{MayThrow IOException}} IOException IO a
6863
ioException = throwIO
69-
70-
ioError : @0 {{MayThrow IOError}} IOError IO a
71-
ioError = ioException

lib/base/Haskell/Prelude.agda

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ open import Haskell.Prim.Traversable public
4343
open import Haskell.Prim.Tuple public hiding (first; second; _***_)
4444
open 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
127129
lookup x [] = Nothing
128130
lookup 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

0 commit comments

Comments
 (0)