I've written the following code:{- ...   ...   ... -}data Ellipsoiddata Halfplanedata Intersectiondata PointSet s a where    Halfplane :: RealFrac a =>                 a -> a -> a -> (a -> a -> Bool) -> a ->                 PointSet Halfplane a    Ellipsoid :: RealFrac a =>                 a -> a -> a -> (a -> a -> Bool) -> a ->                 PointSet Ellipsoid a    Intersection :: [PointSet s a] -> PointSet Intersection atype TestFunc a = RealFrac a => (a -> a -> a ->  Bool)test :: (Show  a) => PointSet t a -> TestFunc atest (Ellipsoid a b c f r) = f'                       where f' z y x = ((x/a)^2 + (y/b)^2 + (z/c)^2) `f` rtest (Halfplane a b c f t) = f'                       where f' z y x = (a*x + b*y + c*z) `f` ttest (Intersection ps) =     f'        where f' z y x = and . map ($ x) $ map ($ y) $ map ($ z) ts              ts = map test psIn 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.
Simplification of consecutive `map`s
haskell
The expressionand . map ($ x) . map ($ y) . map ($ z) . map test $ pscontains several map calls connected with .. But since map f . map g === map (f . g), we can simplify it asand . map (($ x) . ($ y) . ($ z) . test) $ psor more conciselyand . map (\g -> test g x y z) $ psAlso and . map p can be simplified by all, so finally we getall (\g -> test g x y z) psJust one more note, please post code that compiles, especially for CR, it's much easier to work with; see http://sscce.org/