Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data PreReleaseIdentifier
- class HasPreReleaseIdentifier a where
- class AsPreReleaseIdentifier a where
- parsePreReleaseIdentifier :: CharParsing p => p PreReleaseIdentifier
Documentation
>>>
import Text.Parsec(parse)
>>>
import Data.Either(isLeft)
data PreReleaseIdentifier Source #
PreReleaseIdentifierAlphanumeric AlphanumericIdentifier | |
PreReleaseIdentifierNumeric NumericIdentifier |
Instances
class HasPreReleaseIdentifier a where Source #
class AsPreReleaseIdentifier a where Source #
parsePreReleaseIdentifier :: CharParsing p => p PreReleaseIdentifier Source #
>>>
parse (parsePreReleaseIdentifier <* eof) "parsePreReleaseIdentifier" "A"
Right (PreReleaseIdentifierAlphanumeric (AlphanumericIdentifierNonDigit (NonDigitLetter (AlphaUpper Upper_A))))
>>>
isLeft (parse parsePreReleaseIdentifier "parsePreReleaseIdentifier" "")
True
>>>
parse (parsePreReleaseIdentifier <* eof) "parsePreReleaseIdentifier" "Abc-123--XYZ"
Right (PreReleaseIdentifierAlphanumeric (AlphanumericIdentifierNonDigits (NonDigitLetter (AlphaUpper Upper_A)) (IdentifierCharacters (IdentifierCharacterNonDigit (NonDigitLetter (AlphaLower Lower_b)) :| [IdentifierCharacterNonDigit (NonDigitLetter (AlphaLower Lower_c)),IdentifierCharacterNonDigit NonDigitHyphen,IdentifierCharacterDigit DecDigit1,IdentifierCharacterDigit DecDigit2,IdentifierCharacterDigit DecDigit3,IdentifierCharacterNonDigit NonDigitHyphen,IdentifierCharacterNonDigit NonDigitHyphen,IdentifierCharacterNonDigit (NonDigitLetter (AlphaUpper Upper_X)),IdentifierCharacterNonDigit (NonDigitLetter (AlphaUpper Upper_Y)),IdentifierCharacterNonDigit (NonDigitLetter (AlphaUpper Upper_Z))]))))
>>>
isLeft (parse parsePreReleaseIdentifier "parsePreReleaseIdentifier" "+")
True