assert-failure 0.1 → 0.1.1.0
raw patch · 3 files changed
+22/−7 lines, 3 filesdep ~pretty-show
Dependency ranges changed: pretty-show
Files
- Control/Exception/Assert/Sugar.hs +5/−4
- README.md +5/−1
- assert-failure.cabal +12/−2
Control/Exception/Assert/Sugar.hs view
@@ -25,7 +25,7 @@ -- | If the condition fails, display the value blamed for the failure. -- Used as in ----- > assert (age >= 0 `blame` age) $ savings / (99 - age)+-- > assert (age < 120 `blame` age) $ savings / (120 - age) blame :: Show a => Bool -> a -> Bool {-# INLINE blame #-} blame True _ = True@@ -49,13 +49,14 @@ ++ Show.Pretty.ppShow blamed in trace s $ asrt False- $ error "Assert.failure: no error position (upgrade to GHC >= 7.4)"+ $ error "Control.Exception.Assert.Sugar.failure"+ -- Lack of no-ignore-asserts or GHC < 7.4. infix 2 `twith` -- | Syntactic sugar for the pair operation, to be used in 'blame' -- and 'failure' as in ----- > assert (age >= 0 `blame` "negative age" `twith` age) $ savings / (99 - age)+-- > assert (age < 120 `blame` "age too high" `twith` age) $ savings / (120 - age) -- -- or --@@ -74,7 +75,7 @@ -- Syntactic sugar for the pair operation, to be used in 'blame' -- and 'failure' as in ----- > assert (age >= 0 `blame` "negative age" `swith` age) $ savings / (99 - age)+-- > assert (age < 120 `blame` "age too high" `swith` age) $ savings / (120 - age) -- -- or --
README.md view
@@ -1,4 +1,4 @@-assert-failure [](http://travis-ci.org/Mikolaj/assert-failure)+assert-failure [](http://travis-ci.org/Mikolaj/assert-failure)[](https://drone.io/github.com/Mikolaj/assert-failure/latest) ============== This library contains syntactic sugar that improves@@ -6,6 +6,10 @@ This is actually a bunch of hacks wrapping the original 'assert' function, which is, as of GHC 7.8, the only simple way of obtaining source positions. The original 'assert' function is here re-exported for convenience.++See also <http://hackage.haskell.org/package/loch>,+<http://hackage.haskell.org/package/assert>+and <https://ghc.haskell.org/trac/ghc/ticket/5273>. Make sure to enable assertions for your cabal package, e.g., by setting
assert-failure.cabal view
@@ -1,10 +1,20 @@ name: assert-failure-version: 0.1+-- The package version. See the Haskell package versioning policy (PVP)+-- for standards guiding when and how versions should be incremented.+-- http://www.haskell.org/haskellwiki/Package_versioning_policy+-- PVP summary: +-+------- breaking API changes+-- | | +----- non-breaking API additions+-- | | | +--- code changes with no API change+version: 0.1.1.0 synopsis: Syntactic sugar improving 'assert' and 'error' description: This library contains syntactic sugar that improves the usability of 'assert' and 'error'. This is actually a bunch of hacks wrapping the original 'assert' function, see inside.+ .+ See also <http://hackage.haskell.org/package/loch>,+ <http://hackage.haskell.org/package/assert>+ and <https://ghc.haskell.org/trac/ghc/ticket/5273>. homepage: https://github.com/Mikolaj/assert-failure bug-reports: https://github.com/Mikolaj/assert-failure/issues license: BSD3@@ -26,7 +36,7 @@ -- other-modules: build-depends: base >= 4 && < 5, text >= 0.11.2.3 && < 2,- pretty-show >= 1.6 && < 1.6.2+ pretty-show >= 1.6 && < 2 default-language: Haskell2010 default-extensions: MonoLocalBinds, ScopedTypeVariables,