bins 0.1.1.1 → 0.1.2.0
raw patch · 3 files changed
+38/−7 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Bin: expandFin :: KnownNat n => Pointed (Finite n) -> Finite ((1 + n) + 1)
+ Data.Bin: unexpandFin :: KnownNat n => Finite ((1 + n) + 1) -> Pointed (Finite n)
- Data.Bin: binFinExt :: KnownNat n => Bin s n -> Finite (1 + n + 1)
+ Data.Bin: binFinExt :: KnownNat n => Bin s n -> Finite ((1 + n) + 1)
Files
- CHANGELOG.md +10/−0
- bins.cabal +7/−5
- src/Data/Bin.hs +21/−2
CHANGELOG.md view
@@ -1,5 +1,15 @@ # Changelog +Version 0.1.2.0+---------------++*October 4, 2019*++<https://github.com/mstksg/backprop/releases/tag/v0.1.2.0>++* Add `expandFin` and `unexpandFin`, meant to make conversion between+ `Pointed` and `Finite` more streamlined.+ Version 0.1.1.1 ---------------
bins.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.28.2.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: d3a0afd067f13ba2e886ad66828fdb40215329e79a93de097003e945e182473d+-- hash: 2d39bb70debd2683b6b3f7d4d013a5358e519b6b21cf2eb6af0a98fb6292d10e name: bins-version: 0.1.1.1+version: 0.1.2.0 synopsis: Aggregate continuous values into discrete bins description: Please see the README on GitHub at <https://github.com/mstksg/bins#readme> category: Math@@ -16,11 +18,11 @@ copyright: (c) Justin Le 2018 license: BSD3 license-file: LICENSE+tested-with: GHC >= 8.2 build-type: Simple-cabal-version: >= 1.10 extra-source-files:- CHANGELOG.md README.md+ CHANGELOG.md source-repository head type: git
src/Data/Bin.hs view
@@ -47,7 +47,7 @@ -- ** Showing bins , displayBin, displayBinDouble -- *** In-depth inspection- , Pointed(..), pointed, pElem, binIx, fromIx+ , Pointed(..), pointed, pElem, binIx, fromIx, expandFin, unexpandFin -- * Untyped , SomeBin(..), sameBinSpec -- * Handy use patterns@@ -238,7 +238,7 @@ :: KnownNat n => Bin s n -> Finite (1 + n + 1)-binFinExt = pointed minBound (weaken . shift) maxBound . binIx+binFinExt = expandFin . binIx -- | Like 'binFin', but squishes or compresses "below minimum" to "above -- maximum" bins into the 'Finite', counting them in the same bin as the@@ -444,6 +444,25 @@ -- as well. fromFin :: Finite n -> Bin s n fromFin = fromIx . PElem++-- | "Expand" a 'Pointed' containing a 'Finite' to a wider-ranged 'Finite'.+-- Used for 'binFinExt'+--+-- @since 0.1.2.0+expandFin :: KnownNat n => Pointed (Finite n) -> Finite (1 + n + 1)+expandFin = pointed minBound (weaken . shift) maxBound++-- | The inverse of 'expandFin': "re-pack" a 'Finite' back into+-- a 'Pointed' containing a narrower-ranged 'Finite'.+--+-- @since 0.1.2.0+unexpandFin :: KnownNat n => Finite (1 + n + 1) -> Pointed (Finite n)+unexpandFin x = case unshift x of+ Nothing -> Bot+ Just y -> case strengthen y of+ Nothing -> Top+ Just z -> PElem z+ -- | A @'SomeBin' a n@ is @'Bin' s n@, except with the 'BinSpec' s hidden. -- It's useful for returning out of 'withBinner'.