{-# LANGUAGE RankNTypes #-}
module Data.Array.Repa.Shape
( Shape(..)
, inShape
, showShape )
where
class Eq sh => Shape sh where
rank :: sh -> Int
zeroDim :: sh
unitDim :: sh
intersectDim :: sh -> sh -> sh
addDim :: sh -> sh -> sh
size :: sh -> Int
sizeIsValid :: sh -> Bool
toIndex :: sh
-> sh
-> Int
fromIndex
:: sh
-> Int
-> sh
inShapeRange
:: sh
-> sh
-> sh
-> Bool
listOfShape :: sh -> [Int]
shapeOfList :: [Int] -> sh
infixr 0 `deepSeq`
deepSeq :: sh -> a -> a
inShape :: forall sh
. Shape sh
=> sh
-> sh
-> Bool
{-# INLINE inShape #-}
inShape :: forall sh. Shape sh => sh -> sh -> Bool
inShape sh
sh sh
ix
= sh -> sh -> sh -> Bool
forall sh. Shape sh => sh -> sh -> sh -> Bool
inShapeRange sh
forall sh. Shape sh => sh
zeroDim sh
sh sh
ix
showShape :: Shape sh => sh -> String
showShape :: forall sh. Shape sh => sh -> String
showShape = (Int -> String -> String) -> String -> [Int] -> String
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\Int
sh String
str -> String
str String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" :. " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
sh) String
"Z" ([Int] -> String) -> (sh -> [Int]) -> sh -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. sh -> [Int]
forall sh. Shape sh => sh -> [Int]
listOfShape