{-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeApplications #-} module Main where import Data.Array.Nested arr :: Ranked N2 (Shaped [N2, N3] (Double, Int)) arr = rgenerate (3 ::: 4 ::: IZR) $ \(i ::: j ::: IZR) -> sgenerate @[N2, N3] (2 ::$ 3 ::$ IZS) $ \(k ::$ l ::$ IZS) -> let s = i + j + 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