Data.Vector.Fusion.Bundle.Size

vector-0.11.0.0: Efficient Arrays

Copyright | (c) Roman Leshchinskiy 2008-2010
License | BSD-style
Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au>
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Data.Vector.Fusion.Bundle.Size

Description

Size hints for streams.

Synopsis

- data Size
  - = Exact Int
  - | Max Int
  - | Unknown
- clampedSubtract :: Size -> Size -> Size
- smaller :: Size -> Size -> Size
- larger :: Size -> Size -> Size
- toMax :: Size -> Size
- upperBound :: Size -> Maybe Int
- lowerBound :: Size -> Int

# Documentation

data Size

Size hint

Constructors

Exact Int | Exact size
Max Int | Upper bound on the size
Unknown | Unknown size

Instances

Eq Size |
Num Size |
Show Size |

clampedSubtract :: Size -> Size -> Size

Subtract two sizes with clamping to 0, for drop-like things

smaller :: Size -> Size -> Size

Minimum of two size hints

larger :: Size -> Size -> Size

Maximum of two size hints

toMax :: Size -> Size

Convert a size hint to an upper bound

upperBound :: Size -> Maybe Int

Compute the maximum size from a size hint if possible

lowerBound :: Size -> Int

Compute the minimum size from a size hint