Skip to content
Snippets Groups Projects
Commit 4c730f58 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel :man_dancing:
Browse files

Introduce `Distribution.Compat.Prelude.Internal` + WARNING

This unexposes `Distribution.Compat.Prelude` again, and adds
an exposed `.Internal` module which reexports the `.Prelude` module with
an attached module-level `WARNING` pragma.

This way users are discouraged to use this in `Setup.hs` files as they'd
see compile warning like:

    Foo.hs:19:1-55: warning: [-Wdeprecations]
      Module ‘Distribution.Compat.Prelude.Internal’:
        This modules' API is not stable. Use at your own risk, or better yet, use @base-compat@!

In `cabal-install` we import the `.Internal` module exactly once, and
use -Wno-deprecations to suppress that the warning of that single
import.
parent 81c2d4f7
No related merge requests found
......@@ -315,7 +315,7 @@ library
Distribution.Compat.Exception
Distribution.Compat.Graph
Distribution.Compat.Internal.TempFile
Distribution.Compat.Prelude
Distribution.Compat.Prelude.Internal
Distribution.Compat.ReadP
Distribution.Compat.Semigroup
Distribution.Compat.Stack
......@@ -419,6 +419,7 @@ library
Distribution.Compat.CopyFile
Distribution.Compat.GetShortPathName
Distribution.Compat.MonadFail
Distribution.Compat.Prelude
Distribution.GetOpt
Distribution.Lex
Distribution.Simple.GHC.Internal
......
-- | This module re-exports the non-exposed
-- "Distribution.Compat.Prelude" module for
-- reuse by @cabal-install@'s
-- "Distribution.Client.Compat.Prelude" module.
--
-- It is highly discouraged to rely on this module
-- for @Setup.hs@ scripts since its API is /not/
-- stable.
module Distribution.Compat.Prelude.Internal
{-# WARNING "This modules' API is not stable. Use at your own risk, or better yet, use @base-compat@!" #-}
( module Distribution.Compat.Prelude
) where
import Distribution.Compat.Prelude
{-# LANGUAGE CPP #-}
-- to suppress WARNING in "Distribution.Compat.Prelude.Internal"
{-# OPTIONS_GHC -fno-warn-deprecations #-}
-- | This module does two things:
--
-- * Acts as a compatiblity layer, like @base-compat@.
......@@ -10,13 +13,13 @@
-- this module re-exports)
--
module Distribution.Client.Compat.Prelude
( module Distribution.Compat.Prelude
( module Distribution.Compat.Prelude.Internal
, Prelude.IO
, readMaybe
) where
import Prelude (IO)
import Distribution.Compat.Prelude hiding (IO)
import Distribution.Compat.Prelude.Internal hiding (IO)
#if MIN_VERSION_base(4,6,0)
import Text.Read
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment