talira

primitive

Primitive memory-related operations for Haskell

open sourceBSD-3-Clausefree

primitive is a Haskell library of low-level memory operations over GHC's primitives: boxed, small and unboxed arrays (Array, SmallArray, PrimArray), mutable and immutable byte arrays, raw pointers, mutable variables (MutVar, MVar, PrimVar) and the PrimMonad class that lets the same code run in IO or ST. Written by Roman Leshchinskiy and maintained by the Haskell Libraries Team, it supports GHC 8.2 to 9.14. BSD 3-Clause licence.

Problems it solves

  • work with unboxed arrays and raw memory in Haskell without unsafe GHC internals
  • write array code once that runs in both IO and ST in Haskell
  • a mutable byte buffer for fast binary parsing in Haskell

Features

  • boxed, small and unboxed primitive arrays
  • mutable and immutable byte arrays
  • MutVar, MVar and PrimVar mutable variables
  • PrimMonad class for code that runs in IO or ST
  • tested with GHC 8.2 to 9.14

Alternatives

The same job

These do what primitive does.

  1. vector Efficient Int-indexed arrays for Haskell, mutable and immutable, with loop fusion
  2. array Mutable and immutable arrays for Haskell

Compare primitive with the top 3