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

Moduleoptics-core-0.4.2Haskell2010

Data.IntSet.Optics

This module defines optics for constructing and manipulating finite IntSets.

  • 3 values
  • Packageoptics-core-0.4.2
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceOptics.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 type of a IntSet by mapping the elements to new values.

Sadly, you can't create a valid Traversal for an IntSet, 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]
valuesetOf :: Is k A_Fold => Optic' k is s Int -> s -> IntSet
#

Construct an IntSet from a fold.

Example1 expression
setOf folded [1,2,3,4]fromList [1,2,3,4]
Example1 expression
setOf (folded % _2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]