@@ -24,9 +24,9 @@ module Control.Optics.Linear.Internal
2424 , _Just , _Nothing
2525 , ptraversed , dtraversed
2626 , both , both'
27- , get' , gets' , set'
2827 -- * Using optics
2928 , get , set , gets
29+ , get' , gets' , set' , set''
3030 , match , match' , build
3131 , preview
3232 , over , over'
@@ -42,15 +42,13 @@ module Control.Optics.Linear.Internal
4242import qualified Control.Arrow as NonLinear
4343import qualified Data.Bifunctor.Linear as Bifunctor
4444import Data.Bifunctor.Linear (SymmetricMonoidal )
45- import Data.Monoid
45+ import Data.Monoid ( First ( .. ), Sum ( .. ))
4646import Data.Functor.Const
4747import Data.Functor.Linear
4848import Data.Profunctor.Linear
49- import Data.Functor.Linear
5049import qualified Data.Profunctor.Kleisli.Linear as Linear
5150import Data.Void
52- import Prelude.Linear hiding ((<$>) )
53- -- ^ XXX: not entirely sure why the hiding is necessary here...
51+ import Prelude.Linear
5452import qualified Prelude as P
5553
5654-- TODO: documentation in this module
@@ -161,8 +159,8 @@ get l = gets l P.id
161159gets :: Optic_ (NonLinear. Kleisli (Const r )) a b s t -> (a -> r ) -> s -> r
162160gets (Optical l) f s = getConst' (NonLinear. runKleisli (l (NonLinear. Kleisli (Const P. . f))) s)
163161
164- preview :: Optic_ (NonLinear. Kleisli (Const (Maybe ( First a ) ))) a b s t -> s -> Maybe a
165- preview (Optical l) s = getFirst P. <$> (getConst (NonLinear. runKleisli (l (NonLinear. Kleisli (\ a -> Const (Just ( First a))))) s))
162+ preview :: Optic_ (NonLinear. Kleisli (Const (First a ))) a b s t -> s -> Maybe a
163+ preview (Optical l) s = getFirst (getConst (NonLinear. runKleisli (l (NonLinear. Kleisli (\ a -> Const (First ( Just a))))) s))
166164
167165get' :: Optic_ (Linear. Kleisli (Const (Top , a ))) a b s t -> s ->. (Top , a )
168166get' l = gets' l id
0 commit comments