Filter/Map composition problem Haskell

composition, haskell

Solution

It is clear that `f :: a -> b` and `p :: b -> Bool`. Since we cannot make any other assumptions about `f` and `g`, one will have to define

h = p . f
g = f

Now `h :: a -> Bool` and `g :: a -> b`.

Problem

I've been given this question in a tutorial, and I really don't know how to go about it. How must g and h be defined in terms of p and f in order to ensure that `filter p . map f = map g . filter h` always holds? Any pointers in the right direction would be greatly appreciated.

Original source