HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebasement-0.0.16Haskell2010

Basement.Types.OffsetSize

  • 6 types
  • 24 values
  • Packagebasement-0.0.16
  • Exports30
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceOffsetSize.hs
newtypenewtype FileSize
#

File size in bytes

Constructors

Instances3Eq, Ord, Show
  • Eq FileSizeDefined in basement-0.0.16 · Basement.Types.OffsetSize
  • Ord FileSizeDefined in basement-0.0.16 · Basement.Types.OffsetSize
  • Show FileSizeDefined in basement-0.0.16 · Basement.Types.OffsetSize
newtypenewtype Offset ty
#

Offset in a data structure consisting of elements of type ty.

Int is a terrible backing type which is hard to get away from, considering that GHC/Haskell are mostly using this for offset. Trying to bring some sanity by a lightweight wrapping.

Constructors

Instances15From, TryFrom, Enum, Eq, Num, Ord, …
typetype Offset8 = Offset Word8
#

Offset in bytes used for memory addressing (e.g. in a vector, string, ..)

valueoffsetSub :: Offset a -> Offset a -> Offset a
#

subtract 2 CountOf values of the same type.

m need to be greater than n, otherwise negative count error ensue use the safer (-) version if unsure.

valuesizeSub :: CountOf a -> CountOf a -> CountOf a
#

subtract 2 CountOf values of the same type.

m need to be greater than n, otherwise negative count error ensue use the safer (-) version if unsure.

newtypenewtype CountOf ty
#

CountOf of a data structure.

More specifically, it represents the number of elements of type ty that fit into the data structure.

Example1 expression
length (fromList ['a', 'b', 'c', '🌟']) :: CountOf CharCountOf 4

Same caveats as Offset apply here.

Constructors

Instances19TryFrom, Enum, Eq, Num, Ord, Show, …