1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
{-# LANGUAGE CPP, NoImplicitPrelude #-}
-- |
-- Module : Data.Text.ICU
-- Copyright : (c) 2010 Bryan O'Sullivan
--
-- License : BSD-style
-- Maintainer : bos@serpentine.com
-- Stability : experimental
-- Portability : GHC
--
-- Commonly used functions for Unicode, implemented as bindings to the
-- International Components for Unicode (ICU) libraries.
--
-- This module contains only the most commonly used types and
-- functions. Other modules in this package expose richer interfaces.
module Data.Text.ICU
(
-- * Data representation
-- $data
-- * Types
LocaleName(..)
-- * Boundary analysis
-- $break
, Breaker
, Break
, brkPrefix
, brkBreak
, brkSuffix
, brkStatus
, Line(..)
, Word(..)
, breakCharacter
, breakLine
, breakSentence
, breakWord
, breaks
, breaksRight
-- * Case mapping
, toCaseFold
, toLower
, toUpper
-- * Iteration
, CharIterator
, fromString
, fromText
, fromUtf8
-- * Normalization
, NormalizationMode(..)
, normalize
, quickCheck
, isNormalized
-- * String comparison
-- ** Normalization-sensitive string comparison
, CompareOption(..)
, compare
-- ** Locale-sensitive string collation
-- $collate
, Collator
, collator
, collatorWith
, collate
, collateIter
, sortKey
, uca
-- * Regular expressions
, MatchOption(..)
, ParseError(errError, errLine, errOffset)
, Match
, Regex
, Regular
-- ** Construction
, regex
, regex'
-- ** Inspection
, pattern
-- ** Searching
, find
, findAll
-- ** Match groups
-- $group
, groupCount
, unfold
, span
, group
, prefix
, suffix
) where
import Data.Text.ICU.Break.Pure
import Data.Text.ICU.Collate.Pure
import Data.Text.ICU.Internal
import Data.Text.ICU.Iterator
import Data.Text.ICU.Normalize
import Data.Text.ICU.Regex.Pure
import Data.Text.ICU.Text
#if defined(__HADDOCK__)
import Data.Text.Foreign
import Data.Text (Text)
#endif
-- $data
--
-- The Haskell 'Text' type is implemented as an array in the Haskell
-- heap. This means that its location is not pinned; it may be copied
-- during a garbage collection pass. ICU, on the other hand, works
-- with strings that are allocated in the normal system heap and have
-- a fixed address.
--
-- To accommodate this need, these bindings use the functions from
-- 'Data.Text.Foreign' to copy data between the Haskell heap and the
-- system heap. The copied strings are still managed automatically,
-- but the need to duplicate data does add some performance and memory
-- overhead.
-- $break
--
-- Text boundary analysis is the process of locating linguistic
-- boundaries while formatting and handling text. Examples of this
-- process include:
--
-- * Locating appropriate points to word-wrap text to fit within
-- specific margins while displaying or printing.
--
-- * Counting characters, words, sentences, or paragraphs.
--
-- * Making a list of the unique words in a document.
--
-- * Figuring out if a given range of text contains only whole words.
--
-- * Capitalizing the first letter of each word.
--
-- * Locating a particular unit of the text (For example, finding the
-- third word in the document).
--
-- The 'Breaker' type was designed to support these kinds of
-- tasks.
--
-- For the impure boundary analysis API (which is richer, but less
-- easy to use than the pure API), see the "Data.Text.ICU.Break"
-- module. The impure API supports some uses that may be less
-- efficient via the pure API, including:
--
-- * Locating the beginning of a word that the user has selected.
--
-- * Determining how far to move the text cursor when the user hits an
-- arrow key (Some characters require more than one position in the
-- text store and some characters in the text store do not display
-- at all).
-- $collate
--
-- For the impure collation API (which is richer, but less easy to
-- use than the pure API), see the "Data.Text.ICU.Collate"
-- module.
-- $group
--
-- Capturing groups are numbered starting from zero. Group zero is
-- always the entire matching text. Groups greater than zero contain
-- the text matching each capturing group in a regular expression.
|