So I keep having this small problem where I have something like
func :: a -> b -> [a] -- # or basically any a-> ...-> [a] where ... is any types ->
func x y = func' [x] y -- '# as long as they are used to generate a list of [a] from x
func' :: [a] -> b -> [a]
func' = undefined -- # situation dependant generates a list from
-- # each element and returns it as one long list
should I keep it like this?
should I use func’ hidden by a where?
should I only use the [a] -> b -> [a] version and leave the responsibility of passing [variable] to the callee?
I might well need to compose these functions and might want to mess around with the order so I’m leaning towards option 3. What do you think?
It looks like you are trying to reinvent concatMap:
So the “map” bit takes each element of the input list applies “f” to it. “f” takes a single “a” and returns a “[b]”. These individual lists are then concatenated into a single list.