diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2025-12-02 15:03:10 +0100 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2025-12-02 15:03:43 +0100 |
| commit | b63642a41f3bddc991d92f2f59b9e3ad53c1f15e (patch) | |
| tree | a63b978be8baab76c7aa7a99b13a93b408bfc913 /src/Data/Array/Nested/Shaped/Shape.hs | |
| parent | af0c099079dae7aa52a660b883204035cbed99c3 (diff) | |
Provide ix*FromLinear for all three shape kinds
This speeds up {r,s}generatePrim
Diffstat (limited to 'src/Data/Array/Nested/Shaped/Shape.hs')
| -rw-r--r-- | src/Data/Array/Nested/Shaped/Shape.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Shaped/Shape.hs b/src/Data/Array/Nested/Shaped/Shape.hs index 0a4c1b9..a237b88 100644 --- a/src/Data/Array/Nested/Shaped/Shape.hs +++ b/src/Data/Array/Nested/Shaped/Shape.hs @@ -17,6 +17,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneKindSignatures #-} {-# LANGUAGE StrictData #-} +{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} @@ -44,6 +45,7 @@ import GHC.IsList qualified as IsList import GHC.TypeLits import Data.Array.Nested.Mixed.Shape +import Data.Array.Nested.Mixed.Shape.Internal import Data.Array.Nested.Permutation import Data.Array.Nested.Types @@ -465,3 +467,6 @@ instance KnownShS sh => IsList (ShS sh) where type Item (ShS sh) = Int fromList = shsFromList (knownShS @sh) toList = shsToList + +$(ixFromLinearStub "ixsFromLinear" [t| ShS |] [t| IxS |] [p| ZSS |] (\a b -> [p| (fromSNat' -> $a) :$$ $b |]) [| ZIS |] [| (:.$) |] [| shsToList |]) +{-# INLINEABLE ixsFromLinear #-} |
