module Optics.Operators
( (^.)
, (^..)
, (^?)
, (#)
, (%~)
, (%!~)
, (.~)
, (!~)
, (?~)
, (?!~)
)
where
import Optics.AffineFold
import Optics.Fold
import Optics.Getter
import Optics.Optic
import Optics.Review
import Optics.Setter
(^.) :: Is k A_Getter => s -> Optic' k is s a -> a
(^.) = flip view
{-# INLINE (^.) #-}
infixl 8 ^.
(^?) :: Is k An_AffineFold => s -> Optic' k is s a -> Maybe a
(^?) = flip preview
{-# INLINE (^?) #-}
infixl 8 ^?
(^..) :: Is k A_Fold => s -> Optic' k is s a -> [a]
(^..) = flip toListOf
{-# INLINE (^..) #-}
infixl 8 ^..
(#) :: Is k A_Review => Optic' k is t b -> b -> t
(#) = review
{-# INLINE (#) #-}
infixr 8 #
(%~) :: Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t
(%~) = over
{-# INLINE (%~) #-}
infixr 4 %~
(%!~) :: Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t
(%!~) = over'
{-# INLINE (%!~) #-}
infixr 4 %!~
(.~) :: Is k A_Setter => Optic k is s t a b -> b -> s -> t
(.~) = set
{-# INLINE (.~) #-}
infixr 4 .~
(!~) :: Is k A_Setter => Optic k is s t a b -> b -> s -> t
(!~) = set'
{-# INLINE (!~) #-}
infixr 4 !~
(?~) :: Is k A_Setter => Optic k is s t a (Maybe b) -> b -> s -> t
(?~) = \o -> set o . Just
{-# INLINE (?~) #-}
infixr 4 ?~
(?!~) :: Is k A_Setter => Optic k is s t a (Maybe b) -> b -> s -> t
(?!~) = \o !b -> set' o (Just b)
{-# INLINE (?!~) #-}
infixr 4 ?!~