HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelens-5.3.5Haskell2010

Data.IntSet.Lens

  • 3 values
  • Packagelens-5.3.5
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceLens.hs
valuemembers :: Fold IntSet Int
#

IntSet isn't Foldable, but this Fold can be used to access the members of an IntSet.

Example1 expression
sumOf members $ setOf folded [1,2,3,4]10

This Setter can be used to change the contents of an IntSet by mapping the elements to new values.

Sadly, you can't create a valid Traversal for an IntSet, because the number of elements might change but you can manipulate it by reading using folded and reindexing it via setmapped.

Example1 expression
over setmapped (+1) (IntSet.fromList [1,2,3,4])fromList [2,3,4,5]