packages feed

d10 0.1.0.0 → 0.1.0.1

raw patch · 5 files changed

+78/−19 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -1,1 +1,39 @@ # d10++Data types representing the digits zero through nine.++## Modules++Each of the following modules defines a different type named+`D10`, all of which are different representations of the same+concept:++* `Data.D10.Char` - Defines a `D10` type as a newtype for `Char`,+  where the values are restricted to characters between `'0'` and+  `'9'`.+* `Data.D10.Num` - Defines a `D10` type as a newtype for any+  type with an instance of the `Num` class, where the values+  are restricted to numbers between `fromInteger 0` and+  `fromInteger 9`.+* `Data.D10.Safe` - Defines a `D10` type as+  `D0 | D1 | D2 | ... | D9`.++Other modules:++* `Data.D10.Predicate` - Functions to test whether values of+  various types represent digits in the range *0* to *9*.++## Quasi-quoters++Each module that defines a `D10` type also defines quasi-quoters+for it. With the `QuasiQuotes` GHC extension enabled, a single+digit like *7* can be written as `[d10|7|]`, and a list of digits+like *[4,5,6]* can be written as `[d10|456|]`. For `Data.D10.Char`+and `Data.D10.Num`, the quasi-quoters are an important feature,+because the `D10` types defined in these modules have unsafe+constructors, and the quasi-quoters provide compile-time assurance+that we never construct a `D10` that represents a value outside+the range *0* to *9*. For `Data.D10.Safe`, the quasi-quoter is+offered merely as a possible convenience, allowing you to write+`[d10|456789|]` in place of the somewhat longer expression+`[D4,D5,D6,D7,D8,D9]`.
d10.cabal view
@@ -1,5 +1,5 @@ name: d10-version: 0.1.0.0+version: 0.1.0.1 category: Data synopsis: Digits 0-9 
src/Data/D10/Char.hs view
@@ -77,7 +77,7 @@  -- template-haskell import           Language.Haskell.TH        (ExpQ, Q)-import           Language.Haskell.TH.Quote  (QuasiQuoter (QuasiQuoter))+import           Language.Haskell.TH.Quote  (QuasiQuoter (..)) import           Language.Haskell.TH.Syntax (Lift (lift))  -- $setup@@ -693,9 +693,6 @@  --------------------------------------------------- -qq :: Lift a => (String -> Q a) -> QuasiQuoter-qq f = QuasiQuoter (f >=> lift) undefined undefined undefined- -- | A single base-10 digit. -- -- This quasi-quoter, when used as an expression, produces a@@ -715,7 +712,12 @@ -- ...  d10 :: QuasiQuoter-d10 = qq strD10Fail+d10 = QuasiQuoter+    { quoteExp  = strD10Fail >=> lift+    , quotePat  = \_ -> fail "d10 cannot be used in a pattern context"+    , quoteType = \_ -> fail "d10 cannot be used in a type context"+    , quoteDec  = \_ -> fail "d10 cannot be used in a declaration context"+    }  -- | A list of base-10 digits. --@@ -737,4 +739,9 @@ -- ...  d10list :: QuasiQuoter-d10list = qq strD10ListFail+d10list = QuasiQuoter+    { quoteExp  = strD10ListFail >=> lift+    , quotePat  = \_ -> fail "d10list cannot be used in a pattern context"+    , quoteType = \_ -> fail "d10list cannot be used in a type context"+    , quoteDec  = \_ -> fail "d10list cannot be used in a declaration context"+    }
src/Data/D10/Num.hs view
@@ -81,7 +81,7 @@  -- template-haskell import           Language.Haskell.TH        (ExpQ, Q)-import           Language.Haskell.TH.Quote  (QuasiQuoter (QuasiQuoter))+import           Language.Haskell.TH.Quote  (QuasiQuoter (..)) import           Language.Haskell.TH.Syntax (Lift (lift))  -- $setup@@ -696,9 +696,6 @@  --------------------------------------------------- -qq :: Lift a => (String -> Q a) -> QuasiQuoter-qq f = QuasiQuoter (f >=> lift) undefined undefined undefined- -- | A single base-10 digit. -- -- This quasi-quoter, when used as an expression, produces a@@ -718,7 +715,12 @@ -- ...  d10 :: forall a. (Lift a, Num a) => QuasiQuoter-d10 = qq @(D10 a) strD10Fail+d10 = QuasiQuoter+    { quoteExp  = strD10Fail >=> lift @(D10 a)+    , quotePat  = \_ -> fail "d10 cannot be used in a pattern context"+    , quoteType = \_ -> fail "d10 cannot be used in a type context"+    , quoteDec  = \_ -> fail "d10 cannot be used in a declaration context"+    }  -- | A list of base-10 digits. --@@ -740,4 +742,9 @@ -- ...  d10list :: forall a. (Lift a, Num a) => QuasiQuoter-d10list = qq @[D10 a] strD10ListFail+d10list = QuasiQuoter+    { quoteExp  = strD10ListFail >=> lift @[D10 a]+    , quotePat  = \_ -> fail "d10list cannot be used in a pattern context"+    , quoteType = \_ -> fail "d10list cannot be used in a type context"+    , quoteDec  = \_ -> fail "d10list cannot be used in a declaration context"+    }
src/Data/D10/Safe.hs view
@@ -81,7 +81,7 @@  -- template-haskell import           Language.Haskell.TH        (ExpQ, Q)-import           Language.Haskell.TH.Quote  (QuasiQuoter (QuasiQuoter))+import           Language.Haskell.TH.Quote  (QuasiQuoter (..)) import           Language.Haskell.TH.Syntax (Lift (lift))  -- $setup@@ -730,9 +730,6 @@  --------------------------------------------------- -qq :: Lift a => (String -> Q a) -> QuasiQuoter-qq f = QuasiQuoter (f >=> lift) undefined undefined undefined- -- | A single base-10 digit. -- -- This quasi-quoter, when used as an expression, produces a@@ -752,7 +749,12 @@ -- ...  d10 :: QuasiQuoter-d10 = qq strD10Fail+d10 = QuasiQuoter+    { quoteExp  = strD10Fail >=> lift+    , quotePat  = \_ -> fail "d10 cannot be used in a pattern context"+    , quoteType = \_ -> fail "d10 cannot be used in a type context"+    , quoteDec  = \_ -> fail "d10 cannot be used in a declaration context"+    }  -- | A list of base-10 digits. --@@ -774,4 +776,9 @@ -- ...  d10list :: QuasiQuoter-d10list = qq strD10ListFail+d10list = QuasiQuoter+    { quoteExp  = strD10ListFail >=> lift+    , quotePat  = \_ -> fail "d10list cannot be used in a pattern context"+    , quoteType = \_ -> fail "d10list cannot be used in a type context"+    , quoteDec  = \_ -> fail "d10list cannot be used in a declaration context"+    }