runTagger :: TagCmd -> StackTag (Either (PkgName, String) TagOutput)
runTagger (TagCmd t fmt to fp dep) = do

    let opts = [ tagFmt fmt
               , "-R"  -- tags-absolute
               -- made the default & removed
               -- , "--ignore-close-implementation"
              , "--follow-symlinks"
              -- , "--cache"
              , "--output"
              , to
              , fp
              ]

    (ec, stout, err) <- hasktags opts

    case ec of
        ExitFailure _
            | null err -> return $ Left (dep, stout)
            | otherwise -> return $ Left (dep, err)
        ExitSuccess   -> return $ Right to
  where
    hasktags opts = io $
        readProcessWithExitCode (tagExe t) opts []
          `E.catch` (\(SomeException err) -> return (ExitFailure 1, displayException err, ""))


-- TODO tagExe Hasktags   = "fast-tags"
runTagger :: TagCmd -> StackTag (Either (PkgName, String) TagOutput)
runTagger (TagCmd t fmt to fp dep) = do

    let opts = [ tagFmt fmt
               , "-R"  -- tags-absolute
               -- made the default & removed
               -- , "--ignore-close-implementation"
              , "--follow-symlinks"
              -- , "--cache"
              , "--output"
              , to
              , fp
              ]

    (ec, stout, err) <- hasktags opts

    case ec of
        ExitFailure _
            | null err -> return $ Left (dep, stout)
            | otherwise -> return $ Left (dep, err)
        ExitSuccess   -> return $ Right to
  where
    hasktags opts = io $
        readProcessWithExitCode (tagExe t) opts []
          `E.catch` (\(SomeException err) -> return (ExitFailure 1, displayException err, ""))


-- TODO tagExe Hasktags   = "fast-tags"
runTagger (TagCmd t fmt to fp dep) = do

    let opts = [ tagFmt fmt
               , "-R"  -- tags-absolute
               -- made the default & removed
               -- , "--ignore-close-implementation"
              , "--follow-symlinks"
              -- , "--cache"
              , "--output"
              , to
              , fp
              ]

    (ec, stout, err) <- hasktags opts

    case ec of
        ExitFailure _
            | null err -> return $ Left (dep, stout)
            | otherwise -> return $ Left (dep, err)
        ExitSuccess   -> return $ Right to
  where
    hasktags opts = io $
        readProcessWithExitCode (tagExe t) opts []
          `E.catch` (\(SomeException err) -> return (ExitFailure 1, displayException err, ""))


-- TODO tagExe Hasktags   = "fast-tags"