Copyright | (c) Nathan Bloomfield 2017 |
---|---|
License | GPL-3 |
Maintainer | nbloomf@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
The types reexported by this module (except for YesNo
, which is a renaming of Bool
) are safe strings. Each is an instance of the Validate
class, and may only be constructed using the validate
function. This ensures that the elements of a safe string type satisfy the constraints given in their Validate
instance.
- class Validate t where
- validateMaybe :: Validate t => String -> Maybe t
- data Css_Class_Name
- data Domain_With_Scheme
- data Hex_Color_Code
- data Iso_639_1_Language_Code
- data Letters_Numbers
- data Letters_Numbers_Hyphens_Underscores
- data MD5_Digest
- data Natural_Number_Base_10
- data RFC_3986_Unreserved_Uri_Characters
- data YesNo
- data CommaSep t
Documentation
class Validate t where Source #
The Validate
class lets us approximate subtypes
of String
. Instances should not expose a constructor.
data Css_Class_Name Source #
Valid CSS class names: alphanumeric, hyphen, or underscore, but the first character must be alphanumeric. Note: this type represents only a subset of all valid class names. See the CSS grammar.
data Domain_With_Scheme Source #
Matches domain names with the https scheme. The regex for this match is very simple.
data Hex_Color_Code Source #
Strings of six hexadecimal digits. Case insensitive.
data Iso_639_1_Language_Code Source #
ISO 639.1 two-letter language codes.
See http://www.loc.gov/standards/iso639-2/php/code_list.php.
Must be constructed with validate
.
data Letters_Numbers Source #
Strings consisting only of alphanumeric characters.
Must be constructed using validate
.
data Letters_Numbers_Hyphens_Underscores Source #
Strings consisting only of a-z, A-Z, 0-9, -, and _.
data MD5_Digest Source #
Strings of 64 hexadecimal digits. Case insensitive.
data Natural_Number_Base_10 Source #
Either 0, or a nonempty string of decimal digits with no leading zeros.
data RFC_3986_Unreserved_Uri_Characters Source #
Strings consisting only of a-z, A-Z, 0-9, -, _, ., or ~ characters.
See RFC 3986, Section 2.3.
Must be constructed using validate
.
Type representing Yes or No options for a parameter.
A slightly more semantically meaningful version of Bool
.