primal-0.1.0.0: Primeval world of Haskell.

Copyright(c) Alexey Kuleshevich 2020
LicenseBSD3
MaintainerAlexey Kuleshevich <alexey@kuleshevi.ch>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Control.Prim.Eval

Description

 
Synopsis

Documentation

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 withAliveUnliftPrim instead.

Since: 0.1.0

seqPrim :: MonadPrim s m => a -> m a Source #

An action that evaluates a value to weak head normal form. Same as evaluate, except it works in a MonadPrim

Since: 0.1.0

keepAlive# Source #

Arguments

:: a

The value to preserve

-> (State# s -> (#State# s, r#))

The continuation in which the value will be preserved

-> State# s 
-> (#State# s, r#) 

Forward compatible operator that might be introduced in some future ghc version.

See: !3131

Current version is not as efficient as the version that will be introduced in the future, because it works around the ghc bug by simply preventing inlining and relying on the touch function.

Since: 0.1.0

withAlivePrimBase Source #

Arguments

:: (MonadPrimBase s n, MonadPrim s m) 
=> a

The value to preserve

-> n b

Action to run in which the value will be preserved

-> m b 

Similar to touch. See withAlive# for more info.

Since: 0.1.0

withAliveUnliftPrim Source #

Arguments

:: 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.1.0