Let's say I need to write a function that applies a function to each item in a List, and then appends it to an accumulator. When the List is empty, return the accumulator.go :: [a] -> (a -> [b]) -> [b] -> [b]go [] f acc = accgo (x:xs) f acc = go xs f (acc ++ f x)myFold :: [a] -> (a -> [b]) -> [b]myFold as f = go as f []I used the go function so that I wouldn't force the myFold caller to have to provide an empty [b] type. Also, I used the go function to achieve tail recursion. In Scala, I would've put @annotation.tailrec to make the compilation fail if the compiler could not perform tail-call optimization.Is the above code idiomatic in Haskell?
Implement a fold-like Function in Haskell
haskell