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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleoptics-core-0.4.2Haskell2010

Data.Set.Optics

This module defines optics for constructing and manipulating finite Sets.

  • 2 values
  • Packageoptics-core-0.4.2
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceOptics.hs
valuesetmapped :: Ord b => Setter (Set a) (Set b) a b
#

This Setter can be used to change the type of a Set by mapping the elements to new values.

Sadly, you can't create a valid Traversal for a Set, but you can manipulate it by reading using folded and reindexing it via setmapped.

Example1 expression
over setmapped (+1) (Set.fromList [1,2,3,4])fromList [2,3,4,5]
valuesetOf :: (Is k A_Fold, Ord a) => Optic' k is s a -> s -> Set a
#

Construct a set from a fold.

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