packages feed

digit 0.2.0 → 0.2.1

raw patch · 3 files changed

+30/−2 lines, 3 filesdep +parsersPVP ok

version bump matches the API change (PVP)

Dependencies added: parsers

API changes (from Hackage documentation)

+ Data.Digit: parseDigit :: (Monad p, CharParsing p) => p Digit

Files

digit.cabal view
@@ -1,5 +1,5 @@ name:               digit-version:            0.2.0+version:            0.2.1 license:            BSD3 license-File:       etc/LICENCE author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>@@ -11,7 +11,7 @@ bug-reports:        https://github.com/NICTA/digit/issues cabal-version:      >= 1.10 build-type:         Custom-extra-source-files: etc/CONTRIBUTORS+extra-source-files: etc/CONTRIBUTORS, etc/changelog description:   <<http://i.imgur.com/Ns5hntl.jpg>>   .@@ -31,6 +31,7 @@   build-depends:                     base < 5 && >= 4.8                     , lens >= 4.3.3 && < 5.0+                    , parsers >= 0.12.3 && < 0.13                     , template-haskell >= 2.8    ghc-options:
+ etc/changelog view
@@ -0,0 +1,7 @@+0.2.1++* Include digit parsers.++0.2.0++* Update to use digit prisms.
src/Data/Digit.hs view
@@ -33,22 +33,30 @@ , x9 , digit , digitC+-- * Parsers+, parseDigit+-- * Quasi-Quoters , digitQ ) where +import Control.Applicative(pure) import Control.Category((.)) import Control.Lens(Prism', prism', (^?), ( # ))+import Control.Monad(Monad(fail)) import Data.Char(Char) import Data.Data (Data) import Data.Eq(Eq) import Data.Function(const) import Data.Int(Int)+import Data.List((++)) import Data.Maybe(Maybe(Nothing, Just), maybe) import Data.Ord(Ord) import Data.Typeable (Typeable) import Language.Haskell.TH(ExpQ, PatQ, varE, varP, mkName) import Language.Haskell.TH.Quote(QuasiQuoter(QuasiQuoter), quotePat, quoteExp, quoteDec, dataToExpQ, dataToPatQ, quoteType) import Prelude(Show(..), Read(..), Enum(..), Bounded, error)+import Text.Parser.Char(CharParsing, anyChar)+import Text.Parser.Combinators((<?>))  -- $setup -- >>> import Prelude@@ -396,6 +404,18 @@                      '8' -> Just D8                      '9' -> Just D9                      _ -> Nothing)++parseDigit ::+  (Monad p, CharParsing p) =>+  p Digit+parseDigit =+  let p = do  c <- anyChar+              case c ^? digitC of+                Nothing ->+                  fail ("not a digit: " ++ show c )+                Just d -> +                  pure d+  in p <?> "digit"  instance Show Digit where   show = show . fromEnum