HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulestrict-list-1.0.0.1Haskell2010

StrictList

Definitions of strict linked list.

Most basic operations like fmap, filter, <*> are implemented efficiently by producing an intermediate list in reversed order and then reversing it to the original order to avoid stack recursion. These intermediate reversed functions are exposed by the API, because they very well may be useful for efficient implementations of data-structures built on top of list. E.g., the "deque" package exploits them heavily.

One useful rule of thumb would be that whenever you see that a function has a reversed counterpart, that counterpart is faster and hence if you don't care about the order or intend to reverse the list further down the line, you should give preference to that counterpart.

  • 1 type
  • 36 values

Strict list type

1 declaration
datadata StrictList a
#

Strict linked list.

Constructors

Instances29Monad, Functor, Applicative, Foldable, Traversable, Alternative, …

Conversions

4 declarations

Basic transformations

16 declarations

Queries

7 declarations
valuematch
  1. :: result
  2. -> element -> StrictList element -> result
  3. -> StrictList element
  4. -> result
#

Pattern match on list using functions.

Allows to achieve all the same as uncons only without intermediate Maybe.

Essentially provides the same functionality as either for Either and maybe for Maybe.

Zipping and application

2 declarations

Reversed-order helpers

7 declarations