Skip to content

Commit 4517870

Browse files
committed
Specialized to to Folds.
1 parent f3a83d3 commit 4517870

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Data/Lens/Getter.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Data.Tuple (Tuple (..))
1616
import Control.Monad.State.Class (MonadState, gets)
1717

1818
import Data.Lens.Internal.Forget (Forget (..), runForget)
19-
import Data.Lens.Types (Getter(), Optic())
19+
import Data.Lens.Types (Getter(), Fold(), Optic())
2020
import Data.Lens.Types (IndexedGetter(), Indexed (..))
2121
import Data.Lens.Types (IndexedFold())
2222

@@ -35,8 +35,8 @@ iview l = runForget (l (Indexed $ Forget id))
3535
(^.) s l = view l s
3636

3737
-- | Convert a function into a getter.
38-
to :: forall s t a p. (Profunctor p) => (s -> a) -> Optic p s t a t
39-
to = lmap
38+
to :: forall r s t a b. (s -> a) -> Fold r s t a b
39+
to f p = Forget (runForget p <<< f)
4040

4141
-- | View the focus of a `Getter` in the state of a monad.
4242
use :: forall s t a b m. (MonadState s m) => Getter s t a b -> m a

0 commit comments

Comments
 (0)