HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulererebase-1.21.2Haskell2010

Data.Vector.Storable

  • 2 types
  • 1 class
  • 201 values
  • Packagererebase-1.21.2
  • Exports204
  • LanguageHaskell2010
  • LicenceMIT
  • SourceStorable.hs
datadata Vector a
#
Instances14NFData1, 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.

Instances92Storable, …
  • Storable EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.EPoll
  • Storable EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Poll
  • Storable PollFdDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Poll
  • Storable FingerprintDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable CBoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CClockDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CLLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CPtrdiffDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CSCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CSUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CSigAtomicDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CTimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUCharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntMaxDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUIntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CULLongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CULongDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUSecondsDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CUShortDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable CWcharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.C.Types
  • Storable IntPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Ptr
  • Storable WordPtrDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Ptr
  • Storable FLockDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Handle.Lock.LinuxOFD
  • Storable Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable IoSubSystemDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Storable CBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CBlkSizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CCcDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CClockIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CDevDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CFsBlkCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CFsFilCntDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CGidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CIdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CInoDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CModeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CNfdsDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CNlinkDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable COffDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CPidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CRLimDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CSocklenDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CSpeedDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CSsizeDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CTcflagDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CTimerDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable CUidDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable FdDefined in ghc-internal-9.1003.0 · GHC.Internal.System.Posix.Types
  • Storable Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable CharDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable IntDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable WordDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable CTimespecDefined in time-1.12.2 · Data.Time.Clock.Internal.CTimespec
  • Storable CTimevalDefined in time-1.12.2 · Data.Time.Clock.Internal.CTimeval
  • Storable UUIDDefined in uuid-types-1.0.6 · Data.UUID.Types.Internal

    This Storable instance uses the memory layout as described in RFC 4122, but in contrast to the Binary instance, the fields are stored in host byte order.

  • Storable ()Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable (ConstPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable (FunPtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable (Ptr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable (StablePtr a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable a => Storable (Complex a)Defined in base-4.20.2.0 · Data.Complex
  • Storable a => Storable (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Identity
  • Storable a => Storable (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Ord
  • Storable g => Storable (StateGen g)Defined in random-1.2.1.3 · System.Random.Internal
  • Storable g => Storable (AtomicGen g)Defined in random-1.2.1.3 · System.Random.Stateful
  • Storable g => Storable (IOGen g)Defined in random-1.2.1.3 · System.Random.Stateful
  • Storable g => Storable (STGen g)Defined in random-1.2.1.3 · System.Random.Stateful
  • Storable g => Storable (TGen g)Defined in random-1.2.1.3 · System.Random.Stateful
  • 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-9.1003.0 · GHC.Internal.Foreign.Storable
  • Storable a => Storable (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Const
  • Storable a => Storable (Tagged s a)Defined in tagged-0.8.9 · Data.Tagged