Given some data structure with specific lenses, for example:
import Control.Lens data Thing = Thing { _a :: String , _b :: String , _c :: Int , _d :: Int } makeLenses ''Thing
And given some function that I want to call using several getters, for example:
fun :: Int -> String -> Int -> String -> Bool fun = undefined
I am currently getting a lot of ugliness with parens to access each field, for example:
thing = Thing "hello" "there" 5 1 answer = fun (thing^.c) (thing^.a) (thing^.d) (thing^.b)
Given the brevity of the lens library in most other situations, I was hoping for something more elegant, but I cannot find combinators to help in this particular case.
source share