Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Identity = Identity {}
- identityChecksum :: Identity -> Digit
- parseIdentity :: Text -> Either ParseError Identity
- data ParseError
- randomIdentity :: MonadRandom m => m Identity
Documentation
Represents a valid 10-digit ROC national identification number
(中華民國身份證號碼) of the form A123456789
.
By construction, invalid values are not representable by this type.
An identification number encodes a person's Gender
, the Location
in
which they first registered for an identification card, and a unique Serial
number.
Identity | |
|
Instances
Eq Identity Source # | |
Ord Identity Source # | |
Show Identity Source # | |
Generic Identity Source # | |
type Rep Identity Source # | |
Defined in ROC.ID type Rep Identity = D1 (MetaData "Identity" "ROC.ID" "roc-id-0.1.0.0-EBt7nY1QCMq7lYvcqKJOx6" False) (C1 (MetaCons "Identity" PrefixI True) (S1 (MetaSel (Just "identityGender") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Gender) :*: (S1 (MetaSel (Just "identityLocation") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Location) :*: S1 (MetaSel (Just "identitySerial") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Serial)))) |
parseIdentity :: Text -> Either ParseError Identity Source #
data ParseError Source #
An error produced when parsing an Identity
with the parseIdentity
function.
InvalidLength | The input was either too short or too long. |
InvalidGender | The gender portion of the input was invalid. |
InvalidLocation | The location portion of the input included non-alphabetic characters. |
InvalidSerial | The serial number portion of the input included non-numeric characters. |
InvalidChecksum | The computed checksum did not match the checksum portion of the input. |
Instances
Eq ParseError Source # | |
Defined in ROC.ID (==) :: ParseError -> ParseError -> Bool # (/=) :: ParseError -> ParseError -> Bool # | |
Show ParseError Source # | |
Defined in ROC.ID showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS # |
randomIdentity :: MonadRandom m => m Identity Source #
Generate a random Identity
.