So the first bit is the type signature
fun :: (a -> Bool) -> [a] -> [a]
The (a -> Bool) signifies a function that takes an a and returns a Bool. Since it's being passed as an argument, fun is a "higher order function" — a function that takes another function as an argument (here p, using "p" for "predicate"). The second argument is a list of a's and a list of a's is returned.
The [] case is quite clear. However, when we have at least one element (the x in (x:xs) pattern) we check to see whether p returns true for it (i.e. when (p x) is called). If it does, we add the element to the front of our resulting list, and if not, we just throw that element away. Then we recurse.
Let's step through an example to see what this does.
fun even [1, 2, 3]
if (even 1) then (1 : fun even [2, 3]) else (fun even [2, 3])
fun even [2, 3]
if (even 2) then (2 : fun even [3]) else (fun even [3])
2 : (fun even [3])
2 : (if (even 3) then (3 : fun even []) else (fun even []))
2 : (fun even [])
2 : []
[2]
Look familiar? That's just filter!