Data.Text.Internal.Fusion.Size

text-1.2.3.1: An efficient packed Unicode text type.

Copyright | (c) Roman Leshchinskiy 2008 (c) Bryan O'Sullivan 2009
License | BSD-style
Maintainer | bos@serpentine.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell98

Data.Text.Internal.Fusion.Size

Contents

- Sizes
- Querying sizes

Description

Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!

Size hints.

Synopsis

- data Size
- exactSize :: Int -> Size
- maxSize :: Int -> Size
- betweenSize :: Int -> Int -> Size
- unknownSize :: Size
- unionSize :: Size -> Size -> Size
- charSize :: Char -> Size
- codePointsSize :: Int -> Size
- exactly :: Size -> Maybe Int
- smaller :: Size -> Size -> Size
- larger :: Size -> Size -> Size
- upperBound :: Int -> Size -> Int
- lowerBound :: Int -> Size -> Int
- compareSize :: Size -> Size -> Maybe Ordering
- isEmpty :: Size -> Bool

# Documentation

data Size #

A size in UTF-16 code units.

Instances

Eq Size # |
Instance details Defined in Data.Text.Internal.Fusion.Size Methods (==) :: Size -> Size -> Bool Source # (/=) :: Size -> Size -> Bool Source #
Num Size # |
Instance details Defined in Data.Text.Internal.Fusion.Size Methods (+) :: Size -> Size -> Size Source # (-) :: Size -> Size -> Size Source # (*) :: Size -> Size -> Size Source # negate :: Size -> Size Source # abs :: Size -> Size Source # signum :: Size -> Size Source # fromInteger :: Integer -> Size Source #
Show Size # |
Instance details Defined in Data.Text.Internal.Fusion.Size Methods showsPrec :: Int -> Size -> ShowS Source # show :: Size -> String Source # showList :: [Size] -> ShowS Source #

# Sizes

exactSize :: Int -> Size #

maxSize :: Int -> Size #

betweenSize :: Int -> Int -> Size #

unknownSize :: Size #

unionSize :: Size -> Size -> Size #

charSize :: Char -> Size #

The `Size` of the given code point.

codePointsSize :: Int -> Size #

The `Size` of `n` code points.

# Querying sizes

exactly :: Size -> Maybe Int #

smaller :: Size -> Size -> Size #

Minimum of two size hints.

larger :: Size -> Size -> Size #

Maximum of two size hints.

upperBound :: Int -> Size -> Int #

Compute the maximum size from a size hint, if possible.

lowerBound :: Int -> Size -> Int #

Compute the maximum size from a size hint, if possible.

compareSize :: Size -> Size -> Maybe Ordering #

Determine the ordering relationship between two `Size`s, or `Nothing` in the indeterminate case.

isEmpty :: Size -> Bool #