The highest precedence in Haskell is function application or f a
. So
fst . fst ((a, b), a)
is parsed as
fst . (fst ((a, b), a))
which is obviously nonsense. You can fix this with the $
operator which is just function application with the lowest precedence, so f $ a == f a
.
fst . fst $ ((a, b), a)
Or with some parens
(fst . fst) ((a, b), a)