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

Modulelinear-base-0.4.0Haskell2010

Foreign.Marshal.Pure.Internal

  • 4 types
  • 3 classes
  • 12 values
datadata Dict (a :: Constraint) where
#

Constructors

  • Dict :: a => Dict a
classclass KnownRepresentable a where
#

This abstract type class represents values natively known to have a GC-less implementation. Basically, these are sequences (represented as tuples) of base types.

Methods

Instances9KnownRepresentable, …
valuestripMaybe :: Maybe a -> a
#
valuestripPtr :: Ptr a -> a
#
classclass KnownRepresentable (AsKnown a) => Representable a where
#

Laws of Representable:

  • toKnown must be total

  • ofKnown may be partial, but must be total on the image of toKnown

  • ofKnown . toKnown == id

Associated types

Methods

Instances8Representable, …
classclass Representable b => MkRepresentable a b | a -> b where
#

This is an easier way to create an instance of Representable. It is a bit abusive to use a type class for this (after all, it almost never makes sense to use this as a constraint). But it works in practice.

To use, define an instance of MkRepresentable myType intermediateType then declare the following instance:

instance Representable myType where {type AsKnown = AsKnown intermediateType}

And the default instance mechanism will create the appropriate Representable instance.

Laws of MkRepresentable:

  • toRepr must be total

  • ofRepr may be partial, but must be total on the image of toRepr

  • ofRepr . toRepr = id

Methods

datadata Pool where
#

Pools represent collections of values. A Pool can be consume-ed. This is a no-op: it does not deallocate the data in that pool. It cannot do so, because accessible values might still exist. Consuming a pool simply makes it impossible to add new data to the pool.

Constructors

Instances2Consumable, Dupable
  • Consumable PoolDefined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
  • Dupable PoolDefined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
datadata DLL a
#

Constructors

  • DLL
    • prev :: Ptr (DLL a)
    • elt :: Ptr a
    • next :: Ptr (DLL a)
Instances2Eq, Storable
  • Eq (DLL a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
  • Storable (DLL a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
valueinsertAfter :: Storable a => DLL a -> a -> IO (Ptr (DLL a))
#
valuedelete :: DLL a -> IO ()
#
valuefreeAll :: DLL (Ptr ()) -> DLL (Ptr ()) -> IO ()
#
valuewithPool :: (Pool %1 -> Ur b) %1 -> Ur b
#

Given a linear computation that manages memory, run that computation.

datadata Box a where
#

'Box a' is the abstract type of manually managed data. It can be used as part of data type definitions in order to store linked data structure off heap. See Foreign.List and Foreign.Pair in the examples directory of the source repository.

Constructors

Instances4Storable, KnownRepresentable, Representable, AsKnown
  • Storable (Box a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
  • KnownRepresentable (Box a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
  • Representable (Box a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
  • type AsKnown (Box a) = Box aDefined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal

Orphan instances

2 instances