Converts lambdas like (\x -> func x.field) to (func << .field)
(\x -> func x.field)
(func << .field)
Also handles nested applications like (\x -> f (g x.field)) -> (f << g << .field)
(\x -> f (g x.field))
(f << g << .field)
Reports lambdas that can be simplified to function composition.
config = [ SimplifyLambdaToComposition.rule ]
List.sortBy (\todo -> Time.posixToMillis todo.createdAt) todos List.map (\x -> f (g x.field)) list
List.sortBy (Time.posixToMillis << .createdAt) todos List.map (f << g << .field) list
You can try this rule out by running the following command:
elm-review --template alex-tan/elm-review-opinionated-simplify/example --rules SimplifyLambdaToComposition
Reports lambdas that can be simplified to function composition.
Fail
Success
Try it out
You can try this rule out by running the following command: