summaryrefslogtreecommitdiff
path: root/src/Interpreter/Array.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Interpreter/Array.hs')
-rw-r--r--src/Interpreter/Array.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Interpreter/Array.hs b/src/Interpreter/Array.hs
index f358225..54e0791 100644
--- a/src/Interpreter/Array.hs
+++ b/src/Interpreter/Array.hs
@@ -34,6 +34,9 @@ arrayShape (Array sh _) = sh
arraySize :: Array n t -> Int
arraySize (Array sh _) = shapeSize sh
+arrayIndexLinear :: Array n t -> Int -> t
+arrayIndexLinear (Array _ v) i = v V.! i
+
arrayGenerateLinM :: Monad m => Shape n -> (Int -> m t) -> m (Array n t)
arrayGenerateLinM sh f = Array sh <$> V.generateM (shapeSize sh) f