Is it possible to write the function in the following way:
find_parts: String -> List String -> List String
find_parts word parts =
List.filter String.contains _ word parts
Instead of:
find_parts: String -> List String -> List String
find_parts word parts =
List.filter (\part -> String.contains part word) parts
CodePudding user response:
If there is, it is not documented.
Alternative solution, if you just want to avoid the lambda syntax use the now-deprecated flip if you're using something earlier than 0.19:
find_parts: String -> List String -> List String
find_parts word parts =
List.filter (flip String.contains word) parts
CodePudding user response:
You can also avoid the lambda with function composition:
find_parts: String -> List String -> List String
find_parts word parts =
(List.filter << flip String.contains) word parts
or even just :
find_parts: String -> List String -> List String
find_parts =
List.filter << flip String.contains