Teo Camarasu pushed to branch wip/T26834 at Glasgow Haskell Compiler / GHC Commits: fabb5297 by Teo Camarasu at 2026-01-27T09:28:31+00:00 ghc-internal: refine List imports - - - - - 87d4f2db by Teo Camarasu at 2026-01-27T09:28:31+00:00 Move MonadFix Identity into Monad.Fix - - - - - 16 changed files: - libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs - libraries/ghc-internal/src/GHC/Internal/Control/Monad/Zip.hs - libraries/ghc-internal/src/GHC/Internal/Data/Data.hs - libraries/ghc-internal/src/GHC/Internal/Data/Functor/Identity.hs - libraries/ghc-internal/src/GHC/Internal/Data/List/NonEmpty.hs - libraries/ghc-internal/src/GHC/Internal/Data/String.hs - libraries/ghc-internal/src/GHC/Internal/Data/Version.hs - libraries/ghc-internal/src/GHC/Internal/Event/Windows.hsc - libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc - libraries/ghc-internal/src/GHC/Internal/IO/Encoding/CodePage.hs - libraries/ghc-internal/src/GHC/Internal/ResponseFile.hs - libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs - libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc - libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc - libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs - libraries/ghc-internal/src/GHC/Internal/Windows.hs Changes: ===================================== libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs ===================================== @@ -40,6 +40,7 @@ import GHC.Internal.Generics import GHC.Internal.List ( head, drop ) import GHC.Internal.Control.Monad.ST.Imp import GHC.Internal.System.IO +import GHC.Internal.Data.Functor.Identity (Identity(..)) -- | Monads having fixed points with a \'knot-tying\' semantics. -- Instances of 'MonadFix' should satisfy the following laws: @@ -171,3 +172,8 @@ instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where -- | @since base-4.12.0.0 instance MonadFix Down where mfix f = Down (fix (getDown . f)) + + +-- | @since base-4.8.0.0 +instance MonadFix Identity where + mfix f = Identity (fix (runIdentity . f)) ===================================== libraries/ghc-internal/src/GHC/Internal/Control/Monad/Zip.hs ===================================== @@ -28,7 +28,7 @@ import GHC.Internal.Data.Proxy --import qualified Data.List.NonEmpty as NE import GHC.Internal.Generics import qualified GHC.Internal.Data.List.NonEmpty as NE -import qualified GHC.Internal.Data.List as List +import qualified GHC.Internal.List as List import GHC.Internal.Data.Maybe import GHC.Internal.Data.Tuple --import Prelude ===================================== libraries/ghc-internal/src/GHC/Internal/Data/Data.hs ===================================== @@ -117,7 +117,7 @@ import GHC.Internal.Data.Maybe import GHC.Internal.Data.Monoid import GHC.Internal.Data.NonEmpty ( NonEmpty(..) ) import GHC.Internal.Data.Ord -import GHC.Internal.Data.List (findIndex) +import GHC.Internal.Data.OldList (findIndex) import GHC.Internal.Data.Typeable import GHC.Internal.Data.Version( Version(..) ) import GHC.Internal.Base hiding (Any, IntRep, FloatRep, NonEmpty(..)) ===================================== libraries/ghc-internal/src/GHC/Internal/Data/Functor/Identity.hs ===================================== @@ -33,7 +33,6 @@ module GHC.Internal.Data.Functor.Identity ( Identity(..), ) where -import GHC.Internal.Control.Monad.Fix import GHC.Internal.Data.Bits (Bits, FiniteBits) import GHC.Internal.Data.Coerce import GHC.Internal.Data.Foldable @@ -143,7 +142,3 @@ instance Applicative Identity where -- | @since base-4.8.0.0 instance Monad Identity where m >>= k = k (runIdentity m) - --- | @since base-4.8.0.0 -instance MonadFix Identity where - mfix f = Identity (fix (runIdentity . f)) ===================================== libraries/ghc-internal/src/GHC/Internal/Data/List/NonEmpty.hs ===================================== @@ -8,7 +8,7 @@ module GHC.Internal.Data.List.NonEmpty ) where import GHC.Internal.Data.NonEmpty (NonEmpty (..), map) -import qualified GHC.Internal.Data.List as List +import qualified GHC.Internal.List as List -- | The 'zip' function takes two streams and returns a stream of -- corresponding pairs. ===================================== libraries/ghc-internal/src/GHC/Internal/Data/String.hs ===================================== @@ -35,7 +35,7 @@ module GHC.Internal.Data.String ( import GHC.Internal.Base import GHC.Internal.Data.Functor.Const (Const (Const)) import GHC.Internal.Data.Functor.Identity (Identity (Identity)) -import GHC.Internal.Data.List (lines, words, unlines, unwords) +import GHC.Internal.Data.OldList (lines, words, unlines, unwords) -- | `IsString` is used in combination with the @-XOverloadedStrings@ -- language extension to convert the literals to different string types. ===================================== libraries/ghc-internal/src/GHC/Internal/Data/Version.hs ===================================== @@ -40,7 +40,7 @@ import GHC.Internal.Data.Functor ( Functor(..) ) import GHC.Internal.Data.Bool ( (&&) ) import GHC.Internal.Data.Eq import GHC.Internal.Int ( Int ) -import GHC.Internal.Data.List ( map, sort, concat, concatMap, intersperse, (++) ) +import GHC.Internal.Data.OldList ( map, sort, concat, concatMap, intersperse, (++) ) import GHC.Internal.Data.Ord import GHC.Internal.Data.String ( String ) import GHC.Internal.Base ( Applicative(..) ) ===================================== libraries/ghc-internal/src/GHC/Internal/Event/Windows.hsc ===================================== @@ -103,7 +103,7 @@ import GHC.Internal.IORef import GHC.Internal.Maybe import GHC.Internal.Ptr import GHC.Internal.Word -import GHC.Internal.Data.OldList (deleteBy) +import GHC.Internal.List (deleteBy) import qualified GHC.Internal.Event.Array as A import GHC.Internal.Base import GHC.Internal.Conc.Bound ===================================== libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc ===================================== @@ -39,7 +39,7 @@ module GHC.Internal.ExecutionStack.Internal ( import GHC.Internal.Data.Functor import GHC.Internal.Data.Maybe -import GHC.Internal.Data.List (reverse, null) +import GHC.Internal.List (reverse, null) import GHC.Internal.Word import GHC.Internal.Foreign.C.Types import GHC.Internal.Foreign.C.String (peekCString, CString) ===================================== libraries/ghc-internal/src/GHC/Internal/IO/Encoding/CodePage.hs ===================================== @@ -30,7 +30,7 @@ import GHC.Internal.IO.Encoding.Types import GHC.Internal.IO.Buffer import GHC.Internal.Data.Bits import GHC.Internal.Data.Maybe -import GHC.Internal.Data.OldList (lookup) +import GHC.Internal.List (lookup) import qualified GHC.Internal.IO.Encoding.CodePage.API as API import GHC.Internal.IO.Encoding.CodePage.Table ===================================== libraries/ghc-internal/src/GHC/Internal/ResponseFile.hs ===================================== @@ -28,7 +28,7 @@ import GHC.Internal.Control.Exception import GHC.Internal.Data.Foldable (Foldable(..)) import GHC.Internal.Base import GHC.Internal.Unicode (isSpace) -import GHC.Internal.Data.List (filter, unlines, concat, reverse) +import GHC.Internal.Data.OldList (filter, unlines, concat, reverse) import GHC.Internal.Text.Show (show) import GHC.Internal.System.Environment (getArgs) import GHC.Internal.System.Exit (exitFailure) ===================================== libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs ===================================== @@ -36,7 +36,7 @@ import GHC.Internal.Num import GHC.Internal.Data.Bits import GHC.Internal.Data.Functor import GHC.Internal.Data.Maybe (catMaybes) -import GHC.Internal.Data.List +import GHC.Internal.List import GHC.Internal.Data.Tuple import GHC.Internal.Foreign.Ptr import GHC.Internal.Foreign.Storable ===================================== libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc ===================================== @@ -40,14 +40,14 @@ module GHC.Internal.System.Environment.Blank ) where import GHC.Internal.Data.Functor -import GHC.Internal.Data.List (elem, null, takeWhile) +import GHC.Internal.List (elem, null, takeWhile) import GHC.Internal.Foreign.C.String import GHC.Internal.Base #if defined(mingw32_HOST_OS) import GHC.Internal.Foreign.Ptr import GHC.Internal.Windows import GHC.Internal.Control.Monad -import GHC.Internal.Data.List (lookup) +import GHC.Internal.List (lookup) #else import GHC.Internal.Foreign.C.Error import GHC.Internal.Foreign.C.Types ===================================== libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc ===================================== @@ -53,7 +53,7 @@ import GHC.Internal.System.IO.Error (isDoesNotExistError) import GHC.Internal.System.Posix.Internals #elif defined(linux_HOST_OS) || defined(gnu_HOST_OS) import GHC.Internal.Data.Functor -import GHC.Internal.Data.List (isSuffixOf) +import GHC.Internal.Data.OldList (isSuffixOf) import GHC.Internal.Foreign.C.Types import GHC.Internal.Foreign.C.Error import GHC.Internal.Foreign.C.String @@ -85,7 +85,7 @@ import GHC.Internal.System.Posix.Internals import GHC.Internal.Control.Exception import GHC.Internal.Control.Monad.Fail import GHC.Internal.Data.Functor -import GHC.Internal.Data.List (isPrefixOf, drop) +import GHC.Internal.Data.OldList (isPrefixOf, drop) import GHC.Internal.Word import GHC.Internal.Foreign.C.String import GHC.Internal.Foreign.Marshal.Array ===================================== libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs ===================================== @@ -70,7 +70,7 @@ import GHC.Internal.Foreign.Storable import qualified GHC.Internal.Foreign.C.String.Encoding as GHC #else import GHC.Internal.Int -import GHC.Internal.Data.OldList (elem) +import GHC.Internal.List (elem) #endif -- --------------------------------------------------------------------------- ===================================== libraries/ghc-internal/src/GHC/Internal/Windows.hs ===================================== @@ -80,7 +80,7 @@ module GHC.Internal.Windows ( import GHC.Internal.Data.Bits (finiteBitSize, shiftL, shiftR, (.|.), (.&.)) import GHC.Internal.Unicode (isSpace) -import GHC.Internal.Data.OldList +import GHC.Internal.List import GHC.Internal.Data.Maybe import GHC.Internal.Word import GHC.Internal.Int View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2a1f0bdcfc782163b20cb5ce6d5c914... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2a1f0bdcfc782163b20cb5ce6d5c914... You're receiving this email because of your account on gitlab.haskell.org.