data Player = P | C | B | F1 | F2 | F3

instance Show Player where
show P = "P"
show C = "C"
show B = "B"
show F1 = "F1"
show F2 = "F2"
show F3 = "F3"

instance Eq Player where
x==y = (show x)==(show y)

moves = [(P,C), (P,B), (B,C), (B,F1), (B,F2), (B,F3)]

move_ball p =
moves >>= \(x,y)->
(if p(x,y) then [(x,y)] else []) ++
(moves >>= \(y',z)-> if y==y' && p(x,z) then [(x,z)] else [])