choice 0.2.3 → 0.2.4
raw patch · 2 files changed
+11/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- choice.cabal +1/−1
- src/Data/Choice.hs +10/−0
choice.cabal view
@@ -1,5 +1,5 @@ name: choice-version: 0.2.3+version: 0.2.4 synopsis: A solution to boolean blindness. description: Please see README.md. homepage: https://github.com/mboes/choice#readme
src/Data/Choice.hs view
@@ -9,7 +9,9 @@ -- 'Choice' is the type of labeled booleans. Use it as follows: -- -- @+-- {-\# LANGUAGE DataKinds \#-} -- {-\# LANGUAGE OverloadedLabels \#-}+-- {-\# LANGUAGE PatternSynonyms \#-} -- -- import Data.Choice (Choice, pattern Do, pattern Don't) --@@ -187,6 +189,14 @@ fromBool :: Bool -> Choice a fromBool False = Off Label fromBool True = On Label++isTrue :: Choice a -> Bool+isTrue (Off _) = False+isTrue (On _) = True++isFalse :: Choice a -> Bool+isFalse (Off _) = True+isFalse (On _) = False -- | Case analysis for the 'Choice' type. @choice x y p@ evaluates to @x@ when -- @p@ is false, and evaluates to @y@ when @p@ is true.