{-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeApplications #-} module Main where import Data.Array.Nested arr :: Ranked I2 (Shaped [2, 3] (Double, Int)) arr = rgenerate (3 ::: 4 ::: IZR) $ \(i ::: j ::: IZR) -> sgenerate @[2, 3] $ \(k ::$ l ::$ IZS) -> let s = 24*i + 6*j + 3*k + l in (fromIntegral s, s) foo :: (Double, Int) foo = arr `rindex` (2 ::: 1 ::: IZR) `sindex` (1 ::$ 1 ::$ IZS) main :: IO () main = do print arr print foo print (rtranspose [1,0] arr)