findExe ::
  MonadIO m =>
  MonadDeepError e GrepError m =>
  Text ->
  m (Path Abs File)
findExe exe = do
  path <- hoistEitherAs parseError $ parseRelFile (toString exe)
  hoistMaybe notInPath =<< findExecutable path
  where
    parseError =
      GrepError.NoSuchExecutable exe
    notInPath =
      GrepError.NotInPath exe
findExe ::
  MonadIO m =>
  MonadDeepError e GrepError m =>
  Text ->
  m (Path Abs File)
findExe exe = do
  path <- hoistEitherAs parseError $ parseRelFile (toString exe)
  hoistMaybe notInPath =<< findExecutable path
  where
    parseError =
      GrepError.NoSuchExecutable exe
    notInPath =
      GrepError.NotInPath exe
findExe exe = do
  path <- hoistEitherAs parseError $ parseRelFile (toString exe)
  hoistMaybe notInPath =<< findExecutable path
  where
    parseError =
      GrepError.NoSuchExecutable exe
    notInPath =
      GrepError.NotInPath exe