diff --git a/harpie.cabal b/harpie.cabal
--- a/harpie.cabal
+++ b/harpie.cabal
@@ -1,6 +1,6 @@
 cabal-version: 3.0
 name: harpie
-version: 0.1.2.0
+version: 0.1.3.0
 license: BSD-3-Clause
 license-file: LICENSE
 copyright: Tony Day (c) 2016-2024
@@ -11,91 +11,186 @@
 bug-reports: https://github.com/tonyday567/harpie/issues
 synopsis: Haskell array programming.
 description:
-    This package provides Haskell array programming, interface and environment.
+  This package provides Haskell array programming, interface and environment.
 
-    Module names clash with each other and with the Prelude.
+  Module names clash with each other and with the Prelude.
 
-    == Usage
+  == Usage
 
-    >>> import Harpie.Fixed qualified as F
-    >>> import Harpie.Shape qualified as S
-    >>> import Harpie.Array qualified as A
+  >>> import Harpie.Fixed qualified as F
+  >>> import Harpie.Shape qualified as S
+  >>> import Harpie.Array qualified as A
 
-    >>> a = F.range @[2,3,4]
-    >>> F.shape a
-    [2,3,4]
-    >>> pretty a
-    [[[0,1,2,3],
-      [4,5,6,7],
-      [8,9,10,11]],
-     [[12,13,14,15],
-      [16,17,18,19],
-      [20,21,22,23]]]
+  >>> a = F.range @[2,3,4]
+  >>> F.shape a
+  [2,3,4]
+  >>> pretty a
+  [[[0,1,2,3],
+    [4,5,6,7],
+    [8,9,10,11]],
+   [[12,13,14,15],
+    [16,17,18,19],
+    [20,21,22,23]]]
 
-    >>> a = A.range [2,3,4]
-    >>> F.shape a
-    [2,3,4]
-    >>> pretty a
-    [[[0,1,2,3],
-      [4,5,6,7],
-      [8,9,10,11]],
-     [[12,13,14,15],
-      [16,17,18,19],
-      [20,21,22,23]]]
+  >>> a = A.range [2,3,4]
+  >>> F.shape a
+  [2,3,4]
+  >>> pretty a
+  [[[0,1,2,3],
+    [4,5,6,7],
+    [8,9,10,11]],
+   [[12,13,14,15],
+    [16,17,18,19],
+    [20,21,22,23]]]
 
 build-type: Simple
 tested-with:
-    , GHC == 9.10.1
-    , GHC == 9.8.2
-    , GHC == 9.6.5
+  ghc ==9.6.7
+  ghc ==9.8.4
+  ghc ==9.10.2
+  ghc ==9.12.2
+
 extra-doc-files:
-    ChangeLog.md
-    readme.md
+  ChangeLog.md
+  readme.md
 
 source-repository head
-    type: git
-    location: https://github.com/tonyday567/harpie
+  type: git
+  location: https://github.com/tonyday567/harpie
 
 common ghc-options-stanza
-    ghc-options:
-        -Wall
-        -Wcompat
-        -Widentities
-        -Wincomplete-record-updates
-        -Wincomplete-uni-patterns
-        -Wpartial-fields
-        -Wredundant-constraints
+  ghc-options:
+    -Wall
+    -Wcompat
+    -Widentities
+    -Wincomplete-record-updates
+    -Wincomplete-uni-patterns
+    -Wpartial-fields
+    -Wredundant-constraints
 
 common ghc2021-stanza
-    default-language: GHC2021
+  default-language: GHC2021
 
+common ghc2024-stanza
+  if impl(ghc >=9.10)
+    default-language:
+      GHC2024
+  elif impl(ghc >=9.2)
+    default-language:
+      GHC2021
+
+    default-extensions:
+      DataKinds
+      DerivingStrategies
+      DisambiguateRecordFields
+      ExplicitNamespaces
+      GADTs
+      LambdaCase
+      MonoLocalBinds
+      RoleAnnotations
+  else
+    default-language:
+      Haskell2010
+
+    default-extensions:
+      BangPatterns
+      BinaryLiterals
+      ConstrainedClassMethods
+      ConstraintKinds
+      DeriveDataTypeable
+      DeriveFoldable
+      DeriveFunctor
+      DeriveGeneric
+      DeriveLift
+      DeriveTraversable
+      DoAndIfThenElse
+      EmptyCase
+      EmptyDataDecls
+      EmptyDataDeriving
+      ExistentialQuantification
+      ExplicitForAll
+      FlexibleContexts
+      FlexibleInstances
+      ForeignFunctionInterface
+      GADTSyntax
+      GeneralisedNewtypeDeriving
+      HexFloatLiterals
+      ImplicitPrelude
+      InstanceSigs
+      KindSignatures
+      MonomorphismRestriction
+      MultiParamTypeClasses
+      NamedFieldPuns
+      NamedWildCards
+      NumericUnderscores
+      PatternGuards
+      PolyKinds
+      PostfixOperators
+      RankNTypes
+      RelaxedPolyRec
+      ScopedTypeVariables
+      StandaloneDeriving
+      StarIsType
+      TraditionalRecordSyntax
+      TupleSections
+      TypeApplications
+      TypeOperators
+      TypeSynonymInstances
+
+  if impl(ghc <9.2) && impl(ghc >=8.10)
+    default-extensions:
+      ImportQualifiedPost
+      StandaloneKindSignatures
+
 library
-    import: ghc-options-stanza
-    import: ghc2021-stanza
-    hs-source-dirs: src
-    build-depends:
-        , QuickCheck           >=2.14 && <2.16
-        , adjunctions          >=4.0 && <5
-        , base                 >=4.14 && <5
-        , distributive         >=0.4 && <0.7
-        , first-class-families >=0.8.1 && <0.9
-        , prettyprinter        >=1.7 && <1.8
-        , quickcheck-instances >=0.3.31 && <0.4
-        , random               >=1.2 && <1.4
-        , vector               >=0.12.3 && <0.14
-        , vector-algorithms    >=0.9.0 && <0.10
-    exposed-modules:
-        Harpie.Array
-        Harpie.Fixed
-        Harpie.Shape
-        Harpie.Sort
+  import: ghc-options-stanza
+  import: ghc2024-stanza
+  hs-source-dirs: src
+  build-depends:
+    QuickCheck >=2.14 && <2.17,
+    adjunctions >=4.0 && <5,
+    base >=4.18 && <5,
+    distributive >=0.4 && <0.7,
+    first-class-families >=0.8.1 && <0.9,
+    prettyprinter >=1.7 && <1.8,
+    quickcheck-instances >=0.3.31 && <0.4,
+    random >=1.2 && <1.4,
+    vector >=0.12.3 && <0.14,
+    vector-algorithms >=0.9.0 && <0.10,
 
+  exposed-modules:
+    Harpie.Array
+    Harpie.Fixed
+    Harpie.Shape
+    Harpie.Sort
+
 test-suite doctests
-    import: ghc2021-stanza
-    main-is: doctests.hs
-    hs-source-dirs: test
-    build-depends:
-        , base             >=4.14 && <5
-        , doctest-parallel >=0.3 && <0.4
-    ghc-options: -threaded
-    type: exitcode-stdio-1.0
+  import: ghc2024-stanza
+  main-is: doctests.hs
+  hs-source-dirs: test
+  build-depends:
+    base >=4.14 && <5,
+    doctest-parallel >=0.3 && <0.5,
+
+  ghc-options: -threaded
+  type: exitcode-stdio-1.0
+
+common ghc-options-exe-stanza
+  ghc-options:
+    -fforce-recomp
+    -funbox-strict-fields
+    -rtsopts
+    -threaded
+    -with-rtsopts=-N
+
+executable harpie-bug-issue1
+  import: ghc-options-exe-stanza
+  import: ghc-options-stanza
+  import: ghc2024-stanza
+  main-is: harpie-bug-issue1.hs
+  hs-source-dirs: test
+  build-depends:
+    adjunctions >=4.0 && <5,
+    base >=4.14 && <5,
+    first-class-families >=0.8.1 && <0.9,
+    harpie,
diff --git a/src/Harpie/Fixed.hs b/src/Harpie/Fixed.hs
--- a/src/Harpie/Fixed.hs
+++ b/src/Harpie/Fixed.hs
@@ -190,6 +190,8 @@
     invtri,
     inverse,
     chol,
+    -- cross_,
+    -- norm_,
   )
 where
 
@@ -228,7 +230,7 @@
 -- >>> import Prelude hiding (cycle, repeat, take, drop, zipWith, length)
 -- >>> import Harpie.Fixed as F
 -- >>> import Harpie.Shape qualified as S
--- >>> import Harpie.Shape (SNats (..), Fin (..), Fins (..))
+-- >>> import Harpie.Shape (SNats, Fin (..), Fins (..))
 -- >>> import GHC.TypeNats
 -- >>> import Data.List qualified as List
 -- >>> import Prettyprinter hiding (dot,fill)
@@ -257,6 +259,8 @@
 --  [[12,13,14,15],
 --   [16,17,18,19],
 --   [20,21,22,23]]]
+-- >>> e = array @[3,3] @Double [4,12,-16,12,37,-43,-16,-43,98]
+-- >>> l = chol e
 
 -- $usage
 --
@@ -280,9 +284,10 @@
 -- >>> import Data.Functor.Rep
 --
 -- An important base accounting of 'Array' shape is the singleton types 'SNat' (a type-level 'Natural' or 'Nat') from [GHC.TypeNats](https://hackage.haskell.org/package/base/docs/GHC-TypeNats.html) in base.
+--
 -- >>> import GHC.TypeNats
 --
--- The (first-class-families)[https://hackage.haskell.org/package/first-class-families] library was used to code most of function constraints.
+-- The [first-class-families](https://hackage.haskell.org/package/first-class-families) library was used to code most of type-level constraint logic.
 --
 -- >>> import Fcf qualified
 --
@@ -353,6 +358,7 @@
 -- [1,2,3,4,5,6]
 --
 -- The main computational entry and exit points are often via 'index' and 'tabulate' with arrays indexed by 'Fins':
+--
 -- >>> index a (S.UnsafeFins [1,2,3])
 -- 23
 --
@@ -411,7 +417,7 @@
 -- Note that conversion of an 'Array' to a vector drops shape information, so that:
 --
 -- > vectorAs . asVector == id
--- > asVector . vectorAs == flat
+-- > asVector . vectorAs == 'flat'
 --
 -- >>> asVector (range @[2,3])
 -- [0,1,2,3,4,5]
@@ -459,7 +465,7 @@
   where
     a = unsafeArray v
 
--- | Construct an Array, checking shape.
+-- | Construct an Array, throwing an exception on a bad shape.
 --
 -- >>> array [0..22] :: Array [2,3,4] Int
 -- *** Exception: Shape Mismatch
@@ -486,7 +492,7 @@
 unsafeModifyVector :: (KnownNats s) => (FromVector u a) => (FromVector v b) => (u -> v) -> Array s a -> Array s b
 unsafeModifyVector f a = unsafeArray (asVector (f (vectorAs (asVector a))))
 
--- | Representation of an index into a shape (a type-level [Nat]). The index is a dimension of the shape.
+-- | Representation of an index into a shape (a type-level [Nat]). 'Dim @0' is commonly thought of as the row of an array.
 type Dim = SNat
 
 -- | Pattern synonym for a 'Dim'
@@ -537,8 +543,8 @@
 --
 -- The library design encourages the use of value-level shape arrays (in @Harpie.Array@) via 'toDynamic' in preference to dependent-type styles of coding. In particular, no attempt has been made to prove to the compiler that a particular Shape (resulting from any of the supplied functions) exists. Life is short.
 --
--- > P.take 4 <$> sample' arbitrary :: IO [SomeArray Int]
--- [SomeArray SNats @'[] [0],SomeArray SNats @'[0] [],SomeArray SNats @[1, 1] [1],SomeArray SNats @[5, 1, 4] [2,1,0,2,-6,0,5,6,-1,-4,0,5,-1,6,4,-6,1,0,3,-1]]
+-- >> P.take 4 <$> sample' arbitrary :: IO [SomeArray Int]
+-- >> [SomeArray SNats @'[] [0],SomeArray SNats @'[0] [],SomeArray SNats @[1, 1] [1],SomeArray SNats @[5, 1, 4] [2,1,0,2,-6,0,5,6,-1,-4,0,5,-1,6,4,-6,1,0,3,-1]]
 data SomeArray a = forall s. SomeArray (SNats s) (Array s a)
 
 deriving instance (Show a) => Show (SomeArray a)
@@ -549,7 +555,7 @@
 instance Foldable SomeArray where
   foldMap f (SomeArray _ a) = foldMap f a
 
--- | Contruct a SomeArray
+-- | Construct a SomeArray
 someArray :: forall s t a. (FromVector t a) => SNats s -> t -> SomeArray a
 someArray s t = SomeArray s (Array (asVector t))
 
@@ -1215,7 +1221,7 @@
   Array s' a
 takes _ _ a = unsafeBackpermute id a
 
--- | Across the specified dimesnions, takes the bottom-most elements.
+-- | Across the specified dimensions, takes the bottom-most elements.
 --
 -- >>> pretty (takeBs (Dims @[0,1]) (S.SNats @[1,2]) a)
 -- [[[16,17,18,19],
@@ -1282,6 +1288,8 @@
 --
 -- >>> pretty $ indexes (Dims @[0,1]) (S.UnsafeFins [1,1]) a
 -- [16,17,18,19]
+-- >>> F.indexes (S.SNats @'[1]) (S.fins @'[3] [1]) (F.range @[2,3])
+-- [1,4]
 indexes ::
   forall s' s ds xs a.
   ( KnownNats s,
@@ -2804,29 +2812,15 @@
 --  [-8.0,5.0,3.0]]
 -- >>> mult (chol e) (transpose (chol e)) == e
 -- True
-chol :: (KnownNat m, Floating a) => Matrix m m a -> Matrix m m a
-chol a =
-  let l =
-        unsafeTabulate
-          ( \[i, j] ->
-              bool
-                ( 1
-                    / unsafeIndex l [j, j]
-                    * ( unsafeIndex a [i, j]
-                          - sum
-                            ( (\k -> unsafeIndex l [i, k] * unsafeIndex l [j, k])
-                                <$> ([0 .. (j - 1)] :: [Int])
-                            )
-                      )
-                )
-                ( sqrt
-                    ( unsafeIndex a [i, i]
-                        - sum
-                          ( (\k -> unsafeIndex l [j, k] ^ (2 :: Int))
-                              <$> ([0 .. (j - 1)] :: [Int])
-                          )
-                    )
-                )
-                (i == j)
-          )
-   in l
+chol :: (KnownNat m, Floating a, KnownNats '[m, m]) => Matrix m m a -> Matrix m m a
+chol a = l
+  where
+    l = tabulate (\s -> norm_ 1 l s (index a s - cross_ l s))
+
+norm_ :: (Floating a, KnownNat m) => Int -> Matrix m m a -> Fins '[m, m] -> a -> a
+norm_ d l (UnsafeFins s) = bool (1 / diag l ! [S.getDim d s] *) sqrt (S.isDiag s)
+
+cross_ :: (Num a, KnownNat m) => Matrix m m a -> Fins '[m, m] -> a
+cross_ l s = sum (fmap (\k -> l ! [i, k] * l ! [j, k]) (A.range [j]))
+  where
+    [i, j] = fromFins s
diff --git a/src/Harpie/Shape.hs b/src/Harpie/Shape.hs
--- a/src/Harpie/Shape.hs
+++ b/src/Harpie/Shape.hs
@@ -178,6 +178,8 @@
 import GHC.TypeNats
 import Prelude as P hiding (minimum)
 
+{-# ANN module ("doctest-parallel: --no-implicit-module-import" :: String) #-}
+
 -- $setup
 -- >>> :set -XDataKinds
 -- >>> :set -XTypeFamilies
diff --git a/src/Harpie/Sort.hs b/src/Harpie/Sort.hs
--- a/src/Harpie/Sort.hs
+++ b/src/Harpie/Sort.hs
@@ -16,6 +16,7 @@
 
 -- $setup
 -- >>> :m -Prelude
+-- >>> import Harpie.Sort
 -- >>> import Data.Vector qualified as V
 -- >>> import Data.Ord (Down (..))
 -- >>> import Prelude (Int)
diff --git a/test/harpie-bug-issue1.hs b/test/harpie-bug-issue1.hs
new file mode 100644
--- /dev/null
+++ b/test/harpie-bug-issue1.hs
@@ -0,0 +1,40 @@
+{-# LANGUAGE DataKinds #-}
+{-# OPTIONS_GHC -Wno-redundant-constraints #-}
+
+module Main where
+
+import Data.Functor.Rep (index, tabulate)
+import Fcf qualified
+import Harpie.Fixed qualified as F
+import Harpie.Shape qualified as S
+
+-- | bug-issue1
+--
+-- >>> F.indexes (S.SNats @'[1]) (S.fins @'[3] [1]) (range @[2,3])
+main :: IO ()
+main = do
+  putStrLn $ "using module functions: " <> show x
+  putStrLn $ "using inplace functions:" <> show x'
+  where
+    a = F.range @[2, 3]
+    x = F.indexes (S.SNats @'[1]) (S.fins @'[3] [1]) a
+    x' = F.indexes (S.SNats @'[1]) (S.fins @'[3] [1]) (range @[2, 3])
+
+range :: forall s. (S.KnownNats s) => F.Array s Int
+range = tabulate (S.flatten (S.valuesOf @s) . S.fromFins)
+
+indexes ::
+  forall s' s ds xs a.
+  ( S.KnownNats s,
+    S.KnownNats s',
+    s' ~ Fcf.Eval (S.DeleteDims ds s),
+    xs ~ Fcf.Eval (S.GetDims ds s)
+  ) =>
+  F.Dims ds ->
+  S.Fins xs ->
+  F.Array s a ->
+  F.Array s' a
+indexes S.SNats xs a = F.unsafeBackpermute (S.insertDims (S.valuesOf @ds) (S.fromFins xs)) a
+
+unsafeBackpermute :: forall s' s a. (S.KnownNats s, S.KnownNats s') => ([Int] -> [Int]) -> F.Array s a -> F.Array s' a
+unsafeBackpermute f a = tabulate (index a . S.UnsafeFins . f . S.fromFins)
