Skip to content

Revert "Avoid impredicativity in Distribution.Simple.PreProcess (#5836)" #6553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions Cabal/Distribution/Simple/PreProcess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ data PreProcessor = PreProcessor {
-- preprocessor's output name format.
type PreProcessorExtras = FilePath -> IO [FilePath]

-- | A newtype around 'PreProcessorExtras', useful for storing
-- 'PreProcessorExtras' inside of another type constructor (e.g., a list)
-- without impredicativity (recall that the 'IO' type, which is contained in
-- 'PreProcessorExtras', is a synonym for @'HasCallStack' => Prelude.IO@, which
-- is a polymorphic type).
newtype WrappedPreProcessorExtras = WrapPPE { unWrapPPE :: PreProcessorExtras }

mkSimplePreProcessor :: (FilePath -> FilePath -> Verbosity -> IO ())
-> (FilePath, FilePath)
Expand Down Expand Up @@ -701,8 +695,8 @@ knownSuffixHandlers =
]

-- |Standard preprocessors with possible extra C sources: c2hs, hsc2hs.
knownExtrasHandlers :: [ WrappedPreProcessorExtras ]
knownExtrasHandlers = [ WrapPPE ppC2hsExtras, WrapPPE ppHsc2hsExtras ]
knownExtrasHandlers :: [ PreProcessorExtras ]
knownExtrasHandlers = [ ppC2hsExtras, ppHsc2hsExtras ]

-- | Find any extra C sources generated by preprocessing that need to
-- be added to the component (addresses issue #238).
Expand Down Expand Up @@ -740,7 +734,7 @@ preprocessExtras verbosity comp lbi = case comp of
pp :: FilePath -> IO [FilePath]
pp dir = (map (dir </>) . filter not_sub . concat)
<$> for knownExtrasHandlers
(withLexicalCallStack (\f -> f dir) . unWrapPPE)
(withLexicalCallStack (\f -> f dir))
-- TODO: This is a terrible hack to work around #3545 while we don't
-- reorganize the directory layout. Basically, for the main
-- library, we might accidentally pick up autogenerated sources for
Expand Down