-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Data Parallel Haskell common config and debugging functions. -- -- Common configuration, debugging and utilities. @package dph-base @version 0.7.0.1 -- | Generic array class. This is used as a compatability layer during -- testing and debugging. module Data.Array.Parallel.Array class Array a e valid :: Array a e => a e -> Bool singleton :: Array a e => e -> a e append :: Array a e => a e -> a e -> a e length :: Array a e => a e -> Int index :: Array a e => a e -> Int -> e toVector :: Array a e => a e -> Vector e fromVector :: Array a e => Vector e -> a e -- | Convert a list to an array. fromList :: Array a e => [e] -> a e -- | Convert an array to a list. toList :: Array a e => a e -> [e] -- | Convert the outer level of an array to vectors. toVectors1 :: Array a e => a e -> Vector e -- | Convert the outer two levels of an array to vectors. toVectors2 :: (Array a1 (a2 e), Array a2 e) => a1 (a2 e) -> Vector (Vector e) -- | Convert the outer three levels of an array to vectors. toVectors3 :: (Array a1 (a2 (a3 e)), Array a2 (a3 e), Array a3 e) => a1 (a2 (a3 e)) -> Vector (Vector (Vector e)) -- | Convert some vectors to an array. fromVectors1 :: Array a e => Vector e -> a e -- | Convert some vectors to a nested array fromVectors2 :: (Array a1 (a2 e), Array a2 e) => Vector (Vector e) -> a1 (a2 e) -- | Convert some vectors to a triply nested array fromVectors3 :: (Array a1 (a2 (a3 e)), Array a2 (a3 e), Array a3 e) => Vector (Vector (Vector e)) -> a1 (a2 (a3 e)) instance Array Vector e instance Array [] e -- | Pretty printer classes module Data.Array.Parallel.Pretty -- | Pretty print the physical structure of data. class PprPhysical a pprp :: PprPhysical a => a -> Doc -- | Pretty print virtual / logical structure of data. class PprVirtual a pprv :: PprVirtual a => a -> Doc instance PprPhysical a => PprPhysical (Vector a) instance (PprPhysical a, PprPhysical b) => PprPhysical (a, b) instance PprVirtual Double instance PprVirtual Int instance PprVirtual Bool instance PprPhysical Double instance PprPhysical Int instance PprPhysical Bool -- | Harness for DTrace. module Data.Array.Parallel.Base.DTrace traceLoopEntry :: String -> a -> a traceLoopExit :: String -> a -> a traceLoopST :: String -> ST s a -> ST s a traceLoopEntryST :: String -> ST s () traceLoopExitST :: String -> ST s () traceLoopIO :: String -> IO a -> IO a traceLoopEntryIO :: String -> IO () traceLoopExitIO :: String -> IO () traceFn :: String -> String -> a -> a traceArg :: Show a => String -> a -> b -> b traceF :: String -> a -> a -- | Utilities for defining Read/Show instances. module Data.Array.Parallel.Base.Text showsApp :: Show a => Int -> String -> a -> ShowS readApp :: Read a => String -> ReadPrec a readsApp :: Read a => Int -> String -> ReadS a -- | Parsing of Strings, producing values. -- -- Minimal complete definition: readsPrec (or, for GHC only, -- readPrec) -- -- Derived instances of Read make the following assumptions, which -- derived instances of Show obey: -- -- -- -- For example, given the declarations -- --
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   
-- -- the derived instance of Read in Haskell 98 is equivalent to -- --
--   instance (Read a) => Read (Tree a) where
--   
--           readsPrec d r =  readParen (d > app_prec)
--                            (\r -> [(Leaf m,t) |
--                                    ("Leaf",s) <- lex r,
--                                    (m,t) <- readsPrec (app_prec+1) s]) r
--   
--                         ++ readParen (d > up_prec)
--                            (\r -> [(u:^:v,w) |
--                                    (u,s) <- readsPrec (up_prec+1) r,
--                                    (":^:",t) <- lex s,
--                                    (v,w) <- readsPrec (up_prec+1) t]) r
--   
--             where app_prec = 10
--                   up_prec = 5
--   
-- -- Note that right-associativity of :^: is unused. -- -- The derived instance in GHC is equivalent to -- --
--   instance (Read a) => Read (Tree a) where
--   
--           readPrec = parens $ (prec app_prec $ do
--                                    Ident "Leaf" <- lexP
--                                    m <- step readPrec
--                                    return (Leaf m))
--   
--                        +++ (prec up_prec $ do
--                                    u <- step readPrec
--                                    Symbol ":^:" <- lexP
--                                    v <- step readPrec
--                                    return (u :^: v))
--   
--             where app_prec = 10
--                   up_prec = 5
--   
--           readListPrec = readListPrecDefault
--   
class Read a readsPrec :: Read a => Int -> ReadS a readList :: Read a => ReadS [a] readPrec :: Read a => ReadPrec a readListPrec :: Read a => ReadPrec [a] -- | When tracePrimEnabled, DPH programs will print out what flat -- array primitives they're using at runtime. See tracePrim for -- details. module Data.Array.Parallel.Base.TracePrim -- | Print tracing information to console. -- -- This function is used to wrap the calls to DPH primitives defined in -- dph-prim-par:Data.Array.Parallel.Unlifted -- -- Tracing is only enabled when tracePrimEnabled is True. -- otherwise it's a no-op. tracePrim :: TracePrim -> a -> a -- | Records information about the use of a flat array primitive. -- -- These are the operator names that the vectoriser introduces. -- -- The actual implementation of each operator varies depending on what -- DPH primitive library is being used. -- -- We only trace operators that are at least O(n) in complexity. data TracePrim TraceReplicate :: Int -> TracePrim traceCount :: TracePrim -> Int TraceRepeat :: Int -> Int -> TracePrim traceCount :: TracePrim -> Int traceSrcLength :: TracePrim -> Int TraceIndex :: Int -> Int -> TracePrim traceIndex :: TracePrim -> Int traceSrcLength :: TracePrim -> Int TraceExtract :: Int -> Int -> Int -> TracePrim traceStart :: TracePrim -> Int traceSliceLength :: TracePrim -> Int traceSrcLength :: TracePrim -> Int TraceDrop :: Int -> Int -> TracePrim traceCount :: TracePrim -> Int traceSrcLength :: TracePrim -> Int TracePermute :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceBPermuteDft :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceBPermute :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceMBPermute :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceUpdate :: Int -> Int -> TracePrim traceSrcLength :: TracePrim -> Int traceModLength :: TracePrim -> Int TraceAppend :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceInterleave :: Int -> TracePrim traceDstLength :: TracePrim -> Int TracePack :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceCombine :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceCombine2 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceMap :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceFilter :: Int -> Int -> TracePrim traceSrcLength :: TracePrim -> Int traceDstLength :: TracePrim -> Int TraceZipWith :: Int -> Int -> TracePrim traceSrc1Length :: TracePrim -> Int traceSrc2Length :: TracePrim -> Int TraceFold :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceFold1 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceAnd :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceSum :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceScan :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceIndexed :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceEnumFromTo :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceEnumFromThenTo :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceEnumFromStepLen :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceEnumFromStepLenEach :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceMkSel2 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceTagsSel2 :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceIndicesSel2 :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceElementsSel2_0 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceElementsSel2_1 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceMkSelRep2 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceIndicesSelRep2 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceElementsSelRep2_0 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceElementsSelRep2_1 :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceReplicate_s :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceReplicate_rs :: Int -> Int -> TracePrim traceCount :: TracePrim -> Int traceSrcLength :: TracePrim -> Int TraceAppend_s :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceAppend_vs :: Int -> TracePrim traceDstLength :: TracePrim -> Int TraceFold_s :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceFold1_s :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceFold_r :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceSum_r :: Int -> TracePrim traceSrcLength :: TracePrim -> Int TraceIndices_s :: Int -> TracePrim traceDstLength :: TracePrim -> Int instance Show TracePrim -- | Common config and debugging functions. Imported by most modules. module Data.Array.Parallel.Base -- | Enable internal consistency checks for operations that could corrupt -- the heap. debugCritical :: Bool -- | Enable internal consistency checks. This is NOT implied by -- debugCritical above. If you want both you need to set both to -- `True.` debug :: Bool -- | Print tracing information for each flat array primitive to console. -- The tracing hooks are in `dph-prim-par:Data.Array.Parallel.Unlifted` tracePrimEnabled :: Bool -- | Bounds check, enabled when debug = True. -- -- 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. check :: String -> Int -> Int -> a -> a -- | 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. checkCritical :: String -> Int -> Int -> a -> a -- | Length check, enabled when debug = True. -- -- Check that the second integer is greater or equal to `0' and less or -- equal than the first integer. If the not then error with the -- String. checkLen :: String -> Int -> Int -> a -> a -- | Slice check, enable when debug = True. -- -- The vector must contain at least sliceStart + -- sliceLen elements. checkSlice :: String -> Int -> Int -> Int -> a -> a -- | Equality check, enabled when debug = True. -- -- The two a values must be equal, else error. -- -- The first String gives the location of the error, and the -- second some helpful message. checkEq :: (Eq a, Show a) => String -> String -> a -> a -> b -> b -- | Given an array length, check it is not zero. checkNotEmpty :: String -> Int -> a -> a -- | 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. uninitialised :: String -> a -- | Given a value of an algebraic type, the tag tells us what data -- constructor was used to create it. type Tag = Int -- | Convert a Tag to an Int. This is identity at the value -- level. tagToInt :: Tag -> Int -- | Convert an Int to a Tag. This is identity at the value -- level. intToTag :: Int -> Tag -- | Get the Tag of a Bool value. False is 0, -- True is 1. fromBool :: Bool -> Tag -- | Convert a Tag to a Bool value. toBool :: Tag -> Bool -- | The strict state-transformer monad. A computation of type -- ST s a transforms an internal state indexed by -- s, and returns a value of type a. The s -- parameter is either -- -- -- -- 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) = _|_
--   
newtype ST s a :: * -> * -> * ST :: STRep s a -> ST s a -- | Return the value computed by a state transformer computation. The -- forall ensures that the internal state used by the ST -- computation is inaccessible to the rest of the program. runST :: (forall s. ST s a) -> a