natural 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+43/−3 lines, 3 files
Files
- changelog.md +7/−1
- natural.cabal +1/−1
- src/Natural.hs +35/−1
changelog.md view
@@ -1,6 +1,12 @@+0.1.0.2++* add `minus` function.+* add `one` and `one'` values.+* add `list` iso.+ 0.1.0.1 -* Add support for GHC 7.10 and GHC 8.4+* Add support for GHC 7.10 and GHC 8.4. 0.1.0.0
natural.cabal view
@@ -1,7 +1,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: natural-version: 0.1.0.1+version: 0.1.0.2 synopsis: Natural number description: <<http://i.imgur.com/uZnp9ke.png>>
src/Natural.hs view
@@ -12,6 +12,8 @@ , MinNatural(..) , zero , zero'+, one+, one' , successor , successor' , length@@ -24,11 +26,13 @@ , findIndex , elemIndices , elemIndex+, minus+, list ) where import Control.Applicative(Const) import Control.Category((.), id)-import Control.Lens(Wrapped(_Wrapped', Unwrapped), Rewrapped, Prism', Lens', (^?), ( # ), _Wrapped, prism', iso)+import Control.Lens(Wrapped(_Wrapped', Unwrapped), Rewrapped, Prism', Lens', Iso', (^?), ( # ), _Wrapped, prism', iso) import Control.Monad((>>=)) import Data.Bool(Bool) import Data.Eq(Eq((==)))@@ -211,6 +215,20 @@ zero' = zero # () +one ::+ Prism'+ Natural+ ()+one =+ prism'+ (\() -> Natural 1)+ (\(Natural n) -> if n == 1 then Nothing else Just ())++one' ::+ Natural+one' =+ one # ()+ successor :: Prism' Natural@@ -311,3 +329,19 @@ -> Maybe Natural elemIndex = findIndex . (==)++minus ::+ Natural+ -> Natural+ -> Natural+minus (Natural x) (Natural y) =+ Natural (if x < y then 0 else x - y)++list ::+ Iso'+ Natural+ [()]+list =+ iso+ (\n -> replicate n ())+ length