Copyright | (c) Alexey Kuleshevich 2020 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <alexey@kuleshevi.ch> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- touch :: MonadPrim s m => a -> m ()
- touch# :: a -> State# s -> State# s
- keepAlive :: MonadUnliftPrim s m => a -> m b -> m b
- keepAlive# :: a -> (State# s -> (# State# s, r #)) -> State# s -> (# State# s, r #)
- seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- eval :: MonadPrim s m => a -> m a
- evalM :: MonadPrim s m => m a -> m a
- deepeval :: (MonadPrim s m, NFData a) => a -> m a
- deepevalM :: (MonadPrim s m, NFData a) => m a -> m a
- module Control.DeepSeq
- newtype BNF a = BNF a
Liveness
touch :: MonadPrim s m => a -> m () Source #
This is an action that ensures that the value is still available and garbage collector has not cleaned it up.
Make sure not to use it after some computation that doesn't return, like after
forever
for example, otherwise touch will simply be removed by ghc and bad things
will happen. If you have a case like that, make sure to use withAlivePrimBase
or
keepAlive
instead.
Since: 0.1.0
:: MonadUnliftPrim s m | |
=> a | The value to preserve |
-> m b | Action to run in which the value will be preserved |
-> m b |
Similar to touch
. See withAlive#
for more info.
Since: 0.3.0
Weak-Head Normal Form
seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b infixr 0 #
The value of seq a b
is bottom if a
is bottom, and
otherwise equal to b
. In other words, it evaluates the first
argument a
to weak head normal form (WHNF). seq
is usually
introduced to improve performance by avoiding unneeded laziness.
A note on evaluation order: the expression seq a b
does
not guarantee that a
will be evaluated before b
.
The only guarantee given by seq
is that the both a
and b
will be evaluated before seq
returns a value.
In particular, this means that b
may be evaluated before
a
. If you need to guarantee a specific order of evaluation,
you must use the function pseq
from the "parallel" package.
evalM :: MonadPrim s m => m a -> m a Source #
Run the action and then use eval
to ensure its result is evaluated to Weak Head
Normal Form (WHNF)
Since: 0.3.0
Normal Form
deepeval :: (MonadPrim s m, NFData a) => a -> m a Source #
An action that evaluates a value to Normal Form (NF). This function provides stronger
guarantees than deepseq
with respect to ordering of operations.
Since: 0.3.0
deepevalM :: (MonadPrim s m, NFData a) => m a -> m a Source #
Run the action and the using deepeval
ensure its result is evaluated to Normal Form
(NF)
Since: 0.3.0
module Control.DeepSeq