HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulebasement-0.0.16Haskell2010

Basement.Types.OffsetSize

Synopsis
  • Packagebasement-0.0.16
  • Exports30
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceOffsetSize.hs
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, …
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, …