Simplification of consecutive `map`s I've written the following code:

{- ...
   ...
   ... -}

data Ellipsoid
data Halfplane
data Intersection

data PointSet s a where
    Halfplane :: RealFrac a =&gt;
                 a -&gt; a -&gt; a -&gt; (a -&gt; a -&gt; Bool) -&gt; a -&gt;
                 PointSet Halfplane a
    Ellipsoid :: RealFrac a =&gt;
                 a -&gt; a -&gt; a -&gt; (a -&gt; a -&gt; Bool) -&gt; a -&gt;
                 PointSet Ellipsoid a
    Intersection :: [PointSet s a] -&gt; PointSet Intersection a

type TestFunc a = RealFrac a =&gt; (a -&gt; a -&gt; a -&gt;  Bool)

test :: (Show  a) =&gt; PointSet t a -&gt; TestFunc a
test (Ellipsoid a b c f r) = f'
                       where f' z y x = ((x/a)^2 + (y/b)^2 + (z/c)^2) `f` r
test (Halfplane a b c f t) = f'
                       where f' z y x = (a*x + b*y + c*z) `f` t
test (Intersection ps) =     f'
        where f' z y x = and . map ($ x) $ map ($ y) $ map ($ z) ts
              ts = map test ps


In particular I'd like to have input on f' z y x = and . map ($ x) $ map ($ y) $ map ($ z) ts, whether there is a way to express this more succinctly.

Of course, I'm happy about any other comment as well.
The expression

and . map ($ x) . map ($ y) . map ($ z) . map test $ ps


contains several map calls connected with .. But since map f . map g === map (f . g), we can simplify it as

and . map (($ x) . ($ y) . ($ z) . test) $ ps


or more concisely

and . map (\g -&gt; test g x y z) $ ps


Also and . map p can be simplified by all, so finally we get

all (\g -&gt; test g x y z) ps


Just one more note, please post code that compiles, especially for CR, it's much easier to work with; see http://sscce.org/