mirror of
https://github.com/tweag/ormolu.git
synced 2024-09-11 13:16:13 +03:00
Add option to respect default-extensions from .cabal files
This commit is contained in:
parent
3f52afa1d3
commit
59fced3058
@ -13,6 +13,9 @@
|
||||
the native line ending conventions. [Issue
|
||||
717](https://github.com/tweag/ormolu/issues/717).
|
||||
|
||||
* Opt-in support to respect default-extensions and default-language
|
||||
from .cabal files. [Issue 517](https://github.com/tweag/ormolu/issues/517).
|
||||
|
||||
## Ormolu 0.2.0.0
|
||||
|
||||
* Now standalone kind signatures are grouped with type synonyms. [Issue
|
||||
|
13
README.md
13
README.md
@ -12,6 +12,7 @@
|
||||
* [Editor integration](#editor-integration)
|
||||
* [GitHub actions](#github-actions)
|
||||
* [Magic comments](#magic-comments)
|
||||
* [Account for .cabal files](#account-for-.cabal-files)
|
||||
* [Exit codes](#exit-codes)
|
||||
* [Limitations](#limitations)
|
||||
* [Running on Hackage](#running-on-hackage)
|
||||
@ -163,6 +164,16 @@ source code must still be parseable even when the disabled regions are
|
||||
omitted. Because of that the magic comments cannot be placed arbitrarily,
|
||||
but rather must enclose independent top-level definitions.
|
||||
|
||||
### Account for .cabal files
|
||||
|
||||
Many cabal and stack projects use `default-extensions` to enable GHC
|
||||
language extensions in all source files. With the
|
||||
`--cabal-default-extensions` flag, Ormolu will take them into consideration
|
||||
during formatting.
|
||||
|
||||
When you format input from stdin, you can pass `--stdin-input-file` which
|
||||
will tell Ormolu to find and use a suitable .cabal file.
|
||||
|
||||
### Exit codes
|
||||
|
||||
Exit code | Meaning
|
||||
@ -175,6 +186,8 @@ Exit code | Meaning
|
||||
5 | AST of original and formatted code differs
|
||||
6 | Formatting is not idempotent
|
||||
7 | Unrecognized GHC options
|
||||
8 | Cabal file parsing failed
|
||||
9 | Missing input file path when using stdin input and accounting for .cabal files
|
||||
100 | In checking mode: unformatted files
|
||||
101 | Inplace and check modes do not work with stdin
|
||||
102 | Other issue (with multiple input files)
|
||||
|
123
app/Main.hs
123
app/Main.hs
@ -6,6 +6,7 @@
|
||||
|
||||
module Main (main) where
|
||||
|
||||
import Control.Exception (throwIO)
|
||||
import Control.Monad
|
||||
import Data.Bool (bool)
|
||||
import Data.List (intercalate, sort)
|
||||
@ -19,6 +20,7 @@ import Ormolu.Diff.Text (diffText, printTextDiff)
|
||||
import Ormolu.Parser (manualExts)
|
||||
import Ormolu.Terminal
|
||||
import Ormolu.Utils (showOutputable)
|
||||
import Ormolu.Utils.Extensions (getCabalExtensionDynOptions)
|
||||
import Ormolu.Utils.IO
|
||||
import Paths_ormolu (version)
|
||||
import System.Exit (ExitCode (..), exitWith)
|
||||
@ -29,7 +31,7 @@ import System.IO (hPutStrLn, stderr)
|
||||
main :: IO ()
|
||||
main = do
|
||||
Opts {..} <- execParser optsParserInfo
|
||||
let formatOne' = formatOne optMode optConfig
|
||||
let formatOne' = formatOne optCabalDefaultExtensions optMode optConfig
|
||||
exitCode <- case optInputFiles of
|
||||
[] -> formatOne' Nothing
|
||||
["-"] -> formatOne' Nothing
|
||||
@ -52,6 +54,8 @@ main = do
|
||||
|
||||
-- | Format a single input.
|
||||
formatOne ::
|
||||
-- | Whether to respect default-extensions from .cabal files
|
||||
CabalDefaultExtensionsOpts ->
|
||||
-- | Mode of operation
|
||||
Mode ->
|
||||
-- | Configuration
|
||||
@ -59,43 +63,57 @@ formatOne ::
|
||||
-- | File to format or stdin as 'Nothing'
|
||||
Maybe FilePath ->
|
||||
IO ExitCode
|
||||
formatOne mode config mpath = withPrettyOrmoluExceptions (cfgColorMode config) $
|
||||
case FP.normalise <$> mpath of
|
||||
Nothing -> do
|
||||
r <- ormoluStdin config
|
||||
case mode of
|
||||
Stdout -> do
|
||||
TIO.putStr r
|
||||
return ExitSuccess
|
||||
_ -> do
|
||||
hPutStrLn
|
||||
stderr
|
||||
"This feature is not supported when input comes from stdin."
|
||||
-- 101 is different from all the other exit codes we already use.
|
||||
return (ExitFailure 101)
|
||||
Just inputFile -> do
|
||||
originalInput <- readFileUtf8 inputFile
|
||||
formattedInput <- ormoluFile config inputFile
|
||||
case mode of
|
||||
Stdout -> do
|
||||
TIO.putStr formattedInput
|
||||
return ExitSuccess
|
||||
InPlace -> do
|
||||
-- Only write when the contents have changed, in order to avoid
|
||||
-- updating the modified timestamp if the file was already correctly
|
||||
-- formatted.
|
||||
when (formattedInput /= originalInput) $
|
||||
writeFileUtf8 inputFile formattedInput
|
||||
return ExitSuccess
|
||||
Check ->
|
||||
case diffText originalInput formattedInput inputFile of
|
||||
Nothing -> return ExitSuccess
|
||||
Just diff -> do
|
||||
runTerm (printTextDiff diff) (cfgColorMode config) stderr
|
||||
-- 100 is different to all the other exit code that are emitted
|
||||
-- either from an 'OrmoluException' or from 'error' and
|
||||
-- 'notImplemented'.
|
||||
return (ExitFailure 100)
|
||||
formatOne CabalDefaultExtensionsOpts {..} mode config mpath =
|
||||
withPrettyOrmoluExceptions (cfgColorMode config) $
|
||||
case FP.normalise <$> mpath of
|
||||
Nothing -> do
|
||||
extraDynOptions <-
|
||||
if optUseCabalDefaultExtensions
|
||||
then case optStdinInputFile of
|
||||
Just stdinInputFile ->
|
||||
getCabalExtensionDynOptions stdinInputFile
|
||||
Nothing -> throwIO OrmoluMissingStdinInputFile
|
||||
else pure []
|
||||
r <- ormoluStdin (configPlus extraDynOptions)
|
||||
case mode of
|
||||
Stdout -> do
|
||||
TIO.putStr r
|
||||
return ExitSuccess
|
||||
_ -> do
|
||||
hPutStrLn
|
||||
stderr
|
||||
"This feature is not supported when input comes from stdin."
|
||||
-- 101 is different from all the other exit codes we already use.
|
||||
return (ExitFailure 101)
|
||||
Just inputFile -> do
|
||||
extraDynOptions <-
|
||||
if optUseCabalDefaultExtensions
|
||||
then getCabalExtensionDynOptions inputFile
|
||||
else pure []
|
||||
originalInput <- readFileUtf8 inputFile
|
||||
formattedInput <- ormoluFile (configPlus extraDynOptions) inputFile
|
||||
case mode of
|
||||
Stdout -> do
|
||||
TIO.putStr formattedInput
|
||||
return ExitSuccess
|
||||
InPlace -> do
|
||||
-- Only write when the contents have changed, in order to avoid
|
||||
-- updating the modified timestamp if the file was already correctly
|
||||
-- formatted.
|
||||
when (formattedInput /= originalInput) $
|
||||
writeFileUtf8 inputFile formattedInput
|
||||
return ExitSuccess
|
||||
Check ->
|
||||
case diffText originalInput formattedInput inputFile of
|
||||
Nothing -> return ExitSuccess
|
||||
Just diff -> do
|
||||
runTerm (printTextDiff diff) (cfgColorMode config) stderr
|
||||
-- 100 is different to all the other exit code that are emitted
|
||||
-- either from an 'OrmoluException' or from 'error' and
|
||||
-- 'notImplemented'.
|
||||
return (ExitFailure 100)
|
||||
where
|
||||
configPlus dynOpts = config {cfgDynOptions = cfgDynOptions config ++ dynOpts}
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- Command line options parsing
|
||||
@ -106,7 +124,9 @@ data Opts = Opts
|
||||
-- | Ormolu 'Config'
|
||||
optConfig :: !(Config RegionIndices),
|
||||
-- | Haskell source files to format or stdin (when the list is empty)
|
||||
optInputFiles :: ![FilePath]
|
||||
optInputFiles :: ![FilePath],
|
||||
-- | Options for respecting default-extensions from .cabal files
|
||||
optCabalDefaultExtensions :: CabalDefaultExtensionsOpts
|
||||
}
|
||||
|
||||
-- | Mode of operation.
|
||||
@ -120,6 +140,17 @@ data Mode
|
||||
Check
|
||||
deriving (Eq, Show)
|
||||
|
||||
-- | Configuration for how to account for default-extension
|
||||
-- from .cabal files
|
||||
data CabalDefaultExtensionsOpts = CabalDefaultExtensionsOpts
|
||||
{ -- | Account for default-extensions from .cabal files
|
||||
optUseCabalDefaultExtensions :: Bool,
|
||||
-- | Optional path to a file which will be used to
|
||||
-- find a .cabal file when using input from stdin
|
||||
optStdinInputFile :: Maybe FilePath
|
||||
}
|
||||
deriving (Show)
|
||||
|
||||
optsParserInfo :: ParserInfo Opts
|
||||
optsParserInfo =
|
||||
info (helper <*> ver <*> exts <*> optsParser) . mconcat $
|
||||
@ -171,6 +202,20 @@ optsParser =
|
||||
[ metavar "FILE",
|
||||
help "Haskell source files to format or stdin (the default)"
|
||||
]
|
||||
<*> cabalDefaultExtensionsParser
|
||||
|
||||
cabalDefaultExtensionsParser :: Parser CabalDefaultExtensionsOpts
|
||||
cabalDefaultExtensionsParser =
|
||||
CabalDefaultExtensionsOpts
|
||||
<$> (switch . mconcat)
|
||||
[ short 'e',
|
||||
long "cabal-default-extensions",
|
||||
help "Account for default-extensions from .cabal files"
|
||||
]
|
||||
<*> (optional . strOption . mconcat)
|
||||
[ long "stdin-input-file",
|
||||
help "Path which will be used to find the .cabal file when using input from stdin"
|
||||
]
|
||||
|
||||
configParser :: Parser (Config RegionIndices)
|
||||
configParser =
|
||||
|
@ -21,6 +21,7 @@ let
|
||||
"ormolu" = super.callCabal2nixWithOptions "ormolu" source "-fdev" { };
|
||||
"ghc-lib-parser" = self.ghc-lib-parser_9_0_1_20210324;
|
||||
"path" = self.path_0_9_0;
|
||||
"Cabal" = self.Cabal_3_4_0_0;
|
||||
};
|
||||
ormolize = import ./nix/ormolize {
|
||||
inherit pkgs;
|
||||
@ -38,7 +39,6 @@ let
|
||||
"pandoc"
|
||||
"pipes"
|
||||
"postgrest"
|
||||
"purescript"
|
||||
];
|
||||
ormolizedPackages =
|
||||
let
|
||||
|
@ -1,188 +1,4 @@
|
||||
src/full/Agda/Compiler/JS/Compiler.hs:50:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Compiler/JS/Pretty.hs:16:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Compiler/JS/Syntax.hs:13:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Compiler/MAlonzo/Compiler.hs:336:1-16
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Invalid type signature: pattern YesFloat :: ...
|
||||
Perhaps you meant to use PatternSynonyms?
|
||||
src/full/Agda/Interaction/BasicOps.hs:79:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Interaction/FindFile.hs:50:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Interaction/Highlighting/Generate.hs:59:36-41
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `Ranged'
|
||||
src/full/Agda/Interaction/Imports.hs:7:19-28
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `ScopeCheck'
|
||||
src/full/Agda/Interaction/InteractionTop.hs:63:50-59
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `ScopeCheck'
|
||||
src/full/Agda/Syntax/Abstract.hs:43:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Abstract/Name.hs:30:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Abstract/PatternSynonyms.hs:24:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Common.hs:34:44-45
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete.hs:94:49-50
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Attribute.hs:19:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Definitions.hs:92:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Definitions/Errors.hs:17:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Name.hs:25:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Operators/Parser.hs:25:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Pattern.hs:18:44-45
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Concrete/Pretty.hs:27:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/DoNotation.hs:39:44-45
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/IdiomBrackets.hs:15:44-45
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Internal.hs:937:13-16
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!dom
|
||||
src/full/Agda/Syntax/Parser/LexActions.hs:29:36-41
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `Ranged'
|
||||
src/full/Agda/Syntax/Parser/StringLiterals.hs:12:36-41
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `Ranged'
|
||||
src/full/Agda/Syntax/Reflected.hs:12:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Scope/Base.hs:43:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Scope/Monad.hs:55:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Translation/AbstractToConcrete.hs:75:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Translation/ConcreteToAbstract.hs:91:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Translation/InternalToAbstract.hs:70:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Syntax/Translation/ReflectedToAbstract.hs:32:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Termination/TermCheck.hs:992:12-15
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!dom
|
||||
src/full/Agda/TypeChecking/Conversion.hs:50:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Errors.hs:65:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Monad/Base.hs:103:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Monad/Caching.hs:58:3-4
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!l
|
||||
Possibly caused by a missing 'do'?
|
||||
src/full/Agda/TypeChecking/Monad/Context.hs:36:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Monad/Signature.hs:883:7-10
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!cs'
|
||||
src/full/Agda/TypeChecking/Monad/State.hs:460:7-13
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!table'
|
||||
src/full/Agda/TypeChecking/Positivity.hs:322:6-7
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!m
|
||||
src/full/Agda/TypeChecking/Pretty.hs:50:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Reduce/Fast.hs:517:18-20
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!cl
|
||||
src/full/Agda/TypeChecking/Rules/Application.hs:63:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Rules/Data.hs:44:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Rules/Def.hs:64:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Rules/LHS.hs:83:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Rules/Term.hs:75:44-45
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/SizedTypes/Solve.hs:90:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Substitute.hs:52:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/TypeChecking/Unquote.hs:54:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Utils/Either.hs:31:43-44
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Utils/Graph/AdjacencyMap/Unidirectional.hs:661:7-8
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!q
|
||||
src/full/Agda/Utils/Lens.hs:67:12-13
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!x
|
||||
Possibly caused by a missing 'do'?
|
||||
src/full/Agda/Utils/List2.hs:24:58-59
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `:|'
|
||||
src/full/Agda/Utils/Pointer.hs:55:8-9
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!x
|
||||
src/full/Agda/Utils/Trie.hs:48:45-46
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!v
|
||||
src/full/Agda/Syntax/Internal.hs
|
||||
AST of input and AST of formatted code differ.
|
||||
at src/full/Agda/Syntax/Internal.hs:640:5
|
||||
Please, consider reporting the bug.
|
||||
|
@ -1,50 +1,3 @@
|
||||
server/src-lib/Control/Arrow/Extended.hs:76:29-30
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!v
|
||||
server/src-lib/Control/Arrow/Trans.hs:183:54-56
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!w2
|
||||
server/src-lib/Data/Aeson/Ordered.hs:211:14-17
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!len
|
||||
server/src-lib/Data/Sequence/NonEmpty.hs:77:32-34
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!xs
|
||||
server/src-lib/GHC/Stats/Extended.hs:12:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/App.hs:1010:22
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/BigQuery/Connection.hs:45:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/BigQuery/DDL/RunSQL.hs:50:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/BigQuery/Execute.hs:85:24-25
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!i
|
||||
server/src-lib/Hasura/Backends/BigQuery/Instances/Execute.hs:88:39-40
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!i
|
||||
server/src-lib/Hasura/Backends/BigQuery/Instances/Schema.hs:235:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/Backends/BigQuery/Source.hs:70:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/BigQuery/Types.hs
|
||||
@@ -509,22 +509,29 @@
|
||||
| LessOrEqualOp
|
||||
@ -96,405 +49,3 @@ server/src-lib/Hasura/Backends/BigQuery/Types.hs
|
||||
|
||||
Formatting is not idempotent.
|
||||
Please, consider reporting the bug.
|
||||
server/src-lib/Hasura/Backends/MSSQL/Connection.hs:53:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/MSSQL/DDL/RunSQL.hs:52:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/MSSQL/Instances/Schema.hs:242:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/Backends/MSSQL/Meta.hs:38:18
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/MSSQL/Types/Instances.hs:20:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/MySQL/Instances/Schema.hs:209:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/Backends/MySQL/Meta.hs:27:13
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/MySQL/SQL.hs:32:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/MySQL/Types/Instances.hs:23:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/Postgres/Connection.hs:259:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/Postgres/DDL/Source.hs:47:21
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/Postgres/DDL/Table.hs:171:8
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/Postgres/Instances/Schema.hs:170:28-29
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/Backends/Postgres/SQL/Error.hs:62:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/Postgres/SQL/Types.hs:497:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Backends/Postgres/Types/CitusExtraTableMetadata.hs:25:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Eventing/EventTrigger.hs:95:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Eventing/HTTP.hs:90:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Eventing/ScheduledTrigger/Types.hs:54:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Context.hs:30:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Execute/Action/Types.hs:64:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Execute/Inline.hs:70:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Execute/LiveQuery/Plan.hs:273:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Execute/LiveQuery/Poll.hs:241:27-36
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!respHashM
|
||||
server/src-lib/Hasura/GraphQL/Execute/LiveQuery/State.hs:117:7-17
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!subscriber
|
||||
server/src-lib/Hasura/GraphQL/Execute/LiveQuery/TMap.hs:36:8-9
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!v
|
||||
server/src-lib/Hasura/GraphQL/Explain.hs:44:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Parser/Internal/Parser.hs:172:26-27
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Parser/Internal/Scalars.hs:96:12-13
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/RemoteServer.hs:59:3
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Schema.hs:671:20-21
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/Action.hs:162:19-20
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/BoolExp.hs:41:30-31
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/Build.hs:45:42-43
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/Mutation.hs:58:22-23
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/OrderBy.hs:42:30-31
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/Remote.hs:987:30-31
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/Select.hs:239:41-42
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Schema/Table.hs:68:37-38
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/GraphQL/Transport/HTTP/Protocol.hs:76:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs:170:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Transport/WebSocket/Protocol.hs:37:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/GraphQL/Transport/WebSocket/Server.hs:76:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Incremental/Internal/Dependency.hs:111:21-27
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!access
|
||||
server/src-lib/Hasura/Incremental/Internal/Rule.hs:297:17-19
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!rs
|
||||
server/src-lib/Hasura/Logging.hs:191:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Prelude.hs:180:3-4
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!a
|
||||
Possibly caused by a missing 'do'?
|
||||
server/src-lib/Hasura/RQL/DDL/Action.hs:57:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs:30:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/DDL/RemoteRelationship/Validate.hs:484:28-29
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/RQL/DDL/RemoteSchema/Permission.hs:367:23-24
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/RQL/DDL/Schema.hs:50:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs:131:9-17
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!newCache
|
||||
server/src-lib/Hasura/RQL/DDL/Schema/Cache/Common.hs:37:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/DDL/Schema/Source.hs:72:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/DML/Types.hs:109:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/IR/BoolExp.hs:180:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/IR/Select.hs:529:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Action.hs:122:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/ApiLimit.hs:134:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Column.hs:60:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Common.hs:339:16-17
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/RQL/Types/ComputedField.hs:105:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/CustomTypes.hs:91:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Endpoint.hs:81:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/EventTrigger.hs:77:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Function.hs:31:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/GraphqlSchemaIntrospection.hs:18:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Metadata.hs:106:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Metadata/Object.hs:58:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Permission.hs:89:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/QueryCollection.hs:99:26-27
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/RQL/Types/QueryTags.hs:38:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Relationship.hs:25:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/RemoteRelationship.hs:253:18-31
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!scientificNum
|
||||
server/src-lib/Hasura/RQL/Types/RemoteSchema.hs:57:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Roles.hs:55:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/ScheduledTrigger.hs:88:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/SchemaCache.hs:255:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/SchemaCache/Build.hs:66:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/SchemaCacheTypes.hs:146:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Source.hs:35:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/RQL/Types/Table.hs:53:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/SQL/AnyBackend.hs:53:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/SQL/GeoJSON.hs:187:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/SQL/TH.hs:129:18
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/SQL/Tag.hs:27:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/SQL/Types.hs:46:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/API/Config.hs:29:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/API/Query.hs:164:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/API/V2Query.hs:53:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/App.hs:179:6-9
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!res
|
||||
Possibly caused by a missing 'do'?
|
||||
server/src-lib/Hasura/Server/Auth/JWT.hs:84:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/CheckUpdates.hs:35:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Cors.hs:38:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Init.hs:67:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Init/Config.hs:225:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Logging.hs:313:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Migrate.hs:235:5
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Migrate/Version.hs:22:3
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Rest.hs:70:31-32
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
server/src-lib/Hasura/Server/SchemaUpdate.hs:69:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Telemetry.hs:44:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-lib/Hasura/Server/Telemetry/Counters.hs:172:1
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$'
|
||||
Perhaps you intended to use TemplateHaskell
|
||||
server/src-test/Hasura/GraphQL/Schema/RemoteTest.hs:62:35-36
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
parse error on input `$$'
|
||||
|
@ -1,17 +0,0 @@
|
||||
src/Language/PureScript/Constants/Data/Generic/Rep.hs:6:1-22
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Invalid type signature: pattern DataGenericRep :: ...
|
||||
Perhaps you meant to use PatternSynonyms?
|
||||
src/Language/PureScript/Constants/Data/Newtype.hs:6:1-15
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Invalid type signature: pattern Newtype :: ...
|
||||
Perhaps you meant to use PatternSynonyms?
|
||||
src/Language/PureScript/Constants/Prelude.hs:42:1-15
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Invalid type signature: pattern Discard :: ...
|
||||
Perhaps you meant to use PatternSynonyms?
|
||||
src/Language/PureScript/Ide/State.hs:204:5-6
|
||||
The GHC parser (in Haddock mode) failed:
|
||||
Illegal bang-pattern (use BangPatterns):
|
||||
!r
|
||||
Possibly caused by a missing 'do'?
|
@ -32,7 +32,7 @@
|
||||
cp "$hs_file" "''${hs_file}-original"
|
||||
done
|
||||
|
||||
(ormolu --check-idempotence --mode inplace $hs_files || true) 2> log.txt
|
||||
(ormolu --cabal-default-extensions --check-idempotence --mode inplace $hs_files || true) 2> log.txt
|
||||
'';
|
||||
inherit doCheck;
|
||||
checkPhase =
|
||||
@ -46,8 +46,7 @@
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir "$out"
|
||||
find . -name '*.hs-original' -exec cp --parents {} $out \;
|
||||
find . -name '*.hs' -exec cp --parents {} $out \;
|
||||
find . \( -name '*.hs-original' -o -name '*.hs' -o -name '*.cabal' \) -exec cp --parents {} $out \;
|
||||
cp log.txt $out/log.txt
|
||||
'';
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ library
|
||||
Ormolu.Processing.Preprocess
|
||||
Ormolu.Terminal
|
||||
Ormolu.Utils
|
||||
Ormolu.Utils.Extensions
|
||||
Ormolu.Utils.IO
|
||||
|
||||
hs-source-dirs: src
|
||||
@ -92,7 +93,10 @@ library
|
||||
ghc-lib-parser >=9.0 && <9.1,
|
||||
mtl >=2.0 && <3.0,
|
||||
syb >=0.7 && <0.8,
|
||||
text >=0.2 && <1.3
|
||||
text >=0.2 && <1.3,
|
||||
filepath >=1.2 && <1.5,
|
||||
directory ^>=1.3,
|
||||
Cabal ^>=3.4
|
||||
|
||||
if flag(dev)
|
||||
ghc-options:
|
||||
@ -136,6 +140,7 @@ test-suite tests
|
||||
build-tool-depends: hspec-discover:hspec-discover >=2.0 && <3.0
|
||||
hs-source-dirs: tests
|
||||
other-modules:
|
||||
Ormolu.CabalExtensionsSpec
|
||||
Ormolu.Diff.TextSpec
|
||||
Ormolu.Parser.OptionsSpec
|
||||
Ormolu.Parser.PragmaSpec
|
||||
|
@ -32,6 +32,11 @@ data OrmoluException
|
||||
OrmoluNonIdempotentOutput TextDiff
|
||||
| -- | Some GHC options were not recognized
|
||||
OrmoluUnrecognizedOpts (NonEmpty String)
|
||||
| -- | Cabal file parsing failed
|
||||
OrmoluCabalFileParsingFailed FilePath
|
||||
| -- | Missing input file path when using stdin input and
|
||||
-- accounting for .cabal files
|
||||
OrmoluMissingStdinInputFile
|
||||
deriving (Eq, Show)
|
||||
|
||||
instance Exception OrmoluException
|
||||
@ -80,6 +85,16 @@ printOrmoluException = \case
|
||||
put " "
|
||||
(putS . unwords . NE.toList) opts
|
||||
newline
|
||||
OrmoluCabalFileParsingFailed cabalFile -> do
|
||||
put "Parsing this .cabal file failed:"
|
||||
newline
|
||||
put $ " " <> T.pack cabalFile
|
||||
newline
|
||||
OrmoluMissingStdinInputFile -> do
|
||||
put "The --stdin-input-file option is necessary when using input"
|
||||
newline
|
||||
put "from stdin and accounting for .cabal files"
|
||||
newline
|
||||
|
||||
-- | Inside this wrapper 'OrmoluException' will be caught and displayed
|
||||
-- nicely.
|
||||
@ -102,3 +117,5 @@ withPrettyOrmoluExceptions colorMode m = m `catch` h
|
||||
OrmoluASTDiffers {} -> 5
|
||||
OrmoluNonIdempotentOutput {} -> 6
|
||||
OrmoluUnrecognizedOpts {} -> 7
|
||||
OrmoluCabalFileParsingFailed {} -> 8
|
||||
OrmoluMissingStdinInputFile {} -> 9
|
||||
|
122
src/Ormolu/Utils/Extensions.hs
Normal file
122
src/Ormolu/Utils/Extensions.hs
Normal file
@ -0,0 +1,122 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
module Ormolu.Utils.Extensions
|
||||
( Extension (..),
|
||||
getExtensionsFromCabalFile,
|
||||
findCabalFile,
|
||||
getCabalExtensionDynOptions,
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Exception
|
||||
import Control.Monad.IO.Class
|
||||
import qualified Data.ByteString as B
|
||||
import Data.List (find)
|
||||
import Data.Map.Lazy (Map)
|
||||
import qualified Data.Map.Lazy as M
|
||||
import Data.Maybe (maybeToList)
|
||||
import qualified Distribution.ModuleName as ModuleName
|
||||
import Distribution.PackageDescription
|
||||
import Distribution.PackageDescription.Parsec
|
||||
import Language.Haskell.Extension
|
||||
import Ormolu.Config
|
||||
import Ormolu.Exception
|
||||
import System.Directory
|
||||
import System.FilePath
|
||||
import System.IO.Error (isDoesNotExistError)
|
||||
|
||||
-- | Get a map from Haskell source file paths (without any extensions)
|
||||
-- to its default language extensions
|
||||
getExtensionsFromCabalFile ::
|
||||
MonadIO m =>
|
||||
-- | Path to cabal file
|
||||
FilePath ->
|
||||
m (Map FilePath [DynOption])
|
||||
getExtensionsFromCabalFile cabalFile = liftIO $ do
|
||||
GenericPackageDescription {..} <-
|
||||
parseGenericPackageDescriptionMaybe <$> B.readFile cabalFile >>= \case
|
||||
Just gpd -> pure gpd
|
||||
Nothing -> throwIO $ OrmoluCabalFileParsingFailed cabalFile
|
||||
let lib = maybeToList condLibrary
|
||||
sublibs = snd <$> condSubLibraries
|
||||
pure . M.unions . concat $
|
||||
[ buildMap extractFromLibrary <$> lib ++ sublibs,
|
||||
buildMap extractFromExecutable . snd <$> condExecutables,
|
||||
buildMap extractFromTestSuite . snd <$> condTestSuites,
|
||||
buildMap extractFromBenchmark . snd <$> condBenchmarks
|
||||
]
|
||||
where
|
||||
buildMap f a = let (files, exts) = f (condTreeData a) in M.fromList $ (,exts) <$> files
|
||||
|
||||
extractFromBuildInfo extraModules BuildInfo {..} = (,exts) $ do
|
||||
m <- extraModules ++ (ModuleName.toFilePath <$> otherModules)
|
||||
(takeDirectory cabalFile </>) . (</> dropExtensions m) <$> hsSourceDirs
|
||||
where
|
||||
exts = maybe [] langExt defaultLanguage ++ fmap extToDynOption defaultExtensions
|
||||
langExt =
|
||||
pure . DynOption . \case
|
||||
Haskell98 -> "-XHaskell98"
|
||||
Haskell2010 -> "-XHaskell2010"
|
||||
UnknownLanguage lan -> "-X" ++ lan
|
||||
extToDynOption =
|
||||
DynOption . \case
|
||||
EnableExtension e -> "-X" ++ show e
|
||||
DisableExtension e -> "-XNo" ++ show e
|
||||
UnknownExtension e -> "-X" ++ e
|
||||
|
||||
extractFromLibrary Library {..} =
|
||||
extractFromBuildInfo (ModuleName.toFilePath <$> exposedModules) libBuildInfo
|
||||
extractFromExecutable Executable {..} =
|
||||
extractFromBuildInfo [modulePath] buildInfo
|
||||
extractFromTestSuite TestSuite {..} =
|
||||
extractFromBuildInfo mainPath testBuildInfo
|
||||
where
|
||||
mainPath = case testInterface of
|
||||
TestSuiteExeV10 _ p -> [p]
|
||||
TestSuiteLibV09 _ p -> [ModuleName.toFilePath p]
|
||||
TestSuiteUnsupported {} -> []
|
||||
extractFromBenchmark Benchmark {..} =
|
||||
extractFromBuildInfo mainPath benchmarkBuildInfo
|
||||
where
|
||||
mainPath = case benchmarkInterface of
|
||||
BenchmarkExeV10 _ p -> [p]
|
||||
BenchmarkUnsupported {} -> []
|
||||
|
||||
-- | Find the path to an appropriate .cabal file for a Haskell
|
||||
-- source file, if available
|
||||
findCabalFile ::
|
||||
MonadIO m =>
|
||||
-- | Absolute path to a Haskell source file in a project with a .cabal file
|
||||
FilePath ->
|
||||
m (Maybe FilePath)
|
||||
findCabalFile p = liftIO $ do
|
||||
let parentDir = takeDirectory p
|
||||
ps <-
|
||||
listDirectory parentDir `catch` \case
|
||||
(isDoesNotExistError -> True) -> pure []
|
||||
e -> throwIO e
|
||||
case find ((== ".cabal") . takeExtension) ps of
|
||||
Just cabalFile -> pure . Just $ parentDir </> cabalFile
|
||||
Nothing ->
|
||||
if isDrive parentDir
|
||||
then pure Nothing
|
||||
else findCabalFile parentDir
|
||||
|
||||
-- | Get the default language extensions of a Haskell source file.
|
||||
-- The .cabal file can be provided explicitly or auto-detected.
|
||||
getCabalExtensionDynOptions ::
|
||||
MonadIO m =>
|
||||
-- | Haskell source file
|
||||
FilePath ->
|
||||
m [DynOption]
|
||||
getCabalExtensionDynOptions sourceFile' = liftIO $ do
|
||||
sourceFile <- makeAbsolute sourceFile'
|
||||
mCabalFile <- findCabalFile sourceFile
|
||||
case mCabalFile of
|
||||
Just cabalFile -> do
|
||||
extsByFile <- getExtensionsFromCabalFile cabalFile
|
||||
pure $ M.findWithDefault [] (dropExtensions sourceFile) extsByFile
|
||||
Nothing -> pure []
|
27
tests/Ormolu/CabalExtensionsSpec.hs
Normal file
27
tests/Ormolu/CabalExtensionsSpec.hs
Normal file
@ -0,0 +1,27 @@
|
||||
module Ormolu.CabalExtensionsSpec (spec) where
|
||||
|
||||
import qualified Data.Map as M
|
||||
import Ormolu.Config
|
||||
import Ormolu.Utils.Extensions
|
||||
import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
spec = describe "Handle extensions from .cabal files" $ do
|
||||
it "extract extensions from .cabal files" $ do
|
||||
extsByFile <- getExtensionsFromCabalFile "ormolu.cabal"
|
||||
extsByFile `shouldNotSatisfy` M.null
|
||||
M.elems extsByFile `shouldSatisfy` all (== [DynOption "-XHaskell2010"])
|
||||
extsByFile
|
||||
`shouldSatisfy` members
|
||||
[ "./src/Ormolu",
|
||||
"./app/Main",
|
||||
"./tests/Spec"
|
||||
]
|
||||
it "find the .cabal file" $ do
|
||||
let findsOrmoluCabal start expectedCabalFile = do
|
||||
cabalFile <- findCabalFile start
|
||||
cabalFile `shouldBe` Just expectedCabalFile
|
||||
findsOrmoluCabal "src/Ormolu/Config.hs" "./ormolu.cabal"
|
||||
findsOrmoluCabal "a/b/c/d/e" "./ormolu.cabal"
|
||||
where
|
||||
members as m = all (`M.member` m) as
|
Loading…
Reference in New Issue
Block a user