{-|
Module      : Z.Data.ASCII
Description : ASCII chars
Copyright   : (c) Dong Han, 2020
License     : BSD
Maintainer  : winterland1989@gmail.com
Stability   : experimental
Portability : non-portable

ASCII Chars utility.

-}

module Z.Data.ASCII where

import GHC.Word
import GHC.Exts

-- | Conversion between 'Word8' and 'Char'. Should compile to a no-op.
--
w2c :: Word8 -> Char
{-# INLINE w2c #-}
w2c :: Word8 -> Char
w2c (W8# Word#
w#) = Char# -> Char
C# (Int# -> Char#
chr# (Word# -> Int#
word2Int# Word#
w#))

-- | Unsafe conversion between 'Char' and 'Word8'. This is a no-op and
-- silently truncates to 8 bits Chars > @\\255@.
c2w :: Char -> Word8
{-# INLINE c2w #-}
c2w :: Char -> Word8
c2w (C# Char#
c#) = Word# -> Word8
W8# (Int# -> Word#
int2Word# (Char# -> Int#
ord# Char#
c#))

-- | @\\NUL <= w && w <= \\DEL@
isASCII :: Word8 -> Bool
{-# INLINE isASCII #-}
isASCII :: Word8 -> Bool
isASCII Word8
w = Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
DEL

-- | @A ~ Z@
isUpper :: Word8 -> Bool
{-# INLINE isUpper #-}
isUpper :: Word8 -> Bool
isUpper Word8
w = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
LETTER_A Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
25

-- | @a ~ z@
isLower :: Word8 -> Bool
{-# INLINE isLower #-}
isLower :: Word8 -> Bool
isLower Word8
w =  Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
LETTER_a Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
25

-- | @A ~ Z@ => @a ~ z@
toLower :: Word8 -> Word8
{-# INLINE toLower #-}
toLower :: Word8 -> Word8
toLower Word8
w
  | Word8
65 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<=  Word8
90 = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
+ Word8
32
  | Bool
otherwise           = Word8
w

-- | @a ~ z@ => @A ~ Z@
toUpper :: Word8 -> Word8
{-# INLINE toUpper #-}
toUpper :: Word8 -> Word8
toUpper Word8
w
  | Word8
97 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
122 = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
32
  | Bool
otherwise           = Word8
w

-- | @A ~ Z@ => @a ~ z@, @À ~ Ö@ => @à ~ ö@, @Ø ~ Þ@ => @ø ~ þ@
toLowerLatin :: Word8 -> Word8
{-# INLINE toLowerLatin #-}
toLowerLatin :: Word8 -> Word8
toLowerLatin Word8
w
  |  Word8
65 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<=  Word8
90 Bool -> Bool -> Bool
||
    Word8
192 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
214 Bool -> Bool -> Bool
||
    Word8
216 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
222 = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
+ Word8
32
  | Bool
otherwise            = Word8
w

-- | @a ~ z@ => @A ~ Z@, @à ~ ö@ => @À ~ Ö@, @ø ~ þ@ => @Ø ~ Þ@
toUpperLatin :: Word8 -> Word8
{-# INLINE toUpperLatin #-}
toUpperLatin :: Word8 -> Word8
toUpperLatin Word8
w
  | Word8
97  Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
122 Bool -> Bool -> Bool
||
    Word8
224 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
246 Bool -> Bool -> Bool
||
    Word8
248 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
w Bool -> Bool -> Bool
&& Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
254 = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
32
  | Bool
otherwise            = Word8
w

-- | @ISO-8859-1@ control letter.
isControl :: Word8 -> Bool
{-# INLINE isControl #-}
isControl :: Word8 -> Bool
isControl Word8
w = Word8
w Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
0x1f Bool -> Bool -> Bool
|| Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
DEL Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
32

-- | @ISO-8859-1@ space letter.
isSpace :: Word8 -> Bool
{-# INLINE isSpace #-}
isSpace :: Word8 -> Bool
isSpace Word8
w = Word8
w Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Word8
SPACE Bool -> Bool -> Bool
|| Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
TAB Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
4 Bool -> Bool -> Bool
|| Word8
w Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Word8
0xa0

-- | @0 ~ 9@
isDigit :: Word8 -> Bool
{-# INLINE isDigit #-}
isDigit :: Word8 -> Bool
isDigit Word8
w = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
DIGIT_0 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
9

-- | @0 ~ 7@
isOctDigit :: Word8 -> Bool
{-# INLINE isOctDigit #-}
isOctDigit :: Word8 -> Bool
isOctDigit Word8
w = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
DIGIT_0 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
7

-- | @0 ~ 9, A ~ F, a ~ f@
isHexDigit :: Word8 -> Bool
{-# INLINE isHexDigit #-}
isHexDigit :: Word8 -> Bool
isHexDigit Word8
w = Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
DIGIT_0 Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
9 Bool -> Bool -> Bool
|| Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
LETTER_A Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
5 Bool -> Bool -> Bool
|| Word8
w Word8 -> Word8 -> Word8
forall a. Num a => a -> a -> a
- Word8
LETTER_a Word8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
<= Word8
5

----------------------------------------------------------------

-- | @\\NUL@
pattern NUL :: Word8
pattern $bNUL :: Word8
$mNUL :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
NUL          = 0x00
-- | Start of Heading
pattern SOH :: Word8
pattern $bSOH :: Word8
$mSOH :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SOH          = 0x01
-- | Start of Text
pattern STX :: Word8
pattern $bSTX :: Word8
$mSTX :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
STX          = 0x02
-- | End of Text
pattern ETX :: Word8
pattern $bETX :: Word8
$mETX :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ETX          = 0x03
-- | End of Transmission
pattern EOT :: Word8
pattern $bEOT :: Word8
$mEOT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
EOT          = 0x04
-- | Enquiry
pattern ENQ :: Word8
pattern $bENQ :: Word8
$mENQ :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ENQ          = 0x05
-- | Acknowledgment
pattern ACK :: Word8
pattern $bACK :: Word8
$mACK :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ACK          = 0x06
-- | Bell
pattern BEL :: Word8
pattern $bBEL :: Word8
$mBEL :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BEL          = 0x07
-- | Back Space
pattern BS :: Word8
pattern $bBS :: Word8
$mBS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BS          = 0x08
-- | @\\t@
pattern TAB :: Word8
pattern $bTAB :: Word8
$mTAB :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
TAB          = 0x09
-- | @\\n@
pattern NEWLINE :: Word8
pattern $bNEWLINE :: Word8
$mNEWLINE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
NEWLINE      = 0x0a
-- | @\\v@
pattern VERTICAL_TAB :: Word8
pattern $bVERTICAL_TAB :: Word8
$mVERTICAL_TAB :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
VERTICAL_TAB = 0x0b
-- | @\\f@
pattern FORM_FEED :: Word8
pattern $bFORM_FEED :: Word8
$mFORM_FEED :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
FORM_FEED    = 0x0c
-- | @\\r@
pattern CARRIAGE_RETURN :: Word8
pattern $bCARRIAGE_RETURN :: Word8
$mCARRIAGE_RETURN :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
CARRIAGE_RETURN = 0x0d
-- |  Shift Out / X-On
pattern SO :: Word8
pattern $bSO :: Word8
$mSO :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SO = 0x0e
-- |  Shift In / X-Off
pattern SI :: Word8
pattern $bSI :: Word8
$mSI :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SI = 0x0f
-- | Data Line Escape
pattern DLE :: Word8
pattern $bDLE :: Word8
$mDLE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DLE = 0x10
-- | Device Control 1 (oft. XON)
pattern DC1 :: Word8
pattern $bDC1 :: Word8
$mDC1 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DC1 = 0x11
-- | Device Control 2
pattern DC2 :: Word8
pattern $bDC2 :: Word8
$mDC2 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DC2 = 0x12
-- | Device Control 3 (oft. XOFF)
pattern DC3 :: Word8
pattern $bDC3 :: Word8
$mDC3 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DC3 = 0x13
-- | Device Control 4
pattern DC4 :: Word8
pattern $bDC4 :: Word8
$mDC4 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DC4 = 0x14
-- | Negative Acknowledgement
pattern NAK :: Word8
pattern $bNAK :: Word8
$mNAK :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
NAK = 0x15
-- | Synchronous Idle
pattern SYN :: Word8
pattern $bSYN :: Word8
$mSYN :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SYN = 0x16
-- | End of Transmit Block
pattern ETB :: Word8
pattern $bETB :: Word8
$mETB :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ETB = 0x17
-- | Cancel
pattern CAN :: Word8
pattern $bCAN :: Word8
$mCAN :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
CAN = 0x18
-- |  End of Medium
pattern EM :: Word8
pattern $bEM :: Word8
$mEM :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
EM = 0x19
-- | Substitute
pattern SUB :: Word8
pattern $bSUB :: Word8
$mSUB :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SUB = 0x1a
-- | Escape
pattern ESC :: Word8
pattern $bESC :: Word8
$mESC :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ESC = 0x1b
-- |  File Separator
pattern FS :: Word8
pattern $bFS :: Word8
$mFS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
FS = 0x1c
-- |  Group Separator
pattern GS :: Word8
pattern $bGS :: Word8
$mGS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
GS = 0x1d
-- |  Record Separator
pattern RS :: Word8
pattern $bRS :: Word8
$mRS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
RS = 0x1e
-- |  Unit Separator
pattern US :: Word8
pattern $bUS :: Word8
$mUS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
US = 0x1f
-- | @\' \'@
pattern SPACE :: Word8
pattern $bSPACE :: Word8
$mSPACE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SPACE        = 0x20
-- | @\!@
pattern EXCLAM :: Word8
pattern $bEXCLAM :: Word8
$mEXCLAM :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
EXCLAM       = 0x21
-- | @\"@
pattern DOUBLE_QUOTE :: Word8
pattern $bDOUBLE_QUOTE :: Word8
$mDOUBLE_QUOTE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DOUBLE_QUOTE = 0x22
-- | @\#@
pattern HASH :: Word8
pattern $bHASH :: Word8
$mHASH :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
HASH         = 0x23
-- | @\#@
pattern NUMBER_SIGN :: Word8
pattern $bNUMBER_SIGN :: Word8
$mNUMBER_SIGN :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
NUMBER_SIGN  = 0x23
-- | @\$@
pattern DOLLAR :: Word8
pattern $bDOLLAR :: Word8
$mDOLLAR :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DOLLAR       = 0x24
-- | @\%@
pattern PERCENT :: Word8
pattern $bPERCENT :: Word8
$mPERCENT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
PERCENT      = 0x25
-- | @\&@
pattern AMPERSAND :: Word8
pattern $bAMPERSAND :: Word8
$mAMPERSAND :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
AMPERSAND    = 0x26
-- | @\&@
pattern AND :: Word8
pattern $bAND :: Word8
$mAND :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
AND          = 0x26
-- | @\'@
pattern SINGLE_QUOTE :: Word8
pattern $bSINGLE_QUOTE :: Word8
$mSINGLE_QUOTE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SINGLE_QUOTE = 0x27
-- | @(@
pattern PAREN_LEFT :: Word8
pattern $bPAREN_LEFT :: Word8
$mPAREN_LEFT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
PAREN_LEFT   = 0x28
-- | @)@
pattern PAREN_RIGHT :: Word8
pattern $bPAREN_RIGHT :: Word8
$mPAREN_RIGHT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
PAREN_RIGHT  = 0x29
-- | @*@
pattern ASTERISK :: Word8
pattern $bASTERISK :: Word8
$mASTERISK :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ASTERISK     = 0x2a
-- | @+@
pattern PLUS :: Word8
pattern $bPLUS :: Word8
$mPLUS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
PLUS         = 0x2b
-- | @,@
pattern COMMA :: Word8
pattern $bCOMMA :: Word8
$mCOMMA :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
COMMA        = 0x2c
-- | @-@
pattern HYPHEN :: Word8
pattern $bHYPHEN :: Word8
$mHYPHEN :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
HYPHEN       = 0x2d
-- | @-@
pattern MINUS :: Word8
pattern $bMINUS :: Word8
$mMINUS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
MINUS        = 0x2d
-- | @.@
pattern PERIOD :: Word8
pattern $bPERIOD :: Word8
$mPERIOD :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
PERIOD       = 0x2e
-- | @.@
pattern DOT :: Word8
pattern $bDOT :: Word8
$mDOT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DOT          = 0x2e
-- | @\/@
pattern SLASH :: Word8
pattern $bSLASH :: Word8
$mSLASH :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SLASH        = 0x2f

pattern DIGIT_0 :: Word8
pattern $bDIGIT_0 :: Word8
$mDIGIT_0 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_0      = 0x30
pattern DIGIT_1 :: Word8
pattern $bDIGIT_1 :: Word8
$mDIGIT_1 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_1      = 0x31
pattern DIGIT_2 :: Word8
pattern $bDIGIT_2 :: Word8
$mDIGIT_2 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_2      = 0x32
pattern DIGIT_3 :: Word8
pattern $bDIGIT_3 :: Word8
$mDIGIT_3 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_3      = 0x33
pattern DIGIT_4 :: Word8
pattern $bDIGIT_4 :: Word8
$mDIGIT_4 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_4      = 0x34
pattern DIGIT_5 :: Word8
pattern $bDIGIT_5 :: Word8
$mDIGIT_5 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_5      = 0x35
pattern DIGIT_6 :: Word8
pattern $bDIGIT_6 :: Word8
$mDIGIT_6 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_6      = 0x36
pattern DIGIT_7 :: Word8
pattern $bDIGIT_7 :: Word8
$mDIGIT_7 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_7      = 0x37
pattern DIGIT_8 :: Word8
pattern $bDIGIT_8 :: Word8
$mDIGIT_8 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_8      = 0x38
pattern DIGIT_9 :: Word8
pattern $bDIGIT_9 :: Word8
$mDIGIT_9 :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DIGIT_9      = 0x39

-- | @:@
pattern COLON :: Word8
pattern $bCOLON :: Word8
$mCOLON :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
COLON        = 0x3a
-- | @;@
pattern SEMICOLON :: Word8
pattern $bSEMICOLON :: Word8
$mSEMICOLON :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SEMICOLON    = 0x3b
-- | @<@
pattern LESS :: Word8
pattern $bLESS :: Word8
$mLESS :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LESS         = 0x3c
-- | @<@
pattern ANGLE_LEFT :: Word8
pattern $bANGLE_LEFT :: Word8
$mANGLE_LEFT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ANGLE_LEFT   = 0x3c
-- | @=@
pattern EQUAL :: Word8
pattern $bEQUAL :: Word8
$mEQUAL :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
EQUAL        = 0x3d
-- | @>@
pattern GREATER :: Word8
pattern $bGREATER :: Word8
$mGREATER :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
GREATER      = 0x3e
-- | @>@
pattern ANGLE_RIGHT :: Word8
pattern $bANGLE_RIGHT :: Word8
$mANGLE_RIGHT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
ANGLE_RIGHT  = 0x3e
-- | @\?@
pattern QUESTION :: Word8
pattern $bQUESTION :: Word8
$mQUESTION :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
QUESTION     = 0x3f
-- | @\@@
pattern AT :: Word8
pattern $bAT :: Word8
$mAT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
AT           = 0x40

pattern LETTER_A :: Word8
pattern $bLETTER_A :: Word8
$mLETTER_A :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_A     = 0x41
pattern LETTER_B :: Word8
pattern $bLETTER_B :: Word8
$mLETTER_B :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_B     = 0x42
pattern LETTER_C :: Word8
pattern $bLETTER_C :: Word8
$mLETTER_C :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_C     = 0x43
pattern LETTER_D :: Word8
pattern $bLETTER_D :: Word8
$mLETTER_D :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_D     = 0x44
pattern LETTER_E :: Word8
pattern $bLETTER_E :: Word8
$mLETTER_E :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_E     = 0x45
pattern LETTER_F :: Word8
pattern $bLETTER_F :: Word8
$mLETTER_F :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_F     = 0x46
pattern LETTER_G :: Word8
pattern $bLETTER_G :: Word8
$mLETTER_G :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_G     = 0x47
pattern LETTER_H :: Word8
pattern $bLETTER_H :: Word8
$mLETTER_H :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_H     = 0x48
pattern LETTER_I :: Word8
pattern $bLETTER_I :: Word8
$mLETTER_I :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_I     = 0x49
pattern LETTER_J :: Word8
pattern $bLETTER_J :: Word8
$mLETTER_J :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_J     = 0x4a
pattern LETTER_K :: Word8
pattern $bLETTER_K :: Word8
$mLETTER_K :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_K     = 0x4b
pattern LETTER_L :: Word8
pattern $bLETTER_L :: Word8
$mLETTER_L :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_L     = 0x4c
pattern LETTER_M :: Word8
pattern $bLETTER_M :: Word8
$mLETTER_M :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_M     = 0x4d
pattern LETTER_N :: Word8
pattern $bLETTER_N :: Word8
$mLETTER_N :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_N     = 0x4e
pattern LETTER_O :: Word8
pattern $bLETTER_O :: Word8
$mLETTER_O :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_O     = 0x4f
pattern LETTER_P :: Word8
pattern $bLETTER_P :: Word8
$mLETTER_P :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_P     = 0x50
pattern LETTER_Q :: Word8
pattern $bLETTER_Q :: Word8
$mLETTER_Q :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_Q     = 0x51
pattern LETTER_R :: Word8
pattern $bLETTER_R :: Word8
$mLETTER_R :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_R     = 0x52
pattern LETTER_S :: Word8
pattern $bLETTER_S :: Word8
$mLETTER_S :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_S     = 0x53
pattern LETTER_T :: Word8
pattern $bLETTER_T :: Word8
$mLETTER_T :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_T     = 0x54
pattern LETTER_U :: Word8
pattern $bLETTER_U :: Word8
$mLETTER_U :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_U     = 0x55
pattern LETTER_V :: Word8
pattern $bLETTER_V :: Word8
$mLETTER_V :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_V     = 0x56
pattern LETTER_W :: Word8
pattern $bLETTER_W :: Word8
$mLETTER_W :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_W     = 0x57
pattern LETTER_X :: Word8
pattern $bLETTER_X :: Word8
$mLETTER_X :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_X     = 0x58
pattern LETTER_Y :: Word8
pattern $bLETTER_Y :: Word8
$mLETTER_Y :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_Y     = 0x59
pattern LETTER_Z :: Word8
pattern $bLETTER_Z :: Word8
$mLETTER_Z :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_Z     = 0x5a

-- | @[@
pattern BRACKET_LEFT :: Word8
pattern $bBRACKET_LEFT :: Word8
$mBRACKET_LEFT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BRACKET_LEFT = 0x5b
-- | @[@
pattern SQUARE_LEFT :: Word8
pattern $bSQUARE_LEFT :: Word8
$mSQUARE_LEFT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SQUARE_LEFT = 0x5b
-- | @\\@
pattern BACKSLASH :: Word8
pattern $bBACKSLASH :: Word8
$mBACKSLASH :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BACKSLASH    = 0x5c
-- | @]@
pattern BRACKET_RIGHT :: Word8
pattern $bBRACKET_RIGHT :: Word8
$mBRACKET_RIGHT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BRACKET_RIGHT = 0x5d
-- | @]@
pattern SQUARE_RIGHT :: Word8
pattern $bSQUARE_RIGHT :: Word8
$mSQUARE_RIGHT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
SQUARE_RIGHT = 0x5d
-- | @^@
pattern CIRCUM :: Word8
pattern $bCIRCUM :: Word8
$mCIRCUM :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
CIRCUM       = 0x5e
-- | @_@
pattern UNDERSCORE :: Word8
pattern $bUNDERSCORE :: Word8
$mUNDERSCORE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
UNDERSCORE   = 0x5f
-- | @`@
pattern GRAVE :: Word8
pattern $bGRAVE :: Word8
$mGRAVE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
GRAVE        = 0x60

pattern LETTER_a :: Word8
pattern $bLETTER_a :: Word8
$mLETTER_a :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_a     = 0x61
pattern LETTER_b :: Word8
pattern $bLETTER_b :: Word8
$mLETTER_b :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_b     = 0x62
pattern LETTER_c :: Word8
pattern $bLETTER_c :: Word8
$mLETTER_c :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_c     = 0x63
pattern LETTER_d :: Word8
pattern $bLETTER_d :: Word8
$mLETTER_d :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_d     = 0x64
pattern LETTER_e :: Word8
pattern $bLETTER_e :: Word8
$mLETTER_e :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_e     = 0x65
pattern LETTER_f :: Word8
pattern $bLETTER_f :: Word8
$mLETTER_f :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_f     = 0x66
pattern LETTER_g :: Word8
pattern $bLETTER_g :: Word8
$mLETTER_g :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_g     = 0x67
pattern LETTER_h :: Word8
pattern $bLETTER_h :: Word8
$mLETTER_h :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_h     = 0x68
pattern LETTER_i :: Word8
pattern $bLETTER_i :: Word8
$mLETTER_i :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_i     = 0x69
pattern LETTER_j :: Word8
pattern $bLETTER_j :: Word8
$mLETTER_j :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_j     = 0x6a
pattern LETTER_k :: Word8
pattern $bLETTER_k :: Word8
$mLETTER_k :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_k     = 0x6b
pattern LETTER_l :: Word8
pattern $bLETTER_l :: Word8
$mLETTER_l :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_l     = 0x6c
pattern LETTER_m :: Word8
pattern $bLETTER_m :: Word8
$mLETTER_m :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_m     = 0x6d
pattern LETTER_n :: Word8
pattern $bLETTER_n :: Word8
$mLETTER_n :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_n     = 0x6e
pattern LETTER_o :: Word8
pattern $bLETTER_o :: Word8
$mLETTER_o :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_o     = 0x6f
pattern LETTER_p :: Word8
pattern $bLETTER_p :: Word8
$mLETTER_p :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_p     = 0x70
pattern LETTER_q :: Word8
pattern $bLETTER_q :: Word8
$mLETTER_q :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_q     = 0x71
pattern LETTER_r :: Word8
pattern $bLETTER_r :: Word8
$mLETTER_r :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_r     = 0x72
pattern LETTER_s :: Word8
pattern $bLETTER_s :: Word8
$mLETTER_s :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_s     = 0x73
pattern LETTER_t :: Word8
pattern $bLETTER_t :: Word8
$mLETTER_t :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_t     = 0x74
pattern LETTER_u :: Word8
pattern $bLETTER_u :: Word8
$mLETTER_u :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_u     = 0x75
pattern LETTER_v :: Word8
pattern $bLETTER_v :: Word8
$mLETTER_v :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_v     = 0x76
pattern LETTER_w :: Word8
pattern $bLETTER_w :: Word8
$mLETTER_w :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_w     = 0x77
pattern LETTER_x :: Word8
pattern $bLETTER_x :: Word8
$mLETTER_x :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_x     = 0x78
pattern LETTER_y :: Word8
pattern $bLETTER_y :: Word8
$mLETTER_y :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_y     = 0x79
pattern LETTER_z :: Word8
pattern $bLETTER_z :: Word8
$mLETTER_z :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
LETTER_z     = 0x7a

-- | @{@
pattern BRACE_LEFT :: Word8
pattern $bBRACE_LEFT :: Word8
$mBRACE_LEFT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BRACE_LEFT   = 0x7b
-- | @{@
pattern CURLY_LEFT :: Word8
pattern $bCURLY_LEFT :: Word8
$mCURLY_LEFT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
CURLY_LEFT   = 0x7b
-- | @|@
pattern BAR :: Word8
pattern $bBAR :: Word8
$mBAR :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BAR          = 0x7c
-- | @|@
pattern OR :: Word8
pattern $bOR :: Word8
$mOR :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
OR           = 0x7c
-- | @}@
pattern BRACE_RIGHT :: Word8
pattern $bBRACE_RIGHT :: Word8
$mBRACE_RIGHT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
BRACE_RIGHT  = 0x7d
-- | @}@
pattern CURLY_RIGHT :: Word8
pattern $bCURLY_RIGHT :: Word8
$mCURLY_RIGHT :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
CURLY_RIGHT  = 0x7d
-- | @~@
pattern TILDE :: Word8
pattern $bTILDE :: Word8
$mTILDE :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
TILDE        = 0x7e
-- | @\\DEL@
pattern DEL :: Word8
pattern $bDEL :: Word8
$mDEL :: forall r. Word8 -> (Void# -> r) -> (Void# -> r) -> r
DEL          = 0x7f