HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulerio-0.1.25.0Haskell2010

RIO.Vector.Storable

Storable Vector. Import as:

import qualified RIO.Vector.Storable as VS

This module does not export any partial or unsafe functions. For those, see RIO.Vector.Storable.Partial and RIO.Vector.Storable.Unsafe

Contents
  1. Storable vectors
  2. Accessors
  3. Length information
  4. Indexing
  5. Extracting subvectors
  6. Construction
  7. Initialisation
  8. Monadic initialisation
  9. Unfolding
  10. Enumeration
  11. Concatenation
  12. Restricting memory usage
  13. Modifying vectors
  14. Permutations
  15. Safe destructive update
  16. Elementwise operations
  17. Mapping
  18. Monadic mapping
  19. Zipping
  20. Monadic zipping
  21. Working with predicates
  22. Filtering
  23. Partitioning
  24. Searching
  25. Folding
  26. Specialised folds
  27. Monadic folds
  28. Prefix sums (scans)
  29. Conversions
  30. Lists
  31. Different vector types
  32. Mutable vectors
Synopsis
  • Packagerio-0.1.25.0
  • Exports112
  • LanguageHaskell2010
  • LicenceMIT
  • SourceStorable.hs

Storable vectors

datadata Vector a
#
Instances13NFData1, Vector, IsList, Eq, Data, Ord, …
classclass Storable a where

The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

Memory addresses are represented as values of type Ptr a, for some a which is an instance of class Storable. The type argument to Ptr helps provide some valuable type safety in FFI code (you can't mix pointers of different types without an explicit cast), while helping the Haskell type system figure out which marshalling method is needed for a given pointer.

All marshalling between Haskell and a foreign language ultimately boils down to translating Haskell data structures into the binary representation of a corresponding data structure of the foreign language and vice versa. To code this marshalling in Haskell, it is necessary to manipulate primitive data types stored in unstructured memory blocks. The class Storable facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size Int types (Int8, Int16, Int32, Int64), the fixed size Word types (Word8, Word16, Word32, Word64), StablePtr, all types from Foreign.C.Types, as well as Ptr.

Instances90Storable, …
  • Storable CTimeSpecDefined in directory-1.3.11.0 · System.Directory.Internal.C_utimensat
  • Storable EventDefined in ghc-internal-10.0.0 · GHC.Internal.Event.EPoll
  • Storable EventDefined in ghc-internal-10.0.0 · GHC.Internal.Event.Poll
  • Storable PollFdDefined in ghc-internal-10.0.0 · GHC.Internal.Event.Poll
  • Storable FingerprintDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable CBoolDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CCharDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CClockDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CDoubleDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CFloatDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CIntDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CIntMaxDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CIntPtrDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CLLongDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CLongDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CPtrdiffDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CSCharDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CSUSecondsDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CShortDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CSigAtomicDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CSizeDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CTimeDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CUCharDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntMaxDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntPtrDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CULLongDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CULongDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CUSecondsDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CUShortDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable CWcharDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.C.Types
  • Storable IntPtrDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Ptr
  • Storable WordPtrDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Ptr
  • Storable HalfWordDefined in ghc-internal-10.0.0 · GHC.Internal.Heap.InfoTable.Types
  • Storable FLockDefined in ghc-internal-10.0.0 · GHC.Internal.IO.Handle.Lock.LinuxOFD
  • Storable Int16Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Int32Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Int64Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Int8Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable CBlkCntDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CBlkSizeDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CCcDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CClockIdDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CDevDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CFsBlkCntDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CFsFilCntDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CGidDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CIdDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CInoDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CKeyDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CModeDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CNfdsDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CNlinkDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable COffDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CPidDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CRLimDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CSocklenDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CSpeedDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CSsizeDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CTcflagDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CTimerDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable CUidDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable FdDefined in ghc-internal-10.0.0 · GHC.Internal.System.Posix.Types
  • Storable BoolDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable CharDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable DoubleDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable FloatDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable IntDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable WordDefined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Word16Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Word32Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Word64Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable Word8Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable CTimespecDefined in time-1.16.0.1 · Data.Time.Clock.Internal.CTimespec
  • Storable CTimevalDefined in time-1.16.0.1 · Data.Time.Clock.Internal.CTimeval
  • Storable DirEntDefined in unix-2.8.8.0 · System.Posix.Directory.Common
  • Storable CAttributesDefined in unix-2.8.8.0 · System.Posix.Files.Common
  • Storable CTimeSpecDefined in unix-2.8.8.0 · System.Posix.Files.Common
  • Storable CTimeValDefined in unix-2.8.8.0 · System.Posix.Files.Common
  • Storable ()Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable (ConstPtr a)Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable (FunPtr a)Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable (Ptr a)Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable (StablePtr a)Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable a => Storable (Complex a)Defined in base-4.23.0.0 · Data.Complex
  • Storable a => Storable (Identity a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Functor.Identity
  • Storable a => Storable (Down a)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Ord
  • Prim a => Storable (PrimStorable a)Defined in primitive-0.9.1.0 · Data.Primitive.Types
  • (Storable a, Integral a) => Storable (Ratio a)Defined in ghc-internal-10.0.0 · GHC.Internal.Foreign.Storable
  • Storable a => Storable (Const a b)Defined in ghc-internal-10.0.0 · GHC.Internal.Data.Functor.Const

Accessors

Length information

Indexing

Extracting subvectors

Construction

Initialisation

Monadic initialisation

Unfolding

Enumeration

Concatenation

Restricting memory usage

Modifying vectors

Permutations

Safe destructive update

Elementwise operations

Mapping

Monadic mapping

Zipping

Monadic zipping

Working with predicates

Filtering

Partitioning

Searching

Folding

Specialised folds

Monadic folds

Prefix sums (scans)

Conversions

Lists

Different vector types

Mutable vectors