{-# LANGUAGE Rank2Types #-}
module Data.HashSet.Lens
( setmapped
, setOf
) where
import Control.Lens.Getter (Getting, views)
import Control.Lens.Setter (setting)
import Control.Lens.Type
import qualified Data.HashSet as HashSet
import Data.HashSet (HashSet)
import Data.Hashable
setmapped :: (Eq j, Hashable j) => IndexPreservingSetter (HashSet i) (HashSet j) i j
setmapped :: forall j i.
(Eq j, Hashable j) =>
IndexPreservingSetter (HashSet i) (HashSet j) i j
setmapped = ((i -> j) -> HashSet i -> HashSet j)
-> IndexPreservingSetter (HashSet i) (HashSet j) i j
forall a b s t.
((a -> b) -> s -> t) -> IndexPreservingSetter s t a b
setting (i -> j) -> HashSet i -> HashSet j
forall b a.
(Hashable b, Eq b) =>
(a -> b) -> HashSet a -> HashSet b
HashSet.map
{-# INLINE setmapped #-}
setOf :: Hashable a => Getting (HashSet a) s a -> s -> HashSet a
setOf :: forall a s. Hashable a => Getting (HashSet a) s a -> s -> HashSet a
setOf Getting (HashSet a) s a
l = Getting (HashSet a) s a -> (a -> HashSet a) -> s -> HashSet a
forall s (m :: * -> *) r a.
MonadReader s m =>
LensLike' (Const r) s a -> (a -> r) -> m r
views Getting (HashSet a) s a
l a -> HashSet a
forall a. Hashable a => a -> HashSet a
HashSet.singleton
{-# INLINE setOf #-}