packages feed

natural 0.3.0.2 → 0.3.0.3

raw patch · 3 files changed

+89/−7 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Natural: instance (Natural.MaxNatural ~ a) => Control.Lens.Wrapped.Rewrapped Natural.MaxNatural a
- Natural: instance (Natural.MaxPositive ~ a) => Control.Lens.Wrapped.Rewrapped Natural.MaxPositive a
- Natural: instance (Natural.MinNatural ~ a) => Control.Lens.Wrapped.Rewrapped Natural.MinNatural a
- Natural: instance (Natural.MinPositive ~ a) => Control.Lens.Wrapped.Rewrapped Natural.MinPositive a
- Natural: instance (Natural.ProductNatural ~ a) => Control.Lens.Wrapped.Rewrapped Natural.ProductNatural a
- Natural: instance (Natural.SumPositive ~ a) => Control.Lens.Wrapped.Rewrapped Natural.SumPositive a
+ Natural: instance (Natural.MaxNatural Data.Type.Equality.~ a) => Control.Lens.Wrapped.Rewrapped Natural.MaxNatural a
+ Natural: instance (Natural.MaxPositive Data.Type.Equality.~ a) => Control.Lens.Wrapped.Rewrapped Natural.MaxPositive a
+ Natural: instance (Natural.MinNatural Data.Type.Equality.~ a) => Control.Lens.Wrapped.Rewrapped Natural.MinNatural a
+ Natural: instance (Natural.MinPositive Data.Type.Equality.~ a) => Control.Lens.Wrapped.Rewrapped Natural.MinPositive a
+ Natural: instance (Natural.ProductNatural Data.Type.Equality.~ a) => Control.Lens.Wrapped.Rewrapped Natural.ProductNatural a
+ Natural: instance (Natural.SumPositive Data.Type.Equality.~ a) => Control.Lens.Wrapped.Rewrapped Natural.SumPositive a
+ Natural: minusone :: Positive -> Natural
+ Natural: multiply :: Natural -> Natural -> Natural
+ Natural: multiply1 :: Positive -> Positive -> Positive
+ Natural: oneOr :: AsPositive a => a -> Positive
+ Natural: plus :: Natural -> Natural -> Natural
+ Natural: plus1 :: Positive -> Positive -> Positive
+ Natural: plusone :: Natural -> Positive
+ Natural: square :: Natural -> Natural -> Natural
+ Natural: square1 :: Positive -> Positive -> Positive
+ Natural: zeroOr :: AsNatural a => a -> Natural

Files

changelog.md view
@@ -1,3 +1,7 @@+0.3.0.3++* added some more functions.+ 0.3.0.2  * fix bug in `zero` and `one` prisms.
natural.cabal view
@@ -1,7 +1,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                natural-version:             0.3.0.2+version:             0.3.0.3 synopsis:            Natural number description:          <<http://i.imgur.com/uZnp9ke.png>>@@ -18,7 +18,7 @@ cabal-version:       >=1.10 homepage:            https://github.com/qfpl/natural bug-reports:         https://github.com/qfpl/natural/issues-tested-with:         GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3+tested-with:         GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1  source-repository   head   type:             git@@ -26,7 +26,7 @@  library   exposed-modules:     Natural-  build-depends:       base >=4.8 && <4.12+  build-depends:       base >=4.8 && <4.13                      , lens >=4.15 && < 4.18                      , semigroupoids >= 5 && < 6   hs-source-dirs:      src@@ -36,8 +36,8 @@     build-depends:     semigroups >= 0.9 && < 0.19  test-suite             tests-  build-depends:       QuickCheck >=2.9.2 && <2.12-                     , base >=4.8 && <4.12+  build-depends:       QuickCheck >=2.9.2 && <2.13+                     , base >=4.8 && <4.13                      , checkers >=0.4.6 && <0.5                      , natural                      , hedgehog >=0.5 && <0.7
src/Natural.hs view
@@ -14,6 +14,10 @@ , zero' , successor , successor'+, plus+, multiply+, square+, zeroOr , length , replicate , take@@ -37,6 +41,10 @@ , successor1 , successor1' , successorW+, plus1+, multiply1+, square1+, oneOr , notZero , length1 , replicate1@@ -50,6 +58,8 @@ , elemIndex1 , minus1 , list1+, plusone+, minusone ) where  import Control.Applicative(Const)@@ -65,14 +75,14 @@ import Data.List(iterate, zip, filter, map, repeat) import Data.List.NonEmpty(NonEmpty((:|))) import qualified Data.List.NonEmpty as NonEmpty(iterate, zip, filter)-import Data.Maybe(listToMaybe, Maybe(Just, Nothing))+import Data.Maybe(listToMaybe, Maybe(Just, Nothing), fromMaybe) import Data.Monoid(Monoid(mappend, mempty)) import Data.Ord(Ord((<)), min, max) import Data.Semigroup(Semigroup((<>))) import Data.Semigroup.Foldable(Foldable1(foldMap1)) import Data.Tuple(fst, snd) import Data.Word(Word)-import Prelude(Show, Integral, Integer, (-), (+), (*), fromIntegral)+import Prelude(Show, Integral, Integer, (-), (+), (*), (^), fromIntegral)  newtype Natural =   Natural@@ -255,6 +265,34 @@ successor' =   (successor #) +plus ::+  Natural+  -> Natural+  -> Natural+plus =+  (<>)++multiply ::+  Natural+  -> Natural+  -> Natural+multiply x y =+  (_Wrapped # x <> (_Wrapped # y :: ProductNatural)) ^. _Wrapped++square ::+  Natural+  -> Natural+  -> Natural+square (Natural x) (Natural y) =+  Natural (x ^ y)++zeroOr ::+  AsNatural a =>+  a+  -> Natural+zeroOr n =+  fromMaybe zero' (n ^? _Natural)+ length ::   Foldable f =>   f a@@ -543,6 +581,34 @@     (\(Natural n) -> Positive (n + 1))     (\(Positive n) -> Natural (n - 1)) +plus1 ::+  Positive+  -> Positive+  -> Positive+plus1 x y =+  (_Wrapped # x <> (_Wrapped # y :: SumPositive)) ^. _Wrapped++multiply1 ::+  Positive+  -> Positive+  -> Positive+multiply1 =+  (<>)++square1 ::+  Positive+  -> Positive+  -> Positive+square1 (Positive x) (Positive y) =+  Positive (x ^ y)++oneOr ::+  AsPositive a =>+  a+  -> Positive+oneOr n =+  fromMaybe one' (n ^? _Positive)+ notZero ::   Prism'     Natural@@ -639,3 +705,15 @@   iso     (\n -> replicate1 n ())     length1++plusone ::+  Natural+  -> Positive+plusone =+  (^. successorW)++minusone ::+  Positive+  -> Natural+minusone =+  (successorW #)