Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data AlphaUpper
- class HasAlphaUpper c where
- class AsAlphaUpper a where
- parseAlphaUpper :: (Monad f, CharParsing f) => f AlphaUpper
- data AlphaLower
- class HasAlphaLower c where
- class AsAlphaLower a where
- parseAlphaLower :: (Monad f, CharParsing f) => f AlphaLower
- data Alpha
- class HasAlpha c where
- class AsAlpha r where
- parseAlpha :: (Monad f, CharParsing f) => f Alpha
- upperlower :: Iso' AlphaUpper AlphaLower
- lowerupper :: Iso' AlphaLower AlphaUpper
Upper-case
data AlphaUpper Source #
An upper-case character between
and A
.Z
class HasAlphaUpper c where Source #
alphaUpper :: Lens' c AlphaUpper Source #
class AsAlphaUpper a where Source #
_AlphaUpper :: Prism' a AlphaUpper Source #
parseAlphaUpper :: (Monad f, CharParsing f) => f AlphaUpper Source #
Parse an upper-case alpha character.
>>>
parse parseAlphaUpper "parseAlphaUpper" "A"
Right (AlphaUpper 'A')
>>>
parse parseAlphaUpper "parseAlphaUpper" "Abc"
Right (AlphaUpper 'A')
>>>
isn't _Right (parse parseAlphaUpper "parseAlphaUpper" "a")
True
>>>
isn't _Right (parse parseAlphaUpper "parseAlphaUpper" "")
True
>>>
isn't _Right (parse parseAlphaUpper "parseAlphaUpper" "0")
True
Lower-case
data AlphaLower Source #
A lower-case character between
and a
.z
class HasAlphaLower c where Source #
alphaLower :: Lens' c AlphaLower Source #
class AsAlphaLower a where Source #
_AlphaLower :: Prism' a AlphaLower Source #
parseAlphaLower :: (Monad f, CharParsing f) => f AlphaLower Source #
Parse a lower-case alpha character.
>>>
parse parseAlphaLower "parseAlphaLower" "a"
Right (AlphaLower 'a')
>>>
parse parseAlphaLower "parseAlphaLower" "aBC"
Right (AlphaLower 'a')
>>>
isn't _Right (parse parseAlphaLower "parseAlphaLower" "B")
True
>>>
isn't _Right (parse parseAlphaLower "parseAlphaLower" "")
True
>>>
isn't _Right (parse parseAlphaLower "parseAlphaLower" "0")
True
Any case
Either a lower-case character between
and a
or an upper-case character between z
and A
.Z
class AsAlpha r where Source #
_Alpha :: Prism' r Alpha Source #
_UpperAlpha :: Prism' r AlphaUpper Source #
_LowerAlpha :: Prism' r AlphaLower Source #
parseAlpha :: (Monad f, CharParsing f) => f Alpha Source #
Parse an upper-case or lower-case character.
>>>
parse parseAlpha "parseAlpha" "a"
Right (LowerAlpha (AlphaLower 'a'))
>>>
parse parseAlpha "parseAlpha" "aBC"
Right (LowerAlpha (AlphaLower 'a'))
>>>
parse parseAlpha "parseAlpha" "A"
Right (UpperAlpha (AlphaUpper 'A'))
>>>
parse parseAlpha "parseAlpha" "Abc"
Right (UpperAlpha (AlphaUpper 'A'))
>>>
isn't _Right (parse parseAlpha "parseAlpha" "0")
True
Accessory
upperlower :: Iso' AlphaUpper AlphaLower Source #
Isomorphism from upper to lower.
>>>
(upperlower #) <$> ('a' ^? _AlphaLower)
Just (AlphaUpper 'A')
>>>
(upperlower #) <$> ('A' ^? _AlphaLower)
Nothing
>>>
(upperlower #) <$> ('3' ^? _AlphaLower)
Nothing
lowerupper :: Iso' AlphaLower AlphaUpper Source #
Isomorphism from lower to upper.
>>>
(lowerupper #) <$> ('A' ^? _AlphaUpper)
Just (AlphaLower 'a')
>>>
(lowerupper #) <$> ('a' ^? _AlphaUpper)
Nothing
>>>
(lowerupper #) <$> ('3' ^? _AlphaUpper)
Nothing