Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the setter functions #13

Open
sajidanower23 opened this issue May 21, 2018 · 0 comments
Open

Rename the setter functions #13

sajidanower23 opened this issue May 21, 2018 · 0 comments

Comments

@sajidanower23
Copy link

sajidanower23 commented May 21, 2018

In the module Lets.Lens, there is a setter function and a type alias that goes with it.

type Set s t a b =
  (a -> Identity b)
  -> s
  -> Identity t

-- | Let's write an inverse to @over@ that does the @Identity@ wrapping &
-- unwrapping.
sets ::
  ((a -> b) -> s -> t)
  -> ( a -> Identity b)
  -> s
  -> Identity t
  -- -> Set s t a b
sets f idM = Identity . f (getIdentity . idM)

mapped ::
  Functor f =>
  Set (f a) (f b) a b
mapped = sets fmap

set ::
  Set s t a b
  -> s
  -> b
  -> t
set q s b = over q (const b) s

Later in the module, we can see the use of the data structure Set, which has nothing to do with the setter functions and therefore can be confusing.
It may be worth renaming the setter functions, perhaps to update or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant