packages feed

choice 0.1.1.0 → 0.2.0

raw patch · 3 files changed

+25/−14 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Choice: instance GHC.Generics.Generic (Data.Choice.Choice a)

Files

README.md view
@@ -1,3 +1,10 @@ # Choice: a solution to boolean blindness  [![Build Status](https://travis-ci.org/mboes/choice.svg?branch=master)](https://travis-ci.org/mboes/choice)+[![choice on Stackage LTS](http://stackage.org/package/choice/badge/lts)](http://stackage.org/lts/package/choice)+[![choice on Stackage Nightly](http://stackage.org/package/choice/badge/nightly)](http://stackage.org/nightly/package/choice)++Represent do/don't, is/isn't, with/without flags with `Choice`. See+the introduction in the [API reference][api-reference].++[api-reference]: https://hackage.haskell.org/package/choice/docs/Data-Choice.html
choice.cabal view
@@ -1,5 +1,5 @@ name:                choice-version:             0.1.1.0+version:             0.2.0 synopsis:            A solution to boolean blindness. description:         Please see README.md. homepage:            https://github.com/mboes/choice#readme
src/Data/Choice.hs view
@@ -33,6 +33,8 @@  {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -63,6 +65,8 @@ #if MIN_VERSION_base(4,9,0) import GHC.OverloadedLabels (IsLabel(..)) #endif+import Data.Typeable (Typeable)+import GHC.Generics (Generic) import GHC.TypeLits (Symbol)  -- $label-export@@ -82,11 +86,23 @@ data Choice (a :: Symbol)   = Off {-# UNPACK #-} !(Label a)   | On {-# UNPACK #-} !(Label a)-  deriving (Eq, Ord)+  deriving (Eq, Ord, Generic, Typeable)  instance Show (Choice a) where   show x = "fromBool " ++ show (toBool x) +instance Enum (Choice a) where+  toEnum 0 = Off Label+  toEnum 1 = On Label+  toEnum _ = error "Prelude.Enum.Choice.toEnum: bad argument"++  fromEnum (Off _) = 0+  fromEnum (On _) = 1++instance Bounded (Choice a) where+  minBound = Off Label+  maxBound = On Label+ -- | Alias for 'True', e.g. @Do #block@. pattern Do x = On x @@ -104,18 +120,6 @@  -- | Alias for 'False', e.g. @Without #ownDirectory@. pattern Without x = Off x--instance Enum (Choice a) where-  toEnum 0 = Off Label-  toEnum 1 = On Label-  toEnum _ = error "Prelude.Enum.Choice.toEnum: bad argument"--  fromEnum (Off _) = 0-  fromEnum (On _) = 1--instance Bounded (Choice a) where-  minBound = Off Label-  maxBound = On Label  toBool :: Choice a -> Bool toBool (Off _) = False