| adultinternetusers > References > Haskell reference |
| Intro / Search / adultinternetusers |
| | Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | >> Char << | Monad | IO | Directory | System | Time | Locale | CPUTime | Random |
This library provides a limited set of operations on the Unicode character set. The first 128 entries of this character set are identical to the ASCII set; with the next 128 entries comes the remainder of the Latin-1 character set. This module offers only a limited view of the full Unicode character set; the full set of Unicode character attributes is not accessible in this library.
Unicode characters may be divided into five general categories: non-printing, lower case alphabetic, other alphabetic, numeric digits, and other printable characters. For the purposes of Haskell, any alphabetic character which is not lower case is treated as upper case (Unicode actually has three cases: upper, lower, and title). Numeric digits may be part of identifiers but digits outside the ASCII range are not used by the reader to represent numbers.
For each sort of Unicode character, here are the predicates which return True: Character Type Predicates Lower Case Alphabetic isPrint isAlphaNum isAlpha isLower Other Alphabetic isPrint isAlphaNum isAlpha isUpper Digits isPrint isAlphaNum Other Printable isPrint Non-printing
The isDigit, isOctDigit, and isHexDigit functions select only ASCII characters. intToDigit and digitToInt convert between a single digit Char and the corresponding Int. digitToInt operates fails unless its argument satisfies isHexDigit, but recognises both upper and lower-case hexadecimal digits (i.e. '0'..'9', 'a'..'f', 'A'..'F'). intToDigit fails unless its argument is in the range 0..15, and generates lower-case hexadecmial digits.
The isSpace function recognizes only white characters in the Latin-1 range.
The function showLitChar converts a character to a string using only printable characters, using Haskell source-language escape conventions. The function readLitChar does the reverse.
Function toUpper converts a letter to the corresponding upper-case letter, leaving any other character unchanged. Any Unicode letter which has an upper-case equivalent is transformed. Similarly, toLower converts a letter to the corresponding lower-case letter, leaving any other character unchanged.
The ord and chr functions are fromEnum and toEnum restricted to the type Char.
module Char (
isAscii, isLatin1, isControl, isPrint, isSpace, isUpper, isLower,
isAlpha, isDigit, isOctDigit, isHexDigit, isAlphaNum,
digitToInt, intToDigit,
toUpper, toLower,
ord, chr,
readLitChar, showLitChar, lexLitChar,
-- ...and what the Prelude exports
Char, String
) where
import Array -- used for character name table.
import Numeric (readDec, readOct, lexDigits, readHex)
import UnicodePrims -- source of primitive Unicode functions.
-- Character-testing operations
isAscii, isControl, isPrint, isSpace, isUpper, isLower,
isAlpha, isDigit, isOctDigit, isHexDigit, isAlphaNum :: Char -> Bool
isAscii c = c < '\x80'
isLatin1 c = c <= '\xff'
isControl c = c < ' ' || c >= '\DEL' && c <= '\x9f'
isPrint = primUnicodeIsPrint
isSpace c = c `elem` " \t\n\r\f\v\xA0"
-- Only Latin-1 spaces recognized
isUpper = primUnicodeIsUpper -- 'A'..'Z'
isLower = primUnicodeIsLower -- 'a'..'z'
isAlpha c = isUpper c || isLower c
isDigit c = c >= '0' && c <= '9'
isOctDigit c = c >= '0' && c <= '7'
isHexDigit c = isDigit c || c >= 'A' && c <= 'F' ||
c >= 'a' && c <= 'f'
isAlphaNum = primUnicodeIsAlphaNum
-- Digit conversion operations
digitToInt :: Char -> Int
digitToInt c
| isDigit c = fromEnum c - fromEnum '0'
| c >= 'a' && c <= 'f' = fromEnum c - fromEnum 'a' + 10
| c >= 'A' && c <= 'F' = fromEnum c - fromEnum 'A' + 10
| otherwise = error "Char.digitToInt: not a digit"
intToDigit :: Int -> Char
intToDigit i
| i >= 0 && i <= 9 = toEnum (fromEnum '0' + i)
| i >= 10 && i <= 15 = toEnum (fromEnum 'a' + i - 10)
| otherwise = error "Char.intToDigit: not a digit"
-- Case-changing operations
toUpper :: Char -> Char
toUpper = primUnicodeToUpper
toLower :: Char -> Char
toLower = primUnicodeToLower
-- Character code functions
ord :: Char -> Int
ord = fromEnum
chr :: Int -> Char
chr = toEnum
-- Text functions
readLitChar :: ReadS Char
readLitChar ('\\':s) = readEsc s
where
readEsc ('a':s) = [('\a',s)]
readEsc ('b':s) = [('\b',s)]
readEsc ('f':s) = [('\f',s)]
readEsc ('n':s) = [('\n',s)]
readEsc ('r':s) = [('\r',s)]
readEsc ('t':s) = [('\t',s)]
readEsc ('v':s) = [('\v',s)]
readEsc ('\\':s) = [('\\',s)]
readEsc ('"':s) = [('"',s)]
readEsc ('\'':s) = [('\'',s)]
readEsc ('^':c:s) | c >= '@' && c <= '_'
= [(chr (ord c - ord '@'), s)]
readEsc s@(d:_) | isDigit d
= [(chr n, t) | (n,t) <- readDec s]
readEsc ('o':s) = [(chr n, t) | (n,t) <- readOct s]
readEsc ('x':s) = [(chr n, t) | (n,t) <- readHex s]
readEsc s@(c:_) | isUpper c
= let table = ('\DEL', "DEL") : assocs asciiTab
in case [(c,s') | (c, mne) <- table,
([],s') <- [match mne s]]
of (pr:_) -> [pr]
[] -> []
readEsc _ = []
match :: (Eq a) => [a] -> [a] -> ([a],[a])
match (x:xs) (y:ys) | x == y = match xs ys
match xs ys = (xs,ys)
readLitChar (c:s) = [(c,s)]
showLitChar :: Char -> ShowS
showLitChar c | c > '\DEL' = showChar '\\' .
protectEsc isDigit (shows (ord c))
showLitChar '\DEL' = showString "\\DEL"
showLitChar '\\' = showString "\\\\"
showLitChar c | c >= ' ' = showChar c
showLitChar '\a' = showString "\\a"
showLitChar '\b' = showString "\\b"
showLitChar '\f' = showString "\\f"
showLitChar '\n' = showString "\\n"
showLitChar '\r' = showString "\\r"
showLitChar '\t' = showString "\\t"
showLitChar '\v' = showString "\\v"
showLitChar '\SO' = protectEsc (== 'H') (showString "\\SO")
showLitChar c = showString ('\\' : asciiTab!c)
protectEsc p f = f . cont
where cont s@(c:_) | p c = "\\&" ++ s
cont s = s
asciiTab = listArray ('\NUL', ' ')
["NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI",
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US",
"SP"]
lexLitChar :: ReadS String
lexLitChar ('\\':s) = [('\\':esc, t) | (esc,t) <- lexEsc s]
where
lexEsc (c:s) | c `elem` "abfnrtv\\\"'" = [([c],s)]
lexEsc s@(d:_) | isDigit d = lexDigits s
lexEsc ('^':c:s) | c >= '@' && c <= '_' = [(['^',c],s)]
-- Very crude approximation to \XYZ. Let readers work this out.
lexEsc s@(c:_) | isUpper c = [span isCharName s]
lexEsc _ = []
isCharName c = isUpper c || isDigit c
lexLitChar (c:s) = [([c],s)]
lexLitChar "" = []
Partner sites:
Work Bench Floor Mats Wire Shelving Storage Lockers Workbenches
Quiksilver Board Shorts
Roxy Board Shorts
Volcom Board Shorts
Billabong Board Shorts
Quicksilver Board Shorts
Hurley Board Shorts
Quicksilveredition Board Shorts
Rusty Board Shorts
Reef Board Shorts
oneilll Board Shorts
Ezekiel surf clothing Board Shorts
Paul Frank surf clothing Board Shorts
Mada surf clothing Board Shorts
Analog surf clothing Board Shorts
Quicksilver surf clothing Board Shorts
Jet Pilot surf clothing Board Shorts
Quicksilveredition surf clothing Board Shorts
Dakine surf clothing Board Shorts
Matix surf clothing Board Shorts
Reef surf clothing Board Shorts
O'neill surf clothing Board Shorts
Also, you will want to check out Stanton California so you can see what's up and they are part of Stanton City Hall as well.
You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps
Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here: quiksilver tees http://www.killerdana.com/killerdana/search2.asp?SearchResults.SearchHandle=QT1NZW5zIFNTIFRlZXN_Qj1NZW5zIFNTIFRlZXN_RD01OX5FPTBeMV4yXm51bV9uZXd_ST1QcmljZX5LPTR_TD0xfk09NH5OPTN_&SearchResults.SortAscending=False&SearchResults.SortBy=num_new&Answer=766
quiksilver shirt Quiksilver Shirt
quiksilver board short quiksilver board short
quiksilver clothing Quiksilver clothing
quiksilver apparel Quiksilver apparel
quiksilver jackets quiksilver jacket
quiksilver jeans Quiksilver Shirt
quiksilver shoes Quiksilver Shoes
quiksilver sweaters Quiksilver Sweaters
quiksilver tank Quiksilver Tanks
quiksilver tees Quiksilver Tops
quiksilver wetsuits Quiksilver Wetsuits
Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter
This is the guy we need in government office. His name is Kevin Carr City Of Stanton Council Candidate and he is a great guy. and we can get surf t shirts surfing shirt and Swim Shop for swim wear wimming gear women's and men's And you must check out this website swim suit swimming suit and swim trunks
If you may be in the market for
French Lavender Soaps or
Thyme Body Care,
or even Shea Body Butters, ShopErba has the finest products available
Work Bench Floor Mats Wire Shelving Storage Lockers Workbenches
Quiksilver Board Shorts
Roxy Board Shorts
Volcom Board Shorts
Billabong Board Shorts
Quicksilver Board Shorts
Hurley Board Shorts
Quicksilveredition Board Shorts
Rusty Board Shorts
Reef Board Shorts
oneilll Board Shorts
Ezekiel surf clothing Board Shorts
Paul Frank surf clothing Board Shorts
Mada surf clothing Board Shorts
Analog surf clothing Board Shorts
Quicksilver surf clothing Board Shorts
Jet Pilot surf clothing Board Shorts
Quicksilveredition surf clothing Board Shorts
Dakine surf clothing Board Shorts
Matix surf clothing Board Shorts
Reef surf clothing Board Shorts
O'neill surf clothing Board Shorts
Also, you will want to check out Stanton California so you can see what's up and they are part of Stanton City Hall as well.
You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps
Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here: quiksilver tees http://www.killerdana.com/killerdana/search2.asp?SearchResults.SearchHandle=QT1NZW5zIFNTIFRlZXN_Qj1NZW5zIFNTIFRlZXN_RD01OX5FPTBeMV4yXm51bV9uZXd_ST1QcmljZX5LPTR_TD0xfk09NH5OPTN_&SearchResults.SortAscending=False&SearchResults.SortBy=num_new&Answer=766
quiksilver shirt Quiksilver Shirt
quiksilver board short quiksilver board short
quiksilver clothing Quiksilver clothing
quiksilver apparel Quiksilver apparel
quiksilver jackets quiksilver jacket
quiksilver jeans Quiksilver Shirt
quiksilver shoes Quiksilver Shoes
quiksilver sweaters Quiksilver Sweaters
quiksilver tank Quiksilver Tanks
quiksilver tees Quiksilver Tops
quiksilver wetsuits Quiksilver Wetsuits
Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter
This is the website that has all the latest Lost Clothing for surf, skate and snow. You can also see it here: Lost Surf Clothing. You'll be glad you saw the surf apparel.
This is the website that has all the latest Lost Clothing for surf, skate and snow. You can also see it here: Lost Surf Clothing. You'll be glad you saw the surf apparel.