I'm trying to create a function that gets a variadic function as an argument, i.e.
func :: (a -> ... -> a) -> a
how can I accomplish this?
I've read about polyvariadic functions and I'm sure that Oleg already did it, however I'm lost trying to apply the pattern on a function with a variadic function as an argument. Especially Olegs approach seems to work with glasgow extensions only and I want the solution to work in pure Haskell 98 (like Text.Printf does).
The reason that I ask is that I'm trying to build a function which takes a boolean function as an argument and checks whether it is a tautology, i.e.
isTautology :: (Bool -> ... -> Bool) -> Bool
so that one could type:
isTautology (\x -> x && not x)
isTautology (\x y -> x && y || not y)
My problem is that I keep reading about the trick was to make the return type a type variable (so that it can be the result or another function), but my return type is fixed (Bool).