Safe Haskell | Safe-Infered |
---|
Common config and debugging functions. Imported by most modules.
- debugCritical :: Bool
- debug :: Bool
- tracePrimEnabled :: Bool
- check :: String -> Int -> Int -> a -> a
- checkCritical :: String -> Int -> Int -> a -> a
- checkLen :: String -> Int -> Int -> a -> a
- checkSlice :: String -> Int -> Int -> Int -> a -> a
- checkEq :: (Eq a, Show a) => String -> String -> a -> a -> b -> b
- checkNotEmpty :: String -> Int -> a -> a
- uninitialised :: String -> a
- type Tag = Int
- tagToInt :: Tag -> Int
- intToTag :: Int -> Tag
- fromBool :: Bool -> Tag
- toBool :: Tag -> Bool
- newtype ST s a = ST (STRep s a)
- runST :: (forall s. ST s a) -> a
Debugging infrastructure
Enable internal consistency checks for operations that could corrupt the heap.
Enable internal consistency checks.
This is NOT implied by debugCritical
above. If you want both
you need to set both to `True.`
tracePrimEnabled :: BoolSource
Print tracing information for each flat array primitive to console. The tracing hooks are in `dph-prim-par:Data.Array.Parallel.Unlifted`
checkCritical :: String -> Int -> Int -> a -> aSource
Bounds check, enabled when debugCritical
= True
.
This version is used to check operations that could corrupt the heap.
The first integer is the length of the array, and the second
is the index. The second must be greater or equal to '0' and less than
the first integer. If the not then error
with the String
.
checkNotEmpty :: String -> Int -> a -> aSource
Given an array length, check it is not zero.
uninitialised :: String -> aSource
Throw an error saying something was not intitialised.
The String
must contain a helpful message saying what module
the error occured in, and the possible reasons for it.
If not then a puppy dies at compile time.
Data constructor rags
Given a value of an algebraic type, the tag tells us what data constructor was used to create it.
ST monad re-exported from GHC
newtype ST s a
The strict state-transformer monad.
A computation of type
transforms an internal state indexed
by ST
s as
, and returns a value of type a
.
The s
parameter is either
- an uninstantiated type variable (inside invocations of
runST
), or -
RealWorld
(inside invocations ofstToIO
).
It serves to keep the internal states of different invocations
of runST
separate from each other and from invocations of
stToIO
.
The >>=
and >>
operations are strict in the state (though not in
values stored in the state). For example,
runST
(writeSTRef _|_ v >>= f) = _|_
ST (STRep s a) |