validateNoChanges ::
    World m =>
    InfoFormatter.Loggable info =>
    (FilePath -> info)
    -> ((FilePath, Text) -> Either info ())
    -> ValidateMode
    -> m Bool
validateNoChanges processingFile validate mode =
    let
        infoMode = ForMachine
        onInfo = InfoFormatter.onInfo infoMode
    in
    runState (InfoFormatter.init infoMode) (InfoFormatter.done infoMode) $
    case mode of
        ValidateStdin ->
            lift (validate <$> readStdin) >>= logError onInfo

        ValidateFiles first rest ->
            and <$> mapM validateFile (first:rest)
            where
                validateFile file =
                    (validate <$> readFromFile (onInfo . processingFile) file)
                        >>= logError onInfo
validateNoChanges ::
    World m =>
    InfoFormatter.Loggable info =>
    (FilePath -> info)
    -> ((FilePath, Text) -> Either info ())
    -> ValidateMode
    -> m Bool
validateNoChanges processingFile validate mode =
    let
        infoMode = ForMachine
        onInfo = InfoFormatter.onInfo infoMode
    in
    runState (InfoFormatter.init infoMode) (InfoFormatter.done infoMode) $
    case mode of
        ValidateStdin ->
            lift (validate <$> readStdin) >>= logError onInfo

        ValidateFiles first rest ->
            and <$> mapM validateFile (first:rest)
            where
                validateFile file =
                    (validate <$> readFromFile (onInfo . processingFile) file)
                        >>= logError onInfo
validateNoChanges processingFile validate mode =
    let
        infoMode = ForMachine
        onInfo = InfoFormatter.onInfo infoMode
    in
    runState (InfoFormatter.init infoMode) (InfoFormatter.done infoMode) $
    case mode of
        ValidateStdin ->
            lift (validate <$> readStdin) >>= logError onInfo

        ValidateFiles first rest ->
            and <$> mapM validateFile (first:rest)
            where
                validateFile file =
                    (validate <$> readFromFile (onInfo . processingFile) file)
                        >>= logError onInfo