ormolu-0.1.2.0: A formatter for Haskell source code

Safe Haskell | None
Language | Haskell2010

Ormolu.Exception

Description

`OrmoluException` type and surrounding definitions.

Synopsis

- data OrmoluException
  - = OrmoluParsingFailed SrcSpan String
  - | OrmoluOutputParsingFailed SrcSpan String
  - | OrmoluASTDiffers FilePath [SrcSpan]
  - | OrmoluNonIdempotentOutput RealSrcLoc Text Text
  - | OrmoluUnrecognizedOpts (NonEmpty String)
- withPrettyOrmoluExceptions :: IO a -> IO a

# Documentation

data OrmoluException Source #

Ormolu exception representing all cases when Ormolu can fail.

Constructors

OrmoluParsingFailed SrcSpan String | Parsing of original source code failed
OrmoluOutputParsingFailed SrcSpan String | Parsing of formatted source code failed
OrmoluASTDiffers FilePath [SrcSpan] | Original and resulting ASTs differ
OrmoluNonIdempotentOutput RealSrcLoc Text Text | Formatted source code is not idempotent
OrmoluUnrecognizedOpts (NonEmpty String) | Some GHC options were not recognized

#### Instances

Instances details

Eq OrmoluException Source # |
Instance details Defined in Ormolu.Exception Methods (==) :: OrmoluException -> OrmoluException -> Bool Source # (/=) :: OrmoluException -> OrmoluException -> Bool Source #
Show OrmoluException Source # |
Instance details Defined in Ormolu.Exception Methods showsPrec :: Int -> OrmoluException -> ShowS Source # show :: OrmoluException -> String Source # showList :: [OrmoluException] -> ShowS Source #
Exception OrmoluException Source # |
Instance details Defined in Ormolu.Exception Methods toException :: OrmoluException -> SomeException Source # fromException :: SomeException -> Maybe OrmoluException Source # displayException :: OrmoluException -> String Source #

withPrettyOrmoluExceptions Source #

Arguments

:: IO a | Action that may throw the exception
-> IO a |

Inside this wrapper `OrmoluException` will be caught and displayed nicely using `displayException`.