{-# LANGUAGE RankNTypes #-}
module Fresnel.Set
( setmapped
, setOf
) where

import Data.Set as Set
import Fresnel.Fold
import Fresnel.Setter

setmapped :: Ord b => Setter (Set a) (Set b) a b
setmapped :: forall b a. Ord b => Setter (Set a) (Set b) a b
setmapped = ((a -> b) -> Set a -> Set b) -> Setter (Set a) (Set b) a b
forall a b s t. ((a -> b) -> s -> t) -> Setter s t a b
sets (a -> b) -> Set a -> Set b
forall b a. Ord b => (a -> b) -> Set a -> Set b
Set.map

setOf :: Ord a => Fold s a -> (s -> Set.Set a)
setOf :: forall a s. Ord a => Fold s a -> s -> Set a
setOf Fold s a
o = [a] -> Set a
forall a. Ord a => [a] -> Set a
Set.fromList ([a] -> Set a) -> (s -> [a]) -> s -> Set a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Fold s a -> s -> [a]
forall s a. Fold s a -> s -> [a]
toListOf Optic' p s a
Fold s a
o