packages feed

notzero 0.0.3 → 0.0.4

raw patch · 3 files changed

+22/−1 lines, 3 files

Files

changelog view
@@ -1,3 +1,7 @@+0.0.4++* Add `NotZero` functions to construct with default.+ 0.0.3  * Monoid instances on `NotZeroOr` and `AccNotZeroOr`.
notzero.cabal view
@@ -1,5 +1,5 @@ name:               notzero-version:            0.0.3+version:            0.0.4 license:            BSD3 license-file:       LICENSE author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>
src/Data/NotZero.hs view
@@ -2,6 +2,8 @@   NotZero , getNotZero , notZero+, notZeroElse+, notZero1 ) where  import Control.Lens(Prism', prism')@@ -30,6 +32,21 @@   prism'     getNotZero     (\a -> bool (Just (NotZero a)) Nothing (a == 0))++notZeroElse ::+  (Eq a, Num a) =>+  a+  -> a+  -> NotZero a+notZeroElse d a =+  NotZero (bool 1 d (a == 0))+  +notZero1 ::+  (Eq a, Num a) =>+  a+  -> NotZero a+notZero1 =+  notZeroElse 1  instance Num a => Semigroup (NotZero a) where   NotZero a <> NotZero b =