cabal-gild-1.5.0.1: Formats package descriptions.
Safe HaskellSafe-Inferred
LanguageHaskell2010

CabalGild.Unstable.Main

Description

This module defines the main entry point for the application.

Synopsis

Documentation

defaultMain :: IO () Source #

This is the main entry point for the application. It gets the command line arguments and then hands things off to mainWith. If any exceptions are thrown, they will be handled by onException.

onException :: SomeException -> IO a Source #

If the exception was an ExitCode, simply exit with that code. Otherwise handle exceptions by printing them to STDERR using displayException instead of show. Then exit with a failing status code.

mainWith :: (MonadLog m, MonadRead m, MonadThrow m, MonadWalk m, MonadWrite m) => [String] -> m () Source #

The actual logic for the command line application. This is written using constraints so that it can be run in pure code if so desired. But most often this will be run in IO.

format :: (MonadThrow m, MonadWalk m) => FilePath -> ByteString -> m ByteString Source #

Formats the given input using the provided file path as the apparent source file (see stdin). An exception will be thrown if the input is invalid. The MonadWalk constraint is used to discover modules on the file system. Typically m will be IO.

check :: Leniency -> ByteString -> ByteString -> Bool Source #

Returns true if the output is formatted correctly, false otherwise.