@@ -24,9 +24,9 @@ module Control.Optics.Linear.Internal
24
24
, _Just , _Nothing
25
25
, ptraversed , dtraversed
26
26
, both , both'
27
- , get' , gets' , set'
28
27
-- * Using optics
29
28
, get , set , gets
29
+ , get' , gets' , set' , set''
30
30
, match , match' , build
31
31
, preview
32
32
, over , over'
@@ -42,15 +42,13 @@ module Control.Optics.Linear.Internal
42
42
import qualified Control.Arrow as NonLinear
43
43
import qualified Data.Bifunctor.Linear as Bifunctor
44
44
import Data.Bifunctor.Linear (SymmetricMonoidal )
45
- import Data.Monoid
45
+ import Data.Monoid ( First ( .. ), Sum ( .. ))
46
46
import Data.Functor.Const
47
47
import Data.Functor.Linear
48
48
import Data.Profunctor.Linear
49
- import Data.Functor.Linear
50
49
import qualified Data.Profunctor.Kleisli.Linear as Linear
51
50
import Data.Void
52
- import Prelude.Linear hiding ((<$>) )
53
- -- ^ XXX: not entirely sure why the hiding is necessary here...
51
+ import Prelude.Linear
54
52
import qualified Prelude as P
55
53
56
54
-- TODO: documentation in this module
@@ -159,8 +157,8 @@ get l = gets l P.id
159
157
gets :: Optic_ (NonLinear. Kleisli (Const r )) a b s t -> (a -> r ) -> s -> r
160
158
gets (Optical l) f s = getConst' (NonLinear. runKleisli (l (NonLinear. Kleisli (Const P. . f))) s)
161
159
162
- preview :: Optic_ (NonLinear. Kleisli (Const (Maybe ( First a ) ))) a b s t -> s -> Maybe a
163
- preview (Optical l) s = getFirst P. <$> (getConst (NonLinear. runKleisli (l (NonLinear. Kleisli (\ a -> Const (Just ( First a))))) s))
160
+ preview :: Optic_ (NonLinear. Kleisli (Const (First a ))) a b s t -> s -> Maybe a
161
+ preview (Optical l) s = getFirst (getConst (NonLinear. runKleisli (l (NonLinear. Kleisli (\ a -> Const (First ( Just a))))) s))
164
162
165
163
get' :: Optic_ (Linear. Kleisli (Const (Top , a ))) a b s t -> s ->. (Top , a )
166
164
get' l = gets' l id
0 commit comments