There is a similar question I found here that asks almost the same thing, but not quite.
The question I have is how to compose a list of functions of type (a -> Bool) to be one function that is also (a -> Bool).
Ex.
compose :: [(a -> Bool)] -> (a -> Bool)
compose [] = **?**
compose (x:xs) = x **?** compose xs
The question that was similar to this was taking three functions and mixing them all like so:
newFunction x f g y = f x || g x || y x
But this is very limited because you have to supply a specific number of functions, and it does not return another function, it returns a Boolean. I essentially want a function that gives me the above function without functions as arguments.
I tried messing with Monoids to make this work but I ran into issues with wrapping the functions into a Monoid in the first place, let alone actually composing them together as newFunction does.
Is there a way to compose a list of functions of type (a -> Bool) to one function of the same type?
True
. – EquitesGHCi> :t (or .) . sequence
. – Finickingflip
s, I can't handle. – Finicking