type-unary 0.2.0 → 0.2.1
raw patch · 3 files changed
+10/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ TypeUnary.Nat: unIndex :: (Num a, Enum a) => Index m -> a
+ TypeUnary.Vec: iota :: (IsNat n, Num a, Enum a) => Vec n a
Files
- src/TypeUnary/Nat.hs +4/−1
- src/TypeUnary/Vec.hs +5/−1
- type-unary.cabal +1/−1
src/TypeUnary/Nat.hs view
@@ -22,7 +22,7 @@ , natToZ, natEq, natAdd, natMul , IsNat(..) -- * Inequality proofs and indices- , (:<:)(..), Index(..), succI, index0, index1, index2, index3+ , (:<:)(..), Index(..), unIndex, succI, index0, index1, index2, index3 , coerceToIndex ) where @@ -130,6 +130,9 @@ -- TODO: Consider removing the Nat n field, since it's computable from -- IsNat n or n :<: lim.++unIndex :: (Num a, Enum a) => Index m -> a+unIndex (Index _ j) = natToZ j instance Eq (Index lim) where Index _ n == Index _ n' = isJust (n `natEq` n')
src/TypeUnary/Vec.hs view
@@ -23,7 +23,7 @@ ( module TypeUnary.Nat -- * Vectors- , Vec(..), headV, tailV, joinV, (<+>), indices+ , Vec(..), headV, tailV, joinV, (<+>), indices, iota , Vec0,Vec1,Vec2,Vec3,Vec4,Vec5,Vec6,Vec7,Vec8,Vec9 , Vec10,Vec11,Vec12,Vec13,Vec14,Vec15,Vec16 , vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8@@ -250,6 +250,10 @@ -- (most?) will fail because they rely on a polymorphic combining function. -- Convert from vector to list via Data.Foldable.toList++-- | Vector of ints from 0 to n-1. Named for APL iota operation (but 0 based).+iota :: (IsNat n, Num a, Enum a) => Vec n a+iota = unIndex <$> indices -- Convenient nicknames
type-unary.cabal view
@@ -1,5 +1,5 @@ Name: type-unary-Version: 0.2.0+Version: 0.2.1 Cabal-Version: >= 1.2 Synopsis: Type-level and typed unary natural numbers, inequality proofs, vectors