cabal-fmt-0.1.12: Format .cabal files

Safe Haskell | None
Language | Haskell2010

CabalFmt.Pragma

Synopsis

- data Pragma
  - = FieldPragma FieldPragma
  - | GlobalPragma GlobalPragma
- data FieldPragma
  - = PragmaExpandModules FilePath [ModuleName]
  - | PragmaGlobFiles Glob
  - | PragmaFragment FilePath
- data GlobalPragma
  - = PragmaOptIndent Int
  - | PragmaOptTabular Bool
- parsePragma :: ByteString -> Either String (Maybe Pragma)
- stripWhitespace :: ByteString -> ByteString
- parsePragmas :: Comments -> ([String], [Pragma])

# Documentation

data Pragma #

Constructors

FieldPragma FieldPragma |
GlobalPragma GlobalPragma |

#### Instances

Instances details

Show Pragma # |
Instance details Defined in CabalFmt.Pragma Methods showsPrec :: Int -> Pragma -> ShowS # show :: Pragma -> String # showList :: [Pragma] -> ShowS #

data FieldPragma #

Pragmas applied per field

Constructors

PragmaExpandModules FilePath [ModuleName] |
PragmaGlobFiles Glob |
PragmaFragment FilePath |

#### Instances

Instances details

Show FieldPragma # |
Instance details Defined in CabalFmt.Pragma Methods showsPrec :: Int -> FieldPragma -> ShowS # show :: FieldPragma -> String # showList :: [FieldPragma] -> ShowS #

data GlobalPragma #

Pragmas affecting global output

Constructors

PragmaOptIndent Int |
PragmaOptTabular Bool |

#### Instances

Instances details

Show GlobalPragma # |
Instance details Defined in CabalFmt.Pragma Methods showsPrec :: Int -> GlobalPragma -> ShowS # show :: GlobalPragma -> String # showList :: [GlobalPragma] -> ShowS #

parsePragma :: ByteString -> Either String (Maybe Pragma) #

Parse pragma from `ByteString`.

An error (`Left`) is reported only if input `ByteString` starts with `-- cabal-fmt:`.

stripWhitespace :: ByteString -> ByteString #

parsePragmas :: Comments -> ([String], [Pragma]) #