Saurabh Nanda
Saurabh Nanda

Reputation: 6793

How to convert a function to a lens getter?

Probably related to What in lens should I use to build a read-only getter by index?

I'm looking for a variant of the lens function that allows me to build a Getter s a from an s -> a. Does something like this exist?

Upvotes: 1

Views: 178

Answers (1)

duplode
duplode

Reputation: 34378

You are looking for to, which "build[s] an (index-preserving) Getter from an arbitrary Haskell function".

Upvotes: 1

Related Questions