packages feed

type-unary 0.2.14 → 0.2.15

raw patch · 2 files changed

+15/−2 lines, 2 filesdep +newtype

Dependencies added: newtype

Files

src/TypeUnary/Vec.hs view
@@ -54,6 +54,8 @@ import Foreign.Storable import Foreign.Ptr (Ptr,plusPtr,castPtr) +import Control.Newtype (Newtype(..))+ import Data.VectorSpace  import TypeUnary.Nat@@ -211,6 +213,13 @@   traverse _ ZVec      = pure ZVec   traverse f (a :< as) = liftA2 (:<) (f a) (traverse f as) +instance Newtype (Vec Z a) () where+  pack () = ZVec+  unpack ZVec = ()++instance Newtype (Vec (S n) a) (a,Vec n a) where+  pack = uncurry (:<)+  unpack = unConsV  instance (IsNat n, Num a) => AdditiveGroup (Vec n a) where   { zeroV = pure 0; (^+^) = liftA2 (+) ; negateV = fmap negate }
type-unary.cabal view
@@ -1,5 +1,5 @@ Name:                type-unary-Version:             0.2.14+Version:             0.2.15 Cabal-Version:       >= 1.6 Synopsis:               Type-level and typed unary natural numbers, inequality proofs, vectors@@ -25,7 +25,11 @@ Library   hs-Source-Dirs:      src   Extensions:-  Build-Depends:       base >=4 && < 5, ty>=0.1.5, vector-space, applicative-numbers+  Build-Depends:       base >=4 && < 5+                     , newtype >= 0.2+                     , ty >= 0.1.5+                     , vector-space+                     , applicative-numbers   Exposed-Modules:                             TypeUnary.TyNat                        TypeUnary.Nat