> 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
- Monad question Simon Raahauge DeSantis
- Re: Monad question Magnus Carlsson
- RE: Monad question Frank A. Christoph
- Re: Monad question Sven Panne
- Re: Monad question Malcolm Wallace
- Re: Monad question Reginald Meeson