From b728b22248414c8319681a75f1c8e8cdf8da1fb2 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 11 Sep 2024 13:07:33 +0200 Subject: More WIP interpreter --- src/Interpreter/Array.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Interpreter/Array.hs') 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 -- cgit v1.2.3-70-g09d2