[Haskell-cafe] comprehension generators from IO [a]'s ?

Andrew Pimlott andrew at pimlott.net
Mon Dec 19 16:19:23 EST 2005


On Mon, Dec 19, 2005 at 01:42:19PM -0600, Steve Harris wrote:
> What I'm after is something like:
>  -- (psuedo-code)
>  [(b,c,d) |
>            b <- getDirectoryContents a_dir,
>            c <- getDirectoryContents (a_dir ++ "/" ++ b),
>            d <- getDirectoryContents (a_dir ++ "/" ++ b ++ "/" ++ c) ],

Check out Control.Monad.List.ListT, which combines list non-determinism
with another monad.  Eg,

    ListT (getDirectoryContents a_dir) :: ListT IO FilePath

Andrew


More information about the Haskell-Cafe mailing list