type-unary 0.2.3 → 0.2.4
raw patch · 3 files changed
+23/−3 lines, 3 filesdep +applicative-numbers
Dependencies added: applicative-numbers
Files
- src/.ghci +2/−0
- src/TypeUnary/Vec.hs +17/−1
- type-unary.cabal +4/−2
+ src/.ghci view
@@ -0,0 +1,2 @@+-- So ghci can find ApplicativeNumeric-inc.hs+:set -package applicative-numbers
src/TypeUnary/Vec.hs view
@@ -35,7 +35,7 @@ , flattenV, swizzle, split, deleteV, elemsV , zipV , zipWithV , unzipV , zipV3, zipWithV3, unzipV3- , cross+ , transpose, cross , ToVec(..) ) where @@ -574,6 +574,10 @@ cross :: Vec m a -> Vec n b -> Vec m (Vec n (a,b)) cross as bs = (\ a -> (a,) <$> bs) <$> as +-- | Matrix transposition. Specialization of 'sequenceA'.+transpose :: IsNat n => Vec m (Vec n a) -> Vec n (Vec m a)+transpose = sequenceA+ {-------------------------------------------------------------------- Conversion to vectors --------------------------------------------------------------------}@@ -597,3 +601,15 @@ result :: (b -> b') -> ((a -> b) -> (a -> b')) result = (.)++{--------------------------------------------------------------------+ Numeric instances via the applicative-numbers package+--------------------------------------------------------------------}++-- Generate bogus (error-producing) Enum+#define INSTANCE_Enum++#define CONSTRAINTS IsNat n, ++#define APPLICATIVE Vec n+#include "ApplicativeNumeric-inc.hs"
type-unary.cabal view
@@ -1,5 +1,5 @@ Name: type-unary-Version: 0.2.3+Version: 0.2.4 Cabal-Version: >= 1.6 Synopsis: Type-level and typed unary natural numbers, inequality proofs, vectors@@ -16,6 +16,7 @@ License-File: COPYING Stability: provisional build-type: Simple+data-files: src/.ghci source-repository head type: git@@ -24,10 +25,11 @@ Library hs-Source-Dirs: src Extensions:- Build-Depends: base >=4 && < 5, ty, vector-space+ Build-Depends: base >=4 && < 5, ty, vector-space, applicative-numbers Exposed-Modules: TypeUnary.TyNat TypeUnary.Nat TypeUnary.Vec ghc-options: -Wall+