newtype-zoo 1.0.0.1 → 1.1.0.0
raw patch · 4 files changed
+100/−3 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- README.md +25/−1
- newtype-zoo.cabal +3/−2
- src/NewtypeZoo.hs +64/−0
CHANGELOG.md view
@@ -1,5 +1,13 @@ # Revision history for newtype-zoo +## 1.1.0.0 -- 2019-09-19++* Add module `NewtypeZoo` which exports all reexports all wrappers.+ [Proposed on reddit](https://www.reddit.com/r/haskell/comments/d6fiti/announcement_a_library_of_typical_newtype/f0sz4yv?utm_source=share&utm_medium=web2x) by user _Syrak_+* Document comparison to the `tagged` library, it was pointed out by users _gelisam_ and _davidwsd_+ [on reddit](https://www.reddit.com/r/haskell/comments/d6fiti/announcement_a_library_of_typical_newtype/f0tdyns?utm_source=share&utm_medium=web2x).++ ## 1.0.0.1 -- 2019-09-19 * Fix cabal file issues
README.md view
@@ -20,8 +20,12 @@ applyConfiguration :: Wanted MyConfig -> Current MyConfig -> IO (Active MyConfig) ``` -This simple library contains a list of simple newtype wrappers:+The newtype wrappers in this library are all exported by+the [`NewtypeZoo`](https://hackage.haskell.org/package/newtype-zoo/docs/NewtypeZoo.html) module, or can+be imported individually. +This simple library contains a variety of simple newtype wrappers:+ * [`Active`](https://hackage.haskell.org/package/newtype-zoo/docs/NewtypeZoo-Active.html) * [`Allocated`](https://hackage.haskell.org/package/newtype-zoo/docs/NewtypeZoo-Allocated.html) * [`Broken`](https://hackage.haskell.org/package/newtype-zoo/docs/NewtypeZoo-Broken.html)@@ -64,3 +68,23 @@ * [`Wanted`](https://hackage.haskell.org/package/newtype-zoo/docs/NewtypeZoo-Wanted.html) They live in the sub directory `NewtypeZoo`, e.g. `NewtypeZoo.Active`.++This library offers **shorter code** for the special cases.+The `tagged` library is more general, but requires **more code**.++The reason why I prefer this library in some cases, is shorter type signatures.++One can even combine `tagged` with `newtype-zoo` (I think I will add this to the README):++```haskell++import Data.Tagged+import NewtypeZoo.Current+import NewtypeZoo.Wanted++applyConfigurationTagged+ :: Tagged Wanted MyConfig+ -> Tagged Current MyConfig+ -> IO (Tagged Current MyConfig)++```
newtype-zoo.cabal view
@@ -13,7 +13,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 1.0.0.1+version: 1.1.0.0 -- A short (one-line) description of the package. synopsis: Newtype Wrapper Zoo@@ -53,7 +53,8 @@ library -- Modules exported by the library. exposed-modules:- NewtypeZoo.Active+ NewtypeZoo+ , NewtypeZoo.Active , NewtypeZoo.Allocated , NewtypeZoo.Broken , NewtypeZoo.Cached
+ src/NewtypeZoo.hs view
@@ -0,0 +1,64 @@+-- | General Purpose Newtype Wrappers+--+-- A zoo of /newtype/ wrappers.+--+-- In everyday Haskell programming newtype wrappers occur again and again, to+-- convey some extra meaning for the maintainer of the code, and to prevent+-- mixing up parameters to functions with the same type.+--+-- For example:+--+-- @+-- applyConfiguration :: MyConfig -> MyConfig -> IO MyConfig+-- @+--+-- What the user actually wanted to express was:+--+-- @+-- applyConfiguration :: `Wanted` MyConfig -> `Current` MyConfig -> IO (`Active` MyConfig)+-- @+module NewtypeZoo+ (+ module X+ ) where++import NewtypeZoo.Wanted as X+import NewtypeZoo.Valid as X+import NewtypeZoo.Updated as X+import NewtypeZoo.Unwanted as X+import NewtypeZoo.Unchecked as X+import NewtypeZoo.Single as X+import NewtypeZoo.Responded as X+import NewtypeZoo.Required as X+import NewtypeZoo.Requested as X+import NewtypeZoo.Replied as X+import NewtypeZoo.Remaining as X+import NewtypeZoo.Rejected as X+import NewtypeZoo.Proposed as X+import NewtypeZoo.Previous as X+import NewtypeZoo.Pending as X+import NewtypeZoo.Partial as X+import NewtypeZoo.Old as X+import NewtypeZoo.Offered as X+import NewtypeZoo.Obsolete as X+import NewtypeZoo.Next as X+import NewtypeZoo.New as X+import NewtypeZoo.Needed as X+import NewtypeZoo.Multiple as X+import NewtypeZoo.Missing as X+import NewtypeZoo.Marked as X+import NewtypeZoo.Invalid as X+import NewtypeZoo.Inconsistent as X+import NewtypeZoo.Failed as X+import NewtypeZoo.Existing as X+import NewtypeZoo.Established as X+import NewtypeZoo.Enabled as X+import NewtypeZoo.Disabled as X+import NewtypeZoo.Current as X+import NewtypeZoo.Consistent as X+import NewtypeZoo.Completed as X+import NewtypeZoo.Complete as X+import NewtypeZoo.Cached as X+import NewtypeZoo.Broken as X+import NewtypeZoo.Allocated as X+import NewtypeZoo.Active as X