    {-# LANGUAGE MagicHash, CPP #-}

    -- | Char8 library to be used with Data.ByteString.Char8.
    -- All function assumes that only 8bit part of 'Char' is used
    -- and it is encoded in Latin-1 (ISO-8859-1).
    -- All utility functions are supposed to work as if
    -- those of 'Data.Char'. Exceptions are described in
    -- the function documentations.
    --
    -- Base library 4.7 (GHC 7.8) or earlier is based on Unicode 6.
    -- Base library 4.8 (GHC 7.10) or later is based on Unicode 7.
    -- 'isLower', 'isSymbol' and 'isPunctuation' behave differently.

    module Data.Char8 (
      -- * Character classification
        isControl, isSpace, isLower, isUpper
      , isAlpha, isAlphaNum, isPrint, isDigit, isOctDigit, isHexDigit
      , isLetter, isMark, isNumber, isPunctuation, isSymbol, isSeparator
      -- * Subranges
      , isAscii, isLatin1, isAsciiUpper, isAsciiLower
      -- * Case conversion
      , toUpper, toLower, toTitle
      ) where

    import GHC.Base
    ----------------------------------------------------------------

    isControl :: Char -> Bool
    isControl :: Char -> Bool
    isControl c :: Char
    c = Char
    _nul Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= '\x1f'
               Bool -> Bool -> Bool
    || Char
    _del Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= '\x9f'

    isSpace :: Char -> Bool
    isSpace :: Char -> Bool
    isSpace c :: Char
    c = Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _space
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _tab
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _lf
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _cr
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _np
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _vt
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _nbsp

    -- | This function returns 'True' for 170 and 186 in Unicode 6.
    --   But it returns 'False' in Unicode 7.
    isLower :: Char -> Bool
    isLower :: Char -> Bool
    isLower c :: Char
    c = Char -> Bool
    isLower' Char
    c
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _mu
    #if !MIN_VERSION_base(4,8,0)
             || c == _ordfeminine
             || c == _ordmasculine
    #endif

    isLowerCommon :: Char -> Bool
    isLowerCommon :: Char -> Bool
    isLowerCommon c :: Char
    c = Char -> Bool
    isLower' Char
    c
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _mu
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _ordfeminine
             Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _ordmasculine

    isLower' :: Char -> Bool
    isLower' :: Char -> Bool
    isLower' c :: Char
    c = Char -> Bool
    isAsciiLower Char
    c
              Bool -> Bool -> Bool
    || Char
    _germandbls Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    _odieresis
              Bool -> Bool -> Bool
    || Char
    _oslash     Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    _ydieresis

    isUpper :: Char -> Bool
    isUpper :: Char -> Bool
    isUpper c :: Char
    c = Char -> Bool
    isAsciiUpper Char
    c
             Bool -> Bool -> Bool
    || Char
    _Agrave Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    _Odieresis
             Bool -> Bool -> Bool
    || Char
    _Oslash Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    _Thorn

    isAlpha :: Char -> Bool
    isAlpha :: Char -> Bool
    isAlpha c :: Char
    c = Char -> Bool
    isLowerCommon Char
    c Bool -> Bool -> Bool
    || Char -> Bool
    isUpper Char
    c

    isAlphaNum :: Char -> Bool
    isAlphaNum :: Char -> Bool
    isAlphaNum c :: Char
    c = Char -> Bool
    isAlpha Char
    c Bool -> Bool -> Bool
    || Char -> Bool
    isNumber Char
    c

    isPrint :: Char -> Bool
    isPrint :: Char -> Bool
    isPrint c :: Char
    c
      | Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _softhyphen = Bool
    False
    isPrint c :: Char
    c = Char
    _space Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= '~'
             Bool -> Bool -> Bool
    || Char
    _nbsp  Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    _ydieresis

    isDigit :: Char -> Bool
    isDigit :: Char -> Bool
    isDigit c :: Char
    c = '0' Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= '9'

    isOctDigit :: Char -> Bool
    isOctDigit :: Char -> Bool
    isOctDigit c :: Char
    c = '0' Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= '7'

    isHexDigit :: Char -> Bool
    isHexDigit :: Char -> Bool
    isHexDigit c :: Char
    c = Char -> Bool
    isDigit Char
    c
                Bool -> Bool -> Bool
    || 'A' Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= 'F'
                Bool -> Bool -> Bool
    || 'a' Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= 'f'

    isLetter :: Char -> Bool
    isLetter :: Char -> Bool
    isLetter c :: Char
    c = Char -> Bool
    isLowerCommon Char
    c Bool -> Bool -> Bool
    || Char -> Bool
    isUpper Char
    c

    isMark :: Char -> Bool
    isMark :: Char -> Bool
    isMark _ = Bool
    False

    isNumber :: Char -> Bool
    isNumber :: Char -> Bool
    isNumber c :: Char
    c = Char -> Bool
    isDigit Char
    c
              Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _s1
              Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _s2
              Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _s3
              Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _1'4
              Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _1'2
              Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _3'4

    -- | This function returns 'False' for 167 and 182 in Unicode 6.
    --   But it returns 'True' in Unicode 7.
    isPunctuation :: Char -> Bool
    #if MIN_VERSION_base(4,8,0)
    isPunctuation :: Char -> Bool
    isPunctuation c :: Char
    c = Char
    c Char -> [Char] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` ['\x21','\x22','\x23','\x25','\x26','\x27','\x28','\x29','\x2a','\x2c','\x2d','\x2e','\x2f','\x3a','\x3b','\x3f','\x40','\x5b','\x5c','\x5d','\x5f','\x7b','\x7d','\xa1','\xa7','\xab','\xb6','\xb7','\xbb','\xbf']
    #else
    isPunctuation c = c `elem` ['\x21','\x22','\x23','\x25','\x26','\x27','\x28','\x29','\x2a','\x2c','\x2d','\x2e','\x2f','\x3a','\x3b','\x3f','\x40','\x5b','\x5c','\x5d','\x5f','\x7b','\x7d','\xa1','\xab','\xb7','\xbb','\xbf']
    #endif

    -- | This function returns 'True' for 167 and 182 in Unicode 6.
    --   But it returns 'False' in Unicode 7.
    isSymbol :: Char -> Bool
    #if MIN_VERSION_base(4,8,0)
    isSymbol :: Char -> Bool
    isSymbol c :: Char
    c = Char
    c Char -> [Char] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` ['\x24','\x2b','\x3c','\x3d','\x3e','\x5e','\x60','\x7c','\x7e','\xa2','\xa3','\xa4','\xa5','\xa6','\xa8','\xa9','\xac','\xae','\xaf','\xb0','\xb1','\xb4','\xb8','\xd7','\xf7']
    #else
    isSymbol c = c `elem` ['\x24','\x2b','\x3c','\x3d','\x3e','\x5e','\x60','\x7c','\x7e','\xa2','\xa3','\xa4','\xa5','\xa6','\xa7','\xa8','\xa9','\xac','\xae','\xaf','\xb0','\xb1','\xb4','\xb6','\xb8','\xd7','\xf7']
    #endif

    isSeparator :: Char -> Bool
    isSeparator :: Char -> Bool
    isSeparator c :: Char
    c = Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _space
                 Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _nbsp

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

    isAscii :: Char -> Bool
    isAscii :: Char -> Bool
    isAscii c :: Char
    c = Char
    _nul Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    _del

    isLatin1 :: Char -> Bool
    #if __GLASGOW_HASKELL__ >= 707
    isLatin1 :: Char -> Bool
    isLatin1 (C# c# :: Char#
    c#) = Int# -> Bool
    isTrue# (Char# -> Int#
    ord# Char#
    c# Int# -> Int# -> Int#
    <=# 0xff#)
    #else
    isLatin1 (C# c#) = ord# c# <=# 0xff#
    #endif

    isAsciiUpper :: Char -> Bool
    isAsciiUpper :: Char -> Bool
    isAsciiUpper c :: Char
    c = 'A' Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= 'Z'

    isAsciiLower :: Char -> Bool
    isAsciiLower :: Char -> Bool
    isAsciiLower c :: Char
    c = 'a' Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Char
    c Bool -> Bool -> Bool
    && Char
    c Char -> Char -> Bool
    forall a. Ord a => a -> a -> Bool
    <= 'z'

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

    -- | Micro sign/mu (0xb5) and small letter Y with diaeresis (0xff) remain the same.
    toUpper :: Char -> Char
    toUpper :: Char -> Char
    toUpper c :: Char
    c@(C# c# :: Char#
    c#)
      | Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    _germandbls = Char
    c
      | Char -> Bool
    isLower' Char
    c       = Char# -> Char
    C# (Int# -> Char#
    chr# (Char# -> Int#
    ord# Char#
    c# Int# -> Int# -> Int#
    -# 32#))
      | Bool
    otherwise        = Char
    c

    toLower :: Char -> Char
    toLower :: Char -> Char
    toLower c :: Char
    c@(C# c# :: Char#
    c#)
      | Char -> Bool
    isUpper Char
    c = Char# -> Char
    C# (Int# -> Char#
    chr# (Char# -> Int#
    ord# Char#
    c# Int# -> Int# -> Int#
    +# 32#))
      | Bool
    otherwise = Char
    c

    -- | Micro sign/mu (0xb5) and small letter Y with diaeresis (0xff) remain the same.
    toTitle :: Char -> Char
    toTitle :: Char -> Char
    toTitle = Char -> Char
    toUpper

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

    _nul, _tab, _lf, _vt, _np, _cr :: Char
    _nul :: Char
    _nul = '\x00'
    _tab :: Char
    _tab = '\x09'
    _lf :: Char
    _lf  = '\x0a'
    _vt :: Char
    _vt  = '\x0b'
    _np :: Char
    _np  = '\x0c'
    _cr :: Char
    _cr  = '\x0d'

    _space, _del, _nbsp :: Char
    _space :: Char
    _space = '\x20'
    _del :: Char
    _del   = '\x7f'
    _nbsp :: Char
    _nbsp  = '\xa0'

    _ordfeminine, _softhyphen, _mu, _ordmasculine :: Char
    _ordfeminine :: Char
    _ordfeminine  = '\xaa'
    _softhyphen :: Char
    _softhyphen   = '\xad'
    _mu :: Char
    _mu           = '\xb5'
    _ordmasculine :: Char
    _ordmasculine = '\xba'

    _s2, _s3, _s1, _1'4, _1'2, _3'4  :: Char
    _s2 :: Char
    _s2 = '\xb2'
    _s3 :: Char
    _s3 = '\xb3'
    _s1 :: Char
    _s1 = '\xb9'
    _1'4 :: Char
    _1'4 = '\xbc'
    _1'2 :: Char
    _1'2 = '\xbd'
    _3'4 :: Char
    _3'4 = '\xbe'

    _Agrave, _Odieresis, _Oslash, _Thorn :: Char
    _Agrave :: Char
    _Agrave    = '\xc0'
    _Odieresis :: Char
    _Odieresis = '\xd6'
    _Oslash :: Char
    _Oslash    = '\xd8'
    _Thorn :: Char
    _Thorn     = '\xde'

    _germandbls, _agrave, _odieresis, _oslash, _thorn, _ydieresis :: Char
    _germandbls :: Char
    _germandbls = '\xdf'
    _agrave :: Char
    _agrave     = '\xe0'
    _odieresis :: Char
    _odieresis  = '\xf6'
    _oslash :: Char
    _oslash     = '\xf8'
    _thorn :: Char
    _thorn      = '\xfe'
    _ydieresis :: Char
    _ydieresis  = '\xff'