roc-id 0.1.0.0 → 0.2.0.0
raw patch · 13 files changed
+120/−78 lines, 13 filesdep −generic-arbitrarydep ~MonadRandomdep ~Onlydep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependencies removed: generic-arbitrary
Dependency ranges changed: MonadRandom, Only, QuickCheck, hspec, text, vector-sized
API changes (from Hackage documentation)
Files
- .gitignore +0/−2
- .hspec +0/−1
- CHANGELOG.md +9/−0
- README.md +1/−2
- library/ROC/ID.hs +20/−14
- library/ROC/ID/Digit.hs +2/−1
- library/ROC/ID/Gender.hs +8/−5
- library/ROC/ID/Location.hs +10/−6
- library/ROC/ID/Serial.hs +7/−4
- library/ROC/ID/Utilities.hs +5/−4
- roc-id.cabal +43/−29
- stack.yaml +0/−3
- test/Spec.hs +15/−7
− .gitignore
@@ -1,2 +0,0 @@-.stack-work/-*~
− .hspec
@@ -1,1 +0,0 @@---qc-max-success=1000
+ CHANGELOG.md view
@@ -0,0 +1,9 @@+# 0.2.0.0++- Refreshed package documentation.+- Refreshed all package dependencies.+- Removed dependency on `generic-arbitrary` package.++# 0.1.0.0++- Initial release.
README.md view
@@ -1,8 +1,7 @@ This package provides a [Haskell](https://www.haskell.org/) implementation of-the ROC Identification Number (中華民國身分證號碼) standard.+the ROC (Taiwan) Identification Number (中華民國身分證號碼) standard. For more details of the standard, see: * https://zh.wikipedia.org/wiki/中華民國國民身分證 * https://en.wikipedia.org/wiki/National_Identification_Card_(Republic_of_China)-
library/ROC/ID.hs view
@@ -1,11 +1,11 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-} module ROC.ID ( Identity (..)@@ -15,12 +15,18 @@ , randomIdentity ) where -import Control.Monad.Random.Class (MonadRandom (..))-import Data.Proxy (Proxy (..))-import Data.Text (Text)-import Data.Tuple.Only (Only (..))-import Data.Vector.Sized (Vector)-import GHC.Generics (Generic)+import Control.Monad.Random.Class+ ( MonadRandom (..) )+import Data.Proxy+ ( Proxy (..) )+import Data.Text+ ( Text )+import Data.Tuple.Only+ ( Only (..) )+import Data.Vector.Sized+ ( Vector )+import GHC.Generics+ ( Generic ) import ROC.ID.Digit import ROC.ID.Gender@@ -28,7 +34,7 @@ import ROC.ID.Serial import ROC.ID.Utilities -import qualified Data.Text as T+import qualified Data.Text as T import qualified Data.Vector.Sized as V -- Types:
library/ROC/ID/Digit.hs view
@@ -5,7 +5,8 @@ , parseDigit ) where -import GHC.Generics (Generic)+import GHC.Generics+ ( Generic ) import ROC.ID.Utilities
library/ROC/ID/Gender.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module ROC.ID.Gender@@ -8,9 +8,12 @@ , randomGender ) where -import Control.Monad.Random.Class (MonadRandom (..))-import Data.Text (Text)-import GHC.Generics (Generic)+import Control.Monad.Random.Class+ ( MonadRandom (..) )+import Data.Text+ ( Text )+import GHC.Generics+ ( Generic ) import ROC.ID.Language import ROC.ID.Utilities
library/ROC/ID/Location.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module ROC.ID.Location@@ -9,10 +9,14 @@ , randomLocation ) where -import Control.Monad.Random.Class (MonadRandom (..))-import Data.Text (Text)-import GHC.Generics (Generic)-import ROC.ID.Language (Language (..))+import Control.Monad.Random.Class+ ( MonadRandom (..) )+import Data.Text+ ( Text )+import GHC.Generics+ ( Generic )+import ROC.ID.Language+ ( Language (..) ) import ROC.ID.Utilities -- | A location, encodable within an ROC identification number.
library/ROC/ID/Serial.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} module ROC.ID.Serial@@ -6,9 +6,12 @@ , randomSerial ) where -import Control.Monad.Random.Class (MonadRandom (..))-import Data.Vector.Sized (Vector)-import GHC.Generics (Generic)+import Control.Monad.Random.Class+ ( MonadRandom (..) )+import Data.Vector.Sized+ ( Vector )+import GHC.Generics+ ( Generic ) import ROC.ID.Digit import ROC.ID.Utilities
library/ROC/ID/Utilities.hs view
@@ -1,9 +1,11 @@-{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE ScopedTypeVariables #-} module ROC.ID.Utilities where -import Control.Monad.Random.Class (MonadRandom (..))-import Data.Maybe (listToMaybe)+import Control.Monad.Random.Class+ ( MonadRandom (..) )+import Data.Maybe+ ( listToMaybe ) guard :: x -> Maybe y -> Either x y guard x = maybe (Left x) Right@@ -20,4 +22,3 @@ randomBoundedEnum :: forall a m . MonadRandom m => Bounded a => Enum a => m a randomBoundedEnum = toEnum <$> getRandomR (fromEnum (minBound :: a), fromEnum (maxBound :: a))-
roc-id.cabal view
@@ -1,39 +1,61 @@+cabal-version: 3.0 name: roc-id-version: 0.1.0.0-synopsis: Implementation of the ROC National ID standard.+version: 0.2.0.0+synopsis: Implementation of the ROC (Taiwan) National ID standard. category: Identification homepage: https://github.com/jonathanknowles/roc-id#readme bug-reports: https://github.com/jonathanknowles/roc-id/issues author: Jonathan Knowles maintainer: mail@jonathanknowles.net copyright: Jonathan Knowles-license: BSD3+license: BSD-3-Clause license-file: LICENSE build-type: Simple-cabal-version: >= 1.10 description:- This package provides an implementation of the ROC National Identification- Number (中華民國身分證號碼) standard.- .- In particular, it provides functions for parsing and validating identification- numbers from textual input.- .+ This package provides an implementation of the ROC (Taiwan) National+ Identification Number (中華民國身分證號碼) standard.++ In particular, it provides functions for parsing and validating+ identification numbers from textual input.+ See the "ROC.ID" module to get started.- .+ For more details of the standard on which this package is based, see:- .+ * https://zh.wikipedia.org/wiki/中華民國國民身分證 * https://en.wikipedia.org/wiki/National_Identification_Card_(Republic_of_China) -extra-source-files:+extra-doc-files:+ CHANGELOG.md README.md +common dependency-base+ build-depends:base >= 4.7 && < 5+common dependency-hspec+ build-depends:hspec >= 2.5.5 && < 2.11+common dependency-MonadRandom+ build-depends:MonadRandom >= 0.5.1.1 && < 0.7+common dependency-Only+ build-depends:Only >= 0.1 && < 0.2+common dependency-QuickCheck+ build-depends:QuickCheck >= 2.11.3 && < 2.15+common dependency-text+ build-depends:text >= 1.2.3.1 && < 2.1+common dependency-vector-sized+ build-depends:vector-sized >= 1.0.4.0 && < 1.6+ source-repository head type: git location: https://github.com/jonathanknowles/roc-id library+ import:+ , dependency-base+ , dependency-MonadRandom+ , dependency-Only+ , dependency-text+ , dependency-vector-sized exposed-modules: ROC.ID ROC.ID.Digit@@ -46,30 +68,22 @@ hs-source-dirs: library ghc-options: -Wall- build-depends:- MonadRandom- , Only- , base >=4.7 && <5- , text- , vector-sized default-language: Haskell2010 test-suite roc-id-test+ import:+ , dependency-base+ , dependency-hspec+ , dependency-MonadRandom+ , dependency-Only+ , dependency-QuickCheck+ , dependency-text+ , dependency-vector-sized type: exitcode-stdio-1.0 main-is: Spec.hs- other-modules:- Paths_roc_id hs-source-dirs: test ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N build-depends:- MonadRandom- , Only- , QuickCheck- , base >=4.7 && <5- , generic-arbitrary- , hspec , roc-id- , text- , vector-sized default-language: Haskell2010
− stack.yaml
@@ -1,3 +0,0 @@-resolver: lts-12.21-packages:-- .
test/Spec.hs view
@@ -10,28 +10,36 @@ import ROC.ID.Location import ROC.ID.Serial -import Data.Char (intToDigit)+import Data.Char+ ( intToDigit ) import Test.Hspec+ ( describe, hspec, it, shouldBe ) import Test.QuickCheck-import Test.QuickCheck.Arbitrary.Generic+ ( Arbitrary (..)+ , NonEmptyList (..)+ , applyArbitrary3+ , arbitraryBoundedEnum+ , genericShrink+ , property+ ) +import qualified Data.Text as T import qualified Data.Vector.Sized as V-import qualified Data.Text as T instance Arbitrary Digit where- arbitrary = genericArbitrary+ arbitrary = arbitraryBoundedEnum shrink = genericShrink instance Arbitrary Gender where- arbitrary = genericArbitrary+ arbitrary = arbitraryBoundedEnum shrink = genericShrink instance Arbitrary Identity where- arbitrary = genericArbitrary+ arbitrary = applyArbitrary3 Identity shrink = genericShrink instance Arbitrary Location where- arbitrary = genericArbitrary+ arbitrary = arbitraryBoundedEnum shrink = genericShrink instance Arbitrary Serial where