Not in pointfree style, but surely could be simplified significantly by using Applicative
(need to import Control.Applicative
):
multiplex f xs e = f $ xs <*> pure e
invariantsHold
also could be simplified a little:
invariantsHold = multiplex and [(>=0),(<=50),even]
Using sequenceA
(from Data.Traversable
) is another way to define this multiplex
:
multiplex f xs e = f $ sequenceA xs e
And this definition can be rewritten in pointfree style (give by pointfree
):
multiplex = (. sequenceA) . (.)
or
multiplex = flip ((.) . (.)) sequenceA
Beautiful, but seems pointless to me :-)