hw-prim-0.6.3.2: Primitive functions and data types

Safe Haskell | None
Language | Haskell2010

HaskellWorks.Data.AtIndex

Synopsis

- class Container a where
  - type Elem a
- class Length v => AtIndex v where
  - (!!!) :: v -> Position -> Elem v
  - atIndex :: v -> Position -> Elem v
- class Container v => Length v where
  - length :: v -> Count
  - end :: v -> Position
- atIndexOr :: AtIndex v => Elem v -> v -> Position -> Elem v
- atIndexOrBeforeOrAfter :: AtIndex v => Elem v -> Elem v -> v -> Position -> Elem v
- atIndexOrBeforeOrLast :: (AtIndex v, Length v) => Elem v -> v -> Position -> Elem v

# Documentation

class Container a #

Associated Types

type Elem a #

#### Instances

Instances details

Container ByteString # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem ByteString |
Instance details Defined in HaskellWorks.Data.Container type Elem ByteString = Word8
Container (Vector Int16) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int16) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int16) = Int16
Container (Vector Int32) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int32) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int32) = Int32
Container (Vector Int64) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int64) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int64) = Int64
Container (Vector Int8) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int8) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int8) = Int8
Container (Vector Word16) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word16) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word16) = Word16
Container (Vector Word32) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word32) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word32) = Word32
Container (Vector Word64) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word64) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word64) = Word64
Container (Vector Word8) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word8) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word8) = Word8
Container (Vector Int16) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int16) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int16) = Int16
Container (Vector Int32) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int32) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int32) = Int32
Container (Vector Int64) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int64) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int64) = Int64
Container (Vector Int8) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int8) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int8) = Int8
Container (Vector Word16) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word16) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word16) = Word16
Container (Vector Word32) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word32) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word32) = Word32
Container (Vector Word64) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word64) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word64) = Word64
Container (Vector Word8) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Word8) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Word8) = Word8
Container (Vector Int) # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem (Vector Int) |
Instance details Defined in HaskellWorks.Data.Container type Elem (Vector Int) = Int
Container [a] # |
Instance details Defined in HaskellWorks.Data.Container Associated Types
type Elem [a] |
Instance details Defined in HaskellWorks.Data.Container type Elem [a] = a

class Length v => AtIndex v where #

Methods

(!!!) :: v -> Position -> Elem v #

atIndex :: v -> Position -> Elem v #

#### Instances

Instances details

AtIndex ByteString # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: ByteString -> Position -> Elem ByteString # atIndex :: ByteString -> Position -> Elem ByteString #
AtIndex (Vector Int16) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int16 -> Position -> Elem (Vector Int16) # atIndex :: Vector Int16 -> Position -> Elem (Vector Int16) #
AtIndex (Vector Int32) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int32 -> Position -> Elem (Vector Int32) # atIndex :: Vector Int32 -> Position -> Elem (Vector Int32) #
AtIndex (Vector Int64) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int64 -> Position -> Elem (Vector Int64) # atIndex :: Vector Int64 -> Position -> Elem (Vector Int64) #
AtIndex (Vector Int8) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int8 -> Position -> Elem (Vector Int8) # atIndex :: Vector Int8 -> Position -> Elem (Vector Int8) #
AtIndex (Vector Word16) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word16 -> Position -> Elem (Vector Word16) # atIndex :: Vector Word16 -> Position -> Elem (Vector Word16) #
AtIndex (Vector Word32) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word32 -> Position -> Elem (Vector Word32) # atIndex :: Vector Word32 -> Position -> Elem (Vector Word32) #
AtIndex (Vector Word64) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word64 -> Position -> Elem (Vector Word64) # atIndex :: Vector Word64 -> Position -> Elem (Vector Word64) #
AtIndex (Vector Word8) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word8 -> Position -> Elem (Vector Word8) # atIndex :: Vector Word8 -> Position -> Elem (Vector Word8) #
AtIndex (Vector Int16) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int16 -> Position -> Elem (Vector Int16) # atIndex :: Vector Int16 -> Position -> Elem (Vector Int16) #
AtIndex (Vector Int32) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int32 -> Position -> Elem (Vector Int32) # atIndex :: Vector Int32 -> Position -> Elem (Vector Int32) #
AtIndex (Vector Int64) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int64 -> Position -> Elem (Vector Int64) # atIndex :: Vector Int64 -> Position -> Elem (Vector Int64) #
AtIndex (Vector Int8) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int8 -> Position -> Elem (Vector Int8) # atIndex :: Vector Int8 -> Position -> Elem (Vector Int8) #
AtIndex (Vector Word16) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word16 -> Position -> Elem (Vector Word16) # atIndex :: Vector Word16 -> Position -> Elem (Vector Word16) #
AtIndex (Vector Word32) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word32 -> Position -> Elem (Vector Word32) # atIndex :: Vector Word32 -> Position -> Elem (Vector Word32) #
AtIndex (Vector Word64) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word64 -> Position -> Elem (Vector Word64) # atIndex :: Vector Word64 -> Position -> Elem (Vector Word64) #
AtIndex (Vector Word8) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Word8 -> Position -> Elem (Vector Word8) # atIndex :: Vector Word8 -> Position -> Elem (Vector Word8) #
AtIndex (Vector Int) # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: Vector Int -> Position -> Elem (Vector Int) # atIndex :: Vector Int -> Position -> Elem (Vector Int) #
AtIndex [a] # |
Instance details Defined in HaskellWorks.Data.AtIndex Methods (!!!) :: [a] -> Position -> Elem [a] # atIndex :: [a] -> Position -> Elem [a] #

class Container v => Length v where #

Minimal complete definition

length

Methods

length :: v -> Count #

end :: v -> Position #

#### Instances

Instances details

Length ByteString # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: ByteString -> Count # end :: ByteString -> Position #
Length (Vector Int16) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int16 -> Count # end :: Vector Int16 -> Position #
Length (Vector Int32) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int32 -> Count # end :: Vector Int32 -> Position #
Length (Vector Int64) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int64 -> Count # end :: Vector Int64 -> Position #
Length (Vector Int8) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int8 -> Count # end :: Vector Int8 -> Position #
Length (Vector Word16) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word16 -> Count # end :: Vector Word16 -> Position #
Length (Vector Word32) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word32 -> Count # end :: Vector Word32 -> Position #
Length (Vector Word64) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word64 -> Count # end :: Vector Word64 -> Position #
Length (Vector Word8) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word8 -> Count # end :: Vector Word8 -> Position #
Length (Vector Int16) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int16 -> Count # end :: Vector Int16 -> Position #
Length (Vector Int32) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int32 -> Count # end :: Vector Int32 -> Position #
Length (Vector Int64) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int64 -> Count # end :: Vector Int64 -> Position #
Length (Vector Int8) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int8 -> Count # end :: Vector Int8 -> Position #
Length (Vector Word16) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word16 -> Count # end :: Vector Word16 -> Position #
Length (Vector Word32) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word32 -> Count # end :: Vector Word32 -> Position #
Length (Vector Word64) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word64 -> Count # end :: Vector Word64 -> Position #
Length (Vector Word8) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Word8 -> Count # end :: Vector Word8 -> Position #
Length (Vector Int) # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: Vector Int -> Count # end :: Vector Int -> Position #
Length [a] # |
Instance details Defined in HaskellWorks.Data.Length Methods length :: [a] -> Count # end :: [a] -> Position #

atIndexOr :: AtIndex v => Elem v -> v -> Position -> Elem v #

Get the element of the container at the specified position, but return `d` if position is out of bounds.

atIndexOrBeforeOrAfter :: AtIndex v => Elem v -> Elem v -> v -> Position -> Elem v #

Get the element of the container at the specified position, but return `before` if position before the first element or `after` if the position is beyond the last element.

atIndexOrBeforeOrLast :: (AtIndex v, Length v) => Elem v -> v -> Position -> Elem v #

Get the element of the container at the specified position, but return the last element if the position is past the end of the container or the default value `before'` if the position is before the beginning of the vector. In the case when the container is empty, then the default value `before'` is used.