> getDirectoryContents "." >>= filter (\(x:_) -> x /= '.');
> [65] Cannot unify types:
>     Prelude.IO
> and (Prelude.[])

The problem is that `filter's result type is [a], not
(IO [a]) which its use as an argument to >>= requires.
The fix is easy: lift its result into the monad (using `return').

  getDirectoryContents "." >>= return . filter (\(x:_) -> x /= '.')

Regards,
    Malcolm


Reply via email to