assert-failure 0.1.2.5 → 0.1.2.6
raw patch · 4 files changed
+16/−16 lines, 4 filesdep ~basedep ~pretty-showdep ~textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, pretty-show, text
API changes (from Hackage documentation)
- Control.Exception.Assert.Sugar: allB :: Show a => (a -> Bool) -> [a] -> Bool
+ Control.Exception.Assert.Sugar: allB :: Show v => (v -> Bool) -> [v] -> Bool
- Control.Exception.Assert.Sugar: assert :: () => Bool -> a -> a
+ Control.Exception.Assert.Sugar: assert :: Bool -> a -> a
- Control.Exception.Assert.Sugar: blame :: Show a => Bool -> a -> Bool
+ Control.Exception.Assert.Sugar: blame :: Show v => Bool -> v -> Bool
Files
- Control/Exception/Assert/Sugar.hs +7/−7
- LICENSE +1/−1
- README.md +1/−1
- assert-failure.cabal +7/−7
Control/Exception/Assert/Sugar.hs view
@@ -26,12 +26,12 @@ -- Used as in -- -- > assert (age < 120 `blame` age) $ savings / (120 - age)-blame :: Show a => Bool -> a -> Bool+blame :: Show v => Bool -> v -> Bool {-# NOINLINE blame #-} blame True _ = True blame False blamed = trace (blameMessage blamed) False -blameMessage :: Show a => a -> String+blameMessage :: Show v => v -> String blameMessage blamed = "Contract failed and the following is to blame:\n " ++ Show.Pretty.ppShow blamed @@ -46,10 +46,10 @@ -- extension is enabled. showFailure :: Show v => String -> v -> String {-# NOINLINE showFailure #-}-showFailure s v =+showFailure s blamed = "Internal failure occurred and the following is to blame:\n " ++ s ++ "\n "- ++ Show.Pretty.ppShow v+ ++ Show.Pretty.ppShow blamed infix 2 `swith` -- | Syntactic sugar for the pair operation, to be used for 'blame' as in@@ -60,19 +60,19 @@ -- about defaulting, even when @OverloadedStrings@ extension is enabled. swith :: String -> v -> (String, v) {-# INLINE swith #-}-swith s v = (s, v)+swith s blamed = (s, blamed) -- | Like 'List.all', but if the predicate fails, blame all the list elements -- and especially those for which it fails. To be used as in -- -- > assert (allB (<= height) [yf, y1, y2])-allB :: Show a => (a -> Bool) -> [a] -> Bool+allB :: Show v => (v -> Bool) -> [v] -> Bool {-# NOINLINE allB #-} allB predicate l = case all predicate l of True -> True False -> trace (allBMessage predicate l) False -allBMessage :: Show a => (a -> Bool) -> [a] -> String+allBMessage :: Show v => (v -> Bool) -> [v] -> String allBMessage predicate l = "The following items on the list don't respect the contract:\n" ++ Show.Pretty.ppShow (filter (not . predicate) l)
LICENSE view
@@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2015-2020, Mikolaj Konarski+Copyright (c) 2015-2022, Mikolaj Konarski All rights reserved. Redistribution and use in source and binary forms, with or without
README.md view
@@ -1,4 +1,4 @@-assert-failure [](http://travis-ci.org/Mikolaj/assert-failure) [](https://hackage.haskell.org/package/assert-failure)+assert-failure [](https://hackage.haskell.org/package/assert-failure) ============== This library contains syntactic sugar that makes it easier
assert-failure.cabal view
@@ -6,7 +6,7 @@ -- PVP summary:+-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.2.5+version: 0.1.2.6 synopsis: Syntactic sugar improving 'assert' and 'error' description: This library contains syntactic sugar that makes it easier to write simple contracts with 'assert' and 'error'@@ -15,7 +15,7 @@ bug-reports: https://github.com/Mikolaj/assert-failure/issues license: BSD3 license-file: LICENSE-tested-with: GHC >= 7.10 && <= 8.10+tested-with: GHC ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.3 || ==9.4 data-files: LICENSE, README.md author: Mikolaj Konarski maintainer: Mikolaj Konarski <mikolaj.konarski@funktory.com>@@ -29,17 +29,17 @@ library exposed-modules: Control.Exception.Assert.Sugar -- other-modules:- build-depends: base >= 4.6 && < 5,- text >= 0.11.2.3 && < 2,- pretty-show >= 1.6 && < 2+ build-depends: base >= 4.6 && < 99,+ text >= 0.11.2.3,+ pretty-show >= 1.6 default-language: Haskell2010 default-extensions: MonoLocalBinds, ScopedTypeVariables, OverloadedStrings BangPatterns, RecordWildCards, NamedFieldPuns, MultiWayIf, LambdaCase, DefaultSignatures, InstanceSigs, PatternSynonyms--- TODO: , StrictData+-- TODO: more, after old GHCs dropped other-extensions: RankNTypes ghc-options: -Wall -fwarn-orphans -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -fwarn-implicit-prelude -fwarn-identities--- TODO: ghc-options: -Wall -Wcompat -Worphans -Wincomplete-uni-patterns -Wincomplete-record-updates -Wimplicit-prelude -Wmissing-home-modules -Widentities -Wredundant-constraints -Wmissing-export-lists -Wpartial-fields+-- TODO: more, after old GHCs dropped ghc-options: -fno-ignore-asserts