title: purescript: Mixing Effect and Array contexts
body: <p>I'm trying to implement a recursive function to remove empty directories in purescript.  For the following code I get an error about matching Effect with Array.</p>
  <pre><code>module Test where
  
  import Prelude
  
  import Data.Array as Array
  import Effect (Effect)
  import Node.Buffer.Class (toArray)
  import Node.FS.Stats (isDirectory)
  import Node.FS.Sync as FS
  import Node.Path (FilePath)
  import Prim.Boolean (False)
  
  rmEmptyDirs :: FilePath -&gt; Effect Unit
  rmEmptyDirs path = do
    stats &lt;- FS.stat path
    if isDirectory stats then do
      files &lt;- FS.readdir path
      if Array.length files == 0 then
        FS.rmdir path
      else do
        file &lt;- files
        rmEmptyDirs file
    else
      pure unit
  </code></pre>
  <p>Here is the error message:</p>
  <pre><code>Could not match type
  Effect
  with type
  Array
  while trying to match type Effect Unit
  with type Array t0
  while checking that expression rmEmptyDirs file
  has type Array t0
  in binding group rmEmptyDirs
  where t0 is an unknown type
  </code></pre>
  <p>I understand that the innermost do block is in an Array context.  I don't know how to &quot;strip off&quot; the Effect from the recursive call to <em>rmEmptyDirs</em>.  Putting <em>Array.singleton $</em> before the call doesn't help.  <em>liftEffect</em> has the opposite effect of what I want to do.  How do I get this compile?</p>