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

Modulelens-5.3.5Haskell2010

Control.Lens.Internal.List

This module provides utility functions on lists used by the library implementation.

  • 2 values
  • Packagelens-5.3.5
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceList.hs
valueordinalNub
  1. :: Int

    strict upper bound

  2. -> [Int]

    ordinals

  3. -> [Int]

    unique, in-bound ordinals, in order seen

#

Return the the subset of given ordinals within a given bound and in order of the first occurrence seen.

Bound: 0 <= x < l

Example1 expression
ordinalNub 3 [-1,2,1,4,2,3][2,1]
valuestripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
#

\mathcal{O}(\min(m,n)). The stripSuffix function drops the given suffix from a list. It returns Nothing if the list did not end with the suffix given, or Just the list after the suffix, if it does.

Example1 expression
stripSuffix "bar" "foobar"Just "foo"
Example1 expression
stripSuffix "foo" "foo"Just ""
Example1 expression
stripSuffix "bar" "barfoo"Nothing
Example1 expression
stripSuffix "foo" "barfoobaz"Nothing