1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
module Data.Array.Repa.Repr.Undefined
( X, Array (..))
where
import Data.Array.Repa.Base
import Data.Array.Repa.Shape
import Data.Array.Repa.Eval
-- | An array with undefined elements.
--
-- * This is normally used as the last representation in a partitioned array,
-- as the previous partitions are expected to provide full coverage.
data X
-- | Undefined array elements. Inspecting them yields `error`.
--
instance Source X e where
data Array X sh e
= AUndefined !sh
deepSeqArray _ x
= x
{-# INLINE deepSeqArray #-}
extent (AUndefined sh)
= sh
{-# INLINE extent #-}
index (AUndefined _) _
= error $ "Repa: array element is undefined."
{-# INLINE index #-}
linearIndex (AUndefined _) ix
= error $ "Repa: array element at " ++ show ix ++ " is undefined."
{-# INLINE linearIndex #-}
deriving instance Show sh
=> Show (Array X sh e)
deriving instance Read sh
=> Read (Array X sh e)
instance Shape sh => Load X sh e where
loadS _ _ = return ()
loadP _ _ = return ()
|