orthotope 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+65/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Array.Shaped.Instances: instance (Data.Array.Internal.Shape.Shape sh, GHC.Enum.Enum a) => GHC.Enum.Enum (Data.Array.Internal.Shaped.Array sh a)
+ Data.Array.Shaped.Instances: instance (Data.Array.Internal.Shape.Shape sh, GHC.Float.Floating a) => GHC.Float.Floating (Data.Array.Internal.Shaped.Array sh a)
+ Data.Array.Shaped.Instances: instance (Data.Array.Internal.Shape.Shape sh, GHC.Num.Num a) => GHC.Num.Num (Data.Array.Internal.Shaped.Array sh a)
+ Data.Array.Shaped.Instances: instance (Data.Array.Internal.Shape.Shape sh, GHC.Real.Fractional a) => GHC.Real.Fractional (Data.Array.Internal.Shaped.Array sh a)
+ Data.Array.Shaped.Instances: instance (Data.Array.Internal.Shape.Shape sh, GHC.Real.Integral a) => GHC.Real.Integral (Data.Array.Internal.Shaped.Array sh a)
+ Data.Array.Shaped.Instances: instance (Data.Array.Internal.Shape.Shape sh, GHC.Real.Real a) => GHC.Real.Real (Data.Array.Internal.Shaped.Array sh a)
Files
- Data/Array/Shaped/Instances.hs +59/−0
- README.md +3/−0
- orthotope.cabal +3/−2
+ Data/Array/Shaped/Instances.hs view
@@ -0,0 +1,59 @@+--+-- Numeric instances that can be useful, but might not be what you want.+--+{-# OPTIONS_GHC -Wno-orphans #-}+module Data.Array.Shaped.Instances where+import Data.Array.Shaped++instance (Shape sh, Num a) => Num (Array sh a) where+ (+) = zipWithA (+)+ (-) = zipWithA (-)+ (*) = zipWithA (*)+ negate = mapA negate+ abs = mapA abs+ signum = mapA signum+ fromInteger = constant . fromInteger++instance (Shape sh, Fractional a) => Fractional (Array sh a) where+ (/) = zipWithA (/)+ recip = mapA recip+ fromRational = constant . fromRational++instance (Shape sh, Floating a) => Floating (Array sh a) where+ pi = constant pi+ exp = mapA exp+ log = mapA log+ sqrt = mapA sqrt+ (**) = zipWithA (**)+ logBase = zipWithA logBase+ sin = mapA sin+ cos = mapA cos+ tan = mapA tan+ asin = mapA asin+ acos = mapA acos+ atan = mapA atan+ sinh = mapA sinh+ cosh = mapA cosh+ tanh = mapA tanh+ asinh = mapA asinh+ acosh = mapA acosh+ atanh = mapA atanh++-- Real cannot be implemented, but is a superclass of Integral.+instance (Shape sh, Real a) => Real (Array sh a) where+ toRational _ = error "toRational of an Array"++-- Enum cannot be implemented, but is a superclass of Integral.+instance (Shape sh, Enum a) => Enum (Array sh a) where+ toEnum _ = error "toEnum of an Array"+ fromEnum _ = error "fromEnum of an Array"++-- Integral can only be partially implemented+instance (Shape sh, Integral a) => Integral (Array sh a) where+ quot = zipWithA quot+ rem = zipWithA rem+ div = zipWithA div+ mod = zipWithA mod+ quotRem x y = (quot x y, rem x y)+ divMod x y = (div x y, mod x y)+ toInteger _ = error "toInteger of an Array"
README.md view
@@ -8,6 +8,9 @@ This is a library for multi-dimensional arrays inspired by APL. +### See also+The orthotope-hmatrix repo contains some more functionality.+ ## Multi-dimensional arrays Each array has a number of elements of the same type, and a *shape*. The shape
orthotope.cabal view
@@ -1,5 +1,5 @@ name: orthotope-version: 0.1.1.0+version: 0.1.2.0 synopsis: Multidimensional arrays inspired by APL license: Apache license-file: LICENSE@@ -7,7 +7,7 @@ category: array maintainer: lennart@augustsson.net description: Multidimensional arrays inspired by APL.- The library contains a wide variety of structurual+ The library contains a wide variety of structural operations on arrays, but not actual algorithms. build-type: Simple cabal-version: >=1.10@@ -35,6 +35,7 @@ , Data.Array.RankedU , Data.Array.Shape , Data.Array.Shaped+ , Data.Array.Shaped.Instances , Data.Array.ShapedG , Data.Array.ShapedS , Data.Array.ShapedU