Skip to content

Commit df294f6

Browse files
committed
Merge pull request #7 from hdgarrood/unsafe-throw
Add unsafeThrowException and unsafeThrow
2 parents c9241c9 + 3a5befe commit df294f6

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
"package.json"
2121
],
2222
"dependencies": {
23-
"purescript-eff": "^0.1.0"
23+
"purescript-eff": "^0.1.2"
2424
}
2525
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Module Control.Monad.Eff.Exception.Unsafe
2+
3+
#### `unsafeThrowException`
4+
5+
``` purescript
6+
unsafeThrowException :: forall a. Error -> a
7+
```
8+
9+
Throw an exception in pure code. This function should be used very
10+
sparingly, as it can cause unexpected crashes at runtime.
11+
12+
#### `unsafeThrow`
13+
14+
``` purescript
15+
unsafeThrow :: forall a. String -> a
16+
```
17+
18+
Defined as `unsafeThrowException <<< error`.
19+
20+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Control.Monad.Eff.Exception.Unsafe where
2+
3+
import Prelude
4+
import Control.Monad.Eff
5+
import Control.Monad.Eff.Unsafe
6+
import Control.Monad.Eff.Exception
7+
8+
-- | Throw an exception in pure code. This function should be used very
9+
-- | sparingly, as it can cause unexpected crashes at runtime.
10+
unsafeThrowException :: forall a. Error -> a
11+
unsafeThrowException = unsafePerformEff <<< throwException
12+
13+
-- | Defined as `unsafeThrowException <<< error`.
14+
unsafeThrow :: forall a. String -> a
15+
unsafeThrow = unsafeThrowException <<< error

0 commit comments

Comments
 (0)