refined-extras-0.1.0.0: Increased functionality for refined types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Refined.Extras.Predicates.Text

Description

Predicates for Text and String.

Since: 0.1.0.0

Synopsis

Symbol Equality

data SymEqualTo c Source #

Predicate equality for symbols.

Examples

Expand
>>> validate @(SymEqualTo "c") Proxy 'c'
Nothing
>>> showRefineException <$> validate @(SymEqualTo "abc") Proxy 'c'
Just "RefineOtherException (SymEqualTo \"abc\") \"c is not a single Char\""
>>> validate @(SymEqualTo "abc") Proxy "abc"
Nothing
>>> showRefineException <$> validate @(SymEqualTo "123") @Text Proxy "abc"
Just "RefineOtherException (SymEqualTo \"123\") \"abc does not equal the predicate\""

Since: 0.1.0.0

Instances

Instances details
KnownSymbol c => Predicate (SymEqualTo c :: Type) Text Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

KnownSymbol c => Predicate (SymEqualTo c :: Type) Text Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

KnownSymbol c => Predicate (SymEqualTo c :: Type) String Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

KnownSymbol c => Predicate (SymEqualTo c :: Type) Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Generic (SymEqualTo c) Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep (SymEqualTo c) :: Type -> Type Source #

Methods

from :: SymEqualTo c -> Rep (SymEqualTo c) x Source #

to :: Rep (SymEqualTo c) x -> SymEqualTo c Source #

type Rep (SymEqualTo c) Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep (SymEqualTo c) = D1 ('MetaData "SymEqualTo" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

Char Predicates

This section models the boolean functions defined in Data.Char. See that module for more information regarding these definitions.

These instances are defined for Char and Word8, though they can be extended to String, Text, and ByteString via All.

Note: Although Char has instances for all of these predicates, some are missing for Word8 (and by extension ByteString). This is due to Word8's size restriction, i.e., a single byte 0 <= b <= 255. Thus, predicates that extend over the entirety of the unicode range (e.g. Alpha) do not have Word8 instances, as this could be misleading. For instance, consider the unicode character "ɦ" (U+0266):

>>> :{
  let txt = T.singleton ch -- ch == 0x0266 i.e. ɦ
   in isRight $ refine @(All Alpha) txt
:}
True

This Char is part of the alpha unicode category, so the refinement succeeds. On the other hand, suppose we have a Word8 instance that performs the obvious isAlpha . w2c:

>>> :{
  let bs = encodeUtf8 $ T.singleton ch
   in isRight $ refine @(All Alpha) bs
:}
False

The problem is that we are checking the underlying bytes if they satisfy isAlpha, but this is only true for Ascii alpha characters. Morally, our bytestring is this structure:

>>> BS.foldr (:) [] (encodeUtf8 $ T.singleton ch)
[201,166]

Our Alpha refinement fails because the individual byte components of "ɦ" are not themselves considered "alpha" characters (indeed this will only occur due to chance). These are the options:

  1. Outlaw Word8/ByteString instances completely.
  2. Provide the naive isAlpha . w2c implementation for Word8.
  3. Implement ByteString instances by first converting to Text, i.e., do not use its underlying fold.
  4. Provide Word8 instances only when they coincide with Char (i.e. ascii/latin1 predicates). In this case, ByteString works as expected; that is, we can make assertions based on the underlying bytes, but nothing that requires a specific encoding, and we do not get surprised by Text/ByteString mismatches.

Of these, only one and four are reasonable. Two is out because it can have confusing semantics (illustrated above).

Three is rejected because the API is no longer consistent, and we have to arbitrarily assume the ByteString shares its Text encoding (i.e. UTF-8).

One is defensible, but we choose option two, reasoning that it could be useful to assert that a given bytestring contains only ascii numbers or alpha characters while avoiding the pitfalls of reusing predicates intended for arbitrary unicode.

Unicode

These predicates are for unicode code points, hence they are available for Char (thus String, Text).

data Space Source #

Predicate for a isSpace.

Examples

Expand
>>> validate @Space Proxy ' '
Nothing
>>> validate @Space Proxy '\r'
Nothing
>>> showRefineException <$> validate @Space Proxy 'a'
Just "RefineOtherException (Space) \"a is not a space character\""

Since: 0.1.0.0

Instances

Instances details
Generic Space Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Space :: Type -> Type Source #

Methods

from :: Space -> Rep Space x Source #

to :: Rep Space x -> Space Source #

Predicate Space Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Space Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Space = D1 ('MetaData "Space" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Lower Source #

Predicate for isLower.

Examples

Expand
>>> validate @Lower Proxy 'c'
Nothing
>>> showRefineException <$> validate @Lower Proxy 'C'
Just "RefineOtherException (Lower) \"C is not lowercase\""

Since: 0.1.0.0

Instances

Instances details
Generic Lower Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Lower :: Type -> Type Source #

Methods

from :: Lower -> Rep Lower x Source #

to :: Rep Lower x -> Lower Source #

Predicate Lower Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Lower Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Lower = D1 ('MetaData "Lower" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Upper Source #

Predicate for isUpper.

Examples

Expand
>>> validate @Upper Proxy 'C'
Nothing
>>> showRefineException <$> validate @Upper Proxy 'c'
Just "RefineOtherException (Upper) \"c is not uppercase\""

Since: 0.1.0.0

Instances

Instances details
Generic Upper Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Upper :: Type -> Type Source #

Methods

from :: Upper -> Rep Upper x Source #

to :: Rep Upper x -> Upper Source #

Predicate Upper Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Upper Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Upper = D1 ('MetaData "Upper" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Alpha Source #

Predicate for isAlpha.

Examples

Expand
>>> validate @Alpha Proxy 'c'
Nothing
>>> validate @Alpha Proxy 'ɦ'
Nothing
>>> showRefineException <$> validate @Alpha Proxy '7'
Just "RefineOtherException (Alpha) \"7 is not an alphabetic character\""

Since: 0.1.0.0

Instances

Instances details
Generic Alpha Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Alpha :: Type -> Type Source #

Methods

from :: Alpha -> Rep Alpha x Source #

to :: Rep Alpha x -> Alpha Source #

Predicate Alpha Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Alpha Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Alpha = D1 ('MetaData "Alpha" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data AlphaNum Source #

Predicate for isAlphaNum.

Examples

Expand
>>> validate @AlphaNum Proxy 'a'
Nothing
>>> validate @AlphaNum Proxy '1'
Nothing
>>> showRefineException <$> validate @AlphaNum Proxy '!'
Just "RefineOtherException (AlphaNum) \"! is not an alpha-numeric character\""

Since: 0.1.0.0

Instances

Instances details
Generic AlphaNum Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep AlphaNum :: Type -> Type Source #

Predicate AlphaNum Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AlphaNum Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AlphaNum = D1 ('MetaData "AlphaNum" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Letter Source #

Predicate for isLetter.

Examples

Expand
>>> validate @Letter Proxy 'f'
Nothing
>>> showRefineException <$> validate @Letter Proxy '\r'
Just "RefineOtherException (Letter) \"\\r is not a letter\""

Since: 0.1.0.0

Instances

Instances details
Generic Letter Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Letter :: Type -> Type Source #

Predicate Letter Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Letter Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Letter = D1 ('MetaData "Letter" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Mark Source #

Predicate for isMark.

Examples

Expand
>>> validate @Mark Proxy '\x20DD'
Nothing
>>> showRefineException <$> validate @Mark Proxy 'a'
Just "RefineOtherException (Mark) \"a is not a mark\""

Since: 0.1.0.0

Instances

Instances details
Generic Mark Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Mark :: Type -> Type Source #

Methods

from :: Mark -> Rep Mark x Source #

to :: Rep Mark x -> Mark Source #

Predicate Mark Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Mark Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Mark = D1 ('MetaData "Mark" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Number Source #

Predicate for isNumber.

Examples

Expand
>>> validate @Number Proxy '2'
Nothing
>>> showRefineException <$> validate @Number Proxy 'a'
Just "RefineOtherException (Number) \"a is not a number\""

Since: 0.1.0.0

Instances

Instances details
Generic Number Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Number :: Type -> Type Source #

Predicate Number Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Number Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Number = D1 ('MetaData "Number" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Punctuation Source #

Predicate for isPunctuation.

Examples

Expand
>>> validate @Punctuation Proxy '!'
Nothing
>>> showRefineException <$> validate @Punctuation Proxy 'a'
Just "RefineOtherException (Punctuation) \"a is not punctuation\""

Since: 0.1.0.0

Instances

Instances details
Generic Punctuation Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Punctuation :: Type -> Type Source #

Predicate Punctuation Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Punctuation Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Punctuation = D1 ('MetaData "Punctuation" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Symbol Source #

Predicate for isSymbol.

Examples

Expand
>>> validate @Symbol Proxy '$'
Nothing
>>> showRefineException <$> validate @Symbol Proxy 'a'
Just "RefineOtherException (Symbol) \"a is not a symbol\""

Since: 0.1.0.0

Instances

Instances details
Generic Symbol Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Symbol :: Type -> Type Source #

Predicate Symbol Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Symbol Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Symbol = D1 ('MetaData "Symbol" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Separator Source #

Predicate for isSeparator.

Examples

Expand
>>> validate @Separator Proxy ' '
Nothing
>>> showRefineException <$> validate @Separator Proxy 'a'
Just "RefineOtherException (Separator) \"a is not a separator\""

Since: 0.1.0.0

Instances

Instances details
Generic Separator Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Separator :: Type -> Type Source #

Predicate Separator Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Separator Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Separator = D1 ('MetaData "Separator" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

Ascii/Latin1

These predicates are for ascii/latin1. Thus they will work for Char (and String, Text) and Word8 (hence ByteString).

data Control Source #

Predicate for isControl.

Examples

Expand
>>> validate @Control Proxy '\r'
Nothing
>>> showRefineException <$> validate @Control Proxy 'a'
Just "RefineOtherException (Control) \"a is not a control character\""

Since: 0.1.0.0

Instances

Instances details
Generic Control Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Control :: Type -> Type Source #

Predicate Control Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate Control Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Control Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Control = D1 ('MetaData "Control" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Digit Source #

Predicate for isDigit.

Examples

Expand
>>> validate @Digit Proxy '1'
Nothing
>>> showRefineException <$> validate @Digit Proxy 'a'
Just "RefineOtherException (Digit) \"a is not a digit\""

Since: 0.1.0.0

Instances

Instances details
Generic Digit Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Digit :: Type -> Type Source #

Methods

from :: Digit -> Rep Digit x Source #

to :: Rep Digit x -> Digit Source #

Predicate Digit Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate Digit Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Digit Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Digit = D1 ('MetaData "Digit" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data OctDigit Source #

Predicate for isOctDigit.

Examples

Expand
>>> validate @OctDigit Proxy '4'
Nothing
>>> showRefineException <$> validate @OctDigit Proxy '9'
Just "RefineOtherException (OctDigit) \"9 is not an octal digit\""

Since: 0.1.0.0

Instances

Instances details
Generic OctDigit Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep OctDigit :: Type -> Type Source #

Predicate OctDigit Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate OctDigit Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep OctDigit Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep OctDigit = D1 ('MetaData "OctDigit" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data HexDigit Source #

Predicate for isHexDigit.

Examples

Expand
>>> validate @HexDigit Proxy '1'
Nothing
>>> validate @HexDigit Proxy 'f'
Nothing
>>> showRefineException <$> validate @HexDigit Proxy 'g'
Just "RefineOtherException (HexDigit) \"g is not a hexadecimal digit\""

Since: 0.1.0.0

Instances

Instances details
Generic HexDigit Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep HexDigit :: Type -> Type Source #

Predicate HexDigit Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate HexDigit Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep HexDigit Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep HexDigit = D1 ('MetaData "HexDigit" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Ascii Source #

Predicate for isAscii.

Examples

Expand
>>> validate @Ascii Proxy 'a'
Nothing
>>> showRefineException <$> validate @Ascii Proxy '\x20DD'
Just "RefineOtherException (Ascii) \"\\8413 is not ascii\""

Since: 0.1.0.0

Instances

Instances details
Generic Ascii Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Ascii :: Type -> Type Source #

Methods

from :: Ascii -> Rep Ascii x Source #

to :: Rep Ascii x -> Ascii Source #

Predicate Ascii Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate Ascii Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Ascii Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Ascii = D1 ('MetaData "Ascii" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data Latin1 Source #

Predicate for Latin1.

Examples

Expand
>>> validate @Latin1 Proxy 'a'
Nothing
>>> showRefineException <$> validate @Latin1 Proxy '\x20DD'
Just "RefineOtherException (Latin1) \"\\8413 is not latin1\""

Since: 0.1.0.0

Instances

Instances details
Generic Latin1 Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep Latin1 :: Type -> Type Source #

Predicate Latin1 Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate Latin1 Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Latin1 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep Latin1 = D1 ('MetaData "Latin1" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data AsciiUpper Source #

Predicate for isAsciiUpper.

Examples

Expand
>>> validate @AsciiUpper Proxy 'A'
Nothing
>>> showRefineException <$> validate @AsciiUpper Proxy 'a'
Just "RefineOtherException (AsciiUpper) \"a is not uppercase ascii\""

Since: 0.1.0.0

Instances

Instances details
Generic AsciiUpper Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep AsciiUpper :: Type -> Type Source #

Predicate AsciiUpper Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate AsciiUpper Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiUpper Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiUpper = D1 ('MetaData "AsciiUpper" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data AsciiLower Source #

Predicate for isAsciiLower.

Examples

Expand
>>> validate @AsciiLower Proxy 'a'
Nothing
>>> showRefineException <$> validate @AsciiLower Proxy 'A'
Just "RefineOtherException (AsciiLower) \"A is not lowercase ascii\""

Since: 0.1.0.0

Instances

Instances details
Generic AsciiLower Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep AsciiLower :: Type -> Type Source #

Predicate AsciiLower Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate AsciiLower Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiLower Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiLower = D1 ('MetaData "AsciiLower" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data AsciiAlpha Source #

Predicate for isAscii and isAlpha, primarily intended for Word8. Redundant for Char, as this is equivalent to (Ascii && Alpha), but we include Char for completeness.

Examples

Expand
>>> validate @AsciiAlpha Proxy 'a'
Nothing
>>> showRefineException <$> validate @AsciiAlpha Proxy '1'
Just "RefineOtherException (AsciiAlpha) \"1 is not alpha ascii\""
>>> showRefineException <$> validate @AsciiAlpha Proxy 'ɦ'
Just "RefineOtherException (AsciiAlpha) \"\\614 is not alpha ascii\""

Since: 0.1.0.0

Instances

Instances details
Generic AsciiAlpha Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep AsciiAlpha :: Type -> Type Source #

Predicate AsciiAlpha Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate AsciiAlpha Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiAlpha Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiAlpha = D1 ('MetaData "AsciiAlpha" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)

data AsciiAlphaNum Source #

Predicate for isAscii and isAlphaNum, primarily intended for Word8. Redundant for Char, as this is equivalent to (Ascii && AlphaNum), but we include Char for completeness.

Examples

Expand
>>> validate @AsciiAlphaNum Proxy 'a'
Nothing
>>> validate @AsciiAlphaNum Proxy '1'
Nothing
>>> showRefineException <$> validate @AsciiAlphaNum Proxy '1'
Nothing
>>> showRefineException <$> validate @AsciiAlphaNum Proxy 'ɦ'
Just "RefineOtherException (AsciiAlphaNum) \"\\614 is not alpha-numeric ascii\""

Since: 0.1.0.0

Instances

Instances details
Generic AsciiAlphaNum Source # 
Instance details

Defined in Refined.Extras.Predicates.Text

Associated Types

type Rep AsciiAlphaNum :: Type -> Type Source #

Predicate AsciiAlphaNum Word8 Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

Predicate AsciiAlphaNum Char Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiAlphaNum Source #

Since: 0.1.0.0

Instance details

Defined in Refined.Extras.Predicates.Text

type Rep AsciiAlphaNum = D1 ('MetaData "AsciiAlphaNum" "Refined.Extras.Predicates.Text" "refined-extras-0.1.0.0-inplace" 'False) (V1 :: Type -> Type)