word8-0.0.4/0000755000000000000000000000000012217441423010744 5ustar0000000000000000word8-0.0.4/LICENSE0000644000000000000000000000276512217441423011763 0ustar0000000000000000Copyright (c) 2012, IIJ Innovation Institute Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. word8-0.0.4/Setup.hs0000644000000000000000000000005612217441423012401 0ustar0000000000000000import Distribution.Simple main = defaultMain word8-0.0.4/word8.cabal0000644000000000000000000000256512217441423013003 0ustar0000000000000000Name: word8 Version: 0.0.4 Author: Kazu Yamamoto Maintainer: Kazu Yamamoto License: BSD3 License-File: LICENSE Synopsis: Word8 library Description: Word8 library to be used with Data.ByteString Category: Data Cabal-Version: >= 1.10 Build-Type: Simple Library Default-Language: Haskell2010 GHC-Options: -Wall Exposed-Modules: Data.Char8 Data.Word8 Build-Depends: base >= 4 && < 5 Test-Suite spec Type: exitcode-stdio-1.0 Default-Language: Haskell2010 Hs-Source-Dirs: test Ghc-Options: -Wall Main-Is: Spec.hs Other-Modules: Char8Spec Word8Spec Build-Depends: base , word8 , hspec Benchmark criterion Type: exitcode-stdio-1.0 Default-Language: Haskell2010 Hs-Source-Dirs: bench Ghc-Options: -Wall Main-Is: Bench.hs Build-Depends: base , bytestring , criterion , word8 Source-Repository head Type: git Location: https://github.com/kazu-yamamoto/word8 word8-0.0.4/bench/0000755000000000000000000000000012217441423012023 5ustar0000000000000000word8-0.0.4/bench/Bench.hs0000644000000000000000000000076612217441423013407 0ustar0000000000000000module Main where import Criterion.Main import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as S8 import qualified Data.Char import qualified Data.Char8 import qualified Data.Word8 main :: IO () main = do input <- S.readFile "bench/Bench.hs" defaultMain [ bench "Data.Char" $ whnf (S8.map Data.Char.toLower) input , bench "Data.Char8" $ whnf (S8.map Data.Char8.toLower) input , bench "Data.Word8" $ whnf (S.map Data.Word8.toLower) input ] word8-0.0.4/Data/0000755000000000000000000000000012217441423011615 5ustar0000000000000000word8-0.0.4/Data/Char8.hs0000644000000000000000000001106512217441423013121 0ustar0000000000000000{-# 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. 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 c = _nul <= c && c <= '\x1f' || _del <= c && c <= '\x9f' isSpace :: Char -> Bool isSpace c = c == _space || c == _tab || c == _lf || c == _cr || c == _np || c == _vt || c == _nbsp isLower :: Char -> Bool isLower c = isLower' c || c == _ordfeminine || c == _mu || c == _ordmasculine isLower' :: Char -> Bool isLower' c = isAsciiLower c || _germandbls <= c && c <= _odieresis || _oslash <= c && c <= _ydieresis isUpper :: Char -> Bool isUpper c = isAsciiUpper c || _Agrave <= c && c <= _Odieresis || _Oslash <= c && c <= _Thorn isAlpha :: Char -> Bool isAlpha c = isLower c || isUpper c isAlphaNum :: Char -> Bool isAlphaNum c = isAlpha c || isNumber c isPrint :: Char -> Bool isPrint c | c == _softhyphen = False isPrint c = _space <= c && c <= '~' || _nbsp <= c && c <= _ydieresis isDigit :: Char -> Bool isDigit c = '0' <= c && c <= '9' isOctDigit :: Char -> Bool isOctDigit c = '0' <= c && c <= '7' isHexDigit :: Char -> Bool isHexDigit c = isDigit c || 'A' <= c && c <= 'F' || 'a' <= c && c <= 'f' isLetter :: Char -> Bool isLetter c = isLower c || isUpper c isMark :: Char -> Bool isMark _ = False isNumber :: Char -> Bool isNumber c = isDigit c || c == _s1 || c == _s2 || c == _s3 || c == _1'4 || c == _1'2 || c == _3'4 isPunctuation :: Char -> Bool 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'] isSymbol :: Char -> Bool 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'] isSeparator :: Char -> Bool isSeparator c = c == _space || c == _nbsp ---------------------------------------------------------------- isAscii :: Char -> Bool isAscii c = _nul <= c && c <= _del isLatin1 :: Char -> Bool #if __GLASGOW_HASKELL__ >= 707 isLatin1 (C# c#) = isTrue# (ord# c# <=# 0xff#) #else isLatin1 (C# c#) = ord# c# <=# 0xff# #endif isAsciiUpper :: Char -> Bool isAsciiUpper c = 'A' <= c && c <= 'Z' isAsciiLower :: Char -> Bool isAsciiLower c = 'a' <= c && c <= 'z' ---------------------------------------------------------------- -- | Micro sign/mu (0xb5) and small letter Y with diaeresis (0xff) remain the same. toUpper :: Char -> Char toUpper c@(C# c#) | c == _germandbls = c | isLower' c = C# (chr# (ord# c# -# 32#)) | otherwise = c toLower :: Char -> Char toLower c@(C# c#) | isUpper c = C# (chr# (ord# c# +# 32#)) | otherwise = c -- | Micro sign/mu (0xb5) and small letter Y with diaeresis (0xff) remain the same. toTitle :: Char -> Char toTitle = toUpper ---------------------------------------------------------------- _nul, _tab, _lf, _vt, _np, _cr :: Char _nul = '\x00' _tab = '\x09' _lf = '\x0a' _vt = '\x0b' _np = '\x0c' _cr = '\x0d' _space, _del, _nbsp :: Char _space = '\x20' _del = '\x7f' _nbsp = '\xa0' _ordfeminine, _softhyphen, _mu, _ordmasculine :: Char _ordfeminine = '\xaa' _softhyphen = '\xad' _mu = '\xb5' _ordmasculine = '\xba' _s2, _s3, _s1, _1'4, _1'2, _3'4 :: Char _s2 = '\xb2' _s3 = '\xb3' _s1 = '\xb9' _1'4 = '\xbc' _1'2 = '\xbd' _3'4 = '\xbe' _Agrave, _Odieresis, _Oslash, _Thorn :: Char _Agrave = '\xc0' _Odieresis = '\xd6' _Oslash = '\xd8' _Thorn = '\xde' _germandbls, _agrave, _odieresis, _oslash, _thorn, _ydieresis :: Char _germandbls = '\xdf' _agrave = '\xe0' _odieresis = '\xf6' _oslash = '\xf8' _thorn = '\xfe' _ydieresis = '\xff' word8-0.0.4/Data/Word8.hs0000644000000000000000000001572312217441423013164 0ustar0000000000000000-- | Word8 library to be used with Data.ByteString. -- All function assumes that 'Word8' 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. module Data.Word8 ( -- * Re-exporting Word8 -- * 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 -- * ASCII charactors , _nul, _tab, _lf, _vt, _np, _cr , _space, _exclam, _quotedbl, _numbersign, _dollar, _percent, _ampersand, _quotesingle, _parenleft, _parenright, _asterisk, _plus, _comma, _hyphen, _period, _slash , _0, _1, _2, _3, _4, _5, _6, _7, _8, _9 , _colon, _semicolon, _less, _equal, _greater, _question, _at , _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z , _braketleft, _backslash, _bracketright, _circum, _underscore, _grave , _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z , _blaceleft, _bar, _braceright, _tilde, _del -- * Some Latin-1 charactors , _nbsp , _ordfeminine, _softhyphen, _mu, _ordmasculine , _s2, _s3, _s1, _1'4, _1'2, _3'4 , _Agrave, _Odieresis, _Oslash, _Thorn , _germandbls, _agrave, _odieresis, _oslash, _thorn, _ydieresis ) where import Data.Word (Word8) ---------------------------------------------------------------- isControl :: Word8 -> Bool isControl w = _nul <= w && w <= 0x1f || _del <= w && w <= 0x9f isSpace :: Word8 -> Bool isSpace w = w == _space || w == _tab || w == _lf || w == _cr || w == _np || w == _vt || w == _nbsp isLower :: Word8 -> Bool isLower w = isLower' w || w == _ordfeminine || w == _mu || w == _ordmasculine isLower' :: Word8 -> Bool isLower' w = isAsciiLower w || _germandbls <= w && w <= _odieresis || _oslash <= w && w <= _ydieresis isUpper :: Word8 -> Bool isUpper w = isAsciiUpper w || _Agrave <= w && w <= _Odieresis || _Oslash <= w && w <= _Thorn isAlpha :: Word8 -> Bool isAlpha w = isLower w || isUpper w isAlphaNum :: Word8 -> Bool isAlphaNum w = isAlpha w || isNumber w isPrint :: Word8 -> Bool isPrint w | w == _softhyphen = False isPrint w = _space <= w && w <= _tilde || _nbsp <= w && w <= _ydieresis isDigit :: Word8 -> Bool isDigit w = _0 <= w && w <= _9 isOctDigit :: Word8 -> Bool isOctDigit w = _0 <= w && w <= _7 isHexDigit :: Word8 -> Bool isHexDigit w = isDigit w || _A <= w && w <= _F || _a <= w && w <= _f isLetter :: Word8 -> Bool isLetter w = isLower w || isUpper w isMark :: Word8 -> Bool isMark _ = False isNumber :: Word8 -> Bool isNumber w = isDigit w || w == _s1 || w == _s2 || w == _s3 || w == _1'4 || w == _1'2 || w == _3'4 isPunctuation :: Word8 -> Bool isPunctuation w = w `elem` [0x21,0x22,0x23,0x25,0x26,0x27,0x28,0x29,0x2a,0x2c,0x2d,0x2e,0x2f,0x3a,0x3b,0x3f,0x40,0x5b,0x5c,0x5d,0x5f,0x7b,0x7d,0xa1,0xab,0xb7,0xbb,0xbf] isSymbol :: Word8 -> Bool isSymbol w = w `elem` [0x24,0x2b,0x3c,0x3d,0x3e,0x5e,0x60,0x7c,0x7e,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xac,0xae,0xaf,0xb0,0xb1,0xb4,0xb6,0xb8,0xd7,0xf7] isSeparator :: Word8 -> Bool isSeparator w = w == _space || w == _nbsp ---------------------------------------------------------------- isAscii :: Word8 -> Bool isAscii w = _nul <= w && w <= _del isLatin1 :: Word8 -> Bool isLatin1 _ = True isAsciiUpper :: Word8 -> Bool isAsciiUpper w = _A <= w && w <= _Z isAsciiLower :: Word8 -> Bool isAsciiLower w = _a <= w && w <= _z ---------------------------------------------------------------- -- | Micro sign/mu (0xb5) and small letter Y with diaeresis (0xff) remain the same. toUpper :: Word8 -> Word8 toUpper w | w == _germandbls = w | isLower' w = w - _space | otherwise = w toLower :: Word8 -> Word8 toLower w | isUpper w = w + _space | otherwise = w -- | Micro sign/mu (0xb5) and small letter Y with diaeresis (0xff) remain the same. toTitle :: Word8 -> Word8 toTitle = toUpper ---------------------------------------------------------------- _nul, _tab, _lf, _vt, _np, _cr :: Word8 _nul = 0x00 _tab = 0x09 _lf = 0x0a _vt = 0x0b _np = 0x0c _cr = 0x0d _space, _exclam, _quotedbl, _numbersign, _dollar, _percent, _ampersand, _quotesingle, _parenleft, _parenright, _asterisk, _plus, _comma, _hyphen, _period, _slash :: Word8 _space = 0x20 _exclam = 0x21 _quotedbl = 0x22 _numbersign = 0x23 _dollar = 0x24 _percent = 0x25 _ampersand = 0x26 _quotesingle = 0x27 _parenleft = 0x28 _parenright = 0x29 _asterisk = 0x2a _plus = 0x2b _comma = 0x2c _hyphen = 0x2d _period = 0x2e _slash = 0x2f _0, _1, _2, _3, _4, _5, _6, _7, _8, _9 :: Word8 _0 = 0x30 _1 = 0x31 _2 = 0x32 _3 = 0x33 _4 = 0x34 _5 = 0x35 _6 = 0x36 _7 = 0x37 _8 = 0x38 _9 = 0x39 _colon, _semicolon, _less, _equal, _greater, _question, _at :: Word8 _colon = 0x3a _semicolon = 0x3b _less = 0x3c _equal = 0x3d _greater = 0x3e _question = 0x3f _at = 0x40 _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z :: Word8 _A = 0x41 _B = 0x42 _C = 0x43 _D = 0x44 _E = 0x45 _F = 0x46 _G = 0x47 _H = 0x48 _I = 0x49 _J = 0x4a _K = 0x4b _L = 0x4c _M = 0x4d _N = 0x4e _O = 0x4f _P = 0x50 _Q = 0x51 _R = 0x52 _S = 0x53 _T = 0x54 _U = 0x55 _V = 0x56 _W = 0x57 _X = 0x58 _Y = 0x59 _Z = 0x5a _braketleft, _backslash, _bracketright, _circum, _underscore, _grave :: Word8 _braketleft = 0x5b _backslash = 0x5c _bracketright = 0x5d _circum = 0x5e _underscore = 0x5f _grave = 0x60 _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z :: Word8 _a = 0x61 _b = 0x62 _c = 0x63 _d = 0x64 _e = 0x65 _f = 0x66 _g = 0x67 _h = 0x68 _i = 0x69 _j = 0x6a _k = 0x6b _l = 0x6c _m = 0x6d _n = 0x6e _o = 0x6f _p = 0x70 _q = 0x71 _r = 0x72 _s = 0x73 _t = 0x74 _u = 0x75 _v = 0x76 _w = 0x77 _x = 0x78 _y = 0x79 _z = 0x7a _blaceleft, _bar, _braceright, _tilde, _del :: Word8 _blaceleft = 0x7b _bar = 0x7c _braceright = 0x7d _tilde = 0x7e _del = 0x7f _nbsp :: Word8 _nbsp = 0xa0 _ordfeminine, _softhyphen, _mu, _ordmasculine :: Word8 _ordfeminine = 0xaa _softhyphen = 0xad _mu = 0xb5 _ordmasculine = 0xba _s2, _s3, _s1, _1'4, _1'2, _3'4 :: Word8 _s2 = 0xb2 _s3 = 0xb3 _s1 = 0xb9 _1'4 = 0xbc _1'2 = 0xbd _3'4 = 0xbe _Agrave, _Odieresis, _Oslash, _Thorn :: Word8 _Agrave = 0xc0 _Odieresis = 0xd6 _Oslash = 0xd8 _Thorn = 0xde _germandbls, _agrave, _odieresis, _oslash, _thorn, _ydieresis :: Word8 _germandbls = 0xdf _agrave = 0xe0 _odieresis = 0xf6 _oslash = 0xf8 _thorn = 0xfe _ydieresis = 0xff word8-0.0.4/test/0000755000000000000000000000000012217441423011723 5ustar0000000000000000word8-0.0.4/test/Char8Spec.hs0000644000000000000000000000601512217441423014041 0ustar0000000000000000module Char8Spec where import qualified Data.Char as C import Data.Char8 import Test.Hspec import Test.Hspec.QuickCheck spec :: Spec spec = do describe "isControl" $ do prop "behaves like model" $ \c -> isControl c == C.isControl c describe "isSpace" $ do prop "behaves like model" $ \c -> isSpace c == C.isSpace c describe "isLower" $ do prop "behaves like model" $ \c -> isLower c == C.isLower c describe "isUpper" $ do prop "behaves like model" $ \c -> isUpper c == C.isUpper c describe "isAlpha" $ do prop "behaves like model" $ \c -> isAlpha c == C.isAlpha c describe "isAlphaNum" $ do prop "behaves like model" $ \c -> isAlphaNum c == C.isAlphaNum c describe "isPrint" $ do prop "behaves like model" $ \c -> isPrint c == C.isPrint c describe "isDigit" $ do prop "behaves like model" $ \c -> isDigit c == C.isDigit c describe "isOctDigit" $ do prop "behaves like model" $ \c -> isOctDigit c == C.isOctDigit c describe "isHexDigit" $ do prop "behaves like model" $ \c -> isHexDigit c == C.isHexDigit c describe "isLetter" $ do prop "behaves like model" $ \c -> isLetter c == C.isLetter c describe "isMark" $ do prop "behaves like model" $ \c -> isMark c == C.isMark c describe "isNumber" $ do prop "behaves like model" $ \c -> isNumber c == C.isNumber c describe "isPunctuation" $ do prop "behaves like model" $ \c -> isPunctuation c == C.isPunctuation c describe "isSymbol" $ do prop "behaves like model" $ \c -> isSymbol c == C.isSymbol c describe "isSeparator" $ do prop "behaves like model" $ \c -> isSeparator c == C.isSeparator c describe "isAscii" $ do prop "behaves like model" $ \c -> isAscii c == C.isAscii c describe "isLatin1" $ do prop "behaves like model" $ \c -> isLatin1 c == C.isLatin1 c describe "isAsciiUpper" $ do prop "behaves like model" $ \c -> isAsciiUpper c == C.isAsciiUpper c describe "isAsciiLower" $ do prop "behaves like model" $ \c -> isAsciiLower c == C.isAsciiLower c describe "toUpper" $ do prop "behaves like model" $ prop_toUpper describe "toLower" $ do prop "behaves like model" $ \c -> toLower c == C.toLower c describe "toTitle" $ do prop "behaves like model" $ prop_toTitle prop_toUpper :: Char -> Bool prop_toUpper c | c == _mu = True | c == _ydieresis = True | otherwise = toUpper c == C.toUpper c prop_toTitle :: Char -> Bool prop_toTitle c | c == _mu = True | c == _ydieresis = True | otherwise = toTitle c == C.toTitle c ---------------------------------------------------------------- _mu, _ydieresis :: Char _mu = '\xb5' _ydieresis = '\xff' word8-0.0.4/test/Spec.hs0000644000000000000000000000005412217441423013150 0ustar0000000000000000{-# OPTIONS_GHC -F -pgmF hspec-discover #-} word8-0.0.4/test/Word8Spec.hs0000644000000000000000000000656712217441423014113 0ustar0000000000000000module Word8Spec where import qualified Data.Char as C import Data.Word8 import Test.Hspec import Test.Hspec.QuickCheck spec :: Spec spec = do describe "isControl" $ do prop "behaves like model" $ \w -> isControl w == C.isControl (word8ToChar w) describe "isSpace" $ do prop "behaves like model" $ \w -> isSpace w == C.isSpace (word8ToChar w) describe "isLower" $ do prop "behaves like model" $ \w -> isLower w == C.isLower (word8ToChar w) describe "isUpper" $ do prop "behaves like model" $ \w -> isUpper w == C.isUpper (word8ToChar w) describe "isAlpha" $ do prop "behaves like model" $ \w -> isAlpha w == C.isAlpha (word8ToChar w) describe "isAlphaNum" $ do prop "behaves like model" $ \w -> isAlphaNum w == C.isAlphaNum (word8ToChar w) describe "isPrint" $ do prop "behaves like model" $ \w -> isPrint w == C.isPrint (word8ToChar w) describe "isDigit" $ do prop "behaves like model" $ \w -> isDigit w == C.isDigit (word8ToChar w) describe "isOctDigit" $ do prop "behaves like model" $ \w -> isOctDigit w == C.isOctDigit (word8ToChar w) describe "isHexDigit" $ do prop "behaves like model" $ \w -> isHexDigit w == C.isHexDigit (word8ToChar w) describe "isLetter" $ do prop "behaves like model" $ \w -> isLetter w == C.isLetter (word8ToChar w) describe "isMark" $ do prop "behaves like model" $ \w -> isMark w == C.isMark (word8ToChar w) describe "isNumber" $ do prop "behaves like model" $ \w -> isNumber w == C.isNumber (word8ToChar w) describe "isPunctuation" $ do prop "behaves like model" $ \w -> isPunctuation w == C.isPunctuation (word8ToChar w) describe "isSymbol" $ do prop "behaves like model" $ \w -> isSymbol w == C.isSymbol (word8ToChar w) describe "isSeparator" $ do prop "behaves like model" $ \w -> isSeparator w == C.isSeparator (word8ToChar w) describe "isAscii" $ do prop "behaves like model" $ \w -> isAscii w == C.isAscii (word8ToChar w) describe "isLatin1" $ do prop "behaves like model" $ \w -> isLatin1 w == C.isLatin1 (word8ToChar w) describe "isAsciiUpper" $ do prop "behaves like model" $ \w -> isAsciiUpper w == C.isAsciiUpper (word8ToChar w) describe "isAsciiLower" $ do prop "behaves like model" $ \w -> isAsciiLower w == C.isAsciiLower (word8ToChar w) describe "toUpper" $ do prop "behaves like model" $ prop_toUpper describe "toLower" $ do prop "behaves like model" $ \w -> word8ToChar (toLower w) == C.toLower (word8ToChar w) describe "toTitle" $ do prop "behaves like model" $ prop_toTitle prop_toUpper :: Word8 -> Bool prop_toUpper w | w == _mu = True | w == _ydieresis = True | otherwise = word8ToChar (toUpper w) == C.toUpper (word8ToChar w) prop_toTitle :: Word8 -> Bool prop_toTitle w | w == _mu = True | w == _ydieresis = True | otherwise = word8ToChar (toTitle w) == C.toTitle (word8ToChar w) ---------------------------------------------------------------- word8ToChar :: Word8 -> Char word8ToChar = C.chr . fromIntegral