h&J=$      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                        Safe-Inferred *  Safe-Inferred Y Safe-Inferred )*) comfort-arrayShape for arrays that hold elements that can alternatively be stored in a  record. comfort-arrayShape for arrays that hold elements that can alternatively be stored in nested tuples. comfort-array(Row-major composition of two dimensions.Shape.indices (Shape.ZeroBased (3::Int) ::+ Shape.Range 'a' 'c')4[Left 0,Left 1,Left 2,Right 'a',Right 'b',Right 'c'] comfort-array is a shape, where the indices wrap around at the array boundaries. E.g.let shape = Shape.Cyclic (10::Int) in Shape.offset shape (-1) == Shape.offset shape 9This also means that there are multiple indices that address the same array element.%Shape.indices (Shape.Cyclic (7::Int))[0,1,2,3,4,5,6], comfort-arraySimplex is a generalization of 3 to more than two dimensions. Indices are tuples of fixed size with elements ordered in ascending, strictly ascending, descending or strictly descending order. "Order" refers to the index order in b;. In order to avoid confusion we suggest that the order of b is consistent with . Obviously, c implements ranking and ] implements unranking of combinations (in the combinatorial sense) with or without repetitions.Shape.indices $ Shape.simplexAscending (replicate 3 Shape.AllDistinct) $ Shape.ZeroBased (4::Int)![[0,1,2],[0,1,3],[0,2,3],[1,2,3]]Shape.indices $ Shape.simplexAscending (replicate 3 Shape.SomeRepetitive) $ Shape.ZeroBased (3::Int)[[0,0,0],[0,0,1],[0,0,2],[0,1,1],[0,1,2],[0,2,2],[1,1,1],[1,1,2],[1,2,2],[2,2,2]]Shape.indices $ Shape.simplexAscending [Shape.Repetitive,Shape.Distinct,Shape.Repetitive] $ Shape.ZeroBased (4::Int)[[0,0,1],[0,0,2],[0,0,3],[0,1,2],[0,1,3],[0,2,3],[1,1,2],[1,1,3],[1,2,3],[2,2,3]]Shape.indices $ Shape.simplexAscending [Shape.Repetitive,Shape.Distinct,Shape.Distinct] $ Shape.ZeroBased (4::Int)[[0,0,1],[0,0,2],[0,0,3],[0,1,2],[0,1,3],[0,2,3],[1,1,2],[1,1,3],[1,2,3],[2,2,3]]Shape.indices $ Shape.simplexDescending (replicate 3 Shape.AllDistinct) $ Shape.ZeroBased (4::Int)![[2,1,0],[3,1,0],[3,2,0],[3,2,1]]Shape.indices $ Shape.simplexDescending (replicate 3 Shape.SomeRepetitive) $ Shape.ZeroBased (3::Int)[[0,0,0],[1,0,0],[1,1,0],[1,1,1],[2,0,0],[2,1,0],[2,1,1],[2,2,0],[2,2,1],[2,2,2]]Shape.indices $ Shape.simplexDescending [Shape.Repetitive,Shape.Distinct,Shape.Repetitive] $ Shape.ZeroBased (4::Int)[[1,1,0],[2,1,0],[2,2,0],[2,2,1],[3,1,0],[3,2,0],[3,2,1],[3,3,0],[3,3,1],[3,3,2]]Shape.indices $ Shape.simplexDescending [Shape.Repetitive,Shape.Distinct,Shape.Distinct] $ Shape.ZeroBased (4::Int)[[1,1,0],[2,1,0],[2,2,0],[2,2,1],[3,1,0],[3,2,0],[3,2,1],[3,3,0],[3,3,1],[3,3,2]]3 comfort-arrayShape.indices $ Shape.Triangular Shape.Upper $ Shape.ZeroBased (3::Int)%[(0,0),(0,1),(0,2),(1,1),(1,2),(2,2)]Shape.indices $ Shape.Triangular Shape.Lower $ Shape.ZeroBased (3::Int)%[(0,0),(1,0),(1,1),(2,0),(2,1),(2,2)]; comfort-array; is like a Cartesian product, but it is statically asserted that both dimension shapes match.5Shape.indices $ Shape.Cube $ Shape.ZeroBased (2::Int)[(0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0),(1,0,1),(1,1,0),(1,1,1)]> comfort-array> is like a Cartesian product, but it is statically asserted that both dimension shapes match.7Shape.indices $ Shape.Square $ Shape.ZeroBased (3::Int)7[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]A comfort-arrayA has an  instance that is based on the storage order in memory. This way, you can put A values in a  or use them as keys in a  even if Index sh has no 1 instance. The downside is, that the ordering of DeferredIndex sh may differ from the one of Index sh.C comfort-arrayThis data type wraps another array shape. Its index type is a wrapped 3. The advantages are: No conversion forth and back  and Index sh. You can convert once using y and z whenever you need your application specific index type. No need for e.g. Storable (Index sh) , because  is already  . You get ` and \# instances without the need for an a type. The disadvantage is: A deferred index should be bound to a specific shape, but this is not checked. That is, you may obtain a deferred index for one shape and accidentally abuse it for another shape without a warning.Example::{let sh2 = (Shape.ZeroBased (2::Int), Shape.ZeroBased (2::Int)) inlet sh3 = (Shape.ZeroBased (3::Int), Shape.ZeroBased (3::Int)) in0(Shape.offset sh3 $ Shape.indexFromOffset sh2 3,$ Shape.offset (Shape.Deferred sh3) $0 Shape.indexFromOffset (Shape.Deferred sh2) 3):}(4,3)E comfort-arrayE2 denotes a shape of fixed size that is defined by  and 3 methods. For correctness it is necessary that the  and  instances are properly implemented. Automatically derived instances are fine.?Shape.indices (Shape.Enumeration :: Shape.Enumeration Ordering) [LT,EQ,GT]G comfort-arrayG; denotes a range defined by the start index and the length.+Shape.indices (Shape.Shifted (-4) (8::Int))[-4,-3,-2,-1,0,1,2,3]K comfort-arrayK denotes an inclusive range like those of the Haskell 98 standard Array type from the array package. E.g. the shape type (Range Int32, Range Int64) is equivalent to the ix type (Int32, Int64) for Arrays.)Shape.indices (Shape.Range (-5) (5::Int))[-5,-4,-3,-2,-1,0,1,2,3,4,5]3Shape.indices (Shape.Range (-1,-1) (1::Int,1::Int))=[(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]O comfort-arrayO: denotes a range starting at one and has a certain length.'Shape.indices (Shape.OneBased (7::Int))[1,2,3,4,5,6,7]R comfort-arrayR; denotes a range starting at zero and has a certain length.(Shape.indices (Shape.ZeroBased (7::Int))[0,1,2,3,4,5,6]] comfort-arrayIt should hold 'indexFromOffset sh k == indices sh !! k , but ] should generally be faster. comfort-array?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abfcdeighjklnmopqprstuvwxyz{|}~jk`abfcdeigh\]^_wZ[WXYrlnmopqstvuUVRSTxOPQKLMNGHIJEFCDAByz>?@;<=34569:7821{|}~,-./0&%+*'()$"# !  557776 Safe-Inferred+V Safe-Inferred)*+ Safe-Inferred+   Safe-Inferred, Safe-Inferred/, comfort-array\(QC.NonNegative n) (ArrayChar x) -> x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x)) comfort-array\(QC.NonNegative n) (ArrayChar x) -> x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x)) comfort-array\(ArrayChar x) (ArrayChar y) -> let xy = Array.append x y in x == Array.takeLeft xy && y == Array.takeRight xy comfort-array\(ArrayChar x) (ArrayChar y) (ArrayChar z) -> let xyz = Array.append x $ Array.append y z in y == Array.takeCenter xyz comfort-arrayWe must restrict  to Z because of >. Because the shape is static, we do not need a size check in .9 5 Safe-Inferred/ Safe-Inferred/!!9  Safe-Inferred0 Safe-Inferred0 Safe-Inferred1U9  Safe-Inferred1 Safe-Inferred2T  Safe-Inferred2  Safe-Inferred6 comfort-array-\x -> Array.singleton x ! () == (x::Word16) comfort-array\(QC.NonNegative n) (Array16 x) -> x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x)) comfort-array\(QC.NonNegative n) (Array16 x) -> x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x)) comfort-array\(Array16 x) (Array16 y) -> let xy = Array.append x y in x == Array.takeLeft xy && y == Array.takeRight xy comfort-array\(Array16 x) (Array16 y) (Array16 z) -> let xyz = Array.append x $ Array.append y z in y == Array.takeCenter xyz comfort-array8\(Array16 xs) -> Array.sum xs == sum (Array.toList xs) comfort-array\(Array16 xs) -> Array.product xs == product (Array.toList xs)5  Safe-InferredStorableArray.fromList (ZeroBased {zeroBasedSize = 5}) "abcde" comfort-arrayArray.fromTuple ('a',('b','c')) :: Array.Array (Shape.NestedTuple Shape.TupleIndex (X,(X,X))) CharStorableArray.fromList (NestedTuple {getNestedTuple = (Element 0,(Element 1,Element 2))}) "abc":{ let arr = Array.fromTuple ('a',('b','c')) :: Array.Array (Shape.NestedTuple Shape.TupleAccessor (X,(X,X))) Charin (arr ! fst, arr ! (fst.snd)):} ('a','b') comfort-array-:{ let arr = Array.fromRecord ('a' :+ 'b') inlet (real:+imag) = Shape.indexRecordFromShape $ Array.shape arr in(arr ! real, arr ! imag):} ('a','b') comfort-arrayQC.forAll genNonEmptyArray2 $ \xs -> QC.forAll (QC.elements $ Shape.indices $ Array.shape xs) $ \(ix0,ix1) -> Array.pick xs ix0 ! ix1 == xs!(ix0,ix1) comfort-arrayIt is a checked error if a row width differs from the result array width.QC.forAll genArray2 $ \xs -> xs == Array.fromRowArray (snd $ Array.shape xs) (Array.toRowArray xs) comfort-array-It is a checked error if the vector is empty.forAllNonEmpty $ \xs -> Array.minimum xs ==? minimum (Array.toList xs) comfort-array-It is a checked error if the vector is empty.forAllNonEmpty $ \xs -> Array.maximum xs ==? maximum (Array.toList xs) comfort-arrayforAllNonEmpty $ \xs -> Array.limits xs ==? (Array.minimum xs, Array.maximum xs)229   !""#$%%&''(()*+,-..//0123455466789:;<<=>??@@AABCCDEEFFGGHHIJKKLMNNOPPQRRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\]^ef^                                                       _ ` Y Z  %*comfort-array-0.5.2-33pX9TUz3cvDmUs2yeRJ2NData.Array.Comfort.ShapeData.Array.Comfort.Shape.TestData.Array.Comfort.Container"Data.Array.Comfort.Boxed.UncheckedData.Array.Comfort.Boxed+Data.Array.Comfort.Storable.Mutable.Private#Data.Array.Comfort.Storable.Private#Data.Array.Comfort.Storable.Mutable-Data.Array.Comfort.Storable.Unchecked.Monadic%Data.Array.Comfort.Storable.UncheckedData.Array.Comfort.StorableData.Array.Comfort.Shape.Set Data.Array.Comfort.Shape.UtilityData.Array.Comfort.Shape.TupleData.Array.Comfort.Check)Data.Array.Comfort.Boxed.Strict.Unchecked"Data.Array.Comfort.Storable.Memory-Data.Array.Comfort.Storable.Mutable.UncheckedmessageIndexFromOffset Construction ConsIndex Constructed FieldIndexRecord getRecord ElementIndex StaticTuple staticTuple AccessorTupletupleAccessors ElementTuple DataTuple indexTupleAElement TupleIndex TupleAccessor NestedTuplegetNestedTuple::+Cyclic cyclicSize CollisionC CollisionDistinct RepetitiveSomeRepetitive AllDistinct SimplexOrderCSimplexDescendingSimplexAscending SimplexOrder Ascending DescendingSimplex simplexOrdersimplexDimension simplexSizeUpperTriangularLowerTriangular TriangulartriangularParttriangularSizeUpperLowerCubecubeSizeSquare squareSize DeferredIndexDeferred EnumerationShifted shiftedOffset shiftedSizeRange rangeFromrangeToOneBased oneBasedSize ZeroBased zeroBasedSizeZeroPattern DataPattern indexPatternStaticstatic InvIndexedindexFromOffsetuncheckedIndexFromOffsetunifiedIndexFromOffsetIndexedIndexindicesoffsetuncheckedOffset unifiedOffsetinBounds sizeOffsetuncheckedSizeOffsetunifiedSizeOffsetCsizeCheckSingletonChecked UncheckedCheckingResult switchCheck requireCheck runChecked runUnchecked throwOrErrorassertassertIndexFromOffsetzeroBasedSplit deferIndex revealIndexlowerTriangularupperTriangular triangleSize triangleRootsimplexAscendingsimplexDescendingindexTupleFromShapeindexRecordFromShape construct consIndex$fCheckingUnchecked$fCheckingChecked $fMonadResult$fApplicativeResult$fFunctorResult $fEqResult$fC(,,)$fC(,) $fCTagged$fCMap$fCSet$fC() $fIndexed(,,) $fIndexed(,)$fIndexedTagged $fIndexedMap $fIndexedSet $fIndexed()$fInvIndexed(,,)$fInvIndexed(,)$fInvIndexedTagged$fInvIndexedMap$fInvIndexedSet$fInvIndexed() $fStatic(,,) $fStatic(,)$fStaticTagged $fStatic()$fPatternTagged $fPattern() $fStaticZero$fCZero$fPatternZeroBased$fInvIndexedZeroBased $fCZeroBased$fStorableZeroBased$fNFDataZeroBased$fApplicativeZeroBased$fFunctorZeroBased$fInvIndexedOneBased $fCOneBased$fStorableOneBased$fNFDataOneBased$fApplicativeOneBased$fFunctorOneBased$fStorableRange$fInvIndexedRange$fIndexedRange$fCRange $fNFDataRange$fFunctorRange$fStorableShifted$fInvIndexedShifted$fIndexedShifted $fCShifted$fNFDataShifted$fFunctorShifted$fIndexedOneBased$fIndexedZeroBased$fStorableEnumeration$fStaticEnumeration$fInvIndexedEnumeration$fIndexedEnumeration$fCEnumeration$fNFDataEnumeration$fStaticDeferred $fCDeferred$fNFDataDeferred$fStorableDeferredIndex$fInvIndexedDeferred$fIndexedDeferred$fInvIndexedSquare$fIndexedSquare $fCSquare$fStorableSquare$fNFDataSquare$fApplicativeSquare$fFunctorSquare$fPatternSquare $fPattern(,)$fInvIndexedCube $fIndexedCube$fCCube$fStorableCube $fNFDataCube$fApplicativeCube $fFunctorCube$fTriangularPartUpper$fTriangularPartLower$fStaticTriangular$fInvIndexedTriangular$fIndexedTriangular $fCTriangular$fEqTriangular$fNFDataTriangular$fShowSimplexOrder$fEqSimplexOrder $fShowSimplex$fSimplexOrderCDescending$fSimplexOrderCAscending$fInvIndexedSimplex$fIndexedSimplex $fCSimplex$fCollisionCCollision$fCollisionCSomeRepetitive$fCollisionCAllDistinct$fInvIndexedCyclic$fIndexedCyclic $fCCyclic$fStorableCyclic$fNFDataCyclic$fApplicativeCyclic$fFunctorCyclic $fPattern::+ $fStatic::+$fInvIndexed::+ $fIndexed::+$fC::+ $fNFData::+$fNFDataElement$fCNestedTuple$fElementTupleComplex$fElementTuple(,,,)$fElementTuple(,,)$fElementTuple(,)$fElementTupleElement$fElementTuple()$fMonadStrictUnitWriter$fApplicativeStrictUnitWriter$fFunctorStrictUnitWriter$fNFDataNestedTuple$fIndexedNestedTuple$fAccessorTupleComplex$fAccessorTuple(,,,)$fAccessorTuple(,,)$fAccessorTuple(,)$fAccessorTupleElement$fAccessorTuple()$fStaticNestedTuple$fStaticTupleComplex$fStaticTuple(,,,)$fStaticTuple(,,)$fStaticTuple(,)$fStaticTupleElement$fStaticTuple()$fPatternNestedTuple$fIndexedNestedTuple0$fStaticRecord $fCRecord $fEqRecord$fIndexedRecord$fCConstructed$fInvIndexedConstructed$fIndexedConstructed$fMonadConstruction$fApplicativeConstruction$fFunctorConstruction $fEqConsIndex$fShowConsIndex$fEqConstructed$fShowConstructed$fEqFieldIndex$fShowFieldIndex$fEqElementIndex$fOrdElementIndex$fShowElementIndex $fEqElement $fShowElement$fEqNestedTuple$fShowNestedTuple$fEq::+ $fShow::+ $fEqCyclic $fShowCyclic$fShowCollision $fEqCollision$fOrdCollision$fEnumCollision$fShowSomeRepetitive$fEqSomeRepetitive$fShowAllDistinct$fEqAllDistinct$fShowTriangular $fEqUpper $fShowUpper $fEqLower $fShowLower$fEqCube $fShowCube $fEqSquare $fShowSquare$fEqDeferredIndex$fOrdDeferredIndex$fShowDeferredIndex $fEqDeferred$fShowDeferred$fEqEnumeration$fShowEnumeration $fEqShifted $fShowShifted $fEqRange $fShowRange $fEqOneBased$fShowOneBased $fEqZeroBased$fShowZeroBased$fEqZero $fOrdZero $fShowZerotestsEqShapeeqShapeNFShapernfShapeShape shapeSizefromListtoShape$fCT$fCT0$fCT1$fC[]$fCShape $fNFShapeT $fNFShapeMap $fNFShapeT0 $fNFShapeT1 $fNFShape[] $fNFDataShape $fEqShapeT $fEqShapeMap $fEqShapeT0 $fEqShapeT1 $fEqShape[] $fEqShape $fIndexedT $fIndexedT0 $fIndexed[]$fIndexedShape $fShowShape $fShowShape0 $fShowShape1 $fShowShape2ArrayshapebufferreshapemapShape!toListvectorFromList replicatemapzipWithappendtakedroptakeLeft takeRightsplit takeCenter$fTraversableArray$fFoldableArray$fApplicativeArray$fFunctorArray $fNFDataArray $fShowArray $fEqArrayfromMaptoMap fromTupletoTuple fromRecordtoRecord fromContainer toContainer accessMaybe// accumulatetoAssociationsfromAssociationspickIOArraySTArraycopycreatecreateWithSizecreateWithSizeAndResult unsafeCreateunsafeCreateWithSizeunsafeCreateWithSizeAndResultunsafeArrayIOToPrimshow withArrayPtrwithPtrread readMaybewriteupdatenewfreezethaw unsafeFreeze unsafeThaw mapWithIndex singletonsumproductfoldlsample fromBoxedtoBoxedfromStorableVectortoStorableVector toRowArray fromRowArrayminimummaximumfoldl1limitsfoldMap argMinimum argMaximumerrorIndexFromOffsetisRightbaseData.Traversable Traversableghc-prim GHC.Classes<=Ordcontainers-0.6.5.1Data.Set.InternalSetData.Map.InternalMap GHC.TypesIntForeign.StorableStorableGHC.EnumEnumBounded CheckedResultUncheckedResult getChecked getUnchecked combineOffsetcombineSizeOffset|*|+|deconsgetconsnextGHC.Base Applicativepure<*>