File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
docs/Control/Monad/Eff/Exception
src/Control/Monad/Eff/Exception Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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 = unsafeRunEff <<< throwException
12+ where
13+ unsafeRunEff :: forall e b . Eff e b -> b
14+ unsafeRunEff = runPure <<< unsafeInterleaveEff
15+
16+ -- | Defined as `unsafeThrowException <<< error`.
17+ unsafeThrow :: forall a . String -> a
18+ unsafeThrow = unsafeThrowException <<< error
You can’t perform that action at this time.
0 commit comments