-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | The GHC API
--
-- GHC's functionality can be useful for more things than just compiling
-- Haskell programs. Important use cases are programs that analyse (and
-- perhaps transform) Haskell code. Others include loading Haskell code
-- dynamically in a GHCi-like manner. For this reason, a lot of GHC's
-- functionality is made available through this package.
@package ghc
@version 8.2.2
module Config
data IntegerLibrary
IntegerGMP :: IntegerLibrary
IntegerSimple :: IntegerLibrary
cBuildPlatformString :: String
cHostPlatformString :: String
cTargetPlatformString :: String
cProjectName :: String
cProjectGitCommitId :: String
cProjectVersion :: String
cProjectVersionInt :: String
cProjectPatchLevel :: String
cProjectPatchLevel1 :: String
cProjectPatchLevel2 :: String
cBooterVersion :: String
cStage :: String
cIntegerLibrary :: String
cIntegerLibraryType :: IntegerLibrary
cSupportsSplitObjs :: String
cGhcWithInterpreter :: String
cGhcWithNativeCodeGen :: String
cGhcWithSMP :: String
cGhcRTSWays :: String
cGhcRtsWithLibdw :: Bool
cGhcEnableTablesNextToCode :: String
cLeadingUnderscore :: String
cGHC_UNLIT_PGM :: String
cGHC_SPLIT_PGM :: String
cLibFFI :: Bool
cGhcThreaded :: Bool
cGhcDebugged :: Bool
instance GHC.Classes.Eq Config.IntegerLibrary
module Constants
hiVersion :: Integer
mAX_TUPLE_SIZE :: Int
mAX_CTUPLE_SIZE :: Int
mAX_SUM_SIZE :: Int
-- | Default maximum depth for both class instance search and type family
-- reduction. See also Trac #5395.
mAX_REDUCTION_DEPTH :: Int
-- | Default maximum constraint-solver iterations Typically there should be
-- very few
mAX_SOLVER_ITERATIONS :: Int
wORD64_SIZE :: Int
tARGET_MAX_CHAR :: Int
module Encoding
utf8DecodeChar# :: Addr# -> (# Char#, Int# #)
utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)
utf8CharStart :: Ptr Word8 -> IO (Ptr Word8)
utf8DecodeChar :: Ptr Word8 -> (Char, Int)
utf8DecodeByteString :: ByteString -> [Char]
utf8DecodeStringLazy :: ForeignPtr Word8 -> Int -> Int -> [Char]
utf8EncodeChar :: Char -> Ptr Word8 -> IO (Ptr Word8)
utf8EncodeString :: Ptr Word8 -> String -> IO ()
utf8EncodedLength :: String -> Int
countUTF8Chars :: Ptr Word8 -> Int -> IO Int
zEncodeString :: UserString -> EncodedString
zDecodeString :: EncodedString -> UserString
toBase62 :: Word64 -> String
-- | Converts a 64-bit word into a base-62 string
toBase62Padded :: Word64 -> String
module Exception
catchIO :: IO a -> (IOException -> IO a) -> IO a
handleIO :: (IOException -> IO a) -> IO a -> IO a
tryIO :: IO a -> IO (Either IOException a)
-- | A monad that can catch exceptions. A minimal definition requires a
-- definition of gcatch.
--
-- Implementations on top of IO should implement gmask to
-- eventually call the primitive mask. These are used for
-- implementations that support asynchronous exceptions. The default
-- implementations of gbracket and gfinally use
-- gmask thus rarely require overriding.
class MonadIO m => ExceptionMonad m
-- | Generalised version of catch, allowing an arbitrary exception
-- handling monad instead of just IO.
gcatch :: (ExceptionMonad m, Exception e) => m a -> (e -> m a) -> m a
-- | Generalised version of mask_, allowing an arbitrary exception
-- handling monad instead of just IO.
gmask :: ExceptionMonad m => ((m a -> m a) -> m b) -> m b
-- | Generalised version of bracket, allowing an arbitrary exception
-- handling monad instead of just IO.
gbracket :: ExceptionMonad m => m a -> (a -> m b) -> (a -> m c) -> m c
-- | Generalised version of finally, allowing an arbitrary exception
-- handling monad instead of just IO.
gfinally :: ExceptionMonad m => m a -> m b -> m a
gtry :: (ExceptionMonad m, Exception e) => m a -> m (Either e a)
-- | Generalised version of handle, allowing an arbitrary exception
-- handling monad instead of just IO.
ghandle :: (ExceptionMonad m, Exception e) => (e -> m a) -> m a -> m a
-- | Always executes the first argument. If this throws an exception the
-- second argument is executed and the exception is raised again.
gonException :: (ExceptionMonad m) => m a -> m b -> m a
instance Exception.ExceptionMonad GHC.Types.IO
module FastFunctions
inlinePerformIO :: IO a -> a
module FastMutInt
data FastMutInt
newFastMutInt :: IO FastMutInt
readFastMutInt :: FastMutInt -> IO Int
writeFastMutInt :: FastMutInt -> Int -> IO ()
data FastMutPtr
newFastMutPtr :: IO FastMutPtr
readFastMutPtr :: FastMutPtr -> IO (Ptr a)
writeFastMutPtr :: FastMutPtr -> Ptr a -> IO ()
module Fingerprint
readHexFingerprint :: String -> Fingerprint
fingerprintByteString :: ByteString -> Fingerprint
data Fingerprint :: *
Fingerprint :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> Fingerprint
fingerprint0 :: Fingerprint
fingerprintFingerprints :: [Fingerprint] -> Fingerprint
fingerprintData :: Ptr Word8 -> Int -> IO Fingerprint
fingerprintString :: String -> Fingerprint
-- | Computes the hash of a given file. This function loops over the
-- handle, running in constant memory.
getFileHash :: FilePath -> IO Fingerprint
module FiniteMap
insertList :: Ord key => [(key, elt)] -> Map key elt -> Map key elt
insertListWith :: Ord key => (elt -> elt -> elt) -> [(key, elt)] -> Map key elt -> Map key elt
deleteList :: Ord key => [key] -> Map key elt -> Map key elt
foldRight :: (elt -> a -> a) -> a -> Map key elt -> a
foldRightWithKey :: (key -> elt -> a -> a) -> a -> Map key elt -> a
-- | A backtracking, logic programming monad.
--
-- Adapted from the paper /Backtracking, Interleaving, and Terminating
-- Monad Transformers/, by Oleg Kiselyov, Chung-chieh Shan, Daniel P.
-- Friedman, Amr Sabry
-- (http://www.cs.rutgers.edu/~ccshan/logicprog/ListT-icfp2005.pdf).
module ListT
-- | A monad transformer for performing backtracking computations layered
-- over another monad m
newtype ListT m a
ListT :: (forall r. (a -> m r -> m r) -> m r -> m r) -> ListT m a
[unListT] :: ListT m a -> forall r. (a -> m r -> m r) -> m r -> m r
-- | Runs a ListT computation with the specified initial success and
-- failure continuations.
runListT :: ListT m a -> (a -> m r -> m r) -> m r -> m r
select :: Monad m => [a] -> ListT m a
fold :: ListT m a -> (a -> m r -> m r) -> m r -> m r
instance GHC.Base.Functor (ListT.ListT f)
instance GHC.Base.Applicative (ListT.ListT f)
instance GHC.Base.Alternative (ListT.ListT f)
instance GHC.Base.Monad (ListT.ListT m)
instance GHC.Base.MonadPlus (ListT.ListT m)
module Panic
-- | GHC's own exception type error messages all take the form:
--
--
-- location: error
--
--
--
-- If the location is on the command line, or in GHC itself, then
-- location="ghc". All of the error types below correspond to a
-- location of "ghc", except for ProgramError (where the string is
-- assumed to contain a location already, so we don't print one).
data GhcException
-- | Some other fatal signal (SIGHUP,SIGTERM)
Signal :: Int -> GhcException
-- | Prints the short usage msg after the error
UsageError :: String -> GhcException
-- | A problem with the command line arguments, but don't print usage.
CmdLineError :: String -> GhcException
-- | The impossible happened.
Panic :: String -> GhcException
PprPanic :: String -> SDoc -> GhcException
-- | The user tickled something that's known not to work yet, but we're not
-- counting it as a bug.
Sorry :: String -> GhcException
PprSorry :: String -> SDoc -> GhcException
-- | An installation problem.
InstallationError :: String -> GhcException
-- | An error in the user's code, probably.
ProgramError :: String -> GhcException
PprProgramError :: String -> SDoc -> GhcException
-- | Append a description of the given exception to this string.
--
-- Note that this uses unsafeGlobalDynFlags, which may have some
-- uninitialized fields if invoked before initGhcMonad has been
-- called. If the error message to be printed includes a pretty-printer
-- document which forces one of these fields this call may bottom.
showGhcException :: GhcException -> ShowS
throwGhcException :: GhcException -> a
throwGhcExceptionIO :: GhcException -> IO a
handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a
-- | The name of this GHC.
progName :: String
-- | Panics and asserts.
pgmError :: String -> a
-- | Panics and asserts.
panic :: String -> a
-- | Panics and asserts.
sorry :: String -> a
-- | Throw an failed assertion exception for a given filename and line
-- number.
assertPanic :: String -> Int -> a
-- | The trace function outputs the trace message given as its first
-- argument, before returning the second argument as its result.
--
-- For example, this returns the value of f x but first outputs
-- the message.
--
--
-- trace ("calling f with x = " ++ show x) (f x)
--
--
-- The trace function should only be used for debugging, or
-- for monitoring execution. The function is not referentially
-- transparent: its type indicates that it is a pure function but it has
-- the side effect of outputting the trace message.
trace :: () => String -> a -> a
panicDoc :: String -> SDoc -> a
sorryDoc :: String -> SDoc -> a
pgmErrorDoc :: String -> SDoc -> a
-- | Any type that you wish to throw or catch as an exception must be an
-- instance of the Exception class. The simplest case is a new
-- exception type directly below the root:
--
--
-- data MyException = ThisException | ThatException
-- deriving Show
--
-- instance Exception MyException
--
--
-- The default method definitions in the Exception class do what
-- we need in this case. You can now throw and catch
-- ThisException and ThatException as exceptions:
--
--
-- *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
-- Caught ThisException
--
--
-- In more complicated examples, you may wish to define a whole hierarchy
-- of exceptions:
--
--
-- ---------------------------------------------------------------------
-- -- Make the root exception type for all the exceptions in a compiler
--
-- data SomeCompilerException = forall e . Exception e => SomeCompilerException e
--
-- instance Show SomeCompilerException where
-- show (SomeCompilerException e) = show e
--
-- instance Exception SomeCompilerException
--
-- compilerExceptionToException :: Exception e => e -> SomeException
-- compilerExceptionToException = toException . SomeCompilerException
--
-- compilerExceptionFromException :: Exception e => SomeException -> Maybe e
-- compilerExceptionFromException x = do
-- SomeCompilerException a <- fromException x
-- cast a
--
-- ---------------------------------------------------------------------
-- -- Make a subhierarchy for exceptions in the frontend of the compiler
--
-- data SomeFrontendException = forall e . Exception e => SomeFrontendException e
--
-- instance Show SomeFrontendException where
-- show (SomeFrontendException e) = show e
--
-- instance Exception SomeFrontendException where
-- toException = compilerExceptionToException
-- fromException = compilerExceptionFromException
--
-- frontendExceptionToException :: Exception e => e -> SomeException
-- frontendExceptionToException = toException . SomeFrontendException
--
-- frontendExceptionFromException :: Exception e => SomeException -> Maybe e
-- frontendExceptionFromException x = do
-- SomeFrontendException a <- fromException x
-- cast a
--
-- ---------------------------------------------------------------------
-- -- Make an exception type for a particular frontend compiler exception
--
-- data MismatchedParentheses = MismatchedParentheses
-- deriving Show
--
-- instance Exception MismatchedParentheses where
-- toException = frontendExceptionToException
-- fromException = frontendExceptionFromException
--
--
-- We can now catch a MismatchedParentheses exception as
-- MismatchedParentheses, SomeFrontendException or
-- SomeCompilerException, but not other types, e.g.
-- IOException:
--
--
-- *Main> throw MismatchedParentheses catch e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses catch e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses catch e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses catch e -> putStrLn ("Caught " ++ show (e :: IOException))
-- *** Exception: MismatchedParentheses
--
class (Typeable * e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e
-- | Render this exception value in a human-friendly manner.
--
-- Default implementation: show.
displayException :: Exception e => e -> String
-- | Show an exception as a string.
showException :: Exception e => e -> String
-- | Show an exception which can possibly throw other exceptions. Used when
-- displaying exception thrown within TH code.
safeShowException :: Exception e => e -> IO String
-- | Similar to catch, but returns an Either result which is
-- (Right a) if no exception of type e was
-- raised, or (Left ex) if an exception of type
-- e was raised and its value is ex. If any other type
-- of exception is raised than it will be propogated up to the next
-- enclosing exception handler.
--
--
-- try a = catch (Right `liftM` a) (return . Left)
--
try :: Exception e => IO a -> IO Either e a
-- | Like try, but pass through UserInterrupt and Panic exceptions. Used
-- when we want soft failures when reading interface files, for example.
-- TODO: I'm not entirely sure if this is catching what we really want to
-- catch
tryMost :: IO a -> IO (Either SomeException a)
-- | throwTo raises an arbitrary exception in the target thread (GHC
-- only).
--
-- Exception delivery synchronizes between the source and target thread:
-- throwTo does not return until the exception has been raised in
-- the target thread. The calling thread can thus be certain that the
-- target thread has received the exception. Exception delivery is also
-- atomic with respect to other exceptions. Atomicity is a useful
-- property to have when dealing with race conditions: e.g. if there are
-- two threads that can kill each other, it is guaranteed that only one
-- of the threads will get to kill the other.
--
-- Whatever work the target thread was doing when the exception was
-- raised is not lost: the computation is suspended until required by
-- another thread.
--
-- If the target thread is currently making a foreign call, then the
-- exception will not be raised (and hence throwTo will not
-- return) until the call has completed. This is the case regardless of
-- whether the call is inside a mask or not. However, in GHC a
-- foreign call can be annotated as interruptible, in which case
-- a throwTo will cause the RTS to attempt to cause the call to
-- return; see the GHC documentation for more details.
--
-- Important note: the behaviour of throwTo differs from that
-- described in the paper "Asynchronous exceptions in Haskell"
-- (http://research.microsoft.com/~simonpj/Papers/asynch-exns.htm).
-- In the paper, throwTo is non-blocking; but the library
-- implementation adopts a more synchronous design in which
-- throwTo does not return until the exception is received by the
-- target thread. The trade-off is discussed in Section 9 of the paper.
-- Like any blocking operation, throwTo is therefore interruptible
-- (see Section 5.3 of the paper). Unlike other interruptible operations,
-- however, throwTo is always interruptible, even if it
-- does not actually block.
--
-- There is no guarantee that the exception will be delivered promptly,
-- although the runtime will endeavour to ensure that arbitrary delays
-- don't occur. In GHC, an exception can only be raised when a thread
-- reaches a safe point, where a safe point is where memory
-- allocation occurs. Some loops do not perform any memory allocation
-- inside the loop and therefore cannot be interrupted by a
-- throwTo.
--
-- If the target of throwTo is the calling thread, then the
-- behaviour is the same as throwIO, except that the exception is
-- thrown as an asynchronous exception. This means that if there is an
-- enclosing pure computation, which would be the case if the current IO
-- operation is inside unsafePerformIO or
-- unsafeInterleaveIO, that computation is not permanently
-- replaced by the exception, but is suspended as if it had received an
-- asynchronous exception.
--
-- Note that if throwTo is called with the current thread as the
-- target, the exception will be thrown even if the thread is currently
-- inside mask or uninterruptibleMask.
throwTo :: Exception e => ThreadId -> e -> IO ()
-- | Temporarily install standard signal handlers for catching ^C, which
-- just throw an exception in the current thread.
withSignalHandlers :: (ExceptionMonad m, MonadIO m) => m a -> m a
instance GHC.Exception.Exception Panic.GhcException
instance GHC.Show.Show Panic.GhcException
module PPC.Cond
data Cond
ALWAYS :: Cond
EQQ :: Cond
GE :: Cond
GEU :: Cond
GTT :: Cond
GU :: Cond
LE :: Cond
LEU :: Cond
LTT :: Cond
LU :: Cond
NE :: Cond
condNegate :: Cond -> Cond
condUnsigned :: Cond -> Bool
condToSigned :: Cond -> Cond
condToUnsigned :: Cond -> Cond
instance GHC.Classes.Eq PPC.Cond.Cond
module Ctype
is_ident :: Char -> Bool
is_symbol :: Char -> Bool
is_any :: Char -> Bool
is_space :: Char -> Bool
is_lower :: Char -> Bool
is_upper :: Char -> Bool
is_digit :: Char -> Bool
is_alphanum :: Char -> Bool
is_decdigit :: Char -> Bool
is_hexdigit :: Char -> Bool
is_octdigit :: Char -> Bool
is_bindigit :: Char -> Bool
hexDigit :: Char -> Int
octDecDigit :: Char -> Int
-- | A description of the platform we're compiling for.
module Platform
-- | Contains enough information for the native code generator to emit code
-- for this platform.
data Platform
Platform :: Arch -> OS -> {-# UNPACK #-} !Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Platform
[platformArch] :: Platform -> Arch
[platformOS] :: Platform -> OS
[platformWordSize] :: Platform -> {-# UNPACK #-} !Int
[platformUnregisterised] :: Platform -> Bool
[platformHasGnuNonexecStack] :: Platform -> Bool
[platformHasIdentDirective] :: Platform -> Bool
[platformHasSubsectionsViaSymbols] :: Platform -> Bool
[platformIsCrossCompiling] :: Platform -> Bool
-- | Architectures that the native code generator knows about. TODO: It
-- might be nice to extend these constructors with information about what
-- instruction set extensions an architecture might support.
data Arch
ArchUnknown :: Arch
ArchX86 :: Arch
ArchX86_64 :: Arch
ArchPPC :: Arch
ArchPPC_64 :: PPC_64ABI -> Arch
[ppc_64ABI] :: Arch -> PPC_64ABI
ArchSPARC :: Arch
ArchSPARC64 :: Arch
ArchARM :: ArmISA -> [ArmISAExt] -> ArmABI -> Arch
[armISA] :: Arch -> ArmISA
[armISAExt] :: Arch -> [ArmISAExt]
[armABI] :: Arch -> ArmABI
ArchARM64 :: Arch
ArchAlpha :: Arch
ArchMipseb :: Arch
ArchMipsel :: Arch
ArchJavaScript :: Arch
-- | Operating systems that the native code generator knows about. Having
-- OSUnknown should produce a sensible default, but no promises.
data OS
OSUnknown :: OS
OSLinux :: OS
OSDarwin :: OS
OSiOS :: OS
OSSolaris2 :: OS
OSMinGW32 :: OS
OSFreeBSD :: OS
OSDragonFly :: OS
OSOpenBSD :: OS
OSNetBSD :: OS
OSKFreeBSD :: OS
OSHaiku :: OS
OSQNXNTO :: OS
OSAndroid :: OS
OSAIX :: OS
-- | ARM Instruction Set Architecture, Extensions and ABI
data ArmISA
ARMv5 :: ArmISA
ARMv6 :: ArmISA
ARMv7 :: ArmISA
data ArmISAExt
VFPv2 :: ArmISAExt
VFPv3 :: ArmISAExt
VFPv3D16 :: ArmISAExt
NEON :: ArmISAExt
IWMMX2 :: ArmISAExt
data ArmABI
SOFT :: ArmABI
SOFTFP :: ArmABI
HARD :: ArmABI
-- | PowerPC 64-bit ABI
data PPC_64ABI
ELF_V1 :: PPC_64ABI
ELF_V2 :: PPC_64ABI
-- | This predicate tells us whether the platform is 32-bit.
target32Bit :: Platform -> Bool
isARM :: Arch -> Bool
-- | This predicate tells us whether the OS supports ELF-like shared
-- libraries.
osElfTarget :: OS -> Bool
-- | This predicate tells us whether the OS support Mach-O shared
-- libraries.
osMachOTarget :: OS -> Bool
osSubsectionsViaSymbols :: OS -> Bool
platformUsesFrameworks :: Platform -> Bool
platformBinariesAreStaticLibs :: Platform -> Bool
instance GHC.Classes.Eq Platform.Platform
instance GHC.Show.Show Platform.Platform
instance GHC.Read.Read Platform.Platform
instance GHC.Classes.Eq Platform.Arch
instance GHC.Show.Show Platform.Arch
instance GHC.Read.Read Platform.Arch
instance GHC.Classes.Eq Platform.PPC_64ABI
instance GHC.Show.Show Platform.PPC_64ABI
instance GHC.Read.Read Platform.PPC_64ABI
instance GHC.Classes.Eq Platform.ArmABI
instance GHC.Show.Show Platform.ArmABI
instance GHC.Read.Read Platform.ArmABI
instance GHC.Classes.Eq Platform.ArmISAExt
instance GHC.Show.Show Platform.ArmISAExt
instance GHC.Read.Read Platform.ArmISAExt
instance GHC.Classes.Eq Platform.ArmISA
instance GHC.Show.Show Platform.ArmISA
instance GHC.Read.Read Platform.ArmISA
instance GHC.Classes.Eq Platform.OS
instance GHC.Show.Show Platform.OS
instance GHC.Read.Read Platform.OS
-- | Platform constants
--
-- (c) The University of Glasgow 2013
module PlatformConstants
data PlatformConstants
PlatformConstants :: () -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Int -> Integer -> Integer -> Integer -> PlatformConstants
[pc_platformConstants] :: PlatformConstants -> ()
[pc_CONTROL_GROUP_CONST_291] :: PlatformConstants -> Int
[pc_STD_HDR_SIZE] :: PlatformConstants -> Int
[pc_PROF_HDR_SIZE] :: PlatformConstants -> Int
[pc_BLOCK_SIZE] :: PlatformConstants -> Int
[pc_BLOCKS_PER_MBLOCK] :: PlatformConstants -> Int
[pc_TICKY_BIN_COUNT] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR7] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR8] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR9] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR10] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rL1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rSp] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rSpLim] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rHp] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rHpLim] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rCCCS] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rCurrentTSO] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rCurrentNursery] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rHpAlloc] :: PlatformConstants -> Int
[pc_OFFSET_stgEagerBlackholeInfo] :: PlatformConstants -> Int
[pc_OFFSET_stgGCEnter1] :: PlatformConstants -> Int
[pc_OFFSET_stgGCFun] :: PlatformConstants -> Int
[pc_OFFSET_Capability_r] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_start] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_free] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_blocks] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_flags] :: PlatformConstants -> Int
[pc_SIZEOF_CostCentreStack] :: PlatformConstants -> Int
[pc_OFFSET_CostCentreStack_mem_alloc] :: PlatformConstants -> Int
[pc_REP_CostCentreStack_mem_alloc] :: PlatformConstants -> Int
[pc_OFFSET_CostCentreStack_scc_count] :: PlatformConstants -> Int
[pc_REP_CostCentreStack_scc_count] :: PlatformConstants -> Int
[pc_OFFSET_StgHeader_ccs] :: PlatformConstants -> Int
[pc_OFFSET_StgHeader_ldvw] :: PlatformConstants -> Int
[pc_SIZEOF_StgSMPThunkHeader] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_allocs] :: PlatformConstants -> Int
[pc_REP_StgEntCounter_allocs] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_allocd] :: PlatformConstants -> Int
[pc_REP_StgEntCounter_allocd] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_registeredp] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_link] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_entry_count] :: PlatformConstants -> Int
[pc_SIZEOF_StgUpdateFrame_NoHdr] :: PlatformConstants -> Int
[pc_SIZEOF_StgMutArrPtrs_NoHdr] :: PlatformConstants -> Int
[pc_OFFSET_StgMutArrPtrs_ptrs] :: PlatformConstants -> Int
[pc_OFFSET_StgMutArrPtrs_size] :: PlatformConstants -> Int
[pc_SIZEOF_StgSmallMutArrPtrs_NoHdr] :: PlatformConstants -> Int
[pc_OFFSET_StgSmallMutArrPtrs_ptrs] :: PlatformConstants -> Int
[pc_SIZEOF_StgArrBytes_NoHdr] :: PlatformConstants -> Int
[pc_OFFSET_StgArrBytes_bytes] :: PlatformConstants -> Int
[pc_OFFSET_StgTSO_alloc_limit] :: PlatformConstants -> Int
[pc_OFFSET_StgTSO_cccs] :: PlatformConstants -> Int
[pc_OFFSET_StgTSO_stackobj] :: PlatformConstants -> Int
[pc_OFFSET_StgStack_sp] :: PlatformConstants -> Int
[pc_OFFSET_StgStack_stack] :: PlatformConstants -> Int
[pc_OFFSET_StgUpdateFrame_updatee] :: PlatformConstants -> Int
[pc_OFFSET_StgFunInfoExtraFwd_arity] :: PlatformConstants -> Int
[pc_REP_StgFunInfoExtraFwd_arity] :: PlatformConstants -> Int
[pc_SIZEOF_StgFunInfoExtraRev] :: PlatformConstants -> Int
[pc_OFFSET_StgFunInfoExtraRev_arity] :: PlatformConstants -> Int
[pc_REP_StgFunInfoExtraRev_arity] :: PlatformConstants -> Int
[pc_MAX_SPEC_SELECTEE_SIZE] :: PlatformConstants -> Int
[pc_MAX_SPEC_AP_SIZE] :: PlatformConstants -> Int
[pc_MIN_PAYLOAD_SIZE] :: PlatformConstants -> Int
[pc_MIN_INTLIKE] :: PlatformConstants -> Int
[pc_MAX_INTLIKE] :: PlatformConstants -> Int
[pc_MIN_CHARLIKE] :: PlatformConstants -> Int
[pc_MAX_CHARLIKE] :: PlatformConstants -> Int
[pc_MUT_ARR_PTRS_CARD_BITS] :: PlatformConstants -> Int
[pc_MAX_Vanilla_REG] :: PlatformConstants -> Int
[pc_MAX_Float_REG] :: PlatformConstants -> Int
[pc_MAX_Double_REG] :: PlatformConstants -> Int
[pc_MAX_Long_REG] :: PlatformConstants -> Int
[pc_MAX_XMM_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Vanilla_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Float_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Double_REG] :: PlatformConstants -> Int
[pc_MAX_Real_XMM_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Long_REG] :: PlatformConstants -> Int
[pc_RESERVED_C_STACK_BYTES] :: PlatformConstants -> Int
[pc_RESERVED_STACK_WORDS] :: PlatformConstants -> Int
[pc_AP_STACK_SPLIM] :: PlatformConstants -> Int
[pc_WORD_SIZE] :: PlatformConstants -> Int
[pc_DOUBLE_SIZE] :: PlatformConstants -> Int
[pc_CINT_SIZE] :: PlatformConstants -> Int
[pc_CLONG_SIZE] :: PlatformConstants -> Int
[pc_CLONG_LONG_SIZE] :: PlatformConstants -> Int
[pc_BITMAP_BITS_SHIFT] :: PlatformConstants -> Int
[pc_TAG_BITS] :: PlatformConstants -> Int
[pc_WORDS_BIGENDIAN] :: PlatformConstants -> Bool
[pc_DYNAMIC_BY_DEFAULT] :: PlatformConstants -> Bool
[pc_LDV_SHIFT] :: PlatformConstants -> Int
[pc_ILDV_CREATE_MASK] :: PlatformConstants -> Integer
[pc_ILDV_STATE_CREATE] :: PlatformConstants -> Integer
[pc_ILDV_STATE_USE] :: PlatformConstants -> Integer
instance GHC.Read.Read PlatformConstants.PlatformConstants
module SPARC.Cond
-- | Branch condition codes.
data Cond
ALWAYS :: Cond
EQQ :: Cond
GE :: Cond
GEU :: Cond
GTT :: Cond
GU :: Cond
LE :: Cond
LEU :: Cond
LTT :: Cond
LU :: Cond
NE :: Cond
NEG :: Cond
NEVER :: Cond
POS :: Cond
VC :: Cond
VS :: Cond
condUnsigned :: Cond -> Bool
condToSigned :: Cond -> Cond
condToUnsigned :: Cond -> Cond
instance GHC.Classes.Eq SPARC.Cond.Cond
module State
newtype State s a
State :: (s -> (# a, s #)) -> State s a
[runState'] :: State s a -> s -> (# a, s #)
get :: State s s
gets :: (s -> a) -> State s a
put :: s -> State s ()
modify :: (s -> s) -> State s ()
evalState :: State s a -> s -> a
execState :: State s a -> s -> s
runState :: State s a -> s -> (a, s)
instance GHC.Base.Functor (State.State s)
instance GHC.Base.Applicative (State.State s)
instance GHC.Base.Monad (State.State s)
module Stream
-- | Stream m a b is a computation in some Monad m that
-- delivers a sequence of elements of type a followed by a
-- result of type b.
--
-- More concretely, a value of type Stream m a b can be run
-- using runStream in the Monad m, and it delivers
-- either
--
--
-- - the final result: Left b, or
-- - Right (a,str), where a is the next element in
-- the stream, and str is a computation to get the rest of the
-- stream.
--
--
-- Stream is itself a Monad, and provides an operation yield that
-- produces a new element of the stream. This makes it convenient to turn
-- existing monadic computations into streams.
--
-- The idea is that Stream is useful for making a monadic computation
-- that produces values from time to time. This can be used for knitting
-- together two complex monadic operations, so that the producer does not
-- have to produce all its values before the consumer starts consuming
-- them. We make the producer into a Stream, and the consumer pulls on
-- the stream each time it wants a new value.
newtype Stream m a b
Stream :: m (Either b (a, Stream m a b)) -> Stream m a b
[runStream] :: Stream m a b -> m (Either b (a, Stream m a b))
yield :: Monad m => a -> Stream m a ()
liftIO :: IO a -> Stream IO b a
-- | Turn a Stream into an ordinary list, by demanding all the elements.
collect :: Monad m => Stream m a () -> m [a]
-- | Turn a list into a Stream, by yielding each element in turn.
fromList :: Monad m => [a] -> Stream m a ()
-- | Apply a function to each element of a Stream, lazily
map :: Monad m => (a -> b) -> Stream m a x -> Stream m b x
-- | Apply a monadic operation to each element of a Stream, lazily
mapM :: Monad m => (a -> m b) -> Stream m a x -> Stream m b x
-- | analog of the list-based mapAccumL on Streams. This is a simple
-- way to map over a Stream while carrying some state around.
mapAccumL :: Monad m => (c -> a -> m (c, b)) -> c -> Stream m a () -> Stream m b c
instance GHC.Base.Monad f => GHC.Base.Functor (Stream.Stream f a)
instance GHC.Base.Monad m => GHC.Base.Applicative (Stream.Stream m a)
instance GHC.Base.Monad m => GHC.Base.Monad (Stream.Stream m a)
module SysTools.Terminal
-- | Check if ANSI escape sequences can be used to control color in stderr.
stderrSupportsAnsiColors :: IO Bool
-- | This module provides an interface for typechecker plugins to access
-- select functions of the TcM, principally those to do with
-- reading parts of the state.
module TcPluginM
-- | Highly random utility functions
module Util
ghciSupported :: Bool
debugIsOn :: Bool
ncgDebugIsOn :: Bool
ghciTablesNextToCode :: Bool
isWindowsHost :: Bool
isDarwinHost :: Bool
zipEqual :: String -> [a] -> [b] -> [(a, b)]
zipWithEqual :: String -> (a -> b -> c) -> [a] -> [b] -> [c]
zipWith3Equal :: String -> (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
zipWith4Equal :: String -> (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]
-- | zipLazy is a kind of zip that is lazy in the second list
-- (observe the ~)
zipLazy :: [a] -> [b] -> [(a, b)]
-- | stretchZipWith p z f xs ys stretches ys by inserting
-- z in the places where p returns True
stretchZipWith :: (a -> Bool) -> b -> (a -> b -> c) -> [a] -> [b] -> [c]
zipWithAndUnzip :: (a -> b -> (c, d)) -> [a] -> [b] -> ([c], [d])
-- | zipWithLazy is like zipWith but is lazy in the second
-- list. The length of the output is always the same as the length of the
-- first list.
zipWithLazy :: (a -> b -> c) -> [a] -> [b] -> [c]
-- | zipWith3Lazy is like zipWith3 but is lazy in the second
-- and third lists. The length of the output is always the same as the
-- length of the first list.
zipWith3Lazy :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
-- | filterByList takes a list of Bools and a list of some elements
-- and filters out these elements for which the corresponding value in
-- the list of Bools is False. This function does not check whether the
-- lists have equal length.
filterByList :: [Bool] -> [a] -> [a]
-- | filterByLists takes a list of Bools and two lists as input, and
-- outputs a new list consisting of elements from the last two input
-- lists. For each Bool in the list, if it is True, then it takes
-- an element from the former list. If it is False, it takes an
-- element from the latter list. The elements taken correspond to the
-- index of the Bool in its list. For example:
--
--
-- filterByLists [True, False, True, False] "abcd" "wxyz" = "axcz"
--
--
-- This function does not check whether the lists have equal length.
filterByLists :: [Bool] -> [a] -> [a] -> [a]
-- | partitionByList takes a list of Bools and a list of some
-- elements and partitions the list according to the list of Bools.
-- Elements corresponding to True go to the left; elements
-- corresponding to False go to the right. For example,
-- partitionByList [True, False, True] [1,2,3] == ([1,3], [2])
-- This function does not check whether the lists have equal length.
partitionByList :: [Bool] -> [a] -> ([a], [a])
unzipWith :: (a -> b -> c) -> [(a, b)] -> [c]
mapFst :: (a -> c) -> [(a, b)] -> [(c, b)]
mapSnd :: (b -> c) -> [(a, b)] -> [(a, c)]
chkAppend :: [a] -> [a] -> [a]
mapAndUnzip :: (a -> (b, c)) -> [a] -> ([b], [c])
mapAndUnzip3 :: (a -> (b, c, d)) -> [a] -> ([b], [c], [d])
mapAccumL2 :: (s1 -> s2 -> a -> (s1, s2, b)) -> s1 -> s2 -> [a] -> (s1, s2, [b])
nOfThem :: Int -> a -> [a]
-- | Like filter, only it reverses the sense of the test
filterOut :: (a -> Bool) -> [a] -> [a]
-- | Uses a function to determine which of two output lists an input
-- element should join
partitionWith :: (a -> Either b c) -> [a] -> ([b], [c])
-- | Teases a list of Eithers apart into two lists
splitEithers :: [Either a b] -> ([a], [b])
dropWhileEndLE :: (a -> Bool) -> [a] -> [a]
-- | spanEnd p l == reverse (span p (reverse l)). The first list
-- returns actually comes after the second list (when you look at the
-- input list).
spanEnd :: (a -> Bool) -> [a] -> ([a], [a])
-- | A strict version of foldl1
foldl1' :: () => (a -> a -> a) -> [a] -> a
foldl2 :: (acc -> a -> b -> acc) -> acc -> [a] -> [b] -> acc
count :: (a -> Bool) -> [a] -> Int
all2 :: (a -> b -> Bool) -> [a] -> [b] -> Bool
-- |
-- (lengthExceeds xs n) = (length xs > n)
--
lengthExceeds :: [a] -> Int -> Bool
-- |
-- (lengthIs xs n) = (length xs == n)
--
lengthIs :: [a] -> Int -> Bool
lengthAtLeast :: [a] -> Int -> Bool
listLengthCmp :: [a] -> Int -> Ordering
-- | atLength atLen atEnd ls n unravels list ls to
-- position n. Precisely:
--
--
-- atLength atLenPred atEndPred ls n
-- | n < 0 = atLenPred ls
-- | length ls < n = atEndPred (n - length ls)
-- | otherwise = atLenPred (drop n ls)
--
atLength :: ([a] -> b) -> b -> [a] -> Int -> b
equalLength :: [a] -> [b] -> Bool
compareLength :: [a] -> [b] -> Ordering
-- | True if length xs <= length ys
leLength :: [a] -> [b] -> Bool
isSingleton :: [a] -> Bool
only :: [a] -> a
singleton :: a -> [a]
notNull :: [a] -> Bool
snocView :: [a] -> Maybe ([a], a)
isIn :: Eq a => String -> a -> [a] -> Bool
isn'tIn :: Eq a => String -> a -> [a] -> Bool
-- | Split a list into chunks of n elements
chunkList :: Int -> [a] -> [[a]]
-- | Replace the last element of a list with another element.
changeLast :: [a] -> a -> [a]
fstOf3 :: (a, b, c) -> a
sndOf3 :: (a, b, c) -> b
thdOf3 :: (a, b, c) -> c
firstM :: Monad m => (a -> m c) -> (a, b) -> m (c, b)
first3M :: Monad m => (a -> m d) -> (a, b, c) -> m (d, b, c)
fst3 :: (a -> d) -> (a, b, c) -> (d, b, c)
snd3 :: (b -> d) -> (a, b, c) -> (a, d, c)
third3 :: (c -> d) -> (a, b, c) -> (a, b, d)
uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
liftFst :: (a -> b) -> (a, c) -> (b, c)
liftSnd :: (a -> b) -> (c, a) -> (c, b)
takeList :: [b] -> [a] -> [a]
dropList :: [b] -> [a] -> [a]
splitAtList :: [b] -> [a] -> ([a], [a])
split :: Char -> String -> [String]
dropTail :: Int -> [a] -> [a]
-- | Convert a word to title case by capitalising the first letter
capitalise :: String -> String
-- | Compose a function with itself n times. (nth rather than twice)
nTimes :: Int -> (a -> a) -> (a -> a)
-- | The sortWith function sorts a list of elements using the user
-- supplied function to project something out of each element
sortWith :: Ord b => (a -> b) -> [a] -> [a]
minWith :: Ord b => (a -> b) -> [a] -> a
nubSort :: Ord a => [a] -> [a]
isEqual :: Ordering -> Bool
eqListBy :: (a -> a -> Bool) -> [a] -> [a] -> Bool
eqMaybeBy :: (a -> a -> Bool) -> Maybe a -> Maybe a -> Bool
thenCmp :: Ordering -> Ordering -> Ordering
infixr 9 `thenCmp`
cmpList :: (a -> a -> Ordering) -> [a] -> [a] -> Ordering
removeSpaces :: String -> String
(<&&>) :: Applicative f => f Bool -> f Bool -> f Bool
infixr 3 <&&>
(<||>) :: Applicative f => f Bool -> f Bool -> f Bool
infixr 2 <||>
fuzzyMatch :: String -> [String] -> [String]
-- | Search for possible matches to the users input in the given list,
-- returning a small number of ranked results
fuzzyLookup :: String -> [(String, a)] -> [a]
transitiveClosure :: (a -> [a]) -> (a -> a -> Bool) -> [a] -> [a]
seqList :: [a] -> b -> b
looksLikeModuleName :: String -> Bool
looksLikePackageName :: String -> Bool
getCmd :: String -> Either String (String, String)
toCmdArgs :: String -> Either String (String, [String])
toArgs :: String -> Either String [String]
exactLog2 :: Integer -> Maybe Integer
readRational :: String -> Rational
maybeRead :: Read a => String -> Maybe a
maybeReadFuzzy :: Read a => String -> Maybe a
doesDirNameExist :: FilePath -> IO Bool
getModificationUTCTime :: FilePath -> IO UTCTime
modificationTimeIfExists :: FilePath -> IO (Maybe UTCTime)
hSetTranslit :: Handle -> IO ()
global :: a -> IORef a
consIORef :: IORef [a] -> a -> IO ()
globalM :: IO a -> IORef a
sharedGlobal :: a -> (Ptr (IORef a) -> IO (Ptr (IORef a))) -> IORef a
sharedGlobalM :: IO a -> (Ptr (IORef a) -> IO (Ptr (IORef a))) -> IORef a
type Suffix = String
splitLongestPrefix :: String -> (Char -> Bool) -> (String, String)
escapeSpaces :: String -> String
data Direction
Forwards :: Direction
Backwards :: Direction
reslash :: Direction -> FilePath -> FilePath
makeRelativeTo :: FilePath -> FilePath -> FilePath
abstractConstr :: String -> Constr
abstractDataType :: String -> DataType
-- | Constructs a non-representation for a non-representable type
mkNoRepType :: String -> DataType
charToC :: Word8 -> String
-- | A sample hash function for Strings. We keep multiplying by the golden
-- ratio and adding. The implementation is:
--
--
-- hashString = foldl' f golden
-- where f m c = fromIntegral (ord c) * magic + hashInt32 m
-- magic = 0xdeadbeef
--
--
-- Where hashInt32 works just as hashInt shown above.
--
-- Knuth argues that repeated multiplication by the golden ratio will
-- minimize gaps in the hash space, and thus it's a good choice for
-- combining together multiple keys to form one.
--
-- Here we know that individual characters c are often small, and this
-- produces frequent collisions if we use ord c alone. A particular
-- problem are the shorter low ASCII and ISO-8859-1 character strings. We
-- pre-multiply by a magic twiddle factor to obtain a good distribution.
-- In fact, given the following test:
--
--
-- testp :: Int32 -> Int
-- testp k = (n - ) . length . group . sort . map hs . take n $ ls
-- where ls = [] : [c : l | l <- ls, c <- ['\0'..'\xff']]
-- hs = foldl' f golden
-- f m c = fromIntegral (ord c) * k + hashInt32 m
-- n = 100000
--
--
-- We discover that testp magic = 0.
hashString :: String -> Int32
-- | CallStacks are a lightweight method of obtaining a partial
-- call-stack at any point in the program.
--
-- A function can request its call-site with the HasCallStack
-- constraint. For example, we can define
--
--
-- errorWithCallStack :: HasCallStack => String -> a
--
--
-- as a variant of error that will get its call-site. We can
-- access the call-stack inside errorWithCallStack with
-- callStack.
--
--
-- errorWithCallStack :: HasCallStack => String -> a
-- errorWithCallStack msg = error (msg ++ "n" ++ prettyCallStack callStack)
--
--
-- Thus, if we call errorWithCallStack we will get a formatted
-- call-stack alongside our error message.
--
--
-- >>> errorWithCallStack "die"
-- *** Exception: die
-- CallStack (from HasCallStack):
-- errorWithCallStack, called at <interactive>:2:1 in interactive:Ghci1
--
--
-- GHC solves HasCallStack constraints in three steps:
--
--
-- - If there is a CallStack in scope -- i.e. the enclosing
-- function has a HasCallStack constraint -- GHC will append the
-- new call-site to the existing CallStack.
-- - If there is no CallStack in scope -- e.g. in the GHCi
-- session above -- and the enclosing definition does not have an
-- explicit type signature, GHC will infer a HasCallStack
-- constraint for the enclosing definition (subject to the monomorphism
-- restriction).
-- - If there is no CallStack in scope and the enclosing
-- definition has an explicit type signature, GHC will solve the
-- HasCallStack constraint for the singleton CallStack
-- containing just the current call-site.
--
--
-- CallStacks do not interact with the RTS and do not require
-- compilation with -prof. On the other hand, as they are built
-- up explicitly via the HasCallStack constraints, they will
-- generally not contain as much information as the simulated call-stacks
-- maintained by the RTS.
--
-- A CallStack is a [(String, SrcLoc)]. The
-- String is the name of function that was called, the
-- SrcLoc is the call-site. The list is ordered with the most
-- recently called function at the head.
--
-- NOTE: The intrepid user may notice that HasCallStack is just an
-- alias for an implicit parameter ?callStack :: CallStack. This
-- is an implementation detail and should not be considered part
-- of the CallStack API, we may decide to change the
-- implementation in the future.
data CallStack :: *
-- | A compatibility wrapper for the GHC.Stack.HasCallStack
-- constraint.
type HasCallStack = HasCallStack
-- | A call stack constraint, but only when isDebugOn.
type HasDebugCallStack = (() :: Constraint)
-- | Pretty-print the current callstack
prettyCurrentCallStack :: HasCallStack => String
data OverridingBool
Auto :: OverridingBool
Always :: OverridingBool
Never :: OverridingBool
overrideWith :: Bool -> OverridingBool -> Bool
instance GHC.Show.Show Util.OverridingBool
module PprColour
-- | A colour/style for use with coloured.
newtype PprColour
PprColour :: String -> PprColour
[renderColour] :: PprColour -> String
-- | Allow colours to be combined (e.g. bold + red); In case of conflict,
-- right side takes precedence.
renderColourAfresh :: PprColour -> String
colCustom :: String -> PprColour
colReset :: PprColour
colBold :: PprColour
colBlackFg :: PprColour
colRedFg :: PprColour
colGreenFg :: PprColour
colYellowFg :: PprColour
colBlueFg :: PprColour
colMagentaFg :: PprColour
colCyanFg :: PprColour
colWhiteFg :: PprColour
data Scheme
Scheme :: PprColour -> PprColour -> PprColour -> PprColour -> PprColour -> PprColour -> Scheme
[sHeader] :: Scheme -> PprColour
[sMessage] :: Scheme -> PprColour
[sWarning] :: Scheme -> PprColour
[sError] :: Scheme -> PprColour
[sFatal] :: Scheme -> PprColour
[sMargin] :: Scheme -> PprColour
defaultScheme :: Scheme
-- | Parse the colour scheme from a string (presumably from the
-- GHC_COLORS environment variable).
parseScheme :: String -> (OverridingBool, Scheme) -> (OverridingBool, Scheme)
instance GHC.Base.Monoid PprColour.PprColour
module Maybes
data MaybeErr err val
Succeeded :: val -> MaybeErr err val
Failed :: err -> MaybeErr err val
failME :: err -> MaybeErr err val
isSuccess :: MaybeErr err val -> Bool
-- | Flipped version of fromMaybe, useful for chaining.
orElse :: Maybe a -> a -> a
infixr 4 `orElse`
firstJust :: Maybe a -> Maybe a -> Maybe a
-- | Takes a list of Maybes and returns the first Just if
-- there is one, or Nothing otherwise.
firstJusts :: [Maybe a] -> Maybe a
whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
expectJust :: HasCallStack => String -> Maybe a -> a
-- | The parameterizable maybe monad, obtained by composing an arbitrary
-- monad with the Maybe monad.
--
-- Computations are actions that may produce a value or exit.
--
-- The return function yields a computation that produces that
-- value, while >>= sequences two subcomputations, exiting
-- if either computation does.
newtype MaybeT (m :: * -> *) a :: (* -> *) -> * -> *
MaybeT :: m Maybe a -> MaybeT a
[runMaybeT] :: MaybeT a -> m Maybe a
liftMaybeT :: Monad m => m a -> MaybeT m a
-- | Try performing an IO action, failing on error.
tryMaybeT :: IO a -> MaybeT IO a
instance GHC.Base.Functor (Maybes.MaybeErr err)
instance GHC.Base.Applicative (Maybes.MaybeErr err)
instance GHC.Base.Monad (Maybes.MaybeErr err)
-- | Utilities related to Monad and Applicative classes Mostly for
-- backwards compatibility.
module MonadUtils
-- | A functor with application, providing operations to
--
--
-- - embed pure expressions (pure), and
-- - sequence computations and combine their results (<*>
-- and liftA2).
--
--
-- A minimal complete definition must include implementations of
-- pure and of either <*> or liftA2. If it
-- defines both, then they must behave the same as their default
-- definitions:
--
-- (<*>) = liftA2 id
-- liftA2 f x y = f <$> x <*>
-- y
--
-- Further, any definition must satisfy the following:
--
--
--
-- The other methods have the following default definitions, which may be
-- overridden with equivalent specialized implementations:
--
--
--
-- As a consequence of these laws, the Functor instance for
-- f will satisfy
--
--
--
-- It may be useful to note that supposing
--
--
-- forall x y. p (q x y) = f x . g y
--
--
-- it follows from the above that
--
--
-- liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
--
--
-- If f is also a Monad, it should satisfy
--
--
--
-- (which implies that pure and <*> satisfy the
-- applicative functor laws).
class Functor f => Applicative (f :: * -> *)
-- | Lift a value.
pure :: Applicative f => a -> f a
-- | Sequential application.
--
-- A few functors support an implementation of <*> that is
-- more efficient than the default one.
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
-- | Sequence actions, discarding the value of the first argument.
(*>) :: Applicative f => f a -> f b -> f b
-- | Sequence actions, discarding the value of the second argument.
(<*) :: Applicative f => f a -> f b -> f a
-- | An infix synonym for fmap.
--
-- The name of this operator is an allusion to $. Note the
-- similarities between their types:
--
--
-- ($) :: (a -> b) -> a -> b
-- (<$>) :: Functor f => (a -> b) -> f a -> f b
--
--
-- Whereas $ is function application, <$> is
-- function application lifted over a Functor.
--
-- Examples
--
-- Convert from a Maybe Int to a
-- Maybe String using show:
--
--
-- >>> show <$> Nothing
-- Nothing
--
-- >>> show <$> Just 3
-- Just "3"
--
--
-- Convert from an Either Int Int to
-- an Either Int String using
-- show:
--
--
-- >>> show <$> Left 17
-- Left 17
--
-- >>> show <$> Right 17
-- Right "17"
--
--
-- Double each element of a list:
--
--
-- >>> (*2) <$> [1,2,3]
-- [2,4,6]
--
--
-- Apply even to the second element of a pair:
--
--
-- >>> even <$> (2,2)
-- (2,True)
--
(<$>) :: Functor f => (a -> b) -> f a -> f b
infixl 4 <$>
-- | Monads having fixed points with a 'knot-tying' semantics. Instances of
-- MonadFix should satisfy the following laws:
--
--
-- - purity mfix (return . h) =
-- return (fix h)
-- - left shrinking (or tightening)
-- mfix (\x -> a >>= \y -> f x y) = a >>= \y
-- -> mfix (\x -> f x y)
-- - sliding mfix (liftM h . f) =
-- liftM h (mfix (f . h)), for strict h.
-- - nesting mfix (\x -> mfix (\y
-- -> f x y)) = mfix (\x -> f x x)
--
--
-- This class is used in the translation of the recursive do
-- notation supported by GHC and Hugs.
class Monad m => MonadFix (m :: * -> *)
-- | The fixed point of a monadic computation. mfix f
-- executes the action f only once, with the eventual output fed
-- back as the input. Hence f should not be strict, for then
-- mfix f would diverge.
mfix :: MonadFix m => (a -> m a) -> m a
-- | Monads in which IO computations may be embedded. Any monad
-- built by applying a sequence of monad transformers to the IO
-- monad will be an instance of this class.
--
-- Instances should satisfy the following laws, which state that
-- liftIO is a transformer of monads:
--
--
class Monad m => MonadIO (m :: * -> *)
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => IO a -> m a
-- | Lift an IO operation with 1 argument into another monad
liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b
-- | Lift an IO operation with 2 arguments into another monad
liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
-- | Lift an IO operation with 3 arguments into another monad
liftIO3 :: MonadIO m => (a -> b -> c -> IO d) -> a -> b -> c -> m d
-- | Lift an IO operation with 4 arguments into another monad
liftIO4 :: MonadIO m => (a -> b -> c -> d -> IO e) -> a -> b -> c -> d -> m e
zipWith3M :: Monad m => (a -> b -> c -> m d) -> [a] -> [b] -> [c] -> m [d]
zipWith3M_ :: Monad m => (a -> b -> c -> m d) -> [a] -> [b] -> [c] -> m ()
zipWith4M :: Monad m => (a -> b -> c -> d -> m e) -> [a] -> [b] -> [c] -> [d] -> m [e]
zipWithAndUnzipM :: Monad m => (a -> b -> m (c, d)) -> [a] -> [b] -> m ([c], [d])
-- | The mapAndUnzipM function maps its first argument over a list,
-- returning the result as a pair of lists. This function is mainly used
-- with complicated data structures or a state-transforming monad.
mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])
-- | mapAndUnzipM for triples
mapAndUnzip3M :: Monad m => (a -> m (b, c, d)) -> [a] -> m ([b], [c], [d])
mapAndUnzip4M :: Monad m => (a -> m (b, c, d, e)) -> [a] -> m ([b], [c], [d], [e])
mapAndUnzip5M :: Monad m => (a -> m (b, c, d, e, f)) -> [a] -> m ([b], [c], [d], [e], [f])
-- | Monadic version of mapAccumL
mapAccumLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])
-- | Monadic version of mapSnd
mapSndM :: Monad m => (b -> m c) -> [(a, b)] -> m [(a, c)]
-- | Monadic version of concatMap
concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]
-- | Monadic version of mapMaybe
mapMaybeM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m [b]
-- | Monadic version of fmap
fmapMaybeM :: (Monad m) => (a -> m b) -> Maybe a -> m (Maybe b)
-- | Monadic version of fmap
fmapEitherM :: Monad m => (a -> m b) -> (c -> m d) -> Either a c -> m (Either b d)
-- | Monadic version of any, aborts the computation at the first
-- True value
anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool
-- | Monad version of all, aborts the computation at the first
-- False value
allM :: Monad m => (a -> m Bool) -> [a] -> m Bool
-- | Monadic version of or
orM :: Monad m => m Bool -> m Bool -> m Bool
-- | Monadic version of foldl
foldlM :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m a
-- | Monadic version of foldl that discards its result
foldlM_ :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m ()
-- | Monadic version of foldr
foldrM :: (Monad m) => (b -> a -> m a) -> a -> [b] -> m a
-- | Monadic version of fmap specialised for Maybe
maybeMapM :: Monad m => (a -> m b) -> (Maybe a -> m (Maybe b))
-- | Monadic version of when, taking the condition in the monad
whenM :: Monad m => m Bool -> m () -> m ()
-- | Monadic version of unless, taking the condition in the monad
unlessM :: Monad m => m Bool -> m () -> m ()
-- | There are two principal string types used internally by GHC:
--
--
--
--
-- - A compact, hash-consed, representation of character strings.
-- - Comparison is O(1), and you can get a Unique from
-- them.
-- - Generated by fsLit.
-- - Turn into SDoc with ftext.
--
--
--
--
--
-- - Just a wrapper for the Addr# of a C string (Ptr
-- CChar).
-- - Practically no operations.
-- - Outputing them is fast.
-- - Generated by sLit.
-- - Turn into SDoc with ptext
-- - Requires manual memory management. Improper use may lead to memory
-- leaks or dangling pointers.
-- - It assumes Latin-1 as the encoding, therefore it cannot represent
-- arbitrary Unicode strings.
--
--
-- Use LitString unless you want the facilities of
-- FastString.
module FastString
fastStringToByteString :: FastString -> ByteString
-- | Create a FastString from an existing ForeignPtr; the
-- difference between this and mkFastStringBytes is that we don't
-- have to copy the bytes if the string is new to the table.
mkFastStringByteString :: ByteString -> FastString
fastZStringToByteString :: FastZString -> ByteString
unsafeMkByteString :: String -> ByteString
hashByteString :: ByteString -> Int
data FastZString
hPutFZS :: Handle -> FastZString -> IO ()
zString :: FastZString -> String
lengthFZS :: FastZString -> Int
-- | A FastString is an array of bytes, hashed to support fast O(1)
-- comparison. It is also associated with a character encoding, so that
-- we know how to convert a FastString to the local encoding, or
-- to the Z-encoding used by the compiler internally.
--
-- FastStrings support a memoized conversion to the Z-encoding via
-- zEncodeFS.
data FastString
FastString :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !ByteString -> {-# UNPACK #-} !(IORef (Maybe FastZString)) -> FastString
[uniq] :: FastString -> {-# UNPACK #-} !Int
[n_chars] :: FastString -> {-# UNPACK #-} !Int
[fs_bs] :: FastString -> {-# UNPACK #-} !ByteString
[fs_ref] :: FastString -> {-# UNPACK #-} !(IORef (Maybe FastZString))
fsLit :: String -> FastString
-- | Creates a UTF-8 encoded FastString from a String
mkFastString :: String -> FastString
mkFastStringBytes :: Ptr Word8 -> Int -> FastString
-- | Creates a FastString from a UTF-8 encoded [Word8]
mkFastStringByteList :: [Word8] -> FastString
-- | Create a FastString from an existing ForeignPtr; the
-- difference between this and mkFastStringBytes is that we don't
-- have to copy the bytes if the string is new to the table.
mkFastStringForeignPtr :: Ptr Word8 -> ForeignPtr Word8 -> Int -> IO FastString
mkFastString# :: Addr# -> FastString
-- | Unpacks and decodes the FastString
unpackFS :: FastString -> String
-- | Gives the UTF-8 encoded bytes corresponding to a FastString
bytesFS :: FastString -> [Word8]
-- | Returns a Z-encoded version of a FastString. This might be the
-- original, if it was already Z-encoded. The first time this function is
-- applied to a particular FastString, the results are memoized.
zEncodeFS :: FastString -> FastZString
uniqueOfFS :: FastString -> Int
-- | Returns the length of the FastString in characters
lengthFS :: FastString -> Int
-- | Returns True if the FastString is empty
nullFS :: FastString -> Bool
appendFS :: FastString -> FastString -> FastString
headFS :: FastString -> Char
tailFS :: FastString -> FastString
concatFS :: [FastString] -> FastString
consFS :: Char -> FastString -> FastString
nilFS :: FastString
-- | Outputs a FastString with no decoding at all, that is,
-- you get the actual bytes in the FastString written to the
-- Handle.
hPutFS :: Handle -> FastString -> IO ()
getFastStringTable :: IO [[FastString]]
-- | Returns True if this FastString is not Z-encoded but
-- already has a Z-encoding cached (used in producing stats).
hasZEncoding :: FastString -> Bool
-- | A LitString is a pointer to some null-terminated array of
-- bytes.
type LitString = Ptr Word8
sLit :: String -> LitString
-- | Wrap an unboxed address into a LitString.
mkLitString# :: Addr# -> LitString
-- | Encode a String into a newly allocated LitString using
-- Latin-1 encoding. The original string must not contain non-Latin-1
-- characters (above codepoint 0xff).
mkLitString :: String -> LitString
-- | Decode a LitString back into a String using Latin-1
-- encoding. This does not free the memory associated with
-- LitString.
unpackLitString :: LitString -> String
-- | Compute the length of a LitString, which must necessarily be
-- null-terminated.
lengthLS :: LitString -> Int
instance Control.DeepSeq.NFData FastString.FastZString
instance GHC.Classes.Eq FastString.FastString
instance GHC.Classes.Ord FastString.FastString
instance Data.String.IsString FastString.FastString
instance GHC.Base.Monoid FastString.FastString
instance GHC.Show.Show FastString.FastString
instance Data.Data.Data FastString.FastString
module Lexeme
isLexCon :: FastString -> Bool
isLexVar :: FastString -> Bool
isLexId :: FastString -> Bool
isLexSym :: FastString -> Bool
isLexConId :: FastString -> Bool
isLexConSym :: FastString -> Bool
isLexVarId :: FastString -> Bool
isLexVarSym :: FastString -> Bool
startsVarSym :: Char -> Bool
startsVarId :: Char -> Bool
startsConSym :: Char -> Bool
startsConId :: Char -> Bool
-- | Is this an acceptable variable name?
okVarOcc :: String -> Bool
-- | Is this an acceptable constructor name?
okConOcc :: String -> Bool
-- | Is this an acceptable type name?
okTcOcc :: String -> Bool
-- | Is this an acceptable alphanumeric variable name, assuming it starts
-- with an acceptable letter?
okVarIdOcc :: String -> Bool
-- | Is this an acceptable symbolic variable name, assuming it starts with
-- an acceptable character?
okVarSymOcc :: String -> Bool
-- | Is this an acceptable alphanumeric constructor name, assuming it
-- starts with an acceptable letter?
okConIdOcc :: String -> Bool
-- | Is this an acceptable symbolic constructor name, assuming it starts
-- with an acceptable character?
okConSymOcc :: String -> Bool
module BufWrite
data BufHandle
BufHandle :: {-# UNPACK #-} !(Ptr Word8) -> {-# UNPACK #-} !FastMutInt -> Handle -> BufHandle
newBufHandle :: Handle -> IO BufHandle
bPutChar :: BufHandle -> Char -> IO ()
bPutStr :: BufHandle -> String -> IO ()
bPutFS :: BufHandle -> FastString -> IO ()
bPutFZS :: BufHandle -> FastZString -> IO ()
bPutLitString :: BufHandle -> LitString -> Int -> IO ()
bFlush :: BufHandle -> IO ()
-- | John Hughes's and Simon Peyton Jones's Pretty Printer Combinators
--
-- Based on The Design of a Pretty-printing Library in Advanced
-- Functional Programming, Johan Jeuring and Erik Meijer (eds), LNCS 925
-- http://www.cs.chalmers.se/~rjmh/Papers/pretty.ps
module Pretty
-- | The abstract type of documents. A Doc represents a *set* of layouts. A
-- Doc with no occurrences of Union or NoDoc represents just one layout.
data Doc
-- | The TextDetails data type
--
-- A TextDetails represents a fragment of text that will be output at
-- some point.
data TextDetails
-- | A single Char fragment
Chr :: {-# UNPACK #-} !Char -> TextDetails
-- | A whole String fragment
Str :: String -> TextDetails
PStr :: FastString -> TextDetails
ZStr :: FastZString -> TextDetails
LStr :: {-# UNPACK #-} !LitString -> {-# UNPACK #-} !Int -> TextDetails
-- | A document of height and width 1, containing a literal character.
char :: Char -> Doc
-- | A document of height 1 containing a literal string. text
-- satisfies the following laws:
--
--
--
-- The side condition on the last law is necessary because
-- text "" has height 1, while empty has no
-- height.
text :: String -> Doc
ftext :: FastString -> Doc
ptext :: LitString -> Doc
ztext :: FastZString -> Doc
-- | Some text with any width. (text s = sizedText (length s) s)
sizedText :: Int -> String -> Doc
-- | Some text, but without any width. Use for non-printing text such as a
-- HTML or Latex tags
zeroWidthText :: String -> Doc
int :: Int -> Doc
integer :: Integer -> Doc
float :: Float -> Doc
double :: Double -> Doc
rational :: Rational -> Doc
semi :: Doc
comma :: Doc
colon :: Doc
space :: Doc
equals :: Doc
lparen :: Doc
rparen :: Doc
lbrack :: Doc
rbrack :: Doc
lbrace :: Doc
rbrace :: Doc
parens :: Doc -> Doc
brackets :: Doc -> Doc
braces :: Doc -> Doc
quotes :: Doc -> Doc
quote :: Doc -> Doc
doubleQuotes :: Doc -> Doc
-- | Apply parens to Doc if boolean is true.
maybeParens :: Bool -> Doc -> Doc
-- | The empty document, with no height and no width. empty is the
-- identity for <>, <+>, $$ and
-- $+$, and anywhere in the argument list for sep,
-- hcat, hsep, vcat, fcat etc.
empty :: Doc
-- | Beside. <> is associative, with identity empty.
(<>) :: Doc -> Doc -> Doc
infixl 6 <>
-- | Beside, separated by space, unless one of the arguments is
-- empty. <+> is associative, with identity
-- empty.
(<+>) :: Doc -> Doc -> Doc
infixl 6 <+>
-- | List version of <>.
hcat :: [Doc] -> Doc
-- | List version of <+>.
hsep :: [Doc] -> Doc
-- | Above, except that if the last line of the first argument stops at
-- least one position before the first line of the second begins, these
-- two lines are overlapped. For example:
--
--
-- text "hi" $$ nest 5 (text "there")
--
--
-- lays out as
--
--
-- hi there
--
--
-- rather than
--
--
-- hi
-- there
--
--
-- $$ is associative, with identity empty, and also
-- satisfies
--
--
-- - (x $$ y) <> z = x $$ (y
-- <> z), if y non-empty.
--
($$) :: Doc -> Doc -> Doc
infixl 5 $$
-- | Above, with no overlapping. $+$ is associative, with identity
-- empty.
($+$) :: Doc -> Doc -> Doc
infixl 5 $+$
-- | List version of $$.
vcat :: [Doc] -> Doc
-- | Either hsep or vcat.
sep :: [Doc] -> Doc
-- | Either hcat or vcat.
cat :: [Doc] -> Doc
-- | "Paragraph fill" version of sep.
fsep :: [Doc] -> Doc
-- | "Paragraph fill" version of cat.
fcat :: [Doc] -> Doc
-- | Nest (or indent) a document by a given number of positions (which may
-- also be negative). nest satisfies the laws:
--
--
--
-- The side condition on the last law is needed because empty is a
-- left identity for <>.
nest :: Int -> Doc -> Doc
-- |
-- hang d1 n d2 = sep [d1, nest n d2]
--
hang :: Doc -> Int -> Doc -> Doc
-- | Apply hang to the arguments if the first Doc is not
-- empty.
hangNotEmpty :: Doc -> Int -> Doc -> Doc
-- |
-- punctuate p [d1, ... dn] = [d1 <> p, d2 <> p, ... dn-1 <> p, dn]
--
punctuate :: Doc -> [Doc] -> [Doc]
-- | Returns True if the document is empty
isEmpty :: Doc -> Bool
-- | A rendering style.
data Style
Style :: Mode -> Int -> Float -> Style
-- | The rendering mode
[mode] :: Style -> Mode
-- | Length of line, in chars
[lineLength] :: Style -> Int
-- | Ratio of line length to ribbon length
[ribbonsPerLine] :: Style -> Float
-- | The default style (mode=PageMode, lineLength=100,
-- ribbonsPerLine=1.5).
style :: Style
-- | Render the Doc to a String using the given Style.
renderStyle :: Style -> Doc -> String
-- | Rendering mode.
data Mode
-- | Normal
PageMode :: Mode
-- | With zig-zag cuts
ZigZagMode :: Mode
-- | No indentation, infinitely long lines
LeftMode :: Mode
-- | All on one line
OneLineMode :: Mode
-- | The general rendering interface.
fullRender :: Mode -> Int -> Float -> (TextDetails -> a -> a) -> a -> Doc -> a
printDoc :: Mode -> Int -> Handle -> Doc -> IO ()
printDoc_ :: Mode -> Int -> Handle -> Doc -> IO ()
bufLeftRender :: BufHandle -> Doc -> IO ()
instance GHC.Show.Show Pretty.Doc
-- | This module defines classes and functions for pretty-printing. It also
-- exports a number of helpful debugging and other utilities such as
-- trace and panic.
--
-- The interface to this module is very similar to the standard Hughes-PJ
-- pretty printing module, except that it exports a number of additional
-- functions that are rarely used, and works over the SDoc type.
module Outputable
-- | Class designating that some type has an SDoc representation
class Outputable a
ppr :: Outputable a => a -> SDoc
pprPrec :: Outputable a => Rational -> a -> SDoc
-- | When we print a binder, we often want to print its type too. The
-- OutputableBndr class encapsulates this idea.
class Outputable a => OutputableBndr a
pprBndr :: OutputableBndr a => BindingSite -> a -> SDoc
pprPrefixOcc, pprInfixOcc :: OutputableBndr a => a -> SDoc
pprPrefixOcc, pprInfixOcc :: OutputableBndr a => a -> SDoc
bndrIsJoin_maybe :: OutputableBndr a => a -> Maybe Int
-- | Represents a pretty-printable document.
--
-- To display an SDoc, use printSDoc, printSDocLn,
-- bufLeftRenderSDoc, or renderWithStyle. Avoid calling
-- runSDoc directly as it breaks the abstraction layer.
data SDoc
runSDoc :: SDoc -> SDocContext -> Doc
initSDocContext :: DynFlags -> PprStyle -> SDocContext
docToSDoc :: Doc -> SDoc
sdocWithPprDebug :: (Bool -> SDoc) -> SDoc
-- | Returns the separated concatenation of the pretty printed things.
interppSP :: Outputable a => [a] -> SDoc
-- | Returns the comma-separated concatenation of the pretty printed
-- things.
interpp'SP :: Outputable a => [a] -> SDoc
-- | Returns the comma-separated concatenation of the quoted pretty printed
-- things.
--
--
-- [x,y,z] ==> `x', `y', `z'
--
pprQuotedList :: Outputable a => [a] -> SDoc
pprWithCommas :: (a -> SDoc) -> [a] -> SDoc
quotedListWithOr :: [SDoc] -> SDoc
quotedListWithNor :: [SDoc] -> SDoc
pprWithBars :: (a -> SDoc) -> [a] -> SDoc
empty :: SDoc
isEmpty :: DynFlags -> SDoc -> Bool
-- | Indent SDoc some specified amount
nest :: Int -> SDoc -> SDoc
char :: Char -> SDoc
text :: String -> SDoc
ftext :: FastString -> SDoc
ptext :: LitString -> SDoc
ztext :: FastZString -> SDoc
int :: Int -> SDoc
intWithCommas :: Integral a => a -> SDoc
integer :: Integer -> SDoc
float :: Float -> SDoc
double :: Double -> SDoc
rational :: Rational -> SDoc
-- | doublePrec p n shows a floating point number n with
-- p digits of precision after the decimal point.
doublePrec :: Int -> Double -> SDoc
parens :: SDoc -> SDoc
cparen :: Bool -> SDoc -> SDoc
brackets :: SDoc -> SDoc
braces :: SDoc -> SDoc
quotes :: SDoc -> SDoc
quote :: SDoc -> SDoc
doubleQuotes :: SDoc -> SDoc
angleBrackets :: SDoc -> SDoc
paBrackets :: SDoc -> SDoc
semi :: SDoc
comma :: SDoc
colon :: SDoc
dcolon :: SDoc
space :: SDoc
equals :: SDoc
dot :: SDoc
vbar :: SDoc
arrow :: SDoc
larrow :: SDoc
darrow :: SDoc
arrowt :: SDoc
larrowt :: SDoc
arrowtt :: SDoc
larrowtt :: SDoc
lparen :: SDoc
rparen :: SDoc
lbrack :: SDoc
rbrack :: SDoc
lbrace :: SDoc
rbrace :: SDoc
underscore :: SDoc
blankLine :: SDoc
forAllLit :: SDoc
kindStar :: SDoc
bullet :: SDoc
-- | Join two SDoc together horizontally without a gap
(<>) :: SDoc -> SDoc -> SDoc
-- | Join two SDoc together horizontally with a gap between them
(<+>) :: SDoc -> SDoc -> SDoc
-- | Concatenate SDoc horizontally
hcat :: [SDoc] -> SDoc
-- | Concatenate SDoc horizontally with a space between each one
hsep :: [SDoc] -> SDoc
-- | Join two SDoc together vertically; if there is no vertical
-- overlap it "dovetails" the two onto one line
($$) :: SDoc -> SDoc -> SDoc
-- | Join two SDoc together vertically
($+$) :: SDoc -> SDoc -> SDoc
-- | Concatenate SDoc vertically with dovetailing
vcat :: [SDoc] -> SDoc
-- | Separate: is either like hsep or like vcat, depending on
-- what fits
sep :: [SDoc] -> SDoc
-- | Catenate: is either like hcat or like vcat, depending on
-- what fits
cat :: [SDoc] -> SDoc
-- | A paragraph-fill combinator. It's much like sep, only it keeps fitting
-- things on one line until it can't fit any more.
fsep :: [SDoc] -> SDoc
-- | This behaves like fsep, but it uses <> for
-- horizontal conposition rather than <+>
fcat :: [SDoc] -> SDoc
hang :: SDoc -> Int -> SDoc -> SDoc
-- | This behaves like hang, but does not indent the second document
-- when the header is empty.
hangNotEmpty :: SDoc -> Int -> SDoc -> SDoc
punctuate :: SDoc -> [SDoc] -> [SDoc]
ppWhen :: Bool -> SDoc -> SDoc
ppUnless :: Bool -> SDoc -> SDoc
-- | Converts an integer to a verbal index:
--
--
-- speakNth 1 = text "first"
-- speakNth 5 = text "fifth"
-- speakNth 21 = text "21st"
--
speakNth :: Int -> SDoc
-- | Converts an integer to a verbal multiplicity:
--
--
-- speakN 0 = text "none"
-- speakN 5 = text "five"
-- speakN 10 = text "10"
--
speakN :: Int -> SDoc
-- | Converts an integer and object description to a statement about the
-- multiplicity of those objects:
--
--
-- speakNOf 0 (text "melon") = text "no melons"
-- speakNOf 1 (text "melon") = text "one melon"
-- speakNOf 3 (text "melon") = text "three melons"
--
speakNOf :: Int -> SDoc -> SDoc
-- | Determines the pluralisation suffix appropriate for the length of a
-- list:
--
--
-- plural [] = char 's'
-- plural ["Hello"] = empty
-- plural ["Hello", "World"] = char 's'
--
plural :: [a] -> SDoc
-- | Determines the form of to be appropriate for the length of a list:
--
--
-- isOrAre [] = text "are"
-- isOrAre ["Hello"] = text "is"
-- isOrAre ["Hello", "World"] = text "are"
--
isOrAre :: [a] -> SDoc
-- | Determines the form of to do appropriate for the length of a list:
--
--
-- doOrDoes [] = text "do"
-- doOrDoes ["Hello"] = text "does"
-- doOrDoes ["Hello", "World"] = text "do"
--
doOrDoes :: [a] -> SDoc
unicodeSyntax :: SDoc -> SDoc -> SDoc
-- | Apply the given colour/style for the argument.
--
-- Only takes effect if colours are enabled.
coloured :: PprColour -> SDoc -> SDoc
keyword :: SDoc -> SDoc
-- | The analog of printDoc_ for SDoc, which tries to make
-- sure the terminal doesn't get screwed up by the ANSI color codes if an
-- exception is thrown during pretty-printing.
printSDoc :: Mode -> DynFlags -> Handle -> PprStyle -> SDoc -> IO ()
-- | Like printSDoc but appends an extra newline.
printSDocLn :: Mode -> DynFlags -> Handle -> PprStyle -> SDoc -> IO ()
printForUser :: DynFlags -> Handle -> PrintUnqualified -> SDoc -> IO ()
printForUserPartWay :: DynFlags -> Handle -> Int -> PrintUnqualified -> SDoc -> IO ()
-- | Like printSDocLn but specialized with LeftMode and
-- PprCode CStyle. This is typically used to
-- output C-- code.
printForC :: DynFlags -> Handle -> SDoc -> IO ()
-- | An efficient variant of printSDoc specialized for
-- LeftMode that outputs to a BufHandle.
bufLeftRenderSDoc :: DynFlags -> BufHandle -> PprStyle -> SDoc -> IO ()
pprCode :: CodeStyle -> SDoc -> SDoc
mkCodeStyle :: CodeStyle -> PprStyle
showSDoc :: DynFlags -> SDoc -> String
showSDocUnsafe :: SDoc -> String
showSDocOneLine :: DynFlags -> SDoc -> String
showSDocForUser :: DynFlags -> PrintUnqualified -> SDoc -> String
showSDocDebug :: DynFlags -> SDoc -> String
showSDocDump :: DynFlags -> SDoc -> String
showSDocDumpOneLine :: DynFlags -> SDoc -> String
showSDocUnqual :: DynFlags -> SDoc -> String
showPpr :: Outputable a => DynFlags -> a -> String
renderWithStyle :: DynFlags -> SDoc -> PprStyle -> String
pprInfixVar :: Bool -> SDoc -> SDoc
pprPrefixVar :: Bool -> SDoc -> SDoc
-- | Special combinator for showing character literals.
pprHsChar :: Char -> SDoc
-- | Special combinator for showing string literals.
pprHsString :: FastString -> SDoc
-- | Special combinator for showing bytestring literals.
pprHsBytes :: ByteString -> SDoc
primFloatSuffix :: SDoc
primCharSuffix :: SDoc
primWordSuffix :: SDoc
primDoubleSuffix :: SDoc
primInt64Suffix :: SDoc
primWord64Suffix :: SDoc
primIntSuffix :: SDoc
-- | Special combinator for showing unboxed literals.
pprPrimChar :: Char -> SDoc
pprPrimInt :: Integer -> SDoc
pprPrimWord :: Integer -> SDoc
pprPrimInt64 :: Integer -> SDoc
pprPrimWord64 :: Integer -> SDoc
pprFastFilePath :: FastString -> SDoc
-- | BindingSite is used to tell the thing that prints binder what
-- language construct is binding the identifier. This can be used to
-- decide how much info to print. Also see Note [Binding-site specific
-- printing] in PprCore
data BindingSite
-- | The x in (x. e)
LambdaBind :: BindingSite
-- | The x in case scrut of x { (y,z) -> ... }
CaseBind :: BindingSite
-- | The y,z in case scrut of x { (y,z) -> ... }
CasePatBind :: BindingSite
-- | The x in (let x = rhs in e)
LetBind :: BindingSite
data PprStyle
data CodeStyle
CStyle :: CodeStyle
AsmStyle :: CodeStyle
-- | When printing code that contains original names, we need to map the
-- original names back to something the user understands. This is the
-- purpose of the triple of functions that gets passed around when
-- rendering SDoc.
data PrintUnqualified
QueryQualify :: QueryQualifyName -> QueryQualifyModule -> QueryQualifyPackage -> PrintUnqualified
[queryQualifyName] :: PrintUnqualified -> QueryQualifyName
[queryQualifyModule] :: PrintUnqualified -> QueryQualifyModule
[queryQualifyPackage] :: PrintUnqualified -> QueryQualifyPackage
-- | given an original name, this function tells you which module
-- name it should be qualified with when printing for the user, if any.
-- For example, given Control.Exception.catch, which is in scope
-- as Exception.catch, this function will return Just
-- Exception. Note that the return value is a ModuleName, not
-- a Module, because in source code, names are qualified by ModuleNames.
type QueryQualifyName = Module -> OccName -> QualifyName
-- | For a given module, we need to know whether to print it with a package
-- name to disambiguate it.
type QueryQualifyModule = Module -> Bool
-- | For a given package, we need to know whether to print it with the
-- component id to disambiguate it.
type QueryQualifyPackage = UnitId -> Bool
reallyAlwaysQualify :: PrintUnqualified
reallyAlwaysQualifyNames :: QueryQualifyName
alwaysQualify :: PrintUnqualified
-- | NB: This won't ever show package IDs
alwaysQualifyNames :: QueryQualifyName
alwaysQualifyModules :: QueryQualifyModule
neverQualify :: PrintUnqualified
neverQualifyNames :: QueryQualifyName
neverQualifyModules :: QueryQualifyModule
alwaysQualifyPackages :: QueryQualifyPackage
neverQualifyPackages :: QueryQualifyPackage
data QualifyName
NameUnqual :: QualifyName
NameQual :: ModuleName -> QualifyName
NameNotInScope1 :: QualifyName
NameNotInScope2 :: QualifyName
queryQual :: PprStyle -> PrintUnqualified
sdocWithDynFlags :: (DynFlags -> SDoc) -> SDoc
sdocWithPlatform :: (Platform -> SDoc) -> SDoc
getPprStyle :: (PprStyle -> SDoc) -> SDoc
withPprStyle :: PprStyle -> SDoc -> SDoc
-- | This is not a recommended way to render SDoc, since it breaks
-- the abstraction layer of SDoc. Prefer to use printSDoc,
-- printSDocLn, bufLeftRenderSDoc, or
-- renderWithStyle instead.
withPprStyleDoc :: DynFlags -> PprStyle -> SDoc -> Doc
setStyleColoured :: Bool -> PprStyle -> PprStyle
pprDeeper :: SDoc -> SDoc
-- | Truncate a list that is longer than the current depth.
pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc
pprSetDepth :: Depth -> SDoc -> SDoc
codeStyle :: PprStyle -> Bool
userStyle :: PprStyle -> Bool
debugStyle :: PprStyle -> Bool
dumpStyle :: PprStyle -> Bool
asmStyle :: PprStyle -> Bool
ifPprDebug :: SDoc -> SDoc
qualName :: PprStyle -> QueryQualifyName
qualModule :: PprStyle -> QueryQualifyModule
qualPackage :: PprStyle -> QueryQualifyPackage
-- | Style for printing error messages
mkErrStyle :: DynFlags -> PrintUnqualified -> PprStyle
defaultErrStyle :: DynFlags -> PprStyle
defaultDumpStyle :: DynFlags -> PprStyle
mkDumpStyle :: DynFlags -> PrintUnqualified -> PprStyle
defaultUserStyle :: DynFlags -> PprStyle
mkUserStyle :: DynFlags -> PrintUnqualified -> Depth -> PprStyle
cmdlineParserStyle :: DynFlags -> PprStyle
data Depth
AllTheWay :: Depth
PartWay :: Int -> Depth
-- | Throw an exception saying "bug in GHC"
pprPanic :: HasCallStack => String -> SDoc -> a
-- | Throw an exception saying "this isn't finished yet"
pprSorry :: String -> SDoc -> a
-- | Panic with an assertation failure, recording the given file and line
-- number. Should typically be accessed with the ASSERT family of macros
assertPprPanic :: HasCallStack => String -> Int -> SDoc -> a
-- | Throw an exception saying "bug in pgm being compiled" (used for
-- unusual program errors)
pprPgmError :: String -> SDoc -> a
-- | If debug output is on, show some SDoc on the screen
pprTrace :: String -> SDoc -> a -> a
pprTraceDebug :: String -> SDoc -> a -> a
-- | pprTraceIt desc x is equivalent to pprTrace desc (ppr x)
-- x
pprTraceIt :: Outputable a => String -> a -> a
-- | Just warn about an assertion failure, recording the given file and
-- line number. Should typically be accessed with the WARN macros
warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a
-- | If debug output is on, show some SDoc on the screen along with
-- a call stack when available.
pprSTrace :: HasCallStack => SDoc -> a -> a
-- | The trace function outputs the trace message given as its first
-- argument, before returning the second argument as its result.
--
-- For example, this returns the value of f x but first outputs
-- the message.
--
--
-- trace ("calling f with x = " ++ show x) (f x)
--
--
-- The trace function should only be used for debugging, or
-- for monitoring execution. The function is not referentially
-- transparent: its type indicates that it is a pure function but it has
-- the side effect of outputting the trace message.
trace :: () => String -> a -> a
-- | Panics and asserts.
pgmError :: String -> a
-- | Panics and asserts.
panic :: String -> a
-- | Panics and asserts.
sorry :: String -> a
-- | Throw an failed assertion exception for a given filename and line
-- number.
assertPanic :: String -> Int -> a
pprDebugAndThen :: DynFlags -> (String -> a) -> SDoc -> SDoc -> a
callStackDoc :: HasCallStack => SDoc
instance Outputable.Outputable Outputable.QualifyName
instance Outputable.Outputable Outputable.PprStyle
instance Outputable.Outputable GHC.Types.Char
instance Outputable.Outputable GHC.Types.Bool
instance Outputable.Outputable GHC.Types.Ordering
instance Outputable.Outputable GHC.Int.Int32
instance Outputable.Outputable GHC.Int.Int64
instance Outputable.Outputable GHC.Types.Int
instance Outputable.Outputable GHC.Word.Word16
instance Outputable.Outputable GHC.Word.Word32
instance Outputable.Outputable GHC.Types.Word
instance Outputable.Outputable ()
instance Outputable.Outputable a => Outputable.Outputable [a]
instance Outputable.Outputable a => Outputable.Outputable (Data.Set.Internal.Set a)
instance (Outputable.Outputable a, Outputable.Outputable b) => Outputable.Outputable (a, b)
instance Outputable.Outputable a => Outputable.Outputable (GHC.Base.Maybe a)
instance (Outputable.Outputable a, Outputable.Outputable b) => Outputable.Outputable (Data.Either.Either a b)
instance (Outputable.Outputable a, Outputable.Outputable b, Outputable.Outputable c) => Outputable.Outputable (a, b, c)
instance (Outputable.Outputable a, Outputable.Outputable b, Outputable.Outputable c, Outputable.Outputable d) => Outputable.Outputable (a, b, c, d)
instance (Outputable.Outputable a, Outputable.Outputable b, Outputable.Outputable c, Outputable.Outputable d, Outputable.Outputable e) => Outputable.Outputable (a, b, c, d, e)
instance (Outputable.Outputable a, Outputable.Outputable b, Outputable.Outputable c, Outputable.Outputable d, Outputable.Outputable e, Outputable.Outputable f) => Outputable.Outputable (a, b, c, d, e, f)
instance (Outputable.Outputable a, Outputable.Outputable b, Outputable.Outputable c, Outputable.Outputable d, Outputable.Outputable e, Outputable.Outputable f, Outputable.Outputable g) => Outputable.Outputable (a, b, c, d, e, f, g)
instance Outputable.Outputable FastString.FastString
instance (Outputable.Outputable key, Outputable.Outputable elt) => Outputable.Outputable (Data.Map.Internal.Map key elt)
instance Outputable.Outputable elt => Outputable.Outputable (Data.IntMap.Internal.IntMap elt)
instance Outputable.Outputable GHC.Fingerprint.Type.Fingerprint
instance Outputable.Outputable a => Outputable.Outputable (Data.Graph.SCC a)
instance Outputable.Outputable GHC.Serialized.Serialized
instance Outputable.Outputable GHC.LanguageExtensions.Type.Extension
instance Data.String.IsString Outputable.SDoc
module StringBuffer
-- | A StringBuffer is an internal pointer to a sized chunk of bytes. The
-- bytes are intended to be *immutable*. There are pure operations to
-- read the contents of a StringBuffer.
--
-- A StringBuffer may have a finalizer, depending on how it was obtained.
data StringBuffer
StringBuffer :: {-# UNPACK #-} !(ForeignPtr Word8) -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> StringBuffer
[buf] :: StringBuffer -> {-# UNPACK #-} !(ForeignPtr Word8)
[len] :: StringBuffer -> {-# UNPACK #-} !Int
[cur] :: StringBuffer -> {-# UNPACK #-} !Int
-- | Read a file into a StringBuffer. The resulting buffer is
-- automatically managed by the garbage collector.
hGetStringBuffer :: FilePath -> IO StringBuffer
hGetStringBufferBlock :: Handle -> Int -> IO StringBuffer
appendStringBuffers :: StringBuffer -> StringBuffer -> IO StringBuffer
-- | Encode a String into a StringBuffer as UTF-8. The
-- resulting buffer is automatically managed by the garbage collector.
stringToStringBuffer :: String -> StringBuffer
-- | Return the first UTF-8 character of a nonempty StringBuffer and
-- as well the remaining portion (analogous to uncons).
-- Warning: The behavior is undefined if the StringBuffer
-- is empty. The result shares the same buffer as the original. Similar
-- to utf8DecodeChar, if the character cannot be decoded as UTF-8,
-- '\0' is returned.
nextChar :: StringBuffer -> (Char, StringBuffer)
-- | Return the first UTF-8 character of a nonempty StringBuffer
-- (analogous to head). Warning: The behavior is undefined
-- if the StringBuffer is empty. Similar to utf8DecodeChar,
-- if the character cannot be decoded as UTF-8, '\0' is returned.
currentChar :: StringBuffer -> Char
prevChar :: StringBuffer -> Char -> Char
-- | Check whether a StringBuffer is empty (analogous to
-- null).
atEnd :: StringBuffer -> Bool
-- | Return a StringBuffer with the first UTF-8 character removed
-- (analogous to tail). Warning: The behavior is undefined
-- if the StringBuffer is empty. The result shares the same buffer
-- as the original.
stepOn :: StringBuffer -> StringBuffer
-- | Return a StringBuffer with the first n bytes removed.
-- Warning: If there aren't enough characters, the returned
-- StringBuffer will be invalid and any use of it may lead to
-- undefined behavior. The result shares the same buffer as the original.
offsetBytes :: Int -> StringBuffer -> StringBuffer
-- | Compute the difference in offset between two StringBuffers that
-- share the same buffer. Warning: The behavior is undefined if
-- the StringBuffers use separate buffers.
byteDiff :: StringBuffer -> StringBuffer -> Int
-- | Computes a StringBuffer which points to the first character of
-- the wanted line. Lines begin at 1.
atLine :: Int -> StringBuffer -> Maybe StringBuffer
-- | Decode the first n bytes of a StringBuffer as UTF-8
-- into a String. Similar to utf8DecodeChar, if the
-- character cannot be decoded as UTF-8, they will be replaced with '\0'.
lexemeToString :: StringBuffer -> Int -> String
lexemeToFastString :: StringBuffer -> Int -> FastString
parseUnsignedInteger :: StringBuffer -> Int -> Integer -> (Char -> Int) -> Integer
instance GHC.Show.Show StringBuffer.StringBuffer
module Pair
data Pair a
Pair :: a -> a -> Pair a
[pFst] :: Pair a -> a
[pSnd] :: Pair a -> a
unPair :: Pair a -> (a, a)
toPair :: (a, a) -> Pair a
swap :: Pair a -> Pair a
pLiftFst :: (a -> a) -> Pair a -> Pair a
pLiftSnd :: (a -> a) -> Pair a -> Pair a
instance GHC.Base.Functor Pair.Pair
instance GHC.Base.Applicative Pair.Pair
instance Data.Foldable.Foldable Pair.Pair
instance Data.Traversable.Traversable Pair.Pair
instance GHC.Base.Monoid a => GHC.Base.Monoid (Pair.Pair a)
instance Outputable.Outputable a => Outputable.Outputable (Pair.Pair a)
module OrdList
data OrdList a
nilOL :: OrdList a
isNilOL :: OrdList a -> Bool
unitOL :: a -> OrdList a
appOL :: OrdList a -> OrdList a -> OrdList a
infixl 5 `appOL`
consOL :: a -> OrdList a -> OrdList a
infixr 5 `consOL`
snocOL :: OrdList a -> a -> OrdList a
infixl 5 `snocOL`
concatOL :: [OrdList a] -> OrdList a
lastOL :: OrdList a -> a
mapOL :: (a -> b) -> OrdList a -> OrdList b
fromOL :: OrdList a -> [a]
toOL :: [a] -> OrdList a
foldrOL :: (a -> b -> b) -> b -> OrdList a -> b
foldlOL :: (b -> a -> b) -> b -> OrdList a -> b
instance Outputable.Outputable a => Outputable.Outputable (OrdList.OrdList a)
instance Data.Semigroup.Semigroup (OrdList.OrdList a)
instance GHC.Base.Monoid (OrdList.OrdList a)
instance GHC.Base.Functor OrdList.OrdList
instance Data.Foldable.Foldable OrdList.OrdList
instance Data.Traversable.Traversable OrdList.OrdList
module ListSetOps
unionLists :: (Outputable a, Eq a) => [a] -> [a] -> [a]
minusList :: (Eq a) => [a] -> [a] -> [a]
type Assoc a b = [(a, b)]
assoc :: (Eq a) => String -> Assoc a b -> a -> b
assocMaybe :: (Eq a) => Assoc a b -> a -> Maybe b
assocUsing :: (a -> a -> Bool) -> String -> Assoc a b -> a -> b
assocDefault :: (Eq a) => b -> Assoc a b -> a -> b
assocDefaultUsing :: (a -> a -> Bool) -> b -> Assoc a b -> a -> b
hasNoDups :: (Eq a) => [a] -> Bool
runs :: (a -> a -> Bool) -> [a] -> [[a]]
removeDups :: (a -> a -> Ordering) -> [a] -> ([a], [[a]])
findDupsEq :: (a -> a -> Bool) -> [a] -> [[a]]
equivClasses :: (a -> a -> Ordering) -> [a] -> [[a]]
getNth :: Outputable a => [a] -> Int -> a
module Json
-- | Simple data type to represent JSON documents.
data JsonDoc
[JSNull] :: JsonDoc
[JSBool] :: Bool -> JsonDoc
[JSInt] :: Int -> JsonDoc
[JSString] :: String -> JsonDoc
[JSArray] :: [JsonDoc] -> JsonDoc
[JSObject] :: [(String, JsonDoc)] -> JsonDoc
renderJSON :: JsonDoc -> SDoc
escapeJsonString :: String -> String
class ToJson a
json :: ToJson a => a -> JsonDoc
-- | This module contains types that relate to the positions of things in
-- source files, and allow tagging of those things with locations
module SrcLoc
-- | Real Source Location
--
-- Represents a single point within a file
data RealSrcLoc
-- | Source Location
data SrcLoc
RealSrcLoc :: {-# UNPACK #-} !RealSrcLoc -> SrcLoc
UnhelpfulLoc :: FastString -> SrcLoc
mkSrcLoc :: FastString -> Int -> Int -> SrcLoc
mkRealSrcLoc :: FastString -> Int -> Int -> RealSrcLoc
-- | Creates a "bad" SrcLoc that has no detailed information about
-- its location
mkGeneralSrcLoc :: FastString -> SrcLoc
-- | Built-in "bad" SrcLoc values for particular locations
noSrcLoc :: SrcLoc
-- | Built-in "bad" SrcLoc values for particular locations
generatedSrcLoc :: SrcLoc
-- | Built-in "bad" SrcLoc values for particular locations
interactiveSrcLoc :: SrcLoc
-- | Move the SrcLoc down by one line if the character is a newline,
-- to the next 8-char tabstop if it is a tab, and across by one character
-- in any other case
advanceSrcLoc :: RealSrcLoc -> Char -> RealSrcLoc
-- | Gives the filename of the RealSrcLoc
srcLocFile :: RealSrcLoc -> FastString
-- | Raises an error when used on a "bad" SrcLoc
srcLocLine :: RealSrcLoc -> Int
-- | Raises an error when used on a "bad" SrcLoc
srcLocCol :: RealSrcLoc -> Int
-- | A RealSrcSpan delimits a portion of a text file. It could be
-- represented by a pair of (line,column) coordinates, but in fact we
-- optimise slightly by using more compact representations for
-- single-line and zero-length spans, both of which are quite common.
--
-- The end position is defined to be the column after the end of
-- the span. That is, a span of (1,1)-(1,2) is one character long, and a
-- span of (1,1)-(1,1) is zero characters long.
--
-- Real Source Span
data RealSrcSpan
-- | Source Span
--
-- A SrcSpan identifies either a specific portion of a text file
-- or a human-readable description of a location.
data SrcSpan
RealSrcSpan :: !RealSrcSpan -> SrcSpan
UnhelpfulSpan :: !FastString -> SrcSpan
-- | Create a "bad" SrcSpan that has not location information
mkGeneralSrcSpan :: FastString -> SrcSpan
-- | Create a SrcSpan between two points in a file
mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan
-- | Create a SrcSpan between two points in a file
mkRealSrcSpan :: RealSrcLoc -> RealSrcLoc -> RealSrcSpan
-- | Built-in "bad" SrcSpans for common sources of location
-- uncertainty
noSrcSpan :: SrcSpan
-- | Built-in "bad" SrcSpans for common sources of location
-- uncertainty
wiredInSrcSpan :: SrcSpan
-- | Built-in "bad" SrcSpans for common sources of location
-- uncertainty
interactiveSrcSpan :: SrcSpan
-- | Create a SrcSpan corresponding to a single point
srcLocSpan :: SrcLoc -> SrcSpan
realSrcLocSpan :: RealSrcLoc -> RealSrcSpan
-- | Combines two SrcSpan into one that spans at least all the
-- characters within both spans. Assumes the "file" part is the same in
-- both inputs
combineSrcSpans :: SrcSpan -> SrcSpan -> SrcSpan
-- | Convert a SrcSpan into one that represents only its first character
srcSpanFirstCharacter :: SrcSpan -> SrcSpan
-- | Returns the location at the start of the SrcSpan or a "bad"
-- SrcSpan if that is unavailable
srcSpanStart :: SrcSpan -> SrcLoc
-- | Returns the location at the end of the SrcSpan or a "bad"
-- SrcSpan if that is unavailable
srcSpanEnd :: SrcSpan -> SrcLoc
realSrcSpanStart :: RealSrcSpan -> RealSrcLoc
realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc
-- | Obtains the filename for a SrcSpan if it is "good"
srcSpanFileName_maybe :: SrcSpan -> Maybe FastString
pprUserRealSpan :: Bool -> RealSrcSpan -> SDoc
srcSpanFile :: RealSrcSpan -> FastString
srcSpanStartLine :: RealSrcSpan -> Int
srcSpanEndLine :: RealSrcSpan -> Int
srcSpanStartCol :: RealSrcSpan -> Int
srcSpanEndCol :: RealSrcSpan -> Int
-- | Test if a SrcSpan is "good", i.e. has precise location
-- information
isGoodSrcSpan :: SrcSpan -> Bool
-- | True if the span is known to straddle only one line. For "bad"
-- SrcSpan, it returns False
isOneLineSpan :: SrcSpan -> Bool
-- | Tests whether the first span "contains" the other span, meaning that
-- it covers at least as much source code. True where spans are equal.
containsSpan :: RealSrcSpan -> RealSrcSpan -> Bool
type Located e = GenLocated SrcSpan e
type RealLocated e = GenLocated RealSrcSpan e
-- | We attach SrcSpans to lots of things, so let's have a datatype for it.
data GenLocated l e
L :: l -> e -> GenLocated l e
noLoc :: e -> Located e
mkGeneralLocated :: String -> e -> Located e
getLoc :: GenLocated l e -> l
unLoc :: GenLocated l e -> e
-- | Tests whether the two located things are equal
eqLocated :: Eq a => Located a -> Located a -> Bool
-- | Tests the ordering of the two located things
cmpLocated :: Ord a => Located a -> Located a -> Ordering
combineLocs :: Located a -> Located b -> SrcSpan
-- | Combine locations from two Located things and add them to a
-- third thing
addCLoc :: Located a -> Located b -> c -> Located c
-- | Alternative strategies for ordering SrcSpans
leftmost_smallest :: SrcSpan -> SrcSpan -> Ordering
-- | Alternative strategies for ordering SrcSpans
leftmost_largest :: SrcSpan -> SrcSpan -> Ordering
-- | Alternative strategies for ordering SrcSpans
rightmost :: SrcSpan -> SrcSpan -> Ordering
-- | Determines whether a span encloses a given line and column index
spans :: SrcSpan -> (Int, Int) -> Bool
-- | Determines whether a span is enclosed by another one
isSubspanOf :: SrcSpan -> SrcSpan -> Bool
sortLocated :: [Located a] -> [Located a]
instance Data.Traversable.Traversable (SrcLoc.GenLocated l)
instance Data.Foldable.Foldable (SrcLoc.GenLocated l)
instance GHC.Base.Functor (SrcLoc.GenLocated l)
instance (Data.Data.Data e, Data.Data.Data l) => Data.Data.Data (SrcLoc.GenLocated l e)
instance (GHC.Classes.Ord e, GHC.Classes.Ord l) => GHC.Classes.Ord (SrcLoc.GenLocated l e)
instance (GHC.Classes.Eq e, GHC.Classes.Eq l) => GHC.Classes.Eq (SrcLoc.GenLocated l e)
instance GHC.Show.Show SrcLoc.SrcSpan
instance GHC.Classes.Ord SrcLoc.SrcSpan
instance GHC.Classes.Eq SrcLoc.SrcSpan
instance GHC.Classes.Eq SrcLoc.RealSrcSpan
instance GHC.Show.Show SrcLoc.SrcLoc
instance GHC.Classes.Ord SrcLoc.SrcLoc
instance GHC.Classes.Eq SrcLoc.SrcLoc
instance GHC.Classes.Ord SrcLoc.RealSrcLoc
instance GHC.Classes.Eq SrcLoc.RealSrcLoc
instance (Outputable.Outputable l, Outputable.Outputable e) => Outputable.Outputable (SrcLoc.GenLocated l e)
instance Data.Data.Data SrcLoc.SrcSpan
instance Json.ToJson SrcLoc.SrcSpan
instance Control.DeepSeq.NFData SrcLoc.SrcSpan
instance Outputable.Outputable SrcLoc.SrcSpan
instance Data.Data.Data SrcLoc.RealSrcSpan
instance Json.ToJson SrcLoc.RealSrcSpan
instance GHC.Classes.Ord SrcLoc.RealSrcSpan
instance GHC.Show.Show SrcLoc.RealSrcSpan
instance Outputable.Outputable SrcLoc.RealSrcSpan
instance Outputable.Outputable SrcLoc.SrcLoc
instance Outputable.Outputable SrcLoc.RealSrcLoc
instance GHC.Show.Show SrcLoc.RealSrcLoc
module HsDoc
-- | Haskell Documentation String
newtype HsDocString
HsDocString :: FastString -> HsDocString
-- | Located Haskell Documentation String
type LHsDocString = Located HsDocString
ppr_mbDoc :: Maybe LHsDocString -> SDoc
instance Data.Data.Data HsDoc.HsDocString
instance GHC.Show.Show HsDoc.HsDocString
instance GHC.Classes.Eq HsDoc.HsDocString
instance Outputable.Outputable HsDoc.HsDocString
module BasicTypes
type Version = Int
bumpVersion :: Version -> Version
initialVersion :: Version
data LeftOrRight
CLeft :: LeftOrRight
CRight :: LeftOrRight
pickLR :: LeftOrRight -> (a, a) -> a
-- | Constructor Tag
--
-- Type of the tags associated with each constructor possibility or
-- superclass selector
type ConTag = Int
-- | A *zero-indexed* constructor tag
type ConTagZ = Int
-- | Tags are allocated from here for real constructors or for superclass
-- selectors
fIRST_TAG :: ConTag
-- | The number of value arguments that can be applied to a value before it
-- does "real work". So: fib 100 has arity 0 x -> fib x has arity 1
-- See also Note [Definition of arity] in CoreArity
type Arity = Int
-- | Representation Arity
--
-- The number of represented arguments that can be applied to a value
-- before it does "real work". So: fib 100 has representation arity 0 x
-- -> fib x has representation arity 1 () -> fib (x + y) has
-- representation arity 2
type RepArity = Int
-- | The number of arguments that a join point takes. Unlike the arity of a
-- function, this is a purely syntactic property and is fixed when the
-- join point is created (or converted from a value). Both type and value
-- arguments are counted.
type JoinArity = Int
type Alignment = Int
data FunctionOrData
IsFunction :: FunctionOrData
IsData :: FunctionOrData
-- | Warning Text
--
-- reason/explanation from a WARNING or DEPRECATED pragma
data WarningTxt
WarningTxt :: (Located SourceText) -> [Located StringLiteral] -> WarningTxt
DeprecatedTxt :: (Located SourceText) -> [Located StringLiteral] -> WarningTxt
pprWarningTxtForMsg :: WarningTxt -> SDoc
-- | A String Literal in the source, including its original raw format for
-- use by source to source manipulation tools.
data StringLiteral
StringLiteral :: SourceText -> FastString -> StringLiteral
[sl_st] :: StringLiteral -> SourceText
[sl_fs] :: StringLiteral -> FastString
data Fixity
Fixity :: SourceText -> Int -> FixityDirection -> Fixity
data FixityDirection
InfixL :: FixityDirection
InfixR :: FixityDirection
InfixN :: FixityDirection
defaultFixity :: Fixity
maxPrecedence :: Int
minPrecedence :: Int
negateFixity :: Fixity
funTyFixity :: Fixity
compareFixity :: Fixity -> Fixity -> (Bool, Bool)
-- | Captures the fixity of declarations as they are parsed. This is not
-- necessarily the same as the fixity declaration, as the normal fixity
-- may be overridden using parens or backticks.
data LexicalFixity
Prefix :: LexicalFixity
Infix :: LexicalFixity
-- | Recursivity Flag
data RecFlag
Recursive :: RecFlag
NonRecursive :: RecFlag
isRec :: RecFlag -> Bool
isNonRec :: RecFlag -> Bool
boolToRecFlag :: Bool -> RecFlag
data Origin
FromSource :: Origin
Generated :: Origin
isGenerated :: Origin -> Bool
type RuleName = FastString
pprRuleName :: RuleName -> SDoc
data TopLevelFlag
TopLevel :: TopLevelFlag
NotTopLevel :: TopLevelFlag
isTopLevel :: TopLevelFlag -> Bool
isNotTopLevel :: TopLevelFlag -> Bool
-- | Which technique the user explicitly requested when deriving an
-- instance.
data DerivStrategy
-- | GHC's "standard" strategy, which is to implement a custom instance for
-- the data type. This only works for certain types that GHC knows about
-- (e.g., Eq, Show, Functor when
-- -XDeriveFunctor is enabled, etc.)
StockStrategy :: DerivStrategy
-- |
-- -XDeriveAnyClass
--
AnyclassStrategy :: DerivStrategy
-- |
-- -XGeneralizedNewtypeDeriving
--
NewtypeStrategy :: DerivStrategy
-- | The semantics allowed for overlapping instances for a particular
-- instance. See Note [Safe Haskell isSafeOverlap] (in hs) for a
-- explanation of the isSafeOverlap field.
--
--
data OverlapFlag
OverlapFlag :: OverlapMode -> Bool -> OverlapFlag
[overlapMode] :: OverlapFlag -> OverlapMode
[isSafeOverlap] :: OverlapFlag -> Bool
data OverlapMode
-- | This instance must not overlap another NoOverlap instance.
-- However, it may be overlapped by Overlapping instances, and it
-- may overlap Overlappable instances.
NoOverlap :: SourceText -> OverlapMode
-- | Silently ignore this instance if you find a more specific one that
-- matches the constraint you are trying to resolve
--
-- Example: constraint (Foo [Int]) instance Foo [Int] instance {--} Foo
-- [a]
--
-- Since the second instance has the Overlappable flag, the first
-- instance will be chosen (otherwise its ambiguous which to choose)
Overlappable :: SourceText -> OverlapMode
-- | Silently ignore any more general instances that may be used to solve
-- the constraint.
--
-- Example: constraint (Foo [Int]) instance {--} Foo [Int] instance Foo
-- [a]
--
-- Since the first instance has the Overlapping flag, the second---more
-- general---instance will be ignored (otherwise it is ambiguous which to
-- choose)
Overlapping :: SourceText -> OverlapMode
-- | Equivalent to having both Overlapping and Overlappable
-- flags.
Overlaps :: SourceText -> OverlapMode
-- | Behave like Overlappable and Overlapping, and in addition pick an an
-- arbitrary one if there are multiple matching candidates, and don't
-- worry about later instantiation
--
-- Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int]
-- instance Foo [a] Without the Incoherent flag, we'd complain that
-- instantiating b would change which instance was chosen. See
-- also note [Incoherent instances] in InstEnv
Incoherent :: SourceText -> OverlapMode
setOverlapModeMaybe :: OverlapFlag -> Maybe OverlapMode -> OverlapFlag
hasOverlappingFlag :: OverlapMode -> Bool
hasOverlappableFlag :: OverlapMode -> Bool
hasIncoherentFlag :: OverlapMode -> Bool
data Boxity
Boxed :: Boxity
Unboxed :: Boxity
isBoxed :: Boxity -> Bool
data TyPrec
TopPrec :: TyPrec
FunPrec :: TyPrec
TyOpPrec :: TyPrec
TyConPrec :: TyPrec
maybeParen :: TyPrec -> TyPrec -> SDoc -> SDoc
data TupleSort
BoxedTuple :: TupleSort
UnboxedTuple :: TupleSort
ConstraintTuple :: TupleSort
tupleSortBoxity :: TupleSort -> Boxity
boxityTupleSort :: Boxity -> TupleSort
tupleParens :: TupleSort -> SDoc -> SDoc
sumParens :: SDoc -> SDoc
-- | Pretty print an alternative in an unboxed sum e.g. "| a | |".
pprAlternative :: (a -> SDoc) -> a -> ConTag -> Arity -> SDoc
-- | If the Id is a lambda-bound variable then it may have
-- lambda-bound variable info. Sometimes we know whether the lambda
-- binding this variable is a "one-shot" lambda; that is, whether it is
-- applied at most once.
--
-- This information may be useful in optimisation, as computations may
-- safely be floated inside such a lambda without risk of duplicating
-- work.
data OneShotInfo
-- | No information
NoOneShotInfo :: OneShotInfo
-- | The lambda is applied at most once.
OneShotLam :: OneShotInfo
-- | It is always safe to assume that an Id has no lambda-bound
-- variable information
noOneShotInfo :: OneShotInfo
hasNoOneShotInfo :: OneShotInfo -> Bool
isOneShotInfo :: OneShotInfo -> Bool
bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo
worstOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo
-- | identifier Occurrence Information
data OccInfo
-- | There are many occurrences, or unknown occurrences
ManyOccs :: !TailCallInfo -> OccInfo
[occ_tail] :: OccInfo -> !TailCallInfo
-- | Marks unused variables. Sometimes useful for lambda and case-bound
-- variables.
IAmDead :: OccInfo
-- | Occurs exactly once (per branch), not inside a rule
OneOcc :: !InsideLam -> !OneBranch -> !InterestingCxt -> !TailCallInfo -> OccInfo
[occ_in_lam] :: OccInfo -> !InsideLam
[occ_one_br] :: OccInfo -> !OneBranch
[occ_int_cxt] :: OccInfo -> !InterestingCxt
[occ_tail] :: OccInfo -> !TailCallInfo
-- | This identifier breaks a loop of mutually recursive functions. The
-- field marks whether it is only a loop breaker due to a reference in a
-- rule
IAmALoopBreaker :: !RulesOnly -> !TailCallInfo -> OccInfo
[occ_rules_only] :: OccInfo -> !RulesOnly
[occ_tail] :: OccInfo -> !TailCallInfo
noOccInfo :: OccInfo
seqOccInfo :: OccInfo -> ()
zapFragileOcc :: OccInfo -> OccInfo
isOneOcc :: OccInfo -> Bool
isDeadOcc :: OccInfo -> Bool
isStrongLoopBreaker :: OccInfo -> Bool
isWeakLoopBreaker :: OccInfo -> Bool
isManyOccs :: OccInfo -> Bool
strongLoopBreaker :: OccInfo
weakLoopBreaker :: OccInfo
-- | Inside Lambda
type InsideLam = Bool
insideLam :: InsideLam
notInsideLam :: InsideLam
type OneBranch = Bool
oneBranch :: OneBranch
notOneBranch :: OneBranch
-- | Interesting Context
type InterestingCxt = Bool
data TailCallInfo
AlwaysTailCalled :: JoinArity -> TailCallInfo
NoTailCallInfo :: TailCallInfo
tailCallInfo :: OccInfo -> TailCallInfo
zapOccTailCallInfo :: OccInfo -> OccInfo
isAlwaysTailCalled :: OccInfo -> Bool
-- | Embedding Projection pair
data EP a
EP :: a -> a -> EP a
[fromEP] :: EP a -> a
[toEP] :: EP a -> a
-- | Default Method Specification
data DefMethSpec ty
VanillaDM :: DefMethSpec ty
GenericDM :: ty -> DefMethSpec ty
data SwapFlag
NotSwapped :: SwapFlag
IsSwapped :: SwapFlag
flipSwap :: SwapFlag -> SwapFlag
unSwap :: SwapFlag -> (a -> a -> b) -> a -> a -> b
isSwapped :: SwapFlag -> Bool
data CompilerPhase
Phase :: PhaseNum -> CompilerPhase
InitialPhase :: CompilerPhase
-- | Phase Number
type PhaseNum = Int
data Activation
NeverActive :: Activation
AlwaysActive :: Activation
ActiveBefore :: SourceText -> PhaseNum -> Activation
ActiveAfter :: SourceText -> PhaseNum -> Activation
isActive :: CompilerPhase -> Activation -> Bool
isActiveIn :: PhaseNum -> Activation -> Bool
competesWith :: Activation -> Activation -> Bool
isNeverActive :: Activation -> Bool
isAlwaysActive :: Activation -> Bool
isEarlyActive :: Activation -> Bool
-- | Rule Match Information
data RuleMatchInfo
ConLike :: RuleMatchInfo
FunLike :: RuleMatchInfo
isConLike :: RuleMatchInfo -> Bool
isFunLike :: RuleMatchInfo -> Bool
-- | Inline Specification
data InlineSpec
Inline :: InlineSpec
Inlinable :: InlineSpec
NoInline :: InlineSpec
EmptyInlineSpec :: InlineSpec
isEmptyInlineSpec :: InlineSpec -> Bool
data InlinePragma
InlinePragma :: SourceText -> InlineSpec -> Maybe Arity -> Activation -> RuleMatchInfo -> InlinePragma
[inl_src] :: InlinePragma -> SourceText
[inl_inline] :: InlinePragma -> InlineSpec
[inl_sat] :: InlinePragma -> Maybe Arity
[inl_act] :: InlinePragma -> Activation
[inl_rule] :: InlinePragma -> RuleMatchInfo
defaultInlinePragma :: InlinePragma
alwaysInlinePragma :: InlinePragma
neverInlinePragma :: InlinePragma
dfunInlinePragma :: InlinePragma
isDefaultInlinePragma :: InlinePragma -> Bool
isInlinePragma :: InlinePragma -> Bool
isInlinablePragma :: InlinePragma -> Bool
isAnyInlinePragma :: InlinePragma -> Bool
inlinePragmaSpec :: InlinePragma -> InlineSpec
inlinePragmaSat :: InlinePragma -> Maybe Arity
inlinePragmaActivation :: InlinePragma -> Activation
inlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo
setInlinePragmaActivation :: InlinePragma -> Activation -> InlinePragma
setInlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo -> InlinePragma
pprInline :: InlinePragma -> SDoc
pprInlineDebug :: InlinePragma -> SDoc
data SuccessFlag
Succeeded :: SuccessFlag
Failed :: SuccessFlag
succeeded :: SuccessFlag -> Bool
failed :: SuccessFlag -> Bool
successIf :: Bool -> SuccessFlag
-- | Fractional Literal
--
-- Used (instead of Rational) to represent exactly the floating point
-- literal that we encountered in the user's source program. This allows
-- us to pretty-print exactly what the user wrote, which is important
-- e.g. for floating point numbers that can't represented as Doubles (we
-- used to via Double for pretty-printing). See also #2245.
data FractionalLit
FL :: String -> Rational -> FractionalLit
[fl_text] :: FractionalLit -> String
[fl_value] :: FractionalLit -> Rational
negateFractionalLit :: FractionalLit -> FractionalLit
integralFractionalLit :: Integer -> FractionalLit
data SourceText
SourceText :: String -> SourceText
-- | For when code is generated, e.g. TH, deriving. The pretty printer will
-- then make its own representation of the item.
NoSourceText :: SourceText
-- | Special combinator for showing string literals.
pprWithSourceText :: SourceText -> SDoc -> SDoc
-- | An integer or infinity
data IntWithInf
-- | A representation of infinity
infinity :: IntWithInf
-- | Turn a positive number into an IntWithInf, where 0 represents
-- infinity
treatZeroAsInf :: Int -> IntWithInf
-- | Inject any integer into an IntWithInf
mkIntWithInf :: Int -> IntWithInf
intGtLimit :: Int -> IntWithInf -> Bool
data SpliceExplicitFlag
-- | = $(f x y)
ExplicitSplice :: SpliceExplicitFlag
-- | = f x y, i.e. a naked top level expression
ImplicitSplice :: SpliceExplicitFlag
instance Data.Data.Data BasicTypes.SpliceExplicitFlag
instance GHC.Classes.Eq BasicTypes.IntWithInf
instance GHC.Show.Show BasicTypes.FractionalLit
instance Data.Data.Data BasicTypes.FractionalLit
instance Data.Data.Data BasicTypes.InlinePragma
instance GHC.Classes.Eq BasicTypes.InlinePragma
instance GHC.Show.Show BasicTypes.InlineSpec
instance Data.Data.Data BasicTypes.InlineSpec
instance GHC.Classes.Eq BasicTypes.InlineSpec
instance GHC.Show.Show BasicTypes.RuleMatchInfo
instance Data.Data.Data BasicTypes.RuleMatchInfo
instance GHC.Classes.Eq BasicTypes.RuleMatchInfo
instance Data.Data.Data BasicTypes.Activation
instance GHC.Classes.Eq BasicTypes.Activation
instance Data.Data.Data BasicTypes.WarningTxt
instance GHC.Classes.Eq BasicTypes.WarningTxt
instance Data.Data.Data BasicTypes.StringLiteral
instance Data.Data.Data BasicTypes.Fixity
instance Data.Data.Data BasicTypes.OverlapFlag
instance GHC.Classes.Eq BasicTypes.OverlapFlag
instance Data.Data.Data BasicTypes.OverlapMode
instance GHC.Classes.Eq BasicTypes.OverlapMode
instance GHC.Classes.Eq BasicTypes.SourceText
instance GHC.Show.Show BasicTypes.SourceText
instance Data.Data.Data BasicTypes.SourceText
instance GHC.Classes.Eq BasicTypes.OccInfo
instance GHC.Classes.Eq BasicTypes.TailCallInfo
instance Data.Data.Data BasicTypes.TupleSort
instance GHC.Classes.Eq BasicTypes.TupleSort
instance GHC.Classes.Ord BasicTypes.TyPrec
instance GHC.Classes.Eq BasicTypes.TyPrec
instance Data.Data.Data BasicTypes.DerivStrategy
instance GHC.Classes.Eq BasicTypes.DerivStrategy
instance Data.Data.Data BasicTypes.Origin
instance GHC.Classes.Eq BasicTypes.Origin
instance Data.Data.Data BasicTypes.RecFlag
instance GHC.Classes.Eq BasicTypes.RecFlag
instance Data.Data.Data BasicTypes.Boxity
instance GHC.Classes.Eq BasicTypes.Boxity
instance GHC.Classes.Eq BasicTypes.LexicalFixity
instance Data.Data.Data BasicTypes.LexicalFixity
instance Data.Data.Data BasicTypes.FixityDirection
instance GHC.Classes.Eq BasicTypes.FixityDirection
instance Data.Data.Data BasicTypes.FunctionOrData
instance GHC.Classes.Ord BasicTypes.FunctionOrData
instance GHC.Classes.Eq BasicTypes.FunctionOrData
instance GHC.Classes.Eq BasicTypes.OneShotInfo
instance Data.Data.Data BasicTypes.LeftOrRight
instance GHC.Classes.Eq BasicTypes.LeftOrRight
instance GHC.Classes.Ord BasicTypes.IntWithInf
instance Outputable.Outputable BasicTypes.IntWithInf
instance GHC.Num.Num BasicTypes.IntWithInf
instance GHC.Classes.Eq BasicTypes.FractionalLit
instance GHC.Classes.Ord BasicTypes.FractionalLit
instance Outputable.Outputable BasicTypes.FractionalLit
instance Outputable.Outputable BasicTypes.InlinePragma
instance Outputable.Outputable BasicTypes.InlineSpec
instance Outputable.Outputable BasicTypes.RuleMatchInfo
instance Outputable.Outputable BasicTypes.Activation
instance Outputable.Outputable BasicTypes.CompilerPhase
instance Outputable.Outputable BasicTypes.WarningTxt
instance GHC.Classes.Eq BasicTypes.StringLiteral
instance Outputable.Outputable BasicTypes.StringLiteral
instance Outputable.Outputable BasicTypes.Fixity
instance GHC.Classes.Eq BasicTypes.Fixity
instance Outputable.Outputable BasicTypes.OverlapFlag
instance Outputable.Outputable BasicTypes.OverlapMode
instance Outputable.Outputable BasicTypes.SourceText
instance Outputable.Outputable BasicTypes.SuccessFlag
instance Outputable.Outputable (BasicTypes.DefMethSpec ty)
instance Outputable.Outputable BasicTypes.OccInfo
instance Outputable.Outputable BasicTypes.TailCallInfo
instance Outputable.Outputable BasicTypes.DerivStrategy
instance Outputable.Outputable BasicTypes.Origin
instance Outputable.Outputable BasicTypes.RecFlag
instance Outputable.Outputable BasicTypes.Boxity
instance Outputable.Outputable BasicTypes.TopLevelFlag
instance Outputable.Outputable BasicTypes.LexicalFixity
instance Outputable.Outputable BasicTypes.FixityDirection
instance Outputable.Outputable BasicTypes.FunctionOrData
instance Outputable.Outputable BasicTypes.SwapFlag
instance Outputable.Outputable BasicTypes.OneShotInfo
instance Outputable.Outputable BasicTypes.LeftOrRight
module Unique
-- | Unique identifier.
--
-- The type of unique identifiers that are used in many places in GHC for
-- fast ordering and equality tests. You should generate these with the
-- functions from the UniqSupply module
--
-- These are sometimes also referred to as "keys" in comments in GHC.
data Unique
-- | Class of things that we can obtain a Unique from
class Uniquable a
getUnique :: Uniquable a => a -> Unique
uNIQUE_BITS :: Int
hasKey :: Uniquable a => a -> Unique -> Bool
pprUniqueAlways :: Unique -> SDoc
mkUniqueGrimily :: Int -> Unique
getKey :: Unique -> Int
mkUnique :: Char -> Int -> Unique
unpkUnique :: Unique -> (Char, Int)
deriveUnique :: Unique -> Int -> Unique
newTagUnique :: Unique -> Char -> Unique
initTyVarUnique :: Unique
nonDetCmpUnique :: Unique -> Unique -> Ordering
-- | The interface file symbol-table encoding assumes that known-key
-- uniques fit in 30-bits; verify this.
--
-- See Note [Symbol table representation of names] in BinIface for
-- details.
isValidKnownKeyUnique :: Unique -> Bool
mkAlphaTyVarUnique :: Int -> Unique
mkPrimOpIdUnique :: Int -> Unique
mkPreludeMiscIdUnique :: Int -> Unique
mkPreludeDataConUnique :: Arity -> Unique
mkPreludeTyConUnique :: Int -> Unique
mkPreludeClassUnique :: Int -> Unique
mkPArrDataConUnique :: Int -> Unique
mkCoVarUnique :: Int -> Unique
mkVarOccUnique :: FastString -> Unique
mkDataOccUnique :: FastString -> Unique
mkTvOccUnique :: FastString -> Unique
mkTcOccUnique :: FastString -> Unique
mkRegSingleUnique :: Int -> Unique
mkRegPairUnique :: Int -> Unique
mkRegClassUnique :: Int -> Unique
mkRegSubUnique :: Int -> Unique
mkCostCentreUnique :: Int -> Unique
mkBuiltinUnique :: Int -> Unique
mkPseudoUniqueD :: Int -> Unique
mkPseudoUniqueE :: Int -> Unique
mkPseudoUniqueH :: Int -> Unique
tyConRepNameUnique :: Unique -> Unique
dataConWorkerUnique :: Unique -> Unique
dataConRepNameUnique :: Unique -> Unique
instance Unique.Uniquable FastString.FastString
instance Unique.Uniquable GHC.Types.Int
instance Unique.Uniquable Unique.Unique
instance GHC.Classes.Eq Unique.Unique
instance Outputable.Outputable Unique.Unique
instance GHC.Show.Show Unique.Unique
module UniqSupply
-- | Unique Supply
--
-- A value of type UniqSupply is unique, and it can supply
-- one distinct Unique. Also, from the supply, one can also
-- manufacture an arbitrary number of further UniqueSupply
-- values, which will be distinct from the first and from all others.
data UniqSupply
-- | Obtain the Unique from this particular UniqSupply
uniqFromSupply :: UniqSupply -> Unique
-- | Obtain an infinite list of Unique that can be generated by
-- constant splitting of the supply
uniqsFromSupply :: UniqSupply -> [Unique]
-- | Obtain the Unique from this particular UniqSupply, and a
-- new supply
takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply)
-- | Create a unique supply out of thin air. The character given must be
-- distinct from those of all calls to this function in the compiler for
-- the values generated to be truly unique.
mkSplitUniqSupply :: Char -> IO UniqSupply
-- | Build two UniqSupply from a single one, each of which can
-- supply its own Unique.
splitUniqSupply :: UniqSupply -> (UniqSupply, UniqSupply)
-- | Create an infinite list of UniqSupply from a single one
listSplitUniqSupply :: UniqSupply -> [UniqSupply]
-- | Build three UniqSupply from a single one, each of which can
-- supply its own unique
splitUniqSupply3 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply)
-- | Build four UniqSupply from a single one, each of which can
-- supply its own unique
splitUniqSupply4 :: UniqSupply -> (UniqSupply, UniqSupply, UniqSupply, UniqSupply)
-- | A monad which just gives the ability to obtain Uniques
data UniqSM result
-- | A monad for generating unique identifiers
class Monad m => MonadUnique m
-- | Get a new UniqueSupply
getUniqueSupplyM :: MonadUnique m => m UniqSupply
-- | Get a new unique identifier
getUniqueM :: MonadUnique m => m Unique
-- | Get an infinite list of new unique identifiers
getUniquesM :: MonadUnique m => m [Unique]
liftUs :: MonadUnique m => UniqSM a -> m a
-- | Run the UniqSM action, returning the final UniqSupply
initUs :: UniqSupply -> UniqSM a -> (a, UniqSupply)
-- | Run the UniqSM action, discarding the final UniqSupply
initUs_ :: UniqSupply -> UniqSM a -> a
lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b
lazyMapUs :: (a -> UniqSM b) -> [a] -> UniqSM [b]
getUniqueSupplyM3 :: MonadUnique m => m (UniqSupply, UniqSupply, UniqSupply)
initUniqSupply :: Int -> Int -> IO ()
instance UniqSupply.MonadUnique UniqSupply.UniqSM
instance GHC.Base.Monad UniqSupply.UniqSM
instance GHC.Base.Functor UniqSupply.UniqSM
instance GHC.Base.Applicative UniqSupply.UniqSM
instance Control.Monad.Fix.MonadFix UniqSupply.UniqSM
module UniqFM
data UniqFM ele
emptyUFM :: UniqFM elt
unitUFM :: Uniquable key => key -> elt -> UniqFM elt
unitDirectlyUFM :: Unique -> elt -> UniqFM elt
listToUFM :: Uniquable key => [(key, elt)] -> UniqFM elt
listToUFM_Directly :: [(Unique, elt)] -> UniqFM elt
listToUFM_C :: Uniquable key => (elt -> elt -> elt) -> [(key, elt)] -> UniqFM elt
addToUFM :: Uniquable key => UniqFM elt -> key -> elt -> UniqFM elt
addToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM elt -> key -> elt -> UniqFM elt
addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -> (elt -> elts) -> UniqFM elts -> key -> elt -> UniqFM elts
addListToUFM :: Uniquable key => UniqFM elt -> [(key, elt)] -> UniqFM elt
addListToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM elt -> [(key, elt)] -> UniqFM elt
addToUFM_Directly :: UniqFM elt -> Unique -> elt -> UniqFM elt
addListToUFM_Directly :: UniqFM elt -> [(Unique, elt)] -> UniqFM elt
adjustUFM :: Uniquable key => (elt -> elt) -> UniqFM elt -> key -> UniqFM elt
alterUFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqFM elt -> key -> UniqFM elt
adjustUFM_Directly :: (elt -> elt) -> UniqFM elt -> Unique -> UniqFM elt
delFromUFM :: Uniquable key => UniqFM elt -> key -> UniqFM elt
delFromUFM_Directly :: UniqFM elt -> Unique -> UniqFM elt
delListFromUFM :: Uniquable key => UniqFM elt -> [key] -> UniqFM elt
delListFromUFM_Directly :: UniqFM elt -> [Unique] -> UniqFM elt
plusUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt
plusUFM_C :: (elt -> elt -> elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt
-- | `plusUFM_CD f m1 d1 m2 d2` merges the maps using f as the
-- combinding function and d1 resp. d2 as the default
-- value if there is no entry in m1 reps. m2. The
-- domain is the union of the domains of m1 and m2.
--
-- Representative example:
--
--
-- plusUFM_CD f {A: 1, B: 2} 23 {B: 3, C: 4} 42
-- == {A: f 1 42, B: f 2 3, C: f 23 4 }
--
plusUFM_CD :: (elt -> elt -> elt) -> UniqFM elt -> elt -> UniqFM elt -> elt -> UniqFM elt
plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt
plusUFMList :: [UniqFM elt] -> UniqFM elt
minusUFM :: UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1
intersectUFM :: UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1
intersectUFM_C :: (elt1 -> elt2 -> elt3) -> UniqFM elt1 -> UniqFM elt2 -> UniqFM elt3
disjointUFM :: UniqFM elt1 -> UniqFM elt2 -> Bool
equalKeysUFM :: UniqFM a -> UniqFM b -> Bool
nonDetFoldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a
foldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a
nonDetFoldUFM_Directly :: (Unique -> elt -> a -> a) -> a -> UniqFM elt -> a
anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool
allUFM :: (elt -> Bool) -> UniqFM elt -> Bool
seqEltsUFM :: ([elt] -> ()) -> UniqFM elt -> ()
mapUFM :: (elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2
mapUFM_Directly :: (Unique -> elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2
elemUFM :: Uniquable key => key -> UniqFM elt -> Bool
elemUFM_Directly :: Unique -> UniqFM elt -> Bool
filterUFM :: (elt -> Bool) -> UniqFM elt -> UniqFM elt
filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt
partitionUFM :: (elt -> Bool) -> UniqFM elt -> (UniqFM elt, UniqFM elt)
sizeUFM :: UniqFM elt -> Int
isNullUFM :: UniqFM elt -> Bool
lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt
lookupUFM_Directly :: UniqFM elt -> Unique -> Maybe elt
lookupWithDefaultUFM :: Uniquable key => UniqFM elt -> elt -> key -> elt
lookupWithDefaultUFM_Directly :: UniqFM elt -> elt -> Unique -> elt
nonDetEltsUFM :: UniqFM elt -> [elt]
eltsUFM :: UniqFM elt -> [elt]
nonDetKeysUFM :: UniqFM elt -> [Unique]
ufmToSet_Directly :: UniqFM elt -> IntSet
nonDetUFMToList :: UniqFM elt -> [(Unique, elt)]
ufmToIntMap :: UniqFM elt -> IntMap elt
pprUniqFM :: (a -> SDoc) -> UniqFM a -> SDoc
-- | Pretty-print a non-deterministic set. The order of variables is
-- non-deterministic and for pretty-printing that shouldn't be a problem.
-- Having this function helps contain the non-determinism created with
-- nonDetEltsUFM.
pprUFM :: UniqFM a -> ([a] -> SDoc) -> SDoc
-- | Pretty-print a non-deterministic set. The order of variables is
-- non-deterministic and for pretty-printing that shouldn't be a problem.
-- Having this function helps contain the non-determinism created with
-- nonDetUFMToList.
pprUFMWithKeys :: UniqFM a -> ([(Unique, a)] -> SDoc) -> SDoc
-- | Determines the pluralisation suffix appropriate for the length of a
-- set in the same way that plural from Outputable does for lists.
pluralUFM :: UniqFM a -> SDoc
instance GHC.Base.Functor UniqFM.UniqFM
instance GHC.Classes.Eq ele => GHC.Classes.Eq (UniqFM.UniqFM ele)
instance Data.Data.Data ele => Data.Data.Data (UniqFM.UniqFM ele)
instance Data.Semigroup.Semigroup (UniqFM.UniqFM a)
instance GHC.Base.Monoid (UniqFM.UniqFM a)
instance Outputable.Outputable a => Outputable.Outputable (UniqFM.UniqFM a)
module UniqSet
data UniqSet a
getUniqSet :: UniqSet a -> UniqFM a
pprUniqSet :: (a -> SDoc) -> UniqSet a -> SDoc
emptyUniqSet :: UniqSet a
unitUniqSet :: Uniquable a => a -> UniqSet a
mkUniqSet :: Uniquable a => [a] -> UniqSet a
addOneToUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
addListToUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
delOneFromUniqSet_Directly :: UniqSet a -> Unique -> UniqSet a
delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
delListFromUniqSet_Directly :: UniqSet a -> [Unique] -> UniqSet a
unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a
unionManyUniqSets :: [UniqSet a] -> UniqSet a
minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a
uniqSetMinusUFM :: UniqSet a -> UniqFM b -> UniqSet a
intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a
restrictUniqSetToUFM :: UniqSet a -> UniqFM b -> UniqSet a
uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool
uniqSetAll :: (a -> Bool) -> UniqSet a -> Bool
elementOfUniqSet :: Uniquable a => a -> UniqSet a -> Bool
elemUniqSet_Directly :: Unique -> UniqSet a -> Bool
filterUniqSet :: (a -> Bool) -> UniqSet a -> UniqSet a
filterUniqSet_Directly :: (Unique -> elt -> Bool) -> UniqSet elt -> UniqSet elt
sizeUniqSet :: UniqSet a -> Int
isEmptyUniqSet :: UniqSet a -> Bool
lookupUniqSet :: Uniquable a => UniqSet b -> a -> Maybe b
lookupUniqSet_Directly :: UniqSet a -> Unique -> Maybe a
partitionUniqSet :: (a -> Bool) -> UniqSet a -> (UniqSet a, UniqSet a)
mapUniqSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b
-- | unsafeUFMToUniqSet converts a UniqFM a into a
-- UniqSet a assuming, without checking, that it maps
-- each Unique to a value that has that Unique. See Note
-- [Unsound mapUniqSet].
unsafeUFMToUniqSet :: UniqFM a -> UniqSet a
nonDetEltsUniqSet :: UniqSet elt -> [elt]
nonDetKeysUniqSet :: UniqSet elt -> [Unique]
nonDetFoldUniqSet :: (elt -> a -> a) -> a -> UniqSet elt -> a
nonDetFoldUniqSet_Directly :: (Unique -> elt -> a -> a) -> a -> UniqSet elt -> a
instance Data.Data.Data a => Data.Data.Data (UniqSet.UniqSet a)
instance GHC.Classes.Eq (UniqSet.UniqSet a)
instance Outputable.Outputable a => Outputable.Outputable (UniqSet.UniqSet a)
instance Data.Semigroup.Semigroup (UniqSet.UniqSet a)
instance GHC.Base.Monoid (UniqSet.UniqSet a)
-- | Types for the general graph colorer.
module GraphBase
-- | A fn to check if a node is trivially colorable For graphs who's color
-- classes are disjoint then a node is 'trivially colorable' when it has
-- less neighbors and exclusions than available colors for that node.
--
-- For graph's who's color classes overlap, ie some colors alias other
-- colors, then this can be a bit more tricky. There is a general way to
-- calculate this, but it's likely be too slow for use in the code. The
-- coloring algorithm takes a canned function which can be optimised by
-- the user to be specific to the specific graph being colored.
--
-- for details, see "A Generalised Algorithm for Graph-Coloring Register
-- Allocation" Smith, Ramsey, Holloway - PLDI 2004.
type Triv k cls color = cls -> UniqSet k -> UniqSet color -> Bool
-- | The Interference graph. There used to be more fields, but they were
-- turfed out in a previous revision. maybe we'll want more later..
data Graph k cls color
Graph :: UniqFM (Node k cls color) -> Graph k cls color
-- | All active nodes in the graph.
[graphMap] :: Graph k cls color -> UniqFM (Node k cls color)
-- | An empty graph.
initGraph :: Graph k cls color
-- | Modify the finite map holding the nodes in the graph.
graphMapModify :: (UniqFM (Node k cls color) -> UniqFM (Node k cls color)) -> Graph k cls color -> Graph k cls color
-- | Graph nodes. Represents a thing that can conflict with another thing.
-- For the register allocater the nodes represent registers.
data Node k cls color
Node :: k -> cls -> Maybe color -> UniqSet k -> UniqSet color -> [color] -> UniqSet k -> Node k cls color
-- | A unique identifier for this node.
[nodeId] :: Node k cls color -> k
-- | The class of this node, determines the set of colors that can be used.
[nodeClass] :: Node k cls color -> cls
-- | The color of this node, if any.
[nodeColor] :: Node k cls color -> Maybe color
-- | Neighbors which must be colored differently to this node.
[nodeConflicts] :: Node k cls color -> UniqSet k
-- | Colors that cannot be used by this node.
[nodeExclusions] :: Node k cls color -> UniqSet color
-- | Colors that this node would prefer to be, in decending order.
[nodePreference] :: Node k cls color -> [color]
-- | Neighbors that this node would like to be colored the same as.
[nodeCoalesce] :: Node k cls color -> UniqSet k
-- | An empty node.
newNode :: k -> cls -> Node k cls color
module UniqDFM
-- | Type of unique deterministic finite maps
data UniqDFM ele
emptyUDFM :: UniqDFM elt
unitUDFM :: Uniquable key => key -> elt -> UniqDFM elt
addToUDFM :: Uniquable key => UniqDFM elt -> key -> elt -> UniqDFM elt
addToUDFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqDFM elt -> key -> elt -> UniqDFM elt
addListToUDFM :: Uniquable key => UniqDFM elt -> [(key, elt)] -> UniqDFM elt
delFromUDFM :: Uniquable key => UniqDFM elt -> key -> UniqDFM elt
-- | Delete a list of elements from a UniqDFM
delListFromUDFM :: Uniquable key => UniqDFM elt -> [key] -> UniqDFM elt
-- | Apply a function to a particular element
adjustUDFM :: Uniquable key => (elt -> elt) -> UniqDFM elt -> key -> UniqDFM elt
-- | The expression (alterUDFM f k map) alters value x at k, or absence
-- thereof. alterUDFM can be used to insert, delete, or update a value in
-- UniqDFM. Use addToUDFM, delFromUDFM or adjustUDFM when possible, they
-- are more efficient.
alterUDFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqDFM elt -> key -> UniqDFM elt
-- | Map a function over every value in a UniqDFM
mapUDFM :: (elt1 -> elt2) -> UniqDFM elt1 -> UniqDFM elt2
plusUDFM :: UniqDFM elt -> UniqDFM elt -> UniqDFM elt
plusUDFM_C :: (elt -> elt -> elt) -> UniqDFM elt -> UniqDFM elt -> UniqDFM elt
lookupUDFM :: Uniquable key => UniqDFM elt -> key -> Maybe elt
lookupUDFM_Directly :: UniqDFM elt -> Unique -> Maybe elt
elemUDFM :: Uniquable key => key -> UniqDFM elt -> Bool
-- | Performs a deterministic fold over the UniqDFM. It's O(n log n) while
-- the corresponding function on UniqFM is O(n).
foldUDFM :: (elt -> a -> a) -> a -> UniqDFM elt -> a
eltsUDFM :: UniqDFM elt -> [elt]
filterUDFM :: (elt -> Bool) -> UniqDFM elt -> UniqDFM elt
filterUDFM_Directly :: (Unique -> elt -> Bool) -> UniqDFM elt -> UniqDFM elt
isNullUDFM :: UniqDFM elt -> Bool
sizeUDFM :: UniqDFM elt -> Int
intersectUDFM :: UniqDFM elt -> UniqDFM elt -> UniqDFM elt
udfmIntersectUFM :: UniqDFM elt -> UniqFM elt -> UniqDFM elt
intersectsUDFM :: UniqDFM elt -> UniqDFM elt -> Bool
disjointUDFM :: UniqDFM elt -> UniqDFM elt -> Bool
disjointUdfmUfm :: UniqDFM elt -> UniqFM elt2 -> Bool
minusUDFM :: UniqDFM elt1 -> UniqDFM elt2 -> UniqDFM elt1
listToUDFM :: Uniquable key => [(key, elt)] -> UniqDFM elt
udfmMinusUFM :: UniqDFM elt1 -> UniqFM elt2 -> UniqDFM elt1
-- | Partition UniqDFM into two UniqDFMs according to the predicate
partitionUDFM :: (elt -> Bool) -> UniqDFM elt -> (UniqDFM elt, UniqDFM elt)
anyUDFM :: (elt -> Bool) -> UniqDFM elt -> Bool
allUDFM :: (elt -> Bool) -> UniqDFM elt -> Bool
pprUDFM :: UniqDFM a -> ([a] -> SDoc) -> SDoc
-- | Converts UniqDFM to a list, with elements in deterministic
-- order. It's O(n log n) while the corresponding function on
-- UniqFM is O(n).
udfmToList :: UniqDFM elt -> [(Unique, elt)]
-- | This allows for lossy conversion from UniqDFM to UniqFM
udfmToUfm :: UniqDFM elt -> UniqFM elt
-- | Performs a nondeterministic fold over the UniqDFM. It's O(n), same as
-- the corresponding function on UniqFM. If you use this please
-- provide a justification why it doesn't introduce nondeterminism.
nonDetFoldUDFM :: (elt -> a -> a) -> a -> UniqDFM elt -> a
alwaysUnsafeUfmToUdfm :: UniqFM elt -> UniqDFM elt
instance GHC.Base.Functor UniqDFM.UniqDFM
instance Data.Data.Data ele => Data.Data.Data (UniqDFM.UniqDFM ele)
instance Data.Data.Data val => Data.Data.Data (UniqDFM.TaggedVal val)
instance GHC.Base.Monoid (UniqDFM.UniqDFM a)
instance Outputable.Outputable a => Outputable.Outputable (UniqDFM.UniqDFM a)
instance GHC.Classes.Eq val => GHC.Classes.Eq (UniqDFM.TaggedVal val)
instance GHC.Base.Functor UniqDFM.TaggedVal
-- | Specialised deterministic sets, for things with Uniques
--
-- Based on UniqDFMs (as you would expect). See Note
-- [Deterministic UniqFM] in UniqDFM for explanation why we need it.
--
-- Basically, the things need to be in class Uniquable.
module UniqDSet
type UniqDSet a = UniqDFM a
delOneFromUniqDSet :: Uniquable a => UniqDSet a -> a -> UniqDSet a
delListFromUniqDSet :: Uniquable a => UniqDSet a -> [a] -> UniqDSet a
emptyUniqDSet :: UniqDSet a
unitUniqDSet :: Uniquable a => a -> UniqDSet a
mkUniqDSet :: Uniquable a => [a] -> UniqDSet a
addOneToUniqDSet :: Uniquable a => UniqDSet a -> a -> UniqDSet a
addListToUniqDSet :: Uniquable a => UniqDSet a -> [a] -> UniqDSet a
unionUniqDSets :: UniqDSet a -> UniqDSet a -> UniqDSet a
unionManyUniqDSets :: [UniqDSet a] -> UniqDSet a
minusUniqDSet :: UniqDSet a -> UniqDSet a -> UniqDSet a
uniqDSetMinusUniqSet :: UniqDSet a -> UniqSet a -> UniqDSet a
intersectUniqDSets :: UniqDSet a -> UniqDSet a -> UniqDSet a
intersectsUniqDSets :: UniqDSet a -> UniqDSet a -> Bool
foldUniqDSet :: (a -> b -> b) -> b -> UniqDSet a -> b
elementOfUniqDSet :: Uniquable a => a -> UniqDSet a -> Bool
filterUniqDSet :: (a -> Bool) -> UniqDSet a -> UniqDSet a
sizeUniqDSet :: UniqDSet a -> Int
isEmptyUniqDSet :: UniqDSet a -> Bool
lookupUniqDSet :: Uniquable a => UniqDSet a -> a -> Maybe a
uniqDSetToList :: UniqDSet a -> [a]
partitionUniqDSet :: (a -> Bool) -> UniqDSet a -> (UniqDSet a, UniqDSet a)
module FastStringEnv
-- | A non-deterministic set of FastStrings. See Note [Deterministic
-- UniqFM] in UniqDFM for explanation why it's not deterministic and why
-- it matters. Use DFastStringEnv if the set eventually gets converted
-- into a list or folded over in a way where the order changes the
-- generated code.
type FastStringEnv a = UniqFM a
mkFsEnv :: [(FastString, a)] -> FastStringEnv a
emptyFsEnv :: FastStringEnv a
unitFsEnv :: FastString -> a -> FastStringEnv a
extendFsEnv_C :: (a -> a -> a) -> FastStringEnv a -> FastString -> a -> FastStringEnv a
extendFsEnv_Acc :: (a -> b -> b) -> (a -> b) -> FastStringEnv b -> FastString -> a -> FastStringEnv b
extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
extendFsEnvList :: FastStringEnv a -> [(FastString, a)] -> FastStringEnv a
extendFsEnvList_C :: (a -> a -> a) -> FastStringEnv a -> [(FastString, a)] -> FastStringEnv a
filterFsEnv :: (elt -> Bool) -> FastStringEnv elt -> FastStringEnv elt
plusFsEnv :: FastStringEnv a -> FastStringEnv a -> FastStringEnv a
plusFsEnv_C :: (a -> a -> a) -> FastStringEnv a -> FastStringEnv a -> FastStringEnv a
alterFsEnv :: (Maybe a -> Maybe a) -> FastStringEnv a -> FastString -> FastStringEnv a
lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
lookupFsEnv_NF :: FastStringEnv a -> FastString -> a
delFromFsEnv :: FastStringEnv a -> FastString -> FastStringEnv a
delListFromFsEnv :: FastStringEnv a -> [FastString] -> FastStringEnv a
elemFsEnv :: FastString -> FastStringEnv a -> Bool
mapFsEnv :: (elt1 -> elt2) -> FastStringEnv elt1 -> FastStringEnv elt2
type DFastStringEnv a = UniqDFM a
mkDFsEnv :: [(FastString, a)] -> DFastStringEnv a
emptyDFsEnv :: DFastStringEnv a
dFsEnvElts :: DFastStringEnv a -> [a]
lookupDFsEnv :: DFastStringEnv a -> FastString -> Maybe a
-- | An architecture independent description of a register's class.
module RegClass
-- | The class of a register. Used in the register allocator. We treat all
-- registers in a class as being interchangable.
data RegClass
RcInteger :: RegClass
RcFloat :: RegClass
RcDouble :: RegClass
RcDoubleSSE :: RegClass
instance GHC.Classes.Eq RegClass.RegClass
instance Unique.Uniquable RegClass.RegClass
instance Outputable.Outputable RegClass.RegClass
-- | Utils for calculating general worst, bound, squeese and free,
-- functions.
--
-- as per: "A Generalized Algorithm for Graph-Coloring Register
-- Allocation" Michael Smith, Normal Ramsey, Glenn Holloway. PLDI 2004
--
-- These general versions are not used in GHC proper because they are too
-- slow. Instead, hand written optimised versions are provided for each
-- architecture in MachRegs*.hs
--
-- This code is here because we can test the architecture specific code
-- against it.
module RegAlloc.Graph.ArchBase
data RegClass
ClassG32 :: RegClass
ClassG16 :: RegClass
ClassG8 :: RegClass
ClassF64 :: RegClass
-- | A register of some class
data Reg
Reg :: RegClass -> Int -> Reg
RegSub :: RegSub -> Reg -> Reg
-- | A subcomponent of another register
data RegSub
SubL16 :: RegSub
SubL8 :: RegSub
SubL8H :: RegSub
-- | Worst case displacement
--
-- a node N of classN has some number of neighbors, all of which are from
-- classC.
--
-- (worst neighbors classN classC) is the maximum number of potential
-- colors for N that can be lost by coloring its neighbors.
--
-- This should be hand coded/cached for each particular architecture,
-- because the compute time is very long..
worst :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> Int -> RegClass -> RegClass -> Int
-- | For a node N of classN and neighbors of classesC (bound classN
-- classesC) is the maximum number of potential colors for N that can be
-- lost by coloring its neighbors.
bound :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [RegClass] -> Int
-- | The total squeese on a particular node with a list of neighbors.
--
-- A version of this should be constructed for each particular
-- architecture, possibly including uses of bound, so that alised
-- registers don't get counted twice, as per the paper.
squeese :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [(Int, RegClass)] -> Int
instance GHC.Classes.Eq RegAlloc.Graph.ArchBase.Reg
instance GHC.Show.Show RegAlloc.Graph.ArchBase.Reg
instance GHC.Classes.Eq RegAlloc.Graph.ArchBase.RegSub
instance GHC.Classes.Ord RegAlloc.Graph.ArchBase.RegSub
instance GHC.Enum.Enum RegAlloc.Graph.ArchBase.RegSub
instance GHC.Show.Show RegAlloc.Graph.ArchBase.RegSub
instance GHC.Enum.Enum RegAlloc.Graph.ArchBase.RegClass
instance GHC.Classes.Eq RegAlloc.Graph.ArchBase.RegClass
instance GHC.Show.Show RegAlloc.Graph.ArchBase.RegClass
instance Unique.Uniquable RegAlloc.Graph.ArchBase.Reg
-- | A description of the register set of the X86.
--
-- This isn't used directly in GHC proper.
--
-- See RegArchBase.hs for the reference. See MachRegs.hs for the actual
-- trivColorable function used in GHC.
module RegAlloc.Graph.ArchX86
-- | Determine the class of a register
classOfReg :: Reg -> RegClass
-- | Determine all the regs that make up a certain class.
regsOfClass :: RegClass -> UniqSet Reg
-- | Determine the common name of a reg returns Nothing if this reg is not
-- part of the machine.
regName :: Reg -> Maybe String
-- | Which regs alias what other regs.
regAlias :: Reg -> UniqSet Reg
-- | Optimised versions of RegColorBase.{worst, squeese} specific to x86
worst :: Int -> RegClass -> RegClass -> Int
squeese :: RegClass -> [(Int, RegClass)] -> Int
-- | An architecture independent description of a register. This needs to
-- stay architecture independent because it is used by NCGMonad and the
-- register allocators, which are shared by all architectures.
module Reg
-- | An identifier for a primitive real machine register.
type RegNo = Int
-- | A register, either virtual or real
data Reg
RegVirtual :: !VirtualReg -> Reg
RegReal :: !RealReg -> Reg
regPair :: RegNo -> RegNo -> Reg
regSingle :: RegNo -> Reg
isRealReg :: Reg -> Bool
takeRealReg :: Reg -> Maybe RealReg
isVirtualReg :: Reg -> Bool
takeVirtualReg :: Reg -> Maybe VirtualReg
data VirtualReg
VirtualRegI :: {-# UNPACK #-} !Unique -> VirtualReg
VirtualRegHi :: {-# UNPACK #-} !Unique -> VirtualReg
VirtualRegF :: {-# UNPACK #-} !Unique -> VirtualReg
VirtualRegD :: {-# UNPACK #-} !Unique -> VirtualReg
VirtualRegSSE :: {-# UNPACK #-} !Unique -> VirtualReg
renameVirtualReg :: Unique -> VirtualReg -> VirtualReg
classOfVirtualReg :: VirtualReg -> RegClass
getHiVirtualRegFromLo :: VirtualReg -> VirtualReg
getHiVRegFromLo :: Reg -> Reg
-- | RealRegs are machine regs which are available for allocation, in the
-- usual way. We know what class they are, because that's part of the
-- processor's architecture.
--
-- RealRegPairs are pairs of real registers that are allocated together
-- to hold a larger value, such as with Double regs on SPARC.
data RealReg
RealRegSingle :: {-# UNPACK #-} !RegNo -> RealReg
RealRegPair :: {-# UNPACK #-} !RegNo -> {-# UNPACK #-} !RegNo -> RealReg
regNosOfRealReg :: RealReg -> [RegNo]
realRegsAlias :: RealReg -> RealReg -> Bool
-- | The patch function supplied by the allocator maps VirtualReg to
-- RealReg regs, but sometimes we want to apply it to plain old Reg.
liftPatchFnToRegReg :: (VirtualReg -> RealReg) -> (Reg -> Reg)
instance GHC.Classes.Ord Reg.Reg
instance GHC.Classes.Eq Reg.Reg
instance GHC.Classes.Ord Reg.RealReg
instance GHC.Show.Show Reg.RealReg
instance GHC.Classes.Eq Reg.RealReg
instance GHC.Show.Show Reg.VirtualReg
instance GHC.Classes.Eq Reg.VirtualReg
instance Unique.Uniquable Reg.Reg
instance Outputable.Outputable Reg.Reg
instance Unique.Uniquable Reg.RealReg
instance Outputable.Outputable Reg.RealReg
instance GHC.Classes.Ord Reg.VirtualReg
instance Unique.Uniquable Reg.VirtualReg
instance Outputable.Outputable Reg.VirtualReg
module RegAlloc.Graph.TrivColorable
trivColorable :: Platform -> (RegClass -> VirtualReg -> Int) -> (RegClass -> RealReg -> Int) -> Triv VirtualReg RegClass RealReg
-- | Pretty printing of graphs.
module GraphPpr
-- | Pretty print a graph in a somewhat human readable format.
dumpGraph :: (Outputable k, Outputable color) => Graph k cls color -> SDoc
-- | Pretty print a graph in graphviz .dot format. Conflicts get solid
-- edges. Coalescences get dashed edges.
dotGraph :: (Uniquable k, Outputable k, Outputable cls, Outputable color) => (color -> SDoc) -> Triv k cls color -> Graph k cls color -> SDoc
-- | Basic operations on graphs.
module GraphOps
-- | Add a node to the graph, linking up its edges
addNode :: Uniquable k => k -> Node k cls color -> Graph k cls color -> Graph k cls color
-- | Delete a node and all its edges from the graph.
delNode :: (Uniquable k) => k -> Graph k cls color -> Maybe (Graph k cls color)
-- | Get a node from the graph, throwing an error if it's not there
getNode :: Uniquable k => Graph k cls color -> k -> Node k cls color
-- | Lookup a node from the graph.
lookupNode :: Uniquable k => Graph k cls color -> k -> Maybe (Node k cls color)
-- | Modify a node in the graph. returns Nothing if the node isn't present.
modNode :: Uniquable k => (Node k cls color -> Node k cls color) -> k -> Graph k cls color -> Maybe (Graph k cls color)
-- | Get the size of the graph, O(n)
size :: Graph k cls color -> Int
-- | Union two graphs together.
union :: Graph k cls color -> Graph k cls color -> Graph k cls color
-- | Add a conflict between nodes to the graph, creating the nodes
-- required. Conflicts are virtual regs which need to be colored
-- differently.
addConflict :: Uniquable k => (k, cls) -> (k, cls) -> Graph k cls color -> Graph k cls color
-- | Delete a conflict edge. k1 -> k2 returns Nothing if the node isn't
-- in the graph
delConflict :: Uniquable k => k -> k -> Graph k cls color -> Maybe (Graph k cls color)
-- | Add some conflicts to the graph, creating nodes if required. All the
-- nodes in the set are taken to conflict with each other.
addConflicts :: Uniquable k => UniqSet k -> (k -> cls) -> Graph k cls color -> Graph k cls color
-- | Add a coalescence edge to the graph, creating nodes if requried. It is
-- considered adventageous to assign the same color to nodes in a
-- coalesence.
addCoalesce :: Uniquable k => (k, cls) -> (k, cls) -> Graph k cls color -> Graph k cls color
-- | Delete a coalescence edge (k1 -> k2) from the graph.
delCoalesce :: Uniquable k => k -> k -> Graph k cls color -> Maybe (Graph k cls color)
-- | Add an exclusion to the graph, creating nodes if required. These are
-- extra colors that the node cannot use.
addExclusion :: (Uniquable k, Uniquable color) => k -> (k -> cls) -> color -> Graph k cls color -> Graph k cls color
addExclusions :: (Uniquable k, Uniquable color) => k -> (k -> cls) -> [color] -> Graph k cls color -> Graph k cls color
-- | Add a color preference to the graph, creating nodes if required. The
-- most recently added preference is the most prefered. The algorithm
-- tries to assign a node it's prefered color if possible.
addPreference :: Uniquable k => (k, cls) -> color -> Graph k cls color -> Graph k cls color
-- | Coalesce this pair of nodes unconditionally / aggressively. The
-- resulting node is the one with the least key.
--
-- returns: Just the pair of keys if the nodes were coalesced the second
-- element of the pair being the least one
--
-- Nothing if either of the nodes weren't in the graph
coalesceNodes :: (Uniquable k, Ord k, Eq cls) => Bool -> Triv k cls color -> Graph k cls color -> (k, k) -> (Graph k cls color, Maybe (k, k))
-- | Do aggressive coalescing on this graph. returns the new graph and the
-- list of pairs of nodes that got coalesced together. for each pair, the
-- resulting node will have the least key and be second in the pair.
coalesceGraph :: (Uniquable k, Ord k, Eq cls, Outputable k) => Bool -> Triv k cls color -> Graph k cls color -> (Graph k cls color, [(k, k)])
-- | Freeze a node This is for the iterative coalescer. By freezing a node
-- we give up on ever coalescing it. Move all its coalesce edges into the
-- frozen set - and update back edges from other nodes.
freezeNode :: Uniquable k => k -> Graph k cls color -> Graph k cls color
-- | Freeze one node in the graph This if for the iterative coalescer. Look
-- for a move related node of low degree and freeze it.
--
-- We probably don't need to scan the whole graph looking for the node of
-- absolute lowest degree. Just sample the first few and choose the one
-- with the lowest degree out of those. Also, we don't make any
-- distinction between conflicts of different classes.. this is just a
-- heuristic, after all.
--
-- IDEA: freezing a node might free it up for Simplify.. would be good to
-- check for triv right here, and add it to a worklist if known
-- triv/non-move nodes.
freezeOneInGraph :: (Uniquable k) => Graph k cls color -> (Graph k cls color, Bool)
-- | Freeze all the nodes in the graph for debugging the iterative
-- allocator.
freezeAllInGraph :: (Uniquable k) => Graph k cls color -> Graph k cls color
-- | Find all the nodes in the graph that meet some criteria
scanGraph :: (Node k cls color -> Bool) -> Graph k cls color -> [Node k cls color]
-- | Set the color of a certain node
setColor :: Uniquable k => k -> color -> Graph k cls color -> Graph k cls color
-- | validate the internal structure of a graph all its edges should point
-- to valid nodes If they don't then throw an error
validateGraph :: (Uniquable k, Outputable k, Eq color) => SDoc -> Bool -> Graph k cls color -> Graph k cls color
-- | Slurp out a map of how many nodes had a certain number of conflict
-- neighbours
slurpNodeConflictCount :: Graph k cls color -> UniqFM (Int, Int)
-- | Graph Coloring. This is a generic graph coloring library, abstracted
-- over the type of the node keys, nodes and colors.
module GraphColor
-- | Try to color a graph with this set of colors. Uses Chaitin's algorithm
-- to color the graph. The graph is scanned for nodes which are deamed
-- 'trivially colorable'. These nodes are pushed onto a stack and removed
-- from the graph. Once this process is complete the graph can be colored
-- by removing nodes from the stack (ie in reverse order) and assigning
-- them colors different to their neighbors.
colorGraph :: (Uniquable k, Uniquable cls, Uniquable color, Eq cls, Ord k, Outputable k, Outputable cls, Outputable color) => Bool -> Int -> UniqFM (UniqSet color) -> Triv k cls color -> (Graph k cls color -> k) -> Graph k cls color -> (Graph k cls color, UniqSet k, UniqFM k)
module Binary
data Bin a
class Binary a
put_ :: Binary a => BinHandle -> a -> IO ()
put :: Binary a => BinHandle -> a -> IO (Bin a)
get :: Binary a => BinHandle -> IO a
data BinHandle
type SymbolTable = Array Int Name
type Dictionary = Array Int FastString
openBinMem :: Int -> IO BinHandle
seekBin :: BinHandle -> Bin a -> IO ()
seekBy :: BinHandle -> Int -> IO ()
tellBin :: BinHandle -> IO (Bin a)
castBin :: Bin a -> Bin b
isEOFBin :: BinHandle -> IO Bool
-- | Get access to the underlying buffer.
--
-- It is quite important that no references to the ByteString leak
-- out of the continuation lest terrible things happen.
withBinBuffer :: BinHandle -> (ByteString -> IO a) -> IO a
writeBinMem :: BinHandle -> FilePath -> IO ()
readBinMem :: FilePath -> IO BinHandle
putAt :: Binary a => BinHandle -> Bin a -> a -> IO ()
getAt :: Binary a => BinHandle -> Bin a -> IO a
putByte :: BinHandle -> Word8 -> IO ()
getByte :: BinHandle -> IO Word8
lazyGet :: Binary a => BinHandle -> IO a
lazyPut :: Binary a => BinHandle -> a -> IO ()
-- | Information we keep around during interface file
-- serialization/deserialization. Namely we keep the functions for
-- serializing and deserializing Names and FastStrings. We
-- do this because we actually use serialization in two distinct
-- settings,
--
--
-- - When serializing interface files themselves
-- - When computing the fingerprint of an IfaceDecl (which we computing
-- by hashing its Binary serialization)
--
--
-- These two settings have different needs while serializing Names:
--
--
-- - Names in interface files are serialized via a symbol table (see
-- Note [Symbol table representation of names] in BinIface).
-- - During fingerprinting a binding Name is serialized as the OccName
-- and a non-binding Name is serialized as the fingerprint of the thing
-- they represent. See Note [Fingerprinting IfaceDecls] for further
-- discussion.
--
data UserData
UserData :: (BinHandle -> IO Name) -> (BinHandle -> IO FastString) -> (BinHandle -> Name -> IO ()) -> (BinHandle -> Name -> IO ()) -> (BinHandle -> FastString -> IO ()) -> UserData
[ud_get_name] :: UserData -> BinHandle -> IO Name
[ud_get_fs] :: UserData -> BinHandle -> IO FastString
-- | serialize a non-binding Name (e.g. a reference to another
-- binding).
[ud_put_nonbinding_name] :: UserData -> BinHandle -> Name -> IO ()
-- | serialize a binding Name (e.g. the name of an IfaceDecl)
[ud_put_binding_name] :: UserData -> BinHandle -> Name -> IO ()
[ud_put_fs] :: UserData -> BinHandle -> FastString -> IO ()
getUserData :: BinHandle -> UserData
setUserData :: BinHandle -> UserData -> BinHandle
newReadState :: (BinHandle -> IO Name) -> (BinHandle -> IO FastString) -> UserData
newWriteState :: (BinHandle -> Name -> IO ()) -> (BinHandle -> Name -> IO ()) -> (BinHandle -> FastString -> IO ()) -> UserData
putDictionary :: BinHandle -> Int -> UniqFM (Int, FastString) -> IO ()
getDictionary :: BinHandle -> IO Dictionary
putFS :: BinHandle -> FastString -> IO ()
instance forall k (a :: k). GHC.Enum.Bounded (Binary.Bin a)
instance forall k (a :: k). GHC.Show.Show (Binary.Bin a)
instance forall k (a :: k). GHC.Classes.Ord (Binary.Bin a)
instance forall k (a :: k). GHC.Classes.Eq (Binary.Bin a)
instance Binary.Binary GHC.Word.Word8
instance Binary.Binary GHC.Word.Word16
instance Binary.Binary GHC.Word.Word32
instance Binary.Binary GHC.Word.Word64
instance Binary.Binary GHC.Int.Int8
instance Binary.Binary GHC.Int.Int16
instance Binary.Binary GHC.Int.Int32
instance Binary.Binary GHC.Int.Int64
instance Binary.Binary ()
instance Binary.Binary GHC.Types.Bool
instance Binary.Binary GHC.Types.Char
instance Binary.Binary GHC.Types.Int
instance Binary.Binary a => Binary.Binary [a]
instance (Binary.Binary a, Binary.Binary b) => Binary.Binary (a, b)
instance (Binary.Binary a, Binary.Binary b, Binary.Binary c) => Binary.Binary (a, b, c)
instance (Binary.Binary a, Binary.Binary b, Binary.Binary c, Binary.Binary d) => Binary.Binary (a, b, c, d)
instance (Binary.Binary a, Binary.Binary b, Binary.Binary c, Binary.Binary d, Binary.Binary e) => Binary.Binary (a, b, c, d, e)
instance (Binary.Binary a, Binary.Binary b, Binary.Binary c, Binary.Binary d, Binary.Binary e, Binary.Binary f) => Binary.Binary (a, b, c, d, e, f)
instance (Binary.Binary a, Binary.Binary b, Binary.Binary c, Binary.Binary d, Binary.Binary e, Binary.Binary f, Binary.Binary g) => Binary.Binary (a, b, c, d, e, f, g)
instance Binary.Binary a => Binary.Binary (GHC.Base.Maybe a)
instance (Binary.Binary a, Binary.Binary b) => Binary.Binary (Data.Either.Either a b)
instance Binary.Binary Data.Time.Clock.Internal.UTCTime.UTCTime
instance Binary.Binary Data.Time.Calendar.Days.Day
instance Binary.Binary Data.Time.Clock.Internal.DiffTime.DiffTime
instance Binary.Binary GHC.Integer.Type.Integer
instance Binary.Binary a => Binary.Binary (GHC.Real.Ratio a)
instance forall k (a :: k). Binary.Binary (Binary.Bin a)
instance Binary.Binary GHC.Types.TyCon
instance Binary.Binary GHC.Types.VecCount
instance Binary.Binary GHC.Types.VecElem
instance Binary.Binary GHC.Types.RuntimeRep
instance Binary.Binary GHC.Types.KindRep
instance Binary.Binary GHC.Types.TypeLitSort
instance forall k (a :: k). Data.Typeable.Internal.Typeable a => Binary.Binary (Data.Typeable.Internal.TypeRep a)
instance Binary.Binary Data.Typeable.Internal.SomeTypeRep
instance Binary.Binary Data.ByteString.Internal.ByteString
instance Binary.Binary FastString.FastString
instance Binary.Binary BasicTypes.LeftOrRight
instance Binary.Binary GHC.Fingerprint.Type.Fingerprint
instance Binary.Binary BasicTypes.FunctionOrData
instance Binary.Binary BasicTypes.TupleSort
instance Binary.Binary BasicTypes.Activation
instance Binary.Binary BasicTypes.InlinePragma
instance Binary.Binary BasicTypes.RuleMatchInfo
instance Binary.Binary BasicTypes.InlineSpec
instance Binary.Binary BasicTypes.RecFlag
instance Binary.Binary BasicTypes.OverlapMode
instance Binary.Binary BasicTypes.OverlapFlag
instance Binary.Binary BasicTypes.FixityDirection
instance Binary.Binary BasicTypes.Fixity
instance Binary.Binary BasicTypes.WarningTxt
instance Binary.Binary BasicTypes.StringLiteral
instance Binary.Binary a => Binary.Binary (SrcLoc.GenLocated SrcLoc.SrcSpan a)
instance Binary.Binary SrcLoc.SrcSpan
instance Binary.Binary GHC.Serialized.Serialized
instance Binary.Binary BasicTypes.SourceText
module Module
-- | A ModuleName is essentially a simple string, e.g. Data.List.
data ModuleName
pprModuleName :: ModuleName -> SDoc
moduleNameFS :: ModuleName -> FastString
moduleNameString :: ModuleName -> String
-- | Returns the string version of the module name, with dots replaced by
-- slashes.
moduleNameSlashes :: ModuleName -> String
-- | Returns the string version of the module name, with dots replaced by
-- colons.
moduleNameColons :: ModuleName -> String
-- | Get a string representation of a Module that's unique and
-- stable across recompilations. eg.
-- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal"
moduleStableString :: Module -> String
-- | Calculate the free holes of a Module. If this set is non-empty,
-- this module was defined in an indefinite library that had required
-- signatures.
--
-- If a module has free holes, that means that substitutions can operate
-- on it; if it has no free holes, substituting over a module has no
-- effect.
moduleFreeHoles :: Module -> UniqDSet ModuleName
-- | A Module is definite if it has no free holes.
moduleIsDefinite :: Module -> Bool
mkModuleName :: String -> ModuleName
mkModuleNameFS :: FastString -> ModuleName
-- | Compares module names lexically, rather than by their Uniques
stableModuleNameCmp :: ModuleName -> ModuleName -> Ordering
-- | A ComponentId consists of the package name, package version,
-- component ID, the transitive dependencies of the component, and other
-- information to uniquely identify the source code and build
-- configuration of a component.
--
-- This used to be known as an InstalledPackageId, but a package
-- can contain multiple components and a ComponentId uniquely
-- identifies a component within a package. When a package only has one
-- component, the ComponentId coincides with the
-- InstalledPackageId
newtype ComponentId
ComponentId :: FastString -> ComponentId
-- | A unit identifier identifies a (possibly partially) instantiated
-- library. It is primarily used as part of Module, which in turn
-- is used in Name, which is used to give names to entities when
-- typechecking.
--
-- There are two possible forms for a UnitId. It can be a
-- DefiniteUnitId, in which case we just have a string that
-- uniquely identifies some fully compiled, installed library we have on
-- disk. However, when we are typechecking a library with missing holes,
-- we may need to instantiate a library on the fly (in which case we
-- don't have any on-disk representation.) In that case, you have an
-- IndefiniteUnitId, which explicitly records the instantiation,
-- so that we can substitute over it.
data UnitId
IndefiniteUnitId :: {-# UNPACK #-} !IndefUnitId -> UnitId
DefiniteUnitId :: {-# UNPACK #-} !DefUnitId -> UnitId
unitIdFS :: UnitId -> FastString
unitIdKey :: UnitId -> Unique
-- | A unit identifier which identifies an indefinite library (with holes)
-- that has been *on-the-fly* instantiated with a substitution
-- indefUnitIdInsts. In fact, an indefinite unit identifier could
-- have no holes, but we haven't gotten around to compiling the actual
-- library yet.
--
-- An indefinite unit identifier pretty-prints to something like
-- p[H=H,A=aimpl:A>] (p is the
-- ComponentId, and the brackets enclose the module substitution).
data IndefUnitId
IndefUnitId :: FastString -> Unique -> !ComponentId -> ![(ModuleName, Module)] -> UniqDSet ModuleName -> IndefUnitId
-- | A private, uniquely identifying representation of a UnitId. This
-- string is completely private to GHC and is just used to get a unique;
-- in particular, we don't use it for symbols (indefinite libraries are
-- not compiled).
[indefUnitIdFS] :: IndefUnitId -> FastString
-- | Cached unique of unitIdFS.
[indefUnitIdKey] :: IndefUnitId -> Unique
-- | The component identity of the indefinite library that is being
-- instantiated.
[indefUnitIdComponentId] :: IndefUnitId -> !ComponentId
-- | The sorted (by ModuleName) instantiations of this library.
[indefUnitIdInsts] :: IndefUnitId -> ![(ModuleName, Module)]
-- | A cache of the free module variables of unitIdInsts. This
-- lets us efficiently tell if a UnitId has been fully
-- instantiated (free module variables are empty) and whether or not a
-- substitution can have any effect.
[indefUnitIdFreeHoles] :: IndefUnitId -> UniqDSet ModuleName
data IndefModule
IndefModule :: IndefUnitId -> ModuleName -> IndefModule
[indefModuleUnitId] :: IndefModule -> IndefUnitId
[indefModuleName] :: IndefModule -> ModuleName
-- | Injects an IndefUnitId (indefinite library which was on-the-fly
-- instantiated) to a UnitId (either an indefinite or definite
-- library).
indefUnitIdToUnitId :: DynFlags -> IndefUnitId -> UnitId
-- | Injects an IndefModule to Module (see also
-- indefUnitIdToUnitId.
indefModuleToModule :: DynFlags -> IndefModule -> Module
-- | An installed unit identifier identifies a library which has been
-- installed to the package database. These strings are provided to us
-- via the -this-unit-id flag. The library in question may be
-- definite or indefinite; if it is indefinite, none of the holes have
-- been filled (we never install partially instantiated libraries.) Put
-- another way, an installed unit id is either fully instantiated, or not
-- instantiated at all.
--
-- Installed unit identifiers look something like
-- p+af23SAj2dZ219, or maybe just p if they don't use
-- Backpack.
newtype InstalledUnitId
InstalledUnitId :: FastString -> InstalledUnitId
-- | The full hashed unit identifier, including the component id and the
-- hash.
[installedUnitIdFS] :: InstalledUnitId -> FastString
-- | Lossy conversion to the on-disk InstalledUnitId for a
-- component.
toInstalledUnitId :: UnitId -> InstalledUnitId
-- | Substitution on module variables, mapping module names to module
-- identifiers.
type ShHoleSubst = ModuleNameEnv Module
-- | A UnitId is definite if it has no free holes.
unitIdIsDefinite :: UnitId -> Bool
unitIdString :: UnitId -> String
-- | Retrieve the set of free holes of a UnitId.
unitIdFreeHoles :: UnitId -> UniqDSet ModuleName
-- | Create a new, un-hashed unit identifier.
newUnitId :: ComponentId -> [(ModuleName, Module)] -> UnitId
-- | Create a new IndefUnitId given an explicit module substitution.
newIndefUnitId :: ComponentId -> [(ModuleName, Module)] -> IndefUnitId
-- | Create a new simple unit identifier (no holes) from a
-- ComponentId.
newSimpleUnitId :: ComponentId -> UnitId
-- | Generate a uniquely identifying FastString for a unit
-- identifier. This is a one-way function. You can rely on one special
-- property: if a unit identifier is in most general form, its
-- FastString coincides with its ComponentId. This hash is
-- completely internal to GHC and is not used for symbol names or file
-- paths.
hashUnitId :: ComponentId -> [(ModuleName, Module)] -> FastString
-- | Create a new simple unit identifier from a FastString.
-- Internally, this is primarily used to specify wired-in unit
-- identifiers.
fsToUnitId :: FastString -> UnitId
stringToUnitId :: String -> UnitId
-- | Compares package ids lexically, rather than by their Uniques
stableUnitIdCmp :: UnitId -> UnitId -> Ordering
-- | Substitutes holes in a UnitId, suitable for renaming when an
-- include occurs; see Note [Representation of module/name variable].
--
-- p[A=A] maps to p[A=B] with
-- A=B.
renameHoleUnitId :: DynFlags -> ShHoleSubst -> UnitId -> UnitId
-- | Substitutes holes in a Module. NOT suitable for being called
-- directly on a nameModule, see Note [Representation of
-- module/name variable]. p[A=A]:B maps to
-- p[A=q():A]:B with A=q():A; similarly,
-- A maps to q():A.
renameHoleModule :: DynFlags -> ShHoleSubst -> Module -> Module
-- | Like 'renameHoleUnitId, but requires only PackageConfigMap so
-- it can be used by Packages.
renameHoleUnitId' :: PackageConfigMap -> ShHoleSubst -> UnitId -> UnitId
-- | Like renameHoleModule, but requires only
-- PackageConfigMap so it can be used by Packages.
renameHoleModule' :: PackageConfigMap -> ShHoleSubst -> Module -> Module
-- | Given a possibly on-the-fly instantiated module, split it into a
-- Module that we definitely can find on-disk, as well as an
-- instantiation if we need to instantiate it on the fly. If the
-- instantiation is Nothing no on-the-fly renaming is needed.
splitModuleInsts :: Module -> (InstalledModule, Maybe IndefModule)
-- | See splitModuleInsts.
splitUnitIdInsts :: UnitId -> (InstalledUnitId, Maybe IndefUnitId)
generalizeIndefUnitId :: IndefUnitId -> IndefUnitId
generalizeIndefModule :: IndefModule -> IndefModule
parseModuleName :: ReadP ModuleName
parseUnitId :: ReadP UnitId
parseComponentId :: ReadP ComponentId
parseModuleId :: ReadP Module
parseModSubst :: ReadP [(ModuleName, Module)]
primUnitId :: UnitId
integerUnitId :: UnitId
baseUnitId :: UnitId
rtsUnitId :: UnitId
thUnitId :: UnitId
dphSeqUnitId :: UnitId
dphParUnitId :: UnitId
-- | This is the package Id for the current program. It is the default
-- package Id if you don't specify a package name. We don't add this
-- prefix to symbol names, since there can be only one main package per
-- program.
mainUnitId :: UnitId
thisGhcUnitId :: UnitId
isHoleModule :: Module -> Bool
interactiveUnitId :: UnitId
isInteractiveModule :: Module -> Bool
wiredInUnitIds :: [UnitId]
-- | A Module is a pair of a UnitId and a ModuleName.
--
-- Module variables (i.e. H) which can be instantiated to
-- a specific module at some later point in time are represented with
-- moduleUnitId set to holeUnitId (this allows us to avoid
-- having to make moduleUnitId a partial operation.)
data Module
Module :: !UnitId -> !ModuleName -> Module
[moduleUnitId] :: Module -> !UnitId
[moduleName] :: Module -> !ModuleName
pprModule :: Module -> SDoc
mkModule :: UnitId -> ModuleName -> Module
-- | Create a module variable at some ModuleName. See Note
-- [Representation of module/name variables]
mkHoleModule :: ModuleName -> Module
-- | This gives a stable ordering, as opposed to the Ord instance which
-- gives an ordering based on the Uniques of the components, which
-- may not be stable from run to run of the compiler.
stableModuleCmp :: Module -> Module -> Ordering
class HasModule m
getModule :: HasModule m => m Module
class ContainsModule t
extractModule :: ContainsModule t => t -> Module
-- | A InstalledModule is a Module which contains a
-- InstalledUnitId.
data InstalledModule
InstalledModule :: !InstalledUnitId -> !ModuleName -> InstalledModule
[installedModuleUnitId] :: InstalledModule -> !InstalledUnitId
[installedModuleName] :: InstalledModule -> !ModuleName
-- | A map keyed off of InstalledModule
data InstalledModuleEnv elt
-- | Test if a Module corresponds to a given InstalledModule,
-- modulo instantiation.
installedModuleEq :: InstalledModule -> Module -> Bool
-- | Test if a UnitId corresponds to a given InstalledUnitId,
-- modulo instantiation.
installedUnitIdEq :: InstalledUnitId -> UnitId -> Bool
installedUnitIdString :: InstalledUnitId -> String
fsToInstalledUnitId :: FastString -> InstalledUnitId
componentIdToInstalledUnitId :: ComponentId -> InstalledUnitId
stringToInstalledUnitId :: String -> InstalledUnitId
emptyInstalledModuleEnv :: InstalledModuleEnv a
lookupInstalledModuleEnv :: InstalledModuleEnv a -> InstalledModule -> Maybe a
extendInstalledModuleEnv :: InstalledModuleEnv a -> InstalledModule -> a -> InstalledModuleEnv a
filterInstalledModuleEnv :: (InstalledModule -> a -> Bool) -> InstalledModuleEnv a -> InstalledModuleEnv a
delInstalledModuleEnv :: InstalledModuleEnv a -> InstalledModule -> InstalledModuleEnv a
-- | A DefUnitId is an InstalledUnitId with the invariant
-- that it only refers to a definite library; i.e., one we have generated
-- code for.
newtype DefUnitId
DefUnitId :: InstalledUnitId -> DefUnitId
[unDefUnitId] :: DefUnitId -> InstalledUnitId
-- | Module Location
--
-- Where a module lives on the file system: the actual locations of the
-- .hs, .hi and .o files, if we have them
data ModLocation
ModLocation :: Maybe FilePath -> FilePath -> FilePath -> ModLocation
[ml_hs_file] :: ModLocation -> Maybe FilePath
[ml_hi_file] :: ModLocation -> FilePath
[ml_obj_file] :: ModLocation -> FilePath
-- | Add the -boot suffix to .hs, .hi and .o files
addBootSuffix :: FilePath -> FilePath
-- | Add the -boot suffix if the Bool argument is
-- True
addBootSuffix_maybe :: Bool -> FilePath -> FilePath
-- | Add the -boot suffix to all file paths associated with the
-- module
addBootSuffixLocn :: ModLocation -> ModLocation
-- | A map keyed off of Modules
data ModuleEnv elt
elemModuleEnv :: Module -> ModuleEnv a -> Bool
extendModuleEnv :: ModuleEnv a -> Module -> a -> ModuleEnv a
extendModuleEnvList :: ModuleEnv a -> [(Module, a)] -> ModuleEnv a
extendModuleEnvList_C :: (a -> a -> a) -> ModuleEnv a -> [(Module, a)] -> ModuleEnv a
plusModuleEnv_C :: (a -> a -> a) -> ModuleEnv a -> ModuleEnv a -> ModuleEnv a
delModuleEnvList :: ModuleEnv a -> [Module] -> ModuleEnv a
delModuleEnv :: ModuleEnv a -> Module -> ModuleEnv a
plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a
lookupModuleEnv :: ModuleEnv a -> Module -> Maybe a
lookupWithDefaultModuleEnv :: ModuleEnv a -> a -> Module -> a
mapModuleEnv :: (a -> b) -> ModuleEnv a -> ModuleEnv b
mkModuleEnv :: [(Module, a)] -> ModuleEnv a
emptyModuleEnv :: ModuleEnv a
moduleEnvKeys :: ModuleEnv a -> [Module]
moduleEnvElts :: ModuleEnv a -> [a]
moduleEnvToList :: ModuleEnv a -> [(Module, a)]
unitModuleEnv :: Module -> a -> ModuleEnv a
isEmptyModuleEnv :: ModuleEnv a -> Bool
extendModuleEnvWith :: (a -> a -> a) -> ModuleEnv a -> Module -> a -> ModuleEnv a
filterModuleEnv :: (Module -> a -> Bool) -> ModuleEnv a -> ModuleEnv a
-- | A map keyed off of ModuleNames (actually, their Uniques)
type ModuleNameEnv elt = UniqFM elt
-- | A map keyed off of ModuleNames (actually, their Uniques)
-- Has deterministic folds and can be deterministically converted to a
-- list
type DModuleNameEnv elt = UniqDFM elt
-- | A set of Modules
type ModuleSet = Set NDModule
emptyModuleSet :: ModuleSet
mkModuleSet :: [Module] -> ModuleSet
moduleSetElts :: ModuleSet -> [Module]
extendModuleSet :: ModuleSet -> Module -> ModuleSet
elemModuleSet :: Module -> ModuleSet -> Bool
instance GHC.Classes.Eq Module.NDModule
instance GHC.Classes.Ord Module.IndefModule
instance GHC.Classes.Eq Module.IndefModule
instance GHC.Classes.Ord Module.InstalledModule
instance GHC.Classes.Eq Module.InstalledModule
instance GHC.Classes.Ord Module.Module
instance GHC.Classes.Eq Module.Module
instance GHC.Classes.Ord Module.ComponentId
instance GHC.Classes.Eq Module.ComponentId
instance GHC.Classes.Ord Module.DefUnitId
instance GHC.Classes.Eq Module.DefUnitId
instance GHC.Show.Show Module.ModLocation
instance GHC.Classes.Ord Module.NDModule
instance Outputable.Outputable Module.IndefModule
instance Outputable.Outputable Module.InstalledModule
instance Unique.Uniquable Module.ModuleName
instance GHC.Classes.Eq Module.ModuleName
instance GHC.Classes.Ord Module.ModuleName
instance Outputable.Outputable Module.ModuleName
instance Binary.Binary Module.ModuleName
instance GHC.PackageDb.BinaryStringRep Module.ModuleName
instance Data.Data.Data Module.ModuleName
instance Control.DeepSeq.NFData Module.ModuleName
instance Unique.Uniquable Module.Module
instance Outputable.Outputable Module.Module
instance Binary.Binary Module.Module
instance Data.Data.Data Module.Module
instance Control.DeepSeq.NFData Module.Module
instance GHC.PackageDb.DbUnitIdModuleRep Module.InstalledUnitId Module.ComponentId Module.UnitId Module.ModuleName Module.Module
instance GHC.PackageDb.BinaryStringRep Module.ComponentId
instance Unique.Uniquable Module.ComponentId
instance Outputable.Outputable Module.ComponentId
instance GHC.Classes.Eq Module.IndefUnitId
instance GHC.Classes.Ord Module.IndefUnitId
instance Binary.Binary Module.IndefUnitId
instance Binary.Binary Module.InstalledUnitId
instance GHC.PackageDb.BinaryStringRep Module.InstalledUnitId
instance GHC.Classes.Eq Module.InstalledUnitId
instance GHC.Classes.Ord Module.InstalledUnitId
instance Unique.Uniquable Module.InstalledUnitId
instance Outputable.Outputable Module.InstalledUnitId
instance Outputable.Outputable Module.IndefUnitId
instance Outputable.Outputable Module.DefUnitId
instance Binary.Binary Module.DefUnitId
instance GHC.Show.Show Module.UnitId
instance GHC.Classes.Eq Module.UnitId
instance Unique.Uniquable Module.UnitId
instance GHC.Classes.Ord Module.UnitId
instance Data.Data.Data Module.UnitId
instance Control.DeepSeq.NFData Module.UnitId
instance Outputable.Outputable Module.UnitId
instance Binary.Binary Module.UnitId
instance Binary.Binary Module.ComponentId
instance Outputable.Outputable Module.ModLocation
-- | Package configuration information: essentially the interface to Cabal,
-- with some utilities
--
-- (c) The University of Glasgow, 2004
module PackageConfig
packageConfigId :: PackageConfig -> UnitId
expandedPackageConfigId :: PackageConfig -> UnitId
definitePackageConfigId :: PackageConfig -> Maybe DefUnitId
-- | Get the GHC UnitId right out of a Cabalish PackageConfig
installedPackageConfigId :: PackageConfig -> InstalledUnitId
type PackageConfig = InstalledPackageInfo ComponentId SourcePackageId PackageName InstalledUnitId UnitId ModuleName Module
-- | This is a subset of Cabal's InstalledPackageInfo, with just the
-- bits that GHC is interested in. See Cabal's documentation for a more
-- detailed description of all of the fields.
data InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod :: * -> * -> * -> * -> * -> * -> * -> *
InstalledPackageInfo :: instunitid -> compid -> [(modulename, mod)] -> srcpkgid -> srcpkgname -> Version -> Maybe srcpkgname -> String -> [instunitid] -> [(instunitid, String)] -> [FilePath] -> [String] -> [String] -> [String] -> [FilePath] -> [FilePath] -> [String] -> [FilePath] -> [String] -> [String] -> [String] -> [FilePath] -> [FilePath] -> [FilePath] -> [(modulename, Maybe mod)] -> [modulename] -> Bool -> Bool -> Bool -> InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod
[unitId] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> instunitid
[componentId] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> compid
[instantiatedWith] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [(modulename, mod)]
[sourcePackageId] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> srcpkgid
[packageName] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> srcpkgname
[packageVersion] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> Version
[sourceLibName] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> Maybe srcpkgname
[abiHash] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> String
[depends] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [instunitid]
-- | Like depends, but each dependency is annotated with the ABI
-- hash we expect the dependency to respect.
[abiDepends] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [(instunitid, String)]
[importDirs] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[hsLibraries] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[extraLibraries] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[extraGHCiLibraries] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[libraryDirs] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[libraryDynDirs] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[frameworks] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[frameworkDirs] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[ldOptions] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[ccOptions] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[includes] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [String]
[includeDirs] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[haddockInterfaces] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[haddockHTMLs] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [FilePath]
[exposedModules] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [(modulename, Maybe mod)]
[hiddenModules] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> [modulename]
[indefinite] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> Bool
[exposed] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> Bool
[trusted] :: InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulename mod -> Bool
-- | A ComponentId consists of the package name, package version,
-- component ID, the transitive dependencies of the component, and other
-- information to uniquely identify the source code and build
-- configuration of a component.
--
-- This used to be known as an InstalledPackageId, but a package
-- can contain multiple components and a ComponentId uniquely
-- identifies a component within a package. When a package only has one
-- component, the ComponentId coincides with the
-- InstalledPackageId
newtype ComponentId
ComponentId :: FastString -> ComponentId
newtype SourcePackageId
SourcePackageId :: FastString -> SourcePackageId
newtype PackageName
PackageName :: FastString -> PackageName
-- | A Version represents the version of a software entity.
--
-- An instance of Eq is provided, which implements exact equality
-- modulo reordering of the tags in the versionTags field.
--
-- An instance of Ord is also provided, which gives lexicographic
-- ordering on the versionBranch fields (i.e. 2.1 > 2.0, 1.2.3
-- > 1.2.2, etc.). This is expected to be sufficient for many uses,
-- but note that you may need to use a more specific ordering for your
-- versioning scheme. For example, some versioning schemes may include
-- pre-releases which have tags "pre1", "pre2", and so
-- on, and these would need to be taken into account when determining
-- ordering. In some cases, date ordering may be more appropriate, so the
-- application would have to look for date tags in the
-- versionTags field and compare those. The bottom line is, don't
-- always assume that compare and other Ord operations are
-- the right thing for every Version.
--
-- Similarly, concrete representations of versions may differ. One
-- possible concrete representation is provided (see showVersion
-- and parseVersion), but depending on the application a different
-- concrete representation may be more appropriate.
data Version :: *
Version :: [Int] -> [String] -> Version
-- | The numeric branch for this version. This reflects the fact that most
-- software versions are tree-structured; there is a main trunk which is
-- tagged with versions at various points (1,2,3...), and the first
-- branch off the trunk after version 3 is 3.1, the second branch off the
-- trunk after version 3 is 3.2, and so on. The tree can be branched
-- arbitrarily, just by adding more digits.
--
-- We represent the branch as a list of Int, so version 3.2.1
-- becomes [3,2,1]. Lexicographic ordering (i.e. the default instance of
-- Ord for [Int]) gives the natural ordering of branches.
[versionBranch] :: Version -> [Int]
-- | A version can be tagged with an arbitrary list of strings. The
-- interpretation of the list of tags is entirely dependent on the entity
-- that this version applies to.
[versionTags] :: Version -> [String]
defaultPackageConfig :: PackageConfig
sourcePackageIdString :: PackageConfig -> String
packageNameString :: PackageConfig -> String
pprPackageConfig :: PackageConfig -> SDoc
instance GHC.Classes.Ord PackageConfig.PackageName
instance GHC.Classes.Eq PackageConfig.PackageName
instance GHC.Classes.Ord PackageConfig.SourcePackageId
instance GHC.Classes.Eq PackageConfig.SourcePackageId
instance GHC.PackageDb.BinaryStringRep PackageConfig.PackageName
instance Unique.Uniquable PackageConfig.PackageName
instance Outputable.Outputable PackageConfig.PackageName
instance GHC.PackageDb.BinaryStringRep PackageConfig.SourcePackageId
instance Unique.Uniquable PackageConfig.SourcePackageId
instance Outputable.Outputable PackageConfig.SourcePackageId
-- | Dynamically lookup up values from modules and loading them.
module DynamicLoading
pluginError :: [ModuleName] -> a
module ForeignCall
newtype ForeignCall
CCall :: CCallSpec -> ForeignCall
isSafeForeignCall :: ForeignCall -> Bool
data Safety
PlaySafe :: Safety
PlayInterruptible :: Safety
PlayRisky :: Safety
playSafe :: Safety -> Bool
playInterruptible :: Safety -> Bool
data CExportSpec
CExportStatic :: SourceText -> CLabelString -> CCallConv -> CExportSpec
type CLabelString = FastString
isCLabelString :: CLabelString -> Bool
pprCLabelString :: CLabelString -> SDoc
data CCallSpec
CCallSpec :: CCallTarget -> CCallConv -> Safety -> CCallSpec
-- | How to call a particular function in C-land.
data CCallTarget
StaticTarget :: SourceText -> CLabelString -> (Maybe UnitId) -> Bool -> CCallTarget
DynamicTarget :: CCallTarget
isDynamicTarget :: CCallTarget -> Bool
data CCallConv
CCallConv :: CCallConv
CApiConv :: CCallConv
StdCallConv :: CCallConv
PrimCallConv :: CCallConv
JavaScriptCallConv :: CCallConv
defaultCCallConv :: CCallConv
ccallConvToInt :: CCallConv -> Int
ccallConvAttribute :: CCallConv -> SDoc
data Header
Header :: SourceText -> FastString -> Header
-- | A C type, used in CAPI FFI calls
--
--
data CType
CType :: SourceText -> (Maybe Header) -> (SourceText, FastString) -> CType
instance Data.Data.Data ForeignCall.CType
instance GHC.Classes.Eq ForeignCall.CType
instance Data.Data.Data ForeignCall.Header
instance GHC.Classes.Eq ForeignCall.Header
instance Data.Data.Data ForeignCall.CExportSpec
instance GHC.Classes.Eq ForeignCall.ForeignCall
instance GHC.Classes.Eq ForeignCall.CCallSpec
instance Data.Data.Data ForeignCall.CCallTarget
instance GHC.Classes.Eq ForeignCall.CCallTarget
instance Data.Data.Data ForeignCall.CCallConv
instance GHC.Classes.Eq ForeignCall.CCallConv
instance Data.Data.Data ForeignCall.Safety
instance GHC.Show.Show ForeignCall.Safety
instance GHC.Classes.Eq ForeignCall.Safety
instance Outputable.Outputable ForeignCall.CType
instance Binary.Binary ForeignCall.CType
instance Outputable.Outputable ForeignCall.Header
instance Binary.Binary ForeignCall.Header
instance Outputable.Outputable ForeignCall.CExportSpec
instance Binary.Binary ForeignCall.CExportSpec
instance Outputable.Outputable ForeignCall.ForeignCall
instance Binary.Binary ForeignCall.ForeignCall
instance Outputable.Outputable ForeignCall.CCallSpec
instance Binary.Binary ForeignCall.CCallSpec
instance Binary.Binary ForeignCall.CCallTarget
instance Outputable.Outputable ForeignCall.CCallConv
instance Binary.Binary ForeignCall.CCallConv
instance Outputable.Outputable ForeignCall.Safety
instance Binary.Binary ForeignCall.Safety
-- | Boolean formulas without quantifiers and without negation. Such a
-- formula consists of variables, conjunctions (and), and disjunctions
-- (or).
--
-- This module is used to represent minimal complete definitions for
-- classes.
module BooleanFormula
data BooleanFormula a
Var :: a -> BooleanFormula a
And :: [LBooleanFormula a] -> BooleanFormula a
Or :: [LBooleanFormula a] -> BooleanFormula a
Parens :: (LBooleanFormula a) -> BooleanFormula a
type LBooleanFormula a = Located (BooleanFormula a)
mkFalse :: BooleanFormula a
mkTrue :: BooleanFormula a
mkAnd :: Eq a => [LBooleanFormula a] -> BooleanFormula a
mkOr :: Eq a => [LBooleanFormula a] -> BooleanFormula a
mkVar :: a -> BooleanFormula a
isFalse :: BooleanFormula a -> Bool
isTrue :: BooleanFormula a -> Bool
eval :: (a -> Bool) -> BooleanFormula a -> Bool
simplify :: Eq a => (a -> Maybe Bool) -> BooleanFormula a -> BooleanFormula a
isUnsatisfied :: Eq a => (a -> Bool) -> BooleanFormula a -> Maybe (BooleanFormula a)
implies :: Uniquable a => BooleanFormula a -> BooleanFormula a -> Bool
impliesAtom :: Eq a => BooleanFormula a -> a -> Bool
pprBooleanFormula :: (Rational -> a -> SDoc) -> Rational -> BooleanFormula a -> SDoc
pprBooleanFormulaNice :: Outputable a => BooleanFormula a -> SDoc
instance Data.Traversable.Traversable BooleanFormula.BooleanFormula
instance Data.Foldable.Foldable BooleanFormula.BooleanFormula
instance GHC.Base.Functor BooleanFormula.BooleanFormula
instance Data.Data.Data a => Data.Data.Data (BooleanFormula.BooleanFormula a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (BooleanFormula.BooleanFormula a)
instance Outputable.OutputableBndr a => Outputable.Outputable (BooleanFormula.BooleanFormula a)
instance Binary.Binary a => Binary.Binary (BooleanFormula.BooleanFormula a)
module DriverPhases
data HscSource
HsSrcFile :: HscSource
HsBootFile :: HscSource
HsigFile :: HscSource
isHsBootOrSig :: HscSource -> Bool
hscSourceString :: HscSource -> String
data Phase
Unlit :: HscSource -> Phase
Cpp :: HscSource -> Phase
HsPp :: HscSource -> Phase
Hsc :: HscSource -> Phase
Ccxx :: Phase
Cc :: Phase
Cobjc :: Phase
Cobjcxx :: Phase
HCc :: Phase
Splitter :: Phase
SplitAs :: Phase
As :: Bool -> Phase
LlvmOpt :: Phase
LlvmLlc :: Phase
LlvmMangle :: Phase
CmmCpp :: Phase
Cmm :: Phase
MergeForeign :: Phase
StopLn :: Phase
happensBefore :: DynFlags -> Phase -> Phase -> Bool
eqPhase :: Phase -> Phase -> Bool
anyHsc :: Phase
isStopLn :: Phase -> Bool
startPhase :: String -> Phase
phaseInputExt :: Phase -> String
isHaskellishSuffix :: String -> Bool
isHaskellSrcSuffix :: String -> Bool
isBackpackishSuffix :: String -> Bool
isObjectSuffix :: Platform -> String -> Bool
isCishSuffix :: String -> Bool
isDynLibSuffix :: Platform -> String -> Bool
isHaskellUserSrcSuffix :: String -> Bool
isHaskellSigSuffix :: String -> Bool
isSourceSuffix :: String -> Bool
-- | When we are given files (modified by -x arguments) we need to
-- determine if they are Haskellish or not to figure out how we should
-- try to compile it. The rules are:
--
--
-- - If no -x flag was specified, we check to see if the file looks
-- like a module name, has no extension, or has a Haskell source
-- extension.
-- - If an -x flag was specified, we just make sure the specified
-- suffix is a Haskell one.
--
isHaskellishTarget :: (String, Maybe Phase) -> Bool
isHaskellishFilename :: FilePath -> Bool
isHaskellSrcFilename :: FilePath -> Bool
isHaskellSigFilename :: FilePath -> Bool
isObjectFilename :: Platform -> FilePath -> Bool
isCishFilename :: FilePath -> Bool
isDynLibFilename :: Platform -> FilePath -> Bool
isHaskellUserSrcFilename :: FilePath -> Bool
isSourceFilename :: FilePath -> Bool
instance GHC.Show.Show DriverPhases.Phase
instance GHC.Classes.Eq DriverPhases.Phase
instance GHC.Show.Show DriverPhases.HscSource
instance GHC.Classes.Ord DriverPhases.HscSource
instance GHC.Classes.Eq DriverPhases.HscSource
instance Outputable.Outputable DriverPhases.Phase
instance Binary.Binary DriverPhases.HscSource
module Digraph
data Graph node
graphFromEdgedVerticesOrd :: Ord key => [Node key payload] -> Graph (Node key payload)
graphFromEdgedVerticesUniq :: Uniquable key => [Node key payload] -> Graph (Node key payload)
-- | Strongly connected component.
data SCC vertex :: * -> *
-- | A single vertex that is not in any cycle.
AcyclicSCC :: vertex -> SCC vertex
-- | A maximal set of mutually reachable vertices.
CyclicSCC :: [vertex] -> SCC vertex
type Node key payload = (payload, key, [key])
-- | The vertices of a strongly connected component.
flattenSCC :: () => SCC vertex -> [vertex]
-- | The vertices of a list of strongly connected components.
flattenSCCs :: () => [SCC a] -> [a]
stronglyConnCompG :: Graph node -> [SCC node]
topologicalSortG :: Graph node -> [node]
dfsTopSortG :: Graph node -> [[node]]
verticesG :: Graph node -> [node]
edgesG :: Graph node -> [Edge node]
hasVertexG :: Graph node -> node -> Bool
reachableG :: Graph node -> node -> [node]
reachablesG :: Graph node -> [node] -> [node]
transposeG :: Graph node -> Graph node
outdegreeG :: Graph node -> node -> Maybe Int
indegreeG :: Graph node -> node -> Maybe Int
vertexGroupsG :: Graph node -> [[node]]
emptyG :: Graph node -> Bool
componentsG :: Graph node -> [[node]]
-- | Find a reasonably short cycle a->b->c->a, in a strongly
-- connected component. The input nodes are presumed to be a SCC, so you
-- can start anywhere.
findCycle :: forall payload key. Ord key => [Node key payload] -> Maybe [payload]
stronglyConnCompFromEdgedVerticesOrd :: Ord key => [Node key payload] -> [SCC payload]
stronglyConnCompFromEdgedVerticesOrdR :: Ord key => [Node key payload] -> [SCC (Node key payload)]
stronglyConnCompFromEdgedVerticesUniq :: Uniquable key => [Node key payload] -> [SCC payload]
stronglyConnCompFromEdgedVerticesUniqR :: Uniquable key => [Node key payload] -> [SCC (Node key payload)]
instance Outputable.Outputable node => Outputable.Outputable (Digraph.Graph node)
instance Outputable.Outputable node => Outputable.Outputable (Digraph.Edge node)
module Bag
data Bag a
emptyBag :: Bag a
unitBag :: a -> Bag a
unionBags :: Bag a -> Bag a -> Bag a
unionManyBags :: [Bag a] -> Bag a
mapBag :: (a -> b) -> Bag a -> Bag b
elemBag :: Eq a => a -> Bag a -> Bool
lengthBag :: Bag a -> Int
filterBag :: (a -> Bool) -> Bag a -> Bag a
partitionBag :: (a -> Bool) -> Bag a -> (Bag a, Bag a)
partitionBagWith :: (a -> Either b c) -> Bag a -> (Bag b, Bag c)
concatBag :: Bag (Bag a) -> Bag a
catBagMaybes :: Bag (Maybe a) -> Bag a
foldBag :: (r -> r -> r) -> (a -> r) -> r -> Bag a -> r
foldrBag :: (a -> r -> r) -> r -> Bag a -> r
foldlBag :: (r -> a -> r) -> r -> Bag a -> r
isEmptyBag :: Bag a -> Bool
isSingletonBag :: Bag a -> Bool
consBag :: a -> Bag a -> Bag a
infixr 3 `consBag`
snocBag :: Bag a -> a -> Bag a
infixl 3 `snocBag`
anyBag :: (a -> Bool) -> Bag a -> Bool
allBag :: (a -> Bool) -> Bag a -> Bool
listToBag :: [a] -> Bag a
bagToList :: Bag a -> [a]
mapAccumBagL :: (acc -> x -> (acc, y)) -> acc -> Bag x -> (acc, Bag y)
concatMapBag :: (a -> Bag b) -> Bag a -> Bag b
mapMaybeBag :: (a -> Maybe b) -> Bag a -> Bag b
foldrBagM :: (Monad m) => (a -> b -> m b) -> b -> Bag a -> m b
foldlBagM :: (Monad m) => (b -> a -> m b) -> b -> Bag a -> m b
mapBagM :: Monad m => (a -> m b) -> Bag a -> m (Bag b)
mapBagM_ :: Monad m => (a -> m b) -> Bag a -> m ()
flatMapBagM :: Monad m => (a -> m (Bag b)) -> Bag a -> m (Bag b)
flatMapBagPairM :: Monad m => (a -> m (Bag b, Bag c)) -> Bag a -> m (Bag b, Bag c)
mapAndUnzipBagM :: Monad m => (a -> m (b, c)) -> Bag a -> m (Bag b, Bag c)
mapAccumBagLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> Bag x -> m (acc, Bag y)
anyBagM :: Monad m => (a -> m Bool) -> Bag a -> m Bool
filterBagM :: Monad m => (a -> m Bool) -> Bag a -> m (Bag a)
instance Outputable.Outputable a => Outputable.Outputable (Bag.Bag a)
instance Data.Data.Data a => Data.Data.Data (Bag.Bag a)
instance Data.Foldable.Foldable Bag.Bag
-- | Command-line parser
--
-- This is an abstract command-line parser used by DynFlags.
--
-- (c) The University of Glasgow 2005
module CmdLineParser
processArgs :: Monad m => [Flag m] -> [Located String] -> m ([Located String], [Located String], [Located String])
data OptKind m
NoArg :: (EwM m ()) -> OptKind m
HasArg :: (String -> EwM m ()) -> OptKind m
SepArg :: (String -> EwM m ()) -> OptKind m
Prefix :: (String -> EwM m ()) -> OptKind m
OptPrefix :: (String -> EwM m ()) -> OptKind m
OptIntSuffix :: (Maybe Int -> EwM m ()) -> OptKind m
IntSuffix :: (Int -> EwM m ()) -> OptKind m
FloatSuffix :: (Float -> EwM m ()) -> OptKind m
PassFlag :: (String -> EwM m ()) -> OptKind m
AnySuffix :: (String -> EwM m ()) -> OptKind m
PrefixPred :: (String -> Bool) -> (String -> EwM m ()) -> OptKind m
AnySuffixPred :: (String -> Bool) -> (String -> EwM m ()) -> OptKind m
-- | GHC flag modes describing when a flag has an effect.
data GhcFlagMode
-- | The flag only affects the non-interactive GHC
OnlyGhc :: GhcFlagMode
-- | The flag only affects the interactive GHC
OnlyGhci :: GhcFlagMode
-- | The flag affects multiple ghc modes
AllModes :: GhcFlagMode
-- | This flag should not be seen in cli completion
HiddenFlag :: GhcFlagMode
newtype CmdLineP s a
CmdLineP :: (s -> (a, s)) -> CmdLineP s a
[runCmdLine] :: CmdLineP s a -> s -> (a, s)
getCmdLineState :: CmdLineP s s
putCmdLineState :: s -> CmdLineP s ()
data Flag m
Flag :: String -> OptKind m -> GhcFlagMode -> Flag m
[flagName] :: Flag m -> String
[flagOptKind] :: Flag m -> OptKind m
[flagGhcMode] :: Flag m -> GhcFlagMode
defFlag :: String -> OptKind m -> Flag m
defGhcFlag :: String -> OptKind m -> Flag m
defGhciFlag :: String -> OptKind m -> Flag m
defHiddenFlag :: String -> OptKind m -> Flag m
errorsToGhcException :: [(String, String)] -> GhcException
data EwM m a
runEwM :: EwM m a -> m (Errs, Warns, a)
addErr :: Monad m => String -> EwM m ()
addWarn :: Monad m => String -> EwM m ()
getArg :: Monad m => EwM m String
getCurLoc :: Monad m => EwM m SrcSpan
liftEwM :: Monad m => m a -> EwM m a
deprecate :: Monad m => String -> EwM m ()
instance GHC.Base.Functor (CmdLineParser.CmdLineP s)
instance GHC.Base.Applicative (CmdLineParser.CmdLineP s)
instance GHC.Base.Monad (CmdLineParser.CmdLineP s)
instance GHC.Base.Monad m => GHC.Base.Functor (CmdLineParser.EwM m)
instance GHC.Base.Monad m => GHC.Base.Applicative (CmdLineParser.EwM m)
instance GHC.Base.Monad m => GHC.Base.Monad (CmdLineParser.EwM m)
-- | Dynamic flags
--
-- Most flags are dynamic flags, which means they can change from
-- compilation to compilation using OPTIONS_GHC pragmas, and in
-- a multi-session GHC each session can be using different dynamic flags.
-- Dynamic flags can also be set at the prompt in GHCi.
--
-- (c) The University of Glasgow 2005
module DynFlags
data DumpFlag
Opt_D_dump_cmm :: DumpFlag
Opt_D_dump_cmm_from_stg :: DumpFlag
Opt_D_dump_cmm_raw :: DumpFlag
Opt_D_dump_cmm_verbose :: DumpFlag
Opt_D_dump_cmm_cfg :: DumpFlag
Opt_D_dump_cmm_cbe :: DumpFlag
Opt_D_dump_cmm_switch :: DumpFlag
Opt_D_dump_cmm_proc :: DumpFlag
Opt_D_dump_cmm_sp :: DumpFlag
Opt_D_dump_cmm_sink :: DumpFlag
Opt_D_dump_cmm_caf :: DumpFlag
Opt_D_dump_cmm_procmap :: DumpFlag
Opt_D_dump_cmm_split :: DumpFlag
Opt_D_dump_cmm_info :: DumpFlag
Opt_D_dump_cmm_cps :: DumpFlag
Opt_D_dump_asm :: DumpFlag
Opt_D_dump_asm_native :: DumpFlag
Opt_D_dump_asm_liveness :: DumpFlag
Opt_D_dump_asm_regalloc :: DumpFlag
Opt_D_dump_asm_regalloc_stages :: DumpFlag
Opt_D_dump_asm_conflicts :: DumpFlag
Opt_D_dump_asm_stats :: DumpFlag
Opt_D_dump_asm_expanded :: DumpFlag
Opt_D_dump_llvm :: DumpFlag
Opt_D_dump_core_stats :: DumpFlag
Opt_D_dump_deriv :: DumpFlag
Opt_D_dump_ds :: DumpFlag
Opt_D_dump_foreign :: DumpFlag
Opt_D_dump_inlinings :: DumpFlag
Opt_D_dump_rule_firings :: DumpFlag
Opt_D_dump_rule_rewrites :: DumpFlag
Opt_D_dump_simpl_trace :: DumpFlag
Opt_D_dump_occur_anal :: DumpFlag
Opt_D_dump_parsed :: DumpFlag
Opt_D_dump_parsed_ast :: DumpFlag
Opt_D_dump_rn :: DumpFlag
Opt_D_dump_rn_ast :: DumpFlag
Opt_D_dump_shape :: DumpFlag
Opt_D_dump_simpl :: DumpFlag
Opt_D_dump_simpl_iterations :: DumpFlag
Opt_D_dump_spec :: DumpFlag
Opt_D_dump_prep :: DumpFlag
Opt_D_dump_stg :: DumpFlag
Opt_D_dump_call_arity :: DumpFlag
Opt_D_dump_stranal :: DumpFlag
Opt_D_dump_str_signatures :: DumpFlag
Opt_D_dump_tc :: DumpFlag
Opt_D_dump_tc_ast :: DumpFlag
Opt_D_dump_types :: DumpFlag
Opt_D_dump_rules :: DumpFlag
Opt_D_dump_cse :: DumpFlag
Opt_D_dump_worker_wrapper :: DumpFlag
Opt_D_dump_rn_trace :: DumpFlag
Opt_D_dump_rn_stats :: DumpFlag
Opt_D_dump_opt_cmm :: DumpFlag
Opt_D_dump_simpl_stats :: DumpFlag
Opt_D_dump_cs_trace :: DumpFlag
Opt_D_dump_tc_trace :: DumpFlag
Opt_D_dump_ec_trace :: DumpFlag
Opt_D_dump_if_trace :: DumpFlag
Opt_D_dump_vt_trace :: DumpFlag
Opt_D_dump_splices :: DumpFlag
Opt_D_th_dec_file :: DumpFlag
Opt_D_dump_BCOs :: DumpFlag
Opt_D_dump_vect :: DumpFlag
Opt_D_dump_ticked :: DumpFlag
Opt_D_dump_rtti :: DumpFlag
Opt_D_source_stats :: DumpFlag
Opt_D_verbose_stg2stg :: DumpFlag
Opt_D_dump_hi :: DumpFlag
Opt_D_dump_hi_diffs :: DumpFlag
Opt_D_dump_mod_cycles :: DumpFlag
Opt_D_dump_mod_map :: DumpFlag
Opt_D_dump_view_pattern_commoning :: DumpFlag
Opt_D_verbose_core2core :: DumpFlag
Opt_D_dump_debug :: DumpFlag
Opt_D_dump_json :: DumpFlag
Opt_D_ppr_debug :: DumpFlag
Opt_D_no_debug_output :: DumpFlag
-- | Enumerates the simple on-or-off dynamic flags
data GeneralFlag
-- | Append dump output to files instead of stdout.
Opt_DumpToFile :: GeneralFlag
Opt_D_faststring_stats :: GeneralFlag
Opt_D_dump_minimal_imports :: GeneralFlag
Opt_DoCoreLinting :: GeneralFlag
Opt_DoStgLinting :: GeneralFlag
Opt_DoCmmLinting :: GeneralFlag
Opt_DoAsmLinting :: GeneralFlag
Opt_DoAnnotationLinting :: GeneralFlag
Opt_NoLlvmMangler :: GeneralFlag
Opt_WarnIsError :: GeneralFlag
Opt_ShowWarnGroups :: GeneralFlag
Opt_HideSourcePaths :: GeneralFlag
Opt_PrintExplicitForalls :: GeneralFlag
Opt_PrintExplicitKinds :: GeneralFlag
Opt_PrintExplicitCoercions :: GeneralFlag
Opt_PrintExplicitRuntimeReps :: GeneralFlag
Opt_PrintEqualityRelations :: GeneralFlag
Opt_PrintUnicodeSyntax :: GeneralFlag
Opt_PrintExpandedSynonyms :: GeneralFlag
Opt_PrintPotentialInstances :: GeneralFlag
Opt_PrintTypecheckerElaboration :: GeneralFlag
Opt_CallArity :: GeneralFlag
Opt_Strictness :: GeneralFlag
Opt_LateDmdAnal :: GeneralFlag
Opt_KillAbsence :: GeneralFlag
Opt_KillOneShot :: GeneralFlag
Opt_FullLaziness :: GeneralFlag
Opt_FloatIn :: GeneralFlag
Opt_Specialise :: GeneralFlag
Opt_SpecialiseAggressively :: GeneralFlag
Opt_CrossModuleSpecialise :: GeneralFlag
Opt_StaticArgumentTransformation :: GeneralFlag
Opt_CSE :: GeneralFlag
Opt_StgCSE :: GeneralFlag
Opt_LiberateCase :: GeneralFlag
Opt_SpecConstr :: GeneralFlag
Opt_SpecConstrKeen :: GeneralFlag
Opt_DoLambdaEtaExpansion :: GeneralFlag
Opt_IgnoreAsserts :: GeneralFlag
Opt_DoEtaReduction :: GeneralFlag
Opt_CaseMerge :: GeneralFlag
Opt_CaseFolding :: GeneralFlag
Opt_UnboxStrictFields :: GeneralFlag
Opt_UnboxSmallStrictFields :: GeneralFlag
Opt_DictsCheap :: GeneralFlag
Opt_EnableRewriteRules :: GeneralFlag
Opt_Vectorise :: GeneralFlag
Opt_VectorisationAvoidance :: GeneralFlag
Opt_RegsGraph :: GeneralFlag
Opt_RegsIterative :: GeneralFlag
Opt_PedanticBottoms :: GeneralFlag
Opt_LlvmTBAA :: GeneralFlag
Opt_LlvmPassVectorsInRegisters :: GeneralFlag
Opt_LlvmFillUndefWithGarbage :: GeneralFlag
Opt_IrrefutableTuples :: GeneralFlag
Opt_CmmSink :: GeneralFlag
Opt_CmmElimCommonBlocks :: GeneralFlag
Opt_OmitYields :: GeneralFlag
Opt_FunToThunk :: GeneralFlag
Opt_DictsStrict :: GeneralFlag
Opt_DmdTxDictSel :: GeneralFlag
Opt_Loopification :: GeneralFlag
Opt_CprAnal :: GeneralFlag
Opt_WorkerWrapper :: GeneralFlag
Opt_SolveConstantDicts :: GeneralFlag
Opt_IgnoreInterfacePragmas :: GeneralFlag
Opt_OmitInterfacePragmas :: GeneralFlag
Opt_ExposeAllUnfoldings :: GeneralFlag
Opt_WriteInterface :: GeneralFlag
Opt_AutoSccsOnIndividualCafs :: GeneralFlag
Opt_ProfCountEntries :: GeneralFlag
Opt_Pp :: GeneralFlag
Opt_ForceRecomp :: GeneralFlag
Opt_ExcessPrecision :: GeneralFlag
Opt_EagerBlackHoling :: GeneralFlag
Opt_NoHsMain :: GeneralFlag
Opt_SplitObjs :: GeneralFlag
Opt_SplitSections :: GeneralFlag
Opt_StgStats :: GeneralFlag
Opt_HideAllPackages :: GeneralFlag
Opt_HideAllPluginPackages :: GeneralFlag
Opt_PrintBindResult :: GeneralFlag
Opt_Haddock :: GeneralFlag
Opt_HaddockOptions :: GeneralFlag
Opt_BreakOnException :: GeneralFlag
Opt_BreakOnError :: GeneralFlag
Opt_PrintEvldWithShow :: GeneralFlag
Opt_PrintBindContents :: GeneralFlag
Opt_GenManifest :: GeneralFlag
Opt_EmbedManifest :: GeneralFlag
Opt_SharedImplib :: GeneralFlag
Opt_BuildingCabalPackage :: GeneralFlag
Opt_IgnoreDotGhci :: GeneralFlag
Opt_GhciSandbox :: GeneralFlag
Opt_GhciHistory :: GeneralFlag
Opt_LocalGhciHistory :: GeneralFlag
Opt_HelpfulErrors :: GeneralFlag
Opt_DeferTypeErrors :: GeneralFlag
Opt_DeferTypedHoles :: GeneralFlag
Opt_DeferOutOfScopeVariables :: GeneralFlag
-- |
-- -fPIC
--
Opt_PIC :: GeneralFlag
-- |
-- -fPIE
--
Opt_PIE :: GeneralFlag
-- |
-- -pie
--
Opt_PICExecutable :: GeneralFlag
Opt_SccProfilingOn :: GeneralFlag
Opt_Ticky :: GeneralFlag
Opt_Ticky_Allocd :: GeneralFlag
Opt_Ticky_LNE :: GeneralFlag
Opt_Ticky_Dyn_Thunk :: GeneralFlag
Opt_RPath :: GeneralFlag
Opt_RelativeDynlibPaths :: GeneralFlag
Opt_Hpc :: GeneralFlag
Opt_FlatCache :: GeneralFlag
Opt_ExternalInterpreter :: GeneralFlag
Opt_OptimalApplicativeDo :: GeneralFlag
Opt_VersionMacros :: GeneralFlag
Opt_WholeArchiveHsLibs :: GeneralFlag
Opt_SimplPreInlining :: GeneralFlag
Opt_ErrorSpans :: GeneralFlag
Opt_DiagnosticsShowCaret :: GeneralFlag
Opt_PprCaseAsLet :: GeneralFlag
Opt_PprShowTicks :: GeneralFlag
Opt_ShowHoleConstraints :: GeneralFlag
Opt_ShowLoadedModules :: GeneralFlag
Opt_SuppressCoercions :: GeneralFlag
Opt_SuppressVarKinds :: GeneralFlag
Opt_SuppressModulePrefixes :: GeneralFlag
Opt_SuppressTypeApplications :: GeneralFlag
Opt_SuppressIdInfo :: GeneralFlag
Opt_SuppressUnfoldings :: GeneralFlag
Opt_SuppressTypeSignatures :: GeneralFlag
Opt_SuppressUniques :: GeneralFlag
Opt_SuppressTicks :: GeneralFlag
Opt_AutoLinkPackages :: GeneralFlag
Opt_ImplicitImportQualified :: GeneralFlag
Opt_KeepHiDiffs :: GeneralFlag
Opt_KeepHcFiles :: GeneralFlag
Opt_KeepSFiles :: GeneralFlag
Opt_KeepTmpFiles :: GeneralFlag
Opt_KeepRawTokenStream :: GeneralFlag
Opt_KeepLlvmFiles :: GeneralFlag
Opt_KeepHiFiles :: GeneralFlag
Opt_KeepOFiles :: GeneralFlag
Opt_BuildDynamicToo :: GeneralFlag
Opt_DistrustAllPackages :: GeneralFlag
Opt_PackageTrust :: GeneralFlag
Opt_G_NoStateHack :: GeneralFlag
Opt_G_NoOptCoercion :: GeneralFlag
data WarningFlag
Opt_WarnDuplicateExports :: WarningFlag
Opt_WarnDuplicateConstraints :: WarningFlag
Opt_WarnRedundantConstraints :: WarningFlag
Opt_WarnHiShadows :: WarningFlag
Opt_WarnImplicitPrelude :: WarningFlag
Opt_WarnIncompletePatterns :: WarningFlag
Opt_WarnIncompleteUniPatterns :: WarningFlag
Opt_WarnIncompletePatternsRecUpd :: WarningFlag
Opt_WarnOverflowedLiterals :: WarningFlag
Opt_WarnEmptyEnumerations :: WarningFlag
Opt_WarnMissingFields :: WarningFlag
Opt_WarnMissingImportList :: WarningFlag
Opt_WarnMissingMethods :: WarningFlag
Opt_WarnMissingSignatures :: WarningFlag
Opt_WarnMissingLocalSignatures :: WarningFlag
Opt_WarnNameShadowing :: WarningFlag
Opt_WarnOverlappingPatterns :: WarningFlag
Opt_WarnTypeDefaults :: WarningFlag
Opt_WarnMonomorphism :: WarningFlag
Opt_WarnUnusedTopBinds :: WarningFlag
Opt_WarnUnusedLocalBinds :: WarningFlag
Opt_WarnUnusedPatternBinds :: WarningFlag
Opt_WarnUnusedImports :: WarningFlag
Opt_WarnUnusedMatches :: WarningFlag
Opt_WarnUnusedTypePatterns :: WarningFlag
Opt_WarnUnusedForalls :: WarningFlag
Opt_WarnWarningsDeprecations :: WarningFlag
Opt_WarnDeprecatedFlags :: WarningFlag
Opt_WarnAMP :: WarningFlag
Opt_WarnMissingMonadFailInstances :: WarningFlag
Opt_WarnSemigroup :: WarningFlag
Opt_WarnDodgyExports :: WarningFlag
Opt_WarnDodgyImports :: WarningFlag
Opt_WarnOrphans :: WarningFlag
Opt_WarnAutoOrphans :: WarningFlag
Opt_WarnIdentities :: WarningFlag
Opt_WarnTabs :: WarningFlag
Opt_WarnUnrecognisedPragmas :: WarningFlag
Opt_WarnDodgyForeignImports :: WarningFlag
Opt_WarnUnusedDoBind :: WarningFlag
Opt_WarnWrongDoBind :: WarningFlag
Opt_WarnAlternativeLayoutRuleTransitional :: WarningFlag
Opt_WarnUnsafe :: WarningFlag
Opt_WarnSafe :: WarningFlag
Opt_WarnTrustworthySafe :: WarningFlag
Opt_WarnMissedSpecs :: WarningFlag
Opt_WarnAllMissedSpecs :: WarningFlag
Opt_WarnUnsupportedCallingConventions :: WarningFlag
Opt_WarnUnsupportedLlvmVersion :: WarningFlag
Opt_WarnInlineRuleShadowing :: WarningFlag
Opt_WarnTypedHoles :: WarningFlag
Opt_WarnPartialTypeSignatures :: WarningFlag
Opt_WarnMissingExportedSignatures :: WarningFlag
Opt_WarnUntickedPromotedConstructors :: WarningFlag
Opt_WarnDerivingTypeable :: WarningFlag
Opt_WarnDeferredTypeErrors :: WarningFlag
Opt_WarnDeferredOutOfScopeVariables :: WarningFlag
Opt_WarnNonCanonicalMonadInstances :: WarningFlag
Opt_WarnNonCanonicalMonadFailInstances :: WarningFlag
Opt_WarnNonCanonicalMonoidInstances :: WarningFlag
Opt_WarnMissingPatternSynonymSignatures :: WarningFlag
Opt_WarnUnrecognisedWarningFlags :: WarningFlag
Opt_WarnSimplifiableClassConstraints :: WarningFlag
Opt_WarnCPPUndef :: WarningFlag
Opt_WarnUnbangedStrictPatterns :: WarningFlag
Opt_WarnMissingHomeModules :: WarningFlag
-- | Used when outputting warnings: if a reason is given, it is displayed.
-- If a warning isn't controlled by a flag, this is made explicit at the
-- point of use.
data WarnReason
NoReason :: WarnReason
Reason :: !WarningFlag -> WarnReason
data Language
Haskell98 :: Language
Haskell2010 :: Language
data PlatformConstants
PlatformConstants :: () -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Bool -> Bool -> Int -> Integer -> Integer -> Integer -> PlatformConstants
[pc_platformConstants] :: PlatformConstants -> ()
[pc_CONTROL_GROUP_CONST_291] :: PlatformConstants -> Int
[pc_STD_HDR_SIZE] :: PlatformConstants -> Int
[pc_PROF_HDR_SIZE] :: PlatformConstants -> Int
[pc_BLOCK_SIZE] :: PlatformConstants -> Int
[pc_BLOCKS_PER_MBLOCK] :: PlatformConstants -> Int
[pc_TICKY_BIN_COUNT] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR7] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR8] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR9] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rR10] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rF6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rD6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rXMM6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rYMM6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM2] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM3] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM4] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM5] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rZMM6] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rL1] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rSp] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rSpLim] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rHp] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rHpLim] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rCCCS] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rCurrentTSO] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rCurrentNursery] :: PlatformConstants -> Int
[pc_OFFSET_StgRegTable_rHpAlloc] :: PlatformConstants -> Int
[pc_OFFSET_stgEagerBlackholeInfo] :: PlatformConstants -> Int
[pc_OFFSET_stgGCEnter1] :: PlatformConstants -> Int
[pc_OFFSET_stgGCFun] :: PlatformConstants -> Int
[pc_OFFSET_Capability_r] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_start] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_free] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_blocks] :: PlatformConstants -> Int
[pc_OFFSET_bdescr_flags] :: PlatformConstants -> Int
[pc_SIZEOF_CostCentreStack] :: PlatformConstants -> Int
[pc_OFFSET_CostCentreStack_mem_alloc] :: PlatformConstants -> Int
[pc_REP_CostCentreStack_mem_alloc] :: PlatformConstants -> Int
[pc_OFFSET_CostCentreStack_scc_count] :: PlatformConstants -> Int
[pc_REP_CostCentreStack_scc_count] :: PlatformConstants -> Int
[pc_OFFSET_StgHeader_ccs] :: PlatformConstants -> Int
[pc_OFFSET_StgHeader_ldvw] :: PlatformConstants -> Int
[pc_SIZEOF_StgSMPThunkHeader] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_allocs] :: PlatformConstants -> Int
[pc_REP_StgEntCounter_allocs] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_allocd] :: PlatformConstants -> Int
[pc_REP_StgEntCounter_allocd] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_registeredp] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_link] :: PlatformConstants -> Int
[pc_OFFSET_StgEntCounter_entry_count] :: PlatformConstants -> Int
[pc_SIZEOF_StgUpdateFrame_NoHdr] :: PlatformConstants -> Int
[pc_SIZEOF_StgMutArrPtrs_NoHdr] :: PlatformConstants -> Int
[pc_OFFSET_StgMutArrPtrs_ptrs] :: PlatformConstants -> Int
[pc_OFFSET_StgMutArrPtrs_size] :: PlatformConstants -> Int
[pc_SIZEOF_StgSmallMutArrPtrs_NoHdr] :: PlatformConstants -> Int
[pc_OFFSET_StgSmallMutArrPtrs_ptrs] :: PlatformConstants -> Int
[pc_SIZEOF_StgArrBytes_NoHdr] :: PlatformConstants -> Int
[pc_OFFSET_StgArrBytes_bytes] :: PlatformConstants -> Int
[pc_OFFSET_StgTSO_alloc_limit] :: PlatformConstants -> Int
[pc_OFFSET_StgTSO_cccs] :: PlatformConstants -> Int
[pc_OFFSET_StgTSO_stackobj] :: PlatformConstants -> Int
[pc_OFFSET_StgStack_sp] :: PlatformConstants -> Int
[pc_OFFSET_StgStack_stack] :: PlatformConstants -> Int
[pc_OFFSET_StgUpdateFrame_updatee] :: PlatformConstants -> Int
[pc_OFFSET_StgFunInfoExtraFwd_arity] :: PlatformConstants -> Int
[pc_REP_StgFunInfoExtraFwd_arity] :: PlatformConstants -> Int
[pc_SIZEOF_StgFunInfoExtraRev] :: PlatformConstants -> Int
[pc_OFFSET_StgFunInfoExtraRev_arity] :: PlatformConstants -> Int
[pc_REP_StgFunInfoExtraRev_arity] :: PlatformConstants -> Int
[pc_MAX_SPEC_SELECTEE_SIZE] :: PlatformConstants -> Int
[pc_MAX_SPEC_AP_SIZE] :: PlatformConstants -> Int
[pc_MIN_PAYLOAD_SIZE] :: PlatformConstants -> Int
[pc_MIN_INTLIKE] :: PlatformConstants -> Int
[pc_MAX_INTLIKE] :: PlatformConstants -> Int
[pc_MIN_CHARLIKE] :: PlatformConstants -> Int
[pc_MAX_CHARLIKE] :: PlatformConstants -> Int
[pc_MUT_ARR_PTRS_CARD_BITS] :: PlatformConstants -> Int
[pc_MAX_Vanilla_REG] :: PlatformConstants -> Int
[pc_MAX_Float_REG] :: PlatformConstants -> Int
[pc_MAX_Double_REG] :: PlatformConstants -> Int
[pc_MAX_Long_REG] :: PlatformConstants -> Int
[pc_MAX_XMM_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Vanilla_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Float_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Double_REG] :: PlatformConstants -> Int
[pc_MAX_Real_XMM_REG] :: PlatformConstants -> Int
[pc_MAX_Real_Long_REG] :: PlatformConstants -> Int
[pc_RESERVED_C_STACK_BYTES] :: PlatformConstants -> Int
[pc_RESERVED_STACK_WORDS] :: PlatformConstants -> Int
[pc_AP_STACK_SPLIM] :: PlatformConstants -> Int
[pc_WORD_SIZE] :: PlatformConstants -> Int
[pc_DOUBLE_SIZE] :: PlatformConstants -> Int
[pc_CINT_SIZE] :: PlatformConstants -> Int
[pc_CLONG_SIZE] :: PlatformConstants -> Int
[pc_CLONG_LONG_SIZE] :: PlatformConstants -> Int
[pc_BITMAP_BITS_SHIFT] :: PlatformConstants -> Int
[pc_TAG_BITS] :: PlatformConstants -> Int
[pc_WORDS_BIGENDIAN] :: PlatformConstants -> Bool
[pc_DYNAMIC_BY_DEFAULT] :: PlatformConstants -> Bool
[pc_LDV_SHIFT] :: PlatformConstants -> Int
[pc_ILDV_CREATE_MASK] :: PlatformConstants -> Integer
[pc_ILDV_STATE_CREATE] :: PlatformConstants -> Integer
[pc_ILDV_STATE_USE] :: PlatformConstants -> Integer
type FatalMessager = String -> IO ()
type LogAction = DynFlags -> WarnReason -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO ()
type LogFinaliser = DynFlags -> IO ()
newtype FlushOut
FlushOut :: (IO ()) -> FlushOut
newtype FlushErr
FlushErr :: (IO ()) -> FlushErr
data ProfAuto
-- | no SCC annotations added
NoProfAuto :: ProfAuto
-- | top-level and nested functions are annotated
ProfAutoAll :: ProfAuto
-- | top-level functions annotated only
ProfAutoTop :: ProfAuto
-- | exported functions annotated only
ProfAutoExports :: ProfAuto
-- | annotate call-sites
ProfAutoCalls :: ProfAuto
glasgowExtsFlags :: [Extension]
-- | Warning groups.
--
-- As all warnings are in the Weverything set, it is ignored when
-- displaying to the user which group a warning is in.
warningGroups :: [(String, [WarningFlag])]
-- | Warning group hierarchies, where there is an explicit inclusion
-- relation.
--
-- Each inner list is a hierarchy of warning groups, ordered from
-- smallest to largest, where each group is a superset of the one before
-- it.
--
-- Separating this from warningGroups allows for multiple
-- hierarchies with no inherent relation to be defined.
--
-- The special-case Weverything group is not included.
warningHierarchies :: [[String]]
hasPprDebug :: DynFlags -> Bool
hasNoDebugOutput :: DynFlags -> Bool
hasNoStateHack :: DynFlags -> Bool
hasNoOptCoercion :: DynFlags -> Bool
-- | Test whether a DumpFlag is set
dopt :: DumpFlag -> DynFlags -> Bool
-- | Set a DumpFlag
dopt_set :: DynFlags -> DumpFlag -> DynFlags
-- | Unset a DumpFlag
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
-- | Test whether a GeneralFlag is set
gopt :: GeneralFlag -> DynFlags -> Bool
-- | Set a GeneralFlag
gopt_set :: DynFlags -> GeneralFlag -> DynFlags
-- | Unset a GeneralFlag
gopt_unset :: DynFlags -> GeneralFlag -> DynFlags
setGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags
-- | Test whether a WarningFlag is set
wopt :: WarningFlag -> DynFlags -> Bool
-- | Set a WarningFlag
wopt_set :: DynFlags -> WarningFlag -> DynFlags
-- | Unset a WarningFlag
wopt_unset :: DynFlags -> WarningFlag -> DynFlags
-- | Test whether a WarningFlag is set as fatal
wopt_fatal :: WarningFlag -> DynFlags -> Bool
-- | Test whether a Extension is set
xopt :: Extension -> DynFlags -> Bool
-- | Set a Extension
xopt_set :: DynFlags -> Extension -> DynFlags
-- | Unset a Extension
xopt_unset :: DynFlags -> Extension -> DynFlags
lang_set :: DynFlags -> Maybe Language -> DynFlags
-- | An internal helper to check whether to use unicode syntax for output.
--
-- Note: You should very likely be using unicodeSyntax instead of
-- this function.
useUnicodeSyntax :: DynFlags -> Bool
whenGeneratingDynamicToo :: MonadIO m => DynFlags -> m () -> m ()
ifGeneratingDynamicToo :: MonadIO m => DynFlags -> m a -> m a -> m a
whenCannotGenerateDynamicToo :: MonadIO m => DynFlags -> m () -> m ()
dynamicTooMkDynamicDynFlags :: DynFlags -> DynFlags
-- | Contains not only a collection of GeneralFlags but also a
-- plethora of information relating to the compilation of a single file
-- or GHC session
data DynFlags
DynFlags :: GhcMode -> GhcLink -> HscTarget -> Settings -> Int -> Int -> Int -> Int -> Int -> Int -> Maybe String -> [Int] -> Maybe Int -> Bool -> Maybe Int -> Maybe Int -> Int -> Int -> Maybe Int -> Maybe Int -> Int -> Maybe Int -> Maybe Int -> Int -> [FilePath] -> Module -> Maybe String -> IntWithInf -> IntWithInf -> InstalledUnitId -> Maybe ComponentId -> Maybe [(ModuleName, Module)] -> [Way] -> String -> String -> Maybe (String, Int) -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> String -> String -> String -> IORef Bool -> String -> String -> Maybe FilePath -> Maybe [Set String] -> Maybe String -> Maybe String -> Maybe String -> DynLibLoader -> Maybe FilePath -> Maybe FilePath -> [Option] -> [String] -> [String] -> [String] -> [String] -> Maybe String -> RtsOptsEnabled -> Bool -> String -> [ModuleName] -> [(ModuleName, String)] -> [String] -> Hooks -> FilePath -> Bool -> [ModuleName] -> [String] -> [PackageDBFlag] -> [IgnorePackageFlag] -> [PackageFlag] -> [PackageFlag] -> [TrustFlag] -> Maybe FilePath -> Maybe [(FilePath, [PackageConfig])] -> PackageState -> IORef [FilePath] -> IORef (Map FilePath FilePath) -> IORef [FilePath] -> IORef Int -> IORef (Set FilePath) -> IntSet -> IntSet -> IntSet -> IntSet -> Maybe Language -> SafeHaskellMode -> Bool -> Bool -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> [OnOff Extension] -> IntSet -> Int -> Int -> Int -> Int -> Float -> Int -> Bool -> Int -> Int -> IO (Maybe LogOutput) -> LogAction -> LogFinaliser -> FlushOut -> FlushErr -> Maybe String -> [String] -> Int -> Int -> Bool -> OverridingBool -> Bool -> Scheme -> ProfAuto -> Maybe String -> IORef (ModuleEnv Int) -> Maybe SseVersion -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> IORef (Maybe LinkerInfo) -> IORef (Maybe CompilerInfo) -> Int -> Int -> Int -> Bool -> Maybe Int -> Int -> Int -> DynFlags
[ghcMode] :: DynFlags -> GhcMode
[ghcLink] :: DynFlags -> GhcLink
[hscTarget] :: DynFlags -> HscTarget
[settings] :: DynFlags -> Settings
-- | Verbosity level: see Note [Verbosity levels]
[verbosity] :: DynFlags -> Int
-- | Optimisation level
[optLevel] :: DynFlags -> Int
-- | How much debug information to produce
[debugLevel] :: DynFlags -> Int
-- | Number of simplifier phases
[simplPhases] :: DynFlags -> Int
-- | Max simplifier iterations
[maxSimplIterations] :: DynFlags -> Int
-- | Max no iterations for pm checking
[maxPmCheckIterations] :: DynFlags -> Int
[ruleCheck] :: DynFlags -> Maybe String
-- | Additional demand analysis
[strictnessBefore] :: DynFlags -> [Int]
-- | The number of modules to compile in parallel in --make mode, where
-- Nothing ==> compile as many in parallel as there are CPUs.
[parMakeCount] :: DynFlags -> Maybe Int
-- | Enable RTS timing statistics?
[enableTimeStats] :: DynFlags -> Bool
-- | The heap size to set.
[ghcHeapSize] :: DynFlags -> Maybe Int
-- | Maximum number of bindings from the type envt to show in type error
-- messages
[maxRelevantBinds] :: DynFlags -> Maybe Int
-- | Maximum number of unmatched patterns to show in non-exhaustiveness
-- warnings
[maxUncoveredPatterns] :: DynFlags -> Int
-- | Multiplier for simplifier ticks
[simplTickFactor] :: DynFlags -> Int
-- | Threshold for SpecConstr
[specConstrThreshold] :: DynFlags -> Maybe Int
-- | Max number of specialisations for any one function
[specConstrCount] :: DynFlags -> Maybe Int
-- | Max number of specialisations for recursive types Not optional;
-- otherwise ForceSpecConstr can diverge.
[specConstrRecursive] :: DynFlags -> Int
-- | Threshold for LiberateCase
[liberateCaseThreshold] :: DynFlags -> Maybe Int
-- | Arg count for lambda floating See CoreMonad.FloatOutSwitches
[floatLamArgs] :: DynFlags -> Maybe Int
-- | Simplification history size
[historySize] :: DynFlags -> Int
[importPaths] :: DynFlags -> [FilePath]
[mainModIs] :: DynFlags -> Module
[mainFunIs] :: DynFlags -> Maybe String
-- | Typechecker maximum stack depth
[reductionDepth] :: DynFlags -> IntWithInf
-- | Number of iterations in the constraints solver Typically only 1 is
-- needed
[solverIterations] :: DynFlags -> IntWithInf
[thisInstalledUnitId] :: DynFlags -> InstalledUnitId
[thisComponentId_] :: DynFlags -> Maybe ComponentId
[thisUnitIdInsts_] :: DynFlags -> Maybe [(ModuleName, Module)]
-- | Way flags from the command line
[ways] :: DynFlags -> [Way]
-- | The global "way" (e.g. "p" for prof)
[buildTag] :: DynFlags -> String
-- | The RTS "way"
[rtsBuildTag] :: DynFlags -> String
[splitInfo] :: DynFlags -> Maybe (String, Int)
[objectDir] :: DynFlags -> Maybe String
[dylibInstallName] :: DynFlags -> Maybe String
[hiDir] :: DynFlags -> Maybe String
[stubDir] :: DynFlags -> Maybe String
[dumpDir] :: DynFlags -> Maybe String
[objectSuf] :: DynFlags -> String
[hcSuf] :: DynFlags -> String
[hiSuf] :: DynFlags -> String
[canGenerateDynamicToo] :: DynFlags -> IORef Bool
[dynObjectSuf] :: DynFlags -> String
[dynHiSuf] :: DynFlags -> String
[dllSplitFile] :: DynFlags -> Maybe FilePath
[dllSplit] :: DynFlags -> Maybe [Set String]
[outputFile] :: DynFlags -> Maybe String
[dynOutputFile] :: DynFlags -> Maybe String
[outputHi] :: DynFlags -> Maybe String
[dynLibLoader] :: DynFlags -> DynLibLoader
-- | This is set by runPipeline based on where its output is going.
[dumpPrefix] :: DynFlags -> Maybe FilePath
-- | Override the dumpPrefix set by runPipeline. Set by
-- -ddump-file-prefix
[dumpPrefixForce] :: DynFlags -> Maybe FilePath
[ldInputs] :: DynFlags -> [Option]
[includePaths] :: DynFlags -> [String]
[libraryPaths] :: DynFlags -> [String]
[frameworkPaths] :: DynFlags -> [String]
[cmdlineFrameworks] :: DynFlags -> [String]
[rtsOpts] :: DynFlags -> Maybe String
[rtsOptsEnabled] :: DynFlags -> RtsOptsEnabled
[rtsOptsSuggestions] :: DynFlags -> Bool
-- | Path to store the .mix files
[hpcDir] :: DynFlags -> String
[pluginModNames] :: DynFlags -> [ModuleName]
[pluginModNameOpts] :: DynFlags -> [(ModuleName, String)]
-- | the -ffrontend-opt flags given on the command line, in
-- *reverse* order that they're specified on the command line.
[frontendPluginOpts] :: DynFlags -> [String]
[hooks] :: DynFlags -> Hooks
[depMakefile] :: DynFlags -> FilePath
[depIncludePkgDeps] :: DynFlags -> Bool
[depExcludeMods] :: DynFlags -> [ModuleName]
[depSuffixes] :: DynFlags -> [String]
-- | The -package-db flags given on the command line, In *reverse*
-- order that they're specified on the command line. This is intended to
-- be applied with the list of "initial" package databases derived from
-- GHC_PACKAGE_PATH; see getPackageConfRefs.
[packageDBFlags] :: DynFlags -> [PackageDBFlag]
-- | The -ignore-package flags from the command line. In *reverse*
-- order that they're specified on the command line.
[ignorePackageFlags] :: DynFlags -> [IgnorePackageFlag]
-- | The -package and -hide-package flags from the
-- command-line. In *reverse* order that they're specified on the command
-- line.
[packageFlags] :: DynFlags -> [PackageFlag]
-- | The -plugin-package-id flags from command line. In *reverse*
-- order that they're specified on the command line.
[pluginPackageFlags] :: DynFlags -> [PackageFlag]
-- | The -trust and -distrust flags. In *reverse* order
-- that they're specified on the command line.
[trustFlags] :: DynFlags -> [TrustFlag]
-- | Filepath to the package environment file (if overriding default)
[packageEnv] :: DynFlags -> Maybe FilePath
[pkgDatabase] :: DynFlags -> Maybe [(FilePath, [PackageConfig])]
[pkgState] :: DynFlags -> PackageState
[filesToClean] :: DynFlags -> IORef [FilePath]
[dirsToClean] :: DynFlags -> IORef (Map FilePath FilePath)
[filesToNotIntermediateClean] :: DynFlags -> IORef [FilePath]
[nextTempSuffix] :: DynFlags -> IORef Int
[generatedDumps] :: DynFlags -> IORef (Set FilePath)
[dumpFlags] :: DynFlags -> IntSet
[generalFlags] :: DynFlags -> IntSet
[warningFlags] :: DynFlags -> IntSet
[fatalWarningFlags] :: DynFlags -> IntSet
[language] :: DynFlags -> Maybe Language
-- | Safe Haskell mode
[safeHaskell] :: DynFlags -> SafeHaskellMode
[safeInfer] :: DynFlags -> Bool
[safeInferred] :: DynFlags -> Bool
[thOnLoc] :: DynFlags -> SrcSpan
[newDerivOnLoc] :: DynFlags -> SrcSpan
[overlapInstLoc] :: DynFlags -> SrcSpan
[incoherentOnLoc] :: DynFlags -> SrcSpan
[pkgTrustOnLoc] :: DynFlags -> SrcSpan
[warnSafeOnLoc] :: DynFlags -> SrcSpan
[warnUnsafeOnLoc] :: DynFlags -> SrcSpan
[trustworthyOnLoc] :: DynFlags -> SrcSpan
[extensions] :: DynFlags -> [OnOff Extension]
[extensionFlags] :: DynFlags -> IntSet
[ufCreationThreshold] :: DynFlags -> Int
[ufUseThreshold] :: DynFlags -> Int
[ufFunAppDiscount] :: DynFlags -> Int
[ufDictDiscount] :: DynFlags -> Int
[ufKeenessFactor] :: DynFlags -> Float
[ufDearOp] :: DynFlags -> Int
[ufVeryAggressive] :: DynFlags -> Bool
[maxWorkerArgs] :: DynFlags -> Int
[ghciHistSize] :: DynFlags -> Int
-- | MsgDoc output action: use ErrUtils instead of this if you can
[initLogAction] :: DynFlags -> IO (Maybe LogOutput)
[log_action] :: DynFlags -> LogAction
[log_finaliser] :: DynFlags -> LogFinaliser
[flushOut] :: DynFlags -> FlushOut
[flushErr] :: DynFlags -> FlushErr
[haddockOptions] :: DynFlags -> Maybe String
-- | GHCi scripts specified by -ghci-script, in reverse order
[ghciScripts] :: DynFlags -> [String]
[pprUserLength] :: DynFlags -> Int
[pprCols] :: DynFlags -> Int
[useUnicode] :: DynFlags -> Bool
[useColor] :: DynFlags -> OverridingBool
[canUseColor] :: DynFlags -> Bool
[colScheme] :: DynFlags -> Scheme
-- | what kind of {--} to add automatically
[profAuto] :: DynFlags -> ProfAuto
[interactivePrint] :: DynFlags -> Maybe String
[nextWrapperNum] :: DynFlags -> IORef (ModuleEnv Int)
-- | Machine dependent flags (-mblah stuff)
[sseVersion] :: DynFlags -> Maybe SseVersion
[avx] :: DynFlags -> Bool
[avx2] :: DynFlags -> Bool
[avx512cd] :: DynFlags -> Bool
[avx512er] :: DynFlags -> Bool
[avx512f] :: DynFlags -> Bool
[avx512pf] :: DynFlags -> Bool
-- | Run-time linker information (what options we need, etc.)
[rtldInfo] :: DynFlags -> IORef (Maybe LinkerInfo)
-- | Run-time compiler information
[rtccInfo] :: DynFlags -> IORef (Maybe CompilerInfo)
-- | Max size, in bytes, of inline array allocations.
[maxInlineAllocSize] :: DynFlags -> Int
-- | Only inline memcpy if it generates no more than this many pseudo
-- (roughly: Cmm) instructions.
[maxInlineMemcpyInsns] :: DynFlags -> Int
-- | Only inline memset if it generates no more than this many pseudo
-- (roughly: Cmm) instructions.
[maxInlineMemsetInsns] :: DynFlags -> Int
-- | Reverse the order of error messages in GHC/GHCi
[reverseErrors] :: DynFlags -> Bool
-- | Limit the maximum number of errors to show
[maxErrors] :: DynFlags -> Maybe Int
-- | Unique supply configuration for testing build determinism
[initialUnique] :: DynFlags -> Int
[uniqueIncrement] :: DynFlags -> Int
data FlagSpec flag
FlagSpec :: String -> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
-- | Flag in string form
[flagSpecName] :: FlagSpec flag -> String
-- | Flag in internal form
[flagSpecFlag] :: FlagSpec flag -> flag
-- | Extra action to run when the flag is found Typically, emit a warning
-- or error
[flagSpecAction] :: FlagSpec flag -> (TurnOnFlag -> DynP ())
-- | In which ghc mode the flag has effect
[flagSpecGhcMode] :: FlagSpec flag -> GhcFlagMode
class HasDynFlags m
getDynFlags :: HasDynFlags m => m DynFlags
class ContainsDynFlags t
extractDynFlags :: ContainsDynFlags t => t -> DynFlags
data RtsOptsEnabled
RtsOptsNone :: RtsOptsEnabled
RtsOptsSafeOnly :: RtsOptsEnabled
RtsOptsAll :: RtsOptsEnabled
-- | The target code type of the compilation (if any).
--
-- Whenever you change the target, also make sure to set ghcLink
-- to something sensible.
--
-- HscNothing can be used to avoid generating any output, however,
-- note that:
--
--
-- - If a program uses Template Haskell the typechecker may try to run
-- code from an imported module. This will fail if no code has been
-- generated for this module. You can use needsTemplateHaskell to
-- detect whether this might be the case and choose to either switch to a
-- different target or avoid typechecking such modules. (The latter may
-- be preferable for security reasons.)
--
data HscTarget
-- | Generate C code.
HscC :: HscTarget
-- | Generate assembly using the native code generator.
HscAsm :: HscTarget
-- | Generate assembly using the llvm code generator.
HscLlvm :: HscTarget
-- | Generate bytecode. (Requires LinkInMemory)
HscInterpreted :: HscTarget
-- | Don't generate any code. See notes above.
HscNothing :: HscTarget
-- | Will this target result in an object file on the disk?
isObjectTarget :: HscTarget -> Bool
-- | The HscTarget value corresponding to the default way to create
-- object files on the current platform.
defaultObjectTarget :: Platform -> HscTarget
-- | Does this target retain *all* top-level bindings for a module, rather
-- than just the exported bindings, in the TypeEnv and compiled code (if
-- any)? In interpreted mode we do this, so that GHCi can call functions
-- inside a module. In HscNothing mode we also do it, so that Haddock can
-- get access to the GlobalRdrEnv for a module after typechecking it.
targetRetainsAllBindings :: HscTarget -> Bool
-- | The GhcMode tells us whether we're doing multi-module
-- compilation (controlled via the GHC API) or one-shot
-- (single-module) compilation. This makes a difference primarily to the
-- Finder: in one-shot mode we look for interface files for
-- imported modules, but in multi-module mode we look for source files in
-- order to check whether they need to be recompiled.
data GhcMode
-- | --make, GHCi, etc.
CompManager :: GhcMode
-- |
-- ghc -c Foo.hs
--
OneShot :: GhcMode
-- | ghc -M, see Finder for why we need this
MkDepend :: GhcMode
isOneShot :: GhcMode -> Bool
-- | What to do in the link step, if there is one.
data GhcLink
-- | Don't link at all
NoLink :: GhcLink
-- | Link object code into a binary
LinkBinary :: GhcLink
-- | Use the in-memory dynamic linker (works for both bytecode and object
-- code).
LinkInMemory :: GhcLink
-- | Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
LinkDynLib :: GhcLink
-- | Link objects into a static lib
LinkStaticLib :: GhcLink
isNoLink :: GhcLink -> Bool
-- | Flags for manipulating packages visibility.
data PackageFlag
-- | -package, -package-id
ExposePackage :: String -> PackageArg -> ModRenaming -> PackageFlag
-- |
-- -hide-package
--
HidePackage :: String -> PackageFlag
-- | We accept flags which make packages visible, but how they select the
-- package varies; this data type reflects what selection criterion is
-- used.
data PackageArg
-- | -package, by PackageName
PackageArg :: String -> PackageArg
-- | -package-id, by UnitId
UnitIdArg :: UnitId -> PackageArg
-- | Represents the renaming that may be associated with an exposed
-- package, e.g. the rns part of -package "foo (rns)".
--
-- Here are some example parsings of the package flags (where a string
-- literal is punned to be a ModuleName:
--
--
-- - -package foo is ModRenaming True []
-- - -package foo () is ModRenaming False []
-- - -package foo (A) is ModRenaming False [(A,
-- A)]
-- - -package foo (A as B) is ModRenaming False
-- [(A, B)]
-- - -package foo with (A as B) is ModRenaming True
-- [(A, B)]
--
data ModRenaming
ModRenaming :: Bool -> [(ModuleName, ModuleName)] -> ModRenaming
-- | Bring all exposed modules into scope?
[modRenamingWithImplicit] :: ModRenaming -> Bool
-- | Bring module m into scope under name n.
[modRenamings] :: ModRenaming -> [(ModuleName, ModuleName)]
packageFlagsChanged :: DynFlags -> DynFlags -> Bool
-- | Flags for manipulating the set of non-broken packages.
newtype IgnorePackageFlag
-- |
-- -ignore-package
--
IgnorePackage :: String -> IgnorePackageFlag
-- | Flags for manipulating package trust.
data TrustFlag
-- |
-- -trust
--
TrustPackage :: String -> TrustFlag
-- |
-- -distrust
--
DistrustPackage :: String -> TrustFlag
data PackageDBFlag
PackageDB :: PkgConfRef -> PackageDBFlag
NoUserPackageDB :: PackageDBFlag
NoGlobalPackageDB :: PackageDBFlag
ClearPackageDBs :: PackageDBFlag
data PkgConfRef
GlobalPkgConf :: PkgConfRef
UserPkgConf :: PkgConfRef
PkgConfFile :: FilePath -> PkgConfRef
-- | When invoking external tools as part of the compilation pipeline, we
-- pass these a sequence of options on the command-line. Rather than just
-- using a list of Strings, we use a type that allows us to distinguish
-- between filepaths and 'other stuff'. The reason for this is that this
-- type gives us a handle on transforming filenames, and filenames only,
-- to whatever format they're expected to be on a particular platform.
data Option
FileOption :: String -> String -> Option
Option :: String -> Option
showOpt :: Option -> String
data DynLibLoader
Deployable :: DynLibLoader
SystemDependent :: DynLibLoader
-- | These -f<blah> flags can all be reversed with
-- -fno-<blah>
fFlags :: [FlagSpec GeneralFlag]
-- | These -f<blah> flags can all be reversed with
-- -fno-<blah>
fLangFlags :: [FlagSpec Extension]
-- | These -Xblah flags can all be reversed with -XNoblah
xFlags :: [FlagSpec Extension]
-- | These -W<blah> flags can all be reversed with
-- -Wno-<blah>
wWarningFlags :: [FlagSpec WarningFlag]
-- | Some modules have dependencies on others through the DynFlags rather
-- than textual imports
dynFlagDependencies :: DynFlags -> [ModuleName]
tablesNextToCode :: DynFlags -> Bool
mkTablesNextToCode :: Bool -> Bool
-- | Resolve any internal inconsistencies in a set of DynFlags.
-- Returns the consistent DynFlags as well as a list of warnings
-- to report to the user.
makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String])
shouldUseColor :: DynFlags -> Bool
-- | Are we building with -fPIE or -fPIC enabled?
positionIndependent :: DynFlags -> Bool
data Way
WayCustom :: String -> Way
WayThreaded :: Way
WayDebug :: Way
WayProf :: Way
WayEventLog :: Way
WayDyn :: Way
mkBuildTag :: [Way] -> String
wayRTSOnly :: Way -> Bool
addWay' :: Way -> DynFlags -> DynFlags
updateWays :: DynFlags -> DynFlags
wayGeneralFlags :: Platform -> Way -> [GeneralFlag]
wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag]
thisPackage :: DynFlags -> UnitId
thisComponentId :: DynFlags -> ComponentId
thisUnitIdInsts :: DynFlags -> [(ModuleName, Module)]
-- | Write an error or warning to the LogOutput.
putLogMsg :: DynFlags -> WarnReason -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO ()
-- | The various Safe Haskell modes
data SafeHaskellMode
Sf_None :: SafeHaskellMode
Sf_Unsafe :: SafeHaskellMode
Sf_Trustworthy :: SafeHaskellMode
Sf_Safe :: SafeHaskellMode
-- | Is Safe Haskell on in some way (including inference mode)
safeHaskellOn :: DynFlags -> Bool
-- | Test if Safe Imports are on in some form
safeImportsOn :: DynFlags -> Bool
-- | Is the Safe Haskell safe language in use
safeLanguageOn :: DynFlags -> Bool
-- | Is the Safe Haskell safe inference mode active
safeInferOn :: DynFlags -> Bool
-- | Is the -fpackage-trust mode on
packageTrustOn :: DynFlags -> Bool
-- | Are all direct imports required to be safe for this Safe Haskell mode?
-- Direct imports are when the code explicitly imports a module
safeDirectImpsReq :: DynFlags -> Bool
-- | Are all implicit imports required to be safe for this Safe Haskell
-- mode? Implicit imports are things in the prelude. e.g System.IO when
-- print is used.
safeImplicitImpsReq :: DynFlags -> Bool
-- | A list of unsafe flags under Safe Haskell. Tuple elements are: * name
-- of the flag * function to get srcspan that enabled the flag * function
-- to test if the flag is on * function to turn the flag off
unsafeFlags :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)]
-- | A list of unsafe flags under Safe Haskell. Tuple elements are: * name
-- of the flag * function to get srcspan that enabled the flag * function
-- to test if the flag is on * function to turn the flag off
unsafeFlagsForInfer :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)]
data Settings
Settings :: Platform -> FilePath -> FilePath -> FilePath -> String -> String -> String -> [(String, String)] -> [String] -> FilePath -> Bool -> Bool -> Bool -> Bool -> Bool -> String -> (String, [Option]) -> String -> (String, [Option]) -> (String, [Option]) -> (String, [Option]) -> (String, [Option]) -> (String, [Option]) -> String -> String -> String -> (String, [Option]) -> (String, [Option]) -> String -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> PlatformConstants -> Settings
[sTargetPlatform] :: Settings -> Platform
[sGhcUsagePath] :: Settings -> FilePath
[sGhciUsagePath] :: Settings -> FilePath
[sTopDir] :: Settings -> FilePath
[sTmpDir] :: Settings -> String
[sProgramName] :: Settings -> String
[sProjectVersion] :: Settings -> String
[sRawSettings] :: Settings -> [(String, String)]
[sExtraGccViaCFlags] :: Settings -> [String]
[sSystemPackageConfig] :: Settings -> FilePath
[sLdSupportsCompactUnwind] :: Settings -> Bool
[sLdSupportsBuildId] :: Settings -> Bool
[sLdSupportsFilelist] :: Settings -> Bool
[sLdIsGnuLd] :: Settings -> Bool
[sGccSupportsNoPie] :: Settings -> Bool
[sPgm_L] :: Settings -> String
[sPgm_P] :: Settings -> (String, [Option])
[sPgm_F] :: Settings -> String
[sPgm_c] :: Settings -> (String, [Option])
[sPgm_s] :: Settings -> (String, [Option])
[sPgm_a] :: Settings -> (String, [Option])
[sPgm_l] :: Settings -> (String, [Option])
[sPgm_dll] :: Settings -> (String, [Option])
[sPgm_T] :: Settings -> String
[sPgm_windres] :: Settings -> String
[sPgm_libtool] :: Settings -> String
[sPgm_lo] :: Settings -> (String, [Option])
[sPgm_lc] :: Settings -> (String, [Option])
[sPgm_i] :: Settings -> String
[sOpt_L] :: Settings -> [String]
[sOpt_P] :: Settings -> [String]
[sOpt_F] :: Settings -> [String]
[sOpt_c] :: Settings -> [String]
[sOpt_a] :: Settings -> [String]
[sOpt_l] :: Settings -> [String]
[sOpt_windres] :: Settings -> [String]
[sOpt_lo] :: Settings -> [String]
[sOpt_lc] :: Settings -> [String]
[sOpt_i] :: Settings -> [String]
[sPlatformConstants] :: Settings -> PlatformConstants
targetPlatform :: DynFlags -> Platform
programName :: DynFlags -> String
projectVersion :: DynFlags -> String
ghcUsagePath :: DynFlags -> FilePath
ghciUsagePath :: DynFlags -> FilePath
topDir :: DynFlags -> FilePath
tmpDir :: DynFlags -> String
rawSettings :: DynFlags -> [(String, String)]
-- | The directory for this version of ghc in the user's app directory
-- (typically something like ~.ghcx86_64-linux-7.6.3)
versionedAppDir :: DynFlags -> MaybeT IO FilePath
extraGccViaCFlags :: DynFlags -> [String]
systemPackageConfig :: DynFlags -> FilePath
pgm_L :: DynFlags -> String
pgm_P :: DynFlags -> (String, [Option])
pgm_F :: DynFlags -> String
pgm_c :: DynFlags -> (String, [Option])
pgm_s :: DynFlags -> (String, [Option])
pgm_a :: DynFlags -> (String, [Option])
pgm_l :: DynFlags -> (String, [Option])
pgm_dll :: DynFlags -> (String, [Option])
pgm_T :: DynFlags -> String
pgm_windres :: DynFlags -> String
pgm_libtool :: DynFlags -> String
pgm_lo :: DynFlags -> (String, [Option])
pgm_lc :: DynFlags -> (String, [Option])
pgm_i :: DynFlags -> String
opt_L :: DynFlags -> [String]
opt_P :: DynFlags -> [String]
opt_F :: DynFlags -> [String]
opt_c :: DynFlags -> [String]
opt_a :: DynFlags -> [String]
opt_l :: DynFlags -> [String]
opt_i :: DynFlags -> [String]
opt_windres :: DynFlags -> [String]
opt_lo :: DynFlags -> [String]
opt_lc :: DynFlags -> [String]
-- | The normal DynFlags. Note that they are not suitable for use in
-- this form and must be fully initialized by runGhc first.
defaultDynFlags :: Settings -> DynFlags
defaultWays :: Settings -> [Way]
interpWays :: [Way]
interpreterProfiled :: DynFlags -> Bool
interpreterDynamic :: DynFlags -> Bool
-- | Used by runGhc to partially initialize a new DynFlags
-- value
initDynFlags :: DynFlags -> IO DynFlags
defaultFatalMessager :: FatalMessager
defaultLogAction :: LogAction
-- | Like defaultLogActionHPutStrDoc but appends an extra newline.
defaultLogActionHPrintDoc :: DynFlags -> Handle -> SDoc -> PprStyle -> IO ()
defaultLogActionHPutStrDoc :: DynFlags -> Handle -> SDoc -> PprStyle -> IO ()
defaultFlushOut :: FlushOut
defaultFlushErr :: FlushErr
-- | Retrieve the options corresponding to a particular opt_*
-- field in the correct order
getOpts :: DynFlags -> (DynFlags -> [a]) -> [a]
-- | Gets the verbosity flag for the current verbosity level. This is fed
-- to other tools, so GHC-specific verbosity flags like
-- -ddump-most are not included
getVerbFlags :: DynFlags -> [String]
-- | Sets the DynFlags to be appropriate to the optimisation level
updOptLevel :: Int -> DynFlags -> DynFlags
setTmpDir :: FilePath -> DynFlags -> DynFlags
setUnitId :: String -> DynFlags -> DynFlags
-- | Find the package environment (if one exists)
--
-- We interpret the package environment as a set of package flags; to be
-- specific, if we find a package environment file like
--
--
-- clear-package-db
-- global-package-db
-- package-db blah/package.conf.d
-- package-id id1
-- package-id id2
--
--
-- we interpret this as
--
--
-- [ -hide-all-packages
-- , -clear-package-db
-- , -global-package-db
-- , -package-db blah/package.conf.d
-- , -package-id id1
-- , -package-id id2
-- ]
--
--
-- There's also an older syntax alias for package-id, which is just an
-- unadorned package id
--
--
-- id1
-- id2
--
interpretPackageEnv :: DynFlags -> IO DynFlags
-- | Given a ModuleName of a signature in the home library, find out
-- how it is instantiated. E.g., the canonical form of A in
-- p[A=q[]:A] is q[]:A.
canonicalizeHomeModule :: DynFlags -> ModuleName -> Module
-- | Parse dynamic flags from a list of command line arguments. Returns the
-- the parsed DynFlags, the left-over arguments, and a list of
-- warnings. Throws a UsageError if errors occurred during parsing
-- (such as unknown flags or missing arguments).
parseDynamicFlagsCmdLine :: MonadIO m => DynFlags -> [Located String] -> m (DynFlags, [Located String], [Located String])
-- | Like parseDynamicFlagsCmdLine but does not allow the package
-- flags (-package, -hide-package, -ignore-package, -hide-all-packages,
-- -package-db). Used to parse flags set in a modules pragma.
parseDynamicFilePragma :: MonadIO m => DynFlags -> [Located String] -> m (DynFlags, [Located String], [Located String])
-- | Parses the dynamically set flags for GHC. This is the most general
-- form of the dynamic flag parser that the other methods simply wrap. It
-- allows saying which flags are valid flags and indicating if we are
-- parsing arguments from the command line or from a file pragma.
parseDynamicFlagsFull :: MonadIO m => [Flag (CmdLineP DynFlags)] -> Bool -> DynFlags -> [Located String] -> m (DynFlags, [Located String], [Located String])
-- | All dynamic flags option strings without the deprecated ones. These
-- are the user facing strings for enabling and disabling options.
allNonDeprecatedFlags :: [String]
flagsAll :: [Flag (CmdLineP DynFlags)]
flagsDynamic :: [Flag (CmdLineP DynFlags)]
flagsPackage :: [Flag (CmdLineP DynFlags)]
-- | Make a list of flags for shell completion. Filter all available flags
-- into two groups, for interactive GHC vs all other.
flagsForCompletion :: Bool -> [String]
supportedLanguagesAndExtensions :: [String]
languageExtensions :: Maybe Language -> [Extension]
picCCOpts :: DynFlags -> [String]
picPOpts :: DynFlags -> [String]
compilerInfo :: DynFlags -> [(String, String)]
-- | Was the runtime system built with profiling enabled?
rtsIsProfiled :: Bool
dynamicGhc :: Bool
cONTROL_GROUP_CONST_291 :: DynFlags -> Int
sTD_HDR_SIZE :: DynFlags -> Int
pROF_HDR_SIZE :: DynFlags -> Int
bLOCK_SIZE :: DynFlags -> Int
bLOCKS_PER_MBLOCK :: DynFlags -> Int
tICKY_BIN_COUNT :: DynFlags -> Int
oFFSET_StgRegTable_rR1 :: DynFlags -> Int
oFFSET_StgRegTable_rR2 :: DynFlags -> Int
oFFSET_StgRegTable_rR3 :: DynFlags -> Int
oFFSET_StgRegTable_rR4 :: DynFlags -> Int
oFFSET_StgRegTable_rR5 :: DynFlags -> Int
oFFSET_StgRegTable_rR6 :: DynFlags -> Int
oFFSET_StgRegTable_rR7 :: DynFlags -> Int
oFFSET_StgRegTable_rR8 :: DynFlags -> Int
oFFSET_StgRegTable_rR9 :: DynFlags -> Int
oFFSET_StgRegTable_rR10 :: DynFlags -> Int
oFFSET_StgRegTable_rF1 :: DynFlags -> Int
oFFSET_StgRegTable_rF2 :: DynFlags -> Int
oFFSET_StgRegTable_rF3 :: DynFlags -> Int
oFFSET_StgRegTable_rF4 :: DynFlags -> Int
oFFSET_StgRegTable_rF5 :: DynFlags -> Int
oFFSET_StgRegTable_rF6 :: DynFlags -> Int
oFFSET_StgRegTable_rD1 :: DynFlags -> Int
oFFSET_StgRegTable_rD2 :: DynFlags -> Int
oFFSET_StgRegTable_rD3 :: DynFlags -> Int
oFFSET_StgRegTable_rD4 :: DynFlags -> Int
oFFSET_StgRegTable_rD5 :: DynFlags -> Int
oFFSET_StgRegTable_rD6 :: DynFlags -> Int
oFFSET_StgRegTable_rXMM1 :: DynFlags -> Int
oFFSET_StgRegTable_rXMM2 :: DynFlags -> Int
oFFSET_StgRegTable_rXMM3 :: DynFlags -> Int
oFFSET_StgRegTable_rXMM4 :: DynFlags -> Int
oFFSET_StgRegTable_rXMM5 :: DynFlags -> Int
oFFSET_StgRegTable_rXMM6 :: DynFlags -> Int
oFFSET_StgRegTable_rYMM1 :: DynFlags -> Int
oFFSET_StgRegTable_rYMM2 :: DynFlags -> Int
oFFSET_StgRegTable_rYMM3 :: DynFlags -> Int
oFFSET_StgRegTable_rYMM4 :: DynFlags -> Int
oFFSET_StgRegTable_rYMM5 :: DynFlags -> Int
oFFSET_StgRegTable_rYMM6 :: DynFlags -> Int
oFFSET_StgRegTable_rZMM1 :: DynFlags -> Int
oFFSET_StgRegTable_rZMM2 :: DynFlags -> Int
oFFSET_StgRegTable_rZMM3 :: DynFlags -> Int
oFFSET_StgRegTable_rZMM4 :: DynFlags -> Int
oFFSET_StgRegTable_rZMM5 :: DynFlags -> Int
oFFSET_StgRegTable_rZMM6 :: DynFlags -> Int
oFFSET_StgRegTable_rL1 :: DynFlags -> Int
oFFSET_StgRegTable_rSp :: DynFlags -> Int
oFFSET_StgRegTable_rSpLim :: DynFlags -> Int
oFFSET_StgRegTable_rHp :: DynFlags -> Int
oFFSET_StgRegTable_rHpLim :: DynFlags -> Int
oFFSET_StgRegTable_rCCCS :: DynFlags -> Int
oFFSET_StgRegTable_rCurrentTSO :: DynFlags -> Int
oFFSET_StgRegTable_rCurrentNursery :: DynFlags -> Int
oFFSET_StgRegTable_rHpAlloc :: DynFlags -> Int
oFFSET_stgEagerBlackholeInfo :: DynFlags -> Int
oFFSET_stgGCEnter1 :: DynFlags -> Int
oFFSET_stgGCFun :: DynFlags -> Int
oFFSET_Capability_r :: DynFlags -> Int
oFFSET_bdescr_start :: DynFlags -> Int
oFFSET_bdescr_free :: DynFlags -> Int
oFFSET_bdescr_blocks :: DynFlags -> Int
oFFSET_bdescr_flags :: DynFlags -> Int
sIZEOF_CostCentreStack :: DynFlags -> Int
oFFSET_CostCentreStack_mem_alloc :: DynFlags -> Int
oFFSET_CostCentreStack_scc_count :: DynFlags -> Int
oFFSET_StgHeader_ccs :: DynFlags -> Int
oFFSET_StgHeader_ldvw :: DynFlags -> Int
sIZEOF_StgSMPThunkHeader :: DynFlags -> Int
oFFSET_StgEntCounter_allocs :: DynFlags -> Int
oFFSET_StgEntCounter_allocd :: DynFlags -> Int
oFFSET_StgEntCounter_registeredp :: DynFlags -> Int
oFFSET_StgEntCounter_link :: DynFlags -> Int
oFFSET_StgEntCounter_entry_count :: DynFlags -> Int
sIZEOF_StgUpdateFrame_NoHdr :: DynFlags -> Int
sIZEOF_StgMutArrPtrs_NoHdr :: DynFlags -> Int
oFFSET_StgMutArrPtrs_ptrs :: DynFlags -> Int
oFFSET_StgMutArrPtrs_size :: DynFlags -> Int
sIZEOF_StgSmallMutArrPtrs_NoHdr :: DynFlags -> Int
oFFSET_StgSmallMutArrPtrs_ptrs :: DynFlags -> Int
sIZEOF_StgArrBytes_NoHdr :: DynFlags -> Int
oFFSET_StgArrBytes_bytes :: DynFlags -> Int
oFFSET_StgTSO_alloc_limit :: DynFlags -> Int
oFFSET_StgTSO_cccs :: DynFlags -> Int
oFFSET_StgTSO_stackobj :: DynFlags -> Int
oFFSET_StgStack_sp :: DynFlags -> Int
oFFSET_StgStack_stack :: DynFlags -> Int
oFFSET_StgUpdateFrame_updatee :: DynFlags -> Int
oFFSET_StgFunInfoExtraFwd_arity :: DynFlags -> Int
sIZEOF_StgFunInfoExtraRev :: DynFlags -> Int
oFFSET_StgFunInfoExtraRev_arity :: DynFlags -> Int
mAX_SPEC_SELECTEE_SIZE :: DynFlags -> Int
mAX_SPEC_AP_SIZE :: DynFlags -> Int
mIN_PAYLOAD_SIZE :: DynFlags -> Int
mIN_INTLIKE :: DynFlags -> Int
mAX_INTLIKE :: DynFlags -> Int
mIN_CHARLIKE :: DynFlags -> Int
mAX_CHARLIKE :: DynFlags -> Int
mUT_ARR_PTRS_CARD_BITS :: DynFlags -> Int
mAX_Vanilla_REG :: DynFlags -> Int
mAX_Float_REG :: DynFlags -> Int
mAX_Double_REG :: DynFlags -> Int
mAX_Long_REG :: DynFlags -> Int
mAX_XMM_REG :: DynFlags -> Int
mAX_Real_Vanilla_REG :: DynFlags -> Int
mAX_Real_Float_REG :: DynFlags -> Int
mAX_Real_Double_REG :: DynFlags -> Int
mAX_Real_XMM_REG :: DynFlags -> Int
mAX_Real_Long_REG :: DynFlags -> Int
rESERVED_C_STACK_BYTES :: DynFlags -> Int
rESERVED_STACK_WORDS :: DynFlags -> Int
aP_STACK_SPLIM :: DynFlags -> Int
wORD_SIZE :: DynFlags -> Int
dOUBLE_SIZE :: DynFlags -> Int
cINT_SIZE :: DynFlags -> Int
cLONG_SIZE :: DynFlags -> Int
cLONG_LONG_SIZE :: DynFlags -> Int
bITMAP_BITS_SHIFT :: DynFlags -> Int
tAG_BITS :: DynFlags -> Int
wORDS_BIGENDIAN :: DynFlags -> Bool
dYNAMIC_BY_DEFAULT :: DynFlags -> Bool
lDV_SHIFT :: DynFlags -> Int
iLDV_CREATE_MASK :: DynFlags -> Integer
iLDV_STATE_CREATE :: DynFlags -> Integer
iLDV_STATE_USE :: DynFlags -> Integer
bLOCK_SIZE_W :: DynFlags -> Int
wORD_SIZE_IN_BITS :: DynFlags -> Int
tAG_MASK :: DynFlags -> Int
mAX_PTR_TAG :: DynFlags -> Int
tARGET_MIN_INT :: DynFlags -> Integer
tARGET_MAX_INT :: DynFlags -> Integer
tARGET_MAX_WORD :: DynFlags -> Integer
unsafeGlobalDynFlags :: DynFlags
setUnsafeGlobalDynFlags :: DynFlags -> IO ()
isSseEnabled :: DynFlags -> Bool
isSse2Enabled :: DynFlags -> Bool
isSse4_2Enabled :: DynFlags -> Bool
isAvxEnabled :: DynFlags -> Bool
isAvx2Enabled :: DynFlags -> Bool
isAvx512cdEnabled :: DynFlags -> Bool
isAvx512erEnabled :: DynFlags -> Bool
isAvx512fEnabled :: DynFlags -> Bool
isAvx512pfEnabled :: DynFlags -> Bool
data LinkerInfo
GnuLD :: [Option] -> LinkerInfo
GnuGold :: [Option] -> LinkerInfo
DarwinLD :: [Option] -> LinkerInfo
SolarisLD :: [Option] -> LinkerInfo
AixLD :: [Option] -> LinkerInfo
UnknownLD :: LinkerInfo
data CompilerInfo
GCC :: CompilerInfo
Clang :: CompilerInfo
AppleClang :: CompilerInfo
AppleClang51 :: CompilerInfo
UnknownCC :: CompilerInfo
instance GHC.Show.Show DynFlags.PackageArg
instance GHC.Classes.Eq DynFlags.PackageArg
instance GHC.Classes.Eq DynFlags.ModRenaming
instance GHC.Classes.Eq DynFlags.PackageFlag
instance GHC.Classes.Eq DynFlags.CompilerInfo
instance GHC.Classes.Eq DynFlags.LinkerInfo
instance GHC.Classes.Ord DynFlags.SseVersion
instance GHC.Classes.Eq DynFlags.SseVersion
instance GHC.Classes.Eq DynFlags.PackageDBFlag
instance GHC.Classes.Eq DynFlags.PkgConfRef
instance GHC.Classes.Ord DynFlags.Deprecation
instance GHC.Classes.Eq DynFlags.Deprecation
instance GHC.Classes.Eq DynFlags.Option
instance GHC.Show.Show a => GHC.Show.Show (DynFlags.OnOff a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (DynFlags.OnOff a)
instance GHC.Show.Show DynFlags.Way
instance GHC.Classes.Ord DynFlags.Way
instance GHC.Classes.Eq DynFlags.Way
instance GHC.Show.Show DynFlags.RtsOptsEnabled
instance GHC.Classes.Eq DynFlags.DynLibLoader
instance GHC.Classes.Eq DynFlags.TrustFlag
instance GHC.Classes.Eq DynFlags.IgnorePackageFlag
instance GHC.Show.Show DynFlags.GhcLink
instance GHC.Classes.Eq DynFlags.GhcLink
instance GHC.Classes.Eq DynFlags.GhcMode
instance GHC.Show.Show DynFlags.HscTarget
instance GHC.Classes.Eq DynFlags.HscTarget
instance GHC.Enum.Enum DynFlags.ProfAuto
instance GHC.Classes.Eq DynFlags.ProfAuto
instance GHC.Classes.Eq DynFlags.SafeHaskellMode
instance GHC.Show.Show DynFlags.Language
instance GHC.Enum.Enum DynFlags.Language
instance GHC.Classes.Eq DynFlags.Language
instance GHC.Show.Show DynFlags.WarnReason
instance GHC.Enum.Enum DynFlags.WarningFlag
instance GHC.Show.Show DynFlags.WarningFlag
instance GHC.Classes.Eq DynFlags.WarningFlag
instance GHC.Enum.Enum DynFlags.GeneralFlag
instance GHC.Show.Show DynFlags.GeneralFlag
instance GHC.Classes.Eq DynFlags.GeneralFlag
instance GHC.Enum.Enum DynFlags.DumpFlag
instance GHC.Show.Show DynFlags.DumpFlag
instance GHC.Classes.Eq DynFlags.DumpFlag
instance (GHC.Base.Monoid a, GHC.Base.Monad m, DynFlags.HasDynFlags m) => DynFlags.HasDynFlags (Control.Monad.Trans.Writer.Lazy.WriterT a m)
instance (GHC.Base.Monad m, DynFlags.HasDynFlags m) => DynFlags.HasDynFlags (Control.Monad.Trans.Reader.ReaderT a m)
instance (GHC.Base.Monad m, DynFlags.HasDynFlags m) => DynFlags.HasDynFlags (Control.Monad.Trans.Maybe.MaybeT m)
instance (GHC.Base.Monad m, DynFlags.HasDynFlags m) => DynFlags.HasDynFlags (Control.Monad.Trans.Except.ExceptT e m)
instance Outputable.Outputable DynFlags.PackageArg
instance Outputable.Outputable DynFlags.ModRenaming
instance Outputable.Outputable DynFlags.PackageFlag
instance Outputable.Outputable a => Outputable.Outputable (DynFlags.OnOff a)
instance Outputable.Outputable DynFlags.GhcMode
instance GHC.Show.Show DynFlags.SafeHaskellMode
instance Outputable.Outputable DynFlags.SafeHaskellMode
instance Outputable.Outputable DynFlags.Language
instance Outputable.Outputable DynFlags.WarnReason
instance Json.ToJson DynFlags.WarnReason
-- | Bits and pieces on the bottom of the module dependency tree. Also
-- import the required constants, so we know what we're using.
--
-- In the interests of cross-compilation, we want to free ourselves from
-- the autoconf generated modules like main/Constants
module SPARC.Base
wordLength :: Int
wordLengthInBits :: Int
spillAreaLength :: DynFlags -> Int
-- | We need 8 bytes because our largest registers are 64 bit.
spillSlotSize :: Int
-- | We (allegedly) put the first six C-call arguments in registers; where
-- do we start putting the rest of them?
extraStackArgsHere :: Int
-- | Check whether an offset is representable with 13 bits.
fits13Bits :: Integral a => a -> Bool
-- | Check whether an integer will fit in 32 bits. A CmmInt is intended to
-- be truncated to the appropriate number of bits, so here we truncate it
-- to Int64. This is important because e.g. -1 as a CmmInt might be
-- either -1 or 18446744073709551615.
is32BitInteger :: Integer -> Bool
-- | Sadness.
largeOffsetError :: (Show a) => a -> b
module SMRep
-- | Word offset, or word count
type WordOff = Int
-- | Byte offset, or byte count
type ByteOff = Int
-- | Convert the given number of words to a number of bytes.
--
-- This function morally has type WordOff -> ByteOff, but
-- uses Num a to allow for overloading.
wordsToBytes :: Num a => DynFlags -> a -> a
-- | First round the given byte count up to a multiple of the machine's
-- word size and then convert the result to words.
bytesToWordsRoundUp :: DynFlags -> ByteOff -> WordOff
-- | Round up the given byte count to the next byte count that's a multiple
-- of the machine's word size.
roundUpToWords :: DynFlags -> ByteOff -> ByteOff
data StgWord
fromStgWord :: StgWord -> Integer
toStgWord :: DynFlags -> Integer -> StgWord
data StgHalfWord
fromStgHalfWord :: StgHalfWord -> Integer
toStgHalfWord :: DynFlags -> Integer -> StgHalfWord
hALF_WORD_SIZE :: DynFlags -> ByteOff
hALF_WORD_SIZE_IN_BITS :: DynFlags -> Int
-- | A description of the layout of a closure. Corresponds directly to the
-- closure types in includesrtsstorage/ClosureTypes.h.
data SMRep
HeapRep :: IsStatic -> !WordOff -> !WordOff -> ClosureTypeInfo -> SMRep
ArrayPtrsRep :: !WordOff -> !WordOff -> SMRep
SmallArrayPtrsRep :: !WordOff -> SMRep
ArrayWordsRep :: !WordOff -> SMRep
StackRep :: Liveness -> SMRep
RTSRep :: Int -> SMRep -> SMRep
-- | True = This is a static closure. Affects how we garbage-collect
-- it. Static closure have an extra static link field at the end.
-- Constructors do not have a static variant; see Note [static
-- constructors]
type IsStatic = Bool
data ClosureTypeInfo
Constr :: ConstrTag -> ConstrDescription -> ClosureTypeInfo
Fun :: FunArity -> ArgDescr -> ClosureTypeInfo
Thunk :: ClosureTypeInfo
ThunkSelector :: SelectorOffset -> ClosureTypeInfo
BlackHole :: ClosureTypeInfo
IndStatic :: ClosureTypeInfo
data ArgDescr
ArgSpec :: !Int -> ArgDescr
ArgGen :: Liveness -> ArgDescr
type Liveness = [Bool]
type ConstrDescription = [Word8]
mkHeapRep :: DynFlags -> IsStatic -> WordOff -> WordOff -> ClosureTypeInfo -> SMRep
blackHoleRep :: SMRep
indStaticRep :: SMRep
mkStackRep :: [Bool] -> SMRep
mkRTSRep :: Int -> SMRep -> SMRep
arrPtrsRep :: DynFlags -> WordOff -> SMRep
smallArrPtrsRep :: WordOff -> SMRep
arrWordsRep :: DynFlags -> ByteOff -> SMRep
isStaticRep :: SMRep -> IsStatic
isConRep :: SMRep -> Bool
isThunkRep :: SMRep -> Bool
isFunRep :: SMRep -> Bool
isStaticNoCafCon :: SMRep -> Bool
isStackRep :: SMRep -> Bool
-- | The total size of the closure, in words.
heapClosureSizeW :: DynFlags -> SMRep -> WordOff
-- | Size of a closure header (StgHeader in
-- includesrtsstorage/Closures.h)
fixedHdrSizeW :: DynFlags -> WordOff
arrWordsHdrSize :: DynFlags -> ByteOff
arrWordsHdrSizeW :: DynFlags -> WordOff
arrPtrsHdrSize :: DynFlags -> ByteOff
arrPtrsHdrSizeW :: DynFlags -> WordOff
-- | Size of the profiling part of a closure header (StgProfHeader in
-- includesrtsstorage/Closures.h)
profHdrSize :: DynFlags -> WordOff
thunkHdrSize :: DynFlags -> WordOff
nonHdrSize :: DynFlags -> SMRep -> ByteOff
nonHdrSizeW :: SMRep -> WordOff
smallArrPtrsHdrSize :: DynFlags -> ByteOff
smallArrPtrsHdrSizeW :: DynFlags -> WordOff
hdrSize :: DynFlags -> SMRep -> ByteOff
hdrSizeW :: DynFlags -> SMRep -> WordOff
fixedHdrSize :: DynFlags -> ByteOff
-- | Derives the RTS closure type from an SMRep
rtsClosureType :: SMRep -> Int
rET_SMALL :: Int
rET_BIG :: Int
aRG_GEN :: Int
aRG_GEN_BIG :: Int
-- | The byte offset into the card table of the card for a given element
card :: DynFlags -> Int -> Int
-- | Convert a number of elements to a number of cards, rounding up
cardRoundUp :: DynFlags -> Int -> Int
-- | The size of a card table, in bytes
cardTableSizeB :: DynFlags -> Int -> ByteOff
-- | The size of a card table, in words
cardTableSizeW :: DynFlags -> Int -> WordOff
pprWord8String :: [Word8] -> SDoc
stringToWord8s :: String -> [Word8]
instance GHC.Classes.Eq SMRep.StgHalfWord
instance Data.Bits.Bits SMRep.StgWord
instance GHC.Classes.Eq SMRep.StgWord
instance Outputable.Outputable SMRep.SMRep
instance Outputable.Outputable SMRep.ClosureTypeInfo
instance Outputable.Outputable SMRep.ArgDescr
instance Outputable.Outputable SMRep.StgHalfWord
instance Outputable.Outputable SMRep.StgWord
-- | The assignment of virtual registers to stack slots
module RegAlloc.Linear.StackMap
-- | Identifier for a stack slot.
type StackSlot = Int
data StackMap
StackMap :: !Int -> UniqFM StackSlot -> StackMap
-- | The slots that are still available to be allocated.
[stackMapNextFreeSlot] :: StackMap -> !Int
-- | Assignment of vregs to stack slots.
[stackMapAssignment] :: StackMap -> UniqFM StackSlot
-- | An empty stack map, with all slots available.
emptyStackMap :: DynFlags -> StackMap
-- | If this vreg unique already has a stack assignment then return the
-- slot number, otherwise allocate a new slot, and update the map.
getStackSlotFor :: StackMap -> Unique -> (StackMap, Int)
-- | Return the number of stack slots that were allocated
getStackUse :: StackMap -> Int
-- | GHC uses several kinds of name internally:
--
--
module OccName
data NameSpace
nameSpacesRelated :: NameSpace -> NameSpace -> Bool
tcName :: NameSpace
clsName :: NameSpace
tcClsName :: NameSpace
dataName :: NameSpace
varName :: NameSpace
tvName :: NameSpace
srcDataName :: NameSpace
pprNameSpace :: NameSpace -> SDoc
pprNonVarNameSpace :: NameSpace -> SDoc
pprNameSpaceBrief :: NameSpace -> SDoc
-- | Occurrence Name
--
-- In this context that means: "classified (i.e. as a type name, value
-- name, etc) but not qualified and not yet resolved"
data OccName
pprOccName :: OccName -> SDoc
mkOccName :: NameSpace -> String -> OccName
mkOccNameFS :: NameSpace -> FastString -> OccName
mkVarOcc :: String -> OccName
mkVarOccFS :: FastString -> OccName
mkDataOcc :: String -> OccName
mkDataOccFS :: FastString -> OccName
mkTyVarOcc :: String -> OccName
mkTyVarOccFS :: FastString -> OccName
mkTcOcc :: String -> OccName
mkTcOccFS :: FastString -> OccName
mkClsOcc :: String -> OccName
mkClsOccFS :: FastString -> OccName
mkDFunOcc :: String -> Bool -> OccSet -> OccName
setOccNameSpace :: NameSpace -> OccName -> OccName
demoteOccName :: OccName -> Maybe OccName
-- | Other names in the compiler add additional information to an OccName.
-- This class provides a consistent way to access the underlying OccName.
class HasOccName name
occName :: HasOccName name => name -> OccName
-- | Test for definitions internally generated by GHC. This predicte is
-- used to suppress printing of internal definitions in some debug prints
isDerivedOccName :: OccName -> Bool
mkDataConWrapperOcc :: OccName -> OccName
mkWorkerOcc :: OccName -> OccName
mkMatcherOcc :: OccName -> OccName
mkBuilderOcc :: OccName -> OccName
mkDefaultMethodOcc :: OccName -> OccName
isDefaultMethodOcc :: OccName -> Bool
-- | Is an OccName one of a Typeable TyCon or
-- Module binding? This is needed as these bindings are renamed
-- differently. See Note [Grand plan for Typeable] in TcTypeable.
isTypeableBindOcc :: OccName -> Bool
mkNewTyCoOcc :: OccName -> OccName
mkClassOpAuxOcc :: OccName -> OccName
mkCon2TagOcc :: OccName -> OccName
mkTag2ConOcc :: OccName -> OccName
mkMaxTagOcc :: OccName -> OccName
mkClassDataConOcc :: OccName -> OccName
mkDictOcc :: OccName -> OccName
mkIPOcc :: OccName -> OccName
mkSpecOcc :: OccName -> OccName
mkForeignExportOcc :: OccName -> OccName
mkRepEqOcc :: OccName -> OccName
mkGenR :: OccName -> OccName
mkGen1R :: OccName -> OccName
mkDataTOcc :: OccName -> OccSet -> OccName
mkDataCOcc :: OccName -> OccSet -> OccName
mkDataConWorkerOcc :: OccName -> OccName
mkSuperDictSelOcc :: Int -> OccName -> OccName
mkSuperDictAuxOcc :: Int -> OccName -> OccName
mkLocalOcc :: Unique -> OccName -> OccName
mkMethodOcc :: OccName -> OccName
-- | Derive a name for the representation type constructor of a
-- data/newtype instance.
mkInstTyTcOcc :: String -> OccSet -> OccName
mkInstTyCoOcc :: OccName -> OccName
mkEqPredCoOcc :: OccName -> OccName
mkVectOcc :: Maybe String -> OccName -> OccName
mkVectTyConOcc :: Maybe String -> OccName -> OccName
mkVectDataConOcc :: Maybe String -> OccName -> OccName
mkVectIsoOcc :: Maybe String -> OccName -> OccName
mkPDataTyConOcc :: Maybe String -> OccName -> OccName
mkPDataDataConOcc :: Maybe String -> OccName -> OccName
mkPDatasTyConOcc :: Maybe String -> OccName -> OccName
mkPDatasDataConOcc :: Maybe String -> OccName -> OccName
mkPReprTyConOcc :: Maybe String -> OccName -> OccName
mkPADFunOcc :: Maybe String -> OccName -> OccName
mkRecFldSelOcc :: String -> OccName
mkTyConRepOcc :: OccName -> OccName
occNameFS :: OccName -> FastString
occNameString :: OccName -> String
occNameSpace :: OccName -> NameSpace
isVarOcc :: OccName -> Bool
isTvOcc :: OccName -> Bool
isTcOcc :: OccName -> Bool
isDataOcc :: OccName -> Bool
-- | Test if the OccName is a data constructor that starts with a
-- symbol (e.g. :, or [])
isDataSymOcc :: OccName -> Bool
-- | Test if the OccName is that for any operator (whether it is a
-- data constructor or variable or whatever)
isSymOcc :: OccName -> Bool
-- | Value OccNamess are those that are either in the
-- variable or data constructor namespaces
isValOcc :: OccName -> Bool
-- | Wrap parens around an operator
parenSymOcc :: OccName -> SDoc -> SDoc
-- | Haskell 98 encourages compilers to suppress warnings about unsed names
-- in a pattern if they start with _: this implements that test
startsWithUnderscore :: OccName -> Bool
isTcClsNameSpace :: NameSpace -> Bool
isTvNameSpace :: NameSpace -> Bool
isDataConNameSpace :: NameSpace -> Bool
isVarNameSpace :: NameSpace -> Bool
isValNameSpace :: NameSpace -> Bool
data OccEnv a
emptyOccEnv :: OccEnv a
unitOccEnv :: OccName -> a -> OccEnv a
extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a
mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
lookupOccEnv :: OccEnv a -> OccName -> Maybe a
mkOccEnv :: [(OccName, a)] -> OccEnv a
mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a
extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a
elemOccEnv :: OccName -> OccEnv a -> Bool
occEnvElts :: OccEnv a -> [a]
foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a
plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a
extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a
extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt
delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt
pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc
type OccSet = UniqSet OccName
emptyOccSet :: OccSet
unitOccSet :: OccName -> OccSet
mkOccSet :: [OccName] -> OccSet
extendOccSet :: OccSet -> OccName -> OccSet
extendOccSetList :: OccSet -> [OccName] -> OccSet
unionOccSets :: OccSet -> OccSet -> OccSet
unionManyOccSets :: [OccSet] -> OccSet
minusOccSet :: OccSet -> OccSet -> OccSet
elemOccSet :: OccName -> OccSet -> Bool
isEmptyOccSet :: OccSet -> Bool
intersectOccSet :: OccSet -> OccSet -> OccSet
intersectsOccSet :: OccSet -> OccSet -> Bool
filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet
type TidyOccEnv = UniqFM Int
emptyTidyOccEnv :: TidyOccEnv
initTidyOccEnv :: [OccName] -> TidyOccEnv
tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
tidyOccNames :: TidyOccEnv -> [OccName] -> (TidyOccEnv, [OccName])
avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
-- | A non-deterministic set of FastStrings. See Note [Deterministic
-- UniqFM] in UniqDFM for explanation why it's not deterministic and why
-- it matters. Use DFastStringEnv if the set eventually gets converted
-- into a list or folded over in a way where the order changes the
-- generated code.
type FastStringEnv a = UniqFM a
emptyFsEnv :: FastStringEnv a
lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
mkFsEnv :: [(FastString, a)] -> FastStringEnv a
instance Data.Data.Data a => Data.Data.Data (OccName.OccEnv a)
instance GHC.Classes.Ord OccName.NameSpace
instance GHC.Classes.Eq OccName.NameSpace
instance Outputable.Outputable a => Outputable.Outputable (OccName.OccEnv a)
instance OccName.HasOccName OccName.OccName
instance GHC.Classes.Eq OccName.OccName
instance GHC.Classes.Ord OccName.OccName
instance Data.Data.Data OccName.OccName
instance Control.DeepSeq.NFData OccName.OccName
instance Outputable.Outputable OccName.OccName
instance Outputable.OutputableBndr OccName.OccName
instance Unique.Uniquable OccName.OccName
instance Binary.Binary OccName.OccName
instance Binary.Binary OccName.NameSpace
-- | GHC uses several kinds of name internally:
--
--
--
-- Names are one of:
--
--
-- - External, if they name things declared in other modules. Some
-- external Names are wired in, i.e. they name primitives defined in the
-- compiler itself
-- - Internal, if they name things in the module being compiled. Some
-- internal Names are system names, if they are names manufactured by the
-- compiler
--
module Name
-- | A unique, unambiguous name for something, containing information about
-- where that thing originated.
data Name
-- | BuiltInSyntax is for things like (:), [] and tuples,
-- which have special syntactic forms. They aren't in scope as such.
data BuiltInSyntax
BuiltInSyntax :: BuiltInSyntax
UserSyntax :: BuiltInSyntax
-- | Create a name brought into being by the compiler
mkSystemName :: Unique -> OccName -> Name
mkSystemNameAt :: Unique -> OccName -> SrcSpan -> Name
-- | Create a name which is (for now at least) local to the current module
-- and hence does not need a Module to disambiguate it from other
-- Names
mkInternalName :: Unique -> OccName -> SrcSpan -> Name
mkClonedInternalName :: Unique -> Name -> Name
mkDerivedInternalName :: (OccName -> OccName) -> Unique -> Name -> Name
mkSystemVarName :: Unique -> FastString -> Name
mkSysTvName :: Unique -> FastString -> Name
-- | Make a name for a foreign call
mkFCallName :: Unique -> String -> Name
-- | Create a name which definitely originates in the given module
mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name
-- | Create a name which is actually defined by the compiler itself
mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name
nameUnique :: Name -> Unique
setNameUnique :: Name -> Unique -> Name
nameOccName :: Name -> OccName
nameModule :: Name -> Module
nameModule_maybe :: Name -> Maybe Module
setNameLoc :: Name -> SrcSpan -> Name
tidyNameOcc :: Name -> OccName -> Name
-- | Make the Name into an internal name, regardless of what it was
-- to begin with
localiseName :: Name -> Name
-- | Create a localised variant of a name.
--
-- If the name is external, encode the original's module name to
-- disambiguate. SPJ says: this looks like a rather odd-looking function;
-- but it seems to be used only during vectorisation, so I'm not going to
-- worry
mkLocalisedOccName :: Module -> (Maybe String -> OccName -> OccName) -> Name -> OccName
nameSrcLoc :: Name -> SrcLoc
nameSrcSpan :: Name -> SrcSpan
pprNameDefnLoc :: Name -> SDoc
pprDefinedAt :: Name -> SDoc
isSystemName :: Name -> Bool
isInternalName :: Name -> Bool
isExternalName :: Name -> Bool
isTyVarName :: Name -> Bool
isTyConName :: Name -> Bool
isDataConName :: Name -> Bool
isValName :: Name -> Bool
isVarName :: Name -> Bool
isWiredInName :: Name -> Bool
isBuiltInSyntax :: Name -> Bool
isHoleName :: Name -> Bool
wiredInNameTyThing_maybe :: Name -> Maybe TyThing
-- | Returns True if the name is (a) Internal (b) External but from the
-- specified module (c) External but from the interactive
-- package
--
-- The key idea is that False means: the entity is defined in some other
-- module you can find the details (type, fixity, instances) in some
-- interface file those details will be stored in the EPT or HPT
--
-- True means: the entity is defined in this module or earlier in the
-- GHCi session you can find details (type, fixity, instances) in the
-- TcGblEnv or TcLclEnv
--
-- The isInteractiveModule part is because successive interactions of a
-- GCHi session each give rise to a fresh module (Ghci1, Ghci2, etc), but
-- they all come from the magic interactive package; and all the
-- details are kept in the TcLclEnv, TcGblEnv, NOT in the HPT or EPT. See
-- Note [The interactive package] in HscTypes
nameIsLocalOrFrom :: Module -> Name -> Bool
nameIsHomePackage :: Module -> Name -> Bool
nameIsHomePackageImport :: Module -> Name -> Bool
-- | Returns True if the Name comes from some other package: neither this
-- pacakge nor the interactive package.
nameIsFromExternalPackage :: UnitId -> Name -> Bool
-- | Compare Names lexicographically This only works for Names that
-- originate in the source code or have been tidied.
stableNameCmp :: Name -> Name -> Ordering
-- | A class allowing convenient access to the Name of various
-- datatypes
class NamedThing a
getOccName :: NamedThing a => a -> OccName
getName :: NamedThing a => a -> Name
getSrcLoc :: NamedThing a => a -> SrcLoc
getSrcSpan :: NamedThing a => a -> SrcSpan
getOccString :: NamedThing a => a -> String
getOccFS :: NamedThing a => a -> FastString
pprInfixName :: (Outputable a, NamedThing a) => a -> SDoc
pprPrefixName :: NamedThing a => a -> SDoc
pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc
-- | Get a string representation of a Name that's unique and stable
-- across recompilations. Used for deterministic generation of binds for
-- derived instances. eg.
-- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String"
nameStableString :: Name -> String
instance Name.NamedThing Name.Name
instance Name.NamedThing e => Name.NamedThing (SrcLoc.GenLocated l e)
instance Outputable.Outputable Name.NameSort
instance Control.DeepSeq.NFData Name.Name
instance Control.DeepSeq.NFData Name.NameSort
instance OccName.HasOccName Name.Name
instance GHC.Classes.Eq Name.Name
instance GHC.Classes.Ord Name.Name
instance Unique.Uniquable Name.Name
instance Data.Data.Data Name.Name
instance Binary.Binary Name.Name
instance Outputable.Outputable Name.Name
instance Outputable.OutputableBndr Name.Name
module NameSet
type NameSet = UniqSet Name
emptyNameSet :: NameSet
unitNameSet :: Name -> NameSet
mkNameSet :: [Name] -> NameSet
unionNameSet :: NameSet -> NameSet -> NameSet
unionNameSets :: [NameSet] -> NameSet
minusNameSet :: NameSet -> NameSet -> NameSet
elemNameSet :: Name -> NameSet -> Bool
extendNameSet :: NameSet -> Name -> NameSet
extendNameSetList :: NameSet -> [Name] -> NameSet
delFromNameSet :: NameSet -> Name -> NameSet
delListFromNameSet :: NameSet -> [Name] -> NameSet
isEmptyNameSet :: NameSet -> Bool
filterNameSet :: (Name -> Bool) -> NameSet -> NameSet
-- | True if there is a non-empty intersection. s1
-- intersectsNameSet s2 doesn't compute s2 if
-- s1 is empty
intersectsNameSet :: NameSet -> NameSet -> Bool
intersectNameSet :: NameSet -> NameSet -> NameSet
nameSetAny :: (Name -> Bool) -> NameSet -> Bool
nameSetAll :: (Name -> Bool) -> NameSet -> Bool
-- | Get the elements of a NameSet with some stable ordering. This only
-- works for Names that originate in the source code or have been tidied.
-- See Note [Deterministic UniqFM] to learn about nondeterminism
nameSetElemsStable :: NameSet -> [Name]
type FreeVars = NameSet
isEmptyFVs :: NameSet -> Bool
emptyFVs :: FreeVars
plusFVs :: [FreeVars] -> FreeVars
plusFV :: FreeVars -> FreeVars -> FreeVars
mkFVs :: [Name] -> FreeVars
addOneFV :: FreeVars -> Name -> FreeVars
unitFV :: Name -> FreeVars
delFV :: Name -> FreeVars -> FreeVars
delFVs :: [Name] -> FreeVars -> FreeVars
intersectFVs :: FreeVars -> FreeVars -> FreeVars
-- | A set of names that are defined somewhere
type Defs = NameSet
-- | A set of names that are used somewhere
type Uses = NameSet
-- | (Just ds, us) => The use of any member of the ds
-- implies that all the us are used too. Also, us may
-- mention ds.
--
-- Nothing => Nothing is defined in this group, but
-- nevertheless all the uses are essential. Used for instance
-- declarations, for example
type DefUse = (Maybe Defs, Uses)
-- | A number of DefUses in dependency order: earlier Defs
-- scope over later Uses In a single (def, use) pair, the defs
-- also scope over the uses
type DefUses = [DefUse]
emptyDUs :: DefUses
usesOnly :: Uses -> DefUses
mkDUs :: [(Defs, Uses)] -> DefUses
plusDU :: DefUses -> DefUses -> DefUses
-- | Given some DefUses and some Uses, find all the uses,
-- transitively. The result is a superset of the input Uses; and
-- includes things defined in the input DefUses (but only if they
-- are used)
findUses :: DefUses -> Uses -> Uses
duDefs :: DefUses -> Defs
-- | Collect all Uses, regardless of whether the group is itself
-- used, but remove Defs on the way
duUses :: DefUses -> Uses
-- | Just like duUses, but Defs are not eliminated from the
-- Uses returned
allUses :: DefUses -> Uses
module NameEnv
-- | Name Environment
type NameEnv a = UniqFM a
mkNameEnv :: [(Name, a)] -> NameEnv a
emptyNameEnv :: NameEnv a
isEmptyNameEnv :: NameEnv a -> Bool
unitNameEnv :: Name -> a -> NameEnv a
nameEnvElts :: NameEnv a -> [a]
extendNameEnv_C :: (a -> a -> a) -> NameEnv a -> Name -> a -> NameEnv a
extendNameEnv_Acc :: (a -> b -> b) -> (a -> b) -> NameEnv b -> Name -> a -> NameEnv b
extendNameEnv :: NameEnv a -> Name -> a -> NameEnv a
extendNameEnvList :: NameEnv a -> [(Name, a)] -> NameEnv a
extendNameEnvList_C :: (a -> a -> a) -> NameEnv a -> [(Name, a)] -> NameEnv a
filterNameEnv :: (elt -> Bool) -> NameEnv elt -> NameEnv elt
anyNameEnv :: (elt -> Bool) -> NameEnv elt -> Bool
plusNameEnv :: NameEnv a -> NameEnv a -> NameEnv a
plusNameEnv_C :: (a -> a -> a) -> NameEnv a -> NameEnv a -> NameEnv a
alterNameEnv :: (Maybe a -> Maybe a) -> NameEnv a -> Name -> NameEnv a
lookupNameEnv :: NameEnv a -> Name -> Maybe a
lookupNameEnv_NF :: NameEnv a -> Name -> a
delFromNameEnv :: NameEnv a -> Name -> NameEnv a
delListFromNameEnv :: NameEnv a -> [Name] -> NameEnv a
elemNameEnv :: Name -> NameEnv a -> Bool
mapNameEnv :: (elt1 -> elt2) -> NameEnv elt1 -> NameEnv elt2
disjointNameEnv :: NameEnv a -> NameEnv a -> Bool
-- | Deterministic Name Environment
--
-- See Note [Deterministic UniqFM] in UniqDFM for explanation why we need
-- DNameEnv.
type DNameEnv a = UniqDFM a
emptyDNameEnv :: DNameEnv a
lookupDNameEnv :: DNameEnv a -> Name -> Maybe a
mapDNameEnv :: (a -> b) -> DNameEnv a -> DNameEnv b
alterDNameEnv :: (Maybe a -> Maybe a) -> DNameEnv a -> Name -> DNameEnv a
depAnal :: (node -> [Name]) -> (node -> [Name]) -> [node] -> [SCC node]
module FieldLabel
-- | Field labels are just represented as strings; they are not necessarily
-- unique (even within a module)
type FieldLabelString = FastString
-- | A map from labels to all the auxiliary information
type FieldLabelEnv = DFastStringEnv FieldLabel
-- | Fields in an algebraic record type
data FieldLbl a
FieldLabel :: FieldLabelString -> Bool -> a -> FieldLbl a
-- | User-visible label of the field
[flLabel] :: FieldLbl a -> FieldLabelString
-- | Was DuplicateRecordFields on in the defining module for this datatype?
[flIsOverloaded] :: FieldLbl a -> Bool
-- | Record selector function
[flSelector] :: FieldLbl a -> a
type FieldLabel = FieldLbl Name
-- | Record selector OccNames are built from the underlying field name and
-- the name of the first data constructor of the type, to support
-- duplicate record field names. See Note [Why selector names include
-- data constructors].
mkFieldLabelOccs :: FieldLabelString -> OccName -> Bool -> FieldLbl OccName
instance Data.Traversable.Traversable FieldLabel.FieldLbl
instance Data.Foldable.Foldable FieldLabel.FieldLbl
instance GHC.Base.Functor FieldLabel.FieldLbl
instance GHC.Classes.Eq a => GHC.Classes.Eq (FieldLabel.FieldLbl a)
instance Data.Data.Data a => Data.Data.Data (FieldLabel.FieldLbl a)
instance Outputable.Outputable a => Outputable.Outputable (FieldLabel.FieldLbl a)
instance Binary.Binary a => Binary.Binary (FieldLabel.FieldLbl a)
module HsImpExp
-- | Located Import Declaration
type LImportDecl name = Located (ImportDecl name) When in a list this may have - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSemi'
-- | Import Declaration
--
-- A single Haskell import declaration.
data ImportDecl name
-- | AnnKeywordIds
--
--
ImportDecl :: SourceText -> Located ModuleName -> Maybe StringLiteral -> Bool -> Bool -> Bool -> Bool -> Maybe (Located ModuleName) -> Maybe (Bool, Located [LIE name]) -> ImportDecl name
[ideclSourceSrc] :: ImportDecl name -> SourceText
-- | Module name.
[ideclName] :: ImportDecl name -> Located ModuleName
-- | Package qualifier.
[ideclPkgQual] :: ImportDecl name -> Maybe StringLiteral
-- | True = {-# SOURCE #-} import
[ideclSource] :: ImportDecl name -> Bool
-- | True => safe import
[ideclSafe] :: ImportDecl name -> Bool
-- | True => qualified
[ideclQualified] :: ImportDecl name -> Bool
-- | True => implicit import (of Prelude)
[ideclImplicit] :: ImportDecl name -> Bool
-- | as Module
[ideclAs] :: ImportDecl name -> Maybe (Located ModuleName)
-- | (True => hiding, names)
[ideclHiding] :: ImportDecl name -> Maybe (Bool, Located [LIE name])
simpleImportDecl :: ModuleName -> ImportDecl name
-- | A name in an import or export specfication which may have adornments.
-- Used primarily for accurate pretty printing of ParsedSource, and API
-- Annotation placement.
data IEWrappedName name
-- | no extra
IEName :: (Located name) -> IEWrappedName name
-- | pattern X
IEPattern :: (Located name) -> IEWrappedName name
-- | type (:+:)
IEType :: (Located name) -> IEWrappedName name
-- | Located name with possible adornment - AnnKeywordIds :
-- AnnType, AnnPattern
type LIEWrappedName name = Located (IEWrappedName name)
-- | Located Import or Export
type LIE name = Located (IE name) When in a list this may have - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma'
-- | Imported or exported entity.
data IE name
-- | Imported or Exported Variable
IEVar :: (LIEWrappedName name) -> IE name
-- | Imported or exported Thing with Absent list
--
-- The thing is a Class/Type (can't tell) - AnnKeywordIds :
-- AnnPattern, AnnType,AnnVal
IEThingAbs :: (LIEWrappedName name) -> IE name
-- | Imported or exported Thing with All imported or exported
--
-- The thing is a ClassType and the All refers to
-- methodsconstructors
--
--
IEThingAll :: (LIEWrappedName name) -> IE name
-- | Imported or exported Thing With given imported or exported
--
-- The thing is a Class/Type and the imported or exported things are
-- methods/constructors and record fields; see Note [IEThingWith] -
-- AnnKeywordIds : AnnOpen, AnnClose,
-- AnnComma, AnnType
IEThingWith :: (LIEWrappedName name) -> IEWildcard -> [LIEWrappedName name] -> [Located (FieldLbl name)] -> IE name
-- | Imported or exported module contents
--
-- (Export Only)
--
--
IEModuleContents :: (Located ModuleName) -> IE name
-- | Doc section heading
IEGroup :: Int -> HsDocString -> IE name
-- | Some documentation
IEDoc :: HsDocString -> IE name
-- | Reference to named doc
IEDocNamed :: String -> IE name
-- | Imported or Exported Wildcard
data IEWildcard
NoIEWildcard :: IEWildcard
IEWildcard :: Int -> IEWildcard
ieName :: IE name -> name
ieNames :: IE a -> [a]
ieWrappedName :: IEWrappedName name -> name
ieLWrappedName :: LIEWrappedName name -> Located name
replaceWrappedName :: IEWrappedName name1 -> name2 -> IEWrappedName name2
replaceLWrappedName :: LIEWrappedName name1 -> name2 -> LIEWrappedName name2
pprImpExp :: (HasOccName name, OutputableBndr name) => name -> SDoc
instance Data.Data.Data name => Data.Data.Data (HsImpExp.ImportDecl name)
instance Data.Data.Data name => Data.Data.Data (HsImpExp.IE name)
instance GHC.Classes.Eq name => GHC.Classes.Eq (HsImpExp.IE name)
instance Data.Data.Data HsImpExp.IEWildcard
instance GHC.Classes.Eq HsImpExp.IEWildcard
instance Data.Data.Data name => Data.Data.Data (HsImpExp.IEWrappedName name)
instance GHC.Classes.Eq name => GHC.Classes.Eq (HsImpExp.IEWrappedName name)
instance (Outputable.OutputableBndr name, OccName.HasOccName name) => Outputable.Outputable (HsImpExp.ImportDecl name)
instance (OccName.HasOccName name, Outputable.OutputableBndr name) => Outputable.Outputable (HsImpExp.IE name)
instance OccName.HasOccName name => OccName.HasOccName (HsImpExp.IEWrappedName name)
instance (Outputable.OutputableBndr name, OccName.HasOccName name) => Outputable.OutputableBndr (HsImpExp.IEWrappedName name)
instance (OccName.HasOccName name, Outputable.OutputableBndr name) => Outputable.Outputable (HsImpExp.IEWrappedName name)
-- | Computing fingerprints of values serializeable with GHC's
-- Binary module.
module BinFingerprint
fingerprintBinMem :: BinHandle -> IO Fingerprint
computeFingerprint :: (Binary a) => (BinHandle -> Name -> IO ()) -> a -> IO Fingerprint
-- | Used when we want to fingerprint a structure without depending on the
-- fingerprints of external Names that it refers to.
putNameLiterally :: BinHandle -> Name -> IO ()
-- | Support for source code annotation feature of GHC. That is the ANN
-- pragma.
--
-- (c) The University of Glasgow 2006 (c) The GRASP/AQUA Project, Glasgow
-- University, 1992-1998
module Annotations
-- | Represents an annotation after it has been sufficiently desugared from
-- it's initial form of AnnDecl
data Annotation
Annotation :: CoreAnnTarget -> AnnPayload -> Annotation
-- | The target of the annotation
[ann_target] :: Annotation -> CoreAnnTarget
[ann_value] :: Annotation -> AnnPayload
type AnnPayload = Serialized The "payload" of an annotation allows recovery of its value at a given type, and can be persisted to an interface file
-- | An annotation target
data AnnTarget name
-- | We are annotating something with a name: a type or identifier
NamedTarget :: name -> AnnTarget name
-- | We are annotating a particular module
ModuleTarget :: Module -> AnnTarget name
-- | The kind of annotation target found in the middle end of the compiler
type CoreAnnTarget = AnnTarget Name
-- | Get the name of an annotation target if it exists.
getAnnTargetName_maybe :: AnnTarget name -> Maybe name
-- | A collection of annotations Can't use a type synonym or we hit bug
-- #2412 due to source import
data AnnEnv
-- | Construct a new annotation environment that contains the list of
-- annotations provided.
mkAnnEnv :: [Annotation] -> AnnEnv
-- | Add the given annotation to the environment.
extendAnnEnvList :: AnnEnv -> [Annotation] -> AnnEnv
-- | Union two annotation environments.
plusAnnEnv :: AnnEnv -> AnnEnv -> AnnEnv
-- | An empty annotation environment.
emptyAnnEnv :: AnnEnv
-- | Find the annotations attached to the given target as Typeable
-- values of your choice. If no deserializer is specified, only transient
-- annotations will be returned.
findAnns :: Typeable a => ([Word8] -> a) -> AnnEnv -> CoreAnnTarget -> [a]
-- | Find the annotations attached to the given target as Typeable
-- values of your choice. If no deserializer is specified, only transient
-- annotations will be returned.
findAnnsByTypeRep :: AnnEnv -> CoreAnnTarget -> TypeRep -> [[Word8]]
-- | Deserialize all annotations of a given type. This happens lazily, that
-- is no deserialization will take place until the [a] is actually
-- demanded and the [a] can also be empty (the UniqFM is not filtered).
deserializeAnns :: Typeable a => ([Word8] -> a) -> AnnEnv -> UniqFM [a]
instance Outputable.Outputable Annotations.Annotation
instance GHC.Base.Functor Annotations.AnnTarget
instance Unique.Uniquable name => Unique.Uniquable (Annotations.AnnTarget name)
instance Outputable.Outputable name => Outputable.Outputable (Annotations.AnnTarget name)
instance Binary.Binary name => Binary.Binary (Annotations.AnnTarget name)
module IOEnv
data IOEnv env a
failM :: IOEnv env a
failWithM :: String -> IOEnv env a
data IOEnvFailure
IOEnvFailure :: IOEnvFailure
getEnv :: IOEnv env env
-- | Perform a computation with a different environment
setEnv :: env' -> IOEnv env' a -> IOEnv env a
-- | Perform a computation with an altered environment
updEnv :: (env -> env') -> IOEnv env' a -> IOEnv env a
runIOEnv :: env -> IOEnv env a -> IO a
unsafeInterleaveM :: IOEnv env a -> IOEnv env a
uninterruptibleMaskM_ :: IOEnv env a -> IOEnv env a
tryM :: IOEnv env r -> IOEnv env (Either IOEnvFailure r)
tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r)
tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r)
fixM :: (a -> IOEnv env a) -> IOEnv env a
-- | A mutable variable in the IO monad
data IORef a :: * -> *
newMutVar :: a -> IOEnv env (IORef a)
readMutVar :: IORef a -> IOEnv env a
writeMutVar :: IORef a -> a -> IOEnv env ()
updMutVar :: IORef a -> (a -> a) -> IOEnv env ()
-- | Atomically update the reference. Does not force the evaluation of the
-- new variable contents. For strict update, use atomicUpdMutVar'.
atomicUpdMutVar :: IORef a -> (a -> (a, b)) -> IOEnv env b
-- | Strict variant of atomicUpdMutVar.
atomicUpdMutVar' :: IORef a -> (a -> (a, b)) -> IOEnv env b
instance GHC.Show.Show IOEnv.IOEnvFailure
instance GHC.Exception.Exception IOEnv.IOEnvFailure
instance GHC.Base.Monad (IOEnv.IOEnv m)
instance Control.Monad.Fail.MonadFail (IOEnv.IOEnv m)
instance GHC.Base.Applicative (IOEnv.IOEnv m)
instance GHC.Base.Functor (IOEnv.IOEnv m)
instance Exception.ExceptionMonad (IOEnv.IOEnv a)
instance DynFlags.ContainsDynFlags env => DynFlags.HasDynFlags (IOEnv.IOEnv env)
instance Module.ContainsModule env => Module.HasModule (IOEnv.IOEnv env)
instance GHC.Base.Alternative (IOEnv.IOEnv env)
instance GHC.Base.MonadPlus (IOEnv.IOEnv env)
instance Control.Monad.IO.Class.MonadIO (IOEnv.IOEnv env)
module ErrUtils
data Validity
-- | Everything is fine
IsValid :: Validity
-- | A problem, and some indication of why
NotValid :: MsgDoc -> Validity
andValid :: Validity -> Validity -> Validity
-- | If they aren't all valid, return the first
allValid :: [Validity] -> Validity
isValid :: Validity -> Bool
getInvalids :: [Validity] -> [MsgDoc]
data Severity
SevOutput :: Severity
SevFatal :: Severity
SevInteractive :: Severity
-- | Log messagse intended for compiler developers No filelinecolumn
-- stuff
SevDump :: Severity
-- | Log messages intended for end users. No filelinecolumn stuff.
SevInfo :: Severity
SevWarning :: Severity
-- | SevWarning and SevError are used for warnings and errors o The message
-- has a filelinecolumn heading, plus "warning:" or "error:",
-- added by mkLocMessags o Output is intended for end users
SevError :: Severity
data ErrMsg
errMsgDoc :: ErrMsg -> ErrDoc
-- | Categorise error msgs by their importance. This is so each section can
-- be rendered visually distinct. See Note [Error report] for where these
-- come from.
data ErrDoc
errDoc :: [MsgDoc] -> [MsgDoc] -> [MsgDoc] -> ErrDoc
-- | Primary error msg.
errDocImportant :: ErrDoc -> [MsgDoc]
-- | Context e.g. "In the second argument of ...".
errDocContext :: ErrDoc -> [MsgDoc]
-- | Supplementary information, e.g. "Relevant bindings include ...".
errDocSupplementary :: ErrDoc -> [MsgDoc]
type WarnMsg = ErrMsg
type MsgDoc = SDoc
type Messages = (WarningMessages, ErrorMessages)
type ErrorMessages = Bag ErrMsg
type WarningMessages = Bag WarnMsg
unionMessages :: Messages -> Messages -> Messages
errMsgSpan :: ErrMsg -> SrcSpan
errMsgContext :: ErrMsg -> PrintUnqualified
errorsFound :: DynFlags -> Messages -> Bool
isEmptyMessages :: Messages -> Bool
-- | Checks if given WarnMsg is a fatal warning.
isWarnMsgFatal :: DynFlags -> WarnMsg -> Bool
pprMessageBag :: Bag MsgDoc -> SDoc
pprErrMsgBagWithLoc :: Bag ErrMsg -> [SDoc]
pprLocErrMsg :: ErrMsg -> SDoc
printBagOfErrors :: DynFlags -> Bag ErrMsg -> IO ()
formatErrDoc :: DynFlags -> ErrDoc -> SDoc
emptyMessages :: Messages
-- | Make an unannotated error message with location info.
mkLocMessage :: Severity -> SrcSpan -> MsgDoc -> MsgDoc
-- | Make a possibly annotated error message with location info.
mkLocMessageAnn :: Maybe String -> Severity -> SrcSpan -> MsgDoc -> MsgDoc
makeIntoWarning :: WarnReason -> ErrMsg -> ErrMsg
-- | A short (one-line) error message
mkErrMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> ErrMsg
-- | Variant that doesn't care about qualified/unqualified names
mkPlainErrMsg :: DynFlags -> SrcSpan -> MsgDoc -> ErrMsg
mkErrDoc :: DynFlags -> SrcSpan -> PrintUnqualified -> ErrDoc -> ErrMsg
-- | A long (multi-line) error message
mkLongErrMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> MsgDoc -> ErrMsg
-- | A short (one-line) error message
mkWarnMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> ErrMsg
-- | Variant that doesn't care about qualified/unqualified names
mkPlainWarnMsg :: DynFlags -> SrcSpan -> MsgDoc -> ErrMsg
warnIsErrorMsg :: DynFlags -> ErrMsg
-- | A long (multi-line) error message
mkLongWarnMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> MsgDoc -> MsgDoc -> ErrMsg
doIfSet :: Bool -> IO () -> IO ()
doIfSet_dyn :: DynFlags -> GeneralFlag -> IO () -> IO ()
getCaretDiagnostic :: Severity -> SrcSpan -> IO MsgDoc
dumpIfSet :: DynFlags -> Bool -> String -> SDoc -> IO ()
-- | a wrapper around dumpSDoc. First check whether the dump flag is
-- set Do nothing if it is unset
dumpIfSet_dyn :: DynFlags -> DumpFlag -> String -> SDoc -> IO ()
-- | a wrapper around dumpSDoc. First check whether the dump flag is
-- set Do nothing if it is unset
--
-- Unlike dumpIfSet_dyn, has a printer argument but no header
-- argument
dumpIfSet_dyn_printer :: PrintUnqualified -> DynFlags -> DumpFlag -> SDoc -> IO ()
mkDumpDoc :: String -> SDoc -> SDoc
-- | Write out a dump. If --dump-to-file is set then this goes to a file.
-- otherwise emit to stdout.
--
-- When hdr is empty, we print in a more compact format (no
-- separators and blank lines)
--
-- The DumpFlag is used only to choose the filename to use if
-- --dump-to-file is used; it is not used to decide whether to
-- dump the output
dumpSDoc :: DynFlags -> PrintUnqualified -> DumpFlag -> String -> SDoc -> IO ()
putMsg :: DynFlags -> MsgDoc -> IO ()
printInfoForUser :: DynFlags -> PrintUnqualified -> MsgDoc -> IO ()
printOutputForUser :: DynFlags -> PrintUnqualified -> MsgDoc -> IO ()
logInfo :: DynFlags -> PprStyle -> MsgDoc -> IO ()
-- | Like logInfo but with SevOutput rather then
-- SevInfo
logOutput :: DynFlags -> PprStyle -> MsgDoc -> IO ()
errorMsg :: DynFlags -> MsgDoc -> IO ()
warningMsg :: DynFlags -> MsgDoc -> IO ()
fatalErrorMsg :: DynFlags -> MsgDoc -> IO ()
fatalErrorMsg'' :: FatalMessager -> String -> IO ()
compilationProgressMsg :: DynFlags -> String -> IO ()
showPass :: DynFlags -> String -> IO ()
-- | Time a compilation phase.
--
-- When timings are enabled (e.g. with the -v2 flag), the
-- allocations and CPU time used by the phase will be reported to stderr.
-- Consider a typical usage: withTiming getDynFlags (text "simplify")
-- force pass. When timings are enabled the following costs are
-- included in the produced accounting,
--
--
-- - The cost of executing pass to a result r in
-- WHNF
-- - The cost of evaluating force r to WHNF (e.g.
-- ())
--
--
-- The choice of the force function depends upon the amount of
-- forcing desired; the goal here is to ensure that the cost of
-- evaluating the result is, to the greatest extent possible, included in
-- the accounting provided by withTiming. Often the pass already
-- sufficiently forces its result during construction; in this case
-- const () is a reasonable choice. In other cases, it is
-- necessary to evaluate the result to normal form, in which case
-- something like Control.DeepSeq.rnf is appropriate.
--
-- To avoid adversely affecting compiler performance when timings are not
-- requested, the result is only forced when timings are enabled.
withTiming :: MonadIO m => m DynFlags -> SDoc -> (a -> ()) -> m a -> m a
debugTraceMsg :: DynFlags -> Int -> MsgDoc -> IO ()
ghcExit :: DynFlags -> Int -> IO ()
prettyPrintGhcErrors :: ExceptionMonad m => DynFlags -> m a -> m a
instance GHC.Show.Show ErrUtils.Severity
instance GHC.Show.Show ErrUtils.ErrMsg
instance Json.ToJson ErrUtils.Severity
-- | Package manipulation
module Packages
data PackageState
-- | UniqFM map from UnitId to PackageConfig, plus the
-- transitive closure of preload packages.
data PackageConfigMap
emptyPackageState :: PackageState
-- | Call this after parseDynFlags. It reads the package database
-- files, and sets up various internal tables of package information,
-- according to the package-related flags on the command-line
-- (-package, -hide-package etc.)
--
-- Returns a list of packages to link in if we're doing dynamic linking.
-- This list contains the packages that the user explicitly mentioned
-- with -package flags.
--
-- initPackages can be called again subsequently after updating
-- the packageFlags field of the DynFlags, and it will
-- update the pkgState in DynFlags and return a list of
-- packages to link in.
initPackages :: DynFlags -> IO (DynFlags, [PreloadUnitId])
readPackageConfigs :: DynFlags -> IO [(FilePath, [PackageConfig])]
getPackageConfRefs :: DynFlags -> IO [PkgConfRef]
resolvePackageConfig :: DynFlags -> PkgConfRef -> IO (Maybe FilePath)
readPackageConfig :: DynFlags -> FilePath -> IO (FilePath, [PackageConfig])
-- | Get a list of entries from the package database. NB: be careful with
-- this function, although all packages in this map are "visible", this
-- does not imply that the exposed-modules of the package are available
-- (they may have been thinned or renamed).
listPackageConfigMap :: DynFlags -> [PackageConfig]
-- | Find the package we know about with the given unit id, if any
lookupPackage :: DynFlags -> UnitId -> Maybe PackageConfig
-- | A more specialized interface, which takes a boolean specifying whether
-- or not to look for on-the-fly renamed interfaces, and just a
-- PackageConfigMap rather than a DynFlags (so it can be
-- used while we're initializing DynFlags
lookupPackage' :: Bool -> PackageConfigMap -> UnitId -> Maybe PackageConfig
lookupInstalledPackage :: DynFlags -> InstalledUnitId -> Maybe PackageConfig
-- | Find the package we know about with the given package name (e.g.
-- foo), if any (NB: there might be a locally defined unit name
-- which overrides this)
lookupPackageName :: DynFlags -> PackageName -> Maybe ComponentId
-- | Given a fully instantiated UnitId, improve it into a
-- InstalledUnitId if we can find it in the package database.
improveUnitId :: PackageConfigMap -> UnitId -> UnitId
-- | Search for packages with a given package ID (e.g. "foo-0.1")
searchPackageId :: DynFlags -> SourcePackageId -> [PackageConfig]
-- | Looks up the package with the given id in the package state, panicing
-- if it is not found
getPackageDetails :: DynFlags -> UnitId -> PackageConfig
getInstalledPackageDetails :: DynFlags -> InstalledUnitId -> PackageConfig
componentIdString :: DynFlags -> ComponentId -> Maybe String
displayInstalledUnitId :: DynFlags -> InstalledUnitId -> Maybe String
listVisibleModuleNames :: DynFlags -> [ModuleName]
-- | Takes a ModuleName, and if the module is in any package returns
-- list of modules which take that name.
lookupModuleInAllPackages :: DynFlags -> ModuleName -> [(Module, PackageConfig)]
lookupModuleWithSuggestions :: DynFlags -> ModuleName -> Maybe FastString -> LookupResult
lookupPluginModuleWithSuggestions :: DynFlags -> ModuleName -> Maybe FastString -> LookupResult
-- | The result of performing a lookup
data LookupResult
-- | Found the module uniquely, nothing else to do
LookupFound :: Module -> PackageConfig -> LookupResult
-- | Multiple modules with the same name in scope
LookupMultiple :: [(Module, ModuleOrigin)] -> LookupResult
-- | No modules found, but there were some hidden ones with an exact name
-- match. First is due to package hidden, second is due to module being
-- hidden
LookupHidden :: [(Module, ModuleOrigin)] -> [(Module, ModuleOrigin)] -> LookupResult
-- | Nothing found, here are some suggested different names
LookupNotFound :: [ModuleSuggestion] -> LookupResult
data ModuleSuggestion
SuggestVisible :: ModuleName -> Module -> ModuleOrigin -> ModuleSuggestion
SuggestHidden :: ModuleName -> Module -> ModuleOrigin -> ModuleSuggestion
-- | Package state is all stored in DynFlags, including the details
-- of all packages, which packages are exposed, and which modules they
-- provide.
--
-- The package state is computed by initPackages, and kept in
-- DynFlags. It is influenced by various package flags:
--
--
-- - -package pkg and -package-id pkg
-- cause pkg to become exposed. If
-- -hide-all-packages was not specified, these commands also
-- cause all other packages with the same name to become hidden.
-- - -hide-package pkg causes pkg to
-- become hidden.
-- - (there are a few more flags, check below for their semantics)
--
--
-- The package state has the following properties.
--
--
-- - Let exposedPackages be the set of packages thus exposed.
-- Let depExposedPackages be the transitive closure from
-- exposedPackages of their dependencies.
-- - When searching for a module from an preload import declaration,
-- only the exposed modules in exposedPackages are valid.
-- - When searching for a module from an implicit import, all modules
-- from depExposedPackages are valid.
-- - When linking in a compilation manager mode, we link in packages
-- the program depends on (the compiler knows this list by the time it
-- gets to the link step). Also, we link in all packages which were
-- mentioned with preload -package flags on the command-line, or
-- are a transitive dependency of same, or are "base"/"rts". The reason
-- for this is that we might need packages which don't contain any
-- Haskell modules, and therefore won't be discovered by the normal
-- mechanism of dependency tracking.
--
--
-- Given a module name, there may be multiple ways it came into scope,
-- possibly simultaneously. This data type tracks all the possible ways
-- it could have come into scope. Warning: don't use the record
-- functions, they're partial!
data ModuleOrigin
-- | Module is hidden, and thus never will be available for import. (But
-- maybe the user didn't realize), so we'll still keep track of these
-- modules.)
ModHidden :: ModuleOrigin
-- | Module is public, and could have come from some places.
ModOrigin :: Maybe Bool -> [PackageConfig] -> [PackageConfig] -> Bool -> ModuleOrigin
-- | Just False means that this module is in someone's
-- exported-modules list, but that package is hidden; Just
-- True means that it is available; Nothing means neither
-- applies.
[fromOrigPackage] :: ModuleOrigin -> Maybe Bool
-- | Is the module available from a reexport of an exposed package? There
-- could be multiple.
[fromExposedReexport] :: ModuleOrigin -> [PackageConfig]
-- | Is the module available from a reexport of a hidden package?
[fromHiddenReexport] :: ModuleOrigin -> [PackageConfig]
-- | Did the module export come from a package flag? (ToDo: track more
-- information.
[fromPackageFlag] :: ModuleOrigin -> Bool
-- | Find all the include directories in these and the preload packages
getPackageIncludePath :: DynFlags -> [PreloadUnitId] -> IO [String]
-- | Find all the library paths in these and the preload packages
getPackageLibraryPath :: DynFlags -> [PreloadUnitId] -> IO [String]
-- | Find all the link options in these and the preload packages, returning
-- (package hs lib options, extra library options, other flags)
getPackageLinkOpts :: DynFlags -> [PreloadUnitId] -> IO ([String], [String], [String])
-- | Find all the C-compiler options in these and the preload packages
getPackageExtraCcOpts :: DynFlags -> [PreloadUnitId] -> IO [String]
-- | Find all the package framework paths in these and the preload packages
getPackageFrameworkPath :: DynFlags -> [PreloadUnitId] -> IO [String]
-- | Find all the package frameworks in these and the preload packages
getPackageFrameworks :: DynFlags -> [PreloadUnitId] -> IO [String]
-- | Retrieve the PackageConfigMap from DynFlags; used in the
-- hs-boot loop-breaker.
getPackageConfigMap :: DynFlags -> PackageConfigMap
-- | Find all the PackageConfig in both the preload packages from
-- DynFlags and corresponding to the list of PackageConfigs
getPreloadPackagesAnd :: DynFlags -> [PreloadUnitId] -> IO [PackageConfig]
collectIncludeDirs :: [PackageConfig] -> [FilePath]
collectLibraryPaths :: DynFlags -> [PackageConfig] -> [FilePath]
collectLinkOpts :: DynFlags -> [PackageConfig] -> ([String], [String], [String])
packageHsLibs :: DynFlags -> PackageConfig -> [String]
-- | Given a wired-in UnitId, "unwire" it into the UnitId
-- that it was recorded as in the package database.
unwireUnitId :: DynFlags -> UnitId -> UnitId
pprFlag :: PackageFlag -> SDoc
-- | Show (very verbose) package info
pprPackages :: DynFlags -> SDoc
-- | Show simplified package info.
--
-- The idea is to only print package id, and any information that might
-- be different from the package databases (exposure, trust)
pprPackagesSimple :: DynFlags -> SDoc
-- | Show the mapping of modules to where they come from.
pprModuleMap :: ModuleToPkgConfAll -> SDoc
-- | Will the Name come from a dynamically linked library?
isDllName :: DynFlags -> Module -> Name -> Bool
instance Outputable.Outputable Packages.UnusablePackageReason
instance Outputable.Outputable Packages.UnitVisibility
instance GHC.Base.Monoid Packages.UnitVisibility
instance Outputable.Outputable Packages.ModuleOrigin
instance Data.Semigroup.Semigroup Packages.ModuleOrigin
instance GHC.Base.Monoid Packages.ModuleOrigin
-- | GHC LLVM Mangler
--
-- This script processes the assembly produced by LLVM, rewriting all
-- symbols of type function to object. This keeps them from
-- going through the PLT, which would be bad due to tables-next-to-code.
-- On x86_64, it also rewrites AVX instructions that require alignment to
-- their unaligned counterparts, since the stack is only 16-byte aligned
-- but these instructions require 32-byte alignment.
module LlvmMangler
-- | Read in assembly file and process
llvmFixupAsm :: DynFlags -> FilePath -> FilePath -> IO ()
module Elf
-- | Given a section name, read its contents as a ByteString.
--
-- If the section isn't found or if there is any parsing error, we return
-- Nothing
readElfSectionByName :: DynFlags -> ByteString -> String -> IO (Maybe ByteString)
-- | read a Note as a String
--
-- If you try to read a note from a section which does not support the
-- Note format, the parsing is likely to fail and Nothing will be
-- returned
readElfNoteAsString :: DynFlags -> FilePath -> String -> String -> IO (Maybe String)
-- | Generate the GAS code to create a Note section
--
-- Header fields for notes are 32-bit long (see Note [ELF
-- specification]).
--
-- It seems there is no easy way to force GNU AS to generate a 32-bit
-- word in every case. Hence we use .int directive to create them:
-- however "The byte order and bit size of the number depends on what
-- kind of target the assembly is for."
-- (https:/sourceware.orgbinutilsdocsas/Int.html#Int)
--
-- If we add new target platforms, we need to check that the generated
-- words are 32-bit long, otherwise we need to use platform specific
-- directives to force 32-bit .int in asWord32.
makeElfNote :: DynFlags -> String -> String -> Word32 -> String -> SDoc
module CmmType
data CmmType
b8 :: CmmType
b16 :: CmmType
b32 :: CmmType
b64 :: CmmType
b128 :: CmmType
b256 :: CmmType
b512 :: CmmType
f32 :: CmmType
f64 :: CmmType
bWord :: DynFlags -> CmmType
bHalfWord :: DynFlags -> CmmType
gcWord :: DynFlags -> CmmType
cInt :: DynFlags -> CmmType
cmmBits :: Width -> CmmType
cmmFloat :: Width -> CmmType
typeWidth :: CmmType -> Width
cmmEqType :: CmmType -> CmmType -> Bool
cmmEqType_ignoring_ptrhood :: CmmType -> CmmType -> Bool
isFloatType :: CmmType -> Bool
isGcPtrType :: CmmType -> Bool
isWord32 :: CmmType -> Bool
isWord64 :: CmmType -> Bool
isFloat64 :: CmmType -> Bool
isFloat32 :: CmmType -> Bool
data Width
W8 :: Width
W16 :: Width
W32 :: Width
W64 :: Width
W80 :: Width
W128 :: Width
W256 :: Width
W512 :: Width
widthInBits :: Width -> Int
widthInBytes :: Width -> Int
widthInLog :: Width -> Int
widthFromBytes :: Int -> Width
wordWidth :: DynFlags -> Width
halfWordWidth :: DynFlags -> Width
cIntWidth :: DynFlags -> Width
halfWordMask :: DynFlags -> Integer
narrowU :: Width -> Integer -> Integer
narrowS :: Width -> Integer -> Integer
rEP_CostCentreStack_mem_alloc :: DynFlags -> CmmType
rEP_CostCentreStack_scc_count :: DynFlags -> CmmType
rEP_StgEntCounter_allocs :: DynFlags -> CmmType
rEP_StgEntCounter_allocd :: DynFlags -> CmmType
data ForeignHint
NoHint :: ForeignHint
AddrHint :: ForeignHint
SignedHint :: ForeignHint
type Length = Int
vec :: Length -> CmmType -> CmmType
vec2 :: CmmType -> CmmType
vec4 :: CmmType -> CmmType
vec8 :: CmmType -> CmmType
vec16 :: CmmType -> CmmType
vec2f64 :: CmmType
vec2b64 :: CmmType
vec4f32 :: CmmType
vec4b32 :: CmmType
vec8b16 :: CmmType
vec16b8 :: CmmType
cmmVec :: Int -> CmmType -> CmmType
vecLength :: CmmType -> Length
vecElemType :: CmmType -> CmmType
isVecType :: CmmType -> Bool
instance GHC.Classes.Eq CmmType.ForeignHint
instance GHC.Classes.Eq CmmType.CmmCat
instance GHC.Show.Show CmmType.Width
instance GHC.Classes.Ord CmmType.Width
instance GHC.Classes.Eq CmmType.Width
instance Outputable.Outputable CmmType.CmmType
instance Outputable.Outputable CmmType.CmmCat
instance Outputable.Outputable CmmType.Width
module CmmSwitch
-- | A value of type SwitchTargets contains the alternatives for a
-- CmmSwitch value, and knows whether the value is signed, the
-- possible range, an optional default value and a map from values to
-- jump labels.
data SwitchTargets
-- | The smart constructr mkSwitchTargets normalises the map a bit: * No
-- entries outside the range * No entries equal to the default * No
-- default if all elements have explicit values
mkSwitchTargets :: Bool -> (Integer, Integer) -> Maybe Label -> Map Integer Label -> SwitchTargets
-- | Returns the list of non-default branches of the SwitchTargets value
switchTargetsCases :: SwitchTargets -> [(Integer, Label)]
-- | Return the default label of the SwitchTargets value
switchTargetsDefault :: SwitchTargets -> Maybe Label
-- | Return the range of the SwitchTargets value
switchTargetsRange :: SwitchTargets -> (Integer, Integer)
-- | Return whether this is used for a signed value
switchTargetsSigned :: SwitchTargets -> Bool
-- | Changes all labels mentioned in the SwitchTargets value
mapSwitchTargets :: (Label -> Label) -> SwitchTargets -> SwitchTargets
-- | switchTargetsToTable creates a dense jump table, usable for code
-- generation.
--
-- Also returns an offset to add to the value; the list is 0-based on the
-- result of that addition.
--
-- The conversion from Integer to Int is a bit of a wart, as the actual
-- scrutinee might be an unsigned word, but it just works, due to
-- wrap-around arithmetic (as verified by the CmmSwitchTest test case).
switchTargetsToTable :: SwitchTargets -> (Int, [Maybe Label])
-- | Groups cases with equal targets, suitable for pretty-printing to a
-- c-like switch statement with fall-through semantics.
switchTargetsFallThrough :: SwitchTargets -> ([([Integer], Label)], Maybe Label)
-- | The list of all labels occuring in the SwitchTargets value.
switchTargetsToList :: SwitchTargets -> [Label]
-- | Custom equality helper, needed for CmmCommonBlockElim
eqSwitchTargetWith :: (Label -> Label -> Bool) -> SwitchTargets -> SwitchTargets -> Bool
-- | A SwitchPlan abstractly describes how a Switch statement ought to be
-- implemented. See Note [createSwitchPlan]
data SwitchPlan
Unconditionally :: Label -> SwitchPlan
IfEqual :: Integer -> Label -> SwitchPlan -> SwitchPlan
IfLT :: Bool -> Integer -> SwitchPlan -> SwitchPlan -> SwitchPlan
JumpTable :: SwitchTargets -> SwitchPlan
-- | Does the target support switch out of the box? Then leave this to the
-- target!
targetSupportsSwitch :: HscTarget -> Bool
-- | This function creates a SwitchPlan from a SwitchTargets value,
-- breaking it down into smaller pieces suitable for code generation.
createSwitchPlan :: SwitchTargets -> SwitchPlan
instance GHC.Show.Show CmmSwitch.SwitchPlan
instance GHC.Classes.Eq CmmSwitch.SwitchTargets
instance GHC.Show.Show CmmSwitch.SwitchTargets
module CmmMachOp
-- | Machine-level primops; ones which we can reasonably delegate to the
-- native code generators to handle.
--
-- Most operations are parameterised by the Width that they
-- operate on. Some operations have separate signed and unsigned
-- versions, and float and integer versions.
data MachOp
MO_Add :: Width -> MachOp
MO_Sub :: Width -> MachOp
MO_Eq :: Width -> MachOp
MO_Ne :: Width -> MachOp
MO_Mul :: Width -> MachOp
MO_S_MulMayOflo :: Width -> MachOp
MO_S_Quot :: Width -> MachOp
MO_S_Rem :: Width -> MachOp
MO_S_Neg :: Width -> MachOp
MO_U_MulMayOflo :: Width -> MachOp
MO_U_Quot :: Width -> MachOp
MO_U_Rem :: Width -> MachOp
MO_S_Ge :: Width -> MachOp
MO_S_Le :: Width -> MachOp
MO_S_Gt :: Width -> MachOp
MO_S_Lt :: Width -> MachOp
MO_U_Ge :: Width -> MachOp
MO_U_Le :: Width -> MachOp
MO_U_Gt :: Width -> MachOp
MO_U_Lt :: Width -> MachOp
MO_F_Add :: Width -> MachOp
MO_F_Sub :: Width -> MachOp
MO_F_Neg :: Width -> MachOp
MO_F_Mul :: Width -> MachOp
MO_F_Quot :: Width -> MachOp
MO_F_Eq :: Width -> MachOp
MO_F_Ne :: Width -> MachOp
MO_F_Ge :: Width -> MachOp
MO_F_Le :: Width -> MachOp
MO_F_Gt :: Width -> MachOp
MO_F_Lt :: Width -> MachOp
MO_And :: Width -> MachOp
MO_Or :: Width -> MachOp
MO_Xor :: Width -> MachOp
MO_Not :: Width -> MachOp
MO_Shl :: Width -> MachOp
MO_U_Shr :: Width -> MachOp
MO_S_Shr :: Width -> MachOp
MO_SF_Conv :: Width -> Width -> MachOp
MO_FS_Conv :: Width -> Width -> MachOp
MO_SS_Conv :: Width -> Width -> MachOp
MO_UU_Conv :: Width -> Width -> MachOp
MO_FF_Conv :: Width -> Width -> MachOp
MO_V_Insert :: Length -> Width -> MachOp
MO_V_Extract :: Length -> Width -> MachOp
MO_V_Add :: Length -> Width -> MachOp
MO_V_Sub :: Length -> Width -> MachOp
MO_V_Mul :: Length -> Width -> MachOp
MO_VS_Quot :: Length -> Width -> MachOp
MO_VS_Rem :: Length -> Width -> MachOp
MO_VS_Neg :: Length -> Width -> MachOp
MO_VU_Quot :: Length -> Width -> MachOp
MO_VU_Rem :: Length -> Width -> MachOp
MO_VF_Insert :: Length -> Width -> MachOp
MO_VF_Extract :: Length -> Width -> MachOp
MO_VF_Add :: Length -> Width -> MachOp
MO_VF_Sub :: Length -> Width -> MachOp
MO_VF_Neg :: Length -> Width -> MachOp
MO_VF_Mul :: Length -> Width -> MachOp
MO_VF_Quot :: Length -> Width -> MachOp
pprMachOp :: MachOp -> SDoc
-- | Returns True if the MachOp has commutable arguments. This is
-- used in the platform-independent Cmm optimisations.
--
-- If in doubt, return False. This generates worse code on the
-- native routes, but is otherwise harmless.
isCommutableMachOp :: MachOp -> Bool
-- | Returns True if the MachOp is associative (i.e. (x+y)+z ==
-- x+(y+z)) This is used in the platform-independent Cmm
-- optimisations.
--
-- If in doubt, return False. This generates worse code on the
-- native routes, but is otherwise harmless.
isAssociativeMachOp :: MachOp -> Bool
-- | Returns True if the MachOp is a comparison.
--
-- If in doubt, return False. This generates worse code on the native
-- routes, but is otherwise harmless.
isComparisonMachOp :: MachOp -> Bool
-- | Returns Just w if the operation is an integer comparison with
-- width w, or Nothing otherwise.
maybeIntComparison :: MachOp -> Maybe Width
-- | Returns the MachRep of the result of a MachOp.
machOpResultType :: DynFlags -> MachOp -> [CmmType] -> CmmType
-- | This function is used for debugging only: we can check whether an
-- application of a MachOp is "type-correct" by checking that the
-- MachReps of its arguments are the same as the MachOp expects. This is
-- used when linting a CmmExpr.
machOpArgReps :: DynFlags -> MachOp -> [Width]
maybeInvertComparison :: MachOp -> Maybe MachOp
mo_wordAdd :: DynFlags -> MachOp
mo_wordSub :: DynFlags -> MachOp
mo_wordEq :: DynFlags -> MachOp
mo_wordNe :: DynFlags -> MachOp
mo_wordMul :: DynFlags -> MachOp
mo_wordSQuot :: DynFlags -> MachOp
mo_wordSRem :: DynFlags -> MachOp
mo_wordSNeg :: DynFlags -> MachOp
mo_wordUQuot :: DynFlags -> MachOp
mo_wordURem :: DynFlags -> MachOp
mo_wordSGe :: DynFlags -> MachOp
mo_wordSLe :: DynFlags -> MachOp
mo_wordSGt :: DynFlags -> MachOp
mo_wordSLt :: DynFlags -> MachOp
mo_wordUGe :: DynFlags -> MachOp
mo_wordULe :: DynFlags -> MachOp
mo_wordUGt :: DynFlags -> MachOp
mo_wordULt :: DynFlags -> MachOp
mo_wordAnd :: DynFlags -> MachOp
mo_wordOr :: DynFlags -> MachOp
mo_wordXor :: DynFlags -> MachOp
mo_wordNot :: DynFlags -> MachOp
mo_wordShl :: DynFlags -> MachOp
mo_wordSShr :: DynFlags -> MachOp
mo_wordUShr :: DynFlags -> MachOp
mo_u_8To32 :: MachOp
mo_s_8To32 :: MachOp
mo_u_16To32 :: MachOp
mo_s_16To32 :: MachOp
mo_u_8ToWord :: DynFlags -> MachOp
mo_s_8ToWord :: DynFlags -> MachOp
mo_u_16ToWord :: DynFlags -> MachOp
mo_s_16ToWord :: DynFlags -> MachOp
mo_u_32ToWord :: DynFlags -> MachOp
mo_s_32ToWord :: DynFlags -> MachOp
mo_32To8 :: MachOp
mo_32To16 :: MachOp
mo_WordTo8 :: DynFlags -> MachOp
mo_WordTo16 :: DynFlags -> MachOp
mo_WordTo32 :: DynFlags -> MachOp
mo_WordTo64 :: DynFlags -> MachOp
data CallishMachOp
MO_F64_Pwr :: CallishMachOp
MO_F64_Sin :: CallishMachOp
MO_F64_Cos :: CallishMachOp
MO_F64_Tan :: CallishMachOp
MO_F64_Sinh :: CallishMachOp
MO_F64_Cosh :: CallishMachOp
MO_F64_Tanh :: CallishMachOp
MO_F64_Asin :: CallishMachOp
MO_F64_Acos :: CallishMachOp
MO_F64_Atan :: CallishMachOp
MO_F64_Log :: CallishMachOp
MO_F64_Exp :: CallishMachOp
MO_F64_Fabs :: CallishMachOp
MO_F64_Sqrt :: CallishMachOp
MO_F32_Pwr :: CallishMachOp
MO_F32_Sin :: CallishMachOp
MO_F32_Cos :: CallishMachOp
MO_F32_Tan :: CallishMachOp
MO_F32_Sinh :: CallishMachOp
MO_F32_Cosh :: CallishMachOp
MO_F32_Tanh :: CallishMachOp
MO_F32_Asin :: CallishMachOp
MO_F32_Acos :: CallishMachOp
MO_F32_Atan :: CallishMachOp
MO_F32_Log :: CallishMachOp
MO_F32_Exp :: CallishMachOp
MO_F32_Fabs :: CallishMachOp
MO_F32_Sqrt :: CallishMachOp
MO_UF_Conv :: Width -> CallishMachOp
MO_S_QuotRem :: Width -> CallishMachOp
MO_U_QuotRem :: Width -> CallishMachOp
MO_U_QuotRem2 :: Width -> CallishMachOp
MO_Add2 :: Width -> CallishMachOp
MO_SubWordC :: Width -> CallishMachOp
MO_AddIntC :: Width -> CallishMachOp
MO_SubIntC :: Width -> CallishMachOp
MO_U_Mul2 :: Width -> CallishMachOp
MO_WriteBarrier :: CallishMachOp
MO_Touch :: CallishMachOp
MO_Prefetch_Data :: Int -> CallishMachOp
MO_Memcpy :: Int -> CallishMachOp
MO_Memset :: Int -> CallishMachOp
MO_Memmove :: Int -> CallishMachOp
MO_PopCnt :: Width -> CallishMachOp
MO_Clz :: Width -> CallishMachOp
MO_Ctz :: Width -> CallishMachOp
MO_BSwap :: Width -> CallishMachOp
MO_AtomicRMW :: Width -> AtomicMachOp -> CallishMachOp
MO_AtomicRead :: Width -> CallishMachOp
MO_AtomicWrite :: Width -> CallishMachOp
MO_Cmpxchg :: Width -> CallishMachOp
callishMachOpHints :: CallishMachOp -> ([ForeignHint], [ForeignHint])
pprCallishMachOp :: CallishMachOp -> SDoc
-- | The alignment of a memcpy-ish operation.
machOpMemcpyishAlign :: CallishMachOp -> Maybe Int
-- | The operation to perform atomically.
data AtomicMachOp
AMO_Add :: AtomicMachOp
AMO_Sub :: AtomicMachOp
AMO_And :: AtomicMachOp
AMO_Nand :: AtomicMachOp
AMO_Or :: AtomicMachOp
AMO_Xor :: AtomicMachOp
instance GHC.Show.Show CmmMachOp.CallishMachOp
instance GHC.Classes.Eq CmmMachOp.CallishMachOp
instance GHC.Show.Show CmmMachOp.AtomicMachOp
instance GHC.Classes.Eq CmmMachOp.AtomicMachOp
instance GHC.Show.Show CmmMachOp.MachOp
instance GHC.Classes.Eq CmmMachOp.MachOp
-- | Generating C symbol names emitted by the compiler.
module CPrim
atomicReadLabel :: Width -> String
atomicWriteLabel :: Width -> String
atomicRMWLabel :: Width -> AtomicMachOp -> String
cmpxchgLabel :: Width -> String
popCntLabel :: Width -> String
bSwapLabel :: Width -> String
clzLabel :: Width -> String
ctzLabel :: Width -> String
word2FloatLabel :: Width -> String
module Bitmap
-- | A bitmap represented by a sequence of StgWords on the
-- target architecture. These are used for bitmaps in info tables
-- and other generated code which need to be emitted as sequences of
-- StgWords.
type Bitmap = [StgWord]
-- | Make a bitmap from a sequence of bits
mkBitmap :: DynFlags -> [Bool] -> Bitmap
-- | Make a bitmap where the slots specified are the ones in the
-- bitmap. eg. [0,1,3], size 4 ==> 0xb.
--
-- The list of Ints must be already sorted.
intsToBitmap :: DynFlags -> Int -> [Int] -> Bitmap
-- | Make a bitmap where the slots specified are the zeros in the
-- bitmap. eg. [0,1,3], size 4 ==> 0x4 (we leave any bits
-- outside the size as zero, just to make the bitmap easier to read).
--
-- The list of Ints must be already sorted and
-- duplicate-free.
intsToReverseBitmap :: DynFlags -> Int -> [Int] -> Bitmap
-- | Magic number, must agree with BITMAP_BITS_SHIFT in
-- InfoTables.h. Some kinds of bitmap pack a size/bitmap into a single
-- word if possible, or fall back to an external pointer when the bitmap
-- is too large. This value represents the largest size of bitmap that
-- can be packed into a single word.
mAX_SMALL_BITMAP_SIZE :: DynFlags -> Int
seqBitmap :: Bitmap -> a -> a
module Avail
-- | A collection of AvailInfo - several things that are "available"
type Avails = [AvailInfo]
-- | Records what things are "available", i.e. in scope
data AvailInfo
-- | An ordinary identifier in scope
Avail :: Name -> AvailInfo
-- | A type or class in scope. Parameters:
--
-- 1) The name of the type or class 2) The available pieces of type or
-- class, excluding field selectors. 3) The record fields of the type
-- (see Note [Representing fields in AvailInfo]).
--
-- The AvailTC Invariant: * If the type or class is itself to be in
-- scope, it must be *first* in this list. Thus, typically: AvailTC
-- Eq [Eq, ==, /=]
AvailTC :: Name -> [Name] -> [FieldLabel] -> AvailInfo
avail :: Name -> AvailInfo
availsToNameSet :: [AvailInfo] -> NameSet
availsToNameSetWithSelectors :: [AvailInfo] -> NameSet
availsToNameEnv :: [AvailInfo] -> NameEnv AvailInfo
-- | Just the main name made available, i.e. not the available pieces of
-- type or class brought into scope by the GenAvailInfo
availName :: AvailInfo -> Name
-- | All names made available by the availability information (excluding
-- overloaded selectors)
availNames :: AvailInfo -> [Name]
-- | Names for non-fields made available by the availability information
availNonFldNames :: AvailInfo -> [Name]
-- | All names made available by the availability information (including
-- overloaded selectors)
availNamesWithSelectors :: AvailInfo -> [Name]
-- | Fields made available by the availability information
availFlds :: AvailInfo -> [FieldLabel]
-- | Compare lexicographically
stableAvailCmp :: AvailInfo -> AvailInfo -> Ordering
plusAvail :: AvailInfo -> AvailInfo -> AvailInfo
-- | trims an AvailInfo to keep only a single name
trimAvail :: AvailInfo -> Name -> AvailInfo
-- | filters an AvailInfo by the given predicate
filterAvail :: (Name -> Bool) -> AvailInfo -> [AvailInfo] -> [AvailInfo]
-- | filters AvailInfos by the given predicate
filterAvails :: (Name -> Bool) -> [AvailInfo] -> [AvailInfo]
-- | Combines AvailInfos from the same family avails may
-- have several items with the same availName E.g import Ix( Ix(..),
-- index ) will give Ix(Ix,index,range) and Ix(index) We want to combine
-- these; addAvail does that
nubAvails :: [AvailInfo] -> [AvailInfo]
instance GHC.Classes.Eq Avail.AvailInfo
instance Outputable.Outputable Avail.AvailInfo
instance Binary.Binary Avail.AvailInfo
-- | GHC uses several kinds of name internally:
--
--
module RdrName
-- | Reader Name
--
-- Do not use the data constructors of RdrName directly: prefer the
-- family of functions that creates them, such as mkRdrUnqual
--
--
-- - Note: A Located RdrName will only have API Annotations if it is a
-- compound one, e.g.
--
--
--
-- `bar`
-- ( ~ )
--
--
--
data RdrName
-- | Unqualified name
--
-- Used for ordinary, unqualified occurrences, e.g. x,
-- y or Foo. Create such a RdrName with
-- mkRdrUnqual
Unqual :: OccName -> RdrName
-- | Qualified name
--
-- A qualified name written by the user in source code. The module
-- isn't necessarily the module where the thing is defined; just the one
-- from which it is imported. Examples are Bar.x, Bar.y
-- or Bar.Foo. Create such a RdrName with
-- mkRdrQual
Qual :: ModuleName -> OccName -> RdrName
-- | Original name
--
-- An original name; the module is the defining module. This is
-- used when GHC generates code that will be fed into the renamer (e.g.
-- from deriving clauses), but where we want to say "Use Prelude.map
-- dammit". One of these can be created with mkOrig
Orig :: Module -> OccName -> RdrName
-- | Exact name
--
-- We know exactly the Name. This is used:
--
--
-- - When the parser parses built-in syntax like [] and
-- (,), but wants a RdrName from it
-- - By Template Haskell, when TH has generated a unique name
--
--
-- Such a RdrName can be created by using getRdrName on a
-- Name
Exact :: Name -> RdrName
mkRdrUnqual :: OccName -> RdrName
mkRdrQual :: ModuleName -> OccName -> RdrName
mkUnqual :: NameSpace -> FastString -> RdrName
mkVarUnqual :: FastString -> RdrName
-- | Make a qualified RdrName in the given namespace and where the
-- ModuleName and the OccName are taken from the first and
-- second elements of the tuple respectively
mkQual :: NameSpace -> (FastString, FastString) -> RdrName
mkOrig :: Module -> OccName -> RdrName
nameRdrName :: Name -> RdrName
getRdrName :: NamedThing thing => thing -> RdrName
rdrNameOcc :: RdrName -> OccName
rdrNameSpace :: RdrName -> NameSpace
demoteRdrName :: RdrName -> Maybe RdrName
isRdrDataCon :: RdrName -> Bool
isRdrTyVar :: RdrName -> Bool
isRdrTc :: RdrName -> Bool
isQual :: RdrName -> Bool
isQual_maybe :: RdrName -> Maybe (ModuleName, OccName)
isUnqual :: RdrName -> Bool
isOrig :: RdrName -> Bool
isOrig_maybe :: RdrName -> Maybe (Module, OccName)
isExact :: RdrName -> Bool
isExact_maybe :: RdrName -> Maybe Name
isSrcRdrName :: RdrName -> Bool
-- | Local Reader Environment
--
-- This environment is used to store local bindings (let,
-- where, lambda, case). It is keyed by OccName,
-- because we never use it for qualified names We keep the current
-- mapping, *and* the set of all Names in scope Reason: see Note
-- [Splicing Exact names] in RnEnv
data LocalRdrEnv
emptyLocalRdrEnv :: LocalRdrEnv
extendLocalRdrEnv :: LocalRdrEnv -> Name -> LocalRdrEnv
extendLocalRdrEnvList :: LocalRdrEnv -> [Name] -> LocalRdrEnv
lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name
lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name
elemLocalRdrEnv :: RdrName -> LocalRdrEnv -> Bool
inLocalRdrEnvScope :: Name -> LocalRdrEnv -> Bool
localRdrEnvElts :: LocalRdrEnv -> [Name]
delLocalRdrEnvList :: LocalRdrEnv -> [OccName] -> LocalRdrEnv
-- | Global Reader Environment
--
-- Keyed by OccName; when looking up a qualified name we look up
-- the OccName part, and then check the Provenance to see
-- if the appropriate qualification is valid. This saves routinely
-- doubling the size of the env by adding both qualified and unqualified
-- names to the domain.
--
-- The list in the codomain is required because there may be name clashes
-- These only get reported on lookup, not on construction
--
-- INVARIANT 1: All the members of the list have distinct gre_name
-- fields; that is, no duplicate Names
--
-- INVARIANT 2: Imported provenance => Name is an ExternalName However
-- LocalDefs can have an InternalName. This happens only when
-- type-checking a [d| ... |] Template Haskell quotation; see this note
-- in RnNames Note [Top-level Names in Template Haskell decl quotes]
--
-- INVARIANT 3: If the GlobalRdrEnv maps [occ -> gre], then greOccName
-- gre = occ
--
-- NB: greOccName gre is usually the same as nameOccName (gre_name gre),
-- but not always in the case of record seectors; see greOccName
type GlobalRdrEnv = OccEnv [GlobalRdrElt]
emptyGlobalRdrEnv :: GlobalRdrEnv
mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv
plusGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrEnv -> GlobalRdrEnv
lookupGlobalRdrEnv :: GlobalRdrEnv -> OccName -> [GlobalRdrElt]
extendGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrElt -> GlobalRdrEnv
greOccName :: GlobalRdrElt -> OccName
shadowNames :: GlobalRdrEnv -> [Name] -> GlobalRdrEnv
pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc
globalRdrEnvElts :: GlobalRdrEnv -> [GlobalRdrElt]
lookupGRE_RdrName :: RdrName -> GlobalRdrEnv -> [GlobalRdrElt]
-- | Look for precisely this Name in the environment. This tests
-- whether it is in scope, ignoring anything else that might be in scope
-- with the same OccName.
lookupGRE_Name :: GlobalRdrEnv -> Name -> Maybe GlobalRdrElt
-- | Look for a particular record field selector in the environment, where
-- the selector name and field label may be different: the GlobalRdrEnv
-- is keyed on the label. See Note [Parents for record fields] for why
-- this happens.
lookupGRE_FieldLabel :: GlobalRdrEnv -> FieldLabel -> Maybe GlobalRdrElt
getGRE_NameQualifier_maybes :: GlobalRdrEnv -> Name -> [Maybe [ModuleName]]
-- | Apply a transformation function to the GREs for these OccNames
transformGREs :: (GlobalRdrElt -> GlobalRdrElt) -> [OccName] -> GlobalRdrEnv -> GlobalRdrEnv
-- | Takes a list of GREs which have the right OccName x Pick
-- those GREs that are are in scope * Qualified, as x if want_qual
-- is Qual M _ * Unqualified, as x if want_unqual is Unqual _
--
-- Return each such GRE, with its ImportSpecs filtered, to reflect how it
-- is in scope qualified or unqualified respectively. See Note [GRE
-- filtering]
pickGREs :: RdrName -> [GlobalRdrElt] -> [GlobalRdrElt]
-- | Pick GREs that are in scope *both* qualified *and* unqualified Return
-- each GRE that is, as a pair (qual_gre, unqual_gre) These two GREs are
-- the original GRE with imports filtered to express how it is in scope
-- qualified an unqualified respectively
--
-- Used only for the 'module M' item in export list; see
-- RnNames.exports_from_avail
pickGREsModExp :: ModuleName -> [GlobalRdrElt] -> [(GlobalRdrElt, GlobalRdrElt)]
-- | make a GlobalRdrEnv where all the elements point to the same
-- Provenance (useful for "hiding" imports, or imports with no details).
gresFromAvails :: Maybe ImportSpec -> [AvailInfo] -> [GlobalRdrElt]
gresFromAvail :: (Name -> Maybe ImportSpec) -> AvailInfo -> [GlobalRdrElt]
localGREsFromAvail :: AvailInfo -> [GlobalRdrElt]
availFromGRE :: GlobalRdrElt -> AvailInfo
greUsedRdrName :: GlobalRdrElt -> RdrName
greRdrNames :: GlobalRdrElt -> [RdrName]
greSrcSpan :: GlobalRdrElt -> SrcSpan
greQualModName :: GlobalRdrElt -> ModuleName
-- | Takes a list of distinct GREs and folds them into AvailInfos. This is
-- more efficient than mapping each individual GRE to an AvailInfo and
-- the folding using plusAvail but needs the uniqueness
-- assumption.
gresToAvailInfo :: [GlobalRdrElt] -> [AvailInfo]
-- | Global Reader Element
--
-- An element of the GlobalRdrEnv
data GlobalRdrElt
GRE :: Name -> Parent -> Bool -> [ImportSpec] -> GlobalRdrElt
[gre_name] :: GlobalRdrElt -> Name
[gre_par] :: GlobalRdrElt -> Parent
-- | True = the thing was defined locally
[gre_lcl] :: GlobalRdrElt -> Bool
-- | In scope through these imports
[gre_imp] :: GlobalRdrElt -> [ImportSpec]
isLocalGRE :: GlobalRdrElt -> Bool
isRecFldGRE :: GlobalRdrElt -> Bool
greLabel :: GlobalRdrElt -> Maybe FieldLabelString
-- | Test if an unqualified version of this thing would be in scope
unQualOK :: GlobalRdrElt -> Bool
-- | Is in scope qualified with the given module?
qualSpecOK :: ModuleName -> ImportSpec -> Bool
-- | Is in scope unqualified?
unQualSpecOK :: ImportSpec -> Bool
-- | Print out one place where the name was define/imported (With
-- -dppr-debug, print them all)
pprNameProvenance :: GlobalRdrElt -> SDoc
-- | The children of a Name are the things that are abbreviated by the ".."
-- notation in export lists. See Note [Parents]
data Parent
NoParent :: Parent
ParentIs :: Name -> Parent
[par_is] :: Parent -> Name
-- | See Note [Parents for record fields]
FldParent :: Name -> Maybe FieldLabelString -> Parent
[par_is] :: Parent -> Name
[par_lbl] :: Parent -> Maybe FieldLabelString
-- | Import Specification
--
-- The ImportSpec of something says how it came to be imported
-- It's quite elaborate so that we can give accurate unused-name
-- warnings.
data ImportSpec
ImpSpec :: ImpDeclSpec -> ImpItemSpec -> ImportSpec
[is_decl] :: ImportSpec -> ImpDeclSpec
[is_item] :: ImportSpec -> ImpItemSpec
-- | Import Declaration Specification
--
-- Describes a particular import declaration and is shared among all the
-- Provenances for that decl
data ImpDeclSpec
ImpDeclSpec :: ModuleName -> ModuleName -> Bool -> SrcSpan -> ImpDeclSpec
-- | Module imported, e.g. import Muggle Note the Muggle
-- may well not be the defining module for this thing!
[is_mod] :: ImpDeclSpec -> ModuleName
-- | Import alias, e.g. from as M (or Muggle if there is
-- no as clause)
[is_as] :: ImpDeclSpec -> ModuleName
-- | Was this import qualified?
[is_qual] :: ImpDeclSpec -> Bool
-- | The location of the entire import declaration
[is_dloc] :: ImpDeclSpec -> SrcSpan
-- | Import Item Specification
--
-- Describes import info a particular Name
data ImpItemSpec
-- | The import had no import list, or had a hiding list
ImpAll :: ImpItemSpec
-- | The import had an import list. The is_explicit field is
-- True iff the thing was named explicitly in the import
-- specs rather than being imported as part of a "..." group. Consider:
--
--
-- import C( T(..) )
--
--
-- Here the constructors of T are not named explicitly; only
-- T is named explicitly.
ImpSome :: Bool -> SrcSpan -> ImpItemSpec
[is_explicit] :: ImpItemSpec -> Bool
[is_iloc] :: ImpItemSpec -> SrcSpan
importSpecLoc :: ImportSpec -> SrcSpan
importSpecModule :: ImportSpec -> ModuleName
isExplicitItem :: ImpItemSpec -> Bool
bestImport :: [ImportSpec] -> ImportSpec
instance GHC.Classes.Eq RdrName.GlobalRdrElt
instance Data.Data.Data RdrName.GlobalRdrElt
instance Data.Data.Data RdrName.ImportSpec
instance GHC.Classes.Ord RdrName.ImportSpec
instance GHC.Classes.Eq RdrName.ImportSpec
instance Data.Data.Data RdrName.ImpItemSpec
instance Data.Data.Data RdrName.ImpDeclSpec
instance Data.Data.Data RdrName.Parent
instance GHC.Classes.Eq RdrName.Parent
instance Data.Data.Data RdrName.RdrName
instance Outputable.Outputable RdrName.GlobalRdrElt
instance Outputable.Outputable RdrName.ImportSpec
instance GHC.Classes.Eq RdrName.ImpItemSpec
instance GHC.Classes.Ord RdrName.ImpItemSpec
instance GHC.Classes.Eq RdrName.ImpDeclSpec
instance GHC.Classes.Ord RdrName.ImpDeclSpec
instance Outputable.Outputable RdrName.Parent
instance Outputable.Outputable RdrName.LocalRdrEnv
instance OccName.HasOccName RdrName.RdrName
instance Outputable.Outputable RdrName.RdrName
instance Outputable.OutputableBndr RdrName.RdrName
instance GHC.Classes.Eq RdrName.RdrName
instance GHC.Classes.Ord RdrName.RdrName
module PrelNames
-- | Unique identifier.
--
-- The type of unique identifiers that are used in many places in GHC for
-- fast ordering and equality tests. You should generate these with the
-- functions from the UniqSupply module
--
-- These are sometimes also referred to as "keys" in comments in GHC.
data Unique
-- | Class of things that we can obtain a Unique from
class Uniquable a
getUnique :: Uniquable a => a -> Unique
hasKey :: Uniquable a => a -> Unique -> Bool
int8X16PrimTyConKey :: Unique
int16X8PrimTyConKey :: Unique
int32X4PrimTyConKey :: Unique
int64X2PrimTyConKey :: Unique
int8X32PrimTyConKey :: Unique
int16X16PrimTyConKey :: Unique
int32X8PrimTyConKey :: Unique
int64X4PrimTyConKey :: Unique
int8X64PrimTyConKey :: Unique
int16X32PrimTyConKey :: Unique
int32X16PrimTyConKey :: Unique
int64X8PrimTyConKey :: Unique
word8X16PrimTyConKey :: Unique
word16X8PrimTyConKey :: Unique
word32X4PrimTyConKey :: Unique
word64X2PrimTyConKey :: Unique
word8X32PrimTyConKey :: Unique
word16X16PrimTyConKey :: Unique
word32X8PrimTyConKey :: Unique
word64X4PrimTyConKey :: Unique
word8X64PrimTyConKey :: Unique
word16X32PrimTyConKey :: Unique
word32X16PrimTyConKey :: Unique
word64X8PrimTyConKey :: Unique
floatX4PrimTyConKey :: Unique
doubleX2PrimTyConKey :: Unique
floatX8PrimTyConKey :: Unique
doubleX4PrimTyConKey :: Unique
floatX16PrimTyConKey :: Unique
doubleX8PrimTyConKey :: Unique
allNameStrings :: [String]
itName :: Unique -> SrcSpan -> Name
mkUnboundName :: OccName -> Name
isUnboundName :: Name -> Bool
basicKnownKeyNames :: [Name]
genericTyConNames :: [Name]
pRELUDE :: Module
gHC_PRIM :: Module
gHC_TYPES :: Module
gHC_GENERICS :: Module
gHC_MAGIC :: Module
gHC_CLASSES :: Module
gHC_BASE :: Module
gHC_ENUM :: Module
gHC_GHCI :: Module
gHC_CSTRING :: Module
gHC_SHOW :: Module
gHC_READ :: Module
gHC_NUM :: Module
gHC_INTEGER_TYPE :: Module
gHC_NATURAL :: Module
gHC_LIST :: Module
gHC_TUPLE :: Module
dATA_TUPLE :: Module
dATA_EITHER :: Module
dATA_STRING :: Module
dATA_FOLDABLE :: Module
dATA_TRAVERSABLE :: Module
dATA_MONOID :: Module
dATA_SEMIGROUP :: Module
gHC_CONC :: Module
gHC_IO :: Module
gHC_IO_Exception :: Module
gHC_ST :: Module
gHC_ARR :: Module
gHC_STABLE :: Module
gHC_PTR :: Module
gHC_ERR :: Module
gHC_REAL :: Module
gHC_FLOAT :: Module
gHC_TOP_HANDLER :: Module
sYSTEM_IO :: Module
dYNAMIC :: Module
tYPEABLE :: Module
tYPEABLE_INTERNAL :: Module
gENERICS :: Module
rEAD_PREC :: Module
lEX :: Module
gHC_INT :: Module
gHC_WORD :: Module
mONAD :: Module
mONAD_FIX :: Module
mONAD_ZIP :: Module
mONAD_FAIL :: Module
aRROW :: Module
cONTROL_APPLICATIVE :: Module
gHC_DESUGAR :: Module
rANDOM :: Module
gHC_EXTS :: Module
cONTROL_EXCEPTION_BASE :: Module
gHC_TYPELITS :: Module
gHC_TYPENATS :: Module
dATA_TYPE_EQUALITY :: Module
dATA_COERCE :: Module
gHC_PARR' :: Module
gHC_SRCLOC :: Module
gHC_STACK :: Module
gHC_STACK_TYPES :: Module
gHC_STATICPTR :: Module
gHC_STATICPTR_INTERNAL :: Module
gHC_FINGERPRINT_TYPE :: Module
gHC_OVER_LABELS :: Module
gHC_RECORDS :: Module
mAIN :: Module
rOOT_MAIN :: Module
mkInteractiveModule :: Int -> Module
pRELUDE_NAME :: ModuleName
mAIN_NAME :: ModuleName
dATA_ARRAY_PARALLEL_NAME :: ModuleName
dATA_ARRAY_PARALLEL_PRIM_NAME :: ModuleName
mkPrimModule :: FastString -> Module
mkIntegerModule :: FastString -> Module
mkBaseModule :: FastString -> Module
mkBaseModule_ :: ModuleName -> Module
mkThisGhcModule :: FastString -> Module
mkThisGhcModule_ :: ModuleName -> Module
mkMainModule :: FastString -> Module
mkMainModule_ :: ModuleName -> Module
main_RDR_Unqual :: RdrName
forall_tv_RDR :: RdrName
dot_tv_RDR :: RdrName
eq_RDR :: RdrName
ge_RDR :: RdrName
ne_RDR :: RdrName
le_RDR :: RdrName
lt_RDR :: RdrName
gt_RDR :: RdrName
compare_RDR :: RdrName
ltTag_RDR :: RdrName
eqTag_RDR :: RdrName
gtTag_RDR :: RdrName
eqClass_RDR :: RdrName
numClass_RDR :: RdrName
ordClass_RDR :: RdrName
enumClass_RDR :: RdrName
monadClass_RDR :: RdrName
map_RDR :: RdrName
append_RDR :: RdrName
foldr_RDR :: RdrName
build_RDR :: RdrName
returnM_RDR :: RdrName
bindM_RDR :: RdrName
failM_RDR_preMFP :: RdrName
failM_RDR :: RdrName
left_RDR :: RdrName
right_RDR :: RdrName
fromEnum_RDR :: RdrName
toEnum_RDR :: RdrName
enumFrom_RDR :: RdrName
enumFromTo_RDR :: RdrName
enumFromThen_RDR :: RdrName
enumFromThenTo_RDR :: RdrName
ratioDataCon_RDR :: RdrName
plusInteger_RDR :: RdrName
timesInteger_RDR :: RdrName
ioDataCon_RDR :: RdrName
eqString_RDR :: RdrName
unpackCString_RDR :: RdrName
unpackCStringFoldr_RDR :: RdrName
unpackCStringUtf8_RDR :: RdrName
newStablePtr_RDR :: RdrName
bindIO_RDR :: RdrName
returnIO_RDR :: RdrName
fromInteger_RDR :: RdrName
fromRational_RDR :: RdrName
minus_RDR :: RdrName
times_RDR :: RdrName
plus_RDR :: RdrName
toInteger_RDR :: RdrName
toRational_RDR :: RdrName
fromIntegral_RDR :: RdrName
stringTy_RDR :: RdrName
fromString_RDR :: RdrName
fromList_RDR :: RdrName
fromListN_RDR :: RdrName
toList_RDR :: RdrName
compose_RDR :: RdrName
not_RDR :: RdrName
getTag_RDR :: RdrName
succ_RDR :: RdrName
pred_RDR :: RdrName
minBound_RDR :: RdrName
maxBound_RDR :: RdrName
and_RDR :: RdrName
range_RDR :: RdrName
inRange_RDR :: RdrName
index_RDR :: RdrName
unsafeIndex_RDR :: RdrName
unsafeRangeSize_RDR :: RdrName
readList_RDR :: RdrName
readListDefault_RDR :: RdrName
readListPrec_RDR :: RdrName
readListPrecDefault_RDR :: RdrName
readPrec_RDR :: RdrName
parens_RDR :: RdrName
choose_RDR :: RdrName
lexP_RDR :: RdrName
expectP_RDR :: RdrName
punc_RDR :: RdrName
ident_RDR :: RdrName
symbol_RDR :: RdrName
step_RDR :: RdrName
alt_RDR :: RdrName
reset_RDR :: RdrName
prec_RDR :: RdrName
pfail_RDR :: RdrName
showList_RDR :: RdrName
showList___RDR :: RdrName
showsPrec_RDR :: RdrName
shows_RDR :: RdrName
showString_RDR :: RdrName
showSpace_RDR :: RdrName
showCommaSpace_RDR :: RdrName
showParen_RDR :: RdrName
undefined_RDR :: RdrName
error_RDR :: RdrName
u1DataCon_RDR :: RdrName
par1DataCon_RDR :: RdrName
rec1DataCon_RDR :: RdrName
k1DataCon_RDR :: RdrName
m1DataCon_RDR :: RdrName
l1DataCon_RDR :: RdrName
r1DataCon_RDR :: RdrName
prodDataCon_RDR :: RdrName
comp1DataCon_RDR :: RdrName
unPar1_RDR :: RdrName
unRec1_RDR :: RdrName
unK1_RDR :: RdrName
unComp1_RDR :: RdrName
from_RDR :: RdrName
from1_RDR :: RdrName
to_RDR :: RdrName
to1_RDR :: RdrName
datatypeName_RDR :: RdrName
moduleName_RDR :: RdrName
packageName_RDR :: RdrName
isNewtypeName_RDR :: RdrName
conName_RDR :: RdrName
conFixity_RDR :: RdrName
conIsRecord_RDR :: RdrName
selName_RDR :: RdrName
prefixDataCon_RDR :: RdrName
infixDataCon_RDR :: RdrName
leftAssocDataCon_RDR :: RdrName
rightAssocDataCon_RDR :: RdrName
notAssocDataCon_RDR :: RdrName
uAddrDataCon_RDR :: RdrName
uCharDataCon_RDR :: RdrName
uDoubleDataCon_RDR :: RdrName
uFloatDataCon_RDR :: RdrName
uIntDataCon_RDR :: RdrName
uWordDataCon_RDR :: RdrName
uAddrHash_RDR :: RdrName
uCharHash_RDR :: RdrName
uDoubleHash_RDR :: RdrName
uFloatHash_RDR :: RdrName
uIntHash_RDR :: RdrName
uWordHash_RDR :: RdrName
fmap_RDR :: RdrName
replace_RDR :: RdrName
pure_RDR :: RdrName
ap_RDR :: RdrName
liftA2_RDR :: RdrName
foldable_foldr_RDR :: RdrName
foldMap_RDR :: RdrName
traverse_RDR :: RdrName
mempty_RDR :: RdrName
mappend_RDR :: RdrName
eqTyCon_RDR :: RdrName
varQual_RDR :: Module -> FastString -> RdrName
tcQual_RDR :: Module -> FastString -> RdrName
clsQual_RDR :: Module -> FastString -> RdrName
dataQual_RDR :: Module -> FastString -> RdrName
wildCardName :: Name
runMainIOName :: Name
orderingTyConName :: Name
ltDataConName :: Name
eqDataConName :: Name
gtDataConName :: Name
specTyConName :: Name
eitherTyConName :: Name
leftDataConName :: Name
rightDataConName :: Name
v1TyConName :: Name
u1TyConName :: Name
par1TyConName :: Name
rec1TyConName :: Name
k1TyConName :: Name
m1TyConName :: Name
sumTyConName :: Name
prodTyConName :: Name
compTyConName :: Name
rTyConName :: Name
dTyConName :: Name
cTyConName :: Name
sTyConName :: Name
rec0TyConName :: Name
d1TyConName :: Name
c1TyConName :: Name
s1TyConName :: Name
noSelTyConName :: Name
repTyConName :: Name
rep1TyConName :: Name
uRecTyConName :: Name
uAddrTyConName :: Name
uCharTyConName :: Name
uDoubleTyConName :: Name
uFloatTyConName :: Name
uIntTyConName :: Name
uWordTyConName :: Name
prefixIDataConName :: Name
infixIDataConName :: Name
leftAssociativeDataConName :: Name
rightAssociativeDataConName :: Name
notAssociativeDataConName :: Name
sourceUnpackDataConName :: Name
sourceNoUnpackDataConName :: Name
noSourceUnpackednessDataConName :: Name
sourceLazyDataConName :: Name
sourceStrictDataConName :: Name
noSourceStrictnessDataConName :: Name
decidedLazyDataConName :: Name
decidedStrictDataConName :: Name
decidedUnpackDataConName :: Name
metaDataDataConName :: Name
metaConsDataConName :: Name
metaSelDataConName :: Name
divIntName :: Name
modIntName :: Name
unpackCStringName :: Name
unpackCStringFoldrName :: Name
unpackCStringUtf8Name :: Name
eqStringName :: Name
inlineIdName :: Name
fmapName :: Name
eqClassName :: Name
eqName :: Name
ordClassName :: Name
geName :: Name
functorClassName :: Name
monadClassName :: Name
thenMName :: Name
bindMName :: Name
returnMName :: Name
failMName_preMFP :: Name
monadFailClassName :: Name
failMName :: Name
applicativeClassName :: Name
pureAName :: Name
apAName :: Name
thenAName :: Name
foldableClassName :: Name
traversableClassName :: Name
semigroupClassName :: Name
sappendName :: Name
monoidClassName :: Name
memptyName :: Name
mappendName :: Name
mconcatName :: Name
joinMName :: Name
alternativeClassName :: Name
joinMIdKey :: Unique
apAClassOpKey :: Unique
pureAClassOpKey :: Unique
thenAClassOpKey :: Unique
alternativeClassKey :: Unique
groupWithName :: Name
fromStringName :: Name
otherwiseIdName :: Name
foldrName :: Name
buildName :: Name
augmentName :: Name
mapName :: Name
appendName :: Name
assertName :: Name
breakpointName :: Name
breakpointCondName :: Name
breakpointAutoName :: Name
opaqueTyConName :: Name
breakpointJumpName :: Name
breakpointCondJumpName :: Name
breakpointAutoJumpName :: Name
fstName :: Name
sndName :: Name
numClassName :: Name
fromIntegerName :: Name
minusName :: Name
negateName :: Name
integerTyConName :: Name
mkIntegerName :: Name
integerSDataConName :: Name
integerToWord64Name :: Name
integerToInt64Name :: Name
word64ToIntegerName :: Name
int64ToIntegerName :: Name
plusIntegerName :: Name
timesIntegerName :: Name
smallIntegerName :: Name
wordToIntegerName :: Name
integerToWordName :: Name
integerToIntName :: Name
minusIntegerName :: Name
negateIntegerName :: Name
eqIntegerPrimName :: Name
neqIntegerPrimName :: Name
absIntegerName :: Name
signumIntegerName :: Name
leIntegerPrimName :: Name
gtIntegerPrimName :: Name
ltIntegerPrimName :: Name
geIntegerPrimName :: Name
compareIntegerName :: Name
quotRemIntegerName :: Name
divModIntegerName :: Name
quotIntegerName :: Name
remIntegerName :: Name
divIntegerName :: Name
modIntegerName :: Name
floatFromIntegerName :: Name
doubleFromIntegerName :: Name
encodeFloatIntegerName :: Name
encodeDoubleIntegerName :: Name
decodeDoubleIntegerName :: Name
gcdIntegerName :: Name
lcmIntegerName :: Name
andIntegerName :: Name
orIntegerName :: Name
xorIntegerName :: Name
complementIntegerName :: Name
shiftLIntegerName :: Name
shiftRIntegerName :: Name
bitIntegerName :: Name
naturalTyConName :: Name
naturalFromIntegerName :: Name
rationalTyConName :: Name
ratioTyConName :: Name
ratioDataConName :: Name
realClassName :: Name
integralClassName :: Name
realFracClassName :: Name
fractionalClassName :: Name
fromRationalName :: Name
toIntegerName :: Name
toRationalName :: Name
fromIntegralName :: Name
realToFracName :: Name
floatingClassName :: Name
realFloatClassName :: Name
rationalToFloatName :: Name
rationalToDoubleName :: Name
ixClassName :: Name
trModuleTyConName :: Name
trModuleDataConName :: Name
trNameTyConName :: Name
trNameSDataConName :: Name
trNameDDataConName :: Name
trTyConTyConName :: Name
trTyConDataConName :: Name
kindRepTyConName :: Name
kindRepTyConAppDataConName :: Name
kindRepVarDataConName :: Name
kindRepAppDataConName :: Name
kindRepFunDataConName :: Name
kindRepTYPEDataConName :: Name
kindRepTypeLitSDataConName :: Name
kindRepTypeLitDDataConName :: Name
typeLitSortTyConName :: Name
typeLitSymbolDataConName :: Name
typeLitNatDataConName :: Name
typeableClassName :: Name
typeRepTyConName :: Name
someTypeRepTyConName :: Name
someTypeRepDataConName :: Name
mkTrConName :: Name
mkTrAppName :: Name
mkTrFunName :: Name
typeRepIdName :: Name
typeNatTypeRepName :: Name
typeSymbolTypeRepName :: Name
trGhcPrimModuleName :: Name
starKindRepName :: Name
starArrStarKindRepName :: Name
starArrStarArrStarKindRepName :: Name
errorMessageTypeErrorFamName :: Name
typeErrorTextDataConName :: Name
typeErrorAppendDataConName :: Name
typeErrorVAppendDataConName :: Name
typeErrorShowTypeDataConName :: Name
toDynName :: Name
dataClassName :: Name
assertErrorName :: Name
enumClassName :: Name
enumFromName :: Name
enumFromToName :: Name
enumFromThenName :: Name
enumFromThenToName :: Name
boundedClassName :: Name
concatName :: Name
filterName :: Name
zipName :: Name
isListClassName :: Name
fromListName :: Name
fromListNName :: Name
toListName :: Name
showClassName :: Name
readClassName :: Name
genClassName :: Name
gen1ClassName :: Name
datatypeClassName :: Name
constructorClassName :: Name
selectorClassName :: Name
genericClassNames :: [Name]
ghciIoClassName :: Name
ghciStepIoMName :: Name
ioTyConName :: Name
ioDataConName :: Name
thenIOName :: Name
bindIOName :: Name
returnIOName :: Name
failIOName :: Name
printName :: Name
int8TyConName :: Name
int16TyConName :: Name
int32TyConName :: Name
int64TyConName :: Name
word16TyConName :: Name
word32TyConName :: Name
word64TyConName :: Name
ptrTyConName :: Name
funPtrTyConName :: Name
stablePtrTyConName :: Name
newStablePtrName :: Name
monadFixClassName :: Name
mfixName :: Name
arrAName :: Name
composeAName :: Name
firstAName :: Name
appAName :: Name
choiceAName :: Name
loopAName :: Name
guardMName :: Name
liftMName :: Name
mzipName :: Name
toAnnotationWrapperName :: Name
monadPlusClassName :: Name
randomClassName :: Name
randomGenClassName :: Name
isStringClassName :: Name
knownNatClassName :: Name
knownSymbolClassName :: Name
isLabelClassName :: Name
ipClassName :: Name
hasFieldClassName :: Name
callStackTyConName :: Name
emptyCallStackName :: Name
pushCallStackName :: Name
srcLocDataConName :: Name
pLUGINS :: Module
pluginTyConName :: Name
frontendPluginTyConName :: Name
makeStaticName :: Name
staticPtrInfoTyConName :: Name
staticPtrInfoDataConName :: Name
staticPtrTyConName :: Name
staticPtrDataConName :: Name
fromStaticPtrName :: Name
fingerprintDataConName :: Name
eqTyConName :: Name
varQual :: Module -> FastString -> Unique -> Name
tcQual :: Module -> FastString -> Unique -> Name
clsQual :: Module -> FastString -> Unique -> Name
dcQual :: Module -> FastString -> Unique -> Name
mk_known_key_name :: NameSpace -> Module -> FastString -> Unique -> Name
boundedClassKey :: Unique
enumClassKey :: Unique
eqClassKey :: Unique
floatingClassKey :: Unique
fractionalClassKey :: Unique
integralClassKey :: Unique
monadClassKey :: Unique
dataClassKey :: Unique
functorClassKey :: Unique
numClassKey :: Unique
ordClassKey :: Unique
readClassKey :: Unique
realClassKey :: Unique
realFloatClassKey :: Unique
realFracClassKey :: Unique
showClassKey :: Unique
ixClassKey :: Unique
typeableClassKey :: Unique
typeable1ClassKey :: Unique
typeable2ClassKey :: Unique
typeable3ClassKey :: Unique
typeable4ClassKey :: Unique
typeable5ClassKey :: Unique
typeable6ClassKey :: Unique
typeable7ClassKey :: Unique
monadFixClassKey :: Unique
monadFailClassKey :: Unique
monadPlusClassKey :: Unique
randomClassKey :: Unique
randomGenClassKey :: Unique
isStringClassKey :: Unique
applicativeClassKey :: Unique
foldableClassKey :: Unique
traversableClassKey :: Unique
genClassKey :: Unique
gen1ClassKey :: Unique
datatypeClassKey :: Unique
constructorClassKey :: Unique
selectorClassKey :: Unique
knownNatClassNameKey :: Unique
knownSymbolClassNameKey :: Unique
ghciIoClassKey :: Unique
isLabelClassNameKey :: Unique
semigroupClassKey :: Unique
monoidClassKey :: Unique
ipClassKey :: Unique
hasFieldClassNameKey :: Unique
addrPrimTyConKey :: Unique
arrayPrimTyConKey :: Unique
arrayArrayPrimTyConKey :: Unique
boolTyConKey :: Unique
byteArrayPrimTyConKey :: Unique
charPrimTyConKey :: Unique
charTyConKey :: Unique
doublePrimTyConKey :: Unique
doubleTyConKey :: Unique
floatPrimTyConKey :: Unique
floatTyConKey :: Unique
funTyConKey :: Unique
intPrimTyConKey :: Unique
intTyConKey :: Unique
int8TyConKey :: Unique
int16TyConKey :: Unique
int32PrimTyConKey :: Unique
int32TyConKey :: Unique
int64PrimTyConKey :: Unique
int64TyConKey :: Unique
integerTyConKey :: Unique
naturalTyConKey :: Unique
listTyConKey :: Unique
foreignObjPrimTyConKey :: Unique
maybeTyConKey :: Unique
weakPrimTyConKey :: Unique
mutableArrayPrimTyConKey :: Unique
mutableArrayArrayPrimTyConKey :: Unique
mutableByteArrayPrimTyConKey :: Unique
orderingTyConKey :: Unique
mVarPrimTyConKey :: Unique
ratioTyConKey :: Unique
rationalTyConKey :: Unique
realWorldTyConKey :: Unique
stablePtrPrimTyConKey :: Unique
stablePtrTyConKey :: Unique
eqTyConKey :: Unique
heqTyConKey :: Unique
smallArrayPrimTyConKey :: Unique
smallMutableArrayPrimTyConKey :: Unique
statePrimTyConKey :: Unique
stableNamePrimTyConKey :: Unique
stableNameTyConKey :: Unique
mutVarPrimTyConKey :: Unique
ioTyConKey :: Unique
wordPrimTyConKey :: Unique
wordTyConKey :: Unique
word8TyConKey :: Unique
word16TyConKey :: Unique
word32PrimTyConKey :: Unique
word32TyConKey :: Unique
word64PrimTyConKey :: Unique
word64TyConKey :: Unique
liftedConKey :: Unique
unliftedConKey :: Unique
anyBoxConKey :: Unique
kindConKey :: Unique
boxityConKey :: Unique
typeConKey :: Unique
threadIdPrimTyConKey :: Unique
bcoPrimTyConKey :: Unique
ptrTyConKey :: Unique
funPtrTyConKey :: Unique
tVarPrimTyConKey :: Unique
eqPrimTyConKey :: Unique
eqReprPrimTyConKey :: Unique
eqPhantPrimTyConKey :: Unique
voidPrimTyConKey :: Unique
compactPrimTyConKey :: Unique
parrTyConKey :: Unique
objectTyConKey :: Unique
eitherTyConKey :: Unique
liftedTypeKindTyConKey :: Unique
tYPETyConKey :: Unique
constraintKindTyConKey :: Unique
starKindTyConKey :: Unique
unicodeStarKindTyConKey :: Unique
runtimeRepTyConKey :: Unique
vecCountTyConKey :: Unique
vecElemTyConKey :: Unique
pluginTyConKey :: Unique
frontendPluginTyConKey :: Unique
unknownTyConKey :: Unique
unknown1TyConKey :: Unique
unknown2TyConKey :: Unique
unknown3TyConKey :: Unique
opaqueTyConKey :: Unique
v1TyConKey :: Unique
u1TyConKey :: Unique
par1TyConKey :: Unique
rec1TyConKey :: Unique
k1TyConKey :: Unique
m1TyConKey :: Unique
sumTyConKey :: Unique
prodTyConKey :: Unique
compTyConKey :: Unique
rTyConKey :: Unique
dTyConKey :: Unique
cTyConKey :: Unique
sTyConKey :: Unique
rec0TyConKey :: Unique
d1TyConKey :: Unique
c1TyConKey :: Unique
s1TyConKey :: Unique
noSelTyConKey :: Unique
repTyConKey :: Unique
rep1TyConKey :: Unique
uRecTyConKey :: Unique
uAddrTyConKey :: Unique
uCharTyConKey :: Unique
uDoubleTyConKey :: Unique
uFloatTyConKey :: Unique
uIntTyConKey :: Unique
uWordTyConKey :: Unique
typeNatKindConNameKey :: Unique
typeSymbolKindConNameKey :: Unique
typeNatAddTyFamNameKey :: Unique
typeNatMulTyFamNameKey :: Unique
typeNatExpTyFamNameKey :: Unique
typeNatLeqTyFamNameKey :: Unique
typeNatSubTyFamNameKey :: Unique
typeSymbolCmpTyFamNameKey :: Unique
typeNatCmpTyFamNameKey :: Unique
errorMessageTypeErrorFamKey :: Unique
ntTyConKey :: Unique
coercibleTyConKey :: Unique
proxyPrimTyConKey :: Unique
specTyConKey :: Unique
anyTyConKey :: Unique
staticPtrTyConKey :: Unique
staticPtrInfoTyConKey :: Unique
callStackTyConKey :: Unique
typeRepTyConKey :: Unique
someTypeRepTyConKey :: Unique
someTypeRepDataConKey :: Unique
typeSymbolAppendFamNameKey :: Unique
charDataConKey :: Unique
consDataConKey :: Unique
doubleDataConKey :: Unique
falseDataConKey :: Unique
floatDataConKey :: Unique
intDataConKey :: Unique
integerSDataConKey :: Unique
nilDataConKey :: Unique
ratioDataConKey :: Unique
stableNameDataConKey :: Unique
trueDataConKey :: Unique
wordDataConKey :: Unique
word8DataConKey :: Unique
ioDataConKey :: Unique
integerDataConKey :: Unique
heqDataConKey :: Unique
coercibleDataConKey :: Unique
nothingDataConKey :: Unique
justDataConKey :: Unique
crossDataConKey :: Unique
inlDataConKey :: Unique
inrDataConKey :: Unique
genUnitDataConKey :: Unique
parrDataConKey :: Unique
leftDataConKey :: Unique
rightDataConKey :: Unique
ltDataConKey :: Unique
eqDataConKey :: Unique
gtDataConKey :: Unique
staticPtrDataConKey :: Unique
staticPtrInfoDataConKey :: Unique
fingerprintDataConKey :: Unique
srcLocDataConKey :: Unique
trTyConTyConKey :: Unique
trTyConDataConKey :: Unique
trModuleTyConKey :: Unique
trModuleDataConKey :: Unique
trNameTyConKey :: Unique
trNameSDataConKey :: Unique
trNameDDataConKey :: Unique
trGhcPrimModuleKey :: Unique
kindRepTyConKey :: Unique
typeLitSortTyConKey :: Unique
typeErrorTextDataConKey :: Unique
typeErrorAppendDataConKey :: Unique
typeErrorVAppendDataConKey :: Unique
typeErrorShowTypeDataConKey :: Unique
prefixIDataConKey :: Unique
infixIDataConKey :: Unique
leftAssociativeDataConKey :: Unique
rightAssociativeDataConKey :: Unique
notAssociativeDataConKey :: Unique
sourceUnpackDataConKey :: Unique
sourceNoUnpackDataConKey :: Unique
noSourceUnpackednessDataConKey :: Unique
sourceLazyDataConKey :: Unique
sourceStrictDataConKey :: Unique
noSourceStrictnessDataConKey :: Unique
decidedLazyDataConKey :: Unique
decidedStrictDataConKey :: Unique
decidedUnpackDataConKey :: Unique
metaDataDataConKey :: Unique
metaConsDataConKey :: Unique
metaSelDataConKey :: Unique
vecRepDataConKey :: Unique
tupleRepDataConKey :: Unique
sumRepDataConKey :: Unique
runtimeRepSimpleDataConKeys :: [Unique]
liftedRepDataConKey :: Unique
vecCountDataConKeys :: [Unique]
vecElemDataConKeys :: [Unique]
kindRepTyConAppDataConKey :: Unique
kindRepVarDataConKey :: Unique
kindRepAppDataConKey :: Unique
kindRepFunDataConKey :: Unique
kindRepTYPEDataConKey :: Unique
kindRepTypeLitSDataConKey :: Unique
kindRepTypeLitDDataConKey :: Unique
typeLitSymbolDataConKey :: Unique
typeLitNatDataConKey :: Unique
wildCardKey :: Unique
absentErrorIdKey :: Unique
augmentIdKey :: Unique
appendIdKey :: Unique
buildIdKey :: Unique
errorIdKey :: Unique
foldrIdKey :: Unique
recSelErrorIdKey :: Unique
seqIdKey :: Unique
irrefutPatErrorIdKey :: Unique
eqStringIdKey :: Unique
noMethodBindingErrorIdKey :: Unique
nonExhaustiveGuardsErrorIdKey :: Unique
runtimeErrorIdKey :: Unique
patErrorIdKey :: Unique
voidPrimIdKey :: Unique
realWorldPrimIdKey :: Unique
recConErrorIdKey :: Unique
unpackCStringUtf8IdKey :: Unique
unpackCStringAppendIdKey :: Unique
unpackCStringFoldrIdKey :: Unique
unpackCStringIdKey :: Unique
typeErrorIdKey :: Unique
divIntIdKey :: Unique
modIntIdKey :: Unique
unsafeCoerceIdKey :: Unique
concatIdKey :: Unique
filterIdKey :: Unique
zipIdKey :: Unique
bindIOIdKey :: Unique
returnIOIdKey :: Unique
newStablePtrIdKey :: Unique
printIdKey :: Unique
failIOIdKey :: Unique
nullAddrIdKey :: Unique
voidArgIdKey :: Unique
fstIdKey :: Unique
sndIdKey :: Unique
otherwiseIdKey :: Unique
assertIdKey :: Unique
mkIntegerIdKey :: Unique
smallIntegerIdKey :: Unique
wordToIntegerIdKey :: Unique
integerToWordIdKey :: Unique
integerToIntIdKey :: Unique
integerToWord64IdKey :: Unique
integerToInt64IdKey :: Unique
word64ToIntegerIdKey :: Unique
int64ToIntegerIdKey :: Unique
plusIntegerIdKey :: Unique
timesIntegerIdKey :: Unique
minusIntegerIdKey :: Unique
negateIntegerIdKey :: Unique
eqIntegerPrimIdKey :: Unique
neqIntegerPrimIdKey :: Unique
absIntegerIdKey :: Unique
signumIntegerIdKey :: Unique
leIntegerPrimIdKey :: Unique
gtIntegerPrimIdKey :: Unique
ltIntegerPrimIdKey :: Unique
geIntegerPrimIdKey :: Unique
compareIntegerIdKey :: Unique
quotRemIntegerIdKey :: Unique
divModIntegerIdKey :: Unique
quotIntegerIdKey :: Unique
remIntegerIdKey :: Unique
divIntegerIdKey :: Unique
modIntegerIdKey :: Unique
floatFromIntegerIdKey :: Unique
doubleFromIntegerIdKey :: Unique
encodeFloatIntegerIdKey :: Unique
encodeDoubleIntegerIdKey :: Unique
decodeDoubleIntegerIdKey :: Unique
gcdIntegerIdKey :: Unique
lcmIntegerIdKey :: Unique
andIntegerIdKey :: Unique
orIntegerIdKey :: Unique
xorIntegerIdKey :: Unique
complementIntegerIdKey :: Unique
shiftLIntegerIdKey :: Unique
shiftRIntegerIdKey :: Unique
rootMainKey :: Unique
runMainKey :: Unique
thenIOIdKey :: Unique
lazyIdKey :: Unique
assertErrorIdKey :: Unique
oneShotKey :: Unique
runRWKey :: Unique
breakpointIdKey :: Unique
breakpointCondIdKey :: Unique
breakpointAutoIdKey :: Unique
breakpointJumpIdKey :: Unique
breakpointCondJumpIdKey :: Unique
breakpointAutoJumpIdKey :: Unique
inlineIdKey :: Unique
noinlineIdKey :: Unique
mapIdKey :: Unique
groupWithIdKey :: Unique
dollarIdKey :: Unique
coercionTokenIdKey :: Unique
rationalToFloatIdKey :: Unique
rationalToDoubleIdKey :: Unique
unmarshalObjectIdKey :: Unique
marshalObjectIdKey :: Unique
marshalStringIdKey :: Unique
unmarshalStringIdKey :: Unique
checkDotnetResNameIdKey :: Unique
undefinedKey :: Unique
magicDictKey :: Unique
coerceKey :: Unique
unboundKey :: Unique
fromIntegerClassOpKey :: Unique
minusClassOpKey :: Unique
fromRationalClassOpKey :: Unique
enumFromClassOpKey :: Unique
enumFromThenClassOpKey :: Unique
enumFromToClassOpKey :: Unique
enumFromThenToClassOpKey :: Unique
eqClassOpKey :: Unique
geClassOpKey :: Unique
negateClassOpKey :: Unique
failMClassOpKey_preMFP :: Unique
bindMClassOpKey :: Unique
thenMClassOpKey :: Unique
returnMClassOpKey :: Unique
fmapClassOpKey :: Unique
mfixIdKey :: Unique
failMClassOpKey :: Unique
arrAIdKey :: Unique
composeAIdKey :: Unique
firstAIdKey :: Unique
appAIdKey :: Unique
choiceAIdKey :: Unique
loopAIdKey :: Unique
fromStringClassOpKey :: Unique
toAnnotationWrapperIdKey :: Unique
fromIntegralIdKey :: Unique
realToFracIdKey :: Unique
toIntegerClassOpKey :: Unique
toRationalClassOpKey :: Unique
guardMIdKey :: Unique
liftMIdKey :: Unique
mzipIdKey :: Unique
ghciStepIoMClassOpKey :: Unique
isListClassKey :: Unique
fromListClassOpKey :: Unique
fromListNClassOpKey :: Unique
toListClassOpKey :: Unique
proxyHashKey :: Unique
mkTyConKey :: Unique
mkTrConKey :: Unique
mkTrAppKey :: Unique
mkTrFunKey :: Unique
typeNatTypeRepKey :: Unique
typeSymbolTypeRepKey :: Unique
typeRepIdKey :: Unique
trTYPEKey :: Unique
trTYPE'PtrRepLiftedKey :: Unique
trRuntimeRepKey :: Unique
tr'PtrRepLiftedKey :: Unique
starKindRepKey :: Unique
starArrStarKindRepKey :: Unique
starArrStarArrStarKindRepKey :: Unique
toDynIdKey :: Unique
bitIntegerIdKey :: Unique
heqSCSelIdKey :: Unique
coercibleSCSelIdKey :: Unique
sappendClassOpKey :: Unique
memptyClassOpKey :: Unique
mappendClassOpKey :: Unique
mconcatClassOpKey :: Unique
emptyCallStackKey :: Unique
pushCallStackKey :: Unique
fromStaticPtrClassOpKey :: Unique
makeStaticKey :: Unique
naturalFromIntegerIdKey :: Unique
numericClassKeys :: [Unique]
fractionalClassKeys :: [Unique]
standardClassKeys :: [Unique]
derivableClassKeys :: [Unique]
interactiveClassNames :: [Name]
interactiveClassKeys :: [Unique]
pretendNameIsInScope :: Name -> Bool
module THNames
templateHaskellNames :: [Name]
thSyn :: Module
thLib :: Module
qqLib :: Module
mkTHModule :: FastString -> Module
libFun :: FastString -> Unique -> Name
libTc :: FastString -> Unique -> Name
thFun :: FastString -> Unique -> Name
thTc :: FastString -> Unique -> Name
thCls :: FastString -> Unique -> Name
thCon :: FastString -> Unique -> Name
qqFun :: FastString -> Unique -> Name
liftClassName :: Name
qTyConName :: Name
nameTyConName :: Name
fieldExpTyConName :: Name
patTyConName :: Name
fieldPatTyConName :: Name
expTyConName :: Name
decTyConName :: Name
typeTyConName :: Name
tyVarBndrTyConName :: Name
matchTyConName :: Name
clauseTyConName :: Name
funDepTyConName :: Name
predTyConName :: Name
tExpTyConName :: Name
injAnnTyConName :: Name
kindTyConName :: Name
overlapTyConName :: Name
derivStrategyTyConName :: Name
returnQName :: Name
bindQName :: Name
sequenceQName :: Name
newNameName :: Name
liftName :: Name
mkNameName :: Name
mkNameG_vName :: Name
mkNameG_dName :: Name
mkNameG_tcName :: Name
mkNameLName :: Name
mkNameSName :: Name
liftStringName :: Name
unTypeName :: Name
unTypeQName :: Name
unsafeTExpCoerceName :: Name
charLName :: Name
stringLName :: Name
integerLName :: Name
intPrimLName :: Name
wordPrimLName :: Name
floatPrimLName :: Name
doublePrimLName :: Name
rationalLName :: Name
stringPrimLName :: Name
charPrimLName :: Name
litPName :: Name
varPName :: Name
tupPName :: Name
unboxedTupPName :: Name
unboxedSumPName :: Name
conPName :: Name
infixPName :: Name
tildePName :: Name
bangPName :: Name
asPName :: Name
wildPName :: Name
recPName :: Name
listPName :: Name
sigPName :: Name
viewPName :: Name
fieldPatName :: Name
matchName :: Name
clauseName :: Name
varEName :: Name
conEName :: Name
litEName :: Name
appEName :: Name
appTypeEName :: Name
infixEName :: Name
infixAppName :: Name
sectionLName :: Name
sectionRName :: Name
lamEName :: Name
lamCaseEName :: Name
tupEName :: Name
unboxedTupEName :: Name
unboxedSumEName :: Name
condEName :: Name
multiIfEName :: Name
letEName :: Name
caseEName :: Name
doEName :: Name
compEName :: Name
staticEName :: Name
unboundVarEName :: Name
fromEName :: Name
fromThenEName :: Name
fromToEName :: Name
fromThenToEName :: Name
listEName :: Name
sigEName :: Name
recConEName :: Name
recUpdEName :: Name
fieldExpName :: Name
guardedBName :: Name
normalBName :: Name
normalGEName :: Name
patGEName :: Name
bindSName :: Name
letSName :: Name
noBindSName :: Name
parSName :: Name
funDName :: Name
valDName :: Name
dataDName :: Name
newtypeDName :: Name
tySynDName :: Name
classDName :: Name
instanceWithOverlapDName :: Name
sigDName :: Name
forImpDName :: Name
pragInlDName :: Name
pragSpecDName :: Name
pragSpecInlDName :: Name
pragSpecInstDName :: Name
pragRuleDName :: Name
pragAnnDName :: Name
standaloneDerivWithStrategyDName :: Name
defaultSigDName :: Name
dataInstDName :: Name
newtypeInstDName :: Name
tySynInstDName :: Name
dataFamilyDName :: Name
openTypeFamilyDName :: Name
closedTypeFamilyDName :: Name
infixLDName :: Name
infixRDName :: Name
infixNDName :: Name
roleAnnotDName :: Name
patSynDName :: Name
patSynSigDName :: Name
pragCompleteDName :: Name
cxtName :: Name
noSourceUnpackednessName :: Name
sourceNoUnpackName :: Name
sourceUnpackName :: Name
noSourceStrictnessName :: Name
sourceLazyName :: Name
sourceStrictName :: Name
normalCName :: Name
recCName :: Name
infixCName :: Name
forallCName :: Name
gadtCName :: Name
recGadtCName :: Name
bangName :: Name
bangTypeName :: Name
varBangTypeName :: Name
unidirPatSynName :: Name
implBidirPatSynName :: Name
explBidirPatSynName :: Name
prefixPatSynName :: Name
infixPatSynName :: Name
recordPatSynName :: Name
forallTName :: Name
varTName :: Name
conTName :: Name
tupleTName :: Name
unboxedTupleTName :: Name
unboxedSumTName :: Name
arrowTName :: Name
listTName :: Name
appTName :: Name
sigTName :: Name
equalityTName :: Name
litTName :: Name
promotedTName :: Name
promotedTupleTName :: Name
promotedNilTName :: Name
promotedConsTName :: Name
wildCardTName :: Name
numTyLitName :: Name
strTyLitName :: Name
plainTVName :: Name
kindedTVName :: Name
nominalRName :: Name
representationalRName :: Name
phantomRName :: Name
inferRName :: Name
varKName :: Name
conKName :: Name
tupleKName :: Name
arrowKName :: Name
listKName :: Name
appKName :: Name
starKName :: Name
constraintKName :: Name
noSigName :: Name
kindSigName :: Name
tyVarSigName :: Name
injectivityAnnName :: Name
cCallName :: Name
stdCallName :: Name
cApiCallName :: Name
primCallName :: Name
javaScriptCallName :: Name
unsafeName :: Name
safeName :: Name
interruptibleName :: Name
tExpDataConName :: Name
ruleVarName :: Name
typedRuleVarName :: Name
funDepName :: Name
typeFamName :: Name
dataFamName :: Name
tySynEqnName :: Name
valueAnnotationName :: Name
typeAnnotationName :: Name
moduleAnnotationName :: Name
derivClauseName :: Name
matchQTyConName :: Name
clauseQTyConName :: Name
expQTyConName :: Name
stmtQTyConName :: Name
decQTyConName :: Name
conQTyConName :: Name
bangTypeQTyConName :: Name
varBangTypeQTyConName :: Name
typeQTyConName :: Name
fieldExpQTyConName :: Name
patQTyConName :: Name
fieldPatQTyConName :: Name
predQTyConName :: Name
decsQTyConName :: Name
ruleBndrQTyConName :: Name
tySynEqnQTyConName :: Name
roleTyConName :: Name
derivClauseQTyConName :: Name
quoteExpName :: Name
quotePatName :: Name
quoteDecName :: Name
quoteTypeName :: Name
noInlineDataConName :: Name
inlineDataConName :: Name
inlinableDataConName :: Name
conLikeDataConName :: Name
funLikeDataConName :: Name
allPhasesDataConName :: Name
fromPhaseDataConName :: Name
beforePhaseDataConName :: Name
overlappableDataConName :: Name
overlappingDataConName :: Name
overlapsDataConName :: Name
incoherentDataConName :: Name
stockStrategyDataConName :: Name
anyclassStrategyDataConName :: Name
newtypeStrategyDataConName :: Name
liftClassKey :: Unique
expTyConKey :: Unique
matchTyConKey :: Unique
clauseTyConKey :: Unique
qTyConKey :: Unique
expQTyConKey :: Unique
decQTyConKey :: Unique
patTyConKey :: Unique
matchQTyConKey :: Unique
clauseQTyConKey :: Unique
stmtQTyConKey :: Unique
conQTyConKey :: Unique
typeQTyConKey :: Unique
typeTyConKey :: Unique
tyVarBndrTyConKey :: Unique
decTyConKey :: Unique
bangTypeQTyConKey :: Unique
varBangTypeQTyConKey :: Unique
fieldExpTyConKey :: Unique
fieldPatTyConKey :: Unique
nameTyConKey :: Unique
patQTyConKey :: Unique
fieldPatQTyConKey :: Unique
fieldExpQTyConKey :: Unique
funDepTyConKey :: Unique
predTyConKey :: Unique
predQTyConKey :: Unique
decsQTyConKey :: Unique
ruleBndrQTyConKey :: Unique
tySynEqnQTyConKey :: Unique
roleTyConKey :: Unique
tExpTyConKey :: Unique
injAnnTyConKey :: Unique
kindTyConKey :: Unique
overlapTyConKey :: Unique
derivClauseQTyConKey :: Unique
derivStrategyTyConKey :: Unique
noInlineDataConKey :: Unique
inlineDataConKey :: Unique
inlinableDataConKey :: Unique
conLikeDataConKey :: Unique
funLikeDataConKey :: Unique
allPhasesDataConKey :: Unique
fromPhaseDataConKey :: Unique
beforePhaseDataConKey :: Unique
tExpDataConKey :: Unique
overlappableDataConKey :: Unique
overlappingDataConKey :: Unique
overlapsDataConKey :: Unique
incoherentDataConKey :: Unique
stockDataConKey :: Unique
anyclassDataConKey :: Unique
newtypeDataConKey :: Unique
returnQIdKey :: Unique
bindQIdKey :: Unique
sequenceQIdKey :: Unique
liftIdKey :: Unique
newNameIdKey :: Unique
mkNameIdKey :: Unique
mkNameG_vIdKey :: Unique
mkNameG_dIdKey :: Unique
mkNameG_tcIdKey :: Unique
mkNameLIdKey :: Unique
mkNameSIdKey :: Unique
unTypeIdKey :: Unique
unTypeQIdKey :: Unique
unsafeTExpCoerceIdKey :: Unique
charLIdKey :: Unique
stringLIdKey :: Unique
integerLIdKey :: Unique
intPrimLIdKey :: Unique
wordPrimLIdKey :: Unique
floatPrimLIdKey :: Unique
doublePrimLIdKey :: Unique
rationalLIdKey :: Unique
stringPrimLIdKey :: Unique
charPrimLIdKey :: Unique
liftStringIdKey :: Unique
litPIdKey :: Unique
varPIdKey :: Unique
tupPIdKey :: Unique
unboxedTupPIdKey :: Unique
unboxedSumPIdKey :: Unique
conPIdKey :: Unique
infixPIdKey :: Unique
tildePIdKey :: Unique
bangPIdKey :: Unique
asPIdKey :: Unique
wildPIdKey :: Unique
recPIdKey :: Unique
listPIdKey :: Unique
sigPIdKey :: Unique
viewPIdKey :: Unique
fieldPatIdKey :: Unique
matchIdKey :: Unique
clauseIdKey :: Unique
varEIdKey :: Unique
conEIdKey :: Unique
litEIdKey :: Unique
appEIdKey :: Unique
appTypeEIdKey :: Unique
infixEIdKey :: Unique
infixAppIdKey :: Unique
sectionLIdKey :: Unique
sectionRIdKey :: Unique
lamEIdKey :: Unique
lamCaseEIdKey :: Unique
tupEIdKey :: Unique
unboxedTupEIdKey :: Unique
unboxedSumEIdKey :: Unique
condEIdKey :: Unique
multiIfEIdKey :: Unique
letEIdKey :: Unique
caseEIdKey :: Unique
doEIdKey :: Unique
compEIdKey :: Unique
fromEIdKey :: Unique
fromThenEIdKey :: Unique
fromToEIdKey :: Unique
fromThenToEIdKey :: Unique
listEIdKey :: Unique
sigEIdKey :: Unique
recConEIdKey :: Unique
recUpdEIdKey :: Unique
staticEIdKey :: Unique
unboundVarEIdKey :: Unique
fieldExpIdKey :: Unique
guardedBIdKey :: Unique
normalBIdKey :: Unique
normalGEIdKey :: Unique
patGEIdKey :: Unique
bindSIdKey :: Unique
letSIdKey :: Unique
noBindSIdKey :: Unique
parSIdKey :: Unique
funDIdKey :: Unique
valDIdKey :: Unique
dataDIdKey :: Unique
newtypeDIdKey :: Unique
tySynDIdKey :: Unique
classDIdKey :: Unique
instanceWithOverlapDIdKey :: Unique
instanceDIdKey :: Unique
sigDIdKey :: Unique
forImpDIdKey :: Unique
pragInlDIdKey :: Unique
pragSpecDIdKey :: Unique
pragSpecInlDIdKey :: Unique
pragSpecInstDIdKey :: Unique
pragRuleDIdKey :: Unique
pragAnnDIdKey :: Unique
defaultSigDIdKey :: Unique
dataFamilyDIdKey :: Unique
openTypeFamilyDIdKey :: Unique
closedTypeFamilyDIdKey :: Unique
dataInstDIdKey :: Unique
newtypeInstDIdKey :: Unique
tySynInstDIdKey :: Unique
standaloneDerivWithStrategyDIdKey :: Unique
infixLDIdKey :: Unique
infixRDIdKey :: Unique
infixNDIdKey :: Unique
roleAnnotDIdKey :: Unique
patSynDIdKey :: Unique
patSynSigDIdKey :: Unique
pragCompleteDIdKey :: Unique
cxtIdKey :: Unique
noSourceUnpackednessKey :: Unique
sourceNoUnpackKey :: Unique
sourceUnpackKey :: Unique
noSourceStrictnessKey :: Unique
sourceLazyKey :: Unique
sourceStrictKey :: Unique
normalCIdKey :: Unique
recCIdKey :: Unique
infixCIdKey :: Unique
forallCIdKey :: Unique
gadtCIdKey :: Unique
recGadtCIdKey :: Unique
bangIdKey :: Unique
bangTKey :: Unique
varBangTKey :: Unique
unidirPatSynIdKey :: Unique
implBidirPatSynIdKey :: Unique
explBidirPatSynIdKey :: Unique
prefixPatSynIdKey :: Unique
infixPatSynIdKey :: Unique
recordPatSynIdKey :: Unique
forallTIdKey :: Unique
varTIdKey :: Unique
conTIdKey :: Unique
tupleTIdKey :: Unique
unboxedTupleTIdKey :: Unique
unboxedSumTIdKey :: Unique
arrowTIdKey :: Unique
listTIdKey :: Unique
appTIdKey :: Unique
sigTIdKey :: Unique
equalityTIdKey :: Unique
litTIdKey :: Unique
promotedTIdKey :: Unique
promotedTupleTIdKey :: Unique
promotedNilTIdKey :: Unique
promotedConsTIdKey :: Unique
wildCardTIdKey :: Unique
numTyLitIdKey :: Unique
strTyLitIdKey :: Unique
plainTVIdKey :: Unique
kindedTVIdKey :: Unique
nominalRIdKey :: Unique
representationalRIdKey :: Unique
phantomRIdKey :: Unique
inferRIdKey :: Unique
varKIdKey :: Unique
conKIdKey :: Unique
tupleKIdKey :: Unique
arrowKIdKey :: Unique
listKIdKey :: Unique
appKIdKey :: Unique
starKIdKey :: Unique
constraintKIdKey :: Unique
noSigIdKey :: Unique
kindSigIdKey :: Unique
tyVarSigIdKey :: Unique
injectivityAnnIdKey :: Unique
cCallIdKey :: Unique
stdCallIdKey :: Unique
cApiCallIdKey :: Unique
primCallIdKey :: Unique
javaScriptCallIdKey :: Unique
unsafeIdKey :: Unique
safeIdKey :: Unique
interruptibleIdKey :: Unique
funDepIdKey :: Unique
typeFamIdKey :: Unique
dataFamIdKey :: Unique
tySynEqnIdKey :: Unique
quoteExpKey :: Unique
quotePatKey :: Unique
quoteDecKey :: Unique
quoteTypeKey :: Unique
ruleVarIdKey :: Unique
typedRuleVarIdKey :: Unique
valueAnnotationIdKey :: Unique
typeAnnotationIdKey :: Unique
moduleAnnotationIdKey :: Unique
derivClauseIdKey :: Unique
lift_RDR :: RdrName
mkNameG_dRDR :: RdrName
mkNameG_vRDR :: RdrName
conE_RDR :: RdrName
litE_RDR :: RdrName
appE_RDR :: RdrName
infixApp_RDR :: RdrName
stringL_RDR :: RdrName
intPrimL_RDR :: RdrName
wordPrimL_RDR :: RdrName
floatPrimL_RDR :: RdrName
doublePrimL_RDR :: RdrName
stringPrimL_RDR :: RdrName
charPrimL_RDR :: RdrName
module ApiAnnotation
-- | Retrieve a list of annotation SrcSpans based on the
-- SrcSpan of the annotated AST element, and the known type of the
-- annotation.
getAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> [SrcSpan]
-- | Retrieve a list of annotation SrcSpans based on the
-- SrcSpan of the annotated AST element, and the known type of the
-- annotation. The list is removed from the annotations.
getAndRemoveAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> ([SrcSpan], ApiAnns)
-- | Retrieve the comments allocated to the current SrcSpan
--
-- Note: A given SrcSpan may appear in multiple AST elements,
-- beware of duplicates
getAnnotationComments :: ApiAnns -> SrcSpan -> [Located AnnotationComment]
-- | Retrieve the comments allocated to the current SrcSpan, and
-- remove them from the annotations
getAndRemoveAnnotationComments :: ApiAnns -> SrcSpan -> ([Located AnnotationComment], ApiAnns)
type ApiAnns = (Map ApiAnnKey [SrcSpan], Map SrcSpan [Located AnnotationComment])
type ApiAnnKey = (SrcSpan, AnnKeywordId)
-- | API Annotations exist so that tools can perform source to source
-- conversions of Haskell code. They are used to keep track of the
-- various syntactic keywords that are not captured in the existing AST.
--
-- The annotations, together with original source comments are made
-- available in the pm_annotations field of
-- ParsedModule. Comments are only retained if
-- Opt_KeepRawTokenStream is set in
-- DynFlags before parsing.
--
-- The wiki page describing this feature is
-- https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations
--
-- Note: in general the names of these are taken from the corresponding
-- token, unless otherwise noted See note [Api annotations] above for
-- details of the usage
data AnnKeywordId
AnnAnyclass :: AnnKeywordId
AnnAs :: AnnKeywordId
AnnAt :: AnnKeywordId
-- | !
AnnBang :: AnnKeywordId
-- | '`'
AnnBackquote :: AnnKeywordId
AnnBy :: AnnKeywordId
-- | case or lambda case
AnnCase :: AnnKeywordId
AnnClass :: AnnKeywordId
-- | '#)' or '#-}' etc
AnnClose :: AnnKeywordId
-- | '|)'
AnnCloseB :: AnnKeywordId
-- | '|)', unicode variant
AnnCloseBU :: AnnKeywordId
-- | '}'
AnnCloseC :: AnnKeywordId
-- | '|]'
AnnCloseQ :: AnnKeywordId
-- | '|]', unicode variant
AnnCloseQU :: AnnKeywordId
-- | ')'
AnnCloseP :: AnnKeywordId
-- | ']'
AnnCloseS :: AnnKeywordId
AnnColon :: AnnKeywordId
-- | as a list separator
AnnComma :: AnnKeywordId
-- | in a RdrName for a tuple
AnnCommaTuple :: AnnKeywordId
-- | '=>'
AnnDarrow :: AnnKeywordId
-- | '=>', unicode variant
AnnDarrowU :: AnnKeywordId
AnnData :: AnnKeywordId
-- | '::'
AnnDcolon :: AnnKeywordId
-- | '::', unicode variant
AnnDcolonU :: AnnKeywordId
AnnDefault :: AnnKeywordId
AnnDeriving :: AnnKeywordId
AnnDo :: AnnKeywordId
-- | .
AnnDot :: AnnKeywordId
-- | '..'
AnnDotdot :: AnnKeywordId
AnnElse :: AnnKeywordId
AnnEqual :: AnnKeywordId
AnnExport :: AnnKeywordId
AnnFamily :: AnnKeywordId
AnnForall :: AnnKeywordId
-- | Unicode variant
AnnForallU :: AnnKeywordId
AnnForeign :: AnnKeywordId
-- | for function name in matches where there are multiple equations for
-- the function.
AnnFunId :: AnnKeywordId
AnnGroup :: AnnKeywordId
-- | for CType
AnnHeader :: AnnKeywordId
AnnHiding :: AnnKeywordId
AnnIf :: AnnKeywordId
AnnImport :: AnnKeywordId
AnnIn :: AnnKeywordId
-- | 'infix' or 'infixl' or 'infixr'
AnnInfix :: AnnKeywordId
AnnInstance :: AnnKeywordId
AnnLam :: AnnKeywordId
-- | '<-'
AnnLarrow :: AnnKeywordId
-- | '<-', unicode variant
AnnLarrowU :: AnnKeywordId
AnnLet :: AnnKeywordId
AnnMdo :: AnnKeywordId
-- | -
AnnMinus :: AnnKeywordId
AnnModule :: AnnKeywordId
AnnNewtype :: AnnKeywordId
-- | where a name loses its location in the AST, this carries it
AnnName :: AnnKeywordId
AnnOf :: AnnKeywordId
-- | '(#' or '{-# LANGUAGE' etc
AnnOpen :: AnnKeywordId
-- | '(|'
AnnOpenB :: AnnKeywordId
-- | '(|', unicode variant
AnnOpenBU :: AnnKeywordId
-- | '{'
AnnOpenC :: AnnKeywordId
-- | '[e|' or '[e||'
AnnOpenE :: AnnKeywordId
-- | '[|'
AnnOpenEQ :: AnnKeywordId
-- | '[|', unicode variant
AnnOpenEQU :: AnnKeywordId
-- | '('
AnnOpenP :: AnnKeywordId
-- | '$('
AnnOpenPE :: AnnKeywordId
-- | '$$('
AnnOpenPTE :: AnnKeywordId
-- | '['
AnnOpenS :: AnnKeywordId
AnnPackageName :: AnnKeywordId
AnnPattern :: AnnKeywordId
AnnProc :: AnnKeywordId
AnnQualified :: AnnKeywordId
-- | '->'
AnnRarrow :: AnnKeywordId
-- | '->', unicode variant
AnnRarrowU :: AnnKeywordId
AnnRec :: AnnKeywordId
AnnRole :: AnnKeywordId
AnnSafe :: AnnKeywordId
-- | ';'
AnnSemi :: AnnKeywordId
-- | '''
AnnSimpleQuote :: AnnKeywordId
AnnSignature :: AnnKeywordId
-- | static
AnnStatic :: AnnKeywordId
AnnStock :: AnnKeywordId
AnnThen :: AnnKeywordId
-- | $
AnnThIdSplice :: AnnKeywordId
-- | $$
AnnThIdTySplice :: AnnKeywordId
-- | double '''
AnnThTyQuote :: AnnKeywordId
-- | '~'
AnnTilde :: AnnKeywordId
-- | ~#
AnnTildehsh :: AnnKeywordId
AnnType :: AnnKeywordId
-- | '()' for types
AnnUnit :: AnnKeywordId
AnnUsing :: AnnKeywordId
-- | e.g. INTEGER
AnnVal :: AnnKeywordId
-- | String value, will need quotes when output
AnnValStr :: AnnKeywordId
-- | '|'
AnnVbar :: AnnKeywordId
AnnWhere :: AnnKeywordId
-- | -<
Annlarrowtail :: AnnKeywordId
-- | -<, unicode variant
AnnlarrowtailU :: AnnKeywordId
-- | '->'
Annrarrowtail :: AnnKeywordId
-- | '->', unicode variant
AnnrarrowtailU :: AnnKeywordId
-- | -<<
AnnLarrowtail :: AnnKeywordId
-- | -<<, unicode variant
AnnLarrowtailU :: AnnKeywordId
-- | >>-
AnnRarrowtail :: AnnKeywordId
-- | >>-, unicode variant
AnnRarrowtailU :: AnnKeywordId
AnnEofPos :: AnnKeywordId
data AnnotationComment
-- | something beginning '-- |'
AnnDocCommentNext :: String -> AnnotationComment
-- | something beginning '-- ^'
AnnDocCommentPrev :: String -> AnnotationComment
-- | something beginning '-- $'
AnnDocCommentNamed :: String -> AnnotationComment
-- | a section heading
AnnDocSection :: Int -> String -> AnnotationComment
-- | doc options (prune, ignore-exports, etc)
AnnDocOptions :: String -> AnnotationComment
-- | comment starting by "--"
AnnLineComment :: String -> AnnotationComment
-- | comment in {- -}
AnnBlockComment :: String -> AnnotationComment
-- | Certain tokens can have alternate representations when unicode syntax
-- is enabled. This flag is attached to those tokens in the lexer so that
-- the original source representation can be reproduced in the
-- corresponding ApiAnnotation
data IsUnicodeSyntax
UnicodeSyntax :: IsUnicodeSyntax
NormalSyntax :: IsUnicodeSyntax
-- | Convert a normal annotation into its unicode equivalent one
unicodeAnn :: AnnKeywordId -> AnnKeywordId
-- | Some template haskell tokens have two variants, one with an e
-- the other not:
--
--
-- [| or [e|
-- [|| or [e||
--
--
-- This type indicates whether the e is present or not.
data HasE
HasE :: HasE
NoE :: HasE
-- |
type LRdrName = Located RdrName
instance GHC.Show.Show ApiAnnotation.HasE
instance Data.Data.Data ApiAnnotation.HasE
instance GHC.Classes.Ord ApiAnnotation.HasE
instance GHC.Classes.Eq ApiAnnotation.HasE
instance GHC.Show.Show ApiAnnotation.IsUnicodeSyntax
instance Data.Data.Data ApiAnnotation.IsUnicodeSyntax
instance GHC.Classes.Ord ApiAnnotation.IsUnicodeSyntax
instance GHC.Classes.Eq ApiAnnotation.IsUnicodeSyntax
instance GHC.Show.Show ApiAnnotation.AnnotationComment
instance Data.Data.Data ApiAnnotation.AnnotationComment
instance GHC.Classes.Ord ApiAnnotation.AnnotationComment
instance GHC.Classes.Eq ApiAnnotation.AnnotationComment
instance GHC.Show.Show ApiAnnotation.AnnKeywordId
instance Data.Data.Data ApiAnnotation.AnnKeywordId
instance GHC.Classes.Ord ApiAnnotation.AnnKeywordId
instance GHC.Classes.Eq ApiAnnotation.AnnKeywordId
instance Outputable.Outputable ApiAnnotation.AnnotationComment
instance Outputable.Outputable ApiAnnotation.AnnKeywordId
module Lexer
data Token
ITas :: Token
ITcase :: Token
ITclass :: Token
ITdata :: Token
ITdefault :: Token
ITderiving :: Token
ITdo :: Token
ITelse :: Token
IThiding :: Token
ITforeign :: Token
ITif :: Token
ITimport :: Token
ITin :: Token
ITinfix :: Token
ITinfixl :: Token
ITinfixr :: Token
ITinstance :: Token
ITlet :: Token
ITmodule :: Token
ITnewtype :: Token
ITof :: Token
ITqualified :: Token
ITthen :: Token
ITtype :: Token
ITwhere :: Token
ITforall :: IsUnicodeSyntax -> Token
ITexport :: Token
ITlabel :: Token
ITdynamic :: Token
ITsafe :: Token
ITinterruptible :: Token
ITunsafe :: Token
ITstdcallconv :: Token
ITccallconv :: Token
ITcapiconv :: Token
ITprimcallconv :: Token
ITjavascriptcallconv :: Token
ITmdo :: Token
ITfamily :: Token
ITrole :: Token
ITgroup :: Token
ITby :: Token
ITusing :: Token
ITpattern :: Token
ITstatic :: Token
ITstock :: Token
ITanyclass :: Token
ITunit :: Token
ITsignature :: Token
ITdependency :: Token
ITrequires :: Token
ITinline_prag :: SourceText -> InlineSpec -> RuleMatchInfo -> Token
ITspec_prag :: SourceText -> Token
ITspec_inline_prag :: SourceText -> Bool -> Token
ITsource_prag :: SourceText -> Token
ITrules_prag :: SourceText -> Token
ITwarning_prag :: SourceText -> Token
ITdeprecated_prag :: SourceText -> Token
ITline_prag :: Token
ITscc_prag :: SourceText -> Token
ITgenerated_prag :: SourceText -> Token
ITcore_prag :: SourceText -> Token
ITunpack_prag :: SourceText -> Token
ITnounpack_prag :: SourceText -> Token
ITann_prag :: SourceText -> Token
ITcomplete_prag :: SourceText -> Token
ITclose_prag :: Token
IToptions_prag :: String -> Token
ITinclude_prag :: String -> Token
ITlanguage_prag :: Token
ITvect_prag :: SourceText -> Token
ITvect_scalar_prag :: SourceText -> Token
ITnovect_prag :: SourceText -> Token
ITminimal_prag :: SourceText -> Token
IToverlappable_prag :: SourceText -> Token
IToverlapping_prag :: SourceText -> Token
IToverlaps_prag :: SourceText -> Token
ITincoherent_prag :: SourceText -> Token
ITctype :: SourceText -> Token
ITdotdot :: Token
ITcolon :: Token
ITdcolon :: IsUnicodeSyntax -> Token
ITequal :: Token
ITlam :: Token
ITlcase :: Token
ITvbar :: Token
ITlarrow :: IsUnicodeSyntax -> Token
ITrarrow :: IsUnicodeSyntax -> Token
ITat :: Token
ITtilde :: Token
ITtildehsh :: Token
ITdarrow :: IsUnicodeSyntax -> Token
ITminus :: Token
ITbang :: Token
ITdot :: Token
ITbiglam :: Token
ITocurly :: Token
ITccurly :: Token
ITvocurly :: Token
ITvccurly :: Token
ITobrack :: Token
ITopabrack :: Token
ITcpabrack :: Token
ITcbrack :: Token
IToparen :: Token
ITcparen :: Token
IToubxparen :: Token
ITcubxparen :: Token
ITsemi :: Token
ITcomma :: Token
ITunderscore :: Token
ITbackquote :: Token
ITsimpleQuote :: Token
ITvarid :: FastString -> Token
ITconid :: FastString -> Token
ITvarsym :: FastString -> Token
ITconsym :: FastString -> Token
ITqvarid :: (FastString, FastString) -> Token
ITqconid :: (FastString, FastString) -> Token
ITqvarsym :: (FastString, FastString) -> Token
ITqconsym :: (FastString, FastString) -> Token
ITdupipvarid :: FastString -> Token
ITlabelvarid :: FastString -> Token
ITchar :: SourceText -> Char -> Token
ITstring :: SourceText -> FastString -> Token
ITinteger :: SourceText -> Integer -> Token
ITrational :: FractionalLit -> Token
ITprimchar :: SourceText -> Char -> Token
ITprimstring :: SourceText -> ByteString -> Token
ITprimint :: SourceText -> Integer -> Token
ITprimword :: SourceText -> Integer -> Token
ITprimfloat :: FractionalLit -> Token
ITprimdouble :: FractionalLit -> Token
ITopenExpQuote :: HasE -> IsUnicodeSyntax -> Token
ITopenPatQuote :: Token
ITopenDecQuote :: Token
ITopenTypQuote :: Token
ITcloseQuote :: IsUnicodeSyntax -> Token
ITopenTExpQuote :: HasE -> Token
ITcloseTExpQuote :: Token
ITidEscape :: FastString -> Token
ITparenEscape :: Token
ITidTyEscape :: FastString -> Token
ITparenTyEscape :: Token
ITtyQuote :: Token
ITquasiQuote :: (FastString, FastString, RealSrcSpan) -> Token
ITqQuasiQuote :: (FastString, FastString, FastString, RealSrcSpan) -> Token
ITproc :: Token
ITrec :: Token
IToparenbar :: IsUnicodeSyntax -> Token
ITcparenbar :: IsUnicodeSyntax -> Token
ITlarrowtail :: IsUnicodeSyntax -> Token
ITrarrowtail :: IsUnicodeSyntax -> Token
ITLarrowtail :: IsUnicodeSyntax -> Token
ITRarrowtail :: IsUnicodeSyntax -> Token
ITtypeApp :: Token
ITunknown :: String -> Token
ITeof :: Token
ITdocCommentNext :: String -> Token
ITdocCommentPrev :: String -> Token
ITdocCommentNamed :: String -> Token
ITdocSection :: Int -> String -> Token
ITdocOptions :: String -> Token
ITlineComment :: String -> Token
ITblockComment :: String -> Token
lexer :: Bool -> (Located Token -> P a) -> P a
pragState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState
-- | Creates a parse state from a DynFlags value
mkPState :: DynFlags -> StringBuffer -> RealSrcLoc -> PState
-- | Creates a parse state from a ParserFlags value
mkPStatePure :: ParserFlags -> StringBuffer -> RealSrcLoc -> PState
data PState
PState :: StringBuffer -> ParserFlags -> (DynFlags -> Messages) -> Maybe RealSrcSpan -> !Int -> Maybe Token -> RealSrcSpan -> !Int -> RealSrcLoc -> [LayoutContext] -> [Int] -> [FastString] -> [RealLocated Token] -> Maybe (RealLocated Token) -> RealSrcSpan -> [ALRContext] -> Maybe ALRLayout -> Bool -> [(ApiAnnKey, [SrcSpan])] -> [Located AnnotationComment] -> [(SrcSpan, [Located AnnotationComment])] -> PState
[buffer] :: PState -> StringBuffer
[options] :: PState -> ParserFlags
[messages] :: PState -> DynFlags -> Messages
[tab_first] :: PState -> Maybe RealSrcSpan
[tab_count] :: PState -> !Int
[last_tk] :: PState -> Maybe Token
[last_loc] :: PState -> RealSrcSpan
[last_len] :: PState -> !Int
[loc] :: PState -> RealSrcLoc
[context] :: PState -> [LayoutContext]
[lex_state] :: PState -> [Int]
[srcfiles] :: PState -> [FastString]
[alr_pending_implicit_tokens] :: PState -> [RealLocated Token]
[alr_next_token] :: PState -> Maybe (RealLocated Token)
[alr_last_loc] :: PState -> RealSrcSpan
[alr_context] :: PState -> [ALRContext]
[alr_expecting_ocurly] :: PState -> Maybe ALRLayout
[alr_justClosedExplicitLetBlock] :: PState -> Bool
[annotations] :: PState -> [(ApiAnnKey, [SrcSpan])]
[comment_q] :: PState -> [Located AnnotationComment]
[annotations_comments] :: PState -> [(SrcSpan, [Located AnnotationComment])]
newtype P a
P :: (PState -> ParseResult a) -> P a
[unP] :: P a -> PState -> ParseResult a
data ParseResult a
POk :: PState -> a -> ParseResult a
PFailed :: SrcSpan -> MsgDoc -> ParseResult a
-- | Extracts the flag information needed for parsing
mkParserFlags :: DynFlags -> ParserFlags
-- | The subset of the DynFlags used by the parser
data ParserFlags
ParserFlags :: IntSet -> IntSet -> UnitId -> !ExtsBitmap -> ParserFlags
[pWarningFlags] :: ParserFlags -> IntSet
[pExtensionFlags] :: ParserFlags -> IntSet
-- | key of package currently being compiled
[pThisPackage] :: ParserFlags -> UnitId
-- | bitmap of permitted extensions
[pExtsBitmap] :: ParserFlags -> !ExtsBitmap
getSrcLoc :: P RealSrcLoc
getPState :: P PState
-- | Test whether a Extension is set
extopt :: Extension -> ParserFlags -> Bool
withThisPackage :: (UnitId -> a) -> P a
failLocMsgP :: RealSrcLoc -> RealSrcLoc -> String -> P a
failSpanMsgP :: SrcSpan -> SDoc -> P a
srcParseFail :: P a
getMessages :: PState -> DynFlags -> Messages
popContext :: P ()
pushModuleContext :: P ()
setLastToken :: RealSrcSpan -> Int -> P ()
setSrcLoc :: RealSrcLoc -> P ()
activeContext :: P Bool
nextIsEOF :: P Bool
getLexState :: P Int
popLexState :: P Int
pushLexState :: Int -> P ()
extension :: (ExtsBitmap -> Bool) -> P Bool
bangPatEnabled :: ExtsBitmap -> Bool
datatypeContextsEnabled :: ExtsBitmap -> Bool
traditionalRecordSyntaxEnabled :: ExtsBitmap -> Bool
explicitForallEnabled :: ExtsBitmap -> Bool
inRulePrag :: ExtsBitmap -> Bool
explicitNamespacesEnabled :: ExtsBitmap -> Bool
patternSynonymsEnabled :: ExtsBitmap -> Bool
sccProfilingOn :: ExtsBitmap -> Bool
hpcEnabled :: ExtsBitmap -> Bool
addWarning :: WarningFlag -> SrcSpan -> SDoc -> P ()
lexTokenStream :: StringBuffer -> RealSrcLoc -> DynFlags -> ParseResult [Located Token]
addAnnotation :: SrcSpan -> AnnKeywordId -> SrcSpan -> P ()
-- | Encapsulated call to addAnnotation, requiring only the SrcSpan of the
-- AST construct the annotation belongs to; together with the
-- AnnKeywordId, this is the key of the annotation map.
--
-- This type is useful for places in the parser where it is not yet known
-- what SrcSpan an annotation should be added to. The most common
-- situation is when we are parsing a list: the annotations need to be
-- associated with the AST element that *contains* the list, not the list
-- itself. AddAnn lets us defer adding the annotations until we
-- finish parsing the list and are now parsing the enclosing element; we
-- then apply the AddAnn to associate the annotations. Another
-- common situation is where a common fragment of the AST has been
-- factored out but there is no separate AST node for this fragment (this
-- occurs in class and data declarations). In this case, the annotation
-- belongs to the parent data declaration.
--
-- The usual way an AddAnn is created is using the mj
-- ("make jump") function, and then it can be discharged using the
-- ams function.
type AddAnn = SrcSpan -> P ()
-- | Given a location and a list of AddAnn, apply them all to the location.
addAnnsAt :: SrcSpan -> [AddAnn] -> P ()
-- | Given a SrcSpan that surrounds a HsPar or
-- HsParTy, generate AddAnn values for the opening and
-- closing bordering on the start and end of the span
mkParensApiAnn :: SrcSpan -> [AddAnn]
commentToAnnotation :: Located Token -> Located AnnotationComment
-- | Move the annotations and comments belonging to the old span
-- to the new one.
moveAnnotations :: SrcSpan -> SrcSpan -> P ()
instance GHC.Enum.Enum Lexer.ExtBits
instance GHC.Show.Show Lexer.LayoutContext
instance GHC.Show.Show Lexer.Token
instance GHC.Base.Functor Lexer.P
instance GHC.Base.Applicative Lexer.P
instance GHC.Base.Monad Lexer.P
instance Control.Monad.Fail.MonadFail Lexer.P
instance Outputable.Outputable Lexer.Token
module CmmMonad
newtype PD a
PD :: (DynFlags -> PState -> ParseResult a) -> PD a
[unPD] :: PD a -> DynFlags -> PState -> ParseResult a
liftP :: P a -> PD a
instance GHC.Base.Functor CmmMonad.PD
instance GHC.Base.Applicative CmmMonad.PD
instance GHC.Base.Monad CmmMonad.PD
instance Control.Monad.Fail.MonadFail CmmMonad.PD
instance DynFlags.HasDynFlags CmmMonad.PD
-- | GHC uses several kinds of name internally:
--
--
--
-- These Var names may either be global or local, see
-- Var#globalvslocal
--
-- Global Ids and Vars are those that are imported or
-- correspond to a data constructor, primitive operation, or record
-- selectors. Local Ids and Vars are those bound within an
-- expression (e.g. by a lambda) or at the top level of the module being
-- compiled.
module Var
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and it's use sites.
data Var
-- | Coercion Variable
type CoVar = Id
-- | Identifier
type Id = Var
type NcId = Id
-- | Dictionary Identifier
type DictId = EvId
-- | Dictionary Function Identifier
type DFunId = Id
-- | Evidence Variable
type EvVar = EvId
-- | Equality Variable
type EqVar = EvId
-- | Evidence Identifier
type EvId = Id
-- | Implicit parameter Identifier
type IpId = EvId
type JoinId = Id
-- | Type or kind Variable
type TyVar = Var
-- | Type Variable
type TypeVar = Var
-- | Kind Variable
type KindVar = Var
-- | Type or Kind Variable
type TKVar = Var
-- | Type or Coercion Variable
type TyCoVar = Id
type InVar = Var
type InCoVar = CoVar
type InId = Id
type InTyVar = TyVar
type OutVar = Var
type OutCoVar = CoVar
type OutId = Id
type OutTyVar = TyVar
varName :: Var -> Name
varUnique :: Var -> Unique
-- | The type or kind of the Var in question
varType :: Var -> Kind
setVarName :: Var -> Name -> Var
setVarUnique :: Var -> Unique -> Var
setVarType :: Id -> Type -> Id
updateVarType :: (Type -> Type) -> Id -> Id
updateVarTypeM :: Monad m => (Type -> m Type) -> Id -> m Id
mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
mkLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
-- | Exported Vars will not be removed as dead code
mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
mkCoVar :: Name -> Type -> CoVar
idInfo :: HasDebugCallStack => Id -> IdInfo
idDetails :: Id -> IdDetails
lazySetIdInfo :: Id -> IdInfo -> Var
setIdDetails :: Id -> IdDetails -> Id
-- | If it's a local, make it global
globaliseId :: Id -> Id
-- | Exports the given local Id. Can also be called on global
-- Ids, such as data constructors and class operations, which are
-- born as global Ids and automatically exported
setIdExported :: Id -> Id
-- | We can only do this to LocalIds
setIdNotExported :: Id -> Id
isId :: Var -> Bool
isTyVar :: Var -> Bool
isTcTyVar :: Var -> Bool
-- | isLocalVar returns True for type variables as well as
-- local Ids These are the variables that we need to pay attention
-- to when finding free variables, or doing dependency analysis.
isLocalVar :: Var -> Bool
isLocalId :: Var -> Bool
isCoVar :: Var -> Bool
isNonCoVarId :: Var -> Bool
isTyCoVar :: Var -> Bool
isGlobalId :: Var -> Bool
-- | isExportedIdVar means "don't throw this away"
isExportedId :: Var -> Bool
-- | mustHaveLocalBinding returns True of Ids and
-- TyVars that must have a binding in this module. The converse is
-- not quite right: there are some global Ids that must have
-- bindings, such as record selectors. But that doesn't matter, because
-- it's only used for assertions
mustHaveLocalBinding :: Var -> Bool
data TyVarBndr tyvar argf
TvBndr :: tyvar -> argf -> TyVarBndr tyvar argf
-- | Argument Flag
--
-- Is something required to appear in source Haskell (Required),
-- permitted by request (Specified) (visible type application), or
-- prohibited entirely from appearing in source Haskell
-- (Inferred)? See Note [TyBinders and ArgFlags] in TyCoRep
data ArgFlag
Required :: ArgFlag
Specified :: ArgFlag
Inferred :: ArgFlag
-- | Type Variable Binder
--
-- A TyVarBinder is the binder of a ForAllTy It's convenient to
-- define this synonym here rather its natural home in TyCoRep, because
-- it's used in DataCon.hs-boot
type TyVarBinder = TyVarBndr TyVar ArgFlag
binderVar :: TyVarBndr tv argf -> tv
binderVars :: [TyVarBndr tv argf] -> [tv]
binderArgFlag :: TyVarBndr tv argf -> argf
binderKind :: TyVarBndr TyVar argf -> Kind
-- | Does this ArgFlag classify an argument that is written in
-- Haskell?
isVisibleArgFlag :: ArgFlag -> Bool
-- | Does this ArgFlag classify an argument that is not written in
-- Haskell?
isInvisibleArgFlag :: ArgFlag -> Bool
-- | Do these denote the same level of visibility? Required
-- arguments are visible, others are not. So this function equates
-- Specified and Inferred. Used for printing.
sameVis :: ArgFlag -> ArgFlag -> Bool
mkTyVar :: Name -> Kind -> TyVar
mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar
tyVarName :: TyVar -> Name
tyVarKind :: TyVar -> Kind
tcTyVarDetails :: TyVar -> TcTyVarDetails
setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar
setTyVarName :: TyVar -> Name -> TyVar
setTyVarUnique :: TyVar -> Unique -> TyVar
setTyVarKind :: TyVar -> Kind -> TyVar
updateTyVarKind :: (Kind -> Kind) -> TyVar -> TyVar
updateTyVarKindM :: (Monad m) => (Kind -> m Kind) -> TyVar -> m TyVar
-- | Compare Vars by their Uniques. This is what Ord Var does, provided
-- here to make it explicit at the call-site that it can introduce
-- non-determinism. See Note [Unique Determinism]
nonDetCmpVar :: Var -> Var -> Ordering
instance (Data.Data.Data argf, Data.Data.Data tyvar) => Data.Data.Data (Var.TyVarBndr tyvar argf)
instance Data.Data.Data Var.ArgFlag
instance GHC.Classes.Eq Var.ArgFlag
instance Outputable.Outputable tv => Outputable.Outputable (Var.TyVarBndr tv Var.ArgFlag)
instance (Binary.Binary tv, Binary.Binary vis) => Binary.Binary (Var.TyVarBndr tv vis)
instance Outputable.Outputable Var.ArgFlag
instance Binary.Binary Var.ArgFlag
instance Outputable.Outputable Var.Var
instance Name.NamedThing Var.Var
instance Unique.Uniquable Var.Var
instance GHC.Classes.Eq Var.Var
instance GHC.Classes.Ord Var.Var
instance Data.Data.Data Var.Var
instance OccName.HasOccName Var.Var
module CostCentre
-- | A Cost Centre is a single {--} annotation.
data CostCentre
NormalCC :: {-# UNPACK #-} !Int -> CcName -> Module -> SrcSpan -> IsCafCC -> CostCentre
-- | Two cost centres may have the same name and module but different
-- SrcSpans, so we need a way to distinguish them easily and give them
-- different object-code labels. So every CostCentre has a Unique that is
-- distinct from every other CostCentre in the same module.
--
-- XXX: should really be using Unique here, but we need to derive Data
-- below and there's no Data instance for Unique.
[cc_key] :: CostCentre -> {-# UNPACK #-} !Int
-- | Name of the cost centre itself
[cc_name] :: CostCentre -> CcName
-- | Name of module defining this CC.
[cc_mod] :: CostCentre -> Module
[cc_loc] :: CostCentre -> SrcSpan
[cc_is_caf] :: CostCentre -> IsCafCC
AllCafsCC :: Module -> SrcSpan -> CostCentre
-- | Name of module defining this CC.
[cc_mod] :: CostCentre -> Module
[cc_loc] :: CostCentre -> SrcSpan
type CcName = FastString
data IsCafCC
NotCafCC :: IsCafCC
CafCC :: IsCafCC
-- | A Cost Centre Stack is something that can be attached to a closure.
-- This is either:
--
--
-- - the current cost centre stack (CCCS)
-- - a pre-defined cost centre stack (there are several pre-defined
-- CCSs, see below).
--
data CostCentreStack
type CollectedCCs = ([CostCentre], [CostCentre], [CostCentreStack])
noCCS :: CostCentreStack
currentCCS :: CostCentreStack
dontCareCCS :: CostCentreStack
noCCSAttached :: CostCentreStack -> Bool
isCurrentCCS :: CostCentreStack -> Bool
maybeSingletonCCS :: CostCentreStack -> Maybe CostCentre
mkUserCC :: FastString -> Module -> SrcSpan -> Unique -> CostCentre
mkAutoCC :: Id -> Module -> IsCafCC -> CostCentre
mkAllCafsCC :: Module -> SrcSpan -> CostCentre
mkSingletonCCS :: CostCentre -> CostCentreStack
isCafCCS :: CostCentreStack -> Bool
isCafCC :: CostCentre -> Bool
-- | Is this a cost-centre which records scc counts
isSccCountCC :: CostCentre -> Bool
-- | Is this a cost-centre which can be sccd ?
sccAbleCC :: CostCentre -> Bool
ccFromThisModule :: CostCentre -> Module -> Bool
pprCostCentreCore :: CostCentre -> SDoc
costCentreUserName :: CostCentre -> String
costCentreUserNameFS :: CostCentre -> FastString
costCentreSrcSpan :: CostCentre -> SrcSpan
cmpCostCentre :: CostCentre -> CostCentre -> Ordering
instance GHC.Classes.Ord CostCentre.CostCentreStack
instance GHC.Classes.Eq CostCentre.CostCentreStack
instance Data.Data.Data CostCentre.CostCentre
instance Data.Data.Data CostCentre.IsCafCC
instance GHC.Classes.Ord CostCentre.IsCafCC
instance GHC.Classes.Eq CostCentre.IsCafCC
instance Outputable.Outputable CostCentre.CostCentreStack
instance GHC.Classes.Eq CostCentre.CostCentre
instance GHC.Classes.Ord CostCentre.CostCentre
instance Outputable.Outputable CostCentre.CostCentre
instance Binary.Binary CostCentre.CostCentre
instance Binary.Binary CostCentre.IsCafCC
-- | Module for coercion axioms, used to represent type family instances
-- and newtypes
module CoAxiom
data BranchFlag
type Branched = 'Branched
type Unbranched = 'Unbranched
type BranchIndex = Int
data Branches (br :: BranchFlag)
manyBranches :: [CoAxBranch] -> Branches Branched
unbranched :: CoAxBranch -> Branches Unbranched
fromBranches :: Branches br -> [CoAxBranch]
numBranches :: Branches br -> Int
-- | The [CoAxBranch] passed into the mapping function is a list
-- of all previous branches, reversed
mapAccumBranches :: ([CoAxBranch] -> CoAxBranch -> CoAxBranch) -> Branches br -> Branches br
-- | A CoAxiom is a "coercion constructor", i.e. a named equality
-- axiom.
data CoAxiom br
CoAxiom :: Unique -> Name -> Role -> TyCon -> Branches br -> Bool -> CoAxiom br
[co_ax_unique] :: CoAxiom br -> Unique
[co_ax_name] :: CoAxiom br -> Name
[co_ax_role] :: CoAxiom br -> Role
[co_ax_tc] :: CoAxiom br -> TyCon
[co_ax_branches] :: CoAxiom br -> Branches br
[co_ax_implicit] :: CoAxiom br -> Bool
data CoAxBranch
CoAxBranch :: SrcSpan -> [TyVar] -> [CoVar] -> [Role] -> [Type] -> Type -> [CoAxBranch] -> CoAxBranch
[cab_loc] :: CoAxBranch -> SrcSpan
[cab_tvs] :: CoAxBranch -> [TyVar]
[cab_cvs] :: CoAxBranch -> [CoVar]
[cab_roles] :: CoAxBranch -> [Role]
[cab_lhs] :: CoAxBranch -> [Type]
[cab_rhs] :: CoAxBranch -> Type
[cab_incomps] :: CoAxBranch -> [CoAxBranch]
toBranchedAxiom :: CoAxiom br -> CoAxiom Branched
toUnbranchedAxiom :: CoAxiom br -> CoAxiom Unbranched
coAxiomName :: CoAxiom br -> Name
coAxiomArity :: CoAxiom br -> BranchIndex -> Arity
coAxiomBranches :: CoAxiom br -> Branches br
coAxiomTyCon :: CoAxiom br -> TyCon
isImplicitCoAxiom :: CoAxiom br -> Bool
coAxiomNumPats :: CoAxiom br -> Int
coAxiomNthBranch :: CoAxiom br -> BranchIndex -> CoAxBranch
coAxiomSingleBranch_maybe :: CoAxiom br -> Maybe CoAxBranch
coAxiomRole :: CoAxiom br -> Role
coAxiomSingleBranch :: CoAxiom Unbranched -> CoAxBranch
coAxBranchTyVars :: CoAxBranch -> [TyVar]
coAxBranchCoVars :: CoAxBranch -> [CoVar]
coAxBranchRoles :: CoAxBranch -> [Role]
coAxBranchLHS :: CoAxBranch -> [Type]
coAxBranchRHS :: CoAxBranch -> Type
coAxBranchSpan :: CoAxBranch -> SrcSpan
coAxBranchIncomps :: CoAxBranch -> [CoAxBranch]
placeHolderIncomps :: [CoAxBranch]
data Role
Nominal :: Role
Representational :: Role
Phantom :: Role
fsFromRole :: Role -> FastString
-- | For now, we work only with nominal equality.
data CoAxiomRule
CoAxiomRule :: FastString -> [Role] -> Role -> ([TypeEqn] -> Maybe TypeEqn) -> CoAxiomRule
[coaxrName] :: CoAxiomRule -> FastString
[coaxrAsmpRoles] :: CoAxiomRule -> [Role]
[coaxrRole] :: CoAxiomRule -> Role
-- | coaxrProves returns Nothing when it doesn't like the supplied
-- arguments. When this happens in a coercion that means that the
-- coercion is ill-formed, and Core Lint checks for that.
[coaxrProves] :: CoAxiomRule -> [TypeEqn] -> Maybe TypeEqn
-- | A more explicit representation for `t1 ~ t2`.
type TypeEqn = Pair Type
data BuiltInSynFamily
BuiltInSynFamily :: ([Type] -> Maybe (CoAxiomRule, [Type], Type)) -> ([Type] -> Type -> [TypeEqn]) -> ([Type] -> Type -> [Type] -> Type -> [TypeEqn]) -> BuiltInSynFamily
[sfMatchFam] :: BuiltInSynFamily -> [Type] -> Maybe (CoAxiomRule, [Type], Type)
[sfInteractTop] :: BuiltInSynFamily -> [Type] -> Type -> [TypeEqn]
[sfInteractInert] :: BuiltInSynFamily -> [Type] -> Type -> [Type] -> Type -> [TypeEqn]
trivialBuiltInFamily :: BuiltInSynFamily
instance Data.Data.Data CoAxiom.CoAxBranch
instance Data.Data.Data CoAxiom.Role
instance GHC.Classes.Ord CoAxiom.Role
instance GHC.Classes.Eq CoAxiom.Role
instance Data.Data.Data CoAxiom.CoAxiomRule
instance Unique.Uniquable CoAxiom.CoAxiomRule
instance GHC.Classes.Eq CoAxiom.CoAxiomRule
instance GHC.Classes.Ord CoAxiom.CoAxiomRule
instance Outputable.Outputable CoAxiom.CoAxiomRule
instance GHC.Classes.Eq (CoAxiom.CoAxiom br)
instance Unique.Uniquable (CoAxiom.CoAxiom br)
instance Outputable.Outputable (CoAxiom.CoAxiom br)
instance Name.NamedThing (CoAxiom.CoAxiom br)
instance Data.Typeable.Internal.Typeable br => Data.Data.Data (CoAxiom.CoAxiom br)
instance Outputable.Outputable CoAxiom.CoAxBranch
instance Outputable.Outputable CoAxiom.Role
instance Binary.Binary CoAxiom.Role
module Class
data Class
type ClassOpItem = (Id, DefMethInfo)
data ClassATItem
ATI :: TyCon -> (Maybe (Type, SrcSpan)) -> ClassATItem
type ClassMinimalDef = BooleanFormula Name
type DefMethInfo = Maybe (Name, DefMethSpec Type)
pprDefMethInfo :: DefMethInfo -> SDoc
type FunDep a = ([a], [a])
pprFundeps :: Outputable a => [FunDep a] -> SDoc
pprFunDep :: Outputable a => FunDep a -> SDoc
mkClass :: Name -> [TyVar] -> [FunDep TyVar] -> [PredType] -> [Id] -> [ClassATItem] -> [ClassOpItem] -> ClassMinimalDef -> TyCon -> Class
mkAbstractClass :: Name -> [TyVar] -> [FunDep TyVar] -> TyCon -> Class
classTyVars :: Class -> [TyVar]
classArity :: Class -> Arity
classKey :: Class -> Unique
className :: Class -> Name
classATs :: Class -> [TyCon]
classATItems :: Class -> [ClassATItem]
classTyCon :: Class -> TyCon
classMethods :: Class -> [Id]
classOpItems :: Class -> [ClassOpItem]
classBigSig :: Class -> ([TyVar], [PredType], [Id], [ClassOpItem])
classExtraBigSig :: Class -> ([TyVar], [FunDep TyVar], [PredType], [Id], [ClassATItem], [ClassOpItem])
classTvsFds :: Class -> ([TyVar], [FunDep TyVar])
classSCTheta :: Class -> [PredType]
classAllSelIds :: Class -> [Id]
classSCSelId :: Class -> Int -> Id
classMinimalDef :: Class -> ClassMinimalDef
classHasFds :: Class -> Bool
isAbstractClass :: Class -> Bool
-- | If a class is "naturally coherent", then we needn't worry at all, in
-- any way, about overlapping/incoherent instances. Just solve the thing!
naturallyCoherentClass :: Class -> Bool
instance GHC.Classes.Eq Class.Class
instance Unique.Uniquable Class.Class
instance Name.NamedThing Class.Class
instance Outputable.Outputable Class.Class
instance Data.Data.Data Class.Class
module TyCon
-- | TyCons represent type constructors. Type constructors are introduced
-- by things such as:
--
-- 1) Data declarations: data Foo = ... creates the Foo
-- type constructor of kind *
--
-- 2) Type synonyms: type Foo = ... creates the Foo
-- type constructor
--
-- 3) Newtypes: newtype Foo a = MkFoo ... creates the
-- Foo type constructor of kind * -> *
--
-- 4) Class declarations: class Foo where creates the
-- Foo type constructor of kind *
--
-- This data type also encodes a number of primitive, built in type
-- constructors such as those for function and tuple types.
data TyCon
-- | Represents right-hand-sides of TyCons for algebraic types
data AlgTyConRhs
-- | Says that we know nothing about this data type, except that it's
-- represented by a pointer. Used when we export a data type abstractly
-- into an .hi file.
AbstractTyCon :: AlgTyConRhs
-- | Information about those TyCons derived from a data
-- declaration. This includes data types with no constructors at all.
DataTyCon :: [DataCon] -> Bool -> AlgTyConRhs
-- | The data type constructors; can be empty if the user declares the type
-- to have no constructors
--
-- INVARIANT: Kept in order of increasing DataCon tag (see the tag
-- assignment in DataCon.mkDataCon)
[data_cons] :: AlgTyConRhs -> [DataCon]
-- | Cached value: is this an enumeration type? See Note [Enumeration
-- types]
[is_enum] :: AlgTyConRhs -> Bool
TupleTyCon :: DataCon -> TupleSort -> AlgTyConRhs
-- | The unique constructor for the newtype. It has no
-- existentials
[data_con] :: AlgTyConRhs -> DataCon
-- | Is this a boxed, unboxed or constraint tuple?
[tup_sort] :: AlgTyConRhs -> TupleSort
SumTyCon :: [DataCon] -> AlgTyConRhs
-- | The data type constructors; can be empty if the user declares the type
-- to have no constructors
--
-- INVARIANT: Kept in order of increasing DataCon tag (see the tag
-- assignment in DataCon.mkDataCon)
[data_cons] :: AlgTyConRhs -> [DataCon]
-- | Information about those TyCons derived from a newtype
-- declaration
NewTyCon :: DataCon -> Type -> ([TyVar], Type) -> CoAxiom Unbranched -> AlgTyConRhs
-- | The unique constructor for the newtype. It has no
-- existentials
[data_con] :: AlgTyConRhs -> DataCon
-- | Cached value: the argument type of the constructor, which is just the
-- representation type of the TyCon (remember that
-- newtypes do not exist at runtime so need a different
-- representation type).
--
-- The free TyVars of this type are the tyConTyVars from
-- the corresponding TyCon
[nt_rhs] :: AlgTyConRhs -> Type
-- | Same as the nt_rhs, but this time eta-reduced. Hence the list
-- of TyVars in this field may be shorter than the declared arity
-- of the TyCon.
[nt_etad_rhs] :: AlgTyConRhs -> ([TyVar], Type)
[nt_co] :: AlgTyConRhs -> CoAxiom Unbranched
-- | Both type classes as well as family instances imply implicit type
-- constructors. These implicit type constructors refer to their parent
-- structure (ie, the class or family from which they derive) using a
-- type of the following form.
--
-- Extract those DataCons that we are able to learn about. Note
-- that visibility in this sense does not correspond to visibility in the
-- context of any particular user program!
visibleDataCons :: AlgTyConRhs -> [DataCon]
data AlgTyConFlav
-- | An ordinary type constructor has no parent.
VanillaAlgTyCon :: TyConRepName -> AlgTyConFlav
-- | An unboxed type constructor. The TyConRepName is a Maybe since we
-- currently don't allow unboxed sums to be Typeable since there are too
-- many of them. See #13276.
UnboxedAlgTyCon :: (Maybe TyConRepName) -> AlgTyConFlav
-- | Type constructors representing a class dictionary. See Note [ATyCon
-- for classes] in TyCoRep
ClassTyCon :: Class -> TyConRepName -> AlgTyConFlav
-- | Type constructors representing an *instance* of a *data* family.
-- Parameters:
--
-- 1) The type family in question
--
-- 2) Instance types; free variables are the tyConTyVars of the
-- current TyCon (not the family one). INVARIANT: the number of
-- types matches the arity of the family TyCon
--
-- 3) A CoTyCon identifying the representation type with the
-- type instance family
DataFamInstTyCon :: (CoAxiom Unbranched) -> TyCon -> [Type] -> AlgTyConFlav
isNoParent :: AlgTyConFlav -> Bool
-- | Information pertaining to the expansion of a type synonym
-- (type)
data FamTyConFlav
-- | Represents an open type family without a fixed right hand side.
-- Additional instances can appear at any time.
--
-- These are introduced by either a top level declaration:
--
--
-- data family T a :: *
--
--
-- Or an associated data type declaration, within a class declaration:
--
--
-- class C a b where
-- data T b :: *
--
DataFamilyTyCon :: TyConRepName -> FamTyConFlav
-- | An open type synonym family e.g. type family F x y :: * ->
-- *
OpenSynFamilyTyCon :: FamTyConFlav
-- | A closed type synonym family e.g. type family F x where { F Int =
-- Bool }
ClosedSynFamilyTyCon :: (Maybe (CoAxiom Branched)) -> FamTyConFlav
-- | A closed type synonym family declared in an hs-boot file with type
-- family F a where ..
AbstractClosedSynFamilyTyCon :: FamTyConFlav
-- | Built-in type family used by the TypeNats solver
BuiltInSynFamTyCon :: BuiltInSynFamily -> FamTyConFlav
data Role
Nominal :: Role
Representational :: Role
Phantom :: Role
data Injectivity
NotInjective :: Injectivity
Injective :: [Bool] -> Injectivity
-- | Some promoted datacons signify extra info relevant to GHC. For
-- example, the IntRep constructor of RuntimeRep
-- corresponds to the IntRep constructor of PrimRep. This
-- data structure allows us to store this information right in the
-- TyCon. The other approach would be to look up things like
-- RuntimeRep's PrimRep by known-key every time.
data RuntimeRepInfo
-- | an ordinary promoted data con
NoRRI :: RuntimeRepInfo
-- | A constructor of RuntimeRep. The argument to the function
-- should be the list of arguments to the promoted datacon.
RuntimeRep :: ([Type] -> [PrimRep]) -> RuntimeRepInfo
-- | A constructor of VecCount
VecCount :: Int -> RuntimeRepInfo
-- | A constructor of VecElem
VecElem :: PrimElemRep -> RuntimeRepInfo
type TyConBinder = TyVarBndr TyVar TyConBndrVis
data TyConBndrVis
NamedTCB :: ArgFlag -> TyConBndrVis
AnonTCB :: TyConBndrVis
mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder
mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder]
mkAnonTyConBinder :: TyVar -> TyConBinder
mkAnonTyConBinders :: [TyVar] -> [TyConBinder]
tyConBinderArgFlag :: TyConBinder -> ArgFlag
isNamedTyConBinder :: TyConBinder -> Bool
isVisibleTyConBinder :: TyVarBndr tv TyConBndrVis -> Bool
isInvisibleTyConBinder :: TyVarBndr tv TyConBndrVis -> Bool
-- | The labels for the fields of this particular TyCon
tyConFieldLabels :: TyCon -> [FieldLabel]
-- | Look up a field label belonging to this TyCon
lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel
-- | This is the making of an algebraic TyCon. Notably, you have to
-- pass in the generic (in the -XGenerics sense) information about the
-- type constructor - you can get hold of it easily (see Generics module)
mkAlgTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Maybe CType -> [PredType] -> AlgTyConRhs -> AlgTyConFlav -> Bool -> TyCon
-- | Simpler specialization of mkAlgTyCon for classes
mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon
-- | Given the name of the function type constructor and it's kind, create
-- the corresponding TyCon. It is recomended to use
-- funTyCon if you want this functionality
mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon
-- | Create an unlifted primitive TyCon, such as Int#.
mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
-- | Kind constructors
mkKindTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Name -> TyCon
-- | Create a lifted primitive TyCon such as RealWorld
mkLiftedPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon
mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon
-- | Create a type synonym TyCon
mkSynonymTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> Bool -> Bool -> TyCon
-- | Create a type family TyCon
mkFamilyTyCon :: Name -> [TyConBinder] -> Kind -> Maybe Name -> FamTyConFlav -> Maybe Class -> Injectivity -> TyCon
-- | Create a promoted data constructor TyCon Somewhat dodgily, we
-- give it the same Name as the data constructor itself; when we
-- pretty-print the TyCon we add a quote; see the Outputable TyCon
-- instance
mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon
-- | Makes a tycon suitable for use during type-checking. The only real
-- need for this is for printing error messages during a recursive
-- type/class type-checking knot. It has a kind because TcErrors
-- sometimes calls typeKind. See also Note [Kind checking recursive type
-- and class declarations] in TcTyClsDecls.
mkTcTyCon :: Name -> [TyConBinder] -> Kind -> Bool -> [TyVar] -> TyCon
-- | Returns True if the supplied TyCon resulted from
-- either a data or newtype declaration
isAlgTyCon :: TyCon -> Bool
-- | Returns True for vanilla AlgTyCons -- that is, those created
-- with a data or newtype declaration.
isVanillaAlgTyCon :: TyCon -> Bool
-- | Is this TyCon that for a class instance?
isClassTyCon :: TyCon -> Bool
-- | Is this TyCon that for a data family instance?
isFamInstTyCon :: TyCon -> Bool
isFunTyCon :: TyCon -> Bool
-- | Does this TyCon represent something that cannot be defined in
-- Haskell?
isPrimTyCon :: TyCon -> Bool
-- | Does this TyCon represent a tuple?
--
-- NB: when compiling Data.Tuple, the tycons won't reply
-- True to isTupleTyCon, because they are built as
-- AlgTyCons. However they get spat into the interface file as
-- tuple tycons, so I don't think it matters.
isTupleTyCon :: TyCon -> Bool
-- | Is this the TyCon for an unboxed tuple?
isUnboxedTupleTyCon :: TyCon -> Bool
-- | Is this the TyCon for a boxed tuple?
isBoxedTupleTyCon :: TyCon -> Bool
-- | Is this the TyCon for an unboxed sum?
isUnboxedSumTyCon :: TyCon -> Bool
-- | Is this the TyCon for a promoted tuple?
isPromotedTupleTyCon :: TyCon -> Bool
-- | Is this a TyCon representing a regular H98 type synonym
-- (type)?
isTypeSynonymTyCon :: TyCon -> Bool
-- | True iff we can decompose (T a b c) into ((T a b) c) I.e. is it
-- injective and generative w.r.t nominal equality? That is, if (T a b)
-- ~N d e f, is it always the case that (T ~N d), (a ~N e) and (b ~N f)?
-- Specifically NOT true of synonyms (open and otherwise)
--
-- It'd be unusual to call mightBeUnsaturatedTyCon on a regular H98 type
-- synonym, because you should probably have expanded it first But
-- regardless, it's not decomposable
mightBeUnsaturatedTyCon :: TyCon -> Bool
-- | Is this a PromotedDataCon?
isPromotedDataCon :: TyCon -> Bool
-- | Retrieves the promoted DataCon if this is a PromotedDataCon;
isPromotedDataCon_maybe :: TyCon -> Maybe DataCon
-- | Is this tycon really meant for use at the kind level? That is, should
-- it be permitted without -XDataKinds?
isKindTyCon :: TyCon -> Bool
isLiftedTypeKindTyConName :: Name -> Bool
isTauTyCon :: TyCon -> Bool
isFamFreeTyCon :: TyCon -> Bool
-- | Returns True for data types that are definitely
-- represented by heap-allocated constructors. These are scrutinised by
-- Core-level case expressions, and they get info tables
-- allocated for them.
--
-- Generally, the function will be true for all data types and
-- false for newtypes, unboxed tuples, unboxed sums and type
-- family TyCons. But it is not guaranteed to return True
-- in all cases that it could.
--
-- NB: for a data type family, only the instance TyCons get
-- an info table. The family declaration TyCon does not
isDataTyCon :: TyCon -> Bool
isProductTyCon :: TyCon -> Bool
isDataProductTyCon_maybe :: TyCon -> Maybe DataCon
isDataSumTyCon_maybe :: TyCon -> Maybe [DataCon]
-- | Is this an algebraic TyCon which is just an enumeration of
-- values?
isEnumerationTyCon :: TyCon -> Bool
-- | Is this TyCon that for a newtype
isNewTyCon :: TyCon -> Bool
-- | Test if the TyCon is algebraic but abstract (invisible data
-- constructors)
isAbstractTyCon :: TyCon -> Bool
-- | Is this a TyCon, synonym or otherwise, that defines a family?
isFamilyTyCon :: TyCon -> Bool
-- | Is this a TyCon, synonym or otherwise, that defines a family
-- with instances?
isOpenFamilyTyCon :: TyCon -> Bool
-- | Is this a synonym TyCon that can have may have further
-- instances appear?
isTypeFamilyTyCon :: TyCon -> Bool
-- | Is this a synonym TyCon that can have may have further
-- instances appear?
isDataFamilyTyCon :: TyCon -> Bool
-- | Is this an open type family TyCon?
isOpenTypeFamilyTyCon :: TyCon -> Bool
-- | Is this a non-empty closed type family? Returns Nothing for
-- abstract or empty closed families.
isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched)
-- | Try to read the injectivity information from a FamilyTyCon. For every
-- other TyCon this function panics.
familyTyConInjectivityInfo :: TyCon -> Injectivity
isBuiltInSynFamTyCon_maybe :: TyCon -> Maybe BuiltInSynFamily
-- | Is this TyCon unlifted (i.e. cannot contain bottom)? Note that
-- this can only be true for primitive and unboxed-tuple TyCons
isUnliftedTyCon :: TyCon -> Bool
-- | Is this an algebraic TyCon declared with the GADT syntax?
isGadtSyntaxTyCon :: TyCon -> Bool
-- | isInjectiveTyCon is true of TyCons for which this
-- property holds (where X is the role passed in): If (T a1 b1 c1) ~X (T
-- a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2) (where X1,
-- X2, and X3, are the roles given by tyConRolesX tc X) See also Note
-- [Decomposing equality] in TcCanonical
isInjectiveTyCon :: TyCon -> Role -> Bool
-- | isGenerativeTyCon is true of TyCons for which this
-- property holds (where X is the role passed in): If (T tys ~X t), then
-- (t's head ~X T). See also Note [Decomposing equality] in TcCanonical
isGenerativeTyCon :: TyCon -> Role -> Bool
-- | Is this an AlgTyConRhs of a TyCon that is generative and
-- injective with respect to representational equality?
isGenInjAlgRhs :: AlgTyConRhs -> Bool
-- | Are we able to extract information TyVar to class argument list
-- mapping from a given TyCon?
isTyConAssoc :: TyCon -> Bool
tyConAssoc_maybe :: TyCon -> Maybe Class
-- | Identifies implicit tycons that, in particular, do not go into
-- interface files (because they are implicitly reconstructed when the
-- interface is read).
--
-- Note that:
--
--
-- - Associated families are implicit, as they are re-constructed from
-- the class declaration in which they reside, and
-- - Family instances are not implicit as they represent the
-- instance body (similar to a dfun does that for a class
-- instance).
-- - Tuples are implicit iff they have a wired-in name (namely: boxed
-- and unboxed tupeles are wired-in and implicit, but constraint tuples
-- are not)
--
isImplicitTyCon :: TyCon -> Bool
-- | Check if the tycon actually refers to a proper `data` or `newtype`
-- with user defined constructors rather than one from a class or other
-- construction.
isTyConWithSrcDataCons :: TyCon -> Bool
-- | Is this a TcTyCon? (That is, one only used during type-checking?)
isTcTyCon :: TyCon -> Bool
-- | Could this TyCon ever be levity-polymorphic when fully applied? True
-- is safe. False means we're sure. Does only a quick check based on the
-- TyCon's category. Precondition: The fully-applied TyCon has kind (TYPE
-- blah)
isTcLevPoly :: TyCon -> Bool
-- | Name of the constructor
tyConName :: TyCon -> Name
-- | Returns whether or not this TyCon is definite, or a hole that
-- may be filled in at some later point. See Note [Skolem abstract data]
tyConSkolem :: TyCon -> Bool
-- | Kind of this TyCon
tyConKind :: TyCon -> Kind
-- | A Unique of this TyCon. Invariant: identical to Unique of Name stored
-- in tyConName field.
tyConUnique :: TyCon -> Unique
-- | TyVar binders
tyConTyVars :: TyCon -> [TyVar]
-- | The C type that should be used for this type when using the FFI and
-- CAPI
tyConCType :: TyCon -> Maybe CType
tyConCType_maybe :: TyCon -> Maybe CType
-- | As tyConDataCons_maybe, but returns the empty list of
-- constructors if no constructors could be found
tyConDataCons :: TyCon -> [DataCon]
-- | Determine the DataCons originating from the given TyCon,
-- if the TyCon is the sort that can have any constructors (note:
-- this does not include abstract algebraic types)
tyConDataCons_maybe :: TyCon -> Maybe [DataCon]
-- | If the given TyCon has a single data constructor, i.e.
-- it is a data type with one alternative, a tuple type or a
-- newtype then that constructor is returned. If the
-- TyCon has more than one constructor, or represents a primitive
-- or function type constructor then Nothing is returned. In any
-- other case, the function panics
tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon
tyConSingleDataCon :: TyCon -> DataCon
tyConSingleAlgDataCon_maybe :: TyCon -> Maybe DataCon
-- | Determine the number of value constructors a TyCon has. Panics
-- if the TyCon is not algebraic or a tuple
tyConFamilySize :: TyCon -> Int
-- | Find the "stupid theta" of the TyCon. A "stupid theta" is the
-- context to the left of an algebraic type declaration, e.g. Eq
-- a in the declaration data Eq a => T a ...
tyConStupidTheta :: TyCon -> [PredType]
-- | Arity
tyConArity :: TyCon -> Arity
-- | Get the list of roles for the type parameters of a TyCon
tyConRoles :: TyCon -> [Role]
tyConFlavour :: TyCon -> String
tyConTuple_maybe :: TyCon -> Maybe TupleSort
-- | If this TyCon is that for a class instance, return the class it
-- is for. Otherwise returns Nothing
tyConClass_maybe :: TyCon -> Maybe Class
-- | Return the associated types of the TyCon, if any
tyConATs :: TyCon -> [TyCon]
-- | If this TyCon is that of a data family instance, return the
-- family in question and the instance types. Otherwise, return
-- Nothing
tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type])
tyConFamInstSig_maybe :: TyCon -> Maybe (TyCon, [Type], CoAxiom Unbranched)
-- | If this TyCon is that of a data family instance, return a
-- TyCon which represents a coercion identifying the
-- representation type with the type instance family. Otherwise, return
-- Nothing
tyConFamilyCoercion_maybe :: TyCon -> Maybe (CoAxiom Unbranched)
-- | Extract type variable naming the result of injective type family
tyConFamilyResVar_maybe :: TyCon -> Maybe Name
-- | Extract the TyVars bound by a vanilla type synonym and the
-- corresponding (unsubstituted) right hand side.
synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type)
-- | Extract the information pertaining to the right hand side of a type
-- synonym (type) declaration.
synTyConRhs_maybe :: TyCon -> Maybe Type
-- | Extract the flavour of a type family (with all the extra information
-- that it carries)
famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav
-- | Name of result type variable, used for pretty-printing with
-- --show-iface and for reifying TyCon in Template Haskell
famTcResVar :: TyCon -> Maybe Name
-- | Extract an AlgTyConRhs with information about data constructors
-- from an algebraic or tuple TyCon. Panics for any other sort of
-- TyCon
algTyConRhs :: TyCon -> AlgTyConRhs
-- | Extract the bound type variables and type expansion of a type synonym
-- TyCon. Panics if the TyCon is not a synonym
newTyConRhs :: TyCon -> ([TyVar], Type)
-- | The number of type parameters that need to be passed to a newtype to
-- resolve it. May be less than in the definition if it can be
-- eta-contracted.
newTyConEtadArity :: TyCon -> Int
-- | Extract the bound type variables and type expansion of an
-- eta-contracted type synonym TyCon. Panics if the TyCon
-- is not a synonym
newTyConEtadRhs :: TyCon -> ([TyVar], Type)
-- | Take a TyCon apart into the TyVars it scopes over, the
-- Type it expands into, and (possibly) a coercion from the
-- representation type to the newtype. Returns Nothing
-- if this is not possible.
unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched)
unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched)
newTyConDataCon_maybe :: TyCon -> Maybe DataCon
-- | Maps a label to information about the field
algTcFields :: TyCon -> FieldLabelEnv
-- | Extract any RuntimeRepInfo from this TyCon
tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo
-- | Full binders
tyConBinders :: TyCon -> [TyConBinder]
-- | Result kind
tyConResKind :: TyCon -> Kind
-- | Scoped tyvars over the tycon's body. See Note [TcTyCon]
tcTyConScopedTyVars :: TyCon -> [TyVar]
-- | Expand a type synonym application, if any
expandSynTyCon_maybe :: TyCon -> [tyco] -> Maybe ([(TyVar, tyco)], Type, [tyco])
-- | Make an fake, recovery TyCon from an existing one. Used when
-- recovering from errors
makeRecoveryTyCon :: TyCon -> TyCon
newTyConCo :: TyCon -> CoAxiom Unbranched
-- | Extracts the newtype coercion from such a TyCon, which
-- can be used to construct something with the newtypes type
-- from its representation type (right hand side). If the supplied
-- TyCon is not a newtype, returns Nothing
newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched)
pprPromotionQuote :: TyCon -> SDoc
mkTyConKind :: [TyConBinder] -> Kind -> Kind
type TyConRepName = Name
tyConRepName_maybe :: TyCon -> Maybe TyConRepName
-- | Make a Name for the Typeable representation of the
-- given wired-in type
mkPrelTyConRepName :: Name -> TyConRepName
-- | The name (and defining module) for the Typeable representation (TyCon)
-- of a type constructor.
--
-- See Note [Grand plan for Typeable] in TcTypeable in
-- TcTypeable.
tyConRepModOcc :: Module -> OccName -> (Module, OccName)
-- | A PrimRep is an abstraction of a type. It contains information
-- that the code generator needs in order to pass arguments, return
-- results, and store values of this type.
data PrimRep
VoidRep :: PrimRep
LiftedRep :: PrimRep
-- | Unlifted pointer
UnliftedRep :: PrimRep
-- | Signed, word-sized value
IntRep :: PrimRep
-- | Unsigned, word-sized value
WordRep :: PrimRep
-- | Signed, 64 bit value (with 32-bit words only)
Int64Rep :: PrimRep
-- | Unsigned, 64 bit value (with 32-bit words only)
Word64Rep :: PrimRep
-- | A pointer, but not to a Haskell value (use '(Un)liftedRep')
AddrRep :: PrimRep
FloatRep :: PrimRep
DoubleRep :: PrimRep
-- | A vector
VecRep :: Int -> PrimElemRep -> PrimRep
data PrimElemRep
Int8ElemRep :: PrimElemRep
Int16ElemRep :: PrimElemRep
Int32ElemRep :: PrimElemRep
Int64ElemRep :: PrimElemRep
Word8ElemRep :: PrimElemRep
Word16ElemRep :: PrimElemRep
Word32ElemRep :: PrimElemRep
Word64ElemRep :: PrimElemRep
FloatElemRep :: PrimElemRep
DoubleElemRep :: PrimElemRep
isVoidRep :: PrimRep -> Bool
isGcPtrRep :: PrimRep -> Bool
-- | Find the size of a PrimRep, in words
primRepSizeW :: DynFlags -> PrimRep -> Int
primElemRepSizeB :: PrimElemRep -> Int
-- | Return if Rep stands for floating type, returns Nothing for vector
-- types.
primRepIsFloat :: PrimRep -> Maybe Bool
data RecTcChecker
initRecTc :: RecTcChecker
checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker
instance GHC.Show.Show TyCon.PrimRep
instance GHC.Classes.Eq TyCon.PrimRep
instance GHC.Show.Show TyCon.PrimElemRep
instance GHC.Classes.Eq TyCon.PrimElemRep
instance GHC.Classes.Eq TyCon.Injectivity
instance Outputable.Outputable tv => Outputable.Outputable (Var.TyVarBndr tv TyCon.TyConBndrVis)
instance Binary.Binary TyCon.TyConBndrVis
instance Outputable.Outputable TyCon.AlgTyConFlav
instance Outputable.Outputable TyCon.FamTyConFlav
instance GHC.Classes.Eq TyCon.TyCon
instance Unique.Uniquable TyCon.TyCon
instance Outputable.Outputable TyCon.TyCon
instance Name.NamedThing TyCon.TyCon
instance Data.Data.Data TyCon.TyCon
instance Outputable.Outputable TyCon.PrimRep
instance Outputable.Outputable TyCon.PrimElemRep
instance Binary.Binary TyCon.Injectivity
module IfaceType
type IfExtName = Name
type IfLclName = FastString
data IfaceType
IfaceFreeTyVar :: TyVar -> IfaceType
IfaceTyVar :: IfLclName -> IfaceType
IfaceLitTy :: IfaceTyLit -> IfaceType
IfaceAppTy :: IfaceType -> IfaceType -> IfaceType
IfaceFunTy :: IfaceType -> IfaceType -> IfaceType
IfaceDFunTy :: IfaceType -> IfaceType -> IfaceType
IfaceForAllTy :: IfaceForAllBndr -> IfaceType -> IfaceType
IfaceTyConApp :: IfaceTyCon -> IfaceTcArgs -> IfaceType
IfaceCastTy :: IfaceType -> IfaceCoercion -> IfaceType
IfaceCoercionTy :: IfaceCoercion -> IfaceType
IfaceTupleTy :: TupleSort -> IsPromoted -> IfaceTcArgs -> IfaceType
type IfacePredType = IfaceType
type IfaceKind = IfaceType
data IfaceCoercion
IfaceReflCo :: Role -> IfaceType -> IfaceCoercion
IfaceFunCo :: Role -> IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceTyConAppCo :: Role -> IfaceTyCon -> [IfaceCoercion] -> IfaceCoercion
IfaceAppCo :: IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceForAllCo :: IfaceTvBndr -> IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceCoVarCo :: IfLclName -> IfaceCoercion
IfaceAxiomInstCo :: IfExtName -> BranchIndex -> [IfaceCoercion] -> IfaceCoercion
IfaceUnivCo :: IfaceUnivCoProv -> Role -> IfaceType -> IfaceType -> IfaceCoercion
IfaceSymCo :: IfaceCoercion -> IfaceCoercion
IfaceTransCo :: IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceNthCo :: Int -> IfaceCoercion -> IfaceCoercion
IfaceLRCo :: LeftOrRight -> IfaceCoercion -> IfaceCoercion
IfaceInstCo :: IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceCoherenceCo :: IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceKindCo :: IfaceCoercion -> IfaceCoercion
IfaceSubCo :: IfaceCoercion -> IfaceCoercion
IfaceAxiomRuleCo :: IfLclName -> [IfaceCoercion] -> IfaceCoercion
data IfaceUnivCoProv
IfaceUnsafeCoerceProv :: IfaceUnivCoProv
IfacePhantomProv :: IfaceCoercion -> IfaceUnivCoProv
IfaceProofIrrelProv :: IfaceCoercion -> IfaceUnivCoProv
IfacePluginProv :: String -> IfaceUnivCoProv
-- | See Note [Holes in IfaceUnivCoProv]
IfaceHoleProv :: Unique -> IfaceUnivCoProv
data IfaceTyCon
IfaceTyCon :: IfExtName -> IfaceTyConInfo -> IfaceTyCon
[ifaceTyConName] :: IfaceTyCon -> IfExtName
[ifaceTyConInfo] :: IfaceTyCon -> IfaceTyConInfo
data IfaceTyConInfo
IfaceTyConInfo :: IsPromoted -> IfaceTyConSort -> IfaceTyConInfo
[ifaceTyConIsPromoted] :: IfaceTyConInfo -> IsPromoted
[ifaceTyConSort] :: IfaceTyConInfo -> IfaceTyConSort
-- | The various types of TyCons which have special, built-in syntax.
data IfaceTyConSort
-- | a regular tycon
IfaceNormalTyCon :: IfaceTyConSort
-- | e.g. (a, b, c) or (). The arity is the tuple width,
-- not the tycon arity (which is twice the width in the case of unboxed
-- tuples).
IfaceTupleTyCon :: !Arity -> !TupleSort -> IfaceTyConSort
-- | e.g. (a | b | c)
IfaceSumTyCon :: !Arity -> IfaceTyConSort
-- | a type equality. True indicates kind-homogeneous. See Note
-- [Equality predicates in IfaceType] for details.
IfaceEqualityTyCon :: !Bool -> IfaceTyConSort
-- | Is a TyCon a promoted data constructor or just a normal type
-- constructor?
data IsPromoted
IsNotPromoted :: IsPromoted
IsPromoted :: IsPromoted
data IfaceTyLit
IfaceNumTyLit :: Integer -> IfaceTyLit
IfaceStrTyLit :: FastString -> IfaceTyLit
data IfaceTcArgs
ITC_Nil :: IfaceTcArgs
ITC_Vis :: IfaceType -> IfaceTcArgs -> IfaceTcArgs
ITC_Invis :: IfaceKind -> IfaceTcArgs -> IfaceTcArgs
type IfaceContext = [IfacePredType]
data IfaceBndr
IfaceIdBndr :: {-# UNPACK #-} !IfaceIdBndr -> IfaceBndr
IfaceTvBndr :: {-# UNPACK #-} !IfaceTvBndr -> IfaceBndr
data IfaceOneShot
IfaceNoOneShot :: IfaceOneShot
IfaceOneShot :: IfaceOneShot
type IfaceLamBndr = (IfaceBndr, IfaceOneShot)
type IfaceTvBndr = (IfLclName, IfaceKind)
type IfaceIdBndr = (IfLclName, IfaceType)
type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis
type IfaceForAllBndr = TyVarBndr IfaceTvBndr ArgFlag
-- | Argument Flag
--
-- Is something required to appear in source Haskell (Required),
-- permitted by request (Specified) (visible type application), or
-- prohibited entirely from appearing in source Haskell
-- (Inferred)? See Note [TyBinders and ArgFlags] in TyCoRep
data ArgFlag
Required :: ArgFlag
Specified :: ArgFlag
Inferred :: ArgFlag
-- | Show forall flag
--
-- Unconditionally show the forall quantifier with
-- (ShowForAllMust) or when (ShowForAllWhen) the names used
-- are free in the binder or when compiling with
-- -fprint-explicit-foralls.
data ShowForAllFlag
ShowForAllMust :: ShowForAllFlag
ShowForAllWhen :: ShowForAllFlag
-- | Extract a IfaceTvBndr from a IfaceTyConBinder
ifTyConBinderTyVar :: IfaceTyConBinder -> IfaceTvBndr
-- | Extract the variable name from a IfaceTyConBinder
ifTyConBinderName :: IfaceTyConBinder -> IfLclName
data IfRnEnv2
emptyIfRnEnv2 :: IfRnEnv2
eqIfaceType :: IfRnEnv2 -> IfaceType -> IfaceType -> Bool
eqIfaceTypes :: IfRnEnv2 -> [IfaceType] -> [IfaceType] -> Bool
eqIfaceTcArgs :: IfRnEnv2 -> IfaceTcArgs -> IfaceTcArgs -> Bool
-- | Similar to eqTyVarBndrs, checks that tyvar lists are the same
-- length and have matching kinds; if so, extend the IfRnEnv2.
-- Returns Nothing if they don't match.
eqIfaceTvBndrs :: IfRnEnv2 -> [IfaceTvBndr] -> [IfaceTvBndr] -> Maybe IfRnEnv2
isIfaceLiftedTypeKind :: IfaceKind -> Bool
tcArgsIfaceTypes :: IfaceTcArgs -> [IfaceType]
pprIfaceType :: IfaceType -> SDoc
pprParendIfaceType :: IfaceType -> SDoc
-- | Prints a context or () if empty. This is used when, e.g., we
-- want to display a context in an error message.
pprIfaceContext :: [IfacePredType] -> SDoc
-- | Prints "(C a, D b) =>", including the arrow. This is used when we
-- want to print a context in a type.
pprIfaceContextArr :: [IfacePredType] -> SDoc
pprIfaceIdBndr :: IfaceIdBndr -> SDoc
pprIfaceLamBndr :: IfaceLamBndr -> SDoc
pprIfaceTvBndr :: Bool -> IfaceTvBndr -> SDoc
pprIfaceTyConBinders :: [IfaceTyConBinder] -> SDoc
pprIfaceBndrs :: [IfaceBndr] -> SDoc
pprIfaceTcArgs :: IfaceTcArgs -> SDoc
pprParendIfaceTcArgs :: IfaceTcArgs -> SDoc
pprIfaceForAllPart :: [IfaceForAllBndr] -> [IfacePredType] -> SDoc -> SDoc
-- | Render the "forall ... ." or "forall ... ->" bit of a type.
pprIfaceForAll :: [IfaceForAllBndr] -> SDoc
pprIfaceSigmaType :: ShowForAllFlag -> IfaceType -> SDoc
pprIfaceTyLit :: IfaceTyLit -> SDoc
pprIfaceCoercion :: IfaceCoercion -> SDoc
pprParendIfaceCoercion :: IfaceCoercion -> SDoc
splitIfaceSigmaTy :: IfaceType -> ([IfaceForAllBndr], [IfacePredType], IfaceType)
pprIfaceTypeApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> SDoc
pprUserIfaceForAll :: [IfaceForAllBndr] -> SDoc
pprIfaceCoTcApp :: TyPrec -> IfaceTyCon -> [IfaceCoercion] -> SDoc
pprTyTcApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> SDoc
pprIfacePrefixApp :: TyPrec -> SDoc -> [SDoc] -> SDoc
suppressIfaceInvisibles :: DynFlags -> [IfaceTyConBinder] -> [a] -> [a]
stripIfaceInvisVars :: DynFlags -> [IfaceTyConBinder] -> [IfaceTyConBinder]
stripInvisArgs :: DynFlags -> IfaceTcArgs -> IfaceTcArgs
substIfaceType :: IfaceTySubst -> IfaceType -> IfaceType
substIfaceTyVar :: IfaceTySubst -> IfLclName -> IfaceType
substIfaceTcArgs :: IfaceTySubst -> IfaceTcArgs -> IfaceTcArgs
mkIfaceTySubst :: [IfaceTvBndr] -> [IfaceType] -> IfaceTySubst
eqIfaceTvBndr :: IfaceTvBndr -> IfaceTvBndr -> Bool
instance GHC.Classes.Eq IfaceType.IfaceTyLit
instance GHC.Classes.Eq IfaceType.IfaceTyConSort
instance GHC.Classes.Eq IfaceType.IfaceTyConInfo
instance GHC.Classes.Eq IfaceType.IfaceTyCon
instance GHC.Classes.Eq IfaceType.IsPromoted
instance Outputable.Outputable IfaceType.IfaceBndr
instance Binary.Binary IfaceType.IfaceBndr
instance GHC.Base.Monoid IfaceType.IfaceTcArgs
instance Outputable.Outputable IfaceType.IfaceType
instance Outputable.Outputable IfaceType.IfaceTcArgs
instance Outputable.Outputable IfaceType.IfaceTyCon
instance Outputable.Outputable IfaceType.IfaceCoercion
instance Binary.Binary IfaceType.IfaceTyCon
instance Binary.Binary IfaceType.IfaceTyConSort
instance Binary.Binary IfaceType.IfaceTyConInfo
instance Outputable.Outputable IfaceType.IfaceTyLit
instance Binary.Binary IfaceType.IfaceTyLit
instance Binary.Binary IfaceType.IfaceTcArgs
instance Binary.Binary IfaceType.IfaceType
instance Binary.Binary IfaceType.IfaceCoercion
instance Binary.Binary IfaceType.IfaceUnivCoProv
instance Binary.Binary (BasicTypes.DefMethSpec IfaceType.IfaceType)
instance Binary.Binary IfaceType.IsPromoted
instance Binary.Binary IfaceType.IfaceOneShot
module VarSet
-- | A non-deterministic Variable Set
--
-- A non-deterministic set of variables. See Note [Deterministic UniqFM]
-- in UniqDFM for explanation why it's not deterministic and why it
-- matters. Use DVarSet if the set eventually gets converted into a list
-- or folded over in a way where the order changes the generated code,
-- for example when abstracting variables.
type VarSet = UniqSet Var
-- | Identifier Set
type IdSet = UniqSet Id
-- | Type Variable Set
type TyVarSet = UniqSet TyVar
-- | Coercion Variable Set
type CoVarSet = UniqSet CoVar
-- | Type or Coercion Variable Set
type TyCoVarSet = UniqSet TyCoVar
emptyVarSet :: VarSet
unitVarSet :: Var -> VarSet
mkVarSet :: [Var] -> VarSet
extendVarSet :: VarSet -> Var -> VarSet
extendVarSetList :: VarSet -> [Var] -> VarSet
elemVarSet :: Var -> VarSet -> Bool
subVarSet :: VarSet -> VarSet -> Bool
unionVarSet :: VarSet -> VarSet -> VarSet
unionVarSets :: [VarSet] -> VarSet
-- | map the function over the list, and union the results
mapUnionVarSet :: (a -> VarSet) -> [a] -> VarSet
intersectVarSet :: VarSet -> VarSet -> VarSet
intersectsVarSet :: VarSet -> VarSet -> Bool
disjointVarSet :: VarSet -> VarSet -> Bool
isEmptyVarSet :: VarSet -> Bool
delVarSet :: VarSet -> Var -> VarSet
delVarSetList :: VarSet -> [Var] -> VarSet
delVarSetByKey :: VarSet -> Unique -> VarSet
minusVarSet :: VarSet -> VarSet -> VarSet
filterVarSet :: (Var -> Bool) -> VarSet -> VarSet
anyVarSet :: (Var -> Bool) -> VarSet -> Bool
allVarSet :: (Var -> Bool) -> VarSet -> Bool
transCloVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet
fixVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet
lookupVarSet_Directly :: VarSet -> Unique -> Maybe Var
lookupVarSet :: VarSet -> Var -> Maybe Var
lookupVarSetByName :: VarSet -> Name -> Maybe Var
sizeVarSet :: VarSet -> Int
seqVarSet :: VarSet -> ()
elemVarSetByKey :: Unique -> VarSet -> Bool
partitionVarSet :: (Var -> Bool) -> VarSet -> (VarSet, VarSet)
-- | Determines the pluralisation suffix appropriate for the length of a
-- set in the same way that plural from Outputable does for lists.
pluralVarSet :: VarSet -> SDoc
-- | Pretty-print a non-deterministic set. The order of variables is
-- non-deterministic and for pretty-printing that shouldn't be a problem.
-- Having this function helps contain the non-determinism created with
-- nonDetEltsUFM. Passing a list to the pretty-printing function allows
-- the caller to decide on the order of Vars (eg. toposort them) without
-- them having to use nonDetEltsUFM at the call site. This prevents from
-- let-binding non-deterministically ordered lists and reusing them where
-- determinism matters.
pprVarSet :: VarSet -> ([Var] -> SDoc) -> SDoc
-- | Deterministic Variable Set
type DVarSet = UniqDSet Var
-- | Deterministic Identifier Set
type DIdSet = UniqDSet Id
-- | Deterministic Type Variable Set
type DTyVarSet = UniqDSet TyVar
-- | Deterministic Type or Coercion Variable Set
type DTyCoVarSet = UniqDSet TyCoVar
emptyDVarSet :: DVarSet
unitDVarSet :: Var -> DVarSet
mkDVarSet :: [Var] -> DVarSet
extendDVarSet :: DVarSet -> Var -> DVarSet
-- | Add a list of variables to DVarSet
extendDVarSetList :: DVarSet -> [Var] -> DVarSet
elemDVarSet :: Var -> DVarSet -> Bool
dVarSetElems :: DVarSet -> [Var]
subDVarSet :: DVarSet -> DVarSet -> Bool
unionDVarSet :: DVarSet -> DVarSet -> DVarSet
unionDVarSets :: [DVarSet] -> DVarSet
-- | Map the function over the list, and union the results
mapUnionDVarSet :: (a -> DVarSet) -> [a] -> DVarSet
intersectDVarSet :: DVarSet -> DVarSet -> DVarSet
-- | True if non-empty intersection
intersectsDVarSet :: DVarSet -> DVarSet -> Bool
-- | True if empty intersection
disjointDVarSet :: DVarSet -> DVarSet -> Bool
isEmptyDVarSet :: DVarSet -> Bool
delDVarSet :: DVarSet -> Var -> DVarSet
-- | Delete a list of variables from DVarSet
delDVarSetList :: DVarSet -> [Var] -> DVarSet
minusDVarSet :: DVarSet -> DVarSet -> DVarSet
foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a
filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet
dVarSetMinusVarSet :: DVarSet -> VarSet -> DVarSet
anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool
allDVarSet :: (Var -> Bool) -> DVarSet -> Bool
-- | transCloVarSet for DVarSet
transCloDVarSet :: (DVarSet -> DVarSet) -> DVarSet -> DVarSet
sizeDVarSet :: DVarSet -> Int
seqDVarSet :: DVarSet -> ()
-- | Partition DVarSet according to the predicate given
partitionDVarSet :: (Var -> Bool) -> DVarSet -> (DVarSet, DVarSet)
-- | Convert a DVarSet to a VarSet by forgeting the order of insertion
dVarSetToVarSet :: DVarSet -> VarSet
module VarEnv
-- | Variable Environment
type VarEnv elt = UniqFM elt
-- | Identifier Environment
type IdEnv elt = VarEnv elt
-- | Type Variable Environment
type TyVarEnv elt = VarEnv elt
-- | Coercion Variable Environment
type CoVarEnv elt = VarEnv elt
-- | Type or Coercion Variable Environment
type TyCoVarEnv elt = VarEnv elt
emptyVarEnv :: VarEnv a
unitVarEnv :: Var -> a -> VarEnv a
mkVarEnv :: [(Var, a)] -> VarEnv a
mkVarEnv_Directly :: [(Unique, a)] -> VarEnv a
elemVarEnv :: Var -> VarEnv a -> Bool
disjointVarEnv :: VarEnv a -> VarEnv a -> Bool
extendVarEnv :: VarEnv a -> Var -> a -> VarEnv a
extendVarEnv_C :: (a -> a -> a) -> VarEnv a -> Var -> a -> VarEnv a
extendVarEnv_Acc :: (a -> b -> b) -> (a -> b) -> VarEnv b -> Var -> a -> VarEnv b
extendVarEnv_Directly :: VarEnv a -> Unique -> a -> VarEnv a
extendVarEnvList :: VarEnv a -> [(Var, a)] -> VarEnv a
plusVarEnv :: VarEnv a -> VarEnv a -> VarEnv a
plusVarEnv_C :: (a -> a -> a) -> VarEnv a -> VarEnv a -> VarEnv a
plusVarEnv_CD :: (a -> a -> a) -> VarEnv a -> a -> VarEnv a -> a -> VarEnv a
plusMaybeVarEnv_C :: (a -> a -> Maybe a) -> VarEnv a -> VarEnv a -> VarEnv a
plusVarEnvList :: [VarEnv a] -> VarEnv a
alterVarEnv :: (Maybe a -> Maybe a) -> VarEnv a -> Var -> VarEnv a
delVarEnvList :: VarEnv a -> [Var] -> VarEnv a
delVarEnv :: VarEnv a -> Var -> VarEnv a
delVarEnv_Directly :: VarEnv a -> Unique -> VarEnv a
minusVarEnv :: VarEnv a -> VarEnv b -> VarEnv a
intersectsVarEnv :: VarEnv a -> VarEnv a -> Bool
lookupVarEnv :: VarEnv a -> Var -> Maybe a
lookupVarEnv_NF :: VarEnv a -> Var -> a
lookupWithDefaultVarEnv :: VarEnv a -> a -> Var -> a
mapVarEnv :: (a -> b) -> VarEnv a -> VarEnv b
zipVarEnv :: [Var] -> [a] -> VarEnv a
modifyVarEnv :: (a -> a) -> VarEnv a -> Var -> VarEnv a
modifyVarEnv_Directly :: (a -> a) -> UniqFM a -> Unique -> UniqFM a
isEmptyVarEnv :: VarEnv a -> Bool
elemVarEnvByKey :: Unique -> VarEnv a -> Bool
lookupVarEnv_Directly :: VarEnv a -> Unique -> Maybe a
filterVarEnv :: (a -> Bool) -> VarEnv a -> VarEnv a
filterVarEnv_Directly :: (Unique -> a -> Bool) -> VarEnv a -> VarEnv a
restrictVarEnv :: VarEnv a -> VarSet -> VarEnv a
partitionVarEnv :: (a -> Bool) -> VarEnv a -> (VarEnv a, VarEnv a)
-- | Deterministic Variable Environment
type DVarEnv elt = UniqDFM elt
-- | Deterministic Identifier Environment
type DIdEnv elt = DVarEnv elt
-- | Deterministic Type Variable Environment
type DTyVarEnv elt = DVarEnv elt
emptyDVarEnv :: DVarEnv a
mkDVarEnv :: [(Var, a)] -> DVarEnv a
dVarEnvElts :: DVarEnv a -> [a]
extendDVarEnv :: DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnvList :: DVarEnv a -> [(Var, a)] -> DVarEnv a
lookupDVarEnv :: DVarEnv a -> Var -> Maybe a
elemDVarEnv :: Var -> DVarEnv a -> Bool
isEmptyDVarEnv :: DVarEnv a -> Bool
foldDVarEnv :: (a -> b -> b) -> b -> DVarEnv a -> b
mapDVarEnv :: (a -> b) -> DVarEnv a -> DVarEnv b
modifyDVarEnv :: (a -> a) -> DVarEnv a -> Var -> DVarEnv a
alterDVarEnv :: (Maybe a -> Maybe a) -> DVarEnv a -> Var -> DVarEnv a
plusDVarEnv :: DVarEnv a -> DVarEnv a -> DVarEnv a
plusDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> DVarEnv a -> DVarEnv a
unitDVarEnv :: Var -> a -> DVarEnv a
delDVarEnv :: DVarEnv a -> Var -> DVarEnv a
delDVarEnvList :: DVarEnv a -> [Var] -> DVarEnv a
minusDVarEnv :: DVarEnv a -> DVarEnv a' -> DVarEnv a
partitionDVarEnv :: (a -> Bool) -> DVarEnv a -> (DVarEnv a, DVarEnv a)
anyDVarEnv :: (a -> Bool) -> DVarEnv a -> Bool
-- | A set of variables that are in scope at some point "Secrets of the
-- Glasgow Haskell Compiler inliner" Section 3.2 provides the motivation
-- for this abstraction.
data InScopeSet
emptyInScopeSet :: InScopeSet
mkInScopeSet :: VarSet -> InScopeSet
delInScopeSet :: InScopeSet -> Var -> InScopeSet
extendInScopeSet :: InScopeSet -> Var -> InScopeSet
extendInScopeSetList :: InScopeSet -> [Var] -> InScopeSet
extendInScopeSetSet :: InScopeSet -> VarSet -> InScopeSet
getInScopeVars :: InScopeSet -> VarSet
-- | Look up a variable the InScopeSet. This lets you map from the
-- variable's identity (unique) to its full value.
lookupInScope :: InScopeSet -> Var -> Maybe Var
lookupInScope_Directly :: InScopeSet -> Unique -> Maybe Var
unionInScope :: InScopeSet -> InScopeSet -> InScopeSet
elemInScopeSet :: Var -> InScopeSet -> Bool
-- | uniqAway in_scope v finds a unique that is not used in the
-- in-scope set, and gives that to v.
uniqAway :: InScopeSet -> Var -> Var
varSetInScope :: VarSet -> InScopeSet -> Bool
-- | Rename Environment 2
--
-- When we are comparing (or matching) types or terms, we are faced with
-- "going under" corresponding binders. E.g. when comparing:
--
--
-- \x. e1 ~ \y. e2
--
--
-- Basically we want to rename [x -> y] or
-- [y -> x], but there are lots of things we must be
-- careful of. In particular, x might be free in e2, or
-- y in e1. So the idea is that we come up with a fresh binder
-- that is free in neither, and rename x and y
-- respectively. That means we must maintain:
--
--
-- - A renaming for the left-hand expression
-- - A renaming for the right-hand expressions
-- - An in-scope set
--
--
-- Furthermore, when matching, we want to be able to have an 'occurs
-- check', to prevent:
--
--
-- \x. f ~ \y. y
--
--
-- matching with [f -> y]. So for each expression we
-- want to know that set of locally-bound variables. That is precisely
-- the domain of the mappings 1. and 2., but we must ensure that we
-- always extend the mappings as we go in.
--
-- All of this information is bundled up in the RnEnv2
data RnEnv2
mkRnEnv2 :: InScopeSet -> RnEnv2
-- | rnBndr2 env bL bR goes under a binder bL in the Left
-- term, and binder bR in the Right term. It finds a new binder,
-- new_b, and returns an environment mapping bL ->
-- new_b and bR -> new_b
rnBndr2 :: RnEnv2 -> Var -> Var -> RnEnv2
-- | Applies rnBndr2 to several variables: the two variable lists
-- must be of equal length
rnBndrs2 :: RnEnv2 -> [Var] -> [Var] -> RnEnv2
-- | Similar to rnBndr2 but returns the new variable as well as the
-- new environment
rnBndr2_var :: RnEnv2 -> Var -> Var -> (RnEnv2, Var)
-- | Look up the renaming of an occurrence in the left or right term
rnOccL :: RnEnv2 -> Var -> Var
-- | Look up the renaming of an occurrence in the left or right term
rnOccR :: RnEnv2 -> Var -> Var
-- | Tells whether a variable is locally bound
inRnEnvL :: RnEnv2 -> Var -> Bool
-- | Tells whether a variable is locally bound
inRnEnvR :: RnEnv2 -> Var -> Bool
-- | Look up the renaming of an occurrence in the left or right term
rnOccL_maybe :: RnEnv2 -> Var -> Maybe Var
-- | Look up the renaming of an occurrence in the left or right term
rnOccR_maybe :: RnEnv2 -> Var -> Maybe Var
-- | Similar to rnBndr2 but used when there's a binder on the left
-- side only.
rnBndrL :: RnEnv2 -> Var -> (RnEnv2, Var)
-- | Similar to rnBndr2 but used when there's a binder on the right
-- side only.
rnBndrR :: RnEnv2 -> Var -> (RnEnv2, Var)
-- | Wipe the left or right side renaming
nukeRnEnvL :: RnEnv2 -> RnEnv2
-- | Wipe the left or right side renaming
nukeRnEnvR :: RnEnv2 -> RnEnv2
-- | swap the meaning of left and right
rnSwap :: RnEnv2 -> RnEnv2
delBndrL :: RnEnv2 -> Var -> RnEnv2
delBndrR :: RnEnv2 -> Var -> RnEnv2
delBndrsL :: RnEnv2 -> [Var] -> RnEnv2
delBndrsR :: RnEnv2 -> [Var] -> RnEnv2
addRnInScopeSet :: RnEnv2 -> VarSet -> RnEnv2
-- | Similar to rnBndrL but used for eta expansion See Note [Eta
-- expansion]
rnEtaL :: RnEnv2 -> Var -> (RnEnv2, Var)
-- | Similar to rnBndr2 but used for eta expansion See Note [Eta
-- expansion]
rnEtaR :: RnEnv2 -> Var -> (RnEnv2, Var)
rnInScope :: Var -> RnEnv2 -> Bool
rnInScopeSet :: RnEnv2 -> InScopeSet
lookupRnInScope :: RnEnv2 -> Var -> Var
-- | Retrieve the left mapping
rnEnvL :: RnEnv2 -> VarEnv Var
-- | Retrieve the right mapping
rnEnvR :: RnEnv2 -> VarEnv Var
-- | Tidy Environment
--
-- When tidying up print names, we keep a mapping of in-scope occ-names
-- (the TidyOccEnv) and a Var-to-Var of the current renamings
type TidyEnv = (TidyOccEnv, VarEnv Var)
emptyTidyEnv :: TidyEnv
instance Outputable.Outputable VarEnv.InScopeSet
module FV
type FV = InterestingVarFun -> VarSet -> ([Var], VarSet) -> ([Var], VarSet)
-- | Predicate on possible free variables: returns True iff the
-- variable is interesting
type InterestingVarFun = Var -> Bool
-- | Run a free variable computation, returning a list of distinct free
-- variables in deterministic order and a non-deterministic set
-- containing those variables.
fvVarListVarSet :: FV -> ([Var], VarSet)
-- | Run a free variable computation, returning a list of distinct free
-- variables in deterministic order.
fvVarList :: FV -> [Var]
-- | Run a free variable computation, returning a non-deterministic set of
-- free variables. Don't use if the set will be later converted to a list
-- and the order of that list will impact the generated code.
fvVarSet :: FV -> VarSet
-- | Run a free variable computation, returning a deterministic set of free
-- variables. Note that this is just a wrapper around the version that
-- returns a deterministic list. If you need a list you should use
-- fvVarList.
fvDVarSet :: FV -> DVarSet
-- | Add a variable - when free, to the returned free variables. Ignores
-- duplicates and respects the filtering function.
unitFV :: Id -> FV
-- | Return no free variables.
emptyFV :: FV
-- | Add multiple variables - when free, to the returned free variables.
-- Ignores duplicates and respects the filtering function.
mkFVs :: [Var] -> FV
-- | Union two free variable computations.
unionFV :: FV -> FV -> FV
-- | Union many free variable computations.
unionsFV :: [FV] -> FV
-- | Mark the variable as not free by putting it in scope.
delFV :: Var -> FV -> FV
-- | Mark many free variables as not free.
delFVs :: VarSet -> FV -> FV
-- | Filter a free variable computation.
filterFV :: InterestingVarFun -> FV -> FV
-- | Map a free variable computation over a list and union the results.
mapUnionFV :: (a -> FV) -> [a] -> FV
-- | This module defines TyCons that can't be expressed in Haskell. They
-- are all, therefore, wired-in TyCons. C.f module TysWiredIn
module TysPrim
mkPrimTyConName :: FastString -> Unique -> TyCon -> Name
mkTemplateKindVars :: [Kind] -> [TyVar]
mkTemplateTyVars :: [Kind] -> [TyVar]
mkTemplateTyVarsFrom :: Int -> [Kind] -> [TyVar]
mkTemplateKiTyVars :: [Kind] -> ([Kind] -> [Kind]) -> [TyVar]
mkTemplateTyConBinders :: [Kind] -> ([Kind] -> [Kind]) -> [TyConBinder]
mkTemplateKindTyConBinders :: [Kind] -> [TyConBinder]
mkTemplateAnonTyConBinders :: [Kind] -> [TyConBinder]
alphaTyVars :: [TyVar]
alphaTyVar :: TyVar
betaTyVar :: TyVar
gammaTyVar :: TyVar
deltaTyVar :: TyVar
alphaTys :: [Type]
alphaTy :: Type
betaTy :: Type
gammaTy :: Type
deltaTy :: Type
runtimeRep1TyVar :: TyVar
runtimeRep2TyVar :: TyVar
runtimeRep1Ty :: Type
runtimeRep2Ty :: Type
openAlphaTy :: Type
openBetaTy :: Type
openAlphaTyVar :: TyVar
openBetaTyVar :: TyVar
tYPETyCon :: TyCon
tYPETyConName :: Name
-- | Given a RuntimeRep, applies TYPE to it. see Note [TYPE and RuntimeRep]
tYPE :: Type -> Type
-- | Convert a PrimRep to a Type of kind RuntimeRep Defined
-- here to avoid (more) module loops
primRepToRuntimeRep :: PrimRep -> Type
-- | The (->) type constructor.
--
--
-- (->) :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
-- TYPE rep1 -> TYPE rep2 -> *
--
funTyCon :: TyCon
funTyConName :: Name
primTyCons :: [TyCon]
charPrimTyCon :: TyCon
charPrimTy :: Type
charPrimTyConName :: Name
intPrimTyCon :: TyCon
intPrimTy :: Type
intPrimTyConName :: Name
wordPrimTyCon :: TyCon
wordPrimTy :: Type
wordPrimTyConName :: Name
addrPrimTyCon :: TyCon
addrPrimTy :: Type
addrPrimTyConName :: Name
floatPrimTyCon :: TyCon
floatPrimTy :: Type
floatPrimTyConName :: Name
doublePrimTyCon :: TyCon
doublePrimTy :: Type
doublePrimTyConName :: Name
voidPrimTyCon :: TyCon
voidPrimTy :: Type
statePrimTyCon :: TyCon
mkStatePrimTy :: Type -> Type
realWorldTyCon :: TyCon
realWorldTy :: Type
realWorldStatePrimTy :: Type
proxyPrimTyCon :: TyCon
mkProxyPrimTy :: Type -> Type -> Type
arrayPrimTyCon :: TyCon
mkArrayPrimTy :: Type -> Type
byteArrayPrimTyCon :: TyCon
byteArrayPrimTy :: Type
arrayArrayPrimTyCon :: TyCon
mkArrayArrayPrimTy :: Type
smallArrayPrimTyCon :: TyCon
mkSmallArrayPrimTy :: Type -> Type
mutableArrayPrimTyCon :: TyCon
mkMutableArrayPrimTy :: Type -> Type -> Type
mutableByteArrayPrimTyCon :: TyCon
mkMutableByteArrayPrimTy :: Type -> Type
mutableArrayArrayPrimTyCon :: TyCon
mkMutableArrayArrayPrimTy :: Type -> Type
smallMutableArrayPrimTyCon :: TyCon
mkSmallMutableArrayPrimTy :: Type -> Type -> Type
mutVarPrimTyCon :: TyCon
mkMutVarPrimTy :: Type -> Type -> Type
mVarPrimTyCon :: TyCon
mkMVarPrimTy :: Type -> Type -> Type
tVarPrimTyCon :: TyCon
mkTVarPrimTy :: Type -> Type -> Type
stablePtrPrimTyCon :: TyCon
mkStablePtrPrimTy :: Type -> Type
stableNamePrimTyCon :: TyCon
mkStableNamePrimTy :: Type -> Type
compactPrimTyCon :: TyCon
compactPrimTy :: Type
bcoPrimTyCon :: TyCon
bcoPrimTy :: Type
weakPrimTyCon :: TyCon
mkWeakPrimTy :: Type -> Type
threadIdPrimTyCon :: TyCon
threadIdPrimTy :: Type
int32PrimTyCon :: TyCon
int32PrimTy :: Type
word32PrimTyCon :: TyCon
word32PrimTy :: Type
int64PrimTyCon :: TyCon
int64PrimTy :: Type
word64PrimTyCon :: TyCon
word64PrimTy :: Type
eqPrimTyCon :: TyCon
eqReprPrimTyCon :: TyCon
eqPhantPrimTyCon :: TyCon
int8X16PrimTy :: Type
int8X16PrimTyCon :: TyCon
int16X8PrimTy :: Type
int16X8PrimTyCon :: TyCon
int32X4PrimTy :: Type
int32X4PrimTyCon :: TyCon
int64X2PrimTy :: Type
int64X2PrimTyCon :: TyCon
int8X32PrimTy :: Type
int8X32PrimTyCon :: TyCon
int16X16PrimTy :: Type
int16X16PrimTyCon :: TyCon
int32X8PrimTy :: Type
int32X8PrimTyCon :: TyCon
int64X4PrimTy :: Type
int64X4PrimTyCon :: TyCon
int8X64PrimTy :: Type
int8X64PrimTyCon :: TyCon
int16X32PrimTy :: Type
int16X32PrimTyCon :: TyCon
int32X16PrimTy :: Type
int32X16PrimTyCon :: TyCon
int64X8PrimTy :: Type
int64X8PrimTyCon :: TyCon
word8X16PrimTy :: Type
word8X16PrimTyCon :: TyCon
word16X8PrimTy :: Type
word16X8PrimTyCon :: TyCon
word32X4PrimTy :: Type
word32X4PrimTyCon :: TyCon
word64X2PrimTy :: Type
word64X2PrimTyCon :: TyCon
word8X32PrimTy :: Type
word8X32PrimTyCon :: TyCon
word16X16PrimTy :: Type
word16X16PrimTyCon :: TyCon
word32X8PrimTy :: Type
word32X8PrimTyCon :: TyCon
word64X4PrimTy :: Type
word64X4PrimTyCon :: TyCon
word8X64PrimTy :: Type
word8X64PrimTyCon :: TyCon
word16X32PrimTy :: Type
word16X32PrimTyCon :: TyCon
word32X16PrimTy :: Type
word32X16PrimTyCon :: TyCon
word64X8PrimTy :: Type
word64X8PrimTyCon :: TyCon
floatX4PrimTy :: Type
floatX4PrimTyCon :: TyCon
doubleX2PrimTy :: Type
doubleX2PrimTyCon :: TyCon
floatX8PrimTy :: Type
floatX8PrimTyCon :: TyCon
doubleX4PrimTy :: Type
doubleX4PrimTyCon :: TyCon
floatX16PrimTy :: Type
floatX16PrimTyCon :: TyCon
doubleX8PrimTy :: Type
doubleX8PrimTyCon :: TyCon
module Kind
-- | The key type representing kinds in the compiler.
type Kind = Type
typeKind :: Type -> Kind
-- | This version considers Constraint to be distinct from *. Returns True
-- if the argument is equivalent to Type and False otherwise.
isLiftedTypeKind :: Kind -> Bool
-- | Returns True if the kind classifies unlifted types and False
-- otherwise. Note that this returns False for levity-polymorphic kinds,
-- which may be specialized to a kind that classifies unlifted types.
isUnliftedTypeKind :: Kind -> Bool
isConstraintKind :: Kind -> Bool
isTYPEApp :: Kind -> Maybe DataCon
-- | Does the given type "end" in the given tycon? For example k ->
-- [a] -> * ends in * and Maybe a -> [a]
-- ends in [].
returnsTyCon :: Unique -> Type -> Bool
returnsConstraintKind :: Kind -> Bool
isConstraintKindCon :: TyCon -> Bool
okArrowArgKind :: Kind -> Bool
okArrowResultKind :: Kind -> Bool
-- | Does this classify a type allowed to have values? Responds True to
-- things like *, #, TYPE Lifted, TYPE v, Constraint.
--
-- True of any sub-kind of OpenTypeKind
classifiesTypeWithValues :: Kind -> Bool
-- | Is this kind equivalent to *?
isStarKind :: Kind -> Bool
-- | Is the tycon Constraint?
isStarKindSynonymTyCon :: TyCon -> Bool
-- | Is this kind equivalent to *?
tcIsStarKind :: Kind -> Bool
-- | Tests whether the given kind (which should look like TYPE x)
-- is something other than a constructor tree (that is, constructors at
-- every node).
isKindLevPoly :: Kind -> Bool
-- | Main functions for manipulating types and type-related things
module Type
-- | A global typecheckable-thing, essentially anything that has a name.
-- Not to be confused with a TcTyThing, which is also a
-- typecheckable thing but in the *local* context. See TcEnv for
-- how to retrieve a TyThing given a Name.
data TyThing
AnId :: Id -> TyThing
AConLike :: ConLike -> TyThing
ATyCon :: TyCon -> TyThing
ACoAxiom :: (CoAxiom Branched) -> TyThing
data Type
-- | Argument Flag
--
-- Is something required to appear in source Haskell (Required),
-- permitted by request (Specified) (visible type application), or
-- prohibited entirely from appearing in source Haskell
-- (Inferred)? See Note [TyBinders and ArgFlags] in TyCoRep
data ArgFlag
Required :: ArgFlag
Specified :: ArgFlag
Inferred :: ArgFlag
-- | The key representation of types within the compiler
type KindOrType = Type
-- | A type of the form p of kind Constraint represents a
-- value whose type is the Haskell predicate p, where a
-- predicate is what occurs before the => in a Haskell type.
--
-- We use PredType as documentation to mark those types that we
-- guarantee to have this kind.
--
-- It can be expanded into its representation, but:
--
--
-- - The type checker must treat it as opaque
-- - The rest of the compiler treats it as transparent
--
--
-- Consider these examples:
--
--
-- f :: (Eq a) => a -> Int
-- g :: (?x :: Int -> Int) => a -> Int
-- h :: (r\l) => {r} => {l::Int | r}
--
--
-- Here the Eq a and ?x :: Int -> Int and
-- rl are all called "predicates"
type PredType = Type
-- | A collection of PredTypes
type ThetaType = [PredType]
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and it's use sites.
data Var
-- | Type or kind Variable
type TyVar = Var
isTyVar :: Var -> Bool
-- | Type or Coercion Variable
type TyCoVar = Id
-- | A TyBinder represents an argument to a function. TyBinders can
-- be dependent (Named) or nondependent (Anon). They may
-- also be visible or not. See Note [TyBinders]
data TyBinder
-- | Type Variable Binder
--
-- A TyVarBinder is the binder of a ForAllTy It's convenient to
-- define this synonym here rather its natural home in TyCoRep, because
-- it's used in DataCon.hs-boot
type TyVarBinder = TyVarBndr TyVar ArgFlag
mkTyVarTy :: TyVar -> Type
mkTyVarTys :: [TyVar] -> [Type]
-- | Attempts to obtain the type variable underlying a Type, and
-- panics with the given message if this is not a type variable type. See
-- also getTyVar_maybe
getTyVar :: String -> Type -> TyVar
-- | Attempts to obtain the type variable underlying a Type
getTyVar_maybe :: Type -> Maybe TyVar
-- | Attempts to obtain the type variable underlying a Type, without
-- any expansion
repGetTyVar_maybe :: Type -> Maybe TyVar
-- | If the type is a tyvar, possibly under a cast, returns it, along with
-- the coercion. Thus, the co is :: kind tv ~R kind type
getCastedTyVar_maybe :: Type -> Maybe (TyVar, Coercion)
tyVarKind :: TyVar -> Kind
-- | Applies a type to another, as in e.g. k a
mkAppTy :: Type -> Type -> Type
mkAppTys :: Type -> [Type] -> Type
-- | Attempts to take a type application apart, as in
-- splitAppTy_maybe, and panics if this is not possible
splitAppTy :: Type -> (Type, Type)
-- | Recursively splits a type as far as is possible, leaving a residual
-- type being applied to and the type arguments applied to it. Never
-- fails, even if that means returning an empty list of type
-- applications.
splitAppTys :: Type -> (Type, [Type])
-- | Like splitAppTys, but doesn't look through type synonyms
repSplitAppTys :: Type -> (Type, [Type])
-- | Attempt to take a type application apart, whether it is a function,
-- type constructor, or plain type application. Note that type family
-- applications are NEVER unsaturated by this!
splitAppTy_maybe :: Type -> Maybe (Type, Type)
-- | Does the AppTy split as in splitAppTy_maybe, but assumes that
-- any Core view stuff is already done
repSplitAppTy_maybe :: Type -> Maybe (Type, Type)
-- | Does the AppTy split as in tcSplitAppTy_maybe, but assumes
-- that any coreView stuff is already done. Refuses to look through (c
-- => t)
tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type)
-- | Make an arrow type
mkFunTy :: Type -> Type -> Type
infixr 3 `mkFunTy`
-- | Make nested arrow types
mkFunTys :: [Type] -> Type -> Type
-- | Attempts to extract the argument and result types from a type, and
-- panics if that is not possible. See also splitFunTy_maybe
splitFunTy :: Type -> (Type, Type)
-- | Attempts to extract the argument and result types from a type
splitFunTy_maybe :: Type -> Maybe (Type, Type)
splitFunTys :: Type -> ([Type], Type)
-- | Extract the function result type and panic if that is not possible
funResultTy :: Type -> Type
-- | Extract the function argument type and panic if that is not possible
funArgTy :: Type -> Type
-- | A key function: builds a TyConApp or FunTy as
-- appropriate to its arguments. Applies its arguments to the constructor
-- from left to right.
mkTyConApp :: TyCon -> [Type] -> Type
-- | Create the plain type constructor type which has been applied to no
-- type arguments at all.
mkTyConTy :: TyCon -> Type
-- | The same as fst . splitTyConApp
tyConAppTyCon_maybe :: Type -> Maybe TyCon
-- | Retrieve the tycon heading this type, if there is one. Does not
-- look through synonyms.
tyConAppTyConPicky_maybe :: Type -> Maybe TyCon
-- | The same as snd . splitTyConApp
tyConAppArgs_maybe :: Type -> Maybe [Type]
tyConAppTyCon :: Type -> TyCon
tyConAppArgs :: Type -> [Type]
-- | Attempts to tease a type apart into a type constructor and the
-- application of a number of arguments to that constructor
splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
-- | Attempts to tease a type apart into a type constructor and the
-- application of a number of arguments to that constructor. Panics if
-- that is not possible. See also splitTyConApp_maybe
splitTyConApp :: Type -> (TyCon, [Type])
tyConAppArgN :: Int -> Type -> Type
-- | What is the role assigned to the next parameter of this type? Usually,
-- this will be Nominal, but if the type is a TyConApp, we
-- may be able to do better. The type does *not* have to be well-kinded
-- when applied for this to work!
nextRole :: Type -> Role
-- | Like tcSplitTyConApp_maybe but doesn't look through type
-- synonyms.
tcRepSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
-- | Split a type constructor application into its type constructor and
-- applied types. Note that this may fail in the case of a FunTy
-- with an argument of unknown kind FunTy (e.g. FunTy (a :: k)
-- Int. since the kind of a isn't of the form TYPE
-- rep). Consequently, you may need to zonk your type before using
-- this function.
--
-- If you only need the TyCon, consider using
-- tcTyConAppTyCon_maybe.
tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
-- | Attempts to tease a list type apart and gives the type of the elements
-- if successful (looks through type synonyms)
splitListTyConApp_maybe :: Type -> Maybe Type
-- | Like splitTyConApp_maybe, but doesn't look through synonyms.
-- This assumes the synonyms have already been dealt with.
repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
mkForAllTy :: TyVar -> ArgFlag -> Type -> Type
-- | Wraps foralls over the type using the provided TyVars from left
-- to right
mkForAllTys :: [TyVarBinder] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and
-- Inferred, a common case
mkInvForAllTys :: [TyVar] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and
-- specified, a common case
mkSpecForAllTys :: [TyVar] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and visible
mkVisForAllTys :: [TyVar] -> Type -> Type
-- | Make a dependent forall over an Inferred (as opposed to Specified)
-- variable
mkInvForAllTy :: TyVar -> Type -> Type
-- | Take a ForAllTy apart, returning the list of tyvars and the result
-- type. This always succeeds, even if it returns only an empty list.
-- Note that the result type returned may have free variables that were
-- bound by a forall.
splitForAllTys :: Type -> ([TyVar], Type)
-- | Like splitPiTys but split off only named binders.
splitForAllTyVarBndrs :: Type -> ([TyVarBinder], Type)
-- | Attempts to take a forall type apart, but only if it's a proper
-- forall, with a named binder
splitForAllTy_maybe :: Type -> Maybe (TyVar, Type)
-- | Take a forall type apart, or panics if that is not possible.
splitForAllTy :: Type -> (TyVar, Type)
-- | Attempts to take a forall type apart; works with proper foralls and
-- functions
splitPiTy_maybe :: Type -> Maybe (TyBinder, Type)
-- | Takes a forall type apart, or panics
splitPiTy :: Type -> (TyBinder, Type)
-- | Split off all TyBinders to a type, splitting both proper foralls and
-- functions
splitPiTys :: Type -> ([TyBinder], Type)
mkPiTy :: TyBinder -> Type -> Type
mkPiTys :: [TyBinder] -> Type -> Type
-- | Given a list of type-level vars and a result type, makes TyBinders,
-- preferring anonymous binders if the variable is, in fact, not
-- dependent. All binders are visible.
mkTyConBindersPreferAnon :: [TyVar] -> Type -> [TyConBinder]
-- | Makes a (->) type or an implicit forall type, depending on
-- whether it is given a type variable or a term variable. This is used,
-- for example, when producing the type of a lambda. Always uses Inferred
-- binders.
mkLamType :: Var -> Type -> Type
-- | mkLamType for multiple type or value arguments
mkLamTypes :: [Var] -> Type -> Type
piResultTy :: Type -> Type -> Type
-- | (piResultTys f_ty [ty1, .., tyn]) gives the type of (f ty1 .. tyn)
-- where f :: f_ty piResultTys is interesting because: 1.
-- f_ty may have more for-alls than there are args 2. Less
-- obviously, it may have fewer for-alls For case 2. think of:
-- piResultTys (forall a.a) [forall b.b, Int] This really can happen, but
-- only (I think) in situations involving undefined. For example:
-- undefined :: forall a. a Term: undefined (forall b. b->b)
-- Int This term should have type (Int -> Int), but notice that
-- there are more type args than foralls in undefineds type.
piResultTys :: Type -> [Type] -> Type
applyTysX :: [TyVar] -> Type -> [Type] -> Type
-- | Drops all ForAllTys
dropForAlls :: Type -> Type
mkNumLitTy :: Integer -> Type
-- | Is this a numeric literal. We also look through type synonyms.
isNumLitTy :: Type -> Maybe Integer
mkStrLitTy :: FastString -> Type
-- | Is this a symbol literal. We also look through type synonyms.
isStrLitTy :: Type -> Maybe FastString
-- | Extract the RuntimeRep classifier of a type. For instance,
-- getRuntimeRep_maybe Int = LiftedRep. Returns Nothing
-- if this is not possible.
getRuntimeRep_maybe :: HasDebugCallStack => Type -> Maybe Type
-- | Extract the RuntimeRep classifier of a type from its kind. For
-- example, getRuntimeRepFromKind * = LiftedRep; Returns
-- Nothing if this is not possible.
getRuntimeRepFromKind_maybe :: HasDebugCallStack => Type -> Maybe Type
-- | Make a CastTy. The Coercion must be nominal. Checks the
-- Coercion for reflexivity, dropping it if it's reflexive. See Note [No
-- reflexive casts in types]
mkCastTy :: Type -> Coercion -> Type
mkCoercionTy :: Coercion -> Type
splitCastTy_maybe :: Type -> Maybe (Type, Coercion)
-- | Is this type a custom user error? If so, give us the kind and the
-- error message.
userTypeError_maybe :: Type -> Maybe Type
-- | Render a type corresponding to a user type error into a SDoc.
pprUserTypeErrorTy :: Type -> SDoc
-- | Get the type on the LHS of a coercion induced by a type/data family
-- instance.
coAxNthLHS :: CoAxiom br -> Int -> Type
stripCoercionTy :: Type -> Coercion
-- | Try to split up a coercion type into the types that it coerces
splitCoercionType_maybe :: Type -> Maybe (Type, Type)
splitPiTysInvisible :: Type -> ([TyBinder], Type)
-- | Given a tycon and its arguments, filters out any invisible arguments
filterOutInvisibleTypes :: TyCon -> [Type] -> [Type]
-- | Like filterOutInvisibles, but works on TyVars
filterOutInvisibleTyVars :: TyCon -> [TyVar] -> [TyVar]
-- | Given a tycon and a list of things (which correspond to arguments),
-- partitions the things into Inferred or Specified ones and Required
-- ones The callback function is necessary for this scenario:
--
--
-- T :: forall k. k -> k
-- partitionInvisibles T [forall m. m -> m -> m, S, R, Q]
--
--
-- After substituting, we get
--
--
-- T (forall m. m -> m -> m) :: (forall m. m -> m -> m) -> forall n. n -> n -> n
--
--
-- Thus, the first argument is invisible, S is visible,
-- R is invisible again, and Q is visible.
--
-- If you're absolutely sure that your tycon's kind doesn't end in a
-- variable, it's OK if the callback function panics, as that's the only
-- time it's consulted.
partitionInvisibles :: TyCon -> (a -> Type) -> [a] -> ([a], [a])
-- | Find the result Kind of a type synonym, after applying it to
-- its arity number of type variables Actually this function
-- works fine on data types too, but they'd always return *, so we
-- never need to ask
synTyConResKind :: TyCon -> Kind
modifyJoinResTy :: Int -> (Type -> Type) -> Type -> Type
setJoinResTy :: Int -> Type -> Type -> Type
-- | This describes how a "map" operation over a type/coercion should
-- behave
data TyCoMapper env m
TyCoMapper :: Bool -> (env -> TyVar -> m Type) -> (env -> CoVar -> m Coercion) -> (env -> CoercionHole -> Role -> Type -> Type -> m Coercion) -> (env -> TyVar -> ArgFlag -> m (env, TyVar)) -> TyCoMapper env m
-- | Should the new type be created with smart constructors?
[tcm_smart] :: TyCoMapper env m -> Bool
[tcm_tyvar] :: TyCoMapper env m -> env -> TyVar -> m Type
[tcm_covar] :: TyCoMapper env m -> env -> CoVar -> m Coercion
-- | What to do with coercion holes. See Note [Coercion holes] in TyCoRep.
[tcm_hole] :: TyCoMapper env m -> env -> CoercionHole -> Role -> Type -> Type -> m Coercion
-- | The returned env is used in the extended scope
[tcm_tybinder] :: TyCoMapper env m -> env -> TyVar -> ArgFlag -> m (env, TyVar)
mapType :: Monad m => TyCoMapper env m -> env -> Type -> m Type
mapCoercion :: Monad m => TyCoMapper env m -> env -> Coercion -> m Coercion
-- | Unwrap one layer of newtype on a type constructor and its
-- arguments, using an eta-reduced version of the newtype if
-- possible. This requires tys to have at least newTyConInstArity
-- tycon elements.
newTyConInstRhs :: TyCon -> [Type] -> Type
-- | Given a family instance TyCon and its arg types, return the
-- corresponding family type. E.g:
--
--
-- data family T a
-- data instance T (Maybe b) = MkT b
--
--
-- Where the instance tycon is :RTL, so:
--
--
-- mkFamilyTyConApp :RTL Int = T (Maybe Int)
--
mkFamilyTyConApp :: TyCon -> [Type] -> Type
isDictLikeTy :: Type -> Bool
-- | Creates a primitive type equality predicate. Invariant: the types are
-- not Coercions
mkPrimEqPred :: Type -> Type -> Type
mkReprPrimEqPred :: Type -> Type -> Type
-- | Makes a lifted equality predicate at the given role
mkPrimEqPredRole :: Role -> Type -> Type -> PredType
equalityTyCon :: Role -> TyCon
-- | Creates a primite type equality predicate with explicit kinds
mkHeteroPrimEqPred :: Kind -> Kind -> Type -> Type -> Type
-- | Creates a primitive representational type equality predicate with
-- explicit kinds
mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type
mkClassPred :: Class -> [Type] -> PredType
isClassPred :: PredType -> Bool
isEqPred :: PredType -> Bool
isNomEqPred :: PredType -> Bool
isIPPred :: PredType -> Bool
isIPPred_maybe :: Type -> Maybe (FastString, Type)
isIPTyCon :: TyCon -> Bool
isIPClass :: Class -> Bool
isCTupleClass :: Class -> Bool
data PredTree
ClassPred :: Class -> [Type] -> PredTree
EqPred :: EqRel -> Type -> Type -> PredTree
IrredPred :: PredType -> PredTree
-- | A choice of equality relation. This is separate from the type
-- Role because Phantom does not define a (non-trivial)
-- equality relation.
data EqRel
NomEq :: EqRel
ReprEq :: EqRel
eqRelRole :: EqRel -> Role
classifyPredType :: PredType -> PredTree
getClassPredTys :: PredType -> (Class, [Type])
getClassPredTys_maybe :: PredType -> Maybe (Class, [Type])
getEqPredTys :: PredType -> (Type, Type)
getEqPredTys_maybe :: PredType -> Maybe (Role, Type, Type)
getEqPredRole :: PredType -> Role
-- | Get the equality relation relevant for a pred type.
predTypeEqRel :: PredType -> EqRel
-- | Do these denote the same level of visibility? Required
-- arguments are visible, others are not. So this function equates
-- Specified and Inferred. Used for printing.
sameVis :: ArgFlag -> ArgFlag -> Bool
-- | Make a named binder
mkTyVarBinder :: ArgFlag -> Var -> TyVarBinder
-- | Make many named binders
mkTyVarBinders :: ArgFlag -> [TyVar] -> [TyVarBinder]
-- | Make an anonymous binder
mkAnonBinder :: Type -> TyBinder
-- | Does this binder bind a variable that is not erased? Returns
-- True for anonymous binders.
isAnonTyBinder :: TyBinder -> Bool
isNamedTyBinder :: TyBinder -> Bool
binderVar :: TyVarBndr tv argf -> tv
binderVars :: [TyVarBndr tv argf] -> [tv]
binderKind :: TyVarBndr TyVar argf -> Kind
binderArgFlag :: TyVarBndr tv argf -> argf
tyBinderType :: TyBinder -> Type
-- | Extract a relevant type, if there is one.
binderRelevantType_maybe :: TyBinder -> Maybe Type
-- | Like maybe, but for binders.
caseBinder :: TyBinder -> (TyVarBinder -> a) -> (Type -> a) -> a
-- | Does this ArgFlag classify an argument that is written in
-- Haskell?
isVisibleArgFlag :: ArgFlag -> Bool
-- | Does this ArgFlag classify an argument that is not written in
-- Haskell?
isInvisibleArgFlag :: ArgFlag -> Bool
-- | Does this binder bind a visible argument?
isVisibleBinder :: TyBinder -> Bool
-- | Does this binder bind an invisible argument?
isInvisibleBinder :: TyBinder -> Bool
tyConBindersTyBinders :: [TyConBinder] -> [TyBinder]
-- | Manufacture a new TyConBinder from a TyBinder. Anonymous
-- TyBinders are still assigned names as TyConBinders, so
-- we need the extra gunk with which to construct a Name. Used
-- when producing tyConTyVars from a datatype kind signature. Defined
-- here to avoid module loops.
mkTyBinderTyConBinder :: TyBinder -> SrcSpan -> Unique -> OccName -> TyConBinder
-- | The (->) type constructor.
--
--
-- (->) :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
-- TYPE rep1 -> TYPE rep2 -> *
--
funTyCon :: TyCon
isTyVarTy :: Type -> Bool
isFunTy :: Type -> Bool
isDictTy :: Type -> Bool
-- | Is the type suitable to classify a given/wanted in the typechecker?
isPredTy :: Type -> Bool
isCoercionTy :: Type -> Bool
isCoercionTy_maybe :: Type -> Maybe Coercion
-- | Does this type classify a core (unlifted) Coercion? At either role
-- nominal or representational (t1 ~ t2)
isCoercionType :: Type -> Bool
-- | Checks whether this is a proper forall (with a named binder)
isForAllTy :: Type -> Bool
-- | Is this a function or forall?
isPiTy :: Type -> Bool
isTauTy :: Type -> Bool
isFamFreeTy :: Type -> Bool
-- | Determine whether a type could be the type of a join point of given
-- total arity, according to the polymorphism rule. A join point cannot
-- be polymorphic in its return type, since given join j a b x y
-- z = e1 in e2, the types of e1 and e2 must be the same, and a and b are
-- not in scope for e2. (See Note [The polymorphism rule of join points]
-- in CoreSyn.) Returns False also if the type simply doesn't have enough
-- arguments.
--
-- Note that we need to know how many arguments (type *and* value) the
-- putative join point takes; for instance, if j :: forall a. a -> Int
-- then j could be a binary join point returning an Int, but it could
-- *not* be a unary join point returning a -> Int.
--
-- TODO: See Note [Excess polymorphism and join points]
isValidJoinPointType :: JoinArity -> Type -> Bool
-- | Returns Just True if this type is surely lifted, Just False if it is
-- surely unlifted, Nothing if we can't be sure (i.e., it is levity
-- polymorphic), and panics if the kind does not have the shape TYPE r.
isLiftedType_maybe :: HasDebugCallStack => Type -> Maybe Bool
-- | See Type#type_classification for what an unlifted type is.
-- Panics on levity polymorphic types.
isUnliftedType :: HasDebugCallStack => Type -> Bool
isUnboxedTupleType :: Type -> Bool
isUnboxedSumType :: Type -> Bool
-- | See Type#type_classification for what an algebraic type is.
-- Should only be applied to types, as opposed to e.g. partially
-- saturated type constructors
isAlgType :: Type -> Bool
-- | See Type#type_classification for what an algebraic type is.
-- Should only be applied to types, as opposed to e.g. partially
-- saturated type constructors. Closed type constructors are those with a
-- fixed right hand side, as opposed to e.g. associated types
isClosedAlgType :: Type -> Bool
-- | Check whether a type is a data family type
isDataFamilyAppType :: Type -> Bool
-- | Returns true of types that are opaque to Haskell.
isPrimitiveType :: Type -> Bool
-- | Computes whether an argument (or let right hand side) should be
-- computed strictly or lazily, based only on its type. Currently, it's
-- just isUnliftedType. Panics on levity-polymorphic types.
isStrictType :: HasDebugCallStack => Type -> Bool
-- | Is this the type RuntimeRep?
isRuntimeRepTy :: Type -> Bool
-- | Is a tyvar of type RuntimeRep?
isRuntimeRepVar :: TyVar -> Bool
-- | Is this a type of kind RuntimeRep? (e.g. LiftedRep)
isRuntimeRepKindedTy :: Type -> Bool
-- | Drops prefix of RuntimeRep constructors in TyConApps. Useful
-- for e.g. dropping 'LiftedRep arguments of unboxed tuple TyCon
-- applications:
--
-- dropRuntimeRepArgs [ 'LiftedRep, 'IntRep , String, Int]
dropRuntimeRepArgs :: [Type] -> [Type]
-- | Extract the RuntimeRep classifier of a type. For instance,
-- getRuntimeRep_maybe Int = LiftedRep. Panics if this is not
-- possible.
getRuntimeRep :: HasDebugCallStack => Type -> Type
-- | Extract the RuntimeRep classifier of a type from its kind. For
-- example, getRuntimeRepFromKind * = LiftedRep; Panics if this
-- is not possible.
getRuntimeRepFromKind :: HasDebugCallStack => Type -> Type
-- | The key type representing kinds in the compiler.
type Kind = Type
typeKind :: Type -> Kind
-- | Returns True if a type is levity polymorphic. Should be the same as
-- (isKindLevPoly . typeKind) but much faster. Precondition: The type has
-- kind (TYPE blah)
isTypeLevPoly :: Type -> Bool
-- | Looking past all pi-types, is the end result potentially levity
-- polymorphic? Example: True for (forall r (a :: TYPE r). String ->
-- a) Example: False for (forall r1 r2 (a :: TYPE r1) (b :: TYPE r2). a
-- -> b -> Type)
resultIsLevPoly :: Type -> Bool
liftedTypeKind :: Kind
-- | The worker for tyVarsOfType and tyVarsOfTypeList.
-- The previous implementation used unionVarSet which is O(n+m)
-- and can make the function quadratic. It's exported, so that it can be
-- composed with other functions that compute free variables. See Note
-- [FV naming conventions] in FV.
--
-- Eta-expanded because that makes it run faster (apparently) See Note
-- [FV eta expansion] in FV for explanation.
tyCoFVsOfType :: Type -> FV
tyCoFVsBndr :: TyVarBinder -> FV -> FV
-- | Returns free variables of a type, including kind variables as a
-- non-deterministic set. For type synonyms it does not expand the
-- synonym.
tyCoVarsOfType :: Type -> TyCoVarSet
-- | Returns free variables of types, including kind variables as a
-- non-deterministic set. For type synonyms it does not expand the
-- synonym.
tyCoVarsOfTypes :: [Type] -> TyCoVarSet
-- | tyVarsOfType that returns free variables of a type in a
-- deterministic set. For explanation of why using VarSet is not
-- deterministic see Note [Deterministic FV] in FV.
tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
coVarsOfType :: Type -> CoVarSet
coVarsOfTypes :: [Type] -> TyCoVarSet
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a non-deterministic set.
closeOverKinds :: TyVarSet -> TyVarSet
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a deterministically ordered list.
closeOverKindsList :: [TyVar] -> [TyVar]
-- | Returns True if this type has no free variables. Should be the same as
-- isEmptyVarSet . tyCoVarsOfType, but faster in the non-forall case.
noFreeVarsOfType :: Type -> Bool
-- | Retrieve the free variables in this type, splitting them based on
-- whether they are used visibly or invisibly. Invisible ones come first.
splitVisVarsOfType :: Type -> Pair TyCoVarSet
splitVisVarsOfTypes :: [Type] -> Pair TyCoVarSet
-- | Expand out all type synonyms. Actually, it'd suffice to expand out
-- just the ones that discard type variables (e.g. type Funny a = Int)
-- But we don't know which those are currently, so we just expand all.
--
-- expandTypeSynonyms only expands out type synonyms mentioned in
-- the type, not in the kinds of any TyCon or TyVar mentioned in the
-- type.
--
-- Keep this synchronized with synonymTyConsOfType
expandTypeSynonyms :: Type -> Type
typeSize :: Type -> Int
-- | Extract a well-scoped list of variables from a deterministic set of
-- variables. The result is deterministic. NB: There used to exist
-- varSetElemsWellScoped :: VarSet -> [Var] which took a
-- non-deterministic set and produced a non-deterministic well-scoped
-- list. If you care about the list being well-scoped you also most
-- likely care about it being in deterministic order.
dVarSetElemsWellScoped :: DVarSet -> [Var]
-- | Do a topological sort on a list of tyvars, so that binders occur
-- before occurrences E.g. given [ a::k, k::*, b::k ] it'll return a
-- well-scoped list [ k::*, a::k, b::k ]
--
-- This is a deterministic sorting operation (that is, doesn't depend on
-- Uniques).
toposortTyVars :: [TyVar] -> [TyVar]
-- | Get the free vars of a type in scoped order
tyCoVarsOfTypeWellScoped :: Type -> [TyVar]
-- | Get the free vars of types in scoped order
tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar]
-- | Type equality on source types. Does not look through newtypes
-- or PredTypes, but it does look through type synonyms. This
-- first checks that the kinds of the types are equal and then checks
-- whether the types are equal, ignoring casts and coercions. (The kind
-- check is a recursive call, but since all kinds have type
-- Type, there is no need to check the types of kinds.) See also
-- Note [Non-trivial definitional equality] in TyCoRep.
eqType :: Type -> Type -> Bool
-- | Compare types with respect to a (presumably) non-empty RnEnv2.
eqTypeX :: RnEnv2 -> Type -> Type -> Bool
-- | Type equality on lists of types, looking through type synonyms but not
-- newtypes.
eqTypes :: [Type] -> [Type] -> Bool
nonDetCmpType :: Type -> Type -> Ordering
nonDetCmpTypes :: [Type] -> [Type] -> Ordering
nonDetCmpTypeX :: RnEnv2 -> Type -> Type -> Ordering
nonDetCmpTypesX :: RnEnv2 -> [Type] -> [Type] -> Ordering
-- | Compare two TyCons. NB: This should never see the "star
-- synonyms", as recognized by Kind.isStarKindSynonymTyCon. See Note
-- [Kind Constraint and kind *] in Kind. See Note [nonDetCmpType
-- nondeterminism]
nonDetCmpTc :: TyCon -> TyCon -> Ordering
eqVarBndrs :: RnEnv2 -> [Var] -> [Var] -> Maybe RnEnv2
seqType :: Type -> ()
seqTypes :: [Type] -> ()
-- | This function Strips off the top layer only of a type synonym
-- application (if any) its underlying representation type. Returns
-- Nothing if there is nothing to look through. This function considers
-- Constraint to be a synonym of TYPE LiftedRep.
--
-- By being non-recursive and inlined, this case analysis gets
-- efficiently joined onto the case analysis that the caller is already
-- doing
coreView :: Type -> Maybe Type
-- | Gives the typechecker view of a type. This unwraps synonyms but leaves
-- Constraint alone. c.f. coreView, which turns Constraint into
-- TYPE LiftedRep. Returns Nothing if no unwrapping happens. See also
-- Note [coreView vs tcView] in Type.
tcView :: Type -> Maybe Type
-- | All type constructors occurring in the type; looking through type
-- synonyms, but not newtypes. When it finds a Class, it returns the
-- class TyCon.
tyConsOfType :: Type -> UniqSet TyCon
-- | A substitution of Types for TyVars and Kinds for
-- KindVars
type TvSubstEnv = TyVarEnv Type
-- | Type & coercion substitution
--
-- The following invariants must hold of a TCvSubst:
--
--
-- - The in-scope set is needed only to guide the generation of
-- fresh uniques
-- - In particular, the kind of the type variables in the
-- in-scope set is not relevant
-- - The substitution is only applied ONCE! This is because in general
-- such application will not reach a fixed point.
--
data TCvSubst
TCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> TCvSubst
emptyTvSubstEnv :: TvSubstEnv
emptyTCvSubst :: TCvSubst
mkEmptyTCvSubst :: InScopeSet -> TCvSubst
mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
zipTvSubst :: [TyVar] -> [Type] -> TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst
notElemTCvSubst :: Var -> TCvSubst -> Bool
getTvSubstEnv :: TCvSubst -> TvSubstEnv
setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst
zapTCvSubst :: TCvSubst -> TCvSubst
getTCvInScope :: TCvSubst -> InScopeSet
-- | Returns the free variables of the types in the range of a substitution
-- as a non-deterministic set.
getTCvSubstRangeFVs :: TCvSubst -> VarSet
extendTCvInScope :: TCvSubst -> Var -> TCvSubst
extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst
extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst
extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst
extendTvSubstBinder :: TCvSubst -> TyBinder -> Type -> TCvSubst
extendTvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst
isInScope :: Var -> TCvSubst -> Bool
-- | (compose env1 env2)(x) is env1(env2(x)); i.e. apply
-- env2 then env1. It assumes that both are idempotent.
-- Typically, env1 is the refinement to a base substitution
-- env2
composeTCvSubstEnv :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv)
-- | Composes two substitutions, applying the second one provided first,
-- like in function composition.
composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnv
zipCoEnv :: [CoVar] -> [Coercion] -> CvSubstEnv
isEmptyTCvSubst :: TCvSubst -> Bool
unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
-- | Substitute within a Type The substitution has to satisfy the
-- invariants described in Note [The substitution invariant].
substTy :: HasCallStack => TCvSubst -> Type -> Type
-- | Substitute within several Types The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTys :: HasCallStack => TCvSubst -> [Type] -> [Type]
-- | Type substitution, see zipTvSubst
substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type
-- | Type substitution, see zipTvSubst
substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type]
-- | Substitute within a ThetaType The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType
-- | Substitute within a Type after adding the free variables of the
-- type to the in-scope set. This is useful for the case when the free
-- variables aren't already in the in-scope set or easily available. See
-- also Note [The substitution invariant].
substTyAddInScope :: TCvSubst -> Type -> Type
-- | Substitute within a Type disabling the sanity checks. The
-- problems that the sanity checks in substTy catch are described in Note
-- [The substitution invariant]. The goal of #11371 is to migrate all the
-- calls of substTyUnchecked to substTy and remove this function. Please
-- don't use in new code.
substTyUnchecked :: TCvSubst -> Type -> Type
-- | Substitute within several Types disabling the sanity checks.
-- The problems that the sanity checks in substTys catch are described in
-- Note [The substitution invariant]. The goal of #11371 is to migrate
-- all the calls of substTysUnchecked to substTys and remove this
-- function. Please don't use in new code.
substTysUnchecked :: TCvSubst -> [Type] -> [Type]
-- | Substitute within a ThetaType disabling the sanity checks. The
-- problems that the sanity checks in substTys catch are described in
-- Note [The substitution invariant]. The goal of #11371 is to migrate
-- all the calls of substThetaUnchecked to substTheta and remove this
-- function. Please don't use in new code.
substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType
-- | Type substitution, see zipTvSubst. Disables sanity checks. The
-- problems that the sanity checks in substTy catch are described in Note
-- [The substitution invariant]. The goal of #11371 is to migrate all the
-- calls of substTyUnchecked to substTy and remove this function. Please
-- don't use in new code.
substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type
-- | Substitute within a Coercion disabling sanity checks. The
-- problems that the sanity checks in substCo catch are described in Note
-- [The substitution invariant]. The goal of #11371 is to migrate all the
-- calls of substCoUnchecked to substCo and remove this function. Please
-- don't use in new code.
substCoUnchecked :: TCvSubst -> Coercion -> Coercion
-- | Coercion substitution, see zipTvSubst. Disables sanity checks.
-- The problems that the sanity checks in substCo catch are described in
-- Note [The substitution invariant]. The goal of #11371 is to migrate
-- all the calls of substCoUnchecked to substCo and remove this function.
-- Please don't use in new code.
substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion
-- | Substitute tyvars within a type using a known InScopeSet.
-- Pre-condition: the in_scope set should satisfy Note [The
-- substitution invariant]; specifically it should include the free vars
-- of tys, and of ty minus the domain of the subst.
substTyWithInScope :: InScopeSet -> [TyVar] -> [Type] -> Type -> Type
substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)
substTyVar :: TCvSubst -> TyVar -> Type
substTyVars :: TCvSubst -> [TyVar] -> [Type]
cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar)
cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar])
lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
pprType :: Type -> SDoc
pprParendType :: Type -> SDoc
pprTypeApp :: TyCon -> [Type] -> SDoc
pprTyThingCategory :: TyThing -> SDoc
pprShortTyThing :: TyThing -> SDoc
pprTvBndr :: TyVarBinder -> SDoc
pprTvBndrs :: [TyVarBinder] -> SDoc
pprForAll :: [TyVarBinder] -> SDoc
-- | Print a user-level forall; see Note [When to print foralls]
pprUserForAll :: [TyVarBinder] -> SDoc
pprSigmaType :: Type -> SDoc
ppSuggestExplicitKinds :: SDoc
pprTheta :: ThetaType -> SDoc
pprThetaArrowTy :: ThetaType -> SDoc
pprClassPred :: Class -> [Type] -> SDoc
pprKind :: Kind -> SDoc
pprParendKind :: Kind -> SDoc
-- | Pretty prints a TyCon, using the family instance in case of a
-- representation tycon. For example:
--
--
-- data T [a] = ...
--
--
-- In that case we want to print T [a], where T is the
-- family TyCon
pprSourceTyCon :: TyCon -> SDoc
data TyPrec
TopPrec :: TyPrec
FunPrec :: TyPrec
TyOpPrec :: TyPrec
TyConPrec :: TyPrec
maybeParen :: TyPrec -> TyPrec -> SDoc -> SDoc
pprTyVar :: TyVar -> SDoc
pprTyVars :: [TyVar] -> SDoc
pprPrefixApp :: TyPrec -> SDoc -> [SDoc] -> SDoc
pprArrowChain :: TyPrec -> [SDoc] -> SDoc
tidyType :: TidyEnv -> Type -> Type
tidyTypes :: TidyEnv -> [Type] -> [Type]
tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
-- | Grabs the free type variables, tidies them and then uses
-- tidyType to work over the type itself
tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind)
tidyTyCoVarBndr :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
-- | This tidies up a type for printing in an error message, or in an
-- interface file.
--
-- It doesn't change the uniques at all, just the print names.
tidyTyCoVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
-- | Add the free TyVars to the env in tidy form, so that we can
-- tidy the type they are free in
tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv
-- | Treat a new TyCoVar as a binder, and give it a fresh tidy name
-- using the environment if one has not already been allocated. See also
-- tidyTyCoVarBndr
tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
tidyTyVarOcc :: TidyEnv -> TyVar -> TyVar
-- | Calls tidyType on a top-level type (i.e. with an empty tidying
-- environment)
tidyTopType :: Type -> Type
tidyKind :: TidyEnv -> Kind -> Kind
tidyTyVarBinder :: TidyEnv -> TyVarBndr TyVar vis -> (TidyEnv, TyVarBndr TyVar vis)
tidyTyVarBinders :: TidyEnv -> [TyVarBndr TyVar vis] -> (TidyEnv, [TyVarBndr TyVar vis])
instance GHC.Enum.Bounded Type.TypeOrdering
instance GHC.Enum.Enum Type.TypeOrdering
instance GHC.Classes.Ord Type.TypeOrdering
instance GHC.Classes.Eq Type.TypeOrdering
instance GHC.Classes.Ord Type.EqRel
instance GHC.Classes.Eq Type.EqRel
instance Outputable.Outputable Type.EqRel
module PatSyn
-- | Pattern Synonym
--
-- See Note [Pattern synonym representation] See Note [Pattern synonym
-- signature contexts]
data PatSyn
-- | Build a new pattern synonym
mkPatSyn :: Name -> Bool -> ([TyVarBinder], ThetaType) -> ([TyVarBinder], ThetaType) -> [Type] -> Type -> (Id, Bool) -> Maybe (Id, Bool) -> [FieldLabel] -> PatSyn
-- | The Name of the PatSyn, giving it a unique, rooted
-- identification
patSynName :: PatSyn -> Name
-- | Arity of the pattern synonym
patSynArity :: PatSyn -> Arity
-- | Should the PatSyn be presented infix?
patSynIsInfix :: PatSyn -> Bool
patSynArgs :: PatSyn -> [Type]
patSynMatcher :: PatSyn -> (Id, Bool)
patSynBuilder :: PatSyn -> Maybe (Id, Bool)
patSynUnivTyVarBinders :: PatSyn -> [TyVarBinder]
patSynExTyVars :: PatSyn -> [TyVar]
patSynExTyVarBinders :: PatSyn -> [TyVarBinder]
patSynSig :: PatSyn -> ([TyVar], ThetaType, [TyVar], ThetaType, [Type], Type)
patSynInstArgTys :: PatSyn -> [Type] -> [Type]
patSynInstResTy :: PatSyn -> [Type] -> Type
patSynFieldLabels :: PatSyn -> [FieldLabel]
-- | Extract the type for any given labelled field of the DataCon
patSynFieldType :: PatSyn -> FieldLabelString -> Type
tidyPatSynIds :: (Id -> Id) -> PatSyn -> PatSyn
-- | Print the type of a pattern synonym. The foralls are printed
-- explicitly
pprPatSynType :: PatSyn -> SDoc
instance GHC.Classes.Eq PatSyn.PatSyn
instance Unique.Uniquable PatSyn.PatSyn
instance Name.NamedThing PatSyn.PatSyn
instance Outputable.Outputable PatSyn.PatSyn
instance Outputable.OutputableBndr PatSyn.PatSyn
instance Data.Data.Data PatSyn.PatSyn
module Literal
-- | So-called Literals are one of:
--
--
-- - An unboxed (machine) literal (MachInt,
-- MachFloat, etc.), which is presumed to be surrounded by
-- appropriate constructors (Int#, etc.), so that the overall
-- thing makes sense.
--
--
-- We maintain the invariant that the Integer the Mach{Int,Word}*
-- constructors are actually in the (possibly target-dependent) range.
-- The mkMach{Int,Word}*Wrap smart constructors ensure this by applying
-- the target machine's wrapping semantics. Use these in situations where
-- you know the wrapping semantics are correct.
--
--
-- - The literal derived from the label mentioned in a "foreign label"
-- declaration (MachLabel)
--
data Literal
-- | Char# - at least 31 bits. Create with mkMachChar
MachChar :: Char -> Literal
-- | A string-literal: stored and emitted UTF-8 encoded, we'll arrange to
-- decode it at runtime. Also emitted with a '\0' terminator.
-- Create with mkMachString
MachStr :: ByteString -> Literal
-- | The NULL pointer, the only pointer value that can be
-- represented as a Literal. Create with nullAddrLit
MachNullAddr :: Literal
-- | Int# - according to target machine
MachInt :: Integer -> Literal
-- | Int64# - exactly 64 bits
MachInt64 :: Integer -> Literal
-- | Word# - according to target machine
MachWord :: Integer -> Literal
-- | Word64# - exactly 64 bits
MachWord64 :: Integer -> Literal
-- | Float#. Create with mkMachFloat
MachFloat :: Rational -> Literal
-- | Double#. Create with mkMachDouble
MachDouble :: Rational -> Literal
-- | A label literal. Parameters:
--
-- 1) The name of the symbol mentioned in the declaration
--
-- 2) The size (in bytes) of the arguments the label expects. Only
-- applicable with stdcall labels. Just x =>
-- <x> will be appended to label name when emitting
-- assembly.
MachLabel :: FastString -> (Maybe Int) -> FunctionOrData -> Literal
LitInteger :: Integer -> Type -> Literal
-- | Creates a Literal of type Int#
mkMachInt :: DynFlags -> Integer -> Literal
-- | Creates a Literal of type Int#. If the argument is out
-- of the (target-dependent) range, it is wrapped.
mkMachIntWrap :: DynFlags -> Integer -> Literal
-- | Creates a Literal of type Word#
mkMachWord :: DynFlags -> Integer -> Literal
-- | Creates a Literal of type Word#. If the argument is
-- out of the (target-dependent) range, it is wrapped.
mkMachWordWrap :: DynFlags -> Integer -> Literal
-- | Creates a Literal of type Int64#
mkMachInt64 :: Integer -> Literal
-- | Creates a Literal of type Int64#. If the argument is
-- out of the range, it is wrapped.
mkMachInt64Wrap :: Integer -> Literal
-- | Creates a Literal of type Word64#
mkMachWord64 :: Integer -> Literal
-- | Creates a Literal of type Word64#. If the argument is
-- out of the range, it is wrapped.
mkMachWord64Wrap :: Integer -> Literal
-- | Creates a Literal of type Float#
mkMachFloat :: Rational -> Literal
-- | Creates a Literal of type Double#
mkMachDouble :: Rational -> Literal
-- | Creates a Literal of type Char#
mkMachChar :: Char -> Literal
-- | Creates a Literal of type Addr#, which is appropriate
-- for passing to e.g. some of the "error" functions in GHC.Err such as
-- GHC.Err.runtimeError
mkMachString :: String -> Literal
mkLitInteger :: Integer -> Type -> Literal
-- | Find the Haskell Type the literal occupies
literalType :: Literal -> Type
absentLiteralOf :: TyCon -> Maybe Literal
pprLiteral :: (SDoc -> SDoc) -> Literal -> SDoc
-- | True if code space does not go bad if we duplicate this literal
-- Currently we treat it just like litIsTrivial
litIsDupable :: DynFlags -> Literal -> Bool
-- | True if there is absolutely no penalty to duplicating the literal.
-- False principally of strings.
--
-- "Why?", you say? I'm glad you asked. Well, for one duplicating strings
-- would blow up code sizes. Not only this, it's also unsafe.
--
-- Consider a program that wants to traverse a string. One way it might
-- do this is to first compute the Addr# pointing to the end of the
-- string, and then, starting from the beginning, bump a pointer using
-- eqAddr# to determine the end. For instance,
--
--
-- -- Given pointers to the start and end of a string, count how many zeros
-- -- the string contains.
-- countZeros :: Addr -> -> Int
-- countZeros start end = go start 0
-- where
-- go off n
-- | off `addrEq#` end = n
-- | otherwise = go (off `plusAddr#` 1) n'
-- where n' | isTrue off 0 0#) = n + 1
-- | otherwise = n
--
--
-- Consider what happens if we considered strings to be trivial (and
-- therefore duplicable) and emitted a call like countZeros "hello"
-- plusAddr# 5). The beginning and end pointers do not
-- belong to the same string, meaning that an iteration like the above
-- would blow up terribly. This is what happened in #12757.
--
-- Ultimately the solution here is to make primitive strings a bit more
-- structured, ensuring that the compiler can't inline in ways that will
-- break user code. One approach to this is described in #8472.
litIsTrivial :: Literal -> Bool
litIsLifted :: Literal -> Bool
inIntRange :: DynFlags -> Integer -> Bool
inWordRange :: DynFlags -> Integer -> Bool
tARGET_MAX_INT :: DynFlags -> Integer
inCharRange :: Char -> Bool
-- | Tests whether the literal represents a zero of whatever type it is
isZeroLit :: Literal -> Bool
litFitsInChar :: Literal -> Bool
-- | Returns the Integer contained in the Literal, for when
-- that makes sense, i.e. for Char, Int, Word and
-- LitInteger.
litValue :: Literal -> Integer
-- | Indicate if the Literal contains an Integer value, e.g.
-- Char, Int, Word and LitInteger.
isLitValue :: Literal -> Bool
-- | Returns the Integer contained in the Literal, for when
-- that makes sense, i.e. for Char, Int, Word and
-- LitInteger.
isLitValue_maybe :: Literal -> Maybe Integer
-- | Apply a function to the Integer contained in the
-- Literal, for when that makes sense, e.g. for Char,
-- Int, Word and LitInteger. For fixed-size integral
-- literals, the result will be wrapped in accordance with the semantics
-- of the target type.
mapLitValue :: DynFlags -> (Integer -> Integer) -> Literal -> Literal
word2IntLit :: DynFlags -> Literal -> Literal
int2WordLit :: DynFlags -> Literal -> Literal
narrow8IntLit :: Literal -> Literal
narrow16IntLit :: Literal -> Literal
narrow32IntLit :: Literal -> Literal
narrow8WordLit :: Literal -> Literal
narrow16WordLit :: Literal -> Literal
narrow32WordLit :: Literal -> Literal
char2IntLit :: Literal -> Literal
int2CharLit :: Literal -> Literal
float2IntLit :: Literal -> Literal
int2FloatLit :: Literal -> Literal
double2IntLit :: Literal -> Literal
int2DoubleLit :: Literal -> Literal
nullAddrLit :: Literal
float2DoubleLit :: Literal -> Literal
double2FloatLit :: Literal -> Literal
instance Data.Data.Data Literal.Literal
instance Binary.Binary Literal.Literal
instance Outputable.Outputable Literal.Literal
instance GHC.Classes.Eq Literal.Literal
instance GHC.Classes.Ord Literal.Literal
-- | Module for (a) type kinds and (b) type coercions, as used in System
-- FC. See Expr for more on System FC and how coercions fit into
-- it.
module Coercion
-- | A Coercion is concrete evidence of the equality/convertibility
-- of two types.
data Coercion
type CoercionN = Coercion
type CoercionR = Coercion
type CoercionP = Coercion
-- | For simplicity, we have just one UnivCo that represents a coercion
-- from some type to some other type, with (in general) no restrictions
-- on the type. The UnivCoProvenance specifies more exactly what the
-- coercion really is and why a program should (or shouldn't!) trust the
-- coercion. It is reasonable to consider each constructor of
-- UnivCoProvenance as a totally independent coercion form; their
-- only commonality is that they don't tell you what types they coercion
-- between. (That info is in the UnivCo constructor of
-- Coercion.
data UnivCoProvenance
-- | A coercion to be filled in by the type-checker. See Note [Coercion
-- holes]
data CoercionHole
data LeftOrRight
CLeft :: LeftOrRight
CRight :: LeftOrRight
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and it's use sites.
data Var
-- | Coercion Variable
type CoVar = Id
-- | Type or Coercion Variable
type TyCoVar = Id
data Role
Nominal :: Role
Representational :: Role
Phantom :: Role
ltRole :: Role -> Role -> Bool
coVarTypes :: CoVar -> Pair Type
coVarKind :: CoVar -> Type
coVarKindsTypesRole :: CoVar -> (Kind, Kind, Type, Type, Role)
coVarRole :: CoVar -> Role
coercionType :: Coercion -> Type
-- | If it is the case that
--
--
-- c :: (t1 ~ t2)
--
--
-- i.e. the kind of c relates t1 and t2, then
-- coercionKind c = Pair t1 t2.
coercionKind :: Coercion -> Pair Type
-- | Apply coercionKind to multiple Coercions
coercionKinds :: [Coercion] -> Pair [Type]
-- | Makes a coercion type from two types: the types whose equality is
-- proven by the relevant Coercion
mkCoercionType :: Role -> Type -> Type -> Type
-- | Retrieve the role from a coercion.
coercionRole :: Coercion -> Role
-- | Get a coercion's kind and role. Why both at once? See Note [Computing
-- a coercion kind and role]
coercionKindRole :: Coercion -> (Pair Type, Role)
mkReflCo :: Role -> Type -> Coercion
-- | Make a representational reflexive coercion
mkRepReflCo :: Type -> Coercion
-- | Make a nominal reflexive coercion
mkNomReflCo :: Type -> Coercion
mkCoVarCo :: CoVar -> Coercion
mkCoVarCos :: [CoVar] -> [Coercion]
mkAxInstCo :: Role -> CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Coercion
mkUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [Type] -> [Coercion] -> Coercion
mkAxInstRHS :: CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type
mkUnbranchedAxInstRHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type
-- | Return the left-hand type of the axiom, when the axiom is instantiated
-- at the types given.
mkAxInstLHS :: CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type
-- | Instantiate the left-hand side of an unbranched axiom
mkUnbranchedAxInstLHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type
-- | Make a forall Coercion, where both types related by the
-- coercion are quantified over the same type variable.
mkPiCo :: Role -> Var -> Coercion -> Coercion
mkPiCos :: Role -> [Var] -> Coercion -> Coercion
mkCoCast :: Coercion -> Coercion -> Coercion
-- | Create a symmetric version of the given Coercion that asserts
-- equality between the same types but in the other "direction", so a
-- kind of t1 ~ t2 becomes the kind t2 ~ t1.
mkSymCo :: Coercion -> Coercion
-- | Create a new Coercion by composing the two given
-- Coercions transitively. (co1 ; co2)
mkTransCo :: Coercion -> Coercion -> Coercion
-- | Like mkAppCo, but allows the second coercion to be other than
-- nominal. See Note [mkTransAppCo]. Role r3 cannot be more stringent
-- than either r1 or r2.
mkTransAppCo :: Role -> Coercion -> Type -> Type -> Role -> Coercion -> Type -> Type -> Role -> Coercion
mkNthCo :: Int -> Coercion -> Coercion
mkNthCoRole :: Role -> Int -> Coercion -> Coercion
mkLRCo :: LeftOrRight -> Coercion -> Coercion
-- | Instantiates a Coercion.
mkInstCo :: Coercion -> Coercion -> Coercion
-- | Apply a Coercion to another Coercion. The second
-- coercion must be Nominal, unless the first is Phantom. If the first is
-- Phantom, then the second can be either Phantom or Nominal.
mkAppCo :: Coercion -> Coercion -> Coercion
-- | Applies multiple Coercions to another Coercion, from
-- left to right. See also mkAppCo.
mkAppCos :: Coercion -> [Coercion] -> Coercion
-- | Apply a type constructor to a list of coercions. It is the caller's
-- responsibility to get the roles correct on argument coercions.
mkTyConAppCo :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion
-- | Build a function Coercion from two other Coercions. That
-- is, given co1 :: a ~ b and co2 :: x ~ y produce
-- co :: (a -> x) ~ (b -> y).
mkFunCo :: Role -> Coercion -> Coercion -> Coercion
-- | Make nested function Coercions
mkFunCos :: Role -> [Coercion] -> Coercion -> Coercion
-- | Make a Coercion from a tyvar, a kind coercion, and a body coercion.
-- The kind of the tyvar should be the left-hand kind of the kind
-- coercion.
mkForAllCo :: TyVar -> Coercion -> Coercion -> Coercion
-- | Make nested ForAllCos
mkForAllCos :: [(TyVar, Coercion)] -> Coercion -> Coercion
-- | Make a Coercion quantified over a type variable; the variable has the
-- same type in both sides of the coercion
mkHomoForAllCos :: [TyVar] -> Coercion -> Coercion
-- | Like mkHomoForAllCos, but doesn't check if the inner coercion
-- is reflexive.
mkHomoForAllCos_NoRefl :: [TyVar] -> Coercion -> Coercion
-- | Make a phantom coercion between two types. The coercion passed in must
-- be a nominal coercion between the kinds of the types.
mkPhantomCo :: Coercion -> Type -> Type -> Coercion
-- | Make a phantom coercion between two types of the same kind.
mkHomoPhantomCo :: Type -> Type -> Coercion
toPhantomCo :: Coercion -> Coercion
-- | Manufacture an unsafe coercion from thin air. Currently (May 14) this
-- is used only to implement the unsafeCoerce# primitive.
-- Optimise by pushing down through type constructors.
mkUnsafeCo :: Role -> Type -> Type -> Coercion
-- | Make a coercion from a coercion hole
mkHoleCo :: CoercionHole -> Role -> Type -> Type -> Coercion
-- | Make a universal coercion between two arbitrary types.
mkUnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
mkSubCo :: Coercion -> Coercion
mkAxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion
-- | Make a "coercion between coercions".
mkProofIrrelCo :: Role -> Coercion -> Coercion -> Coercion -> Coercion
-- | Like downgradeRole_maybe, but panics if the change isn't a
-- downgrade. See Note [Role twiddling functions]
downgradeRole :: Role -> Role -> Coercion -> Coercion
-- | If the EqRel is ReprEq, makes a SubCo; otherwise, does nothing. Note
-- that the input coercion should always be nominal.
maybeSubCo :: EqRel -> Coercion -> Coercion
mkAxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion
mkCoherenceCo :: Coercion -> Coercion -> Coercion
infixl 5 `mkCoherenceCo`
-- | A CoherenceCo c1 c2 applies the coercion c2 to the left-hand type in
-- the kind of c1. This function uses sym to get the coercion on the
-- right-hand type of c1. Thus, if c1 :: s ~ t, then mkCoherenceRightCo
-- c1 c2 has the kind (s ~ (t |> c2)) down through type constructors.
-- The second coercion must be representational.
mkCoherenceRightCo :: Coercion -> Coercion -> Coercion
infixl 5 `mkCoherenceRightCo`
-- | An explicitly directed synonym of mkCoherenceCo. The second coercion
-- must be representational.
mkCoherenceLeftCo :: Coercion -> Coercion -> Coercion
infixl 5 `mkCoherenceLeftCo`
-- | Given co :: (a :: k) ~ (b :: k') produce co' :: k ~
-- k'.
mkKindCo :: Coercion -> Coercion
-- | Creates a new coercion with both of its types casted by different
-- casts castCoercionKind g h1 h2, where g :: t1 ~ t2, has type (t1 |>
-- h1) ~ (t2 |> h2) The second and third coercions must be nominal.
castCoercionKind :: Coercion -> Coercion -> Coercion -> Coercion
mkHeteroCoercionType :: Role -> Kind -> Kind -> Type -> Type -> Type
-- | If co :: T ts ~ rep_ty then:
--
--
-- instNewTyCon_maybe T ts = Just (rep_ty, co)
--
--
-- Checks for a newtype, and for being saturated
instNewTyCon_maybe :: TyCon -> [Type] -> Maybe (Type, Coercion)
-- | A function to check if we can reduce a type by one step. Used with
-- topNormaliseTypeX.
type NormaliseStepper ev = RecTcChecker -> TyCon -> [Type] -> NormaliseStepResult ev
-- | The result of stepping in a normalisation function. See
-- topNormaliseTypeX.
data NormaliseStepResult ev
-- | Nothing more to do
NS_Done :: NormaliseStepResult ev
-- | Utter failure. The outer function should fail too.
NS_Abort :: NormaliseStepResult ev
-- | We stepped, yielding new bits; ^ ev is evidence; Usually a co :: old
-- type ~ new type
NS_Step :: RecTcChecker -> Type -> ev -> NormaliseStepResult ev
-- | Try one stepper and then try the next, if the first doesn't make
-- progress. So if it returns NS_Done, it means that both steppers are
-- satisfied
composeSteppers :: NormaliseStepper ev -> NormaliseStepper ev -> NormaliseStepper ev
mapStepResult :: (ev1 -> ev2) -> NormaliseStepResult ev1 -> NormaliseStepResult ev2
-- | A NormaliseStepper that unwraps newtypes, careful not to fall
-- into a loop. If it would fall into a loop, it produces
-- NS_Abort.
unwrapNewTypeStepper :: NormaliseStepper Coercion
-- | Sometimes we want to look through a newtype and get its
-- associated coercion. This function strips off newtype layers
-- enough to reveal something that isn't a newtype.
-- Specifically, here's the invariant:
--
--
-- topNormaliseNewType_maybe rec_nts ty = Just (co, ty')
--
--
-- then (a) co : ty0 ~ ty'. (b) ty' is not a newtype.
--
-- The function returns Nothing for non-newtypes, or
-- unsaturated applications
--
-- This function does *not* look through type families, because it has no
-- access to the type family environment. If you do have that at hand,
-- consider to use topNormaliseType_maybe, which should be a drop-in
-- replacement for topNormaliseNewType_maybe If topNormliseNewType_maybe
-- ty = Just (co, ty'), then co : ty ~R ty'
topNormaliseNewType_maybe :: Type -> Maybe (Coercion, Type)
-- | A general function for normalising the top-level of a type. It
-- continues to use the provided NormaliseStepper until that
-- function fails, and then this function returns. The roles of the
-- coercions produced by the NormaliseStepper must all be the
-- same, which is the role returned from the call to
-- topNormaliseTypeX.
--
-- Typically ev is Coercion.
--
-- If topNormaliseTypeX step plus ty = Just (ev, ty') then ty ~ev1~ t1
-- ~ev2~ t2 ... ~evn~ ty' and ev = ev1 plus ev2 plus
-- ... plus evn If it returns Nothing then no newtype unwrapping
-- could happen
topNormaliseTypeX :: NormaliseStepper ev -> (ev -> ev -> ev) -> Type -> Maybe (ev, Type)
-- | This breaks a Coercion with type T A B C ~ T D E F
-- into a list of Coercions of kinds A ~ D, B ~
-- E and E ~ F. Hence:
--
--
-- decomposeCo 3 c = [nth 0 c, nth 1 c, nth 2 c]
--
decomposeCo :: Arity -> Coercion -> [Coercion]
decomposeFunCo :: Coercion -> (Coercion, Coercion)
-- | Attempts to obtain the type variable underlying a Coercion
getCoVar_maybe :: Coercion -> Maybe CoVar
-- | Attempts to tease a coercion apart into a type constructor and the
-- application of a number of coercion arguments to that constructor
splitTyConAppCo_maybe :: Coercion -> Maybe (TyCon, [Coercion])
-- | Attempt to take a coercion application apart.
splitAppCo_maybe :: Coercion -> Maybe (Coercion, Coercion)
splitFunCo_maybe :: Coercion -> Maybe (Coercion, Coercion)
splitForAllCo_maybe :: Coercion -> Maybe (TyVar, Coercion, Coercion)
nthRole :: Role -> TyCon -> Int -> Role
tyConRolesX :: Role -> TyCon -> [Role]
tyConRolesRepresentational :: TyCon -> [Role]
-- | Converts a coercion to be nominal, if possible. See Note [Role
-- twiddling functions]
setNominalRole_maybe :: Coercion -> Maybe Coercion
pickLR :: LeftOrRight -> (a, a) -> a
-- | Tests if this coercion is obviously reflexive. Guaranteed to work very
-- quickly. Sometimes a coercion can be reflexive, but not obviously so.
-- c.f. isReflexiveCo
isReflCo :: Coercion -> Bool
-- | Returns the type coerced if this coercion is reflexive. Guaranteed to
-- work very quickly. Sometimes a coercion can be reflexive, but not
-- obviously so. c.f. isReflexiveCo_maybe
isReflCo_maybe :: Coercion -> Maybe (Type, Role)
-- | Slowly checks if the coercion is reflexive. Don't call this in a loop,
-- as it walks over the entire coercion.
isReflexiveCo :: Coercion -> Bool
-- | Extracts the coerced type from a reflexive coercion. This potentially
-- walks over the entire coercion, so avoid doing this in a loop.
isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role)
isReflCoVar_maybe :: CoVar -> Maybe Coercion
mkCoVar :: Name -> Type -> CoVar
isCoVar :: Var -> Bool
coVarName :: CoVar -> Name
setCoVarName :: CoVar -> Name -> CoVar
setCoVarUnique :: CoVar -> Unique -> CoVar
-- | Extract a covar, if possible. This check is dirty. Be ashamed of
-- yourself. (It's dirty because it cares about the structure of a
-- coercion, which is morally reprehensible.)
isCoVar_maybe :: Coercion -> Maybe CoVar
tyCoVarsOfCo :: Coercion -> TyCoVarSet
tyCoVarsOfCos :: [Coercion] -> TyCoVarSet
coVarsOfCo :: Coercion -> CoVarSet
tyCoFVsOfCo :: Coercion -> FV
tyCoFVsOfCos :: [Coercion] -> FV
-- | Get a deterministic set of the vars free in a coercion
tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet
coercionSize :: Coercion -> Int
-- | A substitution of Coercions for CoVars
type CvSubstEnv = CoVarEnv Coercion
emptyCvSubstEnv :: CvSubstEnv
lookupCoVar :: TCvSubst -> Var -> Maybe Coercion
-- | Substitute within a Coercion The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substCo :: HasCallStack => TCvSubst -> Coercion -> Coercion
-- | Substitute within several Coercions The substitution has to
-- satisfy the invariants described in Note [The substitution invariant].
substCos :: HasCallStack => TCvSubst -> [Coercion] -> [Coercion]
substCoVar :: TCvSubst -> CoVar -> Coercion
substCoVars :: TCvSubst -> [CoVar] -> [Coercion]
-- | Coercion substitution, see zipTvSubst
substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion
substCoVarBndr :: TCvSubst -> CoVar -> (TCvSubst, CoVar)
extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
getCvSubstEnv :: TCvSubst -> CvSubstEnv
-- | liftCoSubst role lc ty produces a coercion (at role
-- role) that coerces between lc_left(ty) and
-- lc_right(ty), where lc_left is a substitution
-- mapping type variables to the left-hand types of the mapped coercions
-- in lc, and similar for lc_right.
liftCoSubst :: Role -> LiftingContext -> Type -> Coercion
liftCoSubstTyVar :: LiftingContext -> Role -> TyVar -> Maybe Coercion
liftCoSubstWith :: Role -> [TyCoVar] -> [Coercion] -> Type -> Coercion
liftCoSubstWithEx :: Role -> [TyVar] -> [Coercion] -> [TyVar] -> [Type] -> (Type -> Coercion, [Type])
emptyLiftingContext :: InScopeSet -> LiftingContext
-- | Extend a lifting context with a new type mapping.
extendLiftingContext :: LiftingContext -> TyVar -> Coercion -> LiftingContext
liftCoSubstVarBndrCallback :: (LiftingContext -> Type -> (Coercion, a)) -> LiftingContext -> TyVar -> (LiftingContext, TyVar, Coercion, a)
-- | Is a var in the domain of a lifting context?
isMappedByLC :: TyCoVar -> LiftingContext -> Bool
mkSubstLiftingContext :: TCvSubst -> LiftingContext
-- | Erase the environments in a lifting context
zapLiftingContext :: LiftingContext -> LiftingContext
-- | Like substForAllCoBndr, but works on a lifting context
substForAllCoBndrCallbackLC :: Bool -> (Coercion -> Coercion) -> LiftingContext -> TyVar -> Coercion -> (LiftingContext, TyVar, Coercion)
-- | Extract the underlying substitution from the LiftingContext
lcTCvSubst :: LiftingContext -> TCvSubst
-- | Get the InScopeSet from a LiftingContext
lcInScopeSet :: LiftingContext -> InScopeSet
type LiftCoEnv = VarEnv Coercion
data LiftingContext
LC :: TCvSubst -> LiftCoEnv -> LiftingContext
liftEnvSubstLeft :: TCvSubst -> LiftCoEnv -> TCvSubst
liftEnvSubstRight :: TCvSubst -> LiftCoEnv -> TCvSubst
substRightCo :: LiftingContext -> Coercion -> Coercion
substLeftCo :: LiftingContext -> Coercion -> Coercion
-- | Apply "sym" to all coercions in a LiftCoEnv
swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv
lcSubstLeft :: LiftingContext -> TCvSubst
lcSubstRight :: LiftingContext -> TCvSubst
-- | Syntactic equality of coercions
eqCoercion :: Coercion -> Coercion -> Bool
-- | Compare two Coercions, with respect to an RnEnv2
eqCoercionX :: RnEnv2 -> Coercion -> Coercion -> Bool
seqCo :: Coercion -> ()
pprCo :: Coercion -> SDoc
pprParendCo :: Coercion -> SDoc
pprCoBndr :: Name -> Coercion -> SDoc
pprCoAxiom :: CoAxiom br -> SDoc
pprCoAxBranch :: CoAxiom br -> CoAxBranch -> SDoc
pprCoAxBranchHdr :: CoAxiom br -> BranchIndex -> SDoc
tidyCo :: TidyEnv -> Coercion -> Coercion
tidyCos :: TidyEnv -> [Coercion] -> [Coercion]
-- | like mkKindCo, but aggressively & recursively optimizes to avoid
-- using a KindCo constructor. The output role is nominal.
promoteCoercion :: Coercion -> Coercion
instance Outputable.Outputable Coercion.LiftingContext
module Unify
-- | tcMatchTy t1 t2 produces a substitution (over fvs(t1))
-- s such that s(t1) equals t2. The returned
-- substitution might bind coercion variables, if the variable is an
-- argument to a GADT constructor.
--
-- Precondition: typeKind ty1 eqType typeKind ty2
--
-- We don't pass in a set of "template variables" to be bound by the
-- match, because tcMatchTy (and similar functions) are always used on
-- top-level types, so we can bind any of the free variables of the LHS.
tcMatchTy :: Type -> Type -> Maybe TCvSubst
-- | Like tcMatchTy, but allows the kinds of the types to differ,
-- and thus matches them as well.
tcMatchTyKi :: Type -> Type -> Maybe TCvSubst
-- | Like tcMatchTy but over a list of types.
tcMatchTys :: [Type] -> [Type] -> Maybe TCvSubst
-- | Like tcMatchTyKi but over a list of types.
tcMatchTyKis :: [Type] -> [Type] -> Maybe TCvSubst
-- | This is similar to tcMatchTy, but extends a substitution
tcMatchTyX :: TCvSubst -> Type -> Type -> Maybe TCvSubst
-- | Like tcMatchTys, but extending a substitution
tcMatchTysX :: TCvSubst -> [Type] -> [Type] -> Maybe TCvSubst
-- | Like tcMatchTyKis, but extending a substitution
tcMatchTyKisX :: TCvSubst -> [Type] -> [Type] -> Maybe TCvSubst
-- | This one is called from the expression matcher, which already has a
-- MatchEnv in hand
ruleMatchTyKiX :: TyCoVarSet -> RnEnv2 -> TvSubstEnv -> Type -> Type -> Maybe TvSubstEnv
roughMatchTcs :: [Type] -> [Maybe Name]
instanceCantMatch :: [Maybe Name] -> [Maybe Name] -> Bool
-- | Given a list of pairs of types, are any two members of a pair surely
-- apart, even after arbitrary type function evaluation and substitution?
typesCantMatch :: [(Type, Type)] -> Bool
-- | Simple unification of two types; all type variables are bindable
-- Precondition: the kinds are already equal
tcUnifyTy :: Type -> Type -> Maybe TCvSubst
-- | Like tcUnifyTy, but also unifies the kinds
tcUnifyTyKi :: Type -> Type -> Maybe TCvSubst
tcUnifyTys :: (TyCoVar -> BindFlag) -> [Type] -> [Type] -> Maybe TCvSubst
-- | Like tcUnifyTys but also unifies the kinds
tcUnifyTyKis :: (TyCoVar -> BindFlag) -> [Type] -> [Type] -> Maybe TCvSubst
-- | tcUnifyTysFG bind_tv tys1 tys2 attepts to find a substitution
-- s (whose domain elements all respond BindMe to
-- bind_tv) such that s(tys1) and that of
-- s(tys2) are equal, as witnessed by the returned Coercions.
-- This version requires that the kinds of the types are the same, if you
-- unify left-to-right.
tcUnifyTysFG :: (TyVar -> BindFlag) -> [Type] -> [Type] -> UnifyResult
-- | Unify two types, treating type family applications as possibly
-- unifying with anything and looking through injective type family
-- applications. Precondition: kinds are the same
tcUnifyTyWithTFs :: Bool -> Type -> Type -> Maybe TCvSubst
data BindFlag
BindMe :: BindFlag
Skolem :: BindFlag
type UnifyResult = UnifyResultM TCvSubst
data UnifyResultM a
Unifiable :: a -> UnifyResultM a
MaybeApart :: a -> UnifyResultM a
SurelyApart :: UnifyResultM a
-- | liftCoMatch is sort of inverse to liftCoSubst. In
-- particular, if liftCoMatch vars ty co == Just s, then
-- listCoSubst s ty == co, where == there means that
-- the result of liftCoSubst has the same type as the original co;
-- but may be different under the hood. That is, it matches a type
-- against a coercion of the same "shape", and returns a lifting
-- substitution which could have been used to produce the given coercion
-- from the given type. Note that this function is incomplete -- it might
-- return Nothing when there does indeed exist a possible lifting
-- context.
--
-- This function is incomplete in that it doesn't respect the equality in
-- eqType. That is, it's possible that this will succeed for t1
-- and fail for t2, even when t1 eqType t2. That's because it
-- depends on there being a very similar structure between the type and
-- the coercion. This incompleteness shouldn't be all that surprising,
-- especially because it depends on the structure of the coercion, which
-- is a silly thing to do.
--
-- The lifting context produced doesn't have to be exacting in the roles
-- of the mappings. This is because any use of the lifting context will
-- also require a desired role. Thus, this algorithm prefers mapping to
-- nominal coercions where it can do so.
liftCoMatch :: TyCoVarSet -> Type -> Coercion -> Maybe LiftingContext
instance GHC.Classes.Eq Unify.BindFlag
instance GHC.Base.Functor Unify.UnifyResultM
instance GHC.Base.Functor Unify.UM
instance GHC.Base.Applicative Unify.UM
instance GHC.Base.Monad Unify.UM
instance GHC.Base.Alternative Unify.UM
instance GHC.Base.MonadPlus Unify.UM
instance Control.Monad.Fail.MonadFail Unify.UM
instance GHC.Base.Applicative Unify.UnifyResultM
instance GHC.Base.Monad Unify.UnifyResultM
instance GHC.Base.Alternative Unify.UnifyResultM
instance GHC.Base.MonadPlus Unify.UnifyResultM
instance Outputable.Outputable a => Outputable.Outputable (Unify.UnifyResultM a)
module DataCon
-- | A data constructor
--
--
data DataCon
-- | Data Constructor Representation
data DataConRep
NoDataConRep :: DataConRep
DCR :: Id -> DataConBoxer -> [Type] -> [StrictnessMark] -> [HsImplBang] -> DataConRep
[dcr_wrap_id] :: DataConRep -> Id
[dcr_boxer] :: DataConRep -> DataConBoxer
[dcr_arg_tys] :: DataConRep -> [Type]
[dcr_stricts] :: DataConRep -> [StrictnessMark]
[dcr_bangs] :: DataConRep -> [HsImplBang]
-- | Source Strictness
--
-- What strictness annotation the user wrote
data SrcStrictness
-- | Lazy, ie '~'
SrcLazy :: SrcStrictness
-- | Strict, ie !
SrcStrict :: SrcStrictness
-- | no strictness annotation
NoSrcStrict :: SrcStrictness
-- | Source Unpackedness
--
-- What unpackedness the user requested
data SrcUnpackedness
-- | {--} specified
SrcUnpack :: SrcUnpackedness
-- | {--} specified
SrcNoUnpack :: SrcUnpackedness
-- | no unpack pragma
NoSrcUnpack :: SrcUnpackedness
-- | Haskell Source Bang
--
-- Bangs on data constructor arguments as the user wrote them in the
-- source code.
--
-- (HsSrcBang _ SrcUnpack SrcLazy) and (HsSrcBang _
-- SrcUnpack NoSrcStrict) (without StrictData) makes no sense, we
-- emit a warning (in checkValidDataCon) and treat it like (HsSrcBang
-- _ NoSrcUnpack SrcLazy)
data HsSrcBang
HsSrcBang :: SourceText -> SrcUnpackedness -> SrcStrictness -> HsSrcBang
-- | Haskell Implementation Bang
--
-- Bangs of data constructor arguments as generated by the compiler after
-- consulting HsSrcBang, flags, etc.
data HsImplBang
-- | Lazy field
HsLazy :: HsImplBang
-- | Strict but not unpacked field
HsStrict :: HsImplBang
-- | Strict and unpacked field co :: arg-ty ~ product-ty HsBang
HsUnpack :: (Maybe Coercion) -> HsImplBang
data StrictnessMark
MarkedStrict :: StrictnessMark
NotMarkedStrict :: StrictnessMark
-- | Constructor Tag
--
-- Type of the tags associated with each constructor possibility or
-- superclass selector
type ConTag = Int
-- | An EqSpec is a tyvar/type pair representing an equality made in
-- rejigging a GADT constructor
data EqSpec
-- | Make an EqSpec
mkEqSpec :: TyVar -> Type -> EqSpec
eqSpecTyVar :: EqSpec -> TyVar
eqSpecType :: EqSpec -> Type
eqSpecPair :: EqSpec -> (TyVar, Type)
eqSpecPreds :: [EqSpec] -> ThetaType
-- | Substitute in an EqSpec. Precondition: if the LHS of the EqSpec
-- is mapped in the substitution, it is mapped to a type variable, not a
-- full type.
substEqSpec :: TCvSubst -> EqSpec -> EqSpec
-- | Filter out any TyBinders mentioned in an EqSpec
filterEqSpec :: [EqSpec] -> [TyVarBinder] -> [TyVarBinder]
-- | Fields in an algebraic record type
data FieldLbl a
FieldLabel :: FieldLabelString -> Bool -> a -> FieldLbl a
-- | User-visible label of the field
[flLabel] :: FieldLbl a -> FieldLabelString
-- | Was DuplicateRecordFields on in the defining module for this datatype?
[flIsOverloaded] :: FieldLbl a -> Bool
-- | Record selector function
[flSelector] :: FieldLbl a -> a
type FieldLabel = FieldLbl Name
-- | Field labels are just represented as strings; they are not necessarily
-- unique (even within a module)
type FieldLabelString = FastString
-- | Build a new data constructor
mkDataCon :: Name -> Bool -> TyConRepName -> [HsSrcBang] -> [FieldLabel] -> [TyVarBinder] -> [TyVarBinder] -> [EqSpec] -> ThetaType -> [Type] -> Type -> RuntimeRepInfo -> TyCon -> ThetaType -> Id -> DataConRep -> DataCon
buildAlgTyCon :: Name -> [TyVar] -> [Role] -> Maybe CType -> ThetaType -> AlgTyConRhs -> Bool -> AlgTyConFlav -> TyCon
buildSynTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> TyCon
-- | Tags are allocated from here for real constructors or for superclass
-- selectors
fIRST_TAG :: ConTag
-- | The representation type of the data constructor, i.e. the sort type
-- that will represent values of this type at runtime
dataConRepType :: DataCon -> Type
-- | The "signature" of the DataCon returns, in order:
--
-- 1) The result of dataConAllTyVars,
--
-- 2) All the ThetaTypes relating to the DataCon (coercion,
-- dictionary, implicit parameter - whatever)
--
-- 3) The type arguments to the constructor
--
-- 4) The original result type of the DataCon
dataConSig :: DataCon -> ([TyVar], ThetaType, [Type], Type)
-- | Instantantiate the universal tyvars of a data con, returning the
-- instantiated existentials, constraints, and args
dataConInstSig :: DataCon -> [Type] -> ([TyVar], ThetaType, [Type])
-- | The "full signature" of the DataCon returns, in order:
--
-- 1) The result of dataConUnivTyVars
--
-- 2) The result of dataConExTyVars
--
-- 3) The GADT equalities
--
-- 4) The result of dataConDictTheta
--
-- 5) The original argument types to the DataCon (i.e. before any
-- change of the representation of the type)
--
-- 6) The original result type of the DataCon
dataConFullSig :: DataCon -> ([TyVar], [TyVar], [EqSpec], ThetaType, [Type], Type)
-- | The Name of the DataCon, giving it a unique, rooted
-- identification
dataConName :: DataCon -> Name
-- | The string package:module.name identifying a constructor,
-- which is attached to its info table and used by the GHCi debugger and
-- the heap profiler
dataConIdentity :: DataCon -> [Word8]
-- | The tag used for ordering DataCons
dataConTag :: DataCon -> ConTag
-- | The type constructor that we are building via this data constructor
dataConTyCon :: DataCon -> TyCon
-- | The original type constructor used in the definition of this data
-- constructor. In case of a data family instance, that will be the
-- family type constructor.
dataConOrigTyCon :: DataCon -> TyCon
-- | The user-declared type of the data constructor in the nice-to-read
-- form:
--
--
-- T :: forall a b. a -> b -> T [a]
--
--
-- rather than:
--
--
-- T :: forall a c. forall b. (c~[a]) => a -> b -> T c
--
--
-- NB: If the constructor is part of a data instance, the result type
-- mentions the family tycon, not the internal one.
dataConUserType :: DataCon -> Type
-- | The universally-quantified type variables of the constructor
dataConUnivTyVars :: DataCon -> [TyVar]
-- | TyBinders for the universally-quantified type variables
dataConUnivTyVarBinders :: DataCon -> [TyVarBinder]
-- | The existentially-quantified type variables of the constructor
dataConExTyVars :: DataCon -> [TyVar]
-- | TyBinders for the existentially-quantified type variables
dataConExTyVarBinders :: DataCon -> [TyVarBinder]
-- | Both the universal and existentiatial type variables of the
-- constructor
dataConAllTyVars :: DataCon -> [TyVar]
-- | Equalities derived from the result type of the data constructor, as
-- written by the programmer in any GADT declaration. This includes *all*
-- GADT-like equalities, including those written in by hand by the
-- programmer.
dataConEqSpec :: DataCon -> [EqSpec]
-- | The *full* constraints on the constructor type.
dataConTheta :: DataCon -> ThetaType
-- | The "stupid theta" of the DataCon, such as data Eq a
-- in:
--
--
-- data Eq a => T a = ...
--
dataConStupidTheta :: DataCon -> ThetaType
-- | Finds the instantiated types of the arguments required to construct a
-- DataCon representation NB: these INCLUDE any dictionary args
-- but EXCLUDE the data-declaration context, which is discarded It's all
-- post-flattening etc; this is a representation type
dataConInstArgTys :: DataCon -> [Type] -> [Type]
-- | Returns the argument types of the wrapper, excluding all dictionary
-- arguments and without substituting for any type variables
dataConOrigArgTys :: DataCon -> [Type]
dataConOrigResTy :: DataCon -> Type
-- | Returns just the instantiated value argument types of a
-- DataCon, (excluding dictionary args)
dataConInstOrigArgTys :: DataCon -> [Type] -> [Type]
-- | Returns the arg types of the worker, including *all* evidence, after
-- any flattening has been done and without substituting for any type
-- variables
dataConRepArgTys :: DataCon -> [Type]
-- | The labels for the fields of this particular DataCon
dataConFieldLabels :: DataCon -> [FieldLabel]
-- | Extract the type for any given labelled field of the DataCon
dataConFieldType :: DataCon -> FieldLabelString -> Type
-- | Extract the label and type for any given labelled field of the
-- DataCon, or return Nothing if the field does not belong
-- to it
dataConFieldType_maybe :: DataCon -> FieldLabelString -> Maybe (FieldLabel, Type)
-- | Strictness/unpack annotations, from user; or, for imported DataCons,
-- from the interface file The list is in one-to-one correspondence with
-- the arity of the DataCon
dataConSrcBangs :: DataCon -> [HsSrcBang]
-- | Source-level arity of the data constructor
dataConSourceArity :: DataCon -> Arity
-- | Gives the number of actual fields in the representation of the
-- data constructor. This may be more than appear in the source code; the
-- extra ones are the existentially quantified dictionaries
dataConRepArity :: DataCon -> Arity
-- | Should the DataCon be presented infix?
dataConIsInfix :: DataCon -> Bool
-- | Get the Id of the DataCon worker: a function that is the
-- "actual" constructor and has no top level binding in the program. The
-- type may be different from the obvious one written in the source
-- program. Panics if there is no such Id for this DataCon
dataConWorkId :: DataCon -> Id
-- | Returns an Id which looks like the Haskell-source constructor by using
-- the wrapper if it exists (see dataConWrapId_maybe) and failing
-- over to the worker (see dataConWorkId)
dataConWrapId :: DataCon -> Id
-- | Get the Id of the DataCon wrapper: a function that wraps the
-- "actual" constructor so it has the type visible in the source program:
-- c.f. dataConWorkId. Returns Nothing if there is no wrapper,
-- which occurs for an algebraic data constructor and also for a newtype
-- (whose constructor is inlined compulsorily)
dataConWrapId_maybe :: DataCon -> Maybe Id
-- | Find all the Ids implicitly brought into scope by the data
-- constructor. Currently, the union of the dataConWorkId and the
-- dataConWrapId
dataConImplicitTyThings :: DataCon -> [TyThing]
-- | Give the demands on the arguments of a Core constructor application
-- (Con dc args)
dataConRepStrictness :: DataCon -> [StrictnessMark]
dataConImplBangs :: DataCon -> [HsImplBang]
dataConBoxer :: DataCon -> Maybe DataConBoxer
-- | Extract the type constructor, type argument, data constructor and it's
-- representation argument types from a type if it is a product
-- type.
--
-- Precisely, we return Just for any type that is all of:
--
--
-- - Concrete (i.e. constructors visible)
-- - Single-constructor
-- - Not existentially quantified
--
--
-- Whether the type is a data type or a newtype
splitDataProductType_maybe :: Type -> Maybe (TyCon, [Type], DataCon, [Type])
-- | Return whether there are any argument types for this DataCons
-- original source type See Note [DataCon arities]
isNullarySrcDataCon :: DataCon -> Bool
-- | Return whether there are any argument types for this DataCons
-- runtime representation type See Note [DataCon arities]
isNullaryRepDataCon :: DataCon -> Bool
isTupleDataCon :: DataCon -> Bool
isUnboxedTupleCon :: DataCon -> Bool
isUnboxedSumCon :: DataCon -> Bool
-- | Vanilla DataCons are those that are nice boring Haskell 98
-- constructors
isVanillaDataCon :: DataCon -> Bool
classDataCon :: Class -> DataCon
dataConCannotMatch :: [Type] -> DataCon -> Bool
isBanged :: HsImplBang -> Bool
isMarkedStrict :: StrictnessMark -> Bool
-- | Compare strictness annotations
eqHsBang :: HsImplBang -> HsImplBang -> Bool
isSrcStrict :: SrcStrictness -> Bool
isSrcUnpacked :: SrcUnpackedness -> Bool
-- | Should this DataCon be allowed in a type even without -XDataKinds?
-- Currently, only Lifted & Unlifted
specialPromotedDc :: DataCon -> Bool
-- | Was this datacon promotable before GHC 8.0? That is, is it promotable
-- without -XTypeInType
isLegacyPromotableDataCon :: DataCon -> Bool
-- | Was this tycon promotable before GHC 8.0? That is, is it promotable
-- without -XTypeInType
isLegacyPromotableTyCon :: TyCon -> Bool
promoteDataCon :: DataCon -> TyCon
instance Data.Data.Data DataCon.HsSrcBang
instance Data.Data.Data DataCon.HsImplBang
instance Data.Data.Data DataCon.SrcUnpackedness
instance GHC.Classes.Eq DataCon.SrcUnpackedness
instance Data.Data.Data DataCon.SrcStrictness
instance GHC.Classes.Eq DataCon.SrcStrictness
instance Outputable.Outputable DataCon.EqSpec
instance GHC.Classes.Eq DataCon.DataCon
instance Unique.Uniquable DataCon.DataCon
instance Name.NamedThing DataCon.DataCon
instance Outputable.Outputable DataCon.DataCon
instance Outputable.OutputableBndr DataCon.DataCon
instance Data.Data.Data DataCon.DataCon
instance Outputable.Outputable DataCon.HsSrcBang
instance Outputable.Outputable DataCon.HsImplBang
instance Outputable.Outputable DataCon.StrictnessMark
instance Outputable.Outputable DataCon.SrcUnpackedness
instance Binary.Binary DataCon.SrcUnpackedness
instance Outputable.Outputable DataCon.SrcStrictness
instance Binary.Binary DataCon.SrcStrictness
module RepType
type UnaryType = Type
type NvUnaryType = Type
isNvUnaryType :: Type -> Bool
-- | Gets rid of the stuff that prevents us from understanding the runtime
-- representation of a type. Including: 1. Casts 2. Newtypes 3. Foralls
-- 4. Synonyms But not type/data families, because we don't have the envs
-- to hand.
unwrapType :: Type -> Type
-- | True if the type has zero width.
isVoidTy :: Type -> Bool
-- | Discovers the primitive representation of a Type. Returns a
-- list of PrimRep: it's a list because of the possibility of no
-- runtime representation (void) or multiple (unboxed tuple/sum)
typePrimRep :: HasDebugCallStack => Type -> [PrimRep]
-- | Like typePrimRep, but assumes that there is precisely one
-- PrimRep output; an empty list of PrimReps becomes a VoidRep
typePrimRep1 :: HasDebugCallStack => UnaryType -> PrimRep
-- | Take a type of kind RuntimeRep and extract the list of PrimRep
-- that it encodes.
runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep]
typePrimRepArgs :: Type -> [PrimRep]
-- | A PrimRep is an abstraction of a type. It contains information
-- that the code generator needs in order to pass arguments, return
-- results, and store values of this type.
data PrimRep
VoidRep :: PrimRep
LiftedRep :: PrimRep
-- | Unlifted pointer
UnliftedRep :: PrimRep
-- | Signed, word-sized value
IntRep :: PrimRep
-- | Unsigned, word-sized value
WordRep :: PrimRep
-- | Signed, 64 bit value (with 32-bit words only)
Int64Rep :: PrimRep
-- | Unsigned, 64 bit value (with 32-bit words only)
Word64Rep :: PrimRep
-- | A pointer, but not to a Haskell value (use '(Un)liftedRep')
AddrRep :: PrimRep
FloatRep :: PrimRep
DoubleRep :: PrimRep
-- | A vector
VecRep :: Int -> PrimElemRep -> PrimRep
-- | Convert a PrimRep back to a Type. Used only in the unariser to give
-- types to fresh Ids. Really, only the type's representation matters.
primRepToType :: PrimRep -> Type
countFunRepArgs :: Arity -> Type -> RepArity
countConRepArgs :: DataCon -> RepArity
-- | Find the runtime representation of a TyCon. Defined here to
-- avoid module loops. Returns a list of the register shapes necessary.
tyConPrimRep :: HasDebugCallStack => TyCon -> [PrimRep]
-- | Like tyConPrimRep, but assumed that there is precisely zero or
-- one PrimRep output
tyConPrimRep1 :: HasDebugCallStack => TyCon -> PrimRep
-- | Given the arguments of a sum type constructor application, return the
-- unboxed sum rep type.
--
-- E.g.
--
-- ( | Maybe Int | (, Float) #)
--
-- We call `ubxSumRepType [ [IntRep], [LiftedRep], [IntRep, FloatRep] ]`,
-- which returns [WordSlot, PtrSlot, WordSlot, FloatSlot]
--
-- INVARIANT: Result slots are sorted (via Ord SlotTy), except that at
-- the head of the list we have the slot for the tag.
ubxSumRepType :: [[PrimRep]] -> [SlotTy]
layoutUbxSum :: SortedSlotTys -> [SlotTy] -> [Int]
typeSlotTy :: UnaryType -> Maybe SlotTy
data SlotTy
PtrSlot :: SlotTy
WordSlot :: SlotTy
Word64Slot :: SlotTy
FloatSlot :: SlotTy
DoubleSlot :: SlotTy
slotPrimRep :: SlotTy -> PrimRep
primRepSlot :: PrimRep -> SlotTy
instance GHC.Classes.Ord RepType.SlotTy
instance GHC.Classes.Eq RepType.SlotTy
instance Outputable.Outputable RepType.SlotTy
module Demand
data StrDmd
data UseDmd
UCall :: Count -> UseDmd -> UseDmd
UProd :: [ArgUse] -> UseDmd
UHead :: UseDmd
Used :: UseDmd
data Count
type Demand = JointDmd ArgStr ArgUse
type CleanDemand = JointDmd StrDmd UseDmd
getStrDmd :: JointDmd s u -> s
getUseDmd :: JointDmd s u -> u
mkProdDmd :: [Demand] -> CleanDemand
mkOnceUsedDmd :: CleanDemand -> Demand
mkManyUsedDmd :: CleanDemand -> Demand
mkHeadStrict :: CleanDemand -> CleanDemand
oneifyDmd :: Demand -> Demand
toCleanDmd :: Demand -> Type -> (DmdShell, CleanDemand)
absDmd :: Demand
topDmd :: Demand
botDmd :: Demand
seqDmd :: Demand
lubDmd :: Demand -> Demand -> Demand
bothDmd :: Demand -> Demand -> Demand
lazyApply1Dmd :: Demand
lazyApply2Dmd :: Demand
strictApply1Dmd :: Demand
catchArgDmd :: Demand
isTopDmd :: Demand -> Bool
isAbsDmd :: Demand -> Bool
isSeqDmd :: Demand -> Bool
peelUseCall :: UseDmd -> Maybe (Count, UseDmd)
cleanUseDmd_maybe :: Demand -> Maybe UseDmd
strictenDmd :: Demand -> CleanDemand
bothCleanDmd :: CleanDemand -> CleanDemand -> CleanDemand
addCaseBndrDmd :: Demand -> [Demand] -> [Demand]
data DmdType
DmdType :: DmdEnv -> [Demand] -> DmdResult -> DmdType
dmdTypeDepth :: DmdType -> Arity
lubDmdType :: DmdType -> DmdType -> DmdType
bothDmdType :: DmdType -> BothDmdArg -> DmdType
nopDmdType :: DmdType
botDmdType :: DmdType
mkDmdType :: DmdEnv -> [Demand] -> DmdResult -> DmdType
addDemand :: Demand -> DmdType -> DmdType
removeDmdTyArgs :: DmdType -> DmdType
type BothDmdArg = (DmdEnv, Termination ())
mkBothDmdArg :: DmdEnv -> BothDmdArg
toBothDmdArg :: DmdType -> BothDmdArg
type DmdEnv = VarEnv Demand
emptyDmdEnv :: VarEnv Demand
peelFV :: DmdType -> Var -> (DmdType, Demand)
findIdDemand :: DmdType -> Var -> Demand
type DmdResult = Termination CPRResult
data CPRResult
isBotRes :: DmdResult -> Bool
isTopRes :: DmdResult -> Bool
topRes :: DmdResult
botRes :: DmdResult
exnRes :: DmdResult
cprProdRes :: [DmdType] -> DmdResult
vanillaCprProdRes :: Arity -> DmdResult
cprSumRes :: ConTag -> DmdResult
appIsBottom :: StrictSig -> Int -> Bool
isBottomingSig :: StrictSig -> Bool
pprIfaceStrictSig :: StrictSig -> SDoc
trimCPRInfo :: Bool -> Bool -> DmdResult -> DmdResult
returnsCPR_maybe :: DmdResult -> Maybe ConTag
newtype StrictSig
StrictSig :: DmdType -> StrictSig
mkStrictSig :: DmdType -> StrictSig
mkClosedStrictSig :: [Demand] -> DmdResult -> StrictSig
nopSig :: StrictSig
botSig :: StrictSig
exnSig :: StrictSig
cprProdSig :: Arity -> StrictSig
isTopSig :: StrictSig -> Bool
hasDemandEnvSig :: StrictSig -> Bool
splitStrictSig :: StrictSig -> ([Demand], DmdResult)
strictSigDmdEnv :: StrictSig -> DmdEnv
increaseStrictSigArity :: Int -> StrictSig -> StrictSig
seqDemand :: Demand -> ()
seqDemandList :: [Demand] -> ()
seqDmdType :: DmdType -> ()
seqStrictSig :: StrictSig -> ()
evalDmd :: Demand
cleanEvalDmd :: CleanDemand
cleanEvalProdDmd :: Arity -> CleanDemand
isStrictDmd :: Demand -> Bool
splitDmdTy :: DmdType -> (Demand, DmdType)
splitFVs :: Bool -> DmdEnv -> (DmdEnv, DmdEnv)
deferAfterIO :: DmdType -> DmdType
postProcessUnsat :: DmdShell -> DmdType -> DmdType
postProcessDmdType :: DmdShell -> DmdType -> BothDmdArg
splitProdDmd_maybe :: Demand -> Maybe [Demand]
peelCallDmd :: CleanDemand -> (CleanDemand, DmdShell)
mkCallDmd :: CleanDemand -> CleanDemand
mkWorkerDemand :: Int -> Demand
dmdTransformSig :: StrictSig -> CleanDemand -> DmdType
dmdTransformDataConSig :: Arity -> StrictSig -> CleanDemand -> DmdType
dmdTransformDictSelSig :: StrictSig -> CleanDemand -> DmdType
argOneShots :: Demand -> [OneShotInfo]
argsOneShots :: StrictSig -> Arity -> [[OneShotInfo]]
saturatedByOneShots :: Int -> Demand -> Bool
trimToType :: Demand -> TypeShape -> Demand
data TypeShape
TsFun :: TypeShape -> TypeShape
TsProd :: [TypeShape] -> TypeShape
TsUnk :: TypeShape
useCount :: Use u -> Count
isUsedOnce :: Demand -> Bool
reuseEnv :: DmdEnv -> DmdEnv
killUsageDemand :: DynFlags -> Demand -> Demand
killUsageSig :: DynFlags -> StrictSig -> StrictSig
zapUsageDemand :: Demand -> Demand
zapUsageEnvSig :: StrictSig -> StrictSig
-- | Remove all 1* information (but not C1 information) from the demand
zapUsedOnceDemand :: Demand -> Demand
-- | Remove all 1* information (but not C1 information) from the strictness
-- signature
zapUsedOnceSig :: StrictSig -> StrictSig
strictifyDictDmd :: Type -> Demand -> Demand
instance GHC.Classes.Eq Demand.StrictSig
instance GHC.Show.Show Demand.CPRResult
instance GHC.Classes.Eq Demand.CPRResult
instance GHC.Show.Show r => GHC.Show.Show (Demand.Termination r)
instance GHC.Classes.Eq r => GHC.Classes.Eq (Demand.Termination r)
instance GHC.Show.Show Demand.UseDmd
instance GHC.Classes.Eq Demand.UseDmd
instance GHC.Show.Show u => GHC.Show.Show (Demand.Use u)
instance GHC.Classes.Eq u => GHC.Classes.Eq (Demand.Use u)
instance GHC.Show.Show Demand.Count
instance GHC.Classes.Eq Demand.Count
instance GHC.Show.Show Demand.StrDmd
instance GHC.Classes.Eq Demand.StrDmd
instance GHC.Show.Show s => GHC.Show.Show (Demand.Str s)
instance GHC.Classes.Eq s => GHC.Classes.Eq (Demand.Str s)
instance GHC.Show.Show Demand.ExnStr
instance GHC.Classes.Eq Demand.ExnStr
instance (GHC.Show.Show u, GHC.Show.Show s) => GHC.Show.Show (Demand.JointDmd s u)
instance (GHC.Classes.Eq u, GHC.Classes.Eq s) => GHC.Classes.Eq (Demand.JointDmd s u)
instance Outputable.Outputable Demand.StrictSig
instance Binary.Binary Demand.StrictSig
instance GHC.Classes.Eq Demand.DmdType
instance Outputable.Outputable Demand.DmdType
instance Binary.Binary Demand.DmdType
instance Binary.Binary Demand.DmdResult
instance Outputable.Outputable Demand.CPRResult
instance Binary.Binary Demand.CPRResult
instance Outputable.Outputable r => Outputable.Outputable (Demand.Termination r)
instance Outputable.Outputable Demand.TypeShape
instance Outputable.Outputable Demand.ArgUse
instance Outputable.Outputable Demand.UseDmd
instance Binary.Binary Demand.ArgUse
instance Binary.Binary Demand.UseDmd
instance Outputable.Outputable Demand.Count
instance Binary.Binary Demand.Count
instance Outputable.Outputable Demand.StrDmd
instance Outputable.Outputable Demand.ArgStr
instance Binary.Binary Demand.StrDmd
instance Binary.Binary Demand.ArgStr
instance Binary.Binary Demand.ExnStr
instance (Outputable.Outputable s, Outputable.Outputable u) => Outputable.Outputable (Demand.JointDmd s u)
instance (Binary.Binary s, Binary.Binary u) => Binary.Binary (Demand.JointDmd s u)
module ConLike
-- | A constructor-like thing
data ConLike
RealDataCon :: DataCon -> ConLike
PatSynCon :: PatSyn -> ConLike
-- | Number of arguments
conLikeArity :: ConLike -> Arity
-- | Names of fields used for selectors
conLikeFieldLabels :: ConLike -> [FieldLabel]
-- | Returns just the instantiated value argument types of a
-- ConLike, (excluding dictionary args)
conLikeInstOrigArgTys :: ConLike -> [Type] -> [Type]
-- | Existentially quantified type variables
conLikeExTyVars :: ConLike -> [TyVar]
conLikeName :: ConLike -> Name
-- | The "stupid theta" of the ConLike, such as data Eq a
-- in:
--
--
-- data Eq a => T a = ...
--
--
-- It is empty for PatSynCon as they do not allow such contexts.
conLikeStupidTheta :: ConLike -> ThetaType
-- | Returns the Id of the wrapper. This is also known as the
-- builder in some contexts. The value is Nothing only in the case of
-- unidirectional pattern synonyms.
conLikeWrapId_maybe :: ConLike -> Maybe Id
-- | Returns the strictness information for each constructor
conLikeImplBangs :: ConLike -> [HsImplBang]
-- | The "full signature" of the ConLike returns, in order:
--
-- 1) The universally quantified type variables
--
-- 2) The existentially quantified type variables
--
-- 3) The equality specification
--
-- 4) The provided theta (the constraints provided by a match)
--
-- 5) The required theta (the constraints required for a match)
--
-- 6) The original argument types (i.e. before any change of the
-- representation of the type)
--
-- 7) The original result type
conLikeFullSig :: ConLike -> ([TyVar], [TyVar], [EqSpec], ThetaType, ThetaType, [Type], Type)
-- | Returns the type of the whole pattern
conLikeResTy :: ConLike -> [Type] -> Type
-- | Extract the type for any given labelled field of the ConLike
conLikeFieldType :: ConLike -> FieldLabelString -> Type
-- | The ConLikes that have *all* the given fields
conLikesWithFields :: [ConLike] -> [FieldLabelString] -> [ConLike]
conLikeIsInfix :: ConLike -> Bool
instance GHC.Classes.Eq ConLike.ConLike
instance Unique.Uniquable ConLike.ConLike
instance Name.NamedThing ConLike.ConLike
instance Outputable.Outputable ConLike.ConLike
instance Outputable.OutputableBndr ConLike.ConLike
instance Data.Data.Data ConLike.ConLike
-- | CoreSyn holds all the main data types for use by for the Glasgow
-- Haskell Compiler midsection
module CoreSyn
-- | This is the data type that represents GHCs core intermediate language.
-- Currently GHC uses System FC
-- https://www.microsoft.com/en-us/research/publication/system-f-with-type-equality-coercions/
-- for this purpose, which is closely related to the simpler and better
-- known System F http://en.wikipedia.org/wiki/System_F.
--
-- We get from Haskell source to this Core language in a number of
-- stages:
--
--
-- - The source code is parsed into an abstract syntax tree, which is
-- represented by the data type HsExpr with the names being
-- RdrNames
-- - This syntax tree is renamed, which attaches a Unique
-- to every RdrName (yielding a Name) to disambiguate
-- identifiers which are lexically identical. For example, this
-- program:
--
--
--
-- f x = let f x = x + 1
-- in f (x - 2)
--
--
-- Would be renamed by having Uniques attached so it looked
-- something like this:
--
--
-- f_1 x_2 = let f_3 x_4 = x_4 + 1
-- in f_3 (x_2 - 2)
--
--
-- But see Note [Shadowing] below.
--
--
-- - The resulting syntax tree undergoes type checking (which also
-- deals with instantiating type class arguments) to yield a
-- HsExpr type that has Id as it's names.
-- - Finally the syntax tree is desugared from the expressive
-- HsExpr type into this Expr type, which has far fewer
-- constructors and hence is easier to perform optimization, analysis and
-- code generation on.
--
--
-- The type parameter b is for the type of binders in the
-- expression tree.
--
-- The language consists of the following elements:
--
--
-- - Variables
-- - Primitive literals
-- - Applications: note that the argument may be a Type. See
-- Note [CoreSyn let/app invariant] See Note [Levity polymorphism
-- invariants]
-- - Lambda abstraction See Note [Levity polymorphism invariants]
-- - Recursive and non recursive lets. Operationally this
-- corresponds to allocating a thunk for the things bound and then
-- executing the sub-expression.
--
--
--
-- The right hand sides of all top-level and recursive lets
-- must be of lifted type (see Type#type_classification for
-- the meaning of lifted vs. unlifted). There is one
-- exception to this rule, top-level lets are allowed to bind
-- primitive string literals, see Note [CoreSyn top-level string
-- literals].
--
-- See Note [CoreSyn let/app invariant] See Note [Levity polymorphism
-- invariants]
--
-- We allow a non-recursive let to bind a type variable, thus:
--
--
-- Let (NonRec tv (Type ty)) body
--
--
-- This can be very convenient for postponing type substitutions until
-- the next run of the simplifier.
--
-- At the moment, the rest of the compiler only deals with type-let in a
-- Let expression, rather than at top level. We may want to revist this
-- choice.
--
--
-- - Case expression. Operationally this corresponds to evaluating the
-- scrutinee (expression examined) to weak head normal form and then
-- examining at most one level of resulting constructor (i.e. you cannot
-- do nested pattern matching directly with this).
--
--
-- The binder gets bound to the value of the scrutinee, and the
-- Type must be that of all the case alternatives
--
-- This is one of the more complicated elements of the Core language, and
-- comes with a number of restrictions:
--
--
-- - The list of alternatives may be empty; See Note [Empty case
-- alternatives]
-- - The DEFAULT case alternative must be first in the list, if
-- it occurs at all.
-- - The remaining cases are in order of increasing tag (for
-- DataAlts) or lit (for LitAlts). This makes finding
-- the relevant constructor easy, and makes comparison easier too.
-- - The list of alternatives must be exhaustive. An exhaustive
-- case does not necessarily mention all constructors:
--
--
--
-- data Foo = Red | Green | Blue
-- ... case x of
-- Red -> True
-- other -> f (case x of
-- Green -> ...
-- Blue -> ... ) ...
--
--
--
-- The inner case does not need a Red alternative, because
-- x can't be Red at that program point.
--
--
-- - Floating-point values must not be scrutinised against literals.
-- See Trac #9238 and Note [Rules for floating-point comparisons] in
-- PrelRules for rationale.
--
--
--
-- - Cast an expression to a particular type. This is used to implement
-- newtypes (a newtype constructor or destructor just
-- becomes a Cast in Core) and GADTs.
-- - Notes. These allow general information to be added to expressions
-- in the syntax tree
-- - A type: this should only show up at the top level of an Arg
-- - A coercion
--
data Expr b
Var :: Id -> Expr b
Lit :: Literal -> Expr b
App :: (Expr b) -> (Arg b) -> Expr b
Lam :: b -> (Expr b) -> Expr b
Let :: (Bind b) -> (Expr b) -> Expr b
Case :: (Expr b) -> b -> Type -> [Alt b] -> Expr b
Cast :: (Expr b) -> Coercion -> Expr b
Tick :: (Tickish Id) -> (Expr b) -> Expr b
Type :: Type -> Expr b
Coercion :: Coercion -> Expr b
-- | A case split alternative. Consists of the constructor leading to the
-- alternative, the variables bound from the constructor, and the
-- expression to be executed given that binding. The default alternative
-- is (DEFAULT, [], rhs)
type Alt b = (AltCon, [b], Expr b)
-- | Binding, used for top level bindings in a module and local bindings in
-- a let.
data Bind b
NonRec :: b -> (Expr b) -> Bind b
Rec :: [(b, (Expr b))] -> Bind b
-- | A case alternative constructor (i.e. pattern match)
data AltCon
DataAlt :: DataCon -> AltCon
-- | A literal: case e of { 1 -> ... } Invariant: always an
-- *unlifted* literal See Note [Literal alternatives]
LitAlt :: Literal -> AltCon
-- | Trivial alternative: case e of { _ -> ... }
DEFAULT :: AltCon
-- | Type synonym for expressions that occur in function argument
-- positions. Only Arg should contain a Type at top level,
-- general Expr should not
type Arg b = Expr b
-- | Allows attaching extra information to points in expressions
data Tickish id
-- | An {--} profiling annotation, either automatically added by
-- the desugarer as a result of -auto-all, or added by the user.
ProfNote :: CostCentre -> !Bool -> !Bool -> Tickish id
-- | the cost centre
[profNoteCC] :: Tickish id -> CostCentre
-- | bump the entry count?
[profNoteCount] :: Tickish id -> !Bool
-- | scopes over the enclosed expression (i.e. not just a tick)
[profNoteScope] :: Tickish id -> !Bool
-- | A "tick" used by HPC to track the execution of each subexpression in
-- the original source code.
HpcTick :: Module -> !Int -> Tickish id
[tickModule] :: Tickish id -> Module
[tickId] :: Tickish id -> !Int
-- | A breakpoint for the GHCi debugger. This behaves like an HPC tick, but
-- has a list of free variables which will be available for inspection in
-- GHCi when the program stops at the breakpoint.
--
-- NB. we must take account of these Ids when (a) counting free
-- variables, and (b) substituting (don't substitute for them)
Breakpoint :: !Int -> [id] -> Tickish id
[breakpointId] :: Tickish id -> !Int
-- | the order of this list is important: it matches the order of the lists
-- in the appropriate entry in HscTypes.ModBreaks.
--
-- Careful about substitution! See Note [substTickish] in CoreSubst.
[breakpointFVs] :: Tickish id -> [id]
-- | A source note.
--
-- Source notes are pure annotations: Their presence should neither
-- influence compilation nor execution. The semantics are given by
-- causality: The presence of a source note means that a local change in
-- the referenced source code span will possibly provoke the generated
-- code to change. On the flip-side, the functionality of annotated code
-- *must* be invariant against changes to all source code *except* the
-- spans referenced in the source notes (see "Causality of optimized
-- Haskell" paper for details).
--
-- Therefore extending the scope of any given source note is always
-- valid. Note that it is still undesirable though, as this reduces their
-- usefulness for debugging and profiling. Therefore we will generally
-- try only to make use of this property where it is necessary to enable
-- optimizations.
SourceNote :: RealSrcSpan -> String -> Tickish id
-- | Source covered
[sourceSpan] :: Tickish id -> RealSrcSpan
-- | Name for source location (uses same names as CCs)
[sourceName] :: Tickish id -> String
-- | Specifies the scoping behaviour of ticks. This governs the behaviour
-- of ticks that care about the covered code and the cost associated with
-- it. Important for ticks relating to profiling.
data TickishScoping
-- | No scoping: The tick does not care about what code it covers.
-- Transformations can freely move code inside as well as outside without
-- any additional annotation obligations
NoScope :: TickishScoping
-- | Soft scoping: We want all code that is covered to stay covered. Note
-- that this scope type does not forbid transformations from happening,
-- as as long as all results of the transformations are still covered by
-- this tick or a copy of it. For example
--
-- let x = tick... (let y = foo in bar) in baz ===> let x =
-- tick... bar; y = tick... foo in baz
--
-- Is a valid transformation as far as "bar" and "foo" is concerned,
-- because both still are scoped over by the tick.
--
-- Note though that one might object to the "let" not being covered by
-- the tick any more. However, we are generally lax with this - constant
-- costs don't matter too much, and given that the "let" was effectively
-- merged we can view it as having lost its identity anyway.
--
-- Also note that this scoping behaviour allows floating a tick "upwards"
-- in pretty much any situation. For example:
--
-- case foo of x -> tick... bar ==> tick... case foo
-- of x -> bar
--
-- While this is always leagl, we want to make a best effort to only make
-- us of this where it exposes transformation opportunities.
SoftScope :: TickishScoping
-- | Cost centre scoping: We don't want any costs to move to other
-- cost-centre stacks. This means we not only want no code or cost to get
-- moved out of their cost centres, but we also object to code getting
-- associated with new cost-centre ticks - or changing the order in which
-- they get applied.
--
-- A rule of thumb is that we don't want any code to gain new
-- annotations. However, there are notable exceptions, for example:
--
-- let f = y -> foo in tick... ... (f x) ... ==>
-- tick... ... foo[x/y] ...
--
-- In-lining lambdas like this is always legal, because inlining a
-- function does not change the cost-centre stack when the function is
-- called.
CostCentreScope :: TickishScoping
-- | Governs the kind of expression that the tick gets placed on when
-- annotating for example using mkTick. If we find that we want
-- to put a tickish on an expression ruled out here, we try to float it
-- inwards until we find a suitable expression.
data TickishPlacement
-- | Place ticks exactly on run-time expressions. We can still move the
-- tick through pure compile-time constructs such as other ticks, casts
-- or type lambdas. This is the most restrictive placement rule for
-- ticks, as all tickishs have in common that they want to track runtime
-- processes. The only legal placement rule for counting ticks.
PlaceRuntime :: TickishPlacement
-- | As PlaceRuntime, but we float the tick through all lambdas.
-- This makes sense where there is little difference between annotating
-- the lambda and annotating the lambda's code.
PlaceNonLam :: TickishPlacement
-- | In addition to floating through lambdas, cost-centre style tickishs
-- can also be moved from constructors, non-function variables and
-- literals. For example:
--
-- let x = scc... C (scc... y) (scc... 3) in ...
--
-- Neither the constructor application, the variable or the literal are
-- likely to have any cost worth mentioning. And even if y names a thunk,
-- the call would not care about the evaluation context. Therefore
-- removing all annotations in the above example is safe.
PlaceCostCentre :: TickishPlacement
type CoreProgram = [CoreBind]
-- | Expressions where binders are CoreBndrs
type CoreExpr = Expr CoreBndr
-- | Case alternatives where binders are CoreBndrs
type CoreAlt = Alt CoreBndr
-- | Binding groups where binders are CoreBndrs
type CoreBind = Bind CoreBndr
-- | Argument expressions where binders are CoreBndrs
type CoreArg = Arg CoreBndr
-- | The common case for the type of binders and variables when we are
-- manipulating the Core language within GHC
type CoreBndr = Var
type TaggedExpr t = Expr (TaggedBndr t)
type TaggedAlt t = Alt (TaggedBndr t)
type TaggedBind t = Bind (TaggedBndr t)
type TaggedArg t = Arg (TaggedBndr t)
-- | Binders are tagged with a t
data TaggedBndr t
TB :: CoreBndr -> t -> TaggedBndr t
deTagExpr :: TaggedExpr t -> CoreExpr
type InId = Id
type InBind = CoreBind
type InExpr = CoreExpr
type InAlt = CoreAlt
type InArg = CoreArg
type InType = Type
type InKind = Kind
type InBndr = CoreBndr
type InVar = Var
type InCoercion = Coercion
type InTyVar = TyVar
type InCoVar = CoVar
type OutId = Id
type OutBind = CoreBind
type OutExpr = CoreExpr
type OutAlt = CoreAlt
type OutArg = CoreArg
type OutType = Type
type OutKind = Kind
type OutBndr = CoreBndr
type OutVar = Var
type OutCoercion = Coercion
type OutTyVar = TyVar
type OutCoVar = CoVar
mkLet :: Bind b -> Expr b -> Expr b
-- | Bind all supplied binding groups over an expression in a nested let
-- expression. Assumes that the rhs satisfies the let/app invariant.
-- Prefer to use mkCoreLets if possible, which does guarantee the
-- invariant
mkLets :: [Bind b] -> Expr b -> Expr b
-- | Bind all supplied binders over an expression in a nested lambda
-- expression. Prefer to use mkCoreLams if possible
mkLams :: [b] -> Expr b -> Expr b
-- | Apply a list of argument expressions to a function expression in a
-- nested fashion. Prefer to use mkCoreApps if possible
mkApps :: Expr b -> [Arg b] -> Expr b
infixl 4 `mkApps`
-- | Apply a list of type argument expressions to a function expression in
-- a nested fashion
mkTyApps :: Expr b -> [Type] -> Expr b
infixl 4 `mkTyApps`
-- | Apply a list of coercion argument expressions to a function expression
-- in a nested fashion
mkCoApps :: Expr b -> [Coercion] -> Expr b
infixl 4 `mkCoApps`
-- | Apply a list of type or value variables to a function expression in a
-- nested fashion
mkVarApps :: Expr b -> [Var] -> Expr b
infixl 4 `mkVarApps`
mkTyArg :: Type -> Expr b
-- | Create a machine integer literal expression of type Int# from
-- an Integer. If you want an expression of type Int
-- use mkIntExpr
mkIntLit :: DynFlags -> Integer -> Expr b
-- | Create a machine integer literal expression of type Int# from
-- an Int. If you want an expression of type Int use
-- mkIntExpr
mkIntLitInt :: DynFlags -> Int -> Expr b
-- | Create a machine word literal expression of type Word# from
-- an Integer. If you want an expression of type Word
-- use mkWordExpr
mkWordLit :: DynFlags -> Integer -> Expr b
-- | Create a machine word literal expression of type Word# from a
-- Word. If you want an expression of type Word use
-- mkWordExpr
mkWordLitWord :: DynFlags -> Word -> Expr b
mkWord64LitWord64 :: Word64 -> Expr b
mkInt64LitInt64 :: Int64 -> Expr b
-- | Create a machine character literal expression of type Char#.
-- If you want an expression of type Char use mkCharExpr
mkCharLit :: Char -> Expr b
-- | Create a machine string literal expression of type Addr#. If
-- you want an expression of type String use mkStringExpr
mkStringLit :: String -> Expr b
-- | Create a machine single precision literal expression of type
-- Float# from a Rational. If you want an expression of
-- type Float use mkFloatExpr
mkFloatLit :: Rational -> Expr b
-- | Create a machine single precision literal expression of type
-- Float# from a Float. If you want an expression of
-- type Float use mkFloatExpr
mkFloatLitFloat :: Float -> Expr b
-- | Create a machine double precision literal expression of type
-- Double# from a Rational. If you want an expression
-- of type Double use mkDoubleExpr
mkDoubleLit :: Rational -> Expr b
-- | Create a machine double precision literal expression of type
-- Double# from a Double. If you want an expression of
-- type Double use mkDoubleExpr
mkDoubleLitDouble :: Double -> Expr b
-- | Apply a list of argument expressions to a data constructor in a nested
-- fashion. Prefer to use mkCoreConApps if possible
mkConApp :: DataCon -> [Arg b] -> Expr b
mkConApp2 :: DataCon -> [Type] -> [Var] -> Expr b
-- | Create a binding group where a type variable is bound to a type. Per
-- CoreSyn#type_let, this can only be used to bind something in a
-- non-recursive let expression
mkTyBind :: TyVar -> Type -> CoreBind
-- | Create a binding group where a type variable is bound to a type. Per
-- CoreSyn#type_let, this can only be used to bind something in a
-- non-recursive let expression
mkCoBind :: CoVar -> Coercion -> CoreBind
-- | Convert a binder into either a Var or Type Expr
-- appropriately
varToCoreExpr :: CoreBndr -> Expr b
varsToCoreExprs :: [CoreBndr] -> [Expr b]
isId :: Var -> Bool
-- | Compares AltCons within a single list of alternatives
cmpAltCon :: AltCon -> AltCon -> Ordering
cmpAlt :: (AltCon, a, b) -> (AltCon, a, b) -> Ordering
ltAlt :: (AltCon, a, b) -> (AltCon, a, b) -> Bool
-- | Extract every variable by this group
bindersOf :: Bind b -> [b]
-- | bindersOf applied to a list of binding groups
bindersOfBinds :: [Bind b] -> [b]
rhssOfBind :: Bind b -> [Expr b]
rhssOfAlts :: [Alt b] -> [Expr b]
-- | We often want to strip off leading lambdas before getting down to
-- business. Variants are collectTyBinders,
-- collectValBinders, and collectTyAndValBinders
collectBinders :: Expr b -> ([b], Expr b)
collectTyBinders :: CoreExpr -> ([TyVar], CoreExpr)
collectTyAndValBinders :: CoreExpr -> ([TyVar], [Id], CoreExpr)
-- | Strip off exactly N leading lambdas (type or value). Good for use with
-- join points.
collectNBinders :: Int -> Expr b -> ([b], Expr b)
-- | Takes a nested application expression and returns the the function
-- being applied and the arguments to which it is applied
collectArgs :: Expr b -> (Expr b, [Arg b])
-- | Like collectArgs, but also collects looks through floatable
-- ticks if it means that we can find more arguments.
collectArgsTicks :: (Tickish Id -> Bool) -> Expr b -> (Expr b, [Arg b], [Tickish Id])
-- | Collapse all the bindings in the supplied groups into a single list of
-- lhs/rhs pairs suitable for binding in a Rec binding group
flattenBinds :: [Bind b] -> [(b, Expr b)]
-- | If the expression is a Type, converts. Otherwise, panics. NB:
-- This does not convert Coercion to CoercionTy.
exprToType :: CoreExpr -> Type
-- | If the expression is a Coercion, converts.
exprToCoercion_maybe :: CoreExpr -> Maybe Coercion
-- | Determines the type resulting from applying an expression with given
-- type to a given argument expression
applyTypeToArg :: Type -> CoreExpr -> Type
-- | Returns True for value arguments, false for type args NB:
-- coercions are value arguments (zero width, to be sure, like State#,
-- but still value args).
isValArg :: Expr b -> Bool
-- | Returns True iff the expression is a Type expression
-- at its top level. Note this does NOT include Coercions.
isTypeArg :: Expr b -> Bool
-- | Returns True iff the expression is a Type or
-- Coercion expression at its top level
isTyCoArg :: Expr b -> Bool
-- | The number of argument expressions that are values rather than types
-- at their top level
valArgCount :: [Arg b] -> Int
-- | The number of binders that bind values rather than types
valBndrCount :: [CoreBndr] -> Int
-- | Will this argument expression exist at runtime?
isRuntimeArg :: CoreExpr -> Bool
-- | Will this variable exist at runtime?
isRuntimeVar :: Var -> Bool
-- | A "counting tick" (where tickishCounts is True) is one that counts
-- evaluations in some way. We cannot discard a counting tick, and the
-- compiler should preserve the number of counting ticks as far as
-- possible.
--
-- However, we still allow the simplifier to increase or decrease
-- sharing, so in practice the actual number of ticks may vary, except
-- that we never change the value from zero to non-zero or vice versa.
tickishCounts :: Tickish id -> Bool
-- | Returns the intended scoping rule for a Tickish
tickishScoped :: Tickish id -> TickishScoping
-- | Returns whether the tick scoping rule is at least as permissive as the
-- given scoping rule.
tickishScopesLike :: Tickish id -> TickishScoping -> Bool
-- | Returns True for ticks that can be floated upwards easily
-- even where it might change execution counts, such as:
--
-- Just (tick... foo) ==> tick... (Just foo)
--
-- This is a combination of tickishSoftScope and
-- tickishCounts. Note that in principle splittable ticks can
-- become floatable using mkNoTick -- even though there's
-- currently no tickish for which that is the case.
tickishFloatable :: Tickish id -> Bool
-- | Returns True for a tick that is both counting and
-- scoping and can be split into its (tick, scope) parts using
-- mkNoScope and mkNoTick respectively.
tickishCanSplit :: Tickish id -> Bool
mkNoCount :: Tickish id -> Tickish id
mkNoScope :: Tickish id -> Tickish id
-- | Return True if this source annotation compiles to some
-- backend code. Without this flag, the tickish is seen as a simple
-- annotation that does not have any associated evaluation code.
--
-- What this means that we are allowed to disregard the tick if doing so
-- means that we can skip generating any code in the first place. A
-- typical example is top-level bindings:
--
-- foo = tick... y -> ... ==> foo = y -> tick...
-- ...
--
-- Here there is just no operational difference between the first and the
-- second version. Therefore code generation should simply translate the
-- code as if it found the latter.
tickishIsCode :: Tickish id -> Bool
-- | Placement behaviour we want for the ticks
tickishPlace :: Tickish id -> TickishPlacement
-- | Returns whether one tick "contains" the other one, therefore making
-- the second tick redundant.
tickishContains :: Eq b => Tickish b -> Tickish b -> Bool
-- | Records the unfolding of an identifier, which is approximately
-- the form the identifier would have if we substituted its definition in
-- for the identifier. This type should be treated as abstract everywhere
-- except in CoreUnfold
data Unfolding
-- | We have no information about the unfolding.
NoUnfolding :: Unfolding
-- | We have no information about the unfolding, because this Id
-- came from an hi-boot file. See Note [Inlining and hs-boot
-- files] in ToIface for what this is used for.
BootUnfolding :: Unfolding
-- | It ain't one of these constructors. OtherCon xs also
-- indicates that something has been evaluated and hence there's no point
-- in re-evaluating it. OtherCon [] is used even for
-- non-data-type values to indicated evaluated-ness. Notably:
--
--
-- data C = C !(Int -> Int)
-- case x of { C f -> ... }
--
--
-- Here, f gets an OtherCon [] unfolding.
OtherCon :: [AltCon] -> Unfolding
DFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding
[df_bndrs] :: Unfolding -> [Var]
[df_con] :: Unfolding -> DataCon
[df_args] :: Unfolding -> [CoreExpr]
-- | An unfolding with redundant cached information. Parameters:
--
-- uf_tmpl: Template used to perform unfolding; NB: Occurrence info is
-- guaranteed correct: see Note [OccInfo in unfoldings and rules]
--
-- uf_is_top: Is this a top level binding?
--
-- uf_is_value: exprIsHNF template (cached); it is ok to discard
-- a seq on this variable
--
-- uf_is_work_free: Does this waste only a little work if we expand it
-- inside an inlining? Basically this is a cached version of
-- exprIsWorkFree
--
-- uf_guidance: Tells us about the size of the unfolding template
CoreUnfolding :: CoreExpr -> UnfoldingSource -> Bool -> Bool -> Bool -> Bool -> Bool -> UnfoldingGuidance -> Unfolding
[uf_tmpl] :: Unfolding -> CoreExpr
[uf_src] :: Unfolding -> UnfoldingSource
[uf_is_top] :: Unfolding -> Bool
[uf_is_value] :: Unfolding -> Bool
[uf_is_conlike] :: Unfolding -> Bool
[uf_is_work_free] :: Unfolding -> Bool
[uf_expandable] :: Unfolding -> Bool
[uf_guidance] :: Unfolding -> UnfoldingGuidance
-- | UnfoldingGuidance says when unfolding should take place
data UnfoldingGuidance
UnfWhen :: Arity -> Bool -> Bool -> UnfoldingGuidance
[ug_arity] :: UnfoldingGuidance -> Arity
[ug_unsat_ok] :: UnfoldingGuidance -> Bool
[ug_boring_ok] :: UnfoldingGuidance -> Bool
UnfIfGoodArgs :: [Int] -> Int -> Int -> UnfoldingGuidance
[ug_args] :: UnfoldingGuidance -> [Int]
[ug_size] :: UnfoldingGuidance -> Int
[ug_res] :: UnfoldingGuidance -> Int
UnfNever :: UnfoldingGuidance
data UnfoldingSource
InlineRhs :: UnfoldingSource
InlineStable :: UnfoldingSource
InlineCompulsory :: UnfoldingSource
-- | There is no known Unfolding
noUnfolding :: Unfolding
-- | There is no known Unfolding, because this came from an hi-boot
-- file.
bootUnfolding :: Unfolding
-- | This unfolding marks the associated thing as being evaluated
evaldUnfolding :: Unfolding
mkOtherCon :: [AltCon] -> Unfolding
unSaturatedOk :: Bool
needSaturated :: Bool
boringCxtOk :: Bool
boringCxtNotOk :: Bool
-- | Retrieves the template of an unfolding: panics if none is known
unfoldingTemplate :: Unfolding -> CoreExpr
expandUnfolding_maybe :: Unfolding -> Maybe CoreExpr
-- | Retrieves the template of an unfolding if possible
-- maybeUnfoldingTemplate is used mainly wnen specialising, and we do
-- want to specialise DFuns, so it's important to return a template for
-- DFunUnfoldings
maybeUnfoldingTemplate :: Unfolding -> Maybe CoreExpr
-- | The constructors that the unfolding could never be: returns
-- [] if no information is available
otherCons :: Unfolding -> [AltCon]
-- | Determines if it is certainly the case that the unfolding will yield a
-- value (something in HNF): returns False if unsure
isValueUnfolding :: Unfolding -> Bool
-- | Determines if it possibly the case that the unfolding will yield a
-- value. Unlike isValueUnfolding it returns True for
-- OtherCon
isEvaldUnfolding :: Unfolding -> Bool
-- | Is the thing we will unfold into certainly cheap?
isCheapUnfolding :: Unfolding -> Bool
isExpandableUnfolding :: Unfolding -> Bool
-- | True if the unfolding is a constructor application, the
-- application of a CONLIKE function or OtherCon
isConLikeUnfolding :: Unfolding -> Bool
isCompulsoryUnfolding :: Unfolding -> Bool
isStableUnfolding :: Unfolding -> Bool
isFragileUnfolding :: Unfolding -> Bool
-- | Only returns False if there is no unfolding information available at
-- all
hasSomeUnfolding :: Unfolding -> Bool
isBootUnfolding :: Unfolding -> Bool
canUnfold :: Unfolding -> Bool
neverUnfoldGuidance :: UnfoldingGuidance -> Bool
isStableSource :: UnfoldingSource -> Bool
-- | Annotated core: allows annotation at every node in the tree
type AnnExpr bndr annot = (annot, AnnExpr' bndr annot)
-- | A clone of the Expr type but allowing annotation at every tree
-- node
data AnnExpr' bndr annot
AnnVar :: Id -> AnnExpr' bndr annot
AnnLit :: Literal -> AnnExpr' bndr annot
AnnLam :: bndr -> (AnnExpr bndr annot) -> AnnExpr' bndr annot
AnnApp :: (AnnExpr bndr annot) -> (AnnExpr bndr annot) -> AnnExpr' bndr annot
AnnCase :: (AnnExpr bndr annot) -> bndr -> Type -> [AnnAlt bndr annot] -> AnnExpr' bndr annot
AnnLet :: (AnnBind bndr annot) -> (AnnExpr bndr annot) -> AnnExpr' bndr annot
AnnCast :: (AnnExpr bndr annot) -> (annot, Coercion) -> AnnExpr' bndr annot
AnnTick :: (Tickish Id) -> (AnnExpr bndr annot) -> AnnExpr' bndr annot
AnnType :: Type -> AnnExpr' bndr annot
AnnCoercion :: Coercion -> AnnExpr' bndr annot
-- | A clone of the Bind type but allowing annotation at every tree
-- node
data AnnBind bndr annot
AnnNonRec :: bndr -> (AnnExpr bndr annot) -> AnnBind bndr annot
AnnRec :: [(bndr, AnnExpr bndr annot)] -> AnnBind bndr annot
-- | A clone of the Alt type but allowing annotation at every tree
-- node
type AnnAlt bndr annot = (AltCon, [bndr], AnnExpr bndr annot)
-- | Takes a nested application expression and returns the the function
-- being applied and the arguments to which it is applied
collectAnnArgs :: AnnExpr b a -> (AnnExpr b a, [AnnExpr b a])
collectAnnArgsTicks :: (Tickish Var -> Bool) -> AnnExpr b a -> (AnnExpr b a, [AnnExpr b a], [Tickish Var])
deAnnotate :: AnnExpr bndr annot -> Expr bndr
deAnnotate' :: AnnExpr' bndr annot -> Expr bndr
deAnnAlt :: AnnAlt bndr annot -> Alt bndr
-- | As collectBinders but for AnnExpr rather than
-- Expr
collectAnnBndrs :: AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot)
-- | As collectNBinders but for AnnExpr rather than
-- Expr
collectNAnnBndrs :: Int -> AnnExpr bndr annot -> ([bndr], AnnExpr bndr annot)
-- | Is this instance an orphan? If it is not an orphan, contains an
-- OccName witnessing the instance's non-orphanhood. See Note
-- [Orphans]
data IsOrphan
IsOrphan :: IsOrphan
NotOrphan :: OccName -> IsOrphan
-- | Returns true if IsOrphan is orphan.
isOrphan :: IsOrphan -> Bool
-- | Returns true if IsOrphan is not an orphan.
notOrphan :: IsOrphan -> Bool
chooseOrphanAnchor :: NameSet -> IsOrphan
-- | A CoreRule is:
--
--
-- - "Local" if the function it is a rule for is defined in the same
-- module as the rule itself.
-- - "Orphan" if nothing on the LHS is defined in the same module as
-- the rule itself
--
data CoreRule
Rule :: RuleName -> Activation -> Name -> [Maybe Name] -> [CoreBndr] -> [CoreExpr] -> CoreExpr -> Bool -> !Module -> !IsOrphan -> Bool -> CoreRule
-- | Name of the rule, for communication with the user
[ru_name] :: CoreRule -> RuleName
-- | When the rule is active
[ru_act] :: CoreRule -> Activation
-- | Name of the Id at the head of this rule
[ru_fn] :: CoreRule -> Name
-- | Name at the head of each argument to the left hand side
[ru_rough] :: CoreRule -> [Maybe Name]
-- | Variables quantified over
[ru_bndrs] :: CoreRule -> [CoreBndr]
-- | Left hand side arguments
[ru_args] :: CoreRule -> [CoreExpr]
-- | Right hand side of the rule Occurrence info is guaranteed correct See
-- Note [OccInfo in unfoldings and rules]
[ru_rhs] :: CoreRule -> CoreExpr
-- | True = this rule is auto-generated (notably by
-- Specialise or SpecConstr) False = generated at the
-- user's behest See Note [Trimming auto-rules] in TidyPgm for the sole
-- purpose of this field.
[ru_auto] :: CoreRule -> Bool
-- | Module the rule was defined in, used to test if we should see
-- an orphan rule.
[ru_origin] :: CoreRule -> !Module
-- | Whether or not the rule is an orphan.
[ru_orphan] :: CoreRule -> !IsOrphan
-- | True iff the fn at the head of the rule is defined in the
-- same module as the rule and is not an implicit Id (like a
-- record selector, class operation, or data constructor). This is
-- different from ru_orphan, where a rule can avoid being an
-- orphan if *any* Name in LHS of the rule was defined in the same module
-- as the rule.
[ru_local] :: CoreRule -> Bool
-- | Built-in rules are used for constant folding and suchlike. They have
-- no free variables. A built-in rule is always visible (there is no such
-- thing as an orphan built-in rule.)
BuiltinRule :: RuleName -> Name -> Int -> RuleFun -> CoreRule
-- | Name of the rule, for communication with the user
[ru_name] :: CoreRule -> RuleName
-- | Name of the Id at the head of this rule
[ru_fn] :: CoreRule -> Name
-- | Number of arguments that ru_try consumes, if it fires,
-- including type arguments
[ru_nargs] :: CoreRule -> Int
-- | This function does the rewrite. It given too many arguments, it simply
-- discards them; the returned CoreExpr is just the rewrite of
-- ru_fn applied to the first ru_nargs args
[ru_try] :: CoreRule -> RuleFun
-- | Gathers a collection of CoreRules. Maps (the name of) an
-- Id to its rules
type RuleBase = NameEnv [CoreRule]
type RuleName = FastString
type RuleFun = DynFlags -> InScopeEnv -> Id -> [CoreExpr] -> Maybe CoreExpr
type IdUnfoldingFun = Id -> Unfolding
type InScopeEnv = (InScopeSet, IdUnfoldingFun)
-- | A full rule environment which we can apply rules from. Like a
-- RuleBase, but it also includes the set of visible orphans we
-- use to filter out orphan rules which are not visible (even though we
-- can see them...)
data RuleEnv
RuleEnv :: RuleBase -> ModuleSet -> RuleEnv
[re_base] :: RuleEnv -> RuleBase
[re_visible_orphs] :: RuleEnv -> ModuleSet
mkRuleEnv :: RuleBase -> [Module] -> RuleEnv
emptyRuleEnv :: RuleEnv
-- | The number of arguments the ru_fn must be applied to before the
-- rule can match on it
ruleArity :: CoreRule -> Int
ruleName :: CoreRule -> RuleName
-- | The Name of the Id at the head of the rule left hand
-- side
ruleIdName :: CoreRule -> Name
ruleActivation :: CoreRule -> Activation
-- | Set the Name of the Id at the head of the rule left hand
-- side
setRuleIdName :: Name -> CoreRule -> CoreRule
ruleModule :: CoreRule -> Maybe Module
isBuiltinRule :: CoreRule -> Bool
isLocalRule :: CoreRule -> Bool
isAutoRule :: CoreRule -> Bool
data CoreVect
Vect :: Id -> CoreExpr -> CoreVect
NoVect :: Id -> CoreVect
VectType :: Bool -> TyCon -> (Maybe TyCon) -> CoreVect
VectClass :: TyCon -> CoreVect
VectInst :: Id -> CoreVect
instance GHC.Classes.Eq CoreSyn.UnfoldingGuidance
instance Data.Data.Data CoreSyn.IsOrphan
instance GHC.Classes.Eq CoreSyn.TickishPlacement
instance GHC.Classes.Eq CoreSyn.TickishScoping
instance Data.Data.Data b => Data.Data.Data (CoreSyn.Bind b)
instance Data.Data.Data b => Data.Data.Data (CoreSyn.Expr b)
instance Data.Data.Data id => Data.Data.Data (CoreSyn.Tickish id)
instance GHC.Classes.Ord id => GHC.Classes.Ord (CoreSyn.Tickish id)
instance GHC.Classes.Eq id => GHC.Classes.Eq (CoreSyn.Tickish id)
instance Data.Data.Data CoreSyn.AltCon
instance GHC.Classes.Eq CoreSyn.AltCon
instance Outputable.Outputable b => Outputable.Outputable (CoreSyn.TaggedBndr b)
instance Binary.Binary CoreSyn.IsOrphan
instance Outputable.Outputable CoreSyn.AltCon
module TrieMap
-- | CoreMap a is a map from CoreExpr to a. If you
-- are a client, this is the type you want.
data CoreMap a
emptyCoreMap :: CoreMap a
extendCoreMap :: CoreMap a -> CoreExpr -> a -> CoreMap a
lookupCoreMap :: CoreMap a -> CoreExpr -> Maybe a
foldCoreMap :: (a -> b -> b) -> b -> CoreMap a -> b
-- | TypeMap a is a map from Type to a. If you are
-- a client, this is the type you want. The keys in this map may have
-- different kinds.
data TypeMap a
emptyTypeMap :: TypeMap a
extendTypeMap :: TypeMap a -> Type -> a -> TypeMap a
lookupTypeMap :: TypeMap a -> Type -> Maybe a
foldTypeMap :: (a -> b -> b) -> b -> TypeMap a -> b
-- | A LooseTypeMap doesn't do a kind-check. Thus, when lookup up (t
-- |> g), you'll find entries inserted under (t), even if (g) is
-- non-reflexive.
data LooseTypeMap a
data CmEnv
lookupCME :: CmEnv -> Var -> Maybe BoundVar
-- | Extend a TypeMap with a type in the given context.
-- extendTypeMapWithScope m (mkDeBruijnContext [a,b,c]) t v is
-- equivalent to extendTypeMap m (forall a b c. t) v, but allows
-- reuse of the context over multiple insertions.
extendTypeMapWithScope :: TypeMap a -> CmEnv -> Type -> a -> TypeMap a
lookupTypeMapWithScope :: TypeMap a -> CmEnv -> Type -> Maybe a
-- | Construct a deBruijn environment with the given variables in scope.
-- e.g. mkDeBruijnEnv [a,b,c] constructs a context forall a
-- b c.
mkDeBruijnContext :: [Var] -> CmEnv
data MaybeMap m a
data ListMap m a
type LiteralMap a = Map Literal a
class TrieMap m where {
type family Key m :: *;
}
emptyTM :: TrieMap m => m a
lookupTM :: forall b. TrieMap m => Key m -> m b -> Maybe b
alterTM :: forall b. TrieMap m => Key m -> XT b -> m b -> m b
mapTM :: TrieMap m => (a -> b) -> m a -> m b
foldTM :: TrieMap m => (a -> b -> b) -> m a -> b -> b
insertTM :: TrieMap m => Key m -> a -> m a -> m a
deleteTM :: TrieMap m => Key m -> m a -> m a
lkDFreeVar :: Var -> DVarEnv a -> Maybe a
xtDFreeVar :: Var -> XT a -> DVarEnv a -> DVarEnv a
lkDNamed :: NamedThing n => n -> DNameEnv a -> Maybe a
xtDNamed :: NamedThing n => n -> XT a -> DNameEnv a -> DNameEnv a
(>.>) :: (a -> b) -> (b -> c) -> a -> c
infixr 1 >.>
(|>) :: a -> (a -> b) -> b
infixr 1 |>
(|>>) :: TrieMap m2 => (XT (m2 a) -> m1 (m2 a) -> m1 (m2 a)) -> (m2 a -> m2 a) -> m1 (m2 a) -> m1 (m2 a)
infixr 1 |>>
instance TrieMap.TrieMap TrieMap.CoreMap
instance Outputable.Outputable a => Outputable.Outputable (TrieMap.CoreMap a)
instance TrieMap.TrieMap TrieMap.CoreMapX
instance TrieMap.TrieMap TrieMap.AltMap
instance TrieMap.TrieMap TrieMap.CoercionMap
instance TrieMap.TrieMap TrieMap.CoercionMapX
instance TrieMap.TrieMap TrieMap.TypeMap
instance TrieMap.TrieMap TrieMap.LooseTypeMap
instance TrieMap.TrieMap TrieMap.TypeMapX
instance Outputable.Outputable a => Outputable.Outputable (TrieMap.TypeMapG a)
instance TrieMap.TrieMap TrieMap.VarMap
instance GHC.Classes.Eq (TrieMap.DeBruijn CoreSyn.CoreExpr)
instance GHC.Classes.Eq (TrieMap.DeBruijn CoreSyn.CoreAlt)
instance GHC.Classes.Eq (TrieMap.DeBruijn TyCoRep.Coercion)
instance GHC.Classes.Eq (TrieMap.DeBruijn TyCoRep.Type)
instance GHC.Classes.Eq (TrieMap.DeBruijn a) => GHC.Classes.Eq (TrieMap.DeBruijn [a])
instance TrieMap.TrieMap TrieMap.TyLitMap
instance (Outputable.Outputable a, Outputable.Outputable (m a)) => Outputable.Outputable (TrieMap.GenMap m a)
instance (GHC.Classes.Eq (TrieMap.Key m), TrieMap.TrieMap m) => TrieMap.TrieMap (TrieMap.GenMap m)
instance TrieMap.TrieMap m => TrieMap.TrieMap (TrieMap.ListMap m)
instance TrieMap.TrieMap m => TrieMap.TrieMap (TrieMap.MaybeMap m)
instance TrieMap.TrieMap Data.IntMap.Internal.IntMap
instance GHC.Classes.Ord k => TrieMap.TrieMap (Data.Map.Internal.Map k)
instance TrieMap.TrieMap UniqDFM.UniqDFM
module FamInstEnv
data FamInst
FamInst :: CoAxiom Unbranched -> FamFlavor -> Name -> [Maybe Name] -> [TyVar] -> [CoVar] -> [Type] -> Type -> FamInst
[fi_axiom] :: FamInst -> CoAxiom Unbranched
[fi_flavor] :: FamInst -> FamFlavor
[fi_fam] :: FamInst -> Name
[fi_tcs] :: FamInst -> [Maybe Name]
[fi_tvs] :: FamInst -> [TyVar]
[fi_cvs] :: FamInst -> [CoVar]
[fi_tys] :: FamInst -> [Type]
[fi_rhs] :: FamInst -> Type
data FamFlavor
SynFamilyInst :: FamFlavor
DataFamilyInst :: TyCon -> FamFlavor
famInstAxiom :: FamInst -> CoAxiom Unbranched
famInstTyCon :: FamInst -> TyCon
famInstRHS :: FamInst -> Type
famInstsRepTyCons :: [FamInst] -> [TyCon]
famInstRepTyCon_maybe :: FamInst -> Maybe TyCon
dataFamInstRepTyCon :: FamInst -> TyCon
pprFamInst :: FamInst -> SDoc
pprFamInsts :: [FamInst] -> SDoc
mkImportedFamInst :: Name -> [Maybe Name] -> CoAxiom Unbranched -> FamInst
type FamInstEnvs = (FamInstEnv, FamInstEnv)
type FamInstEnv = UniqDFM FamilyInstEnv
emptyFamInstEnv :: FamInstEnv
emptyFamInstEnvs :: (FamInstEnv, FamInstEnv)
extendFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv
extendFamInstEnvList :: FamInstEnv -> [FamInst] -> FamInstEnv
famInstEnvElts :: FamInstEnv -> [FamInst]
famInstEnvSize :: FamInstEnv -> Int
familyInstances :: (FamInstEnv, FamInstEnv) -> TyCon -> [FamInst]
mkCoAxBranch :: [TyVar] -> [CoVar] -> [Type] -> Type -> [Role] -> SrcSpan -> CoAxBranch
mkBranchedCoAxiom :: Name -> TyCon -> [CoAxBranch] -> CoAxiom Branched
mkUnbranchedCoAxiom :: Name -> TyCon -> CoAxBranch -> CoAxiom Unbranched
mkSingleCoAxiom :: Role -> Name -> [TyVar] -> [CoVar] -> TyCon -> [Type] -> Type -> CoAxiom Unbranched
-- | Create a coercion constructor (axiom) suitable for the given newtype
-- TyCon. The Name should be that of a new coercion
-- CoAxiom, the TyVars the arguments expected by the
-- newtype and the type the appropriate right hand side of the
-- newtype, with the free variables a subset of those
-- TyVars.
mkNewTypeCoAxiom :: Name -> TyCon -> [TyVar] -> [Role] -> Type -> CoAxiom Unbranched
data FamInstMatch
FamInstMatch :: FamInst -> [Type] -> [Coercion] -> FamInstMatch
[fim_instance] :: FamInstMatch -> FamInst
[fim_tys] :: FamInstMatch -> [Type]
[fim_cos] :: FamInstMatch -> [Coercion]
lookupFamInstEnv :: FamInstEnvs -> TyCon -> [Type] -> [FamInstMatch]
lookupFamInstEnvConflicts :: FamInstEnvs -> FamInst -> [FamInstMatch]
lookupFamInstEnvByTyCon :: FamInstEnvs -> TyCon -> [FamInst]
isDominatedBy :: CoAxBranch -> [CoAxBranch] -> Bool
-- | Do an apartness check, as described in the "Closed Type Families"
-- paper (POPL '14). This should be used when determining if an equation
-- (CoAxBranch) of a closed type family can be used to reduce a
-- certain target type family application.
apartnessCheck :: [Type] -> CoAxBranch -> Bool
-- | Result of testing two type family equations for injectiviy.
data InjectivityCheckResult
-- | Either RHSs are distinct or unification of RHSs leads to unification
-- of LHSs
InjectivityAccepted :: InjectivityCheckResult
-- | RHSs unify but LHSs don't unify under that substitution. Relevant for
-- closed type families where equation after unification might be
-- overlpapped (in which case it is OK if they don't unify). Constructor
-- stores axioms after unification.
InjectivityUnified :: CoAxBranch -> CoAxBranch -> InjectivityCheckResult
-- | Check whether an open type family equation can be added to already
-- existing instance environment without causing conflicts with supplied
-- injectivity annotations. Returns list of conflicting axioms (type
-- instance declarations).
lookupFamInstEnvInjectivityConflicts :: [Bool] -> FamInstEnvs -> FamInst -> [CoAxBranch]
-- | Check whether two type family axioms don't violate injectivity
-- annotation.
injectiveBranches :: [Bool] -> CoAxBranch -> CoAxBranch -> InjectivityCheckResult
topNormaliseType :: FamInstEnvs -> Type -> Type
-- | Get rid of *outermost* (or toplevel) * type function redex * data
-- family redex * newtypes returning an appropriate Representational
-- coercion. Specifically, if topNormaliseType_maybe env ty = Just (co,
-- ty') then (a) co :: ty ~R ty' (b) ty' is not a newtype, and is not a
-- type-family or data-family redex
--
-- However, ty' can be something like (Maybe (F ty)), where (F ty) is a
-- redex.
topNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe (Coercion, Type)
normaliseType :: FamInstEnvs -> Role -> Type -> (Coercion, Type)
normaliseTcApp :: FamInstEnvs -> Role -> TyCon -> [Type] -> (Coercion, Type)
reduceTyFamApp_maybe :: FamInstEnvs -> Role -> TyCon -> [Type] -> Maybe (Coercion, Type)
-- | Get rid of *outermost* (or toplevel) * type function redex * data
-- family redex * newtypes
--
-- Behaves exactly like topNormaliseType_maybe, but instead of
-- returning a coercion, it returns useful information for issuing
-- pattern matching warnings. See Note [Type normalisation for EmptyCase]
-- for details.
pmTopNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe (Type, [DataCon], Type)
flattenTys :: InScopeSet -> [Type] -> [Type]
instance GHC.Base.Monad FamInstEnv.NormM
instance GHC.Base.Functor FamInstEnv.NormM
instance GHC.Base.Applicative FamInstEnv.NormM
instance Outputable.Outputable FamInstEnv.FamInstMatch
instance Outputable.Outputable FamInstEnv.FamilyInstEnv
instance Name.NamedThing FamInstEnv.FamInst
instance Outputable.Outputable FamInstEnv.FamInst
module IdInfo
-- | Identifier Details
--
-- The IdDetails of an Id give stable, and necessary,
-- information about the Id.
data IdDetails
VanillaId :: IdDetails
-- | The Id for a record selector
RecSelId :: RecSelParent -> Bool -> IdDetails
[sel_tycon] :: IdDetails -> RecSelParent
[sel_naughty] :: IdDetails -> Bool
-- | The Id is for a data constructor worker
DataConWorkId :: DataCon -> IdDetails
-- | The Id is for a data constructor wrapper
DataConWrapId :: DataCon -> IdDetails
-- | The Id is a superclass selector, or class operation of a
-- class
ClassOpId :: Class -> IdDetails
-- | The Id is for a primitive operator
PrimOpId :: PrimOp -> IdDetails
-- | The Id is for a foreign call. Type will be simple: no type
-- families, newtypes, etc
FCallId :: ForeignCall -> IdDetails
-- | The Id is for a HPC tick box (both traditional and binary)
TickBoxOpId :: TickBoxOp -> IdDetails
-- | A dictionary function. Bool = True = the class has only one
-- method, so may be implemented with a newtype, so it might be bad to be
-- strict on this dictionary
DFunId :: Bool -> IdDetails
-- | A coercion variable This only covers un-lifted coercions, of
-- type (t1 ~ t2), not their lifted variants
CoVarId :: IdDetails
-- | An Id for a join point taking n arguments Note [Join points]
-- in CoreSyn
JoinId :: JoinArity -> IdDetails
pprIdDetails :: IdDetails -> SDoc
-- | Just a synonym for CoVarId. Written separately so it can be
-- exported in the hs-boot file.
coVarDetails :: IdDetails
-- | Check if an IdDetails says CoVarId.
isCoVarDetails :: IdDetails -> Bool
-- | The number of arguments that a join point takes. Unlike the arity of a
-- function, this is a purely syntactic property and is fixed when the
-- join point is created (or converted from a value). Both type and value
-- arguments are counted.
type JoinArity = Int
isJoinIdDetails_maybe :: IdDetails -> Maybe JoinArity
-- | Recursive Selector Parent
data RecSelParent
RecSelData :: TyCon -> RecSelParent
RecSelPatSyn :: PatSyn -> RecSelParent
-- | Identifier Information
--
-- An IdInfo gives optional information about an
-- Id. If present it never lies, but it may not be present, in
-- which case there is always a conservative assumption which can be
-- made.
--
-- Two Ids may have different info even though they have the
-- same Unique (and are hence the same Id); for
-- example, one might lack the properties attached to the other.
--
-- Most of the IdInfo gives information about the value, or
-- definition, of the Id, independent of its usage. Exceptions
-- to this are demandInfo, occInfo, oneShotInfo and
-- callArityInfo.
--
-- Performance note: when we update IdInfo, we have to reallocate
-- this entire record, so it is a good idea not to let this data
-- structure get too big.
data IdInfo
-- | Basic IdInfo that carries no useful information whatsoever
vanillaIdInfo :: IdInfo
-- | More informative IdInfo we can use when we know the Id
-- has no CAF references
noCafIdInfo :: IdInfo
-- | If the Id is a lambda-bound variable then it may have
-- lambda-bound variable info. Sometimes we know whether the lambda
-- binding this variable is a "one-shot" lambda; that is, whether it is
-- applied at most once.
--
-- This information may be useful in optimisation, as computations may
-- safely be floated inside such a lambda without risk of duplicating
-- work.
data OneShotInfo
-- | No information
NoOneShotInfo :: OneShotInfo
-- | The lambda is applied at most once.
OneShotLam :: OneShotInfo
-- | Info about a lambda-bound variable, if the Id is one
oneShotInfo :: IdInfo -> OneShotInfo
-- | It is always safe to assume that an Id has no lambda-bound
-- variable information
noOneShotInfo :: OneShotInfo
hasNoOneShotInfo :: OneShotInfo -> Bool
setOneShotInfo :: IdInfo -> OneShotInfo -> IdInfo
infixl 1 `setOneShotInfo`
-- | This is used to remove information on lambda binders that we have
-- setup as part of a lambda group, assuming they will be applied all at
-- once, but turn out to be part of an unsaturated lambda as in e.g:
--
--
-- (\x1. \x2. e) arg1
--
zapLamInfo :: IdInfo -> Maybe IdInfo
-- | Zap info that depends on free variables
zapFragileInfo :: IdInfo -> Maybe IdInfo
-- | Remove all demand info on the IdInfo
zapDemandInfo :: IdInfo -> Maybe IdInfo
-- | Remove usage (but not strictness) info on the IdInfo
zapUsageInfo :: IdInfo -> Maybe IdInfo
-- | Remove usage environment info from the strictness signature on the
-- IdInfo
zapUsageEnvInfo :: IdInfo -> Maybe IdInfo
zapUsedOnceInfo :: IdInfo -> Maybe IdInfo
zapTailCallInfo :: IdInfo -> Maybe IdInfo
zapCallArityInfo :: IdInfo -> IdInfo
-- | Arity Information
--
-- An ArityInfo of n tells us that partial application of
-- this Id to up to n-1 value arguments does
-- essentially no work.
--
-- That is not necessarily the same as saying that it has n
-- leading lambdas, because coerces may get in the way.
--
-- The arity might increase later in the compilation process, if an extra
-- lambda floats up to the binding site.
type ArityInfo = Arity
-- | It is always safe to assume that an Id has an arity of 0
unknownArity :: Arity
-- | Id arity
arityInfo :: IdInfo -> ArityInfo
setArityInfo :: IdInfo -> ArityInfo -> IdInfo
infixl 1 `setArityInfo`
ppArityInfo :: Int -> SDoc
-- | How this is called. n = all calls have at least n arguments
callArityInfo :: IdInfo -> ArityInfo
setCallArityInfo :: IdInfo -> ArityInfo -> IdInfo
strictnessInfo :: IdInfo -> StrictSig
setStrictnessInfo :: IdInfo -> StrictSig -> IdInfo
infixl 1 `setStrictnessInfo`
-- | ID demand information
demandInfo :: IdInfo -> Demand
setDemandInfo :: IdInfo -> Demand -> IdInfo
infixl 1 `setDemandInfo`
pprStrictness :: StrictSig -> SDoc
-- | The Ids unfolding
unfoldingInfo :: IdInfo -> Unfolding
setUnfoldingInfo :: IdInfo -> Unfolding -> IdInfo
infixl 1 `setUnfoldingInfo`
-- | Inline Pragma Information
--
-- Tells when the inlining is active. When it is active the thing may be
-- inlined, depending on how big it is.
--
-- If there was an INLINE pragma, then as a separate matter, the
-- RHS will have been made to look small with a Core inline Note
--
-- The default InlinePragInfo is AlwaysActive, so the info
-- serves entirely as a way to inhibit inlining until we want it
type InlinePragInfo = InlinePragma
-- | Any inline pragma atached to the Id
inlinePragInfo :: IdInfo -> InlinePragma
setInlinePragInfo :: IdInfo -> InlinePragma -> IdInfo
infixl 1 `setInlinePragInfo`
-- | identifier Occurrence Information
data OccInfo
-- | There are many occurrences, or unknown occurrences
ManyOccs :: !TailCallInfo -> OccInfo
[occ_tail] :: OccInfo -> !TailCallInfo
-- | Marks unused variables. Sometimes useful for lambda and case-bound
-- variables.
IAmDead :: OccInfo
-- | Occurs exactly once (per branch), not inside a rule
OneOcc :: !InsideLam -> !OneBranch -> !InterestingCxt -> !TailCallInfo -> OccInfo
[occ_in_lam] :: OccInfo -> !InsideLam
[occ_one_br] :: OccInfo -> !OneBranch
[occ_int_cxt] :: OccInfo -> !InterestingCxt
[occ_tail] :: OccInfo -> !TailCallInfo
-- | This identifier breaks a loop of mutually recursive functions. The
-- field marks whether it is only a loop breaker due to a reference in a
-- rule
IAmALoopBreaker :: !RulesOnly -> !TailCallInfo -> OccInfo
[occ_rules_only] :: OccInfo -> !RulesOnly
[occ_tail] :: OccInfo -> !TailCallInfo
isDeadOcc :: OccInfo -> Bool
isStrongLoopBreaker :: OccInfo -> Bool
isWeakLoopBreaker :: OccInfo -> Bool
-- | How the Id occurs in the program
occInfo :: IdInfo -> OccInfo
setOccInfo :: IdInfo -> OccInfo -> IdInfo
infixl 1 `setOccInfo`
-- | Inside Lambda
type InsideLam = Bool
type OneBranch = Bool
insideLam :: InsideLam
notInsideLam :: InsideLam
oneBranch :: OneBranch
notOneBranch :: OneBranch
data TailCallInfo
AlwaysTailCalled :: JoinArity -> TailCallInfo
NoTailCallInfo :: TailCallInfo
tailCallInfo :: OccInfo -> TailCallInfo
isAlwaysTailCalled :: OccInfo -> Bool
-- | Rule Information
--
-- Records the specializations of this Id that we know about in
-- the form of rewrite CoreRules that target them
data RuleInfo
RuleInfo :: [CoreRule] -> DVarSet -> RuleInfo
-- | Assume that no specilizations exist: always safe
emptyRuleInfo :: RuleInfo
isEmptyRuleInfo :: RuleInfo -> Bool
-- | Retrieve the locally-defined free variables of both the left and right
-- hand sides of the specialization rules
ruleInfoFreeVars :: RuleInfo -> DVarSet
ruleInfoRules :: RuleInfo -> [CoreRule]
-- | Change the name of the function the rule is keyed on on all of the
-- CoreRules
setRuleInfoHead :: Name -> RuleInfo -> RuleInfo
-- | Specialisations of the Ids function which exist See Note
-- [Specialisations and RULES in IdInfo]
ruleInfo :: IdInfo -> RuleInfo
setRuleInfo :: IdInfo -> RuleInfo -> IdInfo
infixl 1 `setRuleInfo`
-- | Constant applicative form Information
--
-- Records whether an Id makes Constant Applicative Form
-- references
data CafInfo
-- | Indicates that the Id is for either:
--
--
-- - A function or static constructor that refers to one or more CAFs,
-- or
-- - A real live CAF
--
MayHaveCafRefs :: CafInfo
-- | A function or static constructor that refers to no CAFs.
NoCafRefs :: CafInfo
ppCafInfo :: CafInfo -> SDoc
mayHaveCafRefs :: CafInfo -> Bool
-- | Id CAF info
cafInfo :: IdInfo -> CafInfo
setCafInfo :: IdInfo -> CafInfo -> IdInfo
infixl 1 `setCafInfo`
-- | Tick box for Hpc-style coverage
data TickBoxOp
TickBox :: Module -> {-# UNPACK #-} !TickBoxId -> TickBoxOp
type TickBoxId = Int
data LevityInfo
-- | when applied, will this Id ever have a levity-polymorphic type?
levityInfo :: IdInfo -> LevityInfo
-- | Marks an IdInfo describing an Id that is never levity polymorphic
-- (even when applied). The Type is only there for checking that it's
-- really never levity polymorphic
setNeverLevPoly :: HasDebugCallStack => IdInfo -> Type -> IdInfo
infixl 1 `setNeverLevPoly`
setLevityInfoWithType :: IdInfo -> Type -> IdInfo
infixl 1 `setLevityInfoWithType`
isNeverLevPolyIdInfo :: IdInfo -> Bool
instance GHC.Classes.Eq IdInfo.RecSelParent
instance GHC.Classes.Eq IdInfo.LevityInfo
instance GHC.Classes.Ord IdInfo.CafInfo
instance GHC.Classes.Eq IdInfo.CafInfo
instance Outputable.Outputable IdInfo.RecSelParent
instance Outputable.Outputable IdInfo.IdDetails
instance Outputable.Outputable IdInfo.TickBoxOp
instance Outputable.Outputable IdInfo.LevityInfo
instance Outputable.Outputable IdInfo.CafInfo
-- | GHC uses several kinds of name internally:
--
--
module Id
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and it's use sites.
data Var
-- | Identifier
type Id = Var
isId :: Var -> Bool
type InVar = Var
type InId = Id
type OutVar = Var
type OutId = Id
-- | For an explanation of global vs. local Ids, see
-- Var#globalvslocal
mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id
-- | Make a global Id without any extra information at all
mkVanillaGlobal :: Name -> Type -> Id
-- | Make a global Id with no global information but some generic
-- IdInfo
mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id
-- | For an explanation of global vs. local Ids, see
-- Var#globalvslocal
mkLocalId :: Name -> Type -> Id
-- | Make a local CoVar
mkLocalCoVar :: Name -> Type -> CoVar
-- | Like mkLocalId, but checks the type to see if it should make a
-- covar
mkLocalIdOrCoVar :: Name -> Type -> Id
-- | Make a local id, with the IdDetails set to CoVarId if the type
-- indicates so.
mkLocalIdOrCoVarWithInfo :: Name -> Type -> IdInfo -> Id
mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id
-- | Create a local Id that is marked as exported. This prevents
-- things attached to it from being removed as dead code. See Note
-- [Exported LocalIds]
mkExportedLocalId :: IdDetails -> Name -> Type -> Id
mkExportedVanillaId :: Name -> Type -> Id
-- | Create a system local Id. These are local Ids (see
-- Var#globalvslocal) that are created by the compiler out of thin
-- air
mkSysLocal :: FastString -> Unique -> Type -> Id
mkSysLocalM :: MonadUnique m => FastString -> Type -> m Id
-- | Like mkSysLocal, but checks to see if we have a covar type
mkSysLocalOrCoVar :: FastString -> Unique -> Type -> Id
mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Type -> m Id
-- | Create a user local Id. These are local Ids (see
-- Var#globalvslocal) with a name and location that the user might
-- recognize
mkUserLocal :: OccName -> Unique -> Type -> SrcSpan -> Id
-- | Like mkUserLocal, but checks if we have a coercion type
mkUserLocalOrCoVar :: OccName -> Unique -> Type -> SrcSpan -> Id
-- | Create a template local for a series of types
mkTemplateLocals :: [Type] -> [Id]
-- | Create a template local for a series of type, but start from a
-- specified template local
mkTemplateLocalsNum :: Int -> [Type] -> [Id]
-- | Create a template local: a family of system local Ids in
-- bijection with Ints, typically used in unfoldings
mkTemplateLocal :: Int -> Type -> Id
-- | Workers get local names. CoreTidy will externalise these if
-- necessary
mkWorkerId :: Unique -> Id -> Type -> Id
idName :: Id -> Name
idType :: Id -> Kind
idUnique :: Id -> Unique
idInfo :: HasDebugCallStack => Id -> IdInfo
idDetails :: Id -> IdDetails
-- | If the Id is that for a record selector, extract the
-- sel_tycon. Panic otherwise.
recordSelectorTyCon :: Id -> RecSelParent
setIdName :: Id -> Name -> Id
setIdUnique :: Id -> Unique -> Id
-- | Not only does this set the Id Type, it also evaluates
-- the type to try and reduce space usage
setIdType :: Id -> Type -> Id
setIdExported :: Id -> Id
setIdNotExported :: Id -> Id
-- | If it's a local, make it global
globaliseId :: Id -> Id
localiseId :: Id -> Id
setIdInfo :: Id -> IdInfo -> Id
lazySetIdInfo :: Id -> IdInfo -> Id
modifyIdInfo :: (IdInfo -> IdInfo) -> Id -> Id
maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id
zapLamIdInfo :: Id -> Id
zapIdDemandInfo :: Id -> Id
zapIdUsageInfo :: Id -> Id
zapIdUsageEnvInfo :: Id -> Id
zapIdUsedOnceInfo :: Id -> Id
zapIdTailCallInfo :: Id -> Id
zapFragileIdInfo :: Id -> Id
zapIdStrictness :: Id -> Id
transferPolyIdInfo :: Id -> [Var] -> Id -> Id
-- | isImplicitId tells whether an Ids info is implied by
-- other declarations, so we don't need to put its signature in an
-- interface file, even if it's mentioned in some other interface
-- unfolding.
isImplicitId :: Id -> Bool
isDeadBinder :: Id -> Bool
-- | This predicate says whether the Id has a strict demand placed
-- on it or has a type such that it can always be evaluated strictly (i.e
-- an unlifted type, as of GHC 7.6). We need to check separately whether
-- the Id has a so-called "strict type" because if the demand for
-- the given id hasn't been computed yet but id has a
-- strict type, we still want isStrictId id to be True.
isStrictId :: Id -> Bool
-- | isExportedIdVar means "don't throw this away"
isExportedId :: Var -> Bool
isLocalId :: Var -> Bool
isGlobalId :: Var -> Bool
isRecordSelector :: Id -> Bool
isNaughtyRecordSelector :: Id -> Bool
isPatSynRecordSelector :: Id -> Bool
isDataConRecordSelector :: Id -> Bool
isClassOpId_maybe :: Id -> Maybe Class
isDFunId :: Id -> Bool
isPrimOpId :: Id -> Bool
isPrimOpId_maybe :: Id -> Maybe PrimOp
isFCallId :: Id -> Bool
isFCallId_maybe :: Id -> Maybe ForeignCall
isDataConWorkId :: Id -> Bool
isDataConWorkId_maybe :: Id -> Maybe DataCon
isDataConId_maybe :: Id -> Maybe DataCon
-- | Get from either the worker or the wrapper Id to the
-- DataCon. Currently used only in the desugarer.
--
-- INVARIANT: idDataCon (dataConWrapId d) = d: remember,
-- dataConWrapId can return either the wrapper or the worker
idDataCon :: Id -> DataCon
isConLikeId :: Id -> Bool
-- | Returns true if an application to n args would diverge
isBottomingId :: Var -> Bool
idIsFrom :: Module -> Id -> Bool
-- | Returns True of an Id which may not have a binding,
-- even though it is defined in this module.
hasNoBinding :: Id -> Bool
-- | Dictionary Identifier
type DictId = EvId
isDictId :: Id -> Bool
isEvVar :: Var -> Bool
type JoinId = Id
isJoinId :: Var -> Bool
isJoinId_maybe :: Var -> Maybe JoinArity
idJoinArity :: JoinId -> JoinArity
asJoinId :: Id -> JoinArity -> JoinId
infixl 1 `asJoinId`
asJoinId_maybe :: Id -> Maybe JoinArity -> Id
infixl 1 `asJoinId_maybe`
zapJoinId :: Id -> Id
idInlinePragma :: Id -> InlinePragma
setInlinePragma :: Id -> InlinePragma -> Id
infixl 1 `setInlinePragma`
modifyInlinePragma :: Id -> (InlinePragma -> InlinePragma) -> Id
idInlineActivation :: Id -> Activation
setInlineActivation :: Id -> Activation -> Id
infixl 1 `setInlineActivation`
idRuleMatchInfo :: Id -> RuleMatchInfo
-- | Returns whether the lambda associated with the Id is certainly
-- applied at most once This one is the "business end", called
-- externally. It works on type variables as well as Ids, returning True
-- Its main purpose is to encapsulate the Horrible State Hack See Note
-- [The state-transformer hack] in CoreArity
isOneShotBndr :: Var -> Bool
isProbablyOneShotLambda :: Id -> Bool
setOneShotLambda :: Id -> Id
clearOneShotLambda :: Id -> Id
updOneShotInfo :: Id -> OneShotInfo -> Id
setIdOneShotInfo :: Id -> OneShotInfo -> Id
infixl 1 `setIdOneShotInfo`
isStateHackType :: Type -> Bool
-- | Should we apply the state hack to values of this Type?
stateHackOneShot :: OneShotInfo
typeOneShot :: Type -> OneShotInfo
idArity :: Id -> Arity
idCallArity :: Id -> Arity
idFunRepArity :: Id -> RepArity
idUnfolding :: Id -> Unfolding
realIdUnfolding :: Id -> Unfolding
idSpecialisation :: Id -> RuleInfo
idCoreRules :: Id -> [CoreRule]
idHasRules :: Id -> Bool
idCafInfo :: Id -> CafInfo
infixl 1 `idCafInfo`
idOneShotInfo :: Id -> OneShotInfo
-- | Like idOneShotInfo, but taking the Horrible State Hack in to
-- account See Note [The state-transformer hack] in CoreArity
idStateHackOneShotInfo :: Id -> OneShotInfo
idOccInfo :: Id -> OccInfo
isNeverLevPolyId :: Id -> Bool
setIdUnfolding :: Id -> Unfolding -> Id
infixl 1 `setIdUnfolding`
setCaseBndrEvald :: StrictnessMark -> Id -> Id
setIdArity :: Id -> Arity -> Id
infixl 1 `setIdArity`
setIdCallArity :: Id -> Arity -> Id
infixl 1 `setIdCallArity`
setIdSpecialisation :: Id -> RuleInfo -> Id
infixl 1 `setIdSpecialisation`
setIdCafInfo :: Id -> CafInfo -> Id
setIdOccInfo :: Id -> OccInfo -> Id
infixl 1 `setIdOccInfo`
zapIdOccInfo :: Id -> Id
setIdDemandInfo :: Id -> Demand -> Id
infixl 1 `setIdDemandInfo`
setIdStrictness :: Id -> StrictSig -> Id
infixl 1 `setIdStrictness`
idDemandInfo :: Id -> Demand
idStrictness :: Id -> StrictSig
module UnVarGraph
data UnVarSet
emptyUnVarSet :: UnVarSet
mkUnVarSet :: [Var] -> UnVarSet
varEnvDom :: VarEnv a -> UnVarSet
unionUnVarSet :: UnVarSet -> UnVarSet -> UnVarSet
unionUnVarSets :: [UnVarSet] -> UnVarSet
delUnVarSet :: UnVarSet -> Var -> UnVarSet
elemUnVarSet :: Var -> UnVarSet -> Bool
isEmptyUnVarSet :: UnVarSet -> Bool
data UnVarGraph
emptyUnVarGraph :: UnVarGraph
unionUnVarGraph :: UnVarGraph -> UnVarGraph -> UnVarGraph
unionUnVarGraphs :: [UnVarGraph] -> UnVarGraph
completeGraph :: UnVarSet -> UnVarGraph
completeBipartiteGraph :: UnVarSet -> UnVarSet -> UnVarGraph
neighbors :: UnVarGraph -> Var -> UnVarSet
delNode :: UnVarGraph -> Var -> UnVarGraph
instance GHC.Classes.Eq UnVarGraph.UnVarSet
instance Outputable.Outputable UnVarGraph.UnVarGraph
instance Outputable.Outputable UnVarGraph.Gen
instance Outputable.Outputable UnVarGraph.UnVarSet
-- | This module is about types that can be defined in Haskell, but which
-- must be wired into the compiler nonetheless. C.f module TysPrim
module TysWiredIn
mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name
mkWiredInIdName :: Module -> FastString -> Unique -> Id -> Name
mkFunKind :: Kind -> Kind -> Kind
mkForAllKind :: TyVar -> ArgFlag -> Kind -> Kind
wiredInTyCons :: [TyCon]
-- | Built-in syntax isn't "in scope" so these OccNames map to wired-in
-- Names with BuiltInSyntax. However, this should only be necessary while
-- resolving names produced by Template Haskell splices since we take
-- care to encode built-in syntax names specially in interface files. See
-- Note [Symbol table representation of names].
--
-- Moreover, there is no need to include names of things that the user
-- can't write (e.g. type representation bindings like $tc(,,,)).
isBuiltInOcc_maybe :: OccName -> Maybe Name
boolTy :: Type
boolTyCon :: TyCon
boolTyCon_RDR :: RdrName
boolTyConName :: Name
trueDataCon :: DataCon
trueDataConId :: Id
true_RDR :: RdrName
falseDataCon :: DataCon
falseDataConId :: Id
false_RDR :: RdrName
promotedFalseDataCon :: TyCon
promotedTrueDataCon :: TyCon
orderingTyCon :: TyCon
ltDataCon :: DataCon
ltDataConId :: Id
eqDataCon :: DataCon
eqDataConId :: Id
gtDataCon :: DataCon
gtDataConId :: Id
promotedLTDataCon :: TyCon
promotedEQDataCon :: TyCon
promotedGTDataCon :: TyCon
boxingDataCon_maybe :: TyCon -> Maybe DataCon
charTyCon :: TyCon
charDataCon :: DataCon
charTyCon_RDR :: RdrName
charTy :: Type
stringTy :: Type
charTyConName :: Name
doubleTyCon :: TyCon
doubleDataCon :: DataCon
doubleTy :: Type
doubleTyConName :: Name
floatTyCon :: TyCon
floatDataCon :: DataCon
floatTy :: Type
floatTyConName :: Name
intTyCon :: TyCon
intDataCon :: DataCon
intTyCon_RDR :: RdrName
intDataCon_RDR :: RdrName
intTyConName :: Name
intTy :: Type
wordTyCon :: TyCon
wordDataCon :: DataCon
wordTyConName :: Name
wordTy :: Type
word8TyCon :: TyCon
word8DataCon :: DataCon
word8TyConName :: Name
word8Ty :: Type
listTyCon :: TyCon
listTyCon_RDR :: RdrName
listTyConName :: Name
listTyConKey :: Unique
nilDataCon :: DataCon
nilDataConName :: Name
nilDataConKey :: Unique
consDataCon_RDR :: RdrName
consDataCon :: DataCon
consDataConName :: Name
promotedNilDataCon :: TyCon
promotedConsDataCon :: TyCon
mkListTy :: Type -> Type
-- | Make a *promoted* list.
mkPromotedListTy :: Kind -> [Type] -> Type
maybeTyCon :: TyCon
maybeTyConName :: Name
nothingDataCon :: DataCon
nothingDataConName :: Name
promotedNothingDataCon :: TyCon
justDataCon :: DataCon
justDataConName :: Name
promotedJustDataCon :: TyCon
-- | Make a tuple type. The list of types should not include any
-- RuntimeRep specifications.
mkTupleTy :: Boxity -> [Type] -> Type
-- | Build the type of a small tuple that holds the specified type of thing
mkBoxedTupleTy :: [Type] -> Type
tupleTyCon :: Boxity -> Arity -> TyCon
tupleDataCon :: Boxity -> Arity -> DataCon
tupleTyConName :: TupleSort -> Arity -> Name
promotedTupleDataCon :: Boxity -> Arity -> TyCon
unitTyCon :: TyCon
unitDataCon :: DataCon
unitDataConId :: Id
unitTy :: Type
unitTyConKey :: Unique
pairTyCon :: TyCon
unboxedUnitTyCon :: TyCon
unboxedUnitDataCon :: DataCon
-- | Specialization of unboxedTupleSumKind for tuples
unboxedTupleKind :: [Type] -> Kind
-- | Specialization of unboxedTupleSumKind for sums
unboxedSumKind :: [Type] -> Kind
cTupleTyConName :: Arity -> Name
cTupleTyConNames :: [Name]
isCTupleTyConName :: Name -> Bool
cTupleDataConName :: Arity -> Name
cTupleDataConNames :: [Name]
anyTyCon :: TyCon
anyTy :: Type
anyTypeOfKind :: Kind -> Type
mkSumTy :: [Type] -> Type
-- | Type constructor for n-ary unboxed sum.
sumTyCon :: Arity -> TyCon
-- | Data constructor for i-th alternative of a n-ary unboxed sum.
sumDataCon :: ConTag -> Arity -> DataCon
typeNatKindCon :: TyCon
typeNatKind :: Kind
typeSymbolKindCon :: TyCon
typeSymbolKind :: Kind
isLiftedTypeKindTyConName :: Name -> Bool
liftedTypeKind :: Kind
constraintKind :: Kind
starKindTyCon :: TyCon
starKindTyConName :: Name
unicodeStarKindTyCon :: TyCon
unicodeStarKindTyConName :: Name
liftedTypeKindTyCon :: TyCon
constraintKindTyCon :: TyCon
-- | Construct a type representing the application of the parallel array
-- constructor
mkPArrTy :: Type -> Type
-- | Represents the type constructor of parallel arrays
--
--
-- - This must match the definition in PrelPArr
--
--
-- NB: Although the constructor is given here, it will not be accessible
-- in user code as it is not in the environment of any compiled module
-- except PrelPArr.
parrTyCon :: TyCon
-- | Fake array constructors
--
--
-- - These constructors are never really used to represent array
-- values; however, they are very convenient during desugaring (and, in
-- particular, in the pattern matching compiler) to treat array pattern
-- just like yet another constructor pattern
--
parrFakeCon :: Arity -> DataCon
-- | Check whether a type constructor is the constructor for parallel
-- arrays
isPArrTyCon :: TyCon -> Bool
-- | Checks whether a data constructor is a fake constructor for parallel
-- arrays
isPArrFakeCon :: DataCon -> Bool
parrTyCon_RDR :: RdrName
parrTyConName :: Name
heqTyCon :: TyCon
heqClass :: Class
heqDataCon :: DataCon
coercibleTyCon :: TyCon
coercibleDataCon :: DataCon
coercibleClass :: Class
runtimeRepTyCon :: TyCon
vecCountTyCon :: TyCon
vecElemTyCon :: TyCon
runtimeRepTy :: Type
liftedRepTy :: Type
liftedRepDataCon :: DataCon
liftedRepDataConTyCon :: TyCon
vecRepDataConTyCon :: TyCon
tupleRepDataConTyCon :: TyCon
sumRepDataConTyCon :: TyCon
liftedRepDataConTy :: Type
unliftedRepDataConTy :: Type
intRepDataConTy :: Type
wordRepDataConTy :: Type
int64RepDataConTy :: Type
word64RepDataConTy :: Type
addrRepDataConTy :: Type
floatRepDataConTy :: Type
doubleRepDataConTy :: Type
vec2DataConTy :: Type
vec4DataConTy :: Type
vec8DataConTy :: Type
vec16DataConTy :: Type
vec32DataConTy :: Type
vec64DataConTy :: Type
int8ElemRepDataConTy :: Type
int16ElemRepDataConTy :: Type
int32ElemRepDataConTy :: Type
int64ElemRepDataConTy :: Type
word8ElemRepDataConTy :: Type
word16ElemRepDataConTy :: Type
word32ElemRepDataConTy :: Type
word64ElemRepDataConTy :: Type
floatElemRepDataConTy :: Type
doubleElemRepDataConTy :: Type
module PrimOp
data PrimOp
CharGtOp :: PrimOp
CharGeOp :: PrimOp
CharEqOp :: PrimOp
CharNeOp :: PrimOp
CharLtOp :: PrimOp
CharLeOp :: PrimOp
OrdOp :: PrimOp
IntAddOp :: PrimOp
IntSubOp :: PrimOp
IntMulOp :: PrimOp
IntMulMayOfloOp :: PrimOp
IntQuotOp :: PrimOp
IntRemOp :: PrimOp
IntQuotRemOp :: PrimOp
AndIOp :: PrimOp
OrIOp :: PrimOp
XorIOp :: PrimOp
NotIOp :: PrimOp
IntNegOp :: PrimOp
IntAddCOp :: PrimOp
IntSubCOp :: PrimOp
IntGtOp :: PrimOp
IntGeOp :: PrimOp
IntEqOp :: PrimOp
IntNeOp :: PrimOp
IntLtOp :: PrimOp
IntLeOp :: PrimOp
ChrOp :: PrimOp
Int2WordOp :: PrimOp
Int2FloatOp :: PrimOp
Int2DoubleOp :: PrimOp
Word2FloatOp :: PrimOp
Word2DoubleOp :: PrimOp
ISllOp :: PrimOp
ISraOp :: PrimOp
ISrlOp :: PrimOp
WordAddOp :: PrimOp
WordSubCOp :: PrimOp
WordAdd2Op :: PrimOp
WordSubOp :: PrimOp
WordMulOp :: PrimOp
WordMul2Op :: PrimOp
WordQuotOp :: PrimOp
WordRemOp :: PrimOp
WordQuotRemOp :: PrimOp
WordQuotRem2Op :: PrimOp
AndOp :: PrimOp
OrOp :: PrimOp
XorOp :: PrimOp
NotOp :: PrimOp
SllOp :: PrimOp
SrlOp :: PrimOp
Word2IntOp :: PrimOp
WordGtOp :: PrimOp
WordGeOp :: PrimOp
WordEqOp :: PrimOp
WordNeOp :: PrimOp
WordLtOp :: PrimOp
WordLeOp :: PrimOp
PopCnt8Op :: PrimOp
PopCnt16Op :: PrimOp
PopCnt32Op :: PrimOp
PopCnt64Op :: PrimOp
PopCntOp :: PrimOp
Clz8Op :: PrimOp
Clz16Op :: PrimOp
Clz32Op :: PrimOp
Clz64Op :: PrimOp
ClzOp :: PrimOp
Ctz8Op :: PrimOp
Ctz16Op :: PrimOp
Ctz32Op :: PrimOp
Ctz64Op :: PrimOp
CtzOp :: PrimOp
BSwap16Op :: PrimOp
BSwap32Op :: PrimOp
BSwap64Op :: PrimOp
BSwapOp :: PrimOp
Narrow8IntOp :: PrimOp
Narrow16IntOp :: PrimOp
Narrow32IntOp :: PrimOp
Narrow8WordOp :: PrimOp
Narrow16WordOp :: PrimOp
Narrow32WordOp :: PrimOp
DoubleGtOp :: PrimOp
DoubleGeOp :: PrimOp
DoubleEqOp :: PrimOp
DoubleNeOp :: PrimOp
DoubleLtOp :: PrimOp
DoubleLeOp :: PrimOp
DoubleAddOp :: PrimOp
DoubleSubOp :: PrimOp
DoubleMulOp :: PrimOp
DoubleDivOp :: PrimOp
DoubleNegOp :: PrimOp
DoubleFabsOp :: PrimOp
Double2IntOp :: PrimOp
Double2FloatOp :: PrimOp
DoubleExpOp :: PrimOp
DoubleLogOp :: PrimOp
DoubleSqrtOp :: PrimOp
DoubleSinOp :: PrimOp
DoubleCosOp :: PrimOp
DoubleTanOp :: PrimOp
DoubleAsinOp :: PrimOp
DoubleAcosOp :: PrimOp
DoubleAtanOp :: PrimOp
DoubleSinhOp :: PrimOp
DoubleCoshOp :: PrimOp
DoubleTanhOp :: PrimOp
DoublePowerOp :: PrimOp
DoubleDecode_2IntOp :: PrimOp
DoubleDecode_Int64Op :: PrimOp
FloatGtOp :: PrimOp
FloatGeOp :: PrimOp
FloatEqOp :: PrimOp
FloatNeOp :: PrimOp
FloatLtOp :: PrimOp
FloatLeOp :: PrimOp
FloatAddOp :: PrimOp
FloatSubOp :: PrimOp
FloatMulOp :: PrimOp
FloatDivOp :: PrimOp
FloatNegOp :: PrimOp
FloatFabsOp :: PrimOp
Float2IntOp :: PrimOp
FloatExpOp :: PrimOp
FloatLogOp :: PrimOp
FloatSqrtOp :: PrimOp
FloatSinOp :: PrimOp
FloatCosOp :: PrimOp
FloatTanOp :: PrimOp
FloatAsinOp :: PrimOp
FloatAcosOp :: PrimOp
FloatAtanOp :: PrimOp
FloatSinhOp :: PrimOp
FloatCoshOp :: PrimOp
FloatTanhOp :: PrimOp
FloatPowerOp :: PrimOp
Float2DoubleOp :: PrimOp
FloatDecode_IntOp :: PrimOp
NewArrayOp :: PrimOp
SameMutableArrayOp :: PrimOp
ReadArrayOp :: PrimOp
WriteArrayOp :: PrimOp
SizeofArrayOp :: PrimOp
SizeofMutableArrayOp :: PrimOp
IndexArrayOp :: PrimOp
UnsafeFreezeArrayOp :: PrimOp
UnsafeThawArrayOp :: PrimOp
CopyArrayOp :: PrimOp
CopyMutableArrayOp :: PrimOp
CloneArrayOp :: PrimOp
CloneMutableArrayOp :: PrimOp
FreezeArrayOp :: PrimOp
ThawArrayOp :: PrimOp
CasArrayOp :: PrimOp
NewSmallArrayOp :: PrimOp
SameSmallMutableArrayOp :: PrimOp
ReadSmallArrayOp :: PrimOp
WriteSmallArrayOp :: PrimOp
SizeofSmallArrayOp :: PrimOp
SizeofSmallMutableArrayOp :: PrimOp
IndexSmallArrayOp :: PrimOp
UnsafeFreezeSmallArrayOp :: PrimOp
UnsafeThawSmallArrayOp :: PrimOp
CopySmallArrayOp :: PrimOp
CopySmallMutableArrayOp :: PrimOp
CloneSmallArrayOp :: PrimOp
CloneSmallMutableArrayOp :: PrimOp
FreezeSmallArrayOp :: PrimOp
ThawSmallArrayOp :: PrimOp
CasSmallArrayOp :: PrimOp
NewByteArrayOp_Char :: PrimOp
NewPinnedByteArrayOp_Char :: PrimOp
NewAlignedPinnedByteArrayOp_Char :: PrimOp
MutableByteArrayIsPinnedOp :: PrimOp
ByteArrayIsPinnedOp :: PrimOp
ByteArrayContents_Char :: PrimOp
SameMutableByteArrayOp :: PrimOp
ShrinkMutableByteArrayOp_Char :: PrimOp
ResizeMutableByteArrayOp_Char :: PrimOp
UnsafeFreezeByteArrayOp :: PrimOp
SizeofByteArrayOp :: PrimOp
SizeofMutableByteArrayOp :: PrimOp
GetSizeofMutableByteArrayOp :: PrimOp
IndexByteArrayOp_Char :: PrimOp
IndexByteArrayOp_WideChar :: PrimOp
IndexByteArrayOp_Int :: PrimOp
IndexByteArrayOp_Word :: PrimOp
IndexByteArrayOp_Addr :: PrimOp
IndexByteArrayOp_Float :: PrimOp
IndexByteArrayOp_Double :: PrimOp
IndexByteArrayOp_StablePtr :: PrimOp
IndexByteArrayOp_Int8 :: PrimOp
IndexByteArrayOp_Int16 :: PrimOp
IndexByteArrayOp_Int32 :: PrimOp
IndexByteArrayOp_Int64 :: PrimOp
IndexByteArrayOp_Word8 :: PrimOp
IndexByteArrayOp_Word16 :: PrimOp
IndexByteArrayOp_Word32 :: PrimOp
IndexByteArrayOp_Word64 :: PrimOp
ReadByteArrayOp_Char :: PrimOp
ReadByteArrayOp_WideChar :: PrimOp
ReadByteArrayOp_Int :: PrimOp
ReadByteArrayOp_Word :: PrimOp
ReadByteArrayOp_Addr :: PrimOp
ReadByteArrayOp_Float :: PrimOp
ReadByteArrayOp_Double :: PrimOp
ReadByteArrayOp_StablePtr :: PrimOp
ReadByteArrayOp_Int8 :: PrimOp
ReadByteArrayOp_Int16 :: PrimOp
ReadByteArrayOp_Int32 :: PrimOp
ReadByteArrayOp_Int64 :: PrimOp
ReadByteArrayOp_Word8 :: PrimOp
ReadByteArrayOp_Word16 :: PrimOp
ReadByteArrayOp_Word32 :: PrimOp
ReadByteArrayOp_Word64 :: PrimOp
WriteByteArrayOp_Char :: PrimOp
WriteByteArrayOp_WideChar :: PrimOp
WriteByteArrayOp_Int :: PrimOp
WriteByteArrayOp_Word :: PrimOp
WriteByteArrayOp_Addr :: PrimOp
WriteByteArrayOp_Float :: PrimOp
WriteByteArrayOp_Double :: PrimOp
WriteByteArrayOp_StablePtr :: PrimOp
WriteByteArrayOp_Int8 :: PrimOp
WriteByteArrayOp_Int16 :: PrimOp
WriteByteArrayOp_Int32 :: PrimOp
WriteByteArrayOp_Int64 :: PrimOp
WriteByteArrayOp_Word8 :: PrimOp
WriteByteArrayOp_Word16 :: PrimOp
WriteByteArrayOp_Word32 :: PrimOp
WriteByteArrayOp_Word64 :: PrimOp
CopyByteArrayOp :: PrimOp
CopyMutableByteArrayOp :: PrimOp
CopyByteArrayToAddrOp :: PrimOp
CopyMutableByteArrayToAddrOp :: PrimOp
CopyAddrToByteArrayOp :: PrimOp
SetByteArrayOp :: PrimOp
AtomicReadByteArrayOp_Int :: PrimOp
AtomicWriteByteArrayOp_Int :: PrimOp
CasByteArrayOp_Int :: PrimOp
FetchAddByteArrayOp_Int :: PrimOp
FetchSubByteArrayOp_Int :: PrimOp
FetchAndByteArrayOp_Int :: PrimOp
FetchNandByteArrayOp_Int :: PrimOp
FetchOrByteArrayOp_Int :: PrimOp
FetchXorByteArrayOp_Int :: PrimOp
NewArrayArrayOp :: PrimOp
SameMutableArrayArrayOp :: PrimOp
UnsafeFreezeArrayArrayOp :: PrimOp
SizeofArrayArrayOp :: PrimOp
SizeofMutableArrayArrayOp :: PrimOp
IndexArrayArrayOp_ByteArray :: PrimOp
IndexArrayArrayOp_ArrayArray :: PrimOp
ReadArrayArrayOp_ByteArray :: PrimOp
ReadArrayArrayOp_MutableByteArray :: PrimOp
ReadArrayArrayOp_ArrayArray :: PrimOp
ReadArrayArrayOp_MutableArrayArray :: PrimOp
WriteArrayArrayOp_ByteArray :: PrimOp
WriteArrayArrayOp_MutableByteArray :: PrimOp
WriteArrayArrayOp_ArrayArray :: PrimOp
WriteArrayArrayOp_MutableArrayArray :: PrimOp
CopyArrayArrayOp :: PrimOp
CopyMutableArrayArrayOp :: PrimOp
AddrAddOp :: PrimOp
AddrSubOp :: PrimOp
AddrRemOp :: PrimOp
Addr2IntOp :: PrimOp
Int2AddrOp :: PrimOp
AddrGtOp :: PrimOp
AddrGeOp :: PrimOp
AddrEqOp :: PrimOp
AddrNeOp :: PrimOp
AddrLtOp :: PrimOp
AddrLeOp :: PrimOp
IndexOffAddrOp_Char :: PrimOp
IndexOffAddrOp_WideChar :: PrimOp
IndexOffAddrOp_Int :: PrimOp
IndexOffAddrOp_Word :: PrimOp
IndexOffAddrOp_Addr :: PrimOp
IndexOffAddrOp_Float :: PrimOp
IndexOffAddrOp_Double :: PrimOp
IndexOffAddrOp_StablePtr :: PrimOp
IndexOffAddrOp_Int8 :: PrimOp
IndexOffAddrOp_Int16 :: PrimOp
IndexOffAddrOp_Int32 :: PrimOp
IndexOffAddrOp_Int64 :: PrimOp
IndexOffAddrOp_Word8 :: PrimOp
IndexOffAddrOp_Word16 :: PrimOp
IndexOffAddrOp_Word32 :: PrimOp
IndexOffAddrOp_Word64 :: PrimOp
ReadOffAddrOp_Char :: PrimOp
ReadOffAddrOp_WideChar :: PrimOp
ReadOffAddrOp_Int :: PrimOp
ReadOffAddrOp_Word :: PrimOp
ReadOffAddrOp_Addr :: PrimOp
ReadOffAddrOp_Float :: PrimOp
ReadOffAddrOp_Double :: PrimOp
ReadOffAddrOp_StablePtr :: PrimOp
ReadOffAddrOp_Int8 :: PrimOp
ReadOffAddrOp_Int16 :: PrimOp
ReadOffAddrOp_Int32 :: PrimOp
ReadOffAddrOp_Int64 :: PrimOp
ReadOffAddrOp_Word8 :: PrimOp
ReadOffAddrOp_Word16 :: PrimOp
ReadOffAddrOp_Word32 :: PrimOp
ReadOffAddrOp_Word64 :: PrimOp
WriteOffAddrOp_Char :: PrimOp
WriteOffAddrOp_WideChar :: PrimOp
WriteOffAddrOp_Int :: PrimOp
WriteOffAddrOp_Word :: PrimOp
WriteOffAddrOp_Addr :: PrimOp
WriteOffAddrOp_Float :: PrimOp
WriteOffAddrOp_Double :: PrimOp
WriteOffAddrOp_StablePtr :: PrimOp
WriteOffAddrOp_Int8 :: PrimOp
WriteOffAddrOp_Int16 :: PrimOp
WriteOffAddrOp_Int32 :: PrimOp
WriteOffAddrOp_Int64 :: PrimOp
WriteOffAddrOp_Word8 :: PrimOp
WriteOffAddrOp_Word16 :: PrimOp
WriteOffAddrOp_Word32 :: PrimOp
WriteOffAddrOp_Word64 :: PrimOp
NewMutVarOp :: PrimOp
ReadMutVarOp :: PrimOp
WriteMutVarOp :: PrimOp
SameMutVarOp :: PrimOp
AtomicModifyMutVarOp :: PrimOp
CasMutVarOp :: PrimOp
CatchOp :: PrimOp
RaiseOp :: PrimOp
RaiseIOOp :: PrimOp
MaskAsyncExceptionsOp :: PrimOp
MaskUninterruptibleOp :: PrimOp
UnmaskAsyncExceptionsOp :: PrimOp
MaskStatus :: PrimOp
AtomicallyOp :: PrimOp
RetryOp :: PrimOp
CatchRetryOp :: PrimOp
CatchSTMOp :: PrimOp
Check :: PrimOp
NewTVarOp :: PrimOp
ReadTVarOp :: PrimOp
ReadTVarIOOp :: PrimOp
WriteTVarOp :: PrimOp
SameTVarOp :: PrimOp
NewMVarOp :: PrimOp
TakeMVarOp :: PrimOp
TryTakeMVarOp :: PrimOp
PutMVarOp :: PrimOp
TryPutMVarOp :: PrimOp
ReadMVarOp :: PrimOp
TryReadMVarOp :: PrimOp
SameMVarOp :: PrimOp
IsEmptyMVarOp :: PrimOp
DelayOp :: PrimOp
WaitReadOp :: PrimOp
WaitWriteOp :: PrimOp
ForkOp :: PrimOp
ForkOnOp :: PrimOp
KillThreadOp :: PrimOp
YieldOp :: PrimOp
MyThreadIdOp :: PrimOp
LabelThreadOp :: PrimOp
IsCurrentThreadBoundOp :: PrimOp
NoDuplicateOp :: PrimOp
ThreadStatusOp :: PrimOp
MkWeakOp :: PrimOp
MkWeakNoFinalizerOp :: PrimOp
AddCFinalizerToWeakOp :: PrimOp
DeRefWeakOp :: PrimOp
FinalizeWeakOp :: PrimOp
TouchOp :: PrimOp
MakeStablePtrOp :: PrimOp
DeRefStablePtrOp :: PrimOp
EqStablePtrOp :: PrimOp
MakeStableNameOp :: PrimOp
EqStableNameOp :: PrimOp
StableNameToIntOp :: PrimOp
CompactNewOp :: PrimOp
CompactResizeOp :: PrimOp
CompactContainsOp :: PrimOp
CompactContainsAnyOp :: PrimOp
CompactGetFirstBlockOp :: PrimOp
CompactGetNextBlockOp :: PrimOp
CompactAllocateBlockOp :: PrimOp
CompactFixupPointersOp :: PrimOp
CompactAdd :: PrimOp
CompactAddWithSharing :: PrimOp
CompactSize :: PrimOp
ReallyUnsafePtrEqualityOp :: PrimOp
ParOp :: PrimOp
SparkOp :: PrimOp
SeqOp :: PrimOp
GetSparkOp :: PrimOp
NumSparks :: PrimOp
DataToTagOp :: PrimOp
TagToEnumOp :: PrimOp
AddrToAnyOp :: PrimOp
AnyToAddrOp :: PrimOp
MkApUpd0_Op :: PrimOp
NewBCOOp :: PrimOp
UnpackClosureOp :: PrimOp
GetApStackValOp :: PrimOp
GetCCSOfOp :: PrimOp
GetCurrentCCSOp :: PrimOp
ClearCCSOp :: PrimOp
TraceEventOp :: PrimOp
TraceMarkerOp :: PrimOp
VecBroadcastOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecPackOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecUnpackOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecInsertOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecAddOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecSubOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecMulOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecDivOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecQuotOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecRemOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecNegOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecIndexByteArrayOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecReadByteArrayOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecWriteByteArrayOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecIndexOffAddrOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecReadOffAddrOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecWriteOffAddrOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecIndexScalarByteArrayOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecReadScalarByteArrayOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecWriteScalarByteArrayOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecIndexScalarOffAddrOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecReadScalarOffAddrOp :: PrimOpVecCat -> Length -> Width -> PrimOp
VecWriteScalarOffAddrOp :: PrimOpVecCat -> Length -> Width -> PrimOp
PrefetchByteArrayOp3 :: PrimOp
PrefetchMutableByteArrayOp3 :: PrimOp
PrefetchAddrOp3 :: PrimOp
PrefetchValueOp3 :: PrimOp
PrefetchByteArrayOp2 :: PrimOp
PrefetchMutableByteArrayOp2 :: PrimOp
PrefetchAddrOp2 :: PrimOp
PrefetchValueOp2 :: PrimOp
PrefetchByteArrayOp1 :: PrimOp
PrefetchMutableByteArrayOp1 :: PrimOp
PrefetchAddrOp1 :: PrimOp
PrefetchValueOp1 :: PrimOp
PrefetchByteArrayOp0 :: PrimOp
PrefetchMutableByteArrayOp0 :: PrimOp
PrefetchAddrOp0 :: PrimOp
PrefetchValueOp0 :: PrimOp
data PrimOpVecCat
IntVec :: PrimOpVecCat
WordVec :: PrimOpVecCat
FloatVec :: PrimOpVecCat
allThePrimOps :: [PrimOp]
primOpType :: PrimOp -> Type
primOpSig :: PrimOp -> ([TyVar], [Type], Type, Arity, StrictSig)
primOpTag :: PrimOp -> Int
maxPrimOpTag :: Int
primOpOcc :: PrimOp -> OccName
tagToEnumKey :: Unique
primOpOutOfLine :: PrimOp -> Bool
primOpCodeSize :: PrimOp -> Int
primOpOkForSpeculation :: PrimOp -> Bool
primOpOkForSideEffects :: PrimOp -> Bool
primOpIsCheap :: PrimOp -> Bool
primOpFixity :: PrimOp -> Maybe Fixity
getPrimOpResultInfo :: PrimOp -> PrimOpResultInfo
data PrimOpResultInfo
ReturnsPrim :: PrimRep -> PrimOpResultInfo
ReturnsAlg :: TyCon -> PrimOpResultInfo
data PrimCall
PrimCall :: CLabelString -> UnitId -> PrimCall
instance Outputable.Outputable PrimOp.PrimCall
instance GHC.Classes.Eq PrimOp.PrimOp
instance GHC.Classes.Ord PrimOp.PrimOp
instance Outputable.Outputable PrimOp.PrimOp
-- | The Name Cache
module NameCache
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache
extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
-- | Return a function to atomically update the name cache.
initNameCache :: UniqSupply -> [Name] -> NameCache
-- | The NameCache makes sure that there is just one Unique assigned for
-- each original name; i.e. (module-name, occ-name) pair and provides
-- something of a lookup mechanism for those names.
data NameCache
NameCache :: !UniqSupply -> !OrigNameCache -> NameCache
-- | Supply of uniques
[nsUniqs] :: NameCache -> !UniqSupply
-- | Ensures that one original name gets one unique
[nsNames] :: NameCache -> !OrigNameCache
-- | Per-module cache of original OccNames given Names
type OrigNameCache = ModuleEnv (OccEnv Name)
-- | This is where we define a mapping from Uniques to their associated
-- known-key Names for things associated with tuples and sums. We use
-- this mapping while deserializing known-key Names in interface file
-- symbol tables, which are encoded as their Unique. See Note [Symbol
-- table representation of names] for details.
module KnownUniques
-- | Get the Name associated with a known-key Unique.
knownUniqueName :: Unique -> Maybe Name
mkSumTyConUnique :: Arity -> Unique
mkSumDataConUnique :: ConTagZ -> Arity -> Unique
mkTupleTyConUnique :: Boxity -> Arity -> Unique
mkTupleDataConUnique :: Boxity -> Arity -> Unique
mkCTupleTyConUnique :: Arity -> Unique
mkCTupleDataConUnique :: Arity -> Unique
module InteractiveEvalTypes
data Resume
Resume :: String -> ForeignRef (ResumeContext [HValueRef]) -> ([TyThing], GlobalRdrEnv) -> [Id] -> ForeignHValue -> Maybe BreakInfo -> SrcSpan -> String -> RemotePtr CostCentreStack -> [History] -> Int -> Resume
[resumeStmt] :: Resume -> String
[resumeContext] :: Resume -> ForeignRef (ResumeContext [HValueRef])
[resumeBindings] :: Resume -> ([TyThing], GlobalRdrEnv)
[resumeFinalIds] :: Resume -> [Id]
[resumeApStack] :: Resume -> ForeignHValue
[resumeBreakInfo] :: Resume -> Maybe BreakInfo
[resumeSpan] :: Resume -> SrcSpan
[resumeDecl] :: Resume -> String
[resumeCCS] :: Resume -> RemotePtr CostCentreStack
[resumeHistory] :: Resume -> [History]
[resumeHistoryIx] :: Resume -> Int
data History
History :: ForeignHValue -> BreakInfo -> [String] -> History
[historyApStack] :: History -> ForeignHValue
[historyBreakInfo] :: History -> BreakInfo
[historyEnclosingDecls] :: History -> [String]
data ExecResult
ExecComplete :: Either SomeException [Name] -> Word64 -> ExecResult
[execResult] :: ExecResult -> Either SomeException [Name]
[execAllocation] :: ExecResult -> Word64
ExecBreak :: [Name] -> Maybe BreakInfo -> ExecResult
[breakNames] :: ExecResult -> [Name]
[breakInfo] :: ExecResult -> Maybe BreakInfo
data SingleStep
RunToCompletion :: SingleStep
SingleStep :: SingleStep
RunAndLogSteps :: SingleStep
isStep :: SingleStep -> Bool
data ExecOptions
ExecOptions :: SingleStep -> String -> Int -> (ForeignHValue -> EvalExpr ForeignHValue) -> ExecOptions
-- | stepping mode
[execSingleStep] :: ExecOptions -> SingleStep
-- | filename (for errors)
[execSourceFile] :: ExecOptions -> String
-- | line number (for errors)
[execLineNumber] :: ExecOptions -> Int
[execWrap] :: ExecOptions -> ForeignHValue -> EvalExpr ForeignHValue
data BreakInfo
BreakInfo :: Module -> Int -> BreakInfo
[breakInfo_module] :: BreakInfo -> Module
[breakInfo_number] :: BreakInfo -> Int
-- | Bytecode assembler types
module ByteCodeTypes
data CompiledByteCode
CompiledByteCode :: [UnlinkedBCO] -> ItblEnv -> [FFIInfo] -> [RemotePtr ()] -> Maybe ModBreaks -> CompiledByteCode
[bc_bcos] :: CompiledByteCode -> [UnlinkedBCO]
[bc_itbls] :: CompiledByteCode -> ItblEnv
[bc_ffis] :: CompiledByteCode -> [FFIInfo]
[bc_strs] :: CompiledByteCode -> [RemotePtr ()]
[bc_breaks] :: CompiledByteCode -> Maybe ModBreaks
seqCompiledByteCode :: CompiledByteCode -> ()
newtype FFIInfo
FFIInfo :: (RemotePtr C_ffi_cif) -> FFIInfo
data UnlinkedBCO
UnlinkedBCO :: !Name -> {-# UNPACK #-} !Int -> !(UArray Int Word16) -> !(UArray Int Word) -> !(SizedSeq BCONPtr) -> !(SizedSeq BCOPtr) -> UnlinkedBCO
[unlinkedBCOName] :: UnlinkedBCO -> !Name
[unlinkedBCOArity] :: UnlinkedBCO -> {-# UNPACK #-} !Int
[unlinkedBCOInstrs] :: UnlinkedBCO -> !(UArray Int Word16)
[unlinkedBCOBitmap] :: UnlinkedBCO -> !(UArray Int Word)
[unlinkedBCOLits] :: UnlinkedBCO -> !(SizedSeq BCONPtr)
[unlinkedBCOPtrs] :: UnlinkedBCO -> !(SizedSeq BCOPtr)
data BCOPtr
BCOPtrName :: !Name -> BCOPtr
BCOPtrPrimOp :: !PrimOp -> BCOPtr
BCOPtrBCO :: !UnlinkedBCO -> BCOPtr
BCOPtrBreakArray :: BCOPtr
data BCONPtr
BCONPtrWord :: {-# UNPACK #-} !Word -> BCONPtr
BCONPtrLbl :: !FastString -> BCONPtr
BCONPtrItbl :: !Name -> BCONPtr
BCONPtrStr :: !ByteString -> BCONPtr
type ItblEnv = NameEnv (Name, ItblPtr)
newtype ItblPtr
ItblPtr :: (RemotePtr StgInfoTable) -> ItblPtr
-- | Information about a breakpoint that we know at code-generation time
data CgBreakInfo
CgBreakInfo :: [(Id, Word16)] -> Type -> CgBreakInfo
[cgb_vars] :: CgBreakInfo -> [(Id, Word16)]
[cgb_resty] :: CgBreakInfo -> Type
-- | All the information about the breakpoints for a module
data ModBreaks
ModBreaks :: ForeignRef BreakArray -> !(Array BreakIndex SrcSpan) -> !(Array BreakIndex [OccName]) -> !(Array BreakIndex [String]) -> !(Array BreakIndex (RemotePtr CostCentre)) -> IntMap CgBreakInfo -> ModBreaks
-- | The array of flags, one per breakpoint, indicating which breakpoints
-- are enabled.
[modBreaks_flags] :: ModBreaks -> ForeignRef BreakArray
-- | An array giving the source span of each breakpoint.
[modBreaks_locs] :: ModBreaks -> !(Array BreakIndex SrcSpan)
-- | An array giving the names of the free variables at each breakpoint.
[modBreaks_vars] :: ModBreaks -> !(Array BreakIndex [OccName])
-- | An array giving the names of the declarations enclosing each
-- breakpoint.
[modBreaks_decls] :: ModBreaks -> !(Array BreakIndex [String])
-- | Array pointing to cost centre for each breakpoint
[modBreaks_ccs] :: ModBreaks -> !(Array BreakIndex (RemotePtr CostCentre))
-- | info about each breakpoint from the bytecode generator
[modBreaks_breakInfo] :: ModBreaks -> IntMap CgBreakInfo
-- | Breakpoint index
type BreakIndex = Int
-- | Construct an empty ModBreaks
emptyModBreaks :: ModBreaks
-- | C CostCentre type
data CCostCentre
instance Control.DeepSeq.NFData ByteCodeTypes.ItblPtr
instance GHC.Show.Show ByteCodeTypes.ItblPtr
instance Control.DeepSeq.NFData ByteCodeTypes.FFIInfo
instance GHC.Show.Show ByteCodeTypes.FFIInfo
instance Outputable.Outputable ByteCodeTypes.CompiledByteCode
instance Outputable.Outputable ByteCodeTypes.CgBreakInfo
instance Control.DeepSeq.NFData ByteCodeTypes.UnlinkedBCO
instance Control.DeepSeq.NFData ByteCodeTypes.BCOPtr
instance Outputable.Outputable ByteCodeTypes.UnlinkedBCO
instance Control.DeepSeq.NFData ByteCodeTypes.BCONPtr
-- | Various utilities for forcing Core structures
--
-- It can often be useful to force various parts of the AST. This module
-- provides a number of seq-like functions to accomplish this.
module CoreSeq
seqExpr :: CoreExpr -> ()
seqExprs :: [CoreExpr] -> ()
seqUnfolding :: Unfolding -> ()
seqRules :: [CoreRule] -> ()
-- | Evaluate all the fields of the IdInfo that are generally
-- demanded by the compiler
megaSeqIdInfo :: IdInfo -> ()
seqRuleInfo :: RuleInfo -> ()
seqBinds :: [Bind CoreBndr] -> ()
-- | Functions to computing the statistics reflective of the "size" of a
-- Core expression
module CoreStats
coreBindsSize :: [CoreBind] -> Int
-- | A measure of the size of the expressions, strictly greater than 0 It
-- also forces the expression pretty drastically as a side effect Counts
-- *leaves*, not internal nodes. Types and coercions are not counted.
exprSize :: CoreExpr -> Int
data CoreStats
CS :: Int -> Int -> Int -> Int -> Int -> CoreStats
[cs_tm] :: CoreStats -> Int
[cs_ty] :: CoreStats -> Int
[cs_co] :: CoreStats -> Int
[cs_vb] :: CoreStats -> Int
[cs_jb] :: CoreStats -> Int
coreBindsStats :: [CoreBind] -> CoreStats
exprStats :: CoreExpr -> CoreStats
instance Outputable.Outputable CoreStats.CoreStats
module PprCore
pprCoreExpr :: OutputableBndr b => Expr b -> SDoc
pprParendExpr :: OutputableBndr b => Expr b -> SDoc
pprCoreBinding :: OutputableBndr b => Bind b -> SDoc
pprCoreBindings :: OutputableBndr b => [Bind b] -> SDoc
pprCoreAlt :: OutputableBndr a => (AltCon, [a], Expr a) -> SDoc
pprCoreBindingWithSize :: CoreBind -> SDoc
pprCoreBindingsWithSize :: [CoreBind] -> SDoc
pprRules :: [CoreRule] -> SDoc
pprOptCo :: Coercion -> SDoc
instance Outputable.OutputableBndr b => Outputable.Outputable (CoreSyn.Bind b)
instance Outputable.OutputableBndr b => Outputable.Outputable (CoreSyn.Expr b)
instance Outputable.OutputableBndr Var.Var
instance Outputable.Outputable b => Outputable.OutputableBndr (CoreSyn.TaggedBndr b)
instance Outputable.Outputable CoreSyn.UnfoldingGuidance
instance Outputable.Outputable CoreSyn.UnfoldingSource
instance Outputable.Outputable CoreSyn.Unfolding
instance Outputable.Outputable CoreSyn.CoreRule
instance Outputable.Outputable id => Outputable.Outputable (CoreSyn.Tickish id)
instance Outputable.Outputable CoreSyn.CoreVect
module StgSyn
data GenStgArg occ
StgVarArg :: occ -> GenStgArg occ
StgLitArg :: Literal -> GenStgArg occ
-- | A top-level binding.
data GenStgTopBinding bndr occ
StgTopLifted :: (GenStgBinding bndr occ) -> GenStgTopBinding bndr occ
StgTopStringLit :: bndr -> ByteString -> GenStgTopBinding bndr occ
data GenStgBinding bndr occ
StgNonRec :: bndr -> (GenStgRhs bndr occ) -> GenStgBinding bndr occ
StgRec :: [(bndr, GenStgRhs bndr occ)] -> GenStgBinding bndr occ
data GenStgExpr bndr occ
StgApp :: occ -> [GenStgArg occ] -> GenStgExpr bndr occ
StgLit :: Literal -> GenStgExpr bndr occ
StgConApp :: DataCon -> [GenStgArg occ] -> [Type] -> GenStgExpr bndr occ
StgOpApp :: StgOp -> [GenStgArg occ] -> Type -> GenStgExpr bndr occ
StgLam :: [bndr] -> StgExpr -> GenStgExpr bndr occ
StgCase :: (GenStgExpr bndr occ) -> bndr -> AltType -> [GenStgAlt bndr occ] -> GenStgExpr bndr occ
StgLet :: (GenStgBinding bndr occ) -> (GenStgExpr bndr occ) -> GenStgExpr bndr occ
StgLetNoEscape :: (GenStgBinding bndr occ) -> (GenStgExpr bndr occ) -> GenStgExpr bndr occ
StgTick :: (Tickish bndr) -> (GenStgExpr bndr occ) -> GenStgExpr bndr occ
data GenStgRhs bndr occ
StgRhsClosure :: CostCentreStack -> StgBinderInfo -> [occ] -> !UpdateFlag -> [bndr] -> (GenStgExpr bndr occ) -> GenStgRhs bndr occ
StgRhsCon :: CostCentreStack -> DataCon -> [GenStgArg occ] -> GenStgRhs bndr occ
type GenStgAlt bndr occ = (AltCon, [bndr], GenStgExpr bndr occ)
data AltType
PolyAlt :: AltType
MultiValAlt :: Int -> AltType
AlgAlt :: TyCon -> AltType
PrimAlt :: PrimRep -> AltType
data UpdateFlag
ReEntrant :: UpdateFlag
Updatable :: UpdateFlag
SingleEntry :: UpdateFlag
isUpdatable :: UpdateFlag -> Bool
data StgBinderInfo
noBinderInfo :: StgBinderInfo
stgSatOcc :: StgBinderInfo
stgUnsatOcc :: StgBinderInfo
satCallsOnly :: StgBinderInfo -> Bool
combineStgBinderInfo :: StgBinderInfo -> StgBinderInfo -> StgBinderInfo
type StgArg = GenStgArg Id
type StgTopBinding = GenStgTopBinding Id Id
type StgBinding = GenStgBinding Id Id
type StgExpr = GenStgExpr Id Id
type StgRhs = GenStgRhs Id Id
type StgAlt = GenStgAlt Id Id
type InStgArg = StgArg
type InStgTopBinding = StgTopBinding
type InStgBinding = StgBinding
type InStgExpr = StgExpr
type InStgRhs = StgRhs
type InStgAlt = StgAlt
type OutStgArg = StgArg
type OutStgTopBinding = StgTopBinding
type OutStgBinding = StgBinding
type OutStgExpr = StgExpr
type OutStgRhs = StgRhs
type OutStgAlt = StgAlt
data StgOp
StgPrimOp :: PrimOp -> StgOp
StgPrimCallOp :: PrimCall -> StgOp
StgFCallOp :: ForeignCall -> Unique -> StgOp
topStgBindHasCafRefs :: GenStgTopBinding bndr Id -> Bool
stgArgHasCafRefs :: GenStgArg Id -> Bool
stgRhsArity :: StgRhs -> Int
-- | Does this constructor application refer to anything in a different
-- *Windows* DLL? If so, we can't allocate it statically
isDllConApp :: DynFlags -> Module -> DataCon -> [StgArg] -> Bool
-- | Type of an StgArg
--
-- Very half baked because we have lost the type arguments.
stgArgType :: StgArg -> Type
-- | Strip ticks of a given type from an STG expression
stripStgTicksTop :: (Tickish Id -> Bool) -> StgExpr -> ([Tickish Id], StgExpr)
pprStgBinding :: StgBinding -> SDoc
pprStgTopBindings :: [StgTopBinding] -> SDoc
instance (Outputable.OutputableBndr bndr, Outputable.Outputable bdee, GHC.Classes.Ord bdee) => Outputable.Outputable (StgSyn.GenStgTopBinding bndr bdee)
instance (Outputable.OutputableBndr bndr, Outputable.Outputable bdee, GHC.Classes.Ord bdee) => Outputable.Outputable (StgSyn.GenStgBinding bndr bdee)
instance (Outputable.OutputableBndr bndr, Outputable.Outputable bdee, GHC.Classes.Ord bdee) => Outputable.Outputable (StgSyn.GenStgExpr bndr bdee)
instance (Outputable.OutputableBndr bndr, Outputable.Outputable bdee, GHC.Classes.Ord bdee) => Outputable.Outputable (StgSyn.GenStgRhs bndr bdee)
instance Outputable.Outputable StgSyn.UpdateFlag
instance Outputable.Outputable StgSyn.AltType
instance Outputable.Outputable bdee => Outputable.Outputable (StgSyn.GenStgArg bdee)
module StgStats
showStgStats :: [StgTopBinding] -> String
instance GHC.Classes.Ord StgStats.CounterType
instance GHC.Classes.Eq StgStats.CounterType
module StgLint
lintStgTopBindings :: String -> [StgTopBinding] -> [StgTopBinding]
instance GHC.Base.Functor StgLint.LintM
instance GHC.Base.Applicative StgLint.LintM
instance GHC.Base.Monad StgLint.LintM
-- | Note [CSE for Stg] ~~~~~~~~~~~~~~~~~~ This module implements a simple
-- common subexpression elimination pass for STG. This is useful because
-- there are expressions that we want to common up (because they are
-- operational equivalent), but that we cannot common up in Core, because
-- their types differ. This was original reported as #9291.
--
-- There are two types of common code occurrences that we aim for, see
-- note [Case 1: CSEing allocated closures] and note [Case 2: CSEing case
-- binders] below.
--
-- Note [Case 1: CSEing allocated closures]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The fist kind of CSE
-- opportunity we aim for is generated by this Haskell code:
--
-- bar :: a -> (Either Int a, Either Bool a) bar x = (Right x, Right
-- x)
--
-- which produces this Core:
--
-- bar :: forall a. a -> (Either Int a, Either Bool a) bar a x =
-- (Right Int a x, Right Bool @a x)
--
-- where the two components of the tuple are differnt terms, and cannot
-- be commoned up (easily). On the STG level we have
--
-- bar [x] = let c1 = Right [x] c2 = Right [x] in (c1,c2)
--
-- and now it is obvious that we can write
--
-- bar [x] = let c1 = Right [x] in (c1,c1)
--
-- instead.
--
-- Note [Case 2: CSEing case binders] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- The second kind of CSE opportunity we aim for is more interesting, and
-- came up in 5344: The Haskell code
--
-- foo :: Either Int a -> Either Bool a foo (Right x) = Right x foo _
-- = Left False
--
-- produces this Core
--
-- foo :: forall a. Either Int a -> Either Bool a foo a e = case e
-- of b { Left n -> … , Right x -> Right Bool @a x }
--
-- where we cannot CSE `Right Bool a x` with the case binder
-- b as they have different types. But in STG we have
--
-- foo [e] = case e of b { Left [n] -> … , Right [x] -> Right [x] }
--
-- and nothing stops us from transforming that to
--
-- foo [e] = case e of b { Left [n] -> … , Right [x] -> b}
module StgCse
stgCse :: [InStgTopBinding] -> [OutStgTopBinding]
instance TrieMap.TrieMap StgCse.ConAppMap
instance TrieMap.TrieMap StgCse.StgArgMap
module SCCfinal
stgMassageForProfiling :: DynFlags -> Module -> UniqSupply -> [StgTopBinding] -> (CollectedCCs, [StgTopBinding])
instance GHC.Base.Functor SCCfinal.MassageM
instance GHC.Base.Applicative SCCfinal.MassageM
instance GHC.Base.Monad SCCfinal.MassageM
module IfaceSyn
data IfaceDecl
IfaceId :: IfaceTopBndr -> IfaceType -> IfaceIdDetails -> IfaceIdInfo -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifType] :: IfaceDecl -> IfaceType
[ifIdDetails] :: IfaceDecl -> IfaceIdDetails
[ifIdInfo] :: IfaceDecl -> IfaceIdInfo
IfaceData :: IfaceTopBndr -> [IfaceTyConBinder] -> IfaceType -> Maybe CType -> [Role] -> IfaceContext -> IfaceConDecls -> Bool -> IfaceTyConParent -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifBinders] :: IfaceDecl -> [IfaceTyConBinder]
[ifResKind] :: IfaceDecl -> IfaceType
[ifCType] :: IfaceDecl -> Maybe CType
[ifRoles] :: IfaceDecl -> [Role]
[ifCtxt] :: IfaceDecl -> IfaceContext
[ifCons] :: IfaceDecl -> IfaceConDecls
[ifGadtSyntax] :: IfaceDecl -> Bool
[ifParent] :: IfaceDecl -> IfaceTyConParent
IfaceSynonym :: IfaceTopBndr -> [Role] -> [IfaceTyConBinder] -> IfaceKind -> IfaceType -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifRoles] :: IfaceDecl -> [Role]
[ifBinders] :: IfaceDecl -> [IfaceTyConBinder]
[ifResKind] :: IfaceDecl -> IfaceKind
[ifSynRhs] :: IfaceDecl -> IfaceType
IfaceFamily :: IfaceTopBndr -> Maybe IfLclName -> [IfaceTyConBinder] -> IfaceKind -> IfaceFamTyConFlav -> Injectivity -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifResVar] :: IfaceDecl -> Maybe IfLclName
[ifBinders] :: IfaceDecl -> [IfaceTyConBinder]
[ifResKind] :: IfaceDecl -> IfaceKind
[ifFamFlav] :: IfaceDecl -> IfaceFamTyConFlav
[ifFamInj] :: IfaceDecl -> Injectivity
IfaceClass :: IfaceTopBndr -> [Role] -> [IfaceTyConBinder] -> [FunDep IfLclName] -> IfaceClassBody -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifRoles] :: IfaceDecl -> [Role]
[ifBinders] :: IfaceDecl -> [IfaceTyConBinder]
[ifFDs] :: IfaceDecl -> [FunDep IfLclName]
[ifBody] :: IfaceDecl -> IfaceClassBody
IfaceAxiom :: IfaceTopBndr -> IfaceTyCon -> Role -> [IfaceAxBranch] -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifTyCon] :: IfaceDecl -> IfaceTyCon
[ifRole] :: IfaceDecl -> Role
[ifAxBranches] :: IfaceDecl -> [IfaceAxBranch]
IfacePatSyn :: IfaceTopBndr -> Bool -> (IfExtName, Bool) -> Maybe (IfExtName, Bool) -> [IfaceForAllBndr] -> [IfaceForAllBndr] -> IfaceContext -> IfaceContext -> [IfaceType] -> IfaceType -> [FieldLabel] -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifPatIsInfix] :: IfaceDecl -> Bool
[ifPatMatcher] :: IfaceDecl -> (IfExtName, Bool)
[ifPatBuilder] :: IfaceDecl -> Maybe (IfExtName, Bool)
[ifPatUnivBndrs] :: IfaceDecl -> [IfaceForAllBndr]
[ifPatExBndrs] :: IfaceDecl -> [IfaceForAllBndr]
[ifPatProvCtxt] :: IfaceDecl -> IfaceContext
[ifPatReqCtxt] :: IfaceDecl -> IfaceContext
[ifPatArgs] :: IfaceDecl -> [IfaceType]
[ifPatTy] :: IfaceDecl -> IfaceType
[ifFieldLabels] :: IfaceDecl -> [FieldLabel]
data IfaceFamTyConFlav
IfaceDataFamilyTyCon :: IfaceFamTyConFlav
IfaceOpenSynFamilyTyCon :: IfaceFamTyConFlav
-- | Name of associated axiom and branches for pretty printing purposes, or
-- Nothing for an empty closed family without an axiom
IfaceClosedSynFamilyTyCon :: (Maybe (IfExtName, [IfaceAxBranch])) -> IfaceFamTyConFlav
IfaceAbstractClosedSynFamilyTyCon :: IfaceFamTyConFlav
IfaceBuiltInSynFamTyCon :: IfaceFamTyConFlav
data IfaceClassOp
IfaceClassOp :: IfaceTopBndr -> IfaceType -> (Maybe (DefMethSpec IfaceType)) -> IfaceClassOp
data IfaceAT
IfaceAT :: IfaceDecl -> (Maybe IfaceType) -> IfaceAT
data IfaceConDecl
IfCon :: IfaceTopBndr -> Bool -> Bool -> [IfaceForAllBndr] -> IfaceEqSpec -> IfaceContext -> [IfaceType] -> [FieldLabel] -> [IfaceBang] -> [IfaceSrcBang] -> IfaceConDecl
[ifConName] :: IfaceConDecl -> IfaceTopBndr
[ifConWrapper] :: IfaceConDecl -> Bool
[ifConInfix] :: IfaceConDecl -> Bool
[ifConExTvs] :: IfaceConDecl -> [IfaceForAllBndr]
[ifConEqSpec] :: IfaceConDecl -> IfaceEqSpec
[ifConCtxt] :: IfaceConDecl -> IfaceContext
[ifConArgTys] :: IfaceConDecl -> [IfaceType]
[ifConFields] :: IfaceConDecl -> [FieldLabel]
[ifConStricts] :: IfaceConDecl -> [IfaceBang]
[ifConSrcStricts] :: IfaceConDecl -> [IfaceSrcBang]
data IfaceConDecls
IfAbstractTyCon :: IfaceConDecls
IfDataTyCon :: [IfaceConDecl] -> IfaceConDecls
IfNewTyCon :: IfaceConDecl -> IfaceConDecls
type IfaceEqSpec = [(IfLclName, IfaceType)]
data IfaceExpr
IfaceLcl :: IfLclName -> IfaceExpr
IfaceExt :: IfExtName -> IfaceExpr
IfaceType :: IfaceType -> IfaceExpr
IfaceCo :: IfaceCoercion -> IfaceExpr
IfaceTuple :: TupleSort -> [IfaceExpr] -> IfaceExpr
IfaceLam :: IfaceLamBndr -> IfaceExpr -> IfaceExpr
IfaceApp :: IfaceExpr -> IfaceExpr -> IfaceExpr
IfaceCase :: IfaceExpr -> IfLclName -> [IfaceAlt] -> IfaceExpr
IfaceECase :: IfaceExpr -> IfaceType -> IfaceExpr
IfaceLet :: IfaceBinding -> IfaceExpr -> IfaceExpr
IfaceCast :: IfaceExpr -> IfaceCoercion -> IfaceExpr
IfaceLit :: Literal -> IfaceExpr
IfaceFCall :: ForeignCall -> IfaceType -> IfaceExpr
IfaceTick :: IfaceTickish -> IfaceExpr -> IfaceExpr
type IfaceAlt = (IfaceConAlt, [IfLclName], IfaceExpr)
data IfaceLetBndr
IfLetBndr :: IfLclName -> IfaceType -> IfaceIdInfo -> IfaceJoinInfo -> IfaceLetBndr
data IfaceJoinInfo
IfaceNotJoinPoint :: IfaceJoinInfo
IfaceJoinPoint :: JoinArity -> IfaceJoinInfo
data IfaceBinding
IfaceNonRec :: IfaceLetBndr -> IfaceExpr -> IfaceBinding
IfaceRec :: [(IfaceLetBndr, IfaceExpr)] -> IfaceBinding
data IfaceConAlt
IfaceDefault :: IfaceConAlt
IfaceDataAlt :: IfExtName -> IfaceConAlt
IfaceLitAlt :: Literal -> IfaceConAlt
data IfaceIdInfo
NoInfo :: IfaceIdInfo
HasInfo :: [IfaceInfoItem] -> IfaceIdInfo
data IfaceIdDetails
IfVanillaId :: IfaceIdDetails
IfRecSelId :: (Either IfaceTyCon IfaceDecl) -> Bool -> IfaceIdDetails
IfDFunId :: IfaceIdDetails
data IfaceUnfolding
IfCoreUnfold :: Bool -> IfaceExpr -> IfaceUnfolding
IfCompulsory :: IfaceExpr -> IfaceUnfolding
IfInlineRule :: Arity -> Bool -> Bool -> IfaceExpr -> IfaceUnfolding
IfDFunUnfold :: [IfaceBndr] -> [IfaceExpr] -> IfaceUnfolding
data IfaceInfoItem
HsArity :: Arity -> IfaceInfoItem
HsStrictness :: StrictSig -> IfaceInfoItem
HsInline :: InlinePragma -> IfaceInfoItem
HsUnfold :: Bool -> IfaceUnfolding -> IfaceInfoItem
HsNoCafRefs :: IfaceInfoItem
HsLevity :: IfaceInfoItem
data IfaceRule
IfaceRule :: RuleName -> Activation -> [IfaceBndr] -> IfExtName -> [IfaceExpr] -> IfaceExpr -> Bool -> IsOrphan -> IfaceRule
[ifRuleName] :: IfaceRule -> RuleName
[ifActivation] :: IfaceRule -> Activation
[ifRuleBndrs] :: IfaceRule -> [IfaceBndr]
[ifRuleHead] :: IfaceRule -> IfExtName
[ifRuleArgs] :: IfaceRule -> [IfaceExpr]
[ifRuleRhs] :: IfaceRule -> IfaceExpr
[ifRuleAuto] :: IfaceRule -> Bool
[ifRuleOrph] :: IfaceRule -> IsOrphan
data IfaceAnnotation
IfaceAnnotation :: IfaceAnnTarget -> AnnPayload -> IfaceAnnotation
[ifAnnotatedTarget] :: IfaceAnnotation -> IfaceAnnTarget
[ifAnnotatedValue] :: IfaceAnnotation -> AnnPayload
type IfaceAnnTarget = AnnTarget OccName
data IfaceClsInst
IfaceClsInst :: IfExtName -> [Maybe IfaceTyCon] -> IfExtName -> OverlapFlag -> IsOrphan -> IfaceClsInst
[ifInstCls] :: IfaceClsInst -> IfExtName
[ifInstTys] :: IfaceClsInst -> [Maybe IfaceTyCon]
[ifDFun] :: IfaceClsInst -> IfExtName
[ifOFlag] :: IfaceClsInst -> OverlapFlag
[ifInstOrph] :: IfaceClsInst -> IsOrphan
data IfaceFamInst
IfaceFamInst :: IfExtName -> [Maybe IfaceTyCon] -> IfExtName -> IsOrphan -> IfaceFamInst
[ifFamInstFam] :: IfaceFamInst -> IfExtName
[ifFamInstTys] :: IfaceFamInst -> [Maybe IfaceTyCon]
[ifFamInstAxiom] :: IfaceFamInst -> IfExtName
[ifFamInstOrph] :: IfaceFamInst -> IsOrphan
data IfaceTickish
IfaceHpcTick :: Module -> Int -> IfaceTickish
IfaceSCC :: CostCentre -> Bool -> Bool -> IfaceTickish
IfaceSource :: RealSrcSpan -> String -> IfaceTickish
data IfaceClassBody
IfAbstractClass :: IfaceClassBody
IfConcreteClass :: IfaceContext -> [IfaceAT] -> [IfaceClassOp] -> BooleanFormula IfLclName -> IfaceClassBody
[ifClassCtxt] :: IfaceClassBody -> IfaceContext
[ifATs] :: IfaceClassBody -> [IfaceAT]
[ifSigs] :: IfaceClassBody -> [IfaceClassOp]
[ifMinDef] :: IfaceClassBody -> BooleanFormula IfLclName
-- | This corresponds to an HsImplBang; that is, the final implementation
-- decision about the data constructor arg
data IfaceBang
IfNoBang :: IfaceBang
IfStrict :: IfaceBang
IfUnpack :: IfaceBang
IfUnpackCo :: IfaceCoercion -> IfaceBang
-- | This corresponds to HsSrcBang
data IfaceSrcBang
IfSrcBang :: SrcUnpackedness -> SrcStrictness -> IfaceSrcBang
-- | Source Unpackedness
--
-- What unpackedness the user requested
data SrcUnpackedness
-- | {--} specified
SrcUnpack :: SrcUnpackedness
-- | {--} specified
SrcNoUnpack :: SrcUnpackedness
-- | no unpack pragma
NoSrcUnpack :: SrcUnpackedness
-- | Source Strictness
--
-- What strictness annotation the user wrote
data SrcStrictness
-- | Lazy, ie '~'
SrcLazy :: SrcStrictness
-- | Strict, ie !
SrcStrict :: SrcStrictness
-- | no strictness annotation
NoSrcStrict :: SrcStrictness
data IfaceAxBranch
IfaceAxBranch :: [IfaceTvBndr] -> [IfaceIdBndr] -> IfaceTcArgs -> [Role] -> IfaceType -> [BranchIndex] -> IfaceAxBranch
[ifaxbTyVars] :: IfaceAxBranch -> [IfaceTvBndr]
[ifaxbCoVars] :: IfaceAxBranch -> [IfaceIdBndr]
[ifaxbLHS] :: IfaceAxBranch -> IfaceTcArgs
[ifaxbRoles] :: IfaceAxBranch -> [Role]
[ifaxbRHS] :: IfaceAxBranch -> IfaceType
[ifaxbIncomps] :: IfaceAxBranch -> [BranchIndex]
data IfaceTyConParent
IfNoParent :: IfaceTyConParent
IfDataInstance :: IfExtName -> IfaceTyCon -> IfaceTcArgs -> IfaceTyConParent
data IfaceCompleteMatch
IfaceCompleteMatch :: [IfExtName] -> IfExtName -> IfaceCompleteMatch
-- | A binding top-level Name in an interface file (e.g. the name of
-- an IfaceDecl).
type IfaceTopBndr = Name
putIfaceTopBndr :: BinHandle -> IfaceTopBndr -> IO ()
getIfaceTopBndr :: BinHandle -> IO IfaceTopBndr
ifaceDeclImplicitBndrs :: IfaceDecl -> [OccName]
visibleIfConDecls :: IfaceConDecls -> [IfaceConDecl]
ifaceDeclFingerprints :: Fingerprint -> IfaceDecl -> [(OccName, Fingerprint)]
freeNamesIfDecl :: IfaceDecl -> NameSet
freeNamesIfRule :: IfaceRule -> NameSet
freeNamesIfFamInst :: IfaceFamInst -> NameSet
-- | Pretty Print an IfaceExpre
--
-- The first argument should be a function that adds parens in context
-- that need an atomic value (e.g. function args)
pprIfaceExpr :: (SDoc -> SDoc) -> IfaceExpr -> SDoc
pprIfaceDecl :: ShowSub -> IfaceDecl -> SDoc
newtype AltPpr
AltPpr :: (Maybe (OccName -> SDoc)) -> AltPpr
data ShowSub
ShowSub :: ShowHowMuch -> ShowForAllFlag -> ShowSub
[ss_how_much] :: ShowSub -> ShowHowMuch
[ss_forall] :: ShowSub -> ShowForAllFlag
data ShowHowMuch
-- | Header information only, not rhs
ShowHeader :: AltPpr -> ShowHowMuch
-- | Show only some sub-components. Specifically,
--
--
-- - @[ @] Print all sub-components.
-- - (n:ns) Print sub-component n with
-- ShowSub = ns; elide other sub-components to ... May
-- 14: the list is max 1 element long at the moment
--
ShowSome :: [OccName] -> AltPpr -> ShowHowMuch
-- | Everything including GHC-internal information (used in --show-iface)
ShowIface :: ShowHowMuch
showToIface :: ShowSub
showToHeader :: ShowSub
instance Outputable.Outputable IfaceSyn.ShowHowMuch
instance Outputable.Outputable IfaceSyn.IfaceRule
instance Binary.Binary IfaceSyn.IfaceRule
instance Name.NamedThing IfaceSyn.IfaceDecl
instance OccName.HasOccName IfaceSyn.IfaceDecl
instance Outputable.Outputable IfaceSyn.IfaceDecl
instance Outputable.Outputable IfaceSyn.IfaceAT
instance Outputable.Outputable IfaceSyn.IfaceIdDetails
instance Binary.Binary IfaceSyn.IfaceDecl
instance Binary.Binary IfaceSyn.IfaceAT
instance Binary.Binary IfaceSyn.IfaceIdDetails
instance Outputable.Outputable IfaceSyn.IfaceExpr
instance Outputable.Outputable IfaceSyn.IfaceIdInfo
instance Outputable.Outputable IfaceSyn.IfaceInfoItem
instance Outputable.Outputable IfaceSyn.IfaceUnfolding
instance Binary.Binary IfaceSyn.IfaceIdInfo
instance Binary.Binary IfaceSyn.IfaceInfoItem
instance Binary.Binary IfaceSyn.IfaceUnfolding
instance Binary.Binary IfaceSyn.IfaceExpr
instance Binary.Binary IfaceSyn.IfaceBinding
instance Binary.Binary IfaceSyn.IfaceLetBndr
instance Outputable.Outputable IfaceSyn.IfaceJoinInfo
instance Binary.Binary IfaceSyn.IfaceJoinInfo
instance Outputable.Outputable IfaceSyn.IfaceConAlt
instance Binary.Binary IfaceSyn.IfaceConAlt
instance Binary.Binary IfaceSyn.IfaceTickish
instance Outputable.Outputable IfaceSyn.IfaceCompleteMatch
instance Binary.Binary IfaceSyn.IfaceCompleteMatch
instance Outputable.Outputable IfaceSyn.IfaceAnnotation
instance Binary.Binary IfaceSyn.IfaceAnnotation
instance Outputable.Outputable IfaceSyn.IfaceFamInst
instance Binary.Binary IfaceSyn.IfaceFamInst
instance Outputable.Outputable IfaceSyn.IfaceClsInst
instance Binary.Binary IfaceSyn.IfaceClsInst
instance Binary.Binary IfaceSyn.IfaceConDecls
instance Name.NamedThing IfaceSyn.IfaceConDecl
instance OccName.HasOccName IfaceSyn.IfaceConDecl
instance Binary.Binary IfaceSyn.IfaceConDecl
instance Binary.Binary IfaceSyn.IfaceSrcBang
instance Binary.Binary IfaceSyn.IfaceBang
instance Binary.Binary IfaceSyn.IfaceFamTyConFlav
instance Binary.Binary IfaceSyn.IfaceAxBranch
instance Name.NamedThing IfaceSyn.IfaceClassOp
instance OccName.HasOccName IfaceSyn.IfaceClassOp
instance Outputable.Outputable IfaceSyn.IfaceClassOp
instance Binary.Binary IfaceSyn.IfaceClassOp
instance Outputable.Outputable IfaceSyn.IfaceTyConParent
instance Binary.Binary IfaceSyn.IfaceTyConParent
module CLabel
data CLabel
-- | Record where a foreign label is stored.
data ForeignLabelSource
-- | Label is in a named package
ForeignLabelInPackage :: UnitId -> ForeignLabelSource
-- | Label is in some external, system package that doesn't also contain
-- compiled Haskell code, and is not associated with any .hi files. We
-- don't have to worry about Haskell code being inlined from external
-- packages. It is safe to treat the RTS package as "external".
ForeignLabelInExternalPackage :: ForeignLabelSource
-- | Label is in the package currenly being compiled. This is only used for
-- creating hacky tmp labels during code generation. Don't use it in any
-- code that might be inlined across a package boundary (ie, core code)
-- else the information will be wrong relative to the destination module.
ForeignLabelInThisPackage :: ForeignLabelSource
-- | For debugging problems with the CLabel representation. We can't make a
-- Show instance for CLabel because lots of its components don't have
-- instances. The regular Outputable instance only shows the label name,
-- and not its other info.
pprDebugCLabel :: CLabel -> SDoc
mkClosureLabel :: Name -> CafInfo -> CLabel
mkSRTLabel :: Name -> CafInfo -> CLabel
mkTopSRTLabel :: Unique -> CLabel
mkInfoTableLabel :: Name -> CafInfo -> CLabel
mkEntryLabel :: Name -> CafInfo -> CLabel
mkSlowEntryLabel :: Name -> CafInfo -> CLabel
mkConEntryLabel :: Name -> CafInfo -> CLabel
mkRednCountsLabel :: Name -> CLabel
mkConInfoTableLabel :: Name -> CafInfo -> CLabel
mkLargeSRTLabel :: Unique -> CLabel
mkApEntryLabel :: Bool -> Int -> CLabel
mkApInfoTableLabel :: Bool -> Int -> CLabel
mkClosureTableLabel :: Name -> CafInfo -> CLabel
mkBytesLabel :: Name -> CLabel
mkLocalClosureLabel :: Name -> CafInfo -> CLabel
mkLocalInfoTableLabel :: Name -> CafInfo -> CLabel
mkLocalEntryLabel :: Name -> CafInfo -> CLabel
mkLocalConEntryLabel :: CafInfo -> Name -> CLabel
mkLocalConInfoTableLabel :: CafInfo -> Name -> CLabel
mkLocalClosureTableLabel :: Name -> CafInfo -> CLabel
mkReturnPtLabel :: Unique -> CLabel
mkReturnInfoLabel :: Unique -> CLabel
mkAltLabel :: Unique -> ConTag -> CLabel
mkDefaultLabel :: Unique -> CLabel
mkBitmapLabel :: Unique -> CLabel
mkStringLitLabel :: Unique -> CLabel
mkAsmTempLabel :: Uniquable a => a -> CLabel
mkAsmTempDerivedLabel :: CLabel -> FastString -> CLabel
mkAsmTempEndLabel :: CLabel -> CLabel
-- | Construct a label for a DWARF Debug Information Entity (DIE)
-- describing another symbol.
mkAsmTempDieLabel :: CLabel -> CLabel
mkPlainModuleInitLabel :: Module -> CLabel
mkSplitMarkerLabel :: CLabel
mkDirty_MUT_VAR_Label :: CLabel
mkUpdInfoLabel :: CLabel
mkBHUpdInfoLabel :: CLabel
mkIndStaticInfoLabel :: CLabel
mkMainCapabilityLabel :: CLabel
mkMAP_FROZEN_infoLabel :: CLabel
mkMAP_FROZEN0_infoLabel :: CLabel
mkMAP_DIRTY_infoLabel :: CLabel
mkSMAP_FROZEN_infoLabel :: CLabel
mkSMAP_FROZEN0_infoLabel :: CLabel
mkSMAP_DIRTY_infoLabel :: CLabel
mkEMPTY_MVAR_infoLabel :: CLabel
mkArrWords_infoLabel :: CLabel
mkTopTickyCtrLabel :: CLabel
mkCAFBlackHoleInfoTableLabel :: CLabel
mkCAFBlackHoleEntryLabel :: CLabel
mkRtsPrimOpLabel :: PrimOp -> CLabel
mkRtsSlowFastTickyCtrLabel :: String -> CLabel
mkSelectorInfoLabel :: Bool -> Int -> CLabel
mkSelectorEntryLabel :: Bool -> Int -> CLabel
mkCmmInfoLabel :: UnitId -> FastString -> CLabel
mkCmmEntryLabel :: UnitId -> FastString -> CLabel
mkCmmRetInfoLabel :: UnitId -> FastString -> CLabel
mkCmmRetLabel :: UnitId -> FastString -> CLabel
mkCmmCodeLabel :: UnitId -> FastString -> CLabel
mkCmmDataLabel :: UnitId -> FastString -> CLabel
mkCmmClosureLabel :: UnitId -> FastString -> CLabel
mkRtsApFastLabel :: FastString -> CLabel
mkPrimCallLabel :: PrimCall -> CLabel
-- | Make a foreign label
mkForeignLabel :: FastString -> Maybe Int -> ForeignLabelSource -> FunctionOrData -> CLabel
-- | Update the label size field in a ForeignLabel
addLabelSize :: CLabel -> Int -> CLabel
-- | Get the label size field from a ForeignLabel
foreignLabelStdcallInfo :: CLabel -> Maybe Int
-- | Whether label is a top-level string literal
isBytesLabel :: CLabel -> Bool
-- | Whether label is a non-haskell label (defined in C code)
isForeignLabel :: CLabel -> Bool
mkCCLabel :: CostCentre -> CLabel
mkCCSLabel :: CostCentreStack -> CLabel
data DynamicLinkerLabelInfo
CodeStub :: DynamicLinkerLabelInfo
SymbolPtr :: DynamicLinkerLabelInfo
GotSymbolPtr :: DynamicLinkerLabelInfo
GotSymbolOffset :: DynamicLinkerLabelInfo
mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel
dynamicLinkerLabelInfo :: CLabel -> Maybe (DynamicLinkerLabelInfo, CLabel)
mkPicBaseLabel :: CLabel
mkDeadStripPreventer :: CLabel -> CLabel
mkHpcTicksLabel :: Module -> CLabel
hasCAF :: CLabel -> Bool
needsCDecl :: CLabel -> Bool
-- | If a label is a local temporary used for native code generation then
-- return just its unique, otherwise nothing.
maybeAsmTemp :: CLabel -> Maybe Unique
-- | Is a CLabel visible outside this object file or not? From the point of
-- view of the code generator, a name is externally visible if it has to
-- be declared as exported in the .o file's symbol table; that is, made
-- non-static.
externallyVisibleCLabel :: CLabel -> Bool
-- | Check whether a label corresponds to a C function that has a prototype
-- in a system header somehere, or is built-in to the C compiler. For
-- these labels we avoid generating our own C prototypes.
isMathFun :: CLabel -> Bool
isCFunctionLabel :: CLabel -> Bool
isGcPtrLabel :: CLabel -> Bool
labelDynamic :: DynFlags -> Module -> CLabel -> Bool
toClosureLbl :: CLabel -> CLabel
toSlowEntryLbl :: CLabel -> CLabel
toEntryLbl :: CLabel -> CLabel
toInfoLbl :: CLabel -> CLabel
toRednCountsLbl :: CLabel -> Maybe CLabel
hasHaskellName :: CLabel -> Maybe Name
pprCLabel :: Platform -> CLabel -> SDoc
instance GHC.Classes.Eq CLabel.CLabel
instance GHC.Classes.Ord CLabel.DynamicLinkerLabelInfo
instance GHC.Classes.Eq CLabel.DynamicLinkerLabelInfo
instance GHC.Classes.Ord CLabel.CmmLabelInfo
instance GHC.Classes.Eq CLabel.CmmLabelInfo
instance GHC.Classes.Ord CLabel.RtsLabelInfo
instance GHC.Classes.Eq CLabel.RtsLabelInfo
instance GHC.Classes.Ord CLabel.CaseLabelInfo
instance GHC.Classes.Eq CLabel.CaseLabelInfo
instance GHC.Classes.Ord CLabel.IdLabelInfo
instance GHC.Classes.Eq CLabel.IdLabelInfo
instance GHC.Classes.Ord CLabel.ForeignLabelSource
instance GHC.Classes.Eq CLabel.ForeignLabelSource
instance GHC.Classes.Ord CLabel.CLabel
instance Outputable.Outputable CLabel.CLabel
instance Outputable.Outputable CLabel.ForeignLabelSource
module ProfInit
profilingInitCode :: Module -> CollectedCCs -> SDoc
module BlockId
type BlockId = Label
mkBlockId :: Unique -> BlockId
newBlockId :: MonadUnique m => m BlockId
blockLbl :: BlockId -> CLabel
infoTblLbl :: BlockId -> CLabel
instance Unique.Uniquable BlockId.BlockId
instance Outputable.Outputable BlockId.BlockId
module CmmExpr
data CmmExpr
CmmLit :: CmmLit -> CmmExpr
CmmLoad :: !CmmExpr -> !CmmType -> CmmExpr
CmmReg :: !CmmReg -> CmmExpr
CmmMachOp :: MachOp -> [CmmExpr] -> CmmExpr
CmmStackSlot :: Area -> {-# UNPACK #-} !Int -> CmmExpr
CmmRegOff :: !CmmReg -> Int -> CmmExpr
cmmExprType :: DynFlags -> CmmExpr -> CmmType
cmmExprWidth :: DynFlags -> CmmExpr -> Width
maybeInvertCmmExpr :: CmmExpr -> Maybe CmmExpr
data CmmReg
CmmLocal :: {-# UNPACK #-} !LocalReg -> CmmReg
CmmGlobal :: GlobalReg -> CmmReg
cmmRegType :: DynFlags -> CmmReg -> CmmType
data CmmLit
CmmInt :: !Integer -> Width -> CmmLit
CmmFloat :: Rational -> Width -> CmmLit
CmmVec :: [CmmLit] -> CmmLit
CmmLabel :: CLabel -> CmmLit
CmmLabelOff :: CLabel -> Int -> CmmLit
CmmLabelDiffOff :: CLabel -> CLabel -> Int -> CmmLit
CmmBlock :: {-# UNPACK #-} !BlockId -> CmmLit
CmmHighStackMark :: CmmLit
cmmLitType :: DynFlags -> CmmLit -> CmmType
data LocalReg
-- | Parameters: 1. Identifier 2. Type
LocalReg :: {-# UNPACK #-} !Unique -> CmmType -> LocalReg
localRegType :: LocalReg -> CmmType
data GlobalReg
VanillaReg :: {-# UNPACK #-} !Int -> VGcPtr -> GlobalReg
FloatReg :: {-# UNPACK #-} !Int -> GlobalReg
DoubleReg :: {-# UNPACK #-} !Int -> GlobalReg
LongReg :: {-# UNPACK #-} !Int -> GlobalReg
XmmReg :: {-# UNPACK #-} !Int -> GlobalReg
YmmReg :: {-# UNPACK #-} !Int -> GlobalReg
ZmmReg :: {-# UNPACK #-} !Int -> GlobalReg
Sp :: GlobalReg
SpLim :: GlobalReg
Hp :: GlobalReg
HpLim :: GlobalReg
CCCS :: GlobalReg
CurrentTSO :: GlobalReg
CurrentNursery :: GlobalReg
HpAlloc :: GlobalReg
EagerBlackholeInfo :: GlobalReg
GCEnter1 :: GlobalReg
GCFun :: GlobalReg
BaseReg :: GlobalReg
MachSp :: GlobalReg
UnwindReturnReg :: GlobalReg
PicBaseReg :: GlobalReg
isArgReg :: GlobalReg -> Bool
globalRegType :: DynFlags -> GlobalReg -> CmmType
spReg :: CmmReg
hpReg :: CmmReg
spLimReg :: CmmReg
nodeReg :: CmmReg
node :: GlobalReg
baseReg :: CmmReg
data VGcPtr
VGcPtr :: VGcPtr
VNonGcPtr :: VGcPtr
class Ord r => DefinerOfRegs r a
foldRegsDefd :: DefinerOfRegs r a => DynFlags -> (b -> r -> b) -> b -> a -> b
class Ord r => UserOfRegs r a
foldRegsUsed :: UserOfRegs r a => DynFlags -> (b -> r -> b) -> b -> a -> b
foldRegsDefd :: DefinerOfRegs r a => DynFlags -> (b -> r -> b) -> b -> a -> b
foldRegsUsed :: UserOfRegs r a => DynFlags -> (b -> r -> b) -> b -> a -> b
foldLocalRegsDefd :: DefinerOfRegs LocalReg a => DynFlags -> (b -> LocalReg -> b) -> b -> a -> b
foldLocalRegsUsed :: UserOfRegs LocalReg a => DynFlags -> (b -> LocalReg -> b) -> b -> a -> b
-- | Sets of registers
type RegSet r = Set r
type LocalRegSet = RegSet LocalReg
type GlobalRegSet = RegSet GlobalReg
emptyRegSet :: RegSet r
elemRegSet :: Ord r => r -> RegSet r -> Bool
extendRegSet :: Ord r => RegSet r -> r -> RegSet r
deleteFromRegSet :: Ord r => RegSet r -> r -> RegSet r
mkRegSet :: Ord r => [r] -> RegSet r
plusRegSet :: Ord r => RegSet r -> RegSet r -> RegSet r
minusRegSet :: Ord r => RegSet r -> RegSet r -> RegSet r
timesRegSet :: Ord r => RegSet r -> RegSet r -> RegSet r
sizeRegSet :: RegSet r -> Int
nullRegSet :: RegSet r -> Bool
regSetToList :: RegSet r -> [r]
-- | A stack area is either the stack slot where a variable is spilled or
-- the stack space where function arguments and results are passed.
data Area
Old :: Area
Young :: {-# UNPACK #-} !BlockId -> Area
instance GHC.Classes.Ord CmmExpr.CmmReg
instance GHC.Classes.Eq CmmExpr.CmmReg
instance GHC.Show.Show CmmExpr.GlobalReg
instance GHC.Show.Show CmmExpr.VGcPtr
instance GHC.Classes.Eq CmmExpr.VGcPtr
instance GHC.Classes.Eq CmmExpr.CmmLit
instance GHC.Classes.Ord CmmExpr.Area
instance GHC.Classes.Eq CmmExpr.Area
instance GHC.Classes.Eq CmmExpr.CmmExpr
instance (GHC.Classes.Ord r, CmmExpr.UserOfRegs r CmmExpr.CmmReg) => CmmExpr.UserOfRegs r CmmExpr.CmmExpr
instance CmmExpr.UserOfRegs CmmExpr.LocalReg CmmExpr.CmmReg
instance CmmExpr.DefinerOfRegs CmmExpr.LocalReg CmmExpr.CmmReg
instance CmmExpr.UserOfRegs CmmExpr.GlobalReg CmmExpr.CmmReg
instance CmmExpr.DefinerOfRegs CmmExpr.GlobalReg CmmExpr.CmmReg
instance GHC.Classes.Eq CmmExpr.GlobalReg
instance GHC.Classes.Ord CmmExpr.GlobalReg
instance GHC.Classes.Ord r => CmmExpr.DefinerOfRegs r r
instance CmmExpr.DefinerOfRegs r a => CmmExpr.DefinerOfRegs r [a]
instance GHC.Classes.Ord r => CmmExpr.UserOfRegs r r
instance CmmExpr.UserOfRegs r a => CmmExpr.UserOfRegs r [a]
instance GHC.Classes.Eq CmmExpr.LocalReg
instance GHC.Classes.Ord CmmExpr.LocalReg
instance Unique.Uniquable CmmExpr.LocalReg
module PprCmmExpr
pprExpr :: CmmExpr -> SDoc
pprLit :: CmmLit -> SDoc
instance Outputable.Outputable CmmExpr.CmmExpr
instance Outputable.Outputable CmmExpr.CmmReg
instance Outputable.Outputable CmmExpr.CmmLit
instance Outputable.Outputable CmmExpr.LocalReg
instance Outputable.Outputable CmmExpr.Area
instance Outputable.Outputable CmmExpr.GlobalReg
module CodeGen.Platform.X86_64
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
freeRegBase :: RegNo -> Bool
module CodeGen.Platform.X86
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
freeRegBase :: RegNo -> Bool
module CodeGen.Platform.SPARC
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module CodeGen.Platform.PPC_Darwin
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module CodeGen.Platform.PPC
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module CodeGen.Platform.NoRegs
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module CodeGen.Platform.ARM64
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module CodeGen.Platform.ARM
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module CodeGen.Platform
-- | Returns True if this global register is stored in a
-- caller-saves machine register.
callerSaves :: Platform -> GlobalReg -> Bool
-- | Here is where the STG register map is defined for each target arch.
-- The order matters (for the llvm backend anyway)! We must make sure to
-- maintain the order here with the order used in the LLVM calling
-- conventions. Note that also, this isn't all registers, just the ones
-- that are currently possbily mapped to real registers.
activeStgRegs :: Platform -> [GlobalReg]
haveRegBase :: Platform -> Bool
globalRegMaybe :: Platform -> GlobalReg -> Maybe RealReg
freeReg :: Platform -> RegNo -> Bool
module CmmNode
data CmmNode e x
[CmmEntry] :: {-# UNPACK #-} !Label -> CmmTickScope -> CmmNode C O
[CmmComment] :: FastString -> CmmNode O O
[CmmTick] :: !CmmTickish -> CmmNode O O
[CmmUnwind] :: [(GlobalReg, Maybe CmmExpr)] -> CmmNode O O
[CmmAssign] :: !CmmReg -> !CmmExpr -> CmmNode O O
[CmmStore] :: !CmmExpr -> !CmmExpr -> CmmNode O O
[CmmUnsafeForeignCall] :: ForeignTarget -> [CmmFormal] -> [CmmActual] -> CmmNode O O
[CmmBranch] :: {-# UNPACK #-} !Label -> CmmNode O C
[CmmCondBranch] :: {cml_pred :: CmmExpr, cml_true, cml_false :: {-# UNPACK #-} !Label, cml_likely :: Maybe Bool} -> CmmNode O C
[CmmSwitch] :: CmmExpr -> SwitchTargets -> CmmNode O C
[CmmCall] :: {cml_target :: CmmExpr, cml_cont :: Maybe Label, cml_args_regs :: [GlobalReg], cml_args :: ByteOff, cml_ret_args :: ByteOff, cml_ret_off :: ByteOff} -> CmmNode O C
[CmmForeignCall] :: {tgt :: ForeignTarget, res :: [CmmFormal], args :: [CmmActual], succ :: {-# UNPACK #-} !Label, ret_args :: ByteOff, ret_off :: ByteOff, intrbl :: Bool} -> CmmNode O C
type CmmFormal = LocalReg
type CmmActual = CmmExpr
-- | Tickish in Cmm context (annotations only)
type CmmTickish = Tickish ()
type UpdFrameOffset = ByteOff
-- | A convention maps a list of values (function arguments or return
-- values) to registers or stack locations.
data Convention
-- | top-level Haskell functions use NativeDirectCall, which maps
-- arguments to registers starting with R2, according to how many
-- registers are available on the platform. This convention ignores R1,
-- because for a top-level function call the function closure is
-- implicit, and doesn't need to be passed.
NativeDirectCall :: Convention
-- | non-top-level Haskell functions, which pass the address of the
-- function closure in R1 (regardless of whether R1 is a real register or
-- not), and the rest of the arguments in registers or on the stack.
NativeNodeCall :: Convention
-- | a native return. The convention for returns depends on how many values
-- are returned: for just one value returned, the appropriate register is
-- used (R1, F1, etc.). regardless of whether it is a real register or
-- not. For multiple values returned, they are mapped to registers or the
-- stack.
NativeReturn :: Convention
-- | Slow entry points: all args pushed on the stack
Slow :: Convention
-- | Entry to the garbage collector: uses the node reg! (TODO: I don't
-- think we need this --SDM)
GC :: Convention
data ForeignConvention
ForeignConvention :: CCallConv -> [ForeignHint] -> [ForeignHint] -> CmmReturnInfo -> ForeignConvention
data ForeignTarget
ForeignTarget :: CmmExpr -> ForeignConvention -> ForeignTarget
PrimTarget :: CallishMachOp -> ForeignTarget
foreignTargetHints :: ForeignTarget -> ([ForeignHint], [ForeignHint])
data CmmReturnInfo
CmmMayReturn :: CmmReturnInfo
CmmNeverReturns :: CmmReturnInfo
mapExp :: (CmmExpr -> CmmExpr) -> CmmNode e x -> CmmNode e x
mapExpDeep :: (CmmExpr -> CmmExpr) -> CmmNode e x -> CmmNode e x
wrapRecExp :: (CmmExpr -> CmmExpr) -> CmmExpr -> CmmExpr
foldExp :: (CmmExpr -> z -> z) -> CmmNode e x -> z -> z
foldExpDeep :: (CmmExpr -> z -> z) -> CmmNode e x -> z -> z
wrapRecExpf :: (CmmExpr -> z -> z) -> CmmExpr -> z -> z
mapExpM :: (CmmExpr -> Maybe CmmExpr) -> CmmNode e x -> Maybe (CmmNode e x)
mapExpDeepM :: (CmmExpr -> Maybe CmmExpr) -> CmmNode e x -> Maybe (CmmNode e x)
wrapRecExpM :: (CmmExpr -> Maybe CmmExpr) -> (CmmExpr -> Maybe CmmExpr)
mapSuccessors :: (Label -> Label) -> CmmNode O C -> CmmNode O C
-- | Tick scope identifier, allowing us to reason about what annotations in
-- a Cmm block should scope over. We especially take care to allow
-- optimisations to reorganise blocks without losing tick association in
-- the process.
data CmmTickScope
-- | The global scope is the "root" of the scope graph. Every scope is a
-- sub-scope of the global scope. It doesn't make sense to add ticks to
-- this scope. On the other hand, this means that setting this scope on a
-- block means no ticks apply to it.
GlobalScope :: CmmTickScope
-- | Constructs a new sub-scope to an existing scope. This allows us to
-- translate Core-style scoping rules (see tickishScoped) into
-- the Cmm world. Suppose the following code:
--
-- tick1 case ... of A -> tick2 ... B -> tick3
-- ...
--
-- We want the top-level tick annotation to apply to blocks generated for
-- the A and B alternatives. We can achieve that by generating
-- tick1 into a block with scope a, while the code for
-- alternatives A and B gets generated into sub-scopes a/b and a/c
-- respectively.
SubScope :: !Unique -> CmmTickScope -> CmmTickScope
-- | A combined scope scopes over everything that the two given scopes
-- cover. It is therefore a sub-scope of either scope. This is required
-- for optimisations. Consider common block elimination:
--
-- A -> tick2 case ... of C -> [common] B -> tick3
-- case ... of D -> [common]
--
-- We will generate code for the C and D alternatives, and figure out
-- afterwards that it's actually common code. Scoping rules dictate that
-- the resulting common block needs to be covered by both tick2
-- and tick3, therefore we need to construct a scope that is a
-- child to *both* scope. Now we can do that - if we assign the scopes
-- ac and bd to the common-ed up blocks, the new block could have
-- a combined tick scope ac+bd, which both tick2 and
-- tick3 apply to.
CombinedScope :: CmmTickScope -> CmmTickScope -> CmmTickScope
-- | Checks whether two tick scopes are sub-scopes of each other. True if
-- the two scopes are equal.
isTickSubScope :: CmmTickScope -> CmmTickScope -> Bool
-- | Combine two tick scopes. The new scope should be sub-scope of both
-- parameters. We simplfy automatically if one tick scope is a sub-scope
-- of the other already.
combineTickScopes :: CmmTickScope -> CmmTickScope -> CmmTickScope
instance GHC.Classes.Eq CmmNode.ForeignTarget
instance GHC.Classes.Eq CmmNode.ForeignConvention
instance GHC.Classes.Eq CmmNode.CmmReturnInfo
instance GHC.Classes.Eq CmmNode.Convention
instance GHC.Classes.Eq (CmmNode.CmmNode e x)
instance Compiler.Hoopl.Graph.NonLocal CmmNode.CmmNode
instance CmmExpr.UserOfRegs CmmExpr.LocalReg (CmmNode.CmmNode e x)
instance CmmExpr.UserOfRegs CmmExpr.GlobalReg (CmmNode.CmmNode e x)
instance CmmExpr.DefinerOfRegs CmmExpr.LocalReg (CmmNode.CmmNode e x)
instance CmmExpr.DefinerOfRegs CmmExpr.GlobalReg (CmmNode.CmmNode e x)
instance GHC.Classes.Eq CmmNode.CmmTickScope
instance GHC.Classes.Ord CmmNode.CmmTickScope
instance Outputable.Outputable CmmNode.CmmTickScope
instance (GHC.Classes.Ord r, CmmExpr.UserOfRegs r CmmExpr.CmmReg) => CmmExpr.UserOfRegs r CmmNode.ForeignTarget
module CmmLex
data CmmToken
CmmT_SpecChar :: Char -> CmmToken
CmmT_DotDot :: CmmToken
CmmT_DoubleColon :: CmmToken
CmmT_Shr :: CmmToken
CmmT_Shl :: CmmToken
CmmT_Ge :: CmmToken
CmmT_Le :: CmmToken
CmmT_Eq :: CmmToken
CmmT_Ne :: CmmToken
CmmT_BoolAnd :: CmmToken
CmmT_BoolOr :: CmmToken
CmmT_CLOSURE :: CmmToken
CmmT_INFO_TABLE :: CmmToken
CmmT_INFO_TABLE_RET :: CmmToken
CmmT_INFO_TABLE_FUN :: CmmToken
CmmT_INFO_TABLE_CONSTR :: CmmToken
CmmT_INFO_TABLE_SELECTOR :: CmmToken
CmmT_else :: CmmToken
CmmT_export :: CmmToken
CmmT_section :: CmmToken
CmmT_goto :: CmmToken
CmmT_if :: CmmToken
CmmT_call :: CmmToken
CmmT_jump :: CmmToken
CmmT_foreign :: CmmToken
CmmT_never :: CmmToken
CmmT_prim :: CmmToken
CmmT_reserve :: CmmToken
CmmT_return :: CmmToken
CmmT_returns :: CmmToken
CmmT_import :: CmmToken
CmmT_switch :: CmmToken
CmmT_case :: CmmToken
CmmT_default :: CmmToken
CmmT_push :: CmmToken
CmmT_unwind :: CmmToken
CmmT_bits8 :: CmmToken
CmmT_bits16 :: CmmToken
CmmT_bits32 :: CmmToken
CmmT_bits64 :: CmmToken
CmmT_bits128 :: CmmToken
CmmT_bits256 :: CmmToken
CmmT_bits512 :: CmmToken
CmmT_float32 :: CmmToken
CmmT_float64 :: CmmToken
CmmT_gcptr :: CmmToken
CmmT_GlobalReg :: GlobalReg -> CmmToken
CmmT_Name :: FastString -> CmmToken
CmmT_String :: String -> CmmToken
CmmT_Int :: Integer -> CmmToken
CmmT_Float :: Rational -> CmmToken
CmmT_EOF :: CmmToken
cmmlex :: (Located CmmToken -> PD a) -> PD a
instance GHC.Show.Show CmmLex.CmmToken
module Cmm
type CmmProgram = [CmmGroup]
type CmmGroup = GenCmmGroup CmmStatics CmmTopInfo CmmGraph
type GenCmmGroup d h g = [GenCmmDecl d h g]
type CmmDecl = GenCmmDecl CmmStatics CmmTopInfo CmmGraph
-- | A top-level chunk, abstracted over the type of the contents of the
-- basic blocks (Cmm or instructions are the likely instantiations).
data GenCmmDecl d h g
CmmProc :: h -> CLabel -> [GlobalReg] -> g -> GenCmmDecl d h g
CmmData :: Section -> d -> GenCmmDecl d h g
type CmmGraph = GenCmmGraph CmmNode
data GenCmmGraph n
CmmGraph :: BlockId -> Graph n C C -> GenCmmGraph n
[g_entry] :: GenCmmGraph n -> BlockId
[g_graph] :: GenCmmGraph n -> Graph n C C
type CmmBlock = Block CmmNode C C
type RawCmmDecl = GenCmmDecl CmmStatics (LabelMap CmmStatics) CmmGraph
type RawCmmGroup = GenCmmGroup CmmStatics (LabelMap CmmStatics) CmmGraph
data Section
Section :: SectionType -> CLabel -> Section
data SectionType
Text :: SectionType
Data :: SectionType
ReadOnlyData :: SectionType
RelocatableReadOnlyData :: SectionType
UninitialisedData :: SectionType
ReadOnlyData16 :: SectionType
CString :: SectionType
OtherSection :: String -> SectionType
data CmmStatics
Statics :: CLabel -> [CmmStatic] -> CmmStatics
data CmmStatic
CmmStaticLit :: CmmLit -> CmmStatic
CmmUninitialised :: Int -> CmmStatic
CmmString :: [Word8] -> CmmStatic
data GenBasicBlock i
BasicBlock :: BlockId -> [i] -> GenBasicBlock i
-- | The branch block id is that of the first block in the branch, which is
-- that branch's entry point
blockId :: GenBasicBlock i -> BlockId
newtype ListGraph i
ListGraph :: [GenBasicBlock i] -> ListGraph i
pprBBlock :: Outputable stmt => GenBasicBlock stmt -> SDoc
type CmmReplGraph e x = GenCmmReplGraph CmmNode e x
type GenCmmReplGraph n e x = UniqSM (Maybe (Graph n e x))
type CmmFwdRewrite f = FwdRewrite UniqSM CmmNode f
type CmmBwdRewrite f = BwdRewrite UniqSM CmmNode f
data CmmTopInfo
TopInfo :: LabelMap CmmInfoTable -> CmmStackInfo -> CmmTopInfo
[info_tbls] :: CmmTopInfo -> LabelMap CmmInfoTable
[stack_info] :: CmmTopInfo -> CmmStackInfo
data CmmStackInfo
StackInfo :: ByteOff -> Maybe ByteOff -> Bool -> CmmStackInfo
[arg_space] :: CmmStackInfo -> ByteOff
[updfr_space] :: CmmStackInfo -> Maybe ByteOff
[do_layout] :: CmmStackInfo -> Bool
-- | Info table as a haskell data type
data CmmInfoTable
CmmInfoTable :: CLabel -> SMRep -> ProfilingInfo -> C_SRT -> CmmInfoTable
[cit_lbl] :: CmmInfoTable -> CLabel
[cit_rep] :: CmmInfoTable -> SMRep
[cit_prof] :: CmmInfoTable -> ProfilingInfo
[cit_srt] :: CmmInfoTable -> C_SRT
topInfoTable :: GenCmmDecl a CmmTopInfo (GenCmmGraph n) -> Maybe CmmInfoTable
data ClosureTypeInfo
Constr :: ConstrTag -> ConstrDescription -> ClosureTypeInfo
Fun :: FunArity -> ArgDescr -> ClosureTypeInfo
Thunk :: ClosureTypeInfo
ThunkSelector :: SelectorOffset -> ClosureTypeInfo
BlackHole :: ClosureTypeInfo
IndStatic :: ClosureTypeInfo
data C_SRT
NoC_SRT :: C_SRT
C_SRT :: !CLabel -> !WordOff -> !StgHalfWord -> C_SRT
needsSRT :: C_SRT -> Bool
data ProfilingInfo
NoProfilingInfo :: ProfilingInfo
ProfilingInfo :: [Word8] -> [Word8] -> ProfilingInfo
type ConstrDescription = [Word8]
instance GHC.Show.Show Cmm.SectionType
instance GHC.Classes.Eq Cmm.C_SRT
instance Outputable.Outputable instr => Outputable.Outputable (Cmm.ListGraph instr)
instance Outputable.Outputable instr => Outputable.Outputable (Cmm.GenBasicBlock instr)
module SPARC.Imm
-- | An immediate value. Not all of these are directly representable by the
-- machine. Things like ImmLit are slurped out and put in a data segment
-- instead.
data Imm
ImmInt :: Int -> Imm
ImmInteger :: Integer -> Imm
ImmCLbl :: CLabel -> Imm
ImmLit :: SDoc -> Imm
ImmIndex :: CLabel -> Int -> Imm
ImmFloat :: Rational -> Imm
ImmDouble :: Rational -> Imm
ImmConstantSum :: Imm -> Imm -> Imm
ImmConstantDiff :: Imm -> Imm -> Imm
LO :: Imm -> Imm
HI :: Imm -> Imm
-- | Create a ImmLit containing this string.
strImmLit :: String -> Imm
-- | Convert a CmmLit to an Imm. Narrow to the width: a CmmInt might be out
-- of range, but we assume that ImmInteger only contains in-range values.
-- A signed value should be fine here.
litToImm :: CmmLit -> Imm
module SPARC.AddrMode
-- | Represents a memory address in an instruction. Being a RISC machine,
-- the SPARC addressing modes are very regular.
data AddrMode
AddrRegReg :: Reg -> Reg -> AddrMode
AddrRegImm :: Reg -> Imm -> AddrMode
-- | Add an integer offset to the address in an AddrMode.
addrOffset :: AddrMode -> Int -> Maybe AddrMode
module PprCmmDecl
writeCmms :: (Outputable info, Outputable g) => DynFlags -> Handle -> [GenCmmGroup CmmStatics info g] -> IO ()
pprCmms :: (Outputable info, Outputable g) => [GenCmmGroup CmmStatics info g] -> SDoc
pprCmmGroup :: (Outputable d, Outputable info, Outputable g) => GenCmmGroup d info g -> SDoc
pprSection :: Section -> SDoc
pprStatic :: CmmStatic -> SDoc
instance (Outputable.Outputable d, Outputable.Outputable info, Outputable.Outputable i) => Outputable.Outputable (Cmm.GenCmmDecl d info i)
instance Outputable.Outputable Cmm.CmmStatics
instance Outputable.Outputable Cmm.CmmStatic
instance Outputable.Outputable Cmm.CmmInfoTable
instance Outputable.Outputable Cmm.C_SRT
instance Outputable.Outputable CmmType.ForeignHint
module PprBase
castFloatToWord8Array :: STUArray s Int Float -> ST s (STUArray s Int Word8)
castDoubleToWord8Array :: STUArray s Int Double -> ST s (STUArray s Int Word8)
floatToBytes :: Float -> [Int]
doubleToBytes :: Double -> [Int]
pprSectionHeader :: Platform -> Section -> SDoc
-- | The LLVM Type System.
module Llvm.Types
-- | A global mutable variable. Maybe defined or external
data LMGlobal
LMGlobal :: LlvmVar -> Maybe LlvmStatic -> LMGlobal
-- | Returns the variable of the LMGlobal
[getGlobalVar] :: LMGlobal -> LlvmVar
-- | Return the value of the LMGlobal
[getGlobalValue] :: LMGlobal -> Maybe LlvmStatic
-- | A String in LLVM
type LMString = FastString
-- | A type alias
type LlvmAlias = (LMString, LlvmType)
-- | Llvm Types
data LlvmType
-- | An integer with a given width in bits.
LMInt :: Int -> LlvmType
-- | 32 bit floating point
LMFloat :: LlvmType
-- | 64 bit floating point
LMDouble :: LlvmType
-- | 80 bit (x86 only) floating point
LMFloat80 :: LlvmType
-- | 128 bit floating point
LMFloat128 :: LlvmType
-- | A pointer to a LlvmType
LMPointer :: LlvmType -> LlvmType
-- | An array of LlvmType
LMArray :: Int -> LlvmType -> LlvmType
-- | A vector of LlvmType
LMVector :: Int -> LlvmType -> LlvmType
-- | A LlvmVar can represent a label (address)
LMLabel :: LlvmType
-- | Void type
LMVoid :: LlvmType
-- | Packed structure type
LMStruct :: [LlvmType] -> LlvmType
-- | Unpacked structure type
LMStructU :: [LlvmType] -> LlvmType
-- | A type alias
LMAlias :: LlvmAlias -> LlvmType
-- | LLVM Metadata
LMMetadata :: LlvmType
-- | Function type, used to create pointers to functions
LMFunction :: LlvmFunctionDecl -> LlvmType
ppParams :: LlvmParameterListType -> [LlvmParameter] -> SDoc
-- | An LLVM section definition. If Nothing then let LLVM decide the
-- section
type LMSection = Maybe LMString
type LMAlign = Maybe Int
data LMConst
-- | Mutable global variable
Global :: LMConst
-- | Constant global variable
Constant :: LMConst
-- | Alias of another variable
Alias :: LMConst
-- | LLVM Variables
data LlvmVar
-- | Variables with a global scope.
LMGlobalVar :: LMString -> LlvmType -> LlvmLinkageType -> LMSection -> LMAlign -> LMConst -> LlvmVar
-- | Variables local to a function or parameters.
LMLocalVar :: Unique -> LlvmType -> LlvmVar
-- | Named local variables. Sometimes we need to be able to explicitly name
-- variables (e.g for function arguments).
LMNLocalVar :: LMString -> LlvmType -> LlvmVar
-- | A constant variable
LMLitVar :: LlvmLit -> LlvmVar
-- | Llvm Literal Data.
--
-- These can be used inline in expressions.
data LlvmLit
-- | Refers to an integer constant (i64 42).
LMIntLit :: Integer -> LlvmType -> LlvmLit
-- | Floating point literal
LMFloatLit :: Double -> LlvmType -> LlvmLit
-- | Literal NULL, only applicable to pointer types
LMNullLit :: LlvmType -> LlvmLit
-- | Vector literal
LMVectorLit :: [LlvmLit] -> LlvmLit
-- | Undefined value, random bit pattern. Useful for optimisations.
LMUndefLit :: LlvmType -> LlvmLit
-- | Llvm Static Data.
--
-- These represent the possible global level variables and constants.
data LlvmStatic
-- | A comment in a static section
LMComment :: LMString -> LlvmStatic
-- | A static variant of a literal value
LMStaticLit :: LlvmLit -> LlvmStatic
-- | For uninitialised data
LMUninitType :: LlvmType -> LlvmStatic
-- | Defines a static LMString
LMStaticStr :: LMString -> LlvmType -> LlvmStatic
-- | A static array
LMStaticArray :: [LlvmStatic] -> LlvmType -> LlvmStatic
-- | A static structure type
LMStaticStruc :: [LlvmStatic] -> LlvmType -> LlvmStatic
-- | A pointer to other data
LMStaticPointer :: LlvmVar -> LlvmStatic
-- | Pointer to Pointer conversion
LMBitc :: LlvmStatic -> LlvmType -> LlvmStatic
-- | Pointer to Integer conversion
LMPtoI :: LlvmStatic -> LlvmType -> LlvmStatic
-- | Constant addition operation
LMAdd :: LlvmStatic -> LlvmStatic -> LlvmStatic
-- | Constant subtraction operation
LMSub :: LlvmStatic -> LlvmStatic -> LlvmStatic
pprSpecialStatic :: LlvmStatic -> SDoc
pprStaticArith :: LlvmStatic -> LlvmStatic -> LitString -> LitString -> String -> SDoc
-- | Return the variable name or value of the LlvmVar in Llvm IR
-- textual representation (e.g. @x, %y or 42).
ppName :: LlvmVar -> SDoc
-- | Return the variable name or value of the LlvmVar in a plain
-- textual representation (e.g. x, y or 42).
ppPlainName :: LlvmVar -> SDoc
-- | Print a literal value. No type.
ppLit :: LlvmLit -> SDoc
garbageLit :: LlvmType -> Maybe LlvmLit
-- | Return the LlvmType of the LlvmVar
getVarType :: LlvmVar -> LlvmType
-- | Return the LlvmType of a LlvmLit
getLitType :: LlvmLit -> LlvmType
-- | Return the LlvmType of the LlvmStatic
getStatType :: LlvmStatic -> LlvmType
-- | Return the LlvmLinkageType for a LlvmVar
getLink :: LlvmVar -> LlvmLinkageType
-- | Add a pointer indirection to the supplied type. LMLabel and
-- LMVoid cannot be lifted.
pLift :: LlvmType -> LlvmType
-- | Lift a variable to LMPointer type.
pVarLift :: LlvmVar -> LlvmVar
-- | Remove the pointer indirection of the supplied type. Only
-- LMPointer constructors can be lowered.
pLower :: LlvmType -> LlvmType
-- | Lower a variable of LMPointer type.
pVarLower :: LlvmVar -> LlvmVar
-- | Test if the given LlvmType is an integer
isInt :: LlvmType -> Bool
-- | Test if the given LlvmType is a floating point type
isFloat :: LlvmType -> Bool
-- | Test if the given LlvmType is an LMPointer construct
isPointer :: LlvmType -> Bool
-- | Test if the given LlvmType is an LMVector construct
isVector :: LlvmType -> Bool
-- | Test if a LlvmVar is global.
isGlobal :: LlvmVar -> Bool
-- | Width in bits of an LlvmType, returns 0 if not applicable
llvmWidthInBits :: DynFlags -> LlvmType -> Int
i128 :: LlvmType
i64 :: LlvmType
i32 :: LlvmType
i16 :: LlvmType
i8 :: LlvmType
i1 :: LlvmType
i8Ptr :: LlvmType
-- | The target architectures word size
llvmWord :: DynFlags -> LlvmType
-- | The target architectures word size
llvmWordPtr :: DynFlags -> LlvmType
-- | An LLVM Function
data LlvmFunctionDecl
LlvmFunctionDecl :: LMString -> LlvmLinkageType -> LlvmCallConvention -> LlvmType -> LlvmParameterListType -> [LlvmParameter] -> LMAlign -> LlvmFunctionDecl
-- | Unique identifier of the function
[decName] :: LlvmFunctionDecl -> LMString
-- | LinkageType of the function
[funcLinkage] :: LlvmFunctionDecl -> LlvmLinkageType
-- | The calling convention of the function
[funcCc] :: LlvmFunctionDecl -> LlvmCallConvention
-- | Type of the returned value
[decReturnType] :: LlvmFunctionDecl -> LlvmType
-- | Indicates if this function uses varargs
[decVarargs] :: LlvmFunctionDecl -> LlvmParameterListType
-- | Parameter types and attributes
[decParams] :: LlvmFunctionDecl -> [LlvmParameter]
-- | Function align value, must be power of 2
[funcAlign] :: LlvmFunctionDecl -> LMAlign
type LlvmFunctionDecls = [LlvmFunctionDecl]
type LlvmParameter = (LlvmType, [LlvmParamAttr])
-- | LLVM Parameter Attributes.
--
-- Parameter attributes are used to communicate additional information
-- about the result or parameters of a function
data LlvmParamAttr
-- | This indicates to the code generator that the parameter or return
-- value should be zero-extended to a 32-bit value by the caller (for a
-- parameter) or the callee (for a return value).
ZeroExt :: LlvmParamAttr
-- | This indicates to the code generator that the parameter or return
-- value should be sign-extended to a 32-bit value by the caller (for a
-- parameter) or the callee (for a return value).
SignExt :: LlvmParamAttr
-- | This indicates that this parameter or return value should be treated
-- in a special target-dependent fashion during while emitting code for a
-- function call or return (usually, by putting it in a register as
-- opposed to memory).
InReg :: LlvmParamAttr
-- | This indicates that the pointer parameter should really be passed by
-- value to the function.
ByVal :: LlvmParamAttr
-- | This indicates that the pointer parameter specifies the address of a
-- structure that is the return value of the function in the source
-- program.
SRet :: LlvmParamAttr
-- | This indicates that the pointer does not alias any global or any other
-- parameter.
NoAlias :: LlvmParamAttr
-- | This indicates that the callee does not make any copies of the pointer
-- that outlive the callee itself
NoCapture :: LlvmParamAttr
-- | This indicates that the pointer parameter can be excised using the
-- trampoline intrinsics.
Nest :: LlvmParamAttr
-- | Llvm Function Attributes.
--
-- Function attributes are set to communicate additional information
-- about a function. Function attributes are considered to be part of the
-- function, not of the function type, so functions with different
-- parameter attributes can have the same function type. Functions can
-- have multiple attributes.
--
-- Descriptions taken from
-- http://llvm.org/docs/LangRef.html#fnattrs
data LlvmFuncAttr
-- | This attribute indicates that the inliner should attempt to inline
-- this function into callers whenever possible, ignoring any active
-- inlining size threshold for this caller.
AlwaysInline :: LlvmFuncAttr
-- | This attribute indicates that the source code contained a hint that
-- inlining this function is desirable (such as the "inline" keyword in
-- C/C++). It is just a hint; it imposes no requirements on the inliner.
InlineHint :: LlvmFuncAttr
-- | This attribute indicates that the inliner should never inline this
-- function in any situation. This attribute may not be used together
-- with the alwaysinline attribute.
NoInline :: LlvmFuncAttr
-- | This attribute suggests that optimization passes and code generator
-- passes make choices that keep the code size of this function low, and
-- otherwise do optimizations specifically to reduce code size.
OptSize :: LlvmFuncAttr
-- | This function attribute indicates that the function never returns
-- normally. This produces undefined behavior at runtime if the function
-- ever does dynamically return.
NoReturn :: LlvmFuncAttr
-- | This function attribute indicates that the function never returns with
-- an unwind or exceptional control flow. If the function does unwind,
-- its runtime behavior is undefined.
NoUnwind :: LlvmFuncAttr
-- | This attribute indicates that the function computes its result (or
-- decides to unwind an exception) based strictly on its arguments,
-- without dereferencing any pointer arguments or otherwise accessing any
-- mutable state (e.g. memory, control registers, etc) visible to caller
-- functions. It does not write through any pointer arguments (including
-- byval arguments) and never changes any state visible to callers. This
-- means that it cannot unwind exceptions by calling the C++ exception
-- throwing methods, but could use the unwind instruction.
ReadNone :: LlvmFuncAttr
-- | This attribute indicates that the function does not write through any
-- pointer arguments (including byval arguments) or otherwise modify any
-- state (e.g. memory, control registers, etc) visible to caller
-- functions. It may dereference pointer arguments and read state that
-- may be set in the caller. A readonly function always returns the same
-- value (or unwinds an exception identically) when called with the same
-- set of arguments and global state. It cannot unwind an exception by
-- calling the C++ exception throwing methods, but may use the unwind
-- instruction.
ReadOnly :: LlvmFuncAttr
-- | This attribute indicates that the function should emit a stack
-- smashing protector. It is in the form of a "canary"—a random value
-- placed on the stack before the local variables that's checked upon
-- return from the function to see if it has been overwritten. A
-- heuristic is used to determine if a function needs stack protectors or
-- not.
--
-- If a function that has an ssp attribute is inlined into a function
-- that doesn't have an ssp attribute, then the resulting function will
-- have an ssp attribute.
Ssp :: LlvmFuncAttr
-- | This attribute indicates that the function should always emit a stack
-- smashing protector. This overrides the ssp function attribute.
--
-- If a function that has an sspreq attribute is inlined into a function
-- that doesn't have an sspreq attribute or which has an ssp attribute,
-- then the resulting function will have an sspreq attribute.
SspReq :: LlvmFuncAttr
-- | This attribute indicates that the code generator should not use a red
-- zone, even if the target-specific ABI normally permits it.
NoRedZone :: LlvmFuncAttr
-- | This attributes disables implicit floating point instructions.
NoImplicitFloat :: LlvmFuncAttr
-- | This attribute disables prologue / epilogue emission for the function.
-- This can have very system-specific consequences.
Naked :: LlvmFuncAttr
-- | Different types to call a function.
data LlvmCallType
-- | Normal call, allocate a new stack frame.
StdCall :: LlvmCallType
-- | Tail call, perform the call in the current stack frame.
TailCall :: LlvmCallType
-- | Different calling conventions a function can use.
data LlvmCallConvention
-- | The C calling convention. This calling convention (the default if no
-- other calling convention is specified) matches the target C calling
-- conventions. This calling convention supports varargs function calls
-- and tolerates some mismatch in the declared prototype and implemented
-- declaration of the function (as does normal C).
CC_Ccc :: LlvmCallConvention
-- | This calling convention attempts to make calls as fast as possible
-- (e.g. by passing things in registers). This calling convention allows
-- the target to use whatever tricks it wants to produce fast code for
-- the target, without having to conform to an externally specified ABI
-- (Application Binary Interface). Implementations of this convention
-- should allow arbitrary tail call optimization to be supported. This
-- calling convention does not support varargs and requires the prototype
-- of al callees to exactly match the prototype of the function
-- definition.
CC_Fastcc :: LlvmCallConvention
-- | This calling convention attempts to make code in the caller as
-- efficient as possible under the assumption that the call is not
-- commonly executed. As such, these calls often preserve all registers
-- so that the call does not break any live ranges in the caller side.
-- This calling convention does not support varargs and requires the
-- prototype of all callees to exactly match the prototype of the
-- function definition.
CC_Coldcc :: LlvmCallConvention
-- | The GHC-specific registerised calling convention.
CC_Ghc :: LlvmCallConvention
-- | Any calling convention may be specified by number, allowing
-- target-specific calling conventions to be used. Target specific
-- calling conventions start at 64.
CC_Ncc :: Int -> LlvmCallConvention
-- | X86 Specific StdCall convention. LLVM includes a specific alias
-- for it rather than just using CC_Ncc.
CC_X86_Stdcc :: LlvmCallConvention
-- | Functions can have a fixed amount of parameters, or a variable amount.
data LlvmParameterListType
FixedArgs :: LlvmParameterListType
VarArgs :: LlvmParameterListType
-- | Linkage type of a symbol.
--
-- The description of the constructors is copied from the Llvm Assembly
-- Language Reference Manual
-- http://www.llvm.org/docs/LangRef.html#linkage, because they
-- correspond to the Llvm linkage types.
data LlvmLinkageType
-- | Global values with internal linkage are only directly accessible by
-- objects in the current module. In particular, linking code into a
-- module with an internal global value may cause the internal to be
-- renamed as necessary to avoid collisions. Because the symbol is
-- internal to the module, all references can be updated. This
-- corresponds to the notion of the static keyword in C.
Internal :: LlvmLinkageType
-- | Globals with linkonce linkage are merged with other globals
-- of the same name when linkage occurs. This is typically used to
-- implement inline functions, templates, or other code which must be
-- generated in each translation unit that uses it. Unreferenced linkonce
-- globals are allowed to be discarded.
LinkOnce :: LlvmLinkageType
-- | weak linkage is exactly the same as linkonce linkage, except
-- that unreferenced weak globals may not be discarded. This is used for
-- globals that may be emitted in multiple translation units, but that
-- are not guaranteed to be emitted into every translation unit that uses
-- them. One example of this are common globals in C, such as int
-- X; at global scope.
Weak :: LlvmLinkageType
-- | appending linkage may only be applied to global variables of
-- pointer to array type. When two global variables with appending
-- linkage are linked together, the two global arrays are appended
-- together. This is the Llvm, typesafe, equivalent of having the system
-- linker append together sections with identical names when .o
-- files are linked.
Appending :: LlvmLinkageType
-- | The semantics of this linkage follow the ELF model: the symbol is weak
-- until linked, if not linked, the symbol becomes null instead of being
-- an undefined reference.
ExternWeak :: LlvmLinkageType
-- | The symbol participates in linkage and can be used to resolve external
-- symbol references.
ExternallyVisible :: LlvmLinkageType
-- | Alias for ExternallyVisible but with explicit textual form in
-- LLVM assembly.
External :: LlvmLinkageType
-- | Symbol is private to the module and should not appear in the symbol
-- table
Private :: LlvmLinkageType
-- | Llvm binary operators machine operations.
data LlvmMachOp
-- | add two integer, floating point or vector values.
LM_MO_Add :: LlvmMachOp
-- | subtract two ...
LM_MO_Sub :: LlvmMachOp
-- | multiply ..
LM_MO_Mul :: LlvmMachOp
-- | unsigned integer or vector division.
LM_MO_UDiv :: LlvmMachOp
-- | signed integer ..
LM_MO_SDiv :: LlvmMachOp
-- | unsigned integer or vector remainder (mod)
LM_MO_URem :: LlvmMachOp
-- | signed ...
LM_MO_SRem :: LlvmMachOp
-- | add two floating point or vector values.
LM_MO_FAdd :: LlvmMachOp
-- | subtract two ...
LM_MO_FSub :: LlvmMachOp
-- | multiply ...
LM_MO_FMul :: LlvmMachOp
-- | divide ...
LM_MO_FDiv :: LlvmMachOp
-- | remainder ...
LM_MO_FRem :: LlvmMachOp
-- | Left shift
LM_MO_Shl :: LlvmMachOp
-- | Logical shift right Shift right, filling with zero
LM_MO_LShr :: LlvmMachOp
-- | Arithmetic shift right The most significant bits of the result will be
-- equal to the sign bit of the left operand.
LM_MO_AShr :: LlvmMachOp
-- | AND bitwise logical operation.
LM_MO_And :: LlvmMachOp
-- | OR bitwise logical operation.
LM_MO_Or :: LlvmMachOp
-- | XOR bitwise logical operation.
LM_MO_Xor :: LlvmMachOp
-- | Llvm compare operations.
data LlvmCmpOp
-- | Equal (Signed and Unsigned)
LM_CMP_Eq :: LlvmCmpOp
-- | Not equal (Signed and Unsigned)
LM_CMP_Ne :: LlvmCmpOp
-- | Unsigned greater than
LM_CMP_Ugt :: LlvmCmpOp
-- | Unsigned greater than or equal
LM_CMP_Uge :: LlvmCmpOp
-- | Unsigned less than
LM_CMP_Ult :: LlvmCmpOp
-- | Unsigned less than or equal
LM_CMP_Ule :: LlvmCmpOp
-- | Signed greater than
LM_CMP_Sgt :: LlvmCmpOp
-- | Signed greater than or equal
LM_CMP_Sge :: LlvmCmpOp
-- | Signed less than
LM_CMP_Slt :: LlvmCmpOp
-- | Signed less than or equal
LM_CMP_Sle :: LlvmCmpOp
-- | Float equal
LM_CMP_Feq :: LlvmCmpOp
-- | Float not equal
LM_CMP_Fne :: LlvmCmpOp
-- | Float greater than
LM_CMP_Fgt :: LlvmCmpOp
-- | Float greater than or equal
LM_CMP_Fge :: LlvmCmpOp
-- | Float less than
LM_CMP_Flt :: LlvmCmpOp
-- | Float less than or equal
LM_CMP_Fle :: LlvmCmpOp
-- | Llvm cast operations.
data LlvmCastOp
-- | Integer truncate
LM_Trunc :: LlvmCastOp
-- | Integer extend (zero fill)
LM_Zext :: LlvmCastOp
-- | Integer extend (sign fill)
LM_Sext :: LlvmCastOp
-- | Float truncate
LM_Fptrunc :: LlvmCastOp
-- | Float extend
LM_Fpext :: LlvmCastOp
-- | Float to unsigned Integer
LM_Fptoui :: LlvmCastOp
-- | Float to signed Integer
LM_Fptosi :: LlvmCastOp
-- | Unsigned Integer to Float
LM_Uitofp :: LlvmCastOp
-- | Signed Int to Float
LM_Sitofp :: LlvmCastOp
-- | Pointer to Integer
LM_Ptrtoint :: LlvmCastOp
-- | Integer to Pointer
LM_Inttoptr :: LlvmCastOp
-- | Cast between types where no bit manipulation is needed
LM_Bitcast :: LlvmCastOp
-- | Convert a Haskell Double to an LLVM hex encoded floating point form.
-- In Llvm float literals can be printed in a big-endian hexadecimal
-- format, regardless of underlying architecture.
--
-- See Note [LLVM Float Types].
ppDouble :: Double -> SDoc
narrowFp :: Double -> Float
widenFp :: Float -> Double
ppFloat :: Float -> SDoc
-- | Reverse or leave byte data alone to fix endianness on this target.
fixEndian :: [a] -> [a]
ppCommaJoin :: (Outputable a) => [a] -> SDoc
ppSpaceJoin :: (Outputable a) => [a] -> SDoc
instance GHC.Classes.Eq Llvm.Types.LlvmCastOp
instance GHC.Classes.Eq Llvm.Types.LlvmCmpOp
instance GHC.Classes.Eq Llvm.Types.LlvmMachOp
instance GHC.Classes.Eq Llvm.Types.LlvmVar
instance GHC.Classes.Eq Llvm.Types.LlvmLit
instance GHC.Classes.Eq Llvm.Types.LlvmType
instance GHC.Classes.Eq Llvm.Types.LlvmFunctionDecl
instance GHC.Classes.Eq Llvm.Types.LlvmLinkageType
instance GHC.Show.Show Llvm.Types.LlvmParameterListType
instance GHC.Classes.Eq Llvm.Types.LlvmParameterListType
instance GHC.Classes.Eq Llvm.Types.LlvmCallConvention
instance GHC.Show.Show Llvm.Types.LlvmCallType
instance GHC.Classes.Eq Llvm.Types.LlvmCallType
instance GHC.Classes.Eq Llvm.Types.LlvmFuncAttr
instance GHC.Classes.Eq Llvm.Types.LlvmParamAttr
instance GHC.Classes.Eq Llvm.Types.LMConst
instance Outputable.Outputable Llvm.Types.LlvmCastOp
instance Outputable.Outputable Llvm.Types.LlvmCmpOp
instance Outputable.Outputable Llvm.Types.LlvmMachOp
instance Outputable.Outputable Llvm.Types.LlvmStatic
instance Outputable.Outputable Llvm.Types.LlvmVar
instance Outputable.Outputable Llvm.Types.LlvmLit
instance Outputable.Outputable Llvm.Types.LlvmType
instance Outputable.Outputable Llvm.Types.LlvmFunctionDecl
instance Outputable.Outputable Llvm.Types.LlvmLinkageType
instance Outputable.Outputable Llvm.Types.LlvmCallConvention
instance Outputable.Outputable Llvm.Types.LlvmFuncAttr
instance Outputable.Outputable Llvm.Types.LlvmParamAttr
module Llvm.MetaData
-- | A reference to an un-named metadata node.
newtype MetaId
MetaId :: Int -> MetaId
-- | LLVM metadata expressions
data MetaExpr
MetaStr :: !LMString -> MetaExpr
MetaNode :: !MetaId -> MetaExpr
MetaVar :: !LlvmVar -> MetaExpr
MetaStruct :: [MetaExpr] -> MetaExpr
-- | Associates some metadata with a specific label for attaching to an
-- instruction.
data MetaAnnot
MetaAnnot :: LMString -> MetaExpr -> MetaAnnot
-- | Metadata declarations. Metadata can only be declared in global scope.
data MetaDecl
-- | Named metadata. Only used for communicating module information to
-- LLVM. ('!name = !{ [!n] }' form).
MetaNamed :: !LMString -> [MetaId] -> MetaDecl
-- | Metadata node declaration. ('!0 = metadata !{ expression }'
-- form).
MetaUnnamed :: !MetaId -> !MetaExpr -> MetaDecl
instance GHC.Classes.Eq Llvm.MetaData.MetaAnnot
instance GHC.Classes.Eq Llvm.MetaData.MetaExpr
instance GHC.Enum.Enum Llvm.MetaData.MetaId
instance GHC.Classes.Ord Llvm.MetaData.MetaId
instance GHC.Classes.Eq Llvm.MetaData.MetaId
instance Outputable.Outputable Llvm.MetaData.MetaExpr
instance Outputable.Outputable Llvm.MetaData.MetaId
-- | The LLVM abstract syntax.
module Llvm.AbsSyn
-- | Block labels
type LlvmBlockId = Unique
-- | A block of LLVM code.
data LlvmBlock
LlvmBlock :: LlvmBlockId -> [LlvmStatement] -> LlvmBlock
-- | The code label for this block
[blockLabel] :: LlvmBlock -> LlvmBlockId
-- | A list of LlvmStatement's representing the code for this block. This
-- list must end with a control flow statement.
[blockStmts] :: LlvmBlock -> [LlvmStatement]
type LlvmBlocks = [LlvmBlock]
-- | An LLVM Module. This is a top level container in LLVM.
data LlvmModule
LlvmModule :: [LMString] -> [LlvmAlias] -> [MetaDecl] -> [LMGlobal] -> LlvmFunctionDecls -> LlvmFunctions -> LlvmModule
-- | Comments to include at the start of the module.
[modComments] :: LlvmModule -> [LMString]
-- | LLVM Alias type definitions.
[modAliases] :: LlvmModule -> [LlvmAlias]
-- | LLVM meta data.
[modMeta] :: LlvmModule -> [MetaDecl]
-- | Global variables to include in the module.
[modGlobals] :: LlvmModule -> [LMGlobal]
-- | LLVM Functions used in this module but defined in other modules.
[modFwdDecls] :: LlvmModule -> LlvmFunctionDecls
-- | LLVM Functions defined in this module.
[modFuncs] :: LlvmModule -> LlvmFunctions
-- | An LLVM Function
data LlvmFunction
LlvmFunction :: LlvmFunctionDecl -> [LMString] -> [LlvmFuncAttr] -> LMSection -> Maybe LlvmStatic -> LlvmBlocks -> LlvmFunction
-- | The signature of this declared function.
[funcDecl] :: LlvmFunction -> LlvmFunctionDecl
-- | The functions arguments
[funcArgs] :: LlvmFunction -> [LMString]
-- | The function attributes.
[funcAttrs] :: LlvmFunction -> [LlvmFuncAttr]
-- | The section to put the function into,
[funcSect] :: LlvmFunction -> LMSection
-- | Prefix data
[funcPrefix] :: LlvmFunction -> Maybe LlvmStatic
-- | The body of the functions.
[funcBody] :: LlvmFunction -> LlvmBlocks
type LlvmFunctions = [LlvmFunction]
type SingleThreaded = Bool
-- | LLVM ordering types for synchronization purposes. (Introduced in LLVM
-- 3.0). Please see the LLVM documentation for a better description.
data LlvmSyncOrdering
-- | Some partial order of operations exists.
SyncUnord :: LlvmSyncOrdering
-- | A single total order for operations at a single address exists.
SyncMonotonic :: LlvmSyncOrdering
-- | Acquire synchronization operation.
SyncAcquire :: LlvmSyncOrdering
-- | Release synchronization operation.
SyncRelease :: LlvmSyncOrdering
-- | Acquire + Release synchronization operation.
SyncAcqRel :: LlvmSyncOrdering
-- | Full sequential Consistency operation.
SyncSeqCst :: LlvmSyncOrdering
-- | LLVM atomic operations. Please see the atomicrmw instruction
-- in the LLVM documentation for a complete description.
data LlvmAtomicOp
LAO_Xchg :: LlvmAtomicOp
LAO_Add :: LlvmAtomicOp
LAO_Sub :: LlvmAtomicOp
LAO_And :: LlvmAtomicOp
LAO_Nand :: LlvmAtomicOp
LAO_Or :: LlvmAtomicOp
LAO_Xor :: LlvmAtomicOp
LAO_Max :: LlvmAtomicOp
LAO_Min :: LlvmAtomicOp
LAO_Umax :: LlvmAtomicOp
LAO_Umin :: LlvmAtomicOp
-- | Llvm Statements
data LlvmStatement
-- | Assign an expression to an variable: * dest: Variable to assign to *
-- source: Source expression
Assignment :: LlvmVar -> LlvmExpression -> LlvmStatement
-- | Memory fence operation
Fence :: Bool -> LlvmSyncOrdering -> LlvmStatement
-- | Always branch to the target label
Branch :: LlvmVar -> LlvmStatement
-- | Branch to label targetTrue if cond is true otherwise to label
-- targetFalse * cond: condition that will be tested, must be of type i1
-- * targetTrue: label to branch to if cond is true * targetFalse: label
-- to branch to if cond is false
BranchIf :: LlvmVar -> LlvmVar -> LlvmVar -> LlvmStatement
-- | Comment Plain comment.
Comment :: [LMString] -> LlvmStatement
-- | Set a label on this position. * name: Identifier of this label, unique
-- for this module
MkLabel :: LlvmBlockId -> LlvmStatement
-- | Store variable value in pointer ptr. If value is of type t then ptr
-- must be of type t*. * value: Variable/Constant to store. * ptr:
-- Location to store the value in
Store :: LlvmVar -> LlvmVar -> LlvmStatement
-- | Multiway branch * scrutinee: Variable or constant which must be of
-- integer type that is determines which arm is chosen. * def: The
-- default label if there is no match in target. * target: A list of
-- (value,label) where the value is an integer constant and label the
-- corresponding label to jump to if the scrutinee matches the value.
Switch :: LlvmVar -> LlvmVar -> [(LlvmVar, LlvmVar)] -> LlvmStatement
-- | Return a result. * result: The variable or constant to return
Return :: (Maybe LlvmVar) -> LlvmStatement
-- | An instruction for the optimizer that the code following is not
-- reachable
Unreachable :: LlvmStatement
-- | Raise an expression to a statement (if don't want result or want to
-- use Llvm unnamed values.
Expr :: LlvmExpression -> LlvmStatement
-- | A nop LLVM statement. Useful as its often more efficient to use this
-- then to wrap LLvmStatement in a Just or [].
Nop :: LlvmStatement
-- | A LLVM statement with metadata attached to it.
MetaStmt :: [MetaAnnot] -> LlvmStatement -> LlvmStatement
-- | Llvm Expressions
data LlvmExpression
-- | Allocate amount * sizeof(tp) bytes on the stack * tp: LlvmType to
-- reserve room for * amount: The nr of tp's which must be allocated
Alloca :: LlvmType -> Int -> LlvmExpression
-- | Perform the machine operator op on the operands left and right * op:
-- operator * left: left operand * right: right operand
LlvmOp :: LlvmMachOp -> LlvmVar -> LlvmVar -> LlvmExpression
-- | Perform a compare operation on the operands left and right * op:
-- operator * left: left operand * right: right operand
Compare :: LlvmCmpOp -> LlvmVar -> LlvmVar -> LlvmExpression
-- | Extract a scalar element from a vector * val: The vector * idx: The
-- index of the scalar within the vector
Extract :: LlvmVar -> LlvmVar -> LlvmExpression
-- | Extract a scalar element from a structure * val: The structure * idx:
-- The index of the scalar within the structure Corresponds to
-- "extractvalue" instruction.
ExtractV :: LlvmVar -> Int -> LlvmExpression
-- | Insert a scalar element into a vector * val: The source vector * elt:
-- The scalar to insert * index: The index at which to insert the scalar
Insert :: LlvmVar -> LlvmVar -> LlvmVar -> LlvmExpression
-- | Allocate amount * sizeof(tp) bytes on the heap * tp: LlvmType to
-- reserve room for * amount: The nr of tp's which must be allocated
Malloc :: LlvmType -> Int -> LlvmExpression
-- | Load the value at location ptr
Load :: LlvmVar -> LlvmExpression
-- | Atomic load of the value at location ptr
ALoad :: LlvmSyncOrdering -> SingleThreaded -> LlvmVar -> LlvmExpression
-- | Navigate in an structure, selecting elements * inbound: Is the pointer
-- inbounds? (computed pointer doesn't overflow) * ptr: Location of the
-- structure * indexes: A list of indexes to select the correct value.
GetElemPtr :: Bool -> LlvmVar -> [LlvmVar] -> LlvmExpression
-- | Cast the variable from to the to type. This is an abstraction of three
-- cast operators in Llvm, inttoptr, prttoint and bitcast. * cast: Cast
-- type * from: Variable to cast * to: type to cast to
Cast :: LlvmCastOp -> LlvmVar -> LlvmType -> LlvmExpression
-- | Atomic read-modify-write operation * op: Atomic operation * addr:
-- Address to modify * operand: Operand to operation * ordering: Ordering
-- requirement
AtomicRMW :: LlvmAtomicOp -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmExpression
-- | Compare-and-exchange operation * addr: Address to modify * old:
-- Expected value * new: New value * suc_ord: Ordering required in
-- success case * fail_ord: Ordering required in failure case, can be no
-- stronger than suc_ord
--
-- Result is an i1, true if store was successful.
CmpXChg :: LlvmVar -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmSyncOrdering -> LlvmExpression
-- | Call a function. The result is the value of the expression. *
-- tailJumps: CallType to signal if the function should be tail called *
-- fnptrval: An LLVM value containing a pointer to a function to be
-- invoked. Can be indirect. Should be LMFunction type. * args: Concrete
-- arguments for the parameters * attrs: A list of function attributes
-- for the call. Only NoReturn, NoUnwind, ReadOnly and ReadNone are valid
-- here.
Call :: LlvmCallType -> LlvmVar -> [LlvmVar] -> [LlvmFuncAttr] -> LlvmExpression
-- | Call a function as above but potentially taking metadata as arguments.
-- * tailJumps: CallType to signal if the function should be tail called
-- * fnptrval: An LLVM value containing a pointer to a function to be
-- invoked. Can be indirect. Should be LMFunction type. * args: Arguments
-- that may include metadata. * attrs: A list of function attributes for
-- the call. Only NoReturn, NoUnwind, ReadOnly and ReadNone are valid
-- here.
CallM :: LlvmCallType -> LlvmVar -> [MetaExpr] -> [LlvmFuncAttr] -> LlvmExpression
-- | Merge variables from different basic blocks which are predecessors of
-- this basic block in a new variable of type tp. * tp: type of the
-- merged variable, must match the types of the predecessor variables. *
-- precessors: A list of variables and the basic block that they
-- originate from.
Phi :: LlvmType -> [(LlvmVar, LlvmVar)] -> LlvmExpression
-- | Inline assembly expression. Syntax is very similar to the style used
-- by GCC. * assembly: Actual inline assembly code. * constraints:
-- Operand constraints. * return ty: Return type of function. * vars: Any
-- variables involved in the assembly code. * sideeffect: Does the
-- expression have side effects not visible from the constraints list. *
-- alignstack: Should the stack be conservatively aligned before this
-- expression is executed.
Asm :: LMString -> LMString -> LlvmType -> [LlvmVar] -> Bool -> Bool -> LlvmExpression
-- | A LLVM expression with metadata attached to it.
MExpr :: [MetaAnnot] -> LlvmExpression -> LlvmExpression
instance GHC.Classes.Eq Llvm.AbsSyn.LlvmStatement
instance GHC.Classes.Eq Llvm.AbsSyn.LlvmExpression
instance GHC.Classes.Eq Llvm.AbsSyn.LlvmAtomicOp
instance GHC.Show.Show Llvm.AbsSyn.LlvmAtomicOp
instance GHC.Classes.Eq Llvm.AbsSyn.LlvmSyncOrdering
instance GHC.Show.Show Llvm.AbsSyn.LlvmSyncOrdering
-- | Pretty print LLVM IR Code.
module Llvm.PpLlvm
-- | Print out a whole LLVM module.
ppLlvmModule :: LlvmModule -> SDoc
-- | Print out a multi-line comment, can be inside a function or on its own
ppLlvmComments :: [LMString] -> SDoc
-- | Print out a comment, can be inside a function or on its own
ppLlvmComment :: LMString -> SDoc
-- | Print out a list of global mutable variable definitions
ppLlvmGlobals :: [LMGlobal] -> SDoc
-- | Print out a global mutable variable definition
ppLlvmGlobal :: LMGlobal -> SDoc
-- | Print out a list of LLVM type aliases.
ppLlvmAliases :: [LlvmAlias] -> SDoc
-- | Print out an LLVM type alias.
ppLlvmAlias :: LlvmAlias -> SDoc
-- | Print out a list of LLVM metadata.
ppLlvmMetas :: [MetaDecl] -> SDoc
-- | Print out an LLVM metadata definition.
ppLlvmMeta :: MetaDecl -> SDoc
-- | Print out a list of function declaration.
ppLlvmFunctionDecls :: LlvmFunctionDecls -> SDoc
-- | Print out a function declaration. Declarations define the function
-- type but don't define the actual body of the function.
ppLlvmFunctionDecl :: LlvmFunctionDecl -> SDoc
-- | Print out a list of function definitions.
ppLlvmFunctions :: LlvmFunctions -> SDoc
-- | Print out a function definition.
ppLlvmFunction :: LlvmFunction -> SDoc
-- | This module supplies bindings to generate Llvm IR from Haskell
-- (http://www.llvm.org/docs/LangRef.html).
--
-- Note: this module is developed in a demand driven way. It is no
-- complete LLVM binding library in Haskell, but enough to generate code
-- for GHC.
--
-- This code is derived from code taken from the Essential Haskell
-- Compiler (EHC) project (http://www.cs.uu.nl/wiki/Ehc/WebHome).
module Llvm
-- | An LLVM Module. This is a top level container in LLVM.
data LlvmModule
LlvmModule :: [LMString] -> [LlvmAlias] -> [MetaDecl] -> [LMGlobal] -> LlvmFunctionDecls -> LlvmFunctions -> LlvmModule
-- | Comments to include at the start of the module.
[modComments] :: LlvmModule -> [LMString]
-- | LLVM Alias type definitions.
[modAliases] :: LlvmModule -> [LlvmAlias]
-- | LLVM meta data.
[modMeta] :: LlvmModule -> [MetaDecl]
-- | Global variables to include in the module.
[modGlobals] :: LlvmModule -> [LMGlobal]
-- | LLVM Functions used in this module but defined in other modules.
[modFwdDecls] :: LlvmModule -> LlvmFunctionDecls
-- | LLVM Functions defined in this module.
[modFuncs] :: LlvmModule -> LlvmFunctions
-- | An LLVM Function
data LlvmFunction
LlvmFunction :: LlvmFunctionDecl -> [LMString] -> [LlvmFuncAttr] -> LMSection -> Maybe LlvmStatic -> LlvmBlocks -> LlvmFunction
-- | The signature of this declared function.
[funcDecl] :: LlvmFunction -> LlvmFunctionDecl
-- | The functions arguments
[funcArgs] :: LlvmFunction -> [LMString]
-- | The function attributes.
[funcAttrs] :: LlvmFunction -> [LlvmFuncAttr]
-- | The section to put the function into,
[funcSect] :: LlvmFunction -> LMSection
-- | Prefix data
[funcPrefix] :: LlvmFunction -> Maybe LlvmStatic
-- | The body of the functions.
[funcBody] :: LlvmFunction -> LlvmBlocks
-- | An LLVM Function
data LlvmFunctionDecl
LlvmFunctionDecl :: LMString -> LlvmLinkageType -> LlvmCallConvention -> LlvmType -> LlvmParameterListType -> [LlvmParameter] -> LMAlign -> LlvmFunctionDecl
-- | Unique identifier of the function
[decName] :: LlvmFunctionDecl -> LMString
-- | LinkageType of the function
[funcLinkage] :: LlvmFunctionDecl -> LlvmLinkageType
-- | The calling convention of the function
[funcCc] :: LlvmFunctionDecl -> LlvmCallConvention
-- | Type of the returned value
[decReturnType] :: LlvmFunctionDecl -> LlvmType
-- | Indicates if this function uses varargs
[decVarargs] :: LlvmFunctionDecl -> LlvmParameterListType
-- | Parameter types and attributes
[decParams] :: LlvmFunctionDecl -> [LlvmParameter]
-- | Function align value, must be power of 2
[funcAlign] :: LlvmFunctionDecl -> LMAlign
type LlvmFunctions = [LlvmFunction]
type LlvmFunctionDecls = [LlvmFunctionDecl]
-- | Llvm Statements
data LlvmStatement
-- | Assign an expression to an variable: * dest: Variable to assign to *
-- source: Source expression
Assignment :: LlvmVar -> LlvmExpression -> LlvmStatement
-- | Memory fence operation
Fence :: Bool -> LlvmSyncOrdering -> LlvmStatement
-- | Always branch to the target label
Branch :: LlvmVar -> LlvmStatement
-- | Branch to label targetTrue if cond is true otherwise to label
-- targetFalse * cond: condition that will be tested, must be of type i1
-- * targetTrue: label to branch to if cond is true * targetFalse: label
-- to branch to if cond is false
BranchIf :: LlvmVar -> LlvmVar -> LlvmVar -> LlvmStatement
-- | Comment Plain comment.
Comment :: [LMString] -> LlvmStatement
-- | Set a label on this position. * name: Identifier of this label, unique
-- for this module
MkLabel :: LlvmBlockId -> LlvmStatement
-- | Store variable value in pointer ptr. If value is of type t then ptr
-- must be of type t*. * value: Variable/Constant to store. * ptr:
-- Location to store the value in
Store :: LlvmVar -> LlvmVar -> LlvmStatement
-- | Multiway branch * scrutinee: Variable or constant which must be of
-- integer type that is determines which arm is chosen. * def: The
-- default label if there is no match in target. * target: A list of
-- (value,label) where the value is an integer constant and label the
-- corresponding label to jump to if the scrutinee matches the value.
Switch :: LlvmVar -> LlvmVar -> [(LlvmVar, LlvmVar)] -> LlvmStatement
-- | Return a result. * result: The variable or constant to return
Return :: (Maybe LlvmVar) -> LlvmStatement
-- | An instruction for the optimizer that the code following is not
-- reachable
Unreachable :: LlvmStatement
-- | Raise an expression to a statement (if don't want result or want to
-- use Llvm unnamed values.
Expr :: LlvmExpression -> LlvmStatement
-- | A nop LLVM statement. Useful as its often more efficient to use this
-- then to wrap LLvmStatement in a Just or [].
Nop :: LlvmStatement
-- | A LLVM statement with metadata attached to it.
MetaStmt :: [MetaAnnot] -> LlvmStatement -> LlvmStatement
-- | Llvm Expressions
data LlvmExpression
-- | Allocate amount * sizeof(tp) bytes on the stack * tp: LlvmType to
-- reserve room for * amount: The nr of tp's which must be allocated
Alloca :: LlvmType -> Int -> LlvmExpression
-- | Perform the machine operator op on the operands left and right * op:
-- operator * left: left operand * right: right operand
LlvmOp :: LlvmMachOp -> LlvmVar -> LlvmVar -> LlvmExpression
-- | Perform a compare operation on the operands left and right * op:
-- operator * left: left operand * right: right operand
Compare :: LlvmCmpOp -> LlvmVar -> LlvmVar -> LlvmExpression
-- | Extract a scalar element from a vector * val: The vector * idx: The
-- index of the scalar within the vector
Extract :: LlvmVar -> LlvmVar -> LlvmExpression
-- | Extract a scalar element from a structure * val: The structure * idx:
-- The index of the scalar within the structure Corresponds to
-- "extractvalue" instruction.
ExtractV :: LlvmVar -> Int -> LlvmExpression
-- | Insert a scalar element into a vector * val: The source vector * elt:
-- The scalar to insert * index: The index at which to insert the scalar
Insert :: LlvmVar -> LlvmVar -> LlvmVar -> LlvmExpression
-- | Allocate amount * sizeof(tp) bytes on the heap * tp: LlvmType to
-- reserve room for * amount: The nr of tp's which must be allocated
Malloc :: LlvmType -> Int -> LlvmExpression
-- | Load the value at location ptr
Load :: LlvmVar -> LlvmExpression
-- | Atomic load of the value at location ptr
ALoad :: LlvmSyncOrdering -> SingleThreaded -> LlvmVar -> LlvmExpression
-- | Navigate in an structure, selecting elements * inbound: Is the pointer
-- inbounds? (computed pointer doesn't overflow) * ptr: Location of the
-- structure * indexes: A list of indexes to select the correct value.
GetElemPtr :: Bool -> LlvmVar -> [LlvmVar] -> LlvmExpression
-- | Cast the variable from to the to type. This is an abstraction of three
-- cast operators in Llvm, inttoptr, prttoint and bitcast. * cast: Cast
-- type * from: Variable to cast * to: type to cast to
Cast :: LlvmCastOp -> LlvmVar -> LlvmType -> LlvmExpression
-- | Atomic read-modify-write operation * op: Atomic operation * addr:
-- Address to modify * operand: Operand to operation * ordering: Ordering
-- requirement
AtomicRMW :: LlvmAtomicOp -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmExpression
-- | Compare-and-exchange operation * addr: Address to modify * old:
-- Expected value * new: New value * suc_ord: Ordering required in
-- success case * fail_ord: Ordering required in failure case, can be no
-- stronger than suc_ord
--
-- Result is an i1, true if store was successful.
CmpXChg :: LlvmVar -> LlvmVar -> LlvmVar -> LlvmSyncOrdering -> LlvmSyncOrdering -> LlvmExpression
-- | Call a function. The result is the value of the expression. *
-- tailJumps: CallType to signal if the function should be tail called *
-- fnptrval: An LLVM value containing a pointer to a function to be
-- invoked. Can be indirect. Should be LMFunction type. * args: Concrete
-- arguments for the parameters * attrs: A list of function attributes
-- for the call. Only NoReturn, NoUnwind, ReadOnly and ReadNone are valid
-- here.
Call :: LlvmCallType -> LlvmVar -> [LlvmVar] -> [LlvmFuncAttr] -> LlvmExpression
-- | Call a function as above but potentially taking metadata as arguments.
-- * tailJumps: CallType to signal if the function should be tail called
-- * fnptrval: An LLVM value containing a pointer to a function to be
-- invoked. Can be indirect. Should be LMFunction type. * args: Arguments
-- that may include metadata. * attrs: A list of function attributes for
-- the call. Only NoReturn, NoUnwind, ReadOnly and ReadNone are valid
-- here.
CallM :: LlvmCallType -> LlvmVar -> [MetaExpr] -> [LlvmFuncAttr] -> LlvmExpression
-- | Merge variables from different basic blocks which are predecessors of
-- this basic block in a new variable of type tp. * tp: type of the
-- merged variable, must match the types of the predecessor variables. *
-- precessors: A list of variables and the basic block that they
-- originate from.
Phi :: LlvmType -> [(LlvmVar, LlvmVar)] -> LlvmExpression
-- | Inline assembly expression. Syntax is very similar to the style used
-- by GCC. * assembly: Actual inline assembly code. * constraints:
-- Operand constraints. * return ty: Return type of function. * vars: Any
-- variables involved in the assembly code. * sideeffect: Does the
-- expression have side effects not visible from the constraints list. *
-- alignstack: Should the stack be conservatively aligned before this
-- expression is executed.
Asm :: LMString -> LMString -> LlvmType -> [LlvmVar] -> Bool -> Bool -> LlvmExpression
-- | A LLVM expression with metadata attached to it.
MExpr :: [MetaAnnot] -> LlvmExpression -> LlvmExpression
type LlvmBlocks = [LlvmBlock]
-- | A block of LLVM code.
data LlvmBlock
LlvmBlock :: LlvmBlockId -> [LlvmStatement] -> LlvmBlock
-- | The code label for this block
[blockLabel] :: LlvmBlock -> LlvmBlockId
-- | A list of LlvmStatement's representing the code for this block. This
-- list must end with a control flow statement.
[blockStmts] :: LlvmBlock -> [LlvmStatement]
-- | Block labels
type LlvmBlockId = Unique
-- | LLVM Parameter Attributes.
--
-- Parameter attributes are used to communicate additional information
-- about the result or parameters of a function
data LlvmParamAttr
-- | This indicates to the code generator that the parameter or return
-- value should be zero-extended to a 32-bit value by the caller (for a
-- parameter) or the callee (for a return value).
ZeroExt :: LlvmParamAttr
-- | This indicates to the code generator that the parameter or return
-- value should be sign-extended to a 32-bit value by the caller (for a
-- parameter) or the callee (for a return value).
SignExt :: LlvmParamAttr
-- | This indicates that this parameter or return value should be treated
-- in a special target-dependent fashion during while emitting code for a
-- function call or return (usually, by putting it in a register as
-- opposed to memory).
InReg :: LlvmParamAttr
-- | This indicates that the pointer parameter should really be passed by
-- value to the function.
ByVal :: LlvmParamAttr
-- | This indicates that the pointer parameter specifies the address of a
-- structure that is the return value of the function in the source
-- program.
SRet :: LlvmParamAttr
-- | This indicates that the pointer does not alias any global or any other
-- parameter.
NoAlias :: LlvmParamAttr
-- | This indicates that the callee does not make any copies of the pointer
-- that outlive the callee itself
NoCapture :: LlvmParamAttr
-- | This indicates that the pointer parameter can be excised using the
-- trampoline intrinsics.
Nest :: LlvmParamAttr
type LlvmParameter = (LlvmType, [LlvmParamAttr])
-- | LLVM atomic operations. Please see the atomicrmw instruction
-- in the LLVM documentation for a complete description.
data LlvmAtomicOp
LAO_Xchg :: LlvmAtomicOp
LAO_Add :: LlvmAtomicOp
LAO_Sub :: LlvmAtomicOp
LAO_And :: LlvmAtomicOp
LAO_Nand :: LlvmAtomicOp
LAO_Or :: LlvmAtomicOp
LAO_Xor :: LlvmAtomicOp
LAO_Max :: LlvmAtomicOp
LAO_Min :: LlvmAtomicOp
LAO_Umax :: LlvmAtomicOp
LAO_Umin :: LlvmAtomicOp
-- | LLVM ordering types for synchronization purposes. (Introduced in LLVM
-- 3.0). Please see the LLVM documentation for a better description.
data LlvmSyncOrdering
-- | Some partial order of operations exists.
SyncUnord :: LlvmSyncOrdering
-- | A single total order for operations at a single address exists.
SyncMonotonic :: LlvmSyncOrdering
-- | Acquire synchronization operation.
SyncAcquire :: LlvmSyncOrdering
-- | Release synchronization operation.
SyncRelease :: LlvmSyncOrdering
-- | Acquire + Release synchronization operation.
SyncAcqRel :: LlvmSyncOrdering
-- | Full sequential Consistency operation.
SyncSeqCst :: LlvmSyncOrdering
-- | Different calling conventions a function can use.
data LlvmCallConvention
-- | The C calling convention. This calling convention (the default if no
-- other calling convention is specified) matches the target C calling
-- conventions. This calling convention supports varargs function calls
-- and tolerates some mismatch in the declared prototype and implemented
-- declaration of the function (as does normal C).
CC_Ccc :: LlvmCallConvention
-- | This calling convention attempts to make calls as fast as possible
-- (e.g. by passing things in registers). This calling convention allows
-- the target to use whatever tricks it wants to produce fast code for
-- the target, without having to conform to an externally specified ABI
-- (Application Binary Interface). Implementations of this convention
-- should allow arbitrary tail call optimization to be supported. This
-- calling convention does not support varargs and requires the prototype
-- of al callees to exactly match the prototype of the function
-- definition.
CC_Fastcc :: LlvmCallConvention
-- | This calling convention attempts to make code in the caller as
-- efficient as possible under the assumption that the call is not
-- commonly executed. As such, these calls often preserve all registers
-- so that the call does not break any live ranges in the caller side.
-- This calling convention does not support varargs and requires the
-- prototype of all callees to exactly match the prototype of the
-- function definition.
CC_Coldcc :: LlvmCallConvention
-- | The GHC-specific registerised calling convention.
CC_Ghc :: LlvmCallConvention
-- | Any calling convention may be specified by number, allowing
-- target-specific calling conventions to be used. Target specific
-- calling conventions start at 64.
CC_Ncc :: Int -> LlvmCallConvention
-- | X86 Specific StdCall convention. LLVM includes a specific alias
-- for it rather than just using CC_Ncc.
CC_X86_Stdcc :: LlvmCallConvention
-- | Different types to call a function.
data LlvmCallType
-- | Normal call, allocate a new stack frame.
StdCall :: LlvmCallType
-- | Tail call, perform the call in the current stack frame.
TailCall :: LlvmCallType
-- | Functions can have a fixed amount of parameters, or a variable amount.
data LlvmParameterListType
FixedArgs :: LlvmParameterListType
VarArgs :: LlvmParameterListType
-- | Linkage type of a symbol.
--
-- The description of the constructors is copied from the Llvm Assembly
-- Language Reference Manual
-- http://www.llvm.org/docs/LangRef.html#linkage, because they
-- correspond to the Llvm linkage types.
data LlvmLinkageType
-- | Global values with internal linkage are only directly accessible by
-- objects in the current module. In particular, linking code into a
-- module with an internal global value may cause the internal to be
-- renamed as necessary to avoid collisions. Because the symbol is
-- internal to the module, all references can be updated. This
-- corresponds to the notion of the static keyword in C.
Internal :: LlvmLinkageType
-- | Globals with linkonce linkage are merged with other globals
-- of the same name when linkage occurs. This is typically used to
-- implement inline functions, templates, or other code which must be
-- generated in each translation unit that uses it. Unreferenced linkonce
-- globals are allowed to be discarded.
LinkOnce :: LlvmLinkageType
-- | weak linkage is exactly the same as linkonce linkage, except
-- that unreferenced weak globals may not be discarded. This is used for
-- globals that may be emitted in multiple translation units, but that
-- are not guaranteed to be emitted into every translation unit that uses
-- them. One example of this are common globals in C, such as int
-- X; at global scope.
Weak :: LlvmLinkageType
-- | appending linkage may only be applied to global variables of
-- pointer to array type. When two global variables with appending
-- linkage are linked together, the two global arrays are appended
-- together. This is the Llvm, typesafe, equivalent of having the system
-- linker append together sections with identical names when .o
-- files are linked.
Appending :: LlvmLinkageType
-- | The semantics of this linkage follow the ELF model: the symbol is weak
-- until linked, if not linked, the symbol becomes null instead of being
-- an undefined reference.
ExternWeak :: LlvmLinkageType
-- | The symbol participates in linkage and can be used to resolve external
-- symbol references.
ExternallyVisible :: LlvmLinkageType
-- | Alias for ExternallyVisible but with explicit textual form in
-- LLVM assembly.
External :: LlvmLinkageType
-- | Symbol is private to the module and should not appear in the symbol
-- table
Private :: LlvmLinkageType
-- | Llvm Function Attributes.
--
-- Function attributes are set to communicate additional information
-- about a function. Function attributes are considered to be part of the
-- function, not of the function type, so functions with different
-- parameter attributes can have the same function type. Functions can
-- have multiple attributes.
--
-- Descriptions taken from
-- http://llvm.org/docs/LangRef.html#fnattrs
data LlvmFuncAttr
-- | This attribute indicates that the inliner should attempt to inline
-- this function into callers whenever possible, ignoring any active
-- inlining size threshold for this caller.
AlwaysInline :: LlvmFuncAttr
-- | This attribute indicates that the source code contained a hint that
-- inlining this function is desirable (such as the "inline" keyword in
-- C/C++). It is just a hint; it imposes no requirements on the inliner.
InlineHint :: LlvmFuncAttr
-- | This attribute indicates that the inliner should never inline this
-- function in any situation. This attribute may not be used together
-- with the alwaysinline attribute.
NoInline :: LlvmFuncAttr
-- | This attribute suggests that optimization passes and code generator
-- passes make choices that keep the code size of this function low, and
-- otherwise do optimizations specifically to reduce code size.
OptSize :: LlvmFuncAttr
-- | This function attribute indicates that the function never returns
-- normally. This produces undefined behavior at runtime if the function
-- ever does dynamically return.
NoReturn :: LlvmFuncAttr
-- | This function attribute indicates that the function never returns with
-- an unwind or exceptional control flow. If the function does unwind,
-- its runtime behavior is undefined.
NoUnwind :: LlvmFuncAttr
-- | This attribute indicates that the function computes its result (or
-- decides to unwind an exception) based strictly on its arguments,
-- without dereferencing any pointer arguments or otherwise accessing any
-- mutable state (e.g. memory, control registers, etc) visible to caller
-- functions. It does not write through any pointer arguments (including
-- byval arguments) and never changes any state visible to callers. This
-- means that it cannot unwind exceptions by calling the C++ exception
-- throwing methods, but could use the unwind instruction.
ReadNone :: LlvmFuncAttr
-- | This attribute indicates that the function does not write through any
-- pointer arguments (including byval arguments) or otherwise modify any
-- state (e.g. memory, control registers, etc) visible to caller
-- functions. It may dereference pointer arguments and read state that
-- may be set in the caller. A readonly function always returns the same
-- value (or unwinds an exception identically) when called with the same
-- set of arguments and global state. It cannot unwind an exception by
-- calling the C++ exception throwing methods, but may use the unwind
-- instruction.
ReadOnly :: LlvmFuncAttr
-- | This attribute indicates that the function should emit a stack
-- smashing protector. It is in the form of a "canary"—a random value
-- placed on the stack before the local variables that's checked upon
-- return from the function to see if it has been overwritten. A
-- heuristic is used to determine if a function needs stack protectors or
-- not.
--
-- If a function that has an ssp attribute is inlined into a function
-- that doesn't have an ssp attribute, then the resulting function will
-- have an ssp attribute.
Ssp :: LlvmFuncAttr
-- | This attribute indicates that the function should always emit a stack
-- smashing protector. This overrides the ssp function attribute.
--
-- If a function that has an sspreq attribute is inlined into a function
-- that doesn't have an sspreq attribute or which has an ssp attribute,
-- then the resulting function will have an sspreq attribute.
SspReq :: LlvmFuncAttr
-- | This attribute indicates that the code generator should not use a red
-- zone, even if the target-specific ABI normally permits it.
NoRedZone :: LlvmFuncAttr
-- | This attributes disables implicit floating point instructions.
NoImplicitFloat :: LlvmFuncAttr
-- | This attribute disables prologue / epilogue emission for the function.
-- This can have very system-specific consequences.
Naked :: LlvmFuncAttr
-- | Llvm compare operations.
data LlvmCmpOp
-- | Equal (Signed and Unsigned)
LM_CMP_Eq :: LlvmCmpOp
-- | Not equal (Signed and Unsigned)
LM_CMP_Ne :: LlvmCmpOp
-- | Unsigned greater than
LM_CMP_Ugt :: LlvmCmpOp
-- | Unsigned greater than or equal
LM_CMP_Uge :: LlvmCmpOp
-- | Unsigned less than
LM_CMP_Ult :: LlvmCmpOp
-- | Unsigned less than or equal
LM_CMP_Ule :: LlvmCmpOp
-- | Signed greater than
LM_CMP_Sgt :: LlvmCmpOp
-- | Signed greater than or equal
LM_CMP_Sge :: LlvmCmpOp
-- | Signed less than
LM_CMP_Slt :: LlvmCmpOp
-- | Signed less than or equal
LM_CMP_Sle :: LlvmCmpOp
-- | Float equal
LM_CMP_Feq :: LlvmCmpOp
-- | Float not equal
LM_CMP_Fne :: LlvmCmpOp
-- | Float greater than
LM_CMP_Fgt :: LlvmCmpOp
-- | Float greater than or equal
LM_CMP_Fge :: LlvmCmpOp
-- | Float less than
LM_CMP_Flt :: LlvmCmpOp
-- | Float less than or equal
LM_CMP_Fle :: LlvmCmpOp
-- | Llvm binary operators machine operations.
data LlvmMachOp
-- | add two integer, floating point or vector values.
LM_MO_Add :: LlvmMachOp
-- | subtract two ...
LM_MO_Sub :: LlvmMachOp
-- | multiply ..
LM_MO_Mul :: LlvmMachOp
-- | unsigned integer or vector division.
LM_MO_UDiv :: LlvmMachOp
-- | signed integer ..
LM_MO_SDiv :: LlvmMachOp
-- | unsigned integer or vector remainder (mod)
LM_MO_URem :: LlvmMachOp
-- | signed ...
LM_MO_SRem :: LlvmMachOp
-- | add two floating point or vector values.
LM_MO_FAdd :: LlvmMachOp
-- | subtract two ...
LM_MO_FSub :: LlvmMachOp
-- | multiply ...
LM_MO_FMul :: LlvmMachOp
-- | divide ...
LM_MO_FDiv :: LlvmMachOp
-- | remainder ...
LM_MO_FRem :: LlvmMachOp
-- | Left shift
LM_MO_Shl :: LlvmMachOp
-- | Logical shift right Shift right, filling with zero
LM_MO_LShr :: LlvmMachOp
-- | Arithmetic shift right The most significant bits of the result will be
-- equal to the sign bit of the left operand.
LM_MO_AShr :: LlvmMachOp
-- | AND bitwise logical operation.
LM_MO_And :: LlvmMachOp
-- | OR bitwise logical operation.
LM_MO_Or :: LlvmMachOp
-- | XOR bitwise logical operation.
LM_MO_Xor :: LlvmMachOp
-- | Llvm cast operations.
data LlvmCastOp
-- | Integer truncate
LM_Trunc :: LlvmCastOp
-- | Integer extend (zero fill)
LM_Zext :: LlvmCastOp
-- | Integer extend (sign fill)
LM_Sext :: LlvmCastOp
-- | Float truncate
LM_Fptrunc :: LlvmCastOp
-- | Float extend
LM_Fpext :: LlvmCastOp
-- | Float to unsigned Integer
LM_Fptoui :: LlvmCastOp
-- | Float to signed Integer
LM_Fptosi :: LlvmCastOp
-- | Unsigned Integer to Float
LM_Uitofp :: LlvmCastOp
-- | Signed Int to Float
LM_Sitofp :: LlvmCastOp
-- | Pointer to Integer
LM_Ptrtoint :: LlvmCastOp
-- | Integer to Pointer
LM_Inttoptr :: LlvmCastOp
-- | Cast between types where no bit manipulation is needed
LM_Bitcast :: LlvmCastOp
-- | LLVM Variables
data LlvmVar
-- | Variables with a global scope.
LMGlobalVar :: LMString -> LlvmType -> LlvmLinkageType -> LMSection -> LMAlign -> LMConst -> LlvmVar
-- | Variables local to a function or parameters.
LMLocalVar :: Unique -> LlvmType -> LlvmVar
-- | Named local variables. Sometimes we need to be able to explicitly name
-- variables (e.g for function arguments).
LMNLocalVar :: LMString -> LlvmType -> LlvmVar
-- | A constant variable
LMLitVar :: LlvmLit -> LlvmVar
-- | Llvm Static Data.
--
-- These represent the possible global level variables and constants.
data LlvmStatic
-- | A comment in a static section
LMComment :: LMString -> LlvmStatic
-- | A static variant of a literal value
LMStaticLit :: LlvmLit -> LlvmStatic
-- | For uninitialised data
LMUninitType :: LlvmType -> LlvmStatic
-- | Defines a static LMString
LMStaticStr :: LMString -> LlvmType -> LlvmStatic
-- | A static array
LMStaticArray :: [LlvmStatic] -> LlvmType -> LlvmStatic
-- | A static structure type
LMStaticStruc :: [LlvmStatic] -> LlvmType -> LlvmStatic
-- | A pointer to other data
LMStaticPointer :: LlvmVar -> LlvmStatic
-- | Pointer to Pointer conversion
LMBitc :: LlvmStatic -> LlvmType -> LlvmStatic
-- | Pointer to Integer conversion
LMPtoI :: LlvmStatic -> LlvmType -> LlvmStatic
-- | Constant addition operation
LMAdd :: LlvmStatic -> LlvmStatic -> LlvmStatic
-- | Constant subtraction operation
LMSub :: LlvmStatic -> LlvmStatic -> LlvmStatic
-- | Llvm Literal Data.
--
-- These can be used inline in expressions.
data LlvmLit
-- | Refers to an integer constant (i64 42).
LMIntLit :: Integer -> LlvmType -> LlvmLit
-- | Floating point literal
LMFloatLit :: Double -> LlvmType -> LlvmLit
-- | Literal NULL, only applicable to pointer types
LMNullLit :: LlvmType -> LlvmLit
-- | Vector literal
LMVectorLit :: [LlvmLit] -> LlvmLit
-- | Undefined value, random bit pattern. Useful for optimisations.
LMUndefLit :: LlvmType -> LlvmLit
-- | Llvm Types
data LlvmType
-- | An integer with a given width in bits.
LMInt :: Int -> LlvmType
-- | 32 bit floating point
LMFloat :: LlvmType
-- | 64 bit floating point
LMDouble :: LlvmType
-- | 80 bit (x86 only) floating point
LMFloat80 :: LlvmType
-- | 128 bit floating point
LMFloat128 :: LlvmType
-- | A pointer to a LlvmType
LMPointer :: LlvmType -> LlvmType
-- | An array of LlvmType
LMArray :: Int -> LlvmType -> LlvmType
-- | A vector of LlvmType
LMVector :: Int -> LlvmType -> LlvmType
-- | A LlvmVar can represent a label (address)
LMLabel :: LlvmType
-- | Void type
LMVoid :: LlvmType
-- | Packed structure type
LMStruct :: [LlvmType] -> LlvmType
-- | Unpacked structure type
LMStructU :: [LlvmType] -> LlvmType
-- | A type alias
LMAlias :: LlvmAlias -> LlvmType
-- | LLVM Metadata
LMMetadata :: LlvmType
-- | Function type, used to create pointers to functions
LMFunction :: LlvmFunctionDecl -> LlvmType
-- | A type alias
type LlvmAlias = (LMString, LlvmType)
-- | A global mutable variable. Maybe defined or external
data LMGlobal
LMGlobal :: LlvmVar -> Maybe LlvmStatic -> LMGlobal
-- | Returns the variable of the LMGlobal
[getGlobalVar] :: LMGlobal -> LlvmVar
-- | Return the value of the LMGlobal
[getGlobalValue] :: LMGlobal -> Maybe LlvmStatic
-- | A String in LLVM
type LMString = FastString
-- | An LLVM section definition. If Nothing then let LLVM decide the
-- section
type LMSection = Maybe LMString
type LMAlign = Maybe Int
data LMConst
-- | Mutable global variable
Global :: LMConst
-- | Constant global variable
Constant :: LMConst
-- | Alias of another variable
Alias :: LMConst
i64 :: LlvmType
i32 :: LlvmType
i16 :: LlvmType
i8 :: LlvmType
i1 :: LlvmType
i8Ptr :: LlvmType
-- | The target architectures word size
llvmWord :: DynFlags -> LlvmType
-- | The target architectures word size
llvmWordPtr :: DynFlags -> LlvmType
-- | LLVM metadata expressions
data MetaExpr
MetaStr :: !LMString -> MetaExpr
MetaNode :: !MetaId -> MetaExpr
MetaVar :: !LlvmVar -> MetaExpr
MetaStruct :: [MetaExpr] -> MetaExpr
-- | Associates some metadata with a specific label for attaching to an
-- instruction.
data MetaAnnot
MetaAnnot :: LMString -> MetaExpr -> MetaAnnot
-- | Metadata declarations. Metadata can only be declared in global scope.
data MetaDecl
-- | Named metadata. Only used for communicating module information to
-- LLVM. ('!name = !{ [!n] }' form).
MetaNamed :: !LMString -> [MetaId] -> MetaDecl
-- | Metadata node declaration. ('!0 = metadata !{ expression }'
-- form).
MetaUnnamed :: !MetaId -> !MetaExpr -> MetaDecl
-- | A reference to an un-named metadata node.
newtype MetaId
MetaId :: Int -> MetaId
-- | Test if a LlvmVar is global.
isGlobal :: LlvmVar -> Bool
-- | Return the LlvmType of a LlvmLit
getLitType :: LlvmLit -> LlvmType
-- | Return the LlvmType of the LlvmVar
getVarType :: LlvmVar -> LlvmType
-- | Return the LlvmLinkageType for a LlvmVar
getLink :: LlvmVar -> LlvmLinkageType
-- | Return the LlvmType of the LlvmStatic
getStatType :: LlvmStatic -> LlvmType
-- | Lift a variable to LMPointer type.
pVarLift :: LlvmVar -> LlvmVar
-- | Lower a variable of LMPointer type.
pVarLower :: LlvmVar -> LlvmVar
-- | Add a pointer indirection to the supplied type. LMLabel and
-- LMVoid cannot be lifted.
pLift :: LlvmType -> LlvmType
-- | Remove the pointer indirection of the supplied type. Only
-- LMPointer constructors can be lowered.
pLower :: LlvmType -> LlvmType
-- | Test if the given LlvmType is an integer
isInt :: LlvmType -> Bool
-- | Test if the given LlvmType is a floating point type
isFloat :: LlvmType -> Bool
-- | Test if the given LlvmType is an LMPointer construct
isPointer :: LlvmType -> Bool
-- | Test if the given LlvmType is an LMVector construct
isVector :: LlvmType -> Bool
-- | Width in bits of an LlvmType, returns 0 if not applicable
llvmWidthInBits :: DynFlags -> LlvmType -> Int
-- | Print a literal value. No type.
ppLit :: LlvmLit -> SDoc
-- | Return the variable name or value of the LlvmVar in Llvm IR
-- textual representation (e.g. @x, %y or 42).
ppName :: LlvmVar -> SDoc
-- | Return the variable name or value of the LlvmVar in a plain
-- textual representation (e.g. x, y or 42).
ppPlainName :: LlvmVar -> SDoc
-- | Print out a whole LLVM module.
ppLlvmModule :: LlvmModule -> SDoc
-- | Print out a multi-line comment, can be inside a function or on its own
ppLlvmComments :: [LMString] -> SDoc
-- | Print out a comment, can be inside a function or on its own
ppLlvmComment :: LMString -> SDoc
-- | Print out a list of global mutable variable definitions
ppLlvmGlobals :: [LMGlobal] -> SDoc
-- | Print out a global mutable variable definition
ppLlvmGlobal :: LMGlobal -> SDoc
-- | Print out a list of function declaration.
ppLlvmFunctionDecls :: LlvmFunctionDecls -> SDoc
-- | Print out a function declaration. Declarations define the function
-- type but don't define the actual body of the function.
ppLlvmFunctionDecl :: LlvmFunctionDecl -> SDoc
-- | Print out a list of function definitions.
ppLlvmFunctions :: LlvmFunctions -> SDoc
-- | Print out a function definition.
ppLlvmFunction :: LlvmFunction -> SDoc
-- | Print out an LLVM type alias.
ppLlvmAlias :: LlvmAlias -> SDoc
-- | Print out a list of LLVM type aliases.
ppLlvmAliases :: [LlvmAlias] -> SDoc
-- | Print out a list of LLVM metadata.
ppLlvmMetas :: [MetaDecl] -> SDoc
-- | Print out an LLVM metadata definition.
ppLlvmMeta :: MetaDecl -> SDoc
-- | Deal with Cmm registers
module LlvmCodeGen.Regs
-- | Get the LlvmVar function argument storing the real register
lmGlobalRegArg :: DynFlags -> GlobalReg -> LlvmVar
-- | Get the LlvmVar function variable storing the real register
lmGlobalRegVar :: DynFlags -> GlobalReg -> LlvmVar
-- | A list of STG Registers that should always be considered alive
alwaysLive :: [GlobalReg]
-- | STG Type Based Alias Analysis hierarchy
stgTBAA :: [(Unique, LMString, Maybe Unique)]
-- | Id values The rootN node is the root (there can be more than
-- one) of the TBAA hierarchy and as of LLVM 4.0 should *only* be
-- referenced by other nodes. It should never occur in any LLVM
-- instruction statement.
baseN :: Unique
-- | Id values The rootN node is the root (there can be more than
-- one) of the TBAA hierarchy and as of LLVM 4.0 should *only* be
-- referenced by other nodes. It should never occur in any LLVM
-- instruction statement.
stackN :: Unique
-- | Id values The rootN node is the root (there can be more than
-- one) of the TBAA hierarchy and as of LLVM 4.0 should *only* be
-- referenced by other nodes. It should never occur in any LLVM
-- instruction statement.
heapN :: Unique
-- | Id values The rootN node is the root (there can be more than
-- one) of the TBAA hierarchy and as of LLVM 4.0 should *only* be
-- referenced by other nodes. It should never occur in any LLVM
-- instruction statement.
rxN :: Unique
-- | Id values The rootN node is the root (there can be more than
-- one) of the TBAA hierarchy and as of LLVM 4.0 should *only* be
-- referenced by other nodes. It should never occur in any LLVM
-- instruction statement.
topN :: Unique
-- | The TBAA metadata identifier
tbaa :: LMString
-- | Get the correct TBAA metadata information for this register type
getTBAA :: GlobalReg -> Unique
-- | Base LLVM Code Generation module
--
-- Contains functions useful through out the code generator.
module LlvmCodeGen.Base
type LlvmCmmDecl = GenCmmDecl [LlvmData] (Maybe CmmStatics) (ListGraph LlvmStatement)
type LlvmBasicBlock = GenBasicBlock LlvmStatement
-- | Global registers live on proc entry
type LiveGlobalRegs = [GlobalReg]
-- | Unresolved code. Of the form: (data label, data type, unresolved data)
type LlvmUnresData = (CLabel, Section, LlvmType, [UnresStatic])
-- | Top level LLVM Data (globals and type aliases)
type LlvmData = ([LMGlobal], [LlvmType])
-- | An unresolved Label.
--
-- Labels are unresolved when we haven't yet determined if they are
-- defined in the module we are currently compiling, or an external one.
type UnresLabel = CmmLit
type UnresStatic = Either UnresLabel LlvmStatic
-- | LLVM Version Number
type LlvmVersion = (Int, Int)
-- | The LLVM Version that is currently supported.
supportedLlvmVersion :: LlvmVersion
llvmVersionStr :: LlvmVersion -> String
-- | The Llvm monad. Wraps LlvmEnv state as well as the
-- IO monad
data LlvmM a
-- | Get initial Llvm environment.
runLlvm :: DynFlags -> LlvmVersion -> BufHandle -> UniqSupply -> LlvmM () -> IO ()
-- | Lift a stream into the LlvmM monad
liftStream :: Stream IO a x -> Stream LlvmM a x
-- | Clear variables from the environment for a subcomputation
withClearVars :: LlvmM a -> LlvmM a
-- | Lookup variables or functions in the environment.
varLookup :: Uniquable key => key -> LlvmM (Maybe LlvmType)
-- | Insert variables or functions into the environment.
varInsert :: Uniquable key => key -> LlvmType -> LlvmM ()
-- | Set a register as allocated on the stack
markStackReg :: GlobalReg -> LlvmM ()
-- | Check whether a register is allocated on the stack
checkStackReg :: GlobalReg -> LlvmM Bool
-- | Lookup variables or functions in the environment.
funLookup :: Uniquable key => key -> LlvmM (Maybe LlvmType)
-- | Insert variables or functions into the environment.
funInsert :: Uniquable key => key -> LlvmType -> LlvmM ()
-- | Get the LLVM version we are generating code for
getLlvmVer :: LlvmM LlvmVersion
getDynFlags :: HasDynFlags m => m DynFlags
-- | Get the platform we are generating code for
getDynFlag :: (DynFlags -> a) -> LlvmM a
-- | Get the platform we are generating code for
getLlvmPlatform :: LlvmM Platform
-- | Dumps the document if the corresponding flag has been set by the user
dumpIfSetLlvm :: DumpFlag -> String -> SDoc -> LlvmM ()
-- | Prints the given contents to the output handle
renderLlvm :: SDoc -> LlvmM ()
-- | Marks a variable as "used"
markUsedVar :: LlvmVar -> LlvmM ()
-- | Return all variables marked as "used" so far
getUsedVars :: LlvmM [LlvmVar]
-- | Here we pre-initialise some functions that are used internally by GHC
-- so as to make sure they have the most general type in the case that
-- user code also uses these functions but with a different type than GHC
-- internally. (Main offender is treating return type as void
-- instead of 'void *'). Fixes trac #5486.
ghcInternalFunctions :: LlvmM ()
-- | Allocate a new global unnamed metadata identifier
getMetaUniqueId :: LlvmM MetaId
-- | Sets metadata node for a given unique
setUniqMeta :: Unique -> MetaId -> LlvmM ()
-- | Gets metadata node for given unique
getUniqMeta :: Unique -> LlvmM (Maybe MetaId)
-- | Translate a basic CmmType to an LlvmType.
cmmToLlvmType :: CmmType -> LlvmType
-- | Translate a Cmm Float Width to a LlvmType.
widthToLlvmFloat :: Width -> LlvmType
-- | Translate a Cmm Bit Width to a LlvmType.
widthToLlvmInt :: Width -> LlvmType
-- | Llvm Function type for Cmm function
llvmFunTy :: LiveGlobalRegs -> LlvmM LlvmType
-- | Llvm Function signature
llvmFunSig :: LiveGlobalRegs -> CLabel -> LlvmLinkageType -> LlvmM LlvmFunctionDecl
-- | A Function's arguments
llvmFunArgs :: DynFlags -> LiveGlobalRegs -> [LlvmVar]
-- | Llvm standard fun attributes
llvmStdFunAttrs :: [LlvmFuncAttr]
-- | Alignment to use for functions
llvmFunAlign :: DynFlags -> LMAlign
-- | Alignment to use for into tables
llvmInfAlign :: DynFlags -> LMAlign
-- | Pointer width
llvmPtrBits :: DynFlags -> Int
-- | Convert a list of types to a list of function parameters (each with no
-- parameter attributes)
tysToParams :: [LlvmType] -> [LlvmParameter]
-- | Section to use for a function
llvmFunSection :: DynFlags -> LMString -> LMSection
-- | Pretty print a CLabel.
strCLabel_llvm :: CLabel -> LlvmM LMString
strDisplayName_llvm :: CLabel -> LlvmM LMString
strProcedureName_llvm :: CLabel -> LlvmM LMString
-- | Create/get a pointer to a global value. Might return an alias if the
-- value in question hasn't been defined yet. We especially make no
-- guarantees on the type of the returned pointer.
getGlobalPtr :: LMString -> LlvmM LlvmVar
-- | Generate definitions for aliases forward-referenced by
-- getGlobalPtr.
--
-- Must be called at a point where we are sure that no new global
-- definitions will be generated anymore!
generateExternDecls :: LlvmM ([LMGlobal], [LlvmType])
-- | Here we take a global variable definition, rename it with a
-- $def suffix, and generate the appropriate alias.
aliasify :: LMGlobal -> LlvmM [LMGlobal]
instance GHC.Base.Functor LlvmCodeGen.Base.LlvmM
instance GHC.Base.Applicative LlvmCodeGen.Base.LlvmM
instance GHC.Base.Monad LlvmCodeGen.Base.LlvmM
instance DynFlags.HasDynFlags LlvmCodeGen.Base.LlvmM
instance UniqSupply.MonadUnique LlvmCodeGen.Base.LlvmM
module SysTools
initSysTools :: Maybe String -> IO Settings
runUnlit :: DynFlags -> [Option] -> IO ()
runCpp :: DynFlags -> [Option] -> IO ()
runCc :: DynFlags -> [Option] -> IO ()
runPp :: DynFlags -> [Option] -> IO ()
runSplit :: DynFlags -> [Option] -> IO ()
runAs :: DynFlags -> [Option] -> IO ()
runLink :: DynFlags -> [Option] -> IO ()
runLibtool :: DynFlags -> [Option] -> IO ()
runMkDLL :: DynFlags -> [Option] -> IO ()
runWindres :: DynFlags -> [Option] -> IO ()
-- | Run the LLVM Optimiser
runLlvmOpt :: DynFlags -> [Option] -> IO ()
-- | Run the LLVM Compiler
runLlvmLlc :: DynFlags -> [Option] -> IO ()
-- | Run the clang compiler (used as an assembler for the LLVM backend on
-- OS X as LLVM doesn't support the OS X system assembler)
runClang :: DynFlags -> [Option] -> IO ()
-- | Figure out which version of LLVM we are running this session
figureLlvmVersion :: DynFlags -> IO (Maybe (Int, Int))
getLinkerInfo :: DynFlags -> IO LinkerInfo
getCompilerInfo :: DynFlags -> IO CompilerInfo
linkDynLib :: DynFlags -> [String] -> [InstalledUnitId] -> IO ()
-- | Run the linker with some arguments and return the output
askLd :: DynFlags -> [Option] -> IO String
touch :: DynFlags -> String -> String -> IO ()
copy :: DynFlags -> String -> FilePath -> FilePath -> IO ()
copyWithHeader :: DynFlags -> String -> Maybe String -> FilePath -> FilePath -> IO ()
setTmpDir :: FilePath -> DynFlags -> DynFlags
newTempName :: DynFlags -> Suffix -> IO FilePath
newTempLibName :: DynFlags -> Suffix -> IO (FilePath, FilePath, String)
cleanTempDirs :: DynFlags -> IO ()
cleanTempFiles :: DynFlags -> IO ()
cleanTempFilesExcept :: DynFlags -> [FilePath] -> IO ()
addFilesToClean :: DynFlags -> [FilePath] -> IO ()
-- | When invoking external tools as part of the compilation pipeline, we
-- pass these a sequence of options on the command-line. Rather than just
-- using a list of Strings, we use a type that allows us to distinguish
-- between filepaths and 'other stuff'. The reason for this is that this
-- type gives us a handle on transforming filenames, and filenames only,
-- to whatever format they're expected to be on a particular platform.
data Option
FileOption :: String -> String -> Option
Option :: String -> Option
-- | Some platforms require that we explicitly link against libm
-- if any math-y things are used (which we assume to include all
-- programs). See #14022.
libmLinkOpts :: [Option]
getPkgFrameworkOpts :: DynFlags -> Platform -> [InstalledUnitId] -> IO [String]
getFrameworkOpts :: DynFlags -> Platform -> [String]
-- | Handle conversion of CmmData to LLVM code.
module LlvmCodeGen.Data
-- | Pass a CmmStatic section to an equivalent Llvm code.
genLlvmData :: (Section, CmmStatics) -> LlvmM LlvmData
-- | Handle static data
genData :: CmmStatic -> LlvmM LlvmStatic
-- | Pretty print helpers for the LLVM Code generator.
module LlvmCodeGen.Ppr
-- | Header code for LLVM modules
pprLlvmHeader :: SDoc
-- | Pretty print LLVM code
pprLlvmCmmDecl :: LlvmCmmDecl -> LlvmM (SDoc, [LlvmVar])
-- | Pretty print LLVM data code
pprLlvmData :: LlvmData -> SDoc
-- | The section we are putting info tables and their entry code into,
-- should be unique since we process the assembly pattern matching this.
infoSection :: String
module Hoopl.Dataflow
-- | Used at the type level to indicate a "closed" structure which supports
-- control transfer only through the use of named labels---no
-- "fallthrough" is permitted. The number of control-flow edges is
-- unconstrained.
data C :: *
-- | Used at the type level to indicate an "open" structure with a unique,
-- unnamed control-flow edge flowing in or out. Fallthrough and
-- concatenation are permitted at an open point.
data O :: *
-- | A sequence of nodes. May be any of four shapes (OO, OC, CO,
-- CC). Open at the entry means single entry, mutatis mutandis for
-- exit. A closedclosed block is a basic/ block and can't be
-- extended further. Clients should avoid manipulating blocks and should
-- stick to either nodes or graphs.
data Block (n :: * -> * -> *) e x :: (* -> * -> *) -> * -> * -> *
lastNode :: () => Block n x C -> n O C
entryLabel :: NonLocal thing => forall x. () => thing C x -> Label
-- | Folds backward over all nodes of an open-open block. Strict in the
-- accumulator.
foldNodesBwdOO :: (CmmNode O O -> f -> f) -> Block CmmNode O O -> f -> f
data DataflowLattice a
DataflowLattice :: a -> JoinFun a -> DataflowLattice a
[fact_bot] :: DataflowLattice a -> a
[fact_join] :: DataflowLattice a -> JoinFun a
newtype OldFact a
OldFact :: a -> OldFact a
newtype NewFact a
NewFact :: a -> NewFact a
-- | The result of joining OldFact and NewFact.
data JoinedFact a
-- | Result is different than OldFact.
Changed :: !a -> JoinedFact a
-- | Result is the same as OldFact.
NotChanged :: !a -> JoinedFact a
type TransferFun f = CmmBlock -> FactBase f -> FactBase f
type FactBase f = LabelMap f
getFact :: DataflowLattice f -> Label -> FactBase f -> f
-- | Returns the joined facts for each label.
mkFactBase :: DataflowLattice f -> [(Label, f)] -> FactBase f
analyzeCmmFwd :: DataflowLattice f -> TransferFun f -> CmmGraph -> FactBase f -> FactBase f
analyzeCmmBwd :: DataflowLattice f -> TransferFun f -> CmmGraph -> FactBase f -> FactBase f
changedIf :: Bool -> a -> JoinedFact a
-- | Returns the result of joining the facts from all the successors of the
-- provided node or block.
joinOutFacts :: (NonLocal n) => DataflowLattice f -> n e C -> FactBase f -> f
module Hoopl
instance Outputable.Outputable Compiler.Hoopl.Label.LabelSet
instance Outputable.Outputable a => Outputable.Outputable (Compiler.Hoopl.Label.LabelMap a)
module Instruction
-- | Holds a list of source and destination registers used by a particular
-- instruction.
--
-- Machine registers that are pre-allocated to stgRegs are filtered out,
-- because they are uninteresting from a register allocation standpoint.
-- (We wouldn't want them to end up on the free list!)
--
-- As far as we are concerned, the fixed registers simply don't exist
-- (for allocation purposes, anyway).
data RegUsage
RU :: [Reg] -> [Reg] -> RegUsage
-- | No regs read or written to.
noUsage :: RegUsage
data GenBasicBlock i
BasicBlock :: BlockId -> [i] -> GenBasicBlock i
-- | The branch block id is that of the first block in the branch, which is
-- that branch's entry point
blockId :: GenBasicBlock i -> BlockId
newtype ListGraph i
ListGraph :: [GenBasicBlock i] -> ListGraph i
type NatCmm instr = GenCmmGroup CmmStatics (LabelMap CmmStatics) (ListGraph instr)
type NatCmmDecl statics instr = GenCmmDecl statics (LabelMap CmmStatics) (ListGraph instr)
type NatBasicBlock instr = GenBasicBlock instr
-- | Returns the info table associated with the CmmDecl's entry point, if
-- any.
topInfoTable :: GenCmmDecl a (LabelMap i) (ListGraph b) -> Maybe i
-- | Return the list of BlockIds in a CmmDecl that are entry points for
-- this proc (i.e. they may be jumped to from outside this proc).
entryBlocks :: GenCmmDecl a (LabelMap i) (ListGraph b) -> [BlockId]
-- | Common things that we can do with instructions, on all architectures.
-- These are used by the shared parts of the native code generator,
-- specifically the register allocators.
class Instruction instr
-- | Get the registers that are being used by this instruction. regUsage
-- doesn't need to do any trickery for jumps and such. Just state
-- precisely the regs read and written by that insn. The consequences of
-- control flow transfers, as far as register allocation goes, are taken
-- care of by the register allocator.
regUsageOfInstr :: Instruction instr => Platform -> instr -> RegUsage
-- | Apply a given mapping to all the register references in this
-- instruction.
patchRegsOfInstr :: Instruction instr => instr -> (Reg -> Reg) -> instr
-- | Checks whether this instruction is a jump/branch instruction. One that
-- can change the flow of control in a way that the register allocator
-- needs to worry about.
isJumpishInstr :: Instruction instr => instr -> Bool
-- | Give the possible destinations of this jump instruction. Must be
-- defined for all jumpish instructions.
jumpDestsOfInstr :: Instruction instr => instr -> [BlockId]
-- | Change the destination of this jump instruction. Used in the linear
-- allocator when adding fixup blocks for join points.
patchJumpInstr :: Instruction instr => instr -> (BlockId -> BlockId) -> instr
-- | An instruction to spill a register into a spill slot.
mkSpillInstr :: Instruction instr => DynFlags -> Reg -> Int -> Int -> instr
-- | An instruction to reload a register from a spill slot.
mkLoadInstr :: Instruction instr => DynFlags -> Reg -> Int -> Int -> instr
-- | See if this instruction is telling us the current C stack delta
takeDeltaInstr :: Instruction instr => instr -> Maybe Int
-- | Check whether this instruction is some meta thing inserted into the
-- instruction stream for other purposes.
--
-- Not something that has to be treated as a real machine instruction and
-- have its registers allocated.
--
-- eg, comments, delta, ldata, etc.
isMetaInstr :: Instruction instr => instr -> Bool
-- | Copy the value in a register to another one. Must work for all
-- register classes.
mkRegRegMoveInstr :: Instruction instr => Platform -> Reg -> Reg -> instr
-- | Take the source and destination from this reg -> reg move
-- instruction or Nothing if it's not one
takeRegRegMoveInstr :: Instruction instr => instr -> Maybe (Reg, Reg)
-- | Make an unconditional jump instruction. For architectures with branch
-- delay slots, its ok to put a NOP after the jump. Don't fill the delay
-- slot with an instruction that references regs or you'll confuse the
-- linear allocator.
mkJumpInstr :: Instruction instr => BlockId -> [instr]
mkStackAllocInstr :: Instruction instr => Platform -> Int -> instr
mkStackDeallocInstr :: Instruction instr => Platform -> Int -> instr
-- | Formats on this architecture A Format is a combination of width and
-- class
--
-- TODO: Signed vs unsigned?
--
-- TODO: This module is currenly shared by all architectures because
-- NCGMonad need to know about it to make a VReg. It would be better to
-- have architecture specific formats, and do the overloading properly.
-- eg SPARC doesn't care about FF80.
module Format
data Format
II8 :: Format
II16 :: Format
II32 :: Format
II64 :: Format
FF32 :: Format
FF64 :: Format
FF80 :: Format
-- | Get the integer format of this width.
intFormat :: Width -> Format
-- | Get the float format of this width.
floatFormat :: Width -> Format
-- | Check if a format represents a floating point value.
isFloatFormat :: Format -> Bool
-- | Convert a Cmm type to a Format.
cmmTypeFormat :: CmmType -> Format
-- | Get the Width of a Format.
formatToWidth :: Format -> Width
formatInBytes :: Format -> Int
instance GHC.Classes.Eq Format.Format
instance GHC.Show.Show Format.Format
module SPARC.Regs
-- | Get the standard name for the register with this number.
showReg :: RegNo -> String
-- | regSqueeze_class reg Calculuate the maximum number of register colors
-- that could be denied to a node of this class due to having this reg as
-- a neighbour.
virtualRegSqueeze :: RegClass -> VirtualReg -> Int
realRegSqueeze :: RegClass -> RealReg -> Int
classOfRealReg :: RealReg -> RegClass
-- | All the allocatable registers in the machine, including register
-- pairs.
allRealRegs :: [RealReg]
-- | Get the regno for this sort of reg
gReg :: Int -> RegNo
-- | Get the regno for this sort of reg
iReg :: Int -> RegNo
-- | Get the regno for this sort of reg
lReg :: Int -> RegNo
-- | Get the regno for this sort of reg
oReg :: Int -> RegNo
-- | Get the regno for this sort of reg
fReg :: Int -> RegNo
-- | Some specific regs used by the code generator.
fp :: Reg
-- | Some specific regs used by the code generator.
sp :: Reg
-- | Some specific regs used by the code generator.
g0 :: Reg
-- | Some specific regs used by the code generator.
g1 :: Reg
-- | Some specific regs used by the code generator.
g2 :: Reg
-- | Some specific regs used by the code generator.
o0 :: Reg
-- | Some specific regs used by the code generator.
o1 :: Reg
-- | Some specific regs used by the code generator.
f0 :: Reg
-- | Some specific regs used by the code generator.
f1 :: Reg
-- | Some specific regs used by the code generator.
f6 :: Reg
-- | Some specific regs used by the code generator.
f8 :: Reg
-- | Some specific regs used by the code generator.
f22 :: Reg
-- | Some specific regs used by the code generator.
f26 :: Reg
-- | Some specific regs used by the code generator.
f27 :: Reg
-- | Produce the second-half-of-a-double register given the first half.
--
-- All the regs that the register allocator can allocate to, with the the
-- fixed use regs removed.
allocatableRegs :: [RealReg]
-- | The registers to place arguments for function calls, for some number
-- of arguments.
argRegs :: RegNo -> [Reg]
-- | All all the regs that could possibly be returned by argRegs
allArgRegs :: [Reg]
callClobberedRegs :: [Reg]
-- | Make a virtual reg with this format.
mkVirtualReg :: Unique -> Format -> VirtualReg
regDotColor :: RealReg -> SDoc
module SPARC.Stack
-- | Get an AddrMode relative to the address in sp. This gives us a stack
-- relative addressing mode for volatile temporaries and for excess call
-- arguments.
spRel :: Int -> AddrMode
-- | Get an address relative to the frame pointer. This doesn't work work
-- for offsets greater than 13 bits; we just hope for the best
fpRel :: Int -> AddrMode
-- | Convert a spill slot number to a *byte* offset, with no sign.
spillSlotToOffset :: DynFlags -> Int -> Int
-- | The maximum number of spill slots available on the C stack. If we use
-- up all of the slots, then we're screwed.
--
-- Why do we reserve 64 bytes, instead of using the whole thing?? -- BL
-- 20090215
maxSpillSlots :: DynFlags -> Int
-- | Free regs map for SPARC
module RegAlloc.Linear.SPARC.FreeRegs
data FreeRegs
FreeRegs :: !Word32 -> !Word32 -> !Word32 -> FreeRegs
-- | A reg map where no regs are free to be allocated.
noFreeRegs :: FreeRegs
-- | The initial set of free regs.
initFreeRegs :: Platform -> FreeRegs
-- | Get all the free registers of this class.
getFreeRegs :: RegClass -> FreeRegs -> [RealReg]
-- | Grab a register.
allocateReg :: Platform -> RealReg -> FreeRegs -> FreeRegs
-- | Release a register from allocation. The register liveness information
-- says that most regs die after a C call, but we still don't want to
-- allocate to some of them.
releaseReg :: Platform -> RealReg -> FreeRegs -> FreeRegs
bitMask :: Int -> Word32
showFreeRegs :: FreeRegs -> String
instance GHC.Show.Show RegAlloc.Linear.SPARC.FreeRegs.FreeRegs
module PPC.Regs
-- | regSqueeze_class reg Calculuate the maximum number of register colors
-- that could be denied to a node of this class due to having this reg as
-- a neighbour.
virtualRegSqueeze :: RegClass -> VirtualReg -> Int
realRegSqueeze :: RegClass -> RealReg -> Int
mkVirtualReg :: Unique -> Format -> VirtualReg
regDotColor :: RealReg -> SDoc
data Imm
ImmInt :: Int -> Imm
ImmInteger :: Integer -> Imm
ImmCLbl :: CLabel -> Imm
ImmLit :: SDoc -> Imm
ImmIndex :: CLabel -> Int -> Imm
ImmFloat :: Rational -> Imm
ImmDouble :: Rational -> Imm
ImmConstantSum :: Imm -> Imm -> Imm
ImmConstantDiff :: Imm -> Imm -> Imm
LO :: Imm -> Imm
HI :: Imm -> Imm
HA :: Imm -> Imm
HIGHERA :: Imm -> Imm
HIGHESTA :: Imm -> Imm
strImmLit :: String -> Imm
litToImm :: CmmLit -> Imm
data AddrMode
AddrRegReg :: Reg -> Reg -> AddrMode
AddrRegImm :: Reg -> Imm -> AddrMode
addrOffset :: AddrMode -> Int -> Maybe AddrMode
spRel :: DynFlags -> Int -> AddrMode
argRegs :: RegNo -> [Reg]
allArgRegs :: [Reg]
callClobberedRegs :: Platform -> [Reg]
allMachRegNos :: [RegNo]
classOfRealReg :: RealReg -> RegClass
showReg :: RegNo -> String
allFPArgRegs :: Platform -> [Reg]
fits16Bits :: Integral a => a -> Bool
makeImmediate :: Integral a => Width -> Bool -> a -> Maybe Imm
fReg :: Int -> RegNo
r0 :: Reg
sp :: Reg
toc :: Reg
r3 :: Reg
r4 :: Reg
r11 :: Reg
r12 :: Reg
r27 :: Reg
r28 :: Reg
r30 :: Reg
tmpReg :: Platform -> Reg
f1 :: Reg
f20 :: Reg
f21 :: Reg
allocatableRegs :: Platform -> [RealReg]
-- | Free regs map for PowerPC
module RegAlloc.Linear.PPC.FreeRegs
data FreeRegs
FreeRegs :: !Word32 -> !Word32 -> FreeRegs
noFreeRegs :: FreeRegs
releaseReg :: RealReg -> FreeRegs -> FreeRegs
initFreeRegs :: Platform -> FreeRegs
getFreeRegs :: RegClass -> FreeRegs -> [RealReg]
allocateReg :: RealReg -> FreeRegs -> FreeRegs
instance GHC.Show.Show RegAlloc.Linear.PPC.FreeRegs.FreeRegs
module CmmUtils
primRepCmmType :: DynFlags -> PrimRep -> CmmType
slotCmmType :: DynFlags -> SlotTy -> CmmType
slotForeignHint :: SlotTy -> ForeignHint
typeCmmType :: DynFlags -> UnaryType -> CmmType
typeForeignHint :: UnaryType -> ForeignHint
primRepForeignHint :: PrimRep -> ForeignHint
zeroCLit :: DynFlags -> CmmLit
mkIntCLit :: DynFlags -> Int -> CmmLit
mkWordCLit :: DynFlags -> Integer -> CmmLit
packHalfWordsCLit :: DynFlags -> StgHalfWord -> StgHalfWord -> CmmLit
mkByteStringCLit :: CLabel -> [Word8] -> (CmmLit, GenCmmDecl CmmStatics info stmt)
mkDataLits :: Section -> CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt
mkRODataLits :: CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt
mkStgWordCLit :: DynFlags -> StgWord -> CmmLit
mkIntExpr :: DynFlags -> Int -> CmmExpr
zeroExpr :: DynFlags -> CmmExpr
mkLblExpr :: CLabel -> CmmExpr
cmmRegOff :: CmmReg -> Int -> CmmExpr
cmmOffset :: DynFlags -> CmmExpr -> Int -> CmmExpr
cmmLabelOff :: CLabel -> Int -> CmmLit
cmmOffsetLit :: CmmLit -> Int -> CmmLit
cmmOffsetExpr :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr
cmmOffsetB :: DynFlags -> CmmExpr -> ByteOff -> CmmExpr
cmmLabelOffB :: CLabel -> ByteOff -> CmmLit
cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit
cmmOffsetExprB :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmRegOffW :: DynFlags -> CmmReg -> WordOff -> CmmExpr
cmmOffsetW :: DynFlags -> CmmExpr -> WordOff -> CmmExpr
cmmLabelOffW :: DynFlags -> CLabel -> WordOff -> CmmLit
cmmOffsetLitW :: DynFlags -> CmmLit -> WordOff -> CmmLit
cmmOffsetExprW :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
-- | Useful for creating an index into an array, with a statically known
-- offset. The type is the element type; used for making the multiplier
cmmIndex :: DynFlags -> Width -> CmmExpr -> Int -> CmmExpr
-- | Useful for creating an index into an array, with an unknown offset.
cmmIndexExpr :: DynFlags -> Width -> CmmExpr -> CmmExpr -> CmmExpr
cmmLoadIndex :: DynFlags -> CmmType -> CmmExpr -> Int -> CmmExpr
cmmLoadIndexW :: DynFlags -> CmmExpr -> Int -> CmmType -> CmmExpr
cmmNegate :: DynFlags -> CmmExpr -> CmmExpr
cmmULtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmUGeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmUGtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmUShrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmSLtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmNeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmEqWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmOrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmAndWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmSubWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmAddWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmMulWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmQuotWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmToWord :: DynFlags -> CmmExpr -> CmmExpr
isTrivialCmmExpr :: CmmExpr -> Bool
hasNoGlobalRegs :: CmmExpr -> Bool
blankWord :: DynFlags -> CmmStatic
cmmTagMask :: DynFlags -> CmmExpr
cmmPointerMask :: DynFlags -> CmmExpr
cmmUntag :: DynFlags -> CmmExpr -> CmmExpr
cmmIsTagged :: DynFlags -> CmmExpr -> CmmExpr
cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr
-- | Returns True if the two STG registers overlap on the specified
-- platform, in the sense that writing to one will clobber the other.
-- This includes the case that the two registers are the same STG
-- register. See Note [Overlapping global registers] for details.
regsOverlap :: DynFlags -> CmmReg -> CmmReg -> Bool
-- | Returns True if the STG register is used by the expression, in the
-- sense that a store to the register might affect the value of the
-- expression.
--
-- We must check for overlapping registers and not just equal registers
-- here, otherwise CmmSink may incorrectly reorder assignments that
-- conflict due to overlap. See Trac #10521 and Note [Overlapping global
-- registers].
regUsedIn :: DynFlags -> CmmReg -> CmmExpr -> Bool
mkLiveness :: DynFlags -> [Maybe LocalReg] -> Liveness
modifyGraph :: (Graph n C C -> Graph n' C C) -> GenCmmGraph n -> GenCmmGraph n'
ofBlockMap :: BlockId -> LabelMap CmmBlock -> CmmGraph
toBlockMap :: CmmGraph -> LabelMap CmmBlock
insertBlock :: CmmBlock -> LabelMap CmmBlock -> LabelMap CmmBlock
ofBlockList :: BlockId -> [CmmBlock] -> CmmGraph
toBlockList :: CmmGraph -> [CmmBlock]
bodyToBlockList :: Body CmmNode -> [CmmBlock]
-- | like toBlockList, but the entry block always comes first
toBlockListEntryFirst :: CmmGraph -> [CmmBlock]
-- | Like toBlockListEntryFirst, but we strive to ensure that we
-- order blocks so that the false case of a conditional jumps to the next
-- block in the output list of blocks. This matches the way OldCmm blocks
-- were output since in OldCmm the false case was a fallthrough, whereas
-- in Cmm conditional branches have both true and false successors. Block
-- ordering can make a big difference in performance in the LLVM backend.
-- Note that we rely crucially on the order of successors returned for
-- CmmCondBranch by the NonLocal instance for CmmNode defind in
-- cmm/CmmNode.hs. -GBM
toBlockListEntryFirstFalseFallthrough :: CmmGraph -> [CmmBlock]
foldGraphBlocks :: (CmmBlock -> a -> a) -> a -> CmmGraph -> a
mapGraphNodes :: (CmmNode C O -> CmmNode C O, CmmNode O O -> CmmNode O O, CmmNode O C -> CmmNode O C) -> CmmGraph -> CmmGraph
postorderDfs :: CmmGraph -> [CmmBlock]
mapGraphNodes1 :: (forall e x. CmmNode e x -> CmmNode e x) -> CmmGraph -> CmmGraph
-- | Extract all tick annotations from the given block
blockTicks :: Block CmmNode C C -> [CmmTickish]
module PprCmm
instance Outputable.Outputable Cmm.CmmStackInfo
instance Outputable.Outputable Cmm.CmmTopInfo
instance Outputable.Outputable (CmmNode.CmmNode e x)
instance Outputable.Outputable CmmNode.Convention
instance Outputable.Outputable CmmNode.ForeignConvention
instance Outputable.Outputable CmmNode.ForeignTarget
instance Outputable.Outputable CmmNode.CmmReturnInfo
instance Outputable.Outputable (Compiler.Hoopl.Block.Block CmmNode.CmmNode Compiler.Hoopl.Block.C Compiler.Hoopl.Block.C)
instance Outputable.Outputable (Compiler.Hoopl.Block.Block CmmNode.CmmNode Compiler.Hoopl.Block.C Compiler.Hoopl.Block.O)
instance Outputable.Outputable (Compiler.Hoopl.Block.Block CmmNode.CmmNode Compiler.Hoopl.Block.O Compiler.Hoopl.Block.C)
instance Outputable.Outputable (Compiler.Hoopl.Block.Block CmmNode.CmmNode Compiler.Hoopl.Block.O Compiler.Hoopl.Block.O)
instance Outputable.Outputable (Compiler.Hoopl.Graph.Graph CmmNode.CmmNode e x)
instance Outputable.Outputable Cmm.CmmGraph
module RegAlloc.Liveness
type RegSet = UniqSet Reg
type RegMap a = UniqFM a
emptyRegMap :: UniqFM a
type BlockMap a = LabelMap a
mapEmpty :: IsMap map => forall a. () => map a
-- | A top level thing which carries liveness information.
type LiveCmmDecl statics instr = GenCmmDecl statics LiveInfo [SCC (LiveBasicBlock instr)]
-- | The register allocator also wants to use SPILL/RELOAD meta
-- instructions, so we'll keep those here.
data InstrSR instr
-- | A real machine instruction
Instr :: instr -> InstrSR instr
-- | spill this reg to a stack slot
SPILL :: Reg -> Int -> InstrSR instr
-- | reload this reg from a stack slot
RELOAD :: Int -> Reg -> InstrSR instr
-- | An instruction with liveness information.
data LiveInstr instr
LiveInstr :: (InstrSR instr) -> (Maybe Liveness) -> LiveInstr instr
-- | Liveness information. The regs which die are ones which are no longer
-- live in the *next* instruction in this sequence. (NB. if the
-- instruction is a jump, these registers might still be live at the jump
-- target(s) - you have to check the liveness at the destination block to
-- find out).
data Liveness
-- | registers that died because they were clobbered by something.
Liveness :: RegSet -> RegSet -> RegSet -> Liveness
-- | registers born in this instruction (written to for first time).
[liveBorn] :: Liveness -> RegSet
-- | registers that died because they were read for the last time.
[liveDieRead] :: Liveness -> RegSet
[liveDieWrite] :: Liveness -> RegSet
-- | Stash regs live on entry to each basic block in the info part of the
-- cmm code.
data LiveInfo
LiveInfo :: (LabelMap CmmStatics) -> [BlockId] -> (Maybe (BlockMap RegSet)) -> (BlockMap IntSet) -> LiveInfo
-- | A basic block with liveness information.
type LiveBasicBlock instr = GenBasicBlock (LiveInstr instr)
-- | map a function across all the basic blocks in this code
mapBlockTop :: (LiveBasicBlock instr -> LiveBasicBlock instr) -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr
-- | map a function across all the basic blocks in this code (monadic
-- version)
mapBlockTopM :: Monad m => (LiveBasicBlock instr -> m (LiveBasicBlock instr)) -> LiveCmmDecl statics instr -> m (LiveCmmDecl statics instr)
mapSCCM :: Monad m => (a -> m b) -> SCC a -> m (SCC b)
mapGenBlockTop :: (GenBasicBlock i -> GenBasicBlock i) -> (GenCmmDecl d h (ListGraph i) -> GenCmmDecl d h (ListGraph i))
-- | map a function across all the basic blocks in this code (monadic
-- version)
mapGenBlockTopM :: Monad m => (GenBasicBlock i -> m (GenBasicBlock i)) -> (GenCmmDecl d h (ListGraph i) -> m (GenCmmDecl d h (ListGraph i)))
-- | Strip away liveness information, yielding NatCmmDecl
stripLive :: (Outputable statics, Outputable instr, Instruction instr) => DynFlags -> LiveCmmDecl statics instr -> NatCmmDecl statics instr
-- | Strip away liveness information from a basic block, and make real
-- spill instructions out of SPILL, RELOAD pseudos along the way.
stripLiveBlock :: Instruction instr => DynFlags -> LiveBasicBlock instr -> NatBasicBlock instr
-- | Slurp out the list of register conflicts and reg-reg moves from this
-- top level thing. Slurping of conflicts and moves is wrapped up
-- together so we don't have to make two passes over the same code when
-- we want to build the graph.
slurpConflicts :: Instruction instr => LiveCmmDecl statics instr -> (Bag (UniqSet Reg), Bag (Reg, Reg))
-- | For spill/reloads
--
-- SPILL v1, slot1 ... RELOAD slot1, v2
--
-- If we can arrange that v1 and v2 are allocated to the same hreg it's
-- more likely the spill/reload instrs can be cleaned and replaced by a
-- nop reg-reg move.
slurpReloadCoalesce :: forall statics instr. Instruction instr => LiveCmmDecl statics instr -> Bag (Reg, Reg)
-- | Erase Delta instructions.
eraseDeltasLive :: Instruction instr => LiveCmmDecl statics instr -> LiveCmmDecl statics instr
-- | Patch the registers in this code according to this register mapping.
-- also erase reg -> reg moves when the reg is the same. also erase
-- reg -> reg moves when the destination dies in this instr.
patchEraseLive :: Instruction instr => (Reg -> Reg) -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr
-- | Patch registers in this LiveInstr, including the liveness information.
patchRegsLiveInstr :: Instruction instr => (Reg -> Reg) -> LiveInstr instr -> LiveInstr instr
-- | If we've compute liveness info for this code already we have to
-- reverse the SCCs in each top to get them back to the right order so we
-- can do it again.
reverseBlocksInTops :: LiveCmmDecl statics instr -> LiveCmmDecl statics instr
regLiveness :: (Outputable instr, Instruction instr) => Platform -> LiveCmmDecl statics instr -> UniqSM (LiveCmmDecl statics instr)
-- | Convert a NatCmmDecl to a LiveCmmDecl, with empty liveness information
natCmmTopToLive :: Instruction instr => NatCmmDecl statics instr -> LiveCmmDecl statics instr
instance Outputable.Outputable RegAlloc.Liveness.LiveInfo
instance Outputable.Outputable instr => Outputable.Outputable (RegAlloc.Liveness.LiveInstr instr)
instance Instruction.Instruction instr => Instruction.Instruction (RegAlloc.Liveness.InstrSR instr)
instance Outputable.Outputable instr => Outputable.Outputable (RegAlloc.Liveness.InstrSR instr)
-- | Put common type definitions here to break recursive module
-- dependencies.
module RegAlloc.Linear.Base
-- | Used to store the register assignment on entry to a basic block. We
-- use this to handle join points, where multiple branch instructions
-- target a particular label. We have to insert fixup code to make the
-- register assignments from the different sources match up.
type BlockAssignment freeRegs = BlockMap (freeRegs, RegMap Loc)
-- | Where a vreg is currently stored A temporary can be marked as living
-- in both a register and memory (InBoth), for example if it was recently
-- loaded from a spill location. This makes it cheap to spill (no save
-- instruction required), but we have to be careful to turn this into
-- InReg if the value in the register is changed.
data Loc
-- | vreg is in a register
InReg :: !RealReg -> Loc
-- | vreg is held in a stack slot
InMem :: {-# UNPACK #-} !StackSlot -> Loc
-- | vreg is held in both a register and a stack slot
InBoth :: !RealReg -> {-# UNPACK #-} !StackSlot -> Loc
-- | Get the reg numbers stored in this Loc.
regsOfLoc :: Loc -> [RealReg]
-- | Reasons why instructions might be inserted by the spiller. Used when
-- generating stats for -ddrop-asm-stats.
data SpillReason
-- | vreg was spilled to a slot so we could use its current hreg for
-- another vreg
SpillAlloc :: !Unique -> SpillReason
-- | vreg was moved because its hreg was clobbered
SpillClobber :: !Unique -> SpillReason
-- | vreg was loaded from a spill slot
SpillLoad :: !Unique -> SpillReason
-- | reg-reg move inserted during join to targets
SpillJoinRR :: !Unique -> SpillReason
-- | reg-mem move inserted during join to targets
SpillJoinRM :: !Unique -> SpillReason
-- | Used to carry interesting stats out of the register allocator.
data RegAllocStats
RegAllocStats :: UniqFM [Int] -> RegAllocStats
[ra_spillInstrs] :: RegAllocStats -> UniqFM [Int]
-- | The register allocator state
data RA_State freeRegs
RA_State :: BlockAssignment freeRegs -> !freeRegs -> RegMap Loc -> Int -> StackMap -> UniqSupply -> [SpillReason] -> DynFlags -> RA_State freeRegs
-- | the current mapping from basic blocks to the register assignments at
-- the beginning of that block.
[ra_blockassig] :: RA_State freeRegs -> BlockAssignment freeRegs
-- | free machine registers
[ra_freeregs] :: RA_State freeRegs -> !freeRegs
-- | assignment of temps to locations
[ra_assig] :: RA_State freeRegs -> RegMap Loc
-- | current stack delta
[ra_delta] :: RA_State freeRegs -> Int
-- | free stack slots for spilling
[ra_stack] :: RA_State freeRegs -> StackMap
-- | unique supply for generating names for join point fixup blocks.
[ra_us] :: RA_State freeRegs -> UniqSupply
-- | Record why things were spilled, for -ddrop-asm-stats. Just keep a list
-- here instead of a map of regs -> reasons. We don't want to slow
-- down the allocator if we're not going to emit the stats.
[ra_spills] :: RA_State freeRegs -> [SpillReason]
[ra_DynFlags] :: RA_State freeRegs -> DynFlags
instance GHC.Classes.Ord RegAlloc.Linear.Base.Loc
instance GHC.Show.Show RegAlloc.Linear.Base.Loc
instance GHC.Classes.Eq RegAlloc.Linear.Base.Loc
instance Outputable.Outputable RegAlloc.Linear.Base.Loc
module RegAlloc.Linear.Stats
-- | Build a map of how many times each reg was alloced, clobbered, loaded
-- etc.
binSpillReasons :: [SpillReason] -> UniqFM [Int]
-- | Count reg-reg moves remaining in this code.
countRegRegMovesNat :: Instruction instr => NatCmmDecl statics instr -> Int
-- | Pretty print some RegAllocStats
pprStats :: Instruction instr => [NatCmmDecl statics instr] -> [RegAllocStats] -> SDoc
-- | State monad for the linear register allocator.
module RegAlloc.Linear.State
-- | The register allocator state
data RA_State freeRegs
RA_State :: BlockAssignment freeRegs -> !freeRegs -> RegMap Loc -> Int -> StackMap -> UniqSupply -> [SpillReason] -> DynFlags -> RA_State freeRegs
-- | the current mapping from basic blocks to the register assignments at
-- the beginning of that block.
[ra_blockassig] :: RA_State freeRegs -> BlockAssignment freeRegs
-- | free machine registers
[ra_freeregs] :: RA_State freeRegs -> !freeRegs
-- | assignment of temps to locations
[ra_assig] :: RA_State freeRegs -> RegMap Loc
-- | current stack delta
[ra_delta] :: RA_State freeRegs -> Int
-- | free stack slots for spilling
[ra_stack] :: RA_State freeRegs -> StackMap
-- | unique supply for generating names for join point fixup blocks.
[ra_us] :: RA_State freeRegs -> UniqSupply
-- | Record why things were spilled, for -ddrop-asm-stats. Just keep a list
-- here instead of a map of regs -> reasons. We don't want to slow
-- down the allocator if we're not going to emit the stats.
[ra_spills] :: RA_State freeRegs -> [SpillReason]
[ra_DynFlags] :: RA_State freeRegs -> DynFlags
-- | The register allocator monad type.
data RegM freeRegs a
-- | Run a computation in the RegM register allocator monad.
runR :: DynFlags -> BlockAssignment freeRegs -> freeRegs -> RegMap Loc -> StackMap -> UniqSupply -> RegM freeRegs a -> (BlockAssignment freeRegs, StackMap, RegAllocStats, a)
spillR :: Instruction instr => Reg -> Unique -> RegM freeRegs (instr, Int)
loadR :: Instruction instr => Reg -> Int -> RegM freeRegs instr
getFreeRegsR :: RegM freeRegs freeRegs
setFreeRegsR :: freeRegs -> RegM freeRegs ()
getAssigR :: RegM freeRegs (RegMap Loc)
setAssigR :: RegMap Loc -> RegM freeRegs ()
getBlockAssigR :: RegM freeRegs (BlockAssignment freeRegs)
setBlockAssigR :: BlockAssignment freeRegs -> RegM freeRegs ()
setDeltaR :: Int -> RegM freeRegs ()
getDeltaR :: RegM freeRegs Int
getUniqueR :: RegM freeRegs Unique
-- | Record that a spill instruction was inserted, for profiling.
recordSpill :: SpillReason -> RegM freeRegs ()
instance GHC.Base.Functor (RegAlloc.Linear.State.RegM freeRegs)
instance GHC.Base.Applicative (RegAlloc.Linear.State.RegM freeRegs)
instance GHC.Base.Monad (RegAlloc.Linear.State.RegM freeRegs)
instance DynFlags.HasDynFlags (RegAlloc.Linear.State.RegM a)
module RegAlloc.Graph.SpillCost
-- | Records the expected cost to spill some regster.
type SpillCostRecord = (VirtualReg, Int, Int, Int)
-- | Add two spill cost records.
plusSpillCostRecord :: SpillCostRecord -> SpillCostRecord -> SpillCostRecord
-- | Show a spill cost record, including the degree from the graph and
-- final calulated spill cost.
pprSpillCostRecord :: (VirtualReg -> RegClass) -> (Reg -> SDoc) -> Graph VirtualReg RegClass RealReg -> SpillCostRecord -> SDoc
-- | Map of SpillCostRecord
type SpillCostInfo = UniqFM SpillCostRecord
-- | An empty map of spill costs.
zeroSpillCostInfo :: SpillCostInfo
-- | Add two spill cost infos.
plusSpillCostInfo :: SpillCostInfo -> SpillCostInfo -> SpillCostInfo
-- | Slurp out information used for determining spill costs.
--
-- For each vreg, the number of times it was written to, read from, and
-- the number of instructions it was live on entry to (lifetime)
slurpSpillCostInfo :: (Outputable instr, Instruction instr) => Platform -> LiveCmmDecl statics instr -> SpillCostInfo
-- | Choose a node to spill from this graph
chooseSpill :: SpillCostInfo -> Graph VirtualReg RegClass RealReg -> VirtualReg
-- | Extract a map of register lifetimes from a SpillCostInfo.
lifeMapFromSpillCostInfo :: SpillCostInfo -> UniqFM (VirtualReg, Int)
-- | Clean out unneeded spill/reload instructions.
--
-- Handling of join points ~~~~~~~~~~~~~~~~~~~~~~~
--
-- B1: B2: ... ... RELOAD SLOT(0), %r1 RELOAD SLOT(0), %r1 ... A ... ...
-- B ... jump B3 jump B3
--
-- B3: ... C ... RELOAD SLOT(0), %r1 ...
--
-- The Plan ~~~~~~~~ As long as %r1 hasn't been written to in A, B or C
-- then we don't need the reload in B3.
--
-- What we really care about here is that on the entry to B3, %r1 will
-- always have the same value that is in SLOT(0) (ie, %r1 is _valid_)
--
-- This also works if the reloads in B1/B2 were spills instead, because
-- spilling %r1 to a slot makes that slot have the same value as %r1.
module RegAlloc.Graph.SpillClean
-- | Clean out unneeded spill/reloads from this top level thing.
cleanSpills :: Instruction instr => Platform -> LiveCmmDecl statics instr -> LiveCmmDecl statics instr
instance Unique.Uniquable RegAlloc.Graph.SpillClean.Store
instance Outputable.Outputable RegAlloc.Graph.SpillClean.Store
-- | When there aren't enough registers to hold all the vregs we have to
-- spill some of those vregs to slots on the stack. This module is used
-- modify the code to use those slots.
module RegAlloc.Graph.Spill
-- | Spill all these virtual regs to stack slots.
--
-- TODO: See if we can split some of the live ranges instead of just
-- globally spilling the virtual reg. This might make the spill cleaner's
-- job easier.
--
-- TODO: On CISCy x86 and x86_64 we don't nessesarally have to add a mov
-- instruction when making spills. If an instr is using a spilled virtual
-- we may be able to address the spill slot directly.
regSpill :: Instruction instr => Platform -> [LiveCmmDecl statics instr] -> UniqSet Int -> UniqSet VirtualReg -> UniqSM ([LiveCmmDecl statics instr], UniqSet Int, SpillStats)
-- | Spiller statistics. Tells us what registers were spilled.
data SpillStats
SpillStats :: UniqFM (Reg, Int, Int) -> SpillStats
[spillStoreLoad] :: SpillStats -> UniqFM (Reg, Int, Int)
-- | Add a spill/reload count to a stats record for a register.
accSpillSL :: (Reg, Int, Int) -> (Reg, Int, Int) -> (Reg, Int, Int)
instance Outputable.Outputable RegAlloc.Graph.Spill.SpillStats
-- | Register coalescing.
module RegAlloc.Graph.Coalesce
-- | Do register coalescing on this top level thing
--
-- For Reg -> Reg moves, if the first reg dies at the same time the
-- second reg is born then the mov only serves to join live ranges. The
-- two regs can be renamed to be the same and the move instruction safely
-- erased.
regCoalesce :: Instruction instr => [LiveCmmDecl statics instr] -> UniqSM [LiveCmmDecl statics instr]
-- | Slurp out mov instructions that only serve to join live ranges.
--
-- During a mov, if the source reg dies and the destiation reg is born
-- then we can rename the two regs to the same thing and eliminate the
-- move.
slurpJoinMovs :: Instruction instr => LiveCmmDecl statics instr -> Bag (Reg, Reg)
module PprC
writeCs :: DynFlags -> Handle -> [RawCmmGroup] -> IO ()
pprStringInCStyle :: [Word8] -> SDoc
instance GHC.Base.Functor PprC.TE
instance GHC.Base.Applicative PprC.TE
instance GHC.Base.Monad PprC.TE
-- | Handle conversion of CmmProc to LLVM code.
module LlvmCodeGen.CodeGen
-- | Top-level of the LLVM proc Code generator
genLlvmProc :: RawCmmDecl -> LlvmM [LlvmCmmDecl]
instance Data.Semigroup.Semigroup LlvmCodeGen.CodeGen.LlvmAccum
instance GHC.Base.Monoid LlvmCodeGen.CodeGen.LlvmAccum
module Debug
-- | Debug information about a block of code. Ticks scope over nested
-- blocks.
data DebugBlock
DebugBlock :: !Label -> !Label -> !CLabel -> !Bool -> !(Maybe DebugBlock) -> ![CmmTickish] -> !(Maybe CmmTickish) -> !(Maybe Int) -> [UnwindPoint] -> ![DebugBlock] -> DebugBlock
-- | Entry label of containing proc
[dblProcedure] :: DebugBlock -> !Label
-- | Hoopl label
[dblLabel] :: DebugBlock -> !Label
-- | Output label
[dblCLabel] :: DebugBlock -> !CLabel
-- | Has an info table?
[dblHasInfoTbl] :: DebugBlock -> !Bool
-- | The parent of this proc. See Note [Splitting DebugBlocks]
[dblParent] :: DebugBlock -> !(Maybe DebugBlock)
-- | Ticks defined in this block
[dblTicks] :: DebugBlock -> ![CmmTickish]
-- | Best source tick covering block
[dblSourceTick] :: DebugBlock -> !(Maybe CmmTickish)
-- | Output position relative to other blocks. Nothing means the
-- block was optimized out
[dblPosition] :: DebugBlock -> !(Maybe Int)
[dblUnwind] :: DebugBlock -> [UnwindPoint]
-- | Nested blocks
[dblBlocks] :: DebugBlock -> ![DebugBlock]
-- | Is this the entry block?
dblIsEntry :: DebugBlock -> Bool
-- | Extract debug data from a group of procedures. We will prefer source
-- notes that come from the given module (presumably the module that we
-- are currently compiling).
cmmDebugGen :: ModLocation -> RawCmmGroup -> [DebugBlock]
cmmDebugLabels :: (i -> Bool) -> GenCmmGroup d g (ListGraph i) -> [Label]
-- | Sets position and unwind table fields in the debug block tree
-- according to native generated code.
cmmDebugLink :: [Label] -> LabelMap [UnwindPoint] -> [DebugBlock] -> [DebugBlock]
-- | Converts debug blocks into a label map for easier lookups
debugToMap :: [DebugBlock] -> LabelMap DebugBlock
-- | Maps registers to expressions that yield their "old" values further up
-- the stack. Most interesting for the stack pointer Sp, but
-- might be useful to document saved registers, too. Note that a
-- register's value will be Nothing when the register's previous
-- value cannot be reconstructed.
type UnwindTable = Map GlobalReg (Maybe UnwindExpr)
-- | A label associated with an UnwindTable
data UnwindPoint
UnwindPoint :: !CLabel -> !UnwindTable -> UnwindPoint
-- | Expressions, used for unwind information
data UnwindExpr
-- | literal value
UwConst :: !Int -> UnwindExpr
-- | register plus offset
UwReg :: !GlobalReg -> !Int -> UnwindExpr
-- | pointer dereferencing
UwDeref :: UnwindExpr -> UnwindExpr
UwLabel :: CLabel -> UnwindExpr
UwPlus :: UnwindExpr -> UnwindExpr -> UnwindExpr
UwMinus :: UnwindExpr -> UnwindExpr -> UnwindExpr
UwTimes :: UnwindExpr -> UnwindExpr -> UnwindExpr
-- | Conversion of Cmm expressions to unwind expressions. We check for
-- unsupported operator usages and simplify the expression as far as
-- possible.
toUnwindExpr :: CmmExpr -> UnwindExpr
instance GHC.Classes.Eq Debug.UnwindExpr
instance Outputable.Outputable Debug.DebugBlock
instance Outputable.Outputable Debug.UnwindPoint
instance Outputable.Outputable Debug.UnwindExpr
module CmmOpt
constantFoldNode :: DynFlags -> CmmNode e x -> CmmNode e x
constantFoldExpr :: DynFlags -> CmmExpr -> CmmExpr
cmmMachOpFold :: DynFlags -> MachOp -> [CmmExpr] -> CmmExpr
cmmMachOpFoldM :: DynFlags -> MachOp -> [CmmExpr] -> Maybe CmmExpr
module CmmLive
type CmmLocalLive = CmmLive LocalReg
-- | Calculated liveness info for a CmmGraph
cmmLocalLiveness :: DynFlags -> CmmGraph -> BlockEntryLiveness LocalReg
cmmGlobalLiveness :: DynFlags -> CmmGraph -> BlockEntryLiveness GlobalReg
-- | The dataflow lattice
liveLattice :: Ord r => DataflowLattice (CmmLive r)
gen_kill :: (DefinerOfRegs r n, UserOfRegs r n) => DynFlags -> n -> CmmLive r -> CmmLive r
module CmmSink
cmmSink :: DynFlags -> CmmGraph -> CmmGraph
module CmmLint
cmmLint :: (Outputable d, Outputable h) => DynFlags -> GenCmmGroup d h CmmGraph -> Maybe SDoc
cmmLintGraph :: DynFlags -> CmmGraph -> Maybe SDoc
instance GHC.Base.Functor CmmLint.CmmLint
instance GHC.Base.Applicative CmmLint.CmmLint
instance GHC.Base.Monad CmmLint.CmmLint
instance DynFlags.HasDynFlags CmmLint.CmmLint
module CmmInfo
mkEmptyContInfoTable :: CLabel -> CmmInfoTable
cmmToRawCmm :: DynFlags -> Stream IO CmmGroup () -> IO (Stream IO RawCmmGroup ())
mkInfoTable :: DynFlags -> CmmDecl -> UniqSM [RawCmmDecl]
-- | Value of the srt field of an info table when using an StgLargeSRT
srtEscape :: DynFlags -> StgHalfWord
closureInfoPtr :: DynFlags -> CmmExpr -> CmmExpr
entryCode :: DynFlags -> CmmExpr -> CmmExpr
getConstrTag :: DynFlags -> CmmExpr -> CmmExpr
cmmGetClosureType :: DynFlags -> CmmExpr -> CmmExpr
infoTable :: DynFlags -> CmmExpr -> CmmExpr
infoTableConstrTag :: DynFlags -> CmmExpr -> CmmExpr
infoTableSrtBitmap :: DynFlags -> CmmExpr -> CmmExpr
infoTableClosureType :: DynFlags -> CmmExpr -> CmmExpr
infoTablePtrs :: DynFlags -> CmmExpr -> CmmExpr
infoTableNonPtrs :: DynFlags -> CmmExpr -> CmmExpr
funInfoTable :: DynFlags -> CmmExpr -> CmmExpr
funInfoArity :: DynFlags -> CmmExpr -> CmmExpr
stdInfoTableSizeW :: DynFlags -> WordOff
fixedInfoTableSizeW :: WordOff
profInfoTableSizeW :: WordOff
maxStdInfoTableSizeW :: WordOff
maxRetInfoTableSizeW :: WordOff
stdInfoTableSizeB :: DynFlags -> ByteOff
conInfoTableSizeB :: DynFlags -> Int
stdSrtBitmapOffset :: DynFlags -> ByteOff
stdClosureTypeOffset :: DynFlags -> ByteOff
stdPtrsOffset :: DynFlags -> ByteOff
stdNonPtrsOffset :: DynFlags -> ByteOff
module CmmProcPoint
type ProcPointSet = LabelSet
data Status
ReachedBy :: ProcPointSet -> Status
ProcPoint :: Status
callProcPoints :: CmmGraph -> ProcPointSet
minimalProcPointSet :: Platform -> ProcPointSet -> CmmGraph -> UniqSM ProcPointSet
splitAtProcPoints :: DynFlags -> CLabel -> ProcPointSet -> ProcPointSet -> LabelMap Status -> CmmDecl -> UniqSM [CmmDecl]
procPointAnalysis :: ProcPointSet -> CmmGraph -> LabelMap Status
attachContInfoTables :: ProcPointSet -> CmmDecl -> CmmDecl
instance Outputable.Outputable CmmProcPoint.Status
module CmmImplementSwitchPlans
-- | Traverses the CmmGraph, making sure that CmmSwitch are
-- suitable for code generation.
cmmImplementSwitchPlans :: DynFlags -> CmmGraph -> UniqSM CmmGraph
module CmmContFlowOpt
cmmCfgOpts :: Bool -> CmmGraph -> CmmGraph
cmmCfgOptsProc :: Bool -> CmmDecl -> CmmDecl
removeUnreachableBlocksProc :: CmmDecl -> CmmDecl
replaceLabels :: LabelMap BlockId -> CmmGraph -> CmmGraph
module CmmCommonBlockElim
elimCommonBlocks :: CmmGraph -> CmmGraph
module CmmCallConv
data ParamLocation
RegisterParam :: GlobalReg -> ParamLocation
StackParam :: ByteOff -> ParamLocation
-- | Given a list of arguments, and a function that tells their types,
-- return a list showing where each argument is passed
assignArgumentsPos :: DynFlags -> ByteOff -> Convention -> (a -> CmmType) -> [a] -> (ByteOff, [(a, ParamLocation)])
assignStack :: DynFlags -> ByteOff -> (a -> CmmType) -> [a] -> (ByteOff, [(a, ParamLocation)])
realArgRegsCover :: DynFlags -> [GlobalReg]
instance Outputable.Outputable CmmCallConv.ParamLocation
module MkGraph
-- | CmmAGraph is a chunk of code consisting of:
--
--
-- - ordinary statements (assignments, stores etc.)
-- - jumps
-- - labels
-- - out-of-line labelled blocks
--
--
-- The semantics is that control falls through labels and out-of-line
-- blocks. Everything after a jump up to the next label is by definition
-- unreachable code, and will be discarded.
--
-- Two CmmAGraphs can be stuck together with *, with the meaning
-- that control flows from the first to the second.
--
-- A CmmAGraph can be turned into a CmmGraph (closed at
-- both ends) by providing a label for the entry point and a tick scope;
-- see labelAGraph.
type CmmAGraph = OrdList CgStmt
-- | Unlabeled graph with tick scope
type CmmAGraphScoped = (CmmAGraph, CmmTickScope)
data CgStmt
CgLabel :: BlockId -> CmmTickScope -> CgStmt
CgStmt :: (CmmNode O O) -> CgStmt
CgLast :: (CmmNode O C) -> CgStmt
CgFork :: BlockId -> CmmAGraph -> CmmTickScope -> CgStmt
(<*>) :: CmmAGraph -> CmmAGraph -> CmmAGraph
catAGraphs :: [CmmAGraph] -> CmmAGraph
-- | created a sequence "goto id; id:" as an AGraph
mkLabel :: BlockId -> CmmTickScope -> CmmAGraph
-- | creates an open AGraph from a given node
mkMiddle :: CmmNode O O -> CmmAGraph
-- | created a closed AGraph from a given node
mkLast :: CmmNode O C -> CmmAGraph
-- | A labelled code block; should end in a last node
outOfLine :: BlockId -> CmmAGraphScoped -> CmmAGraph
-- | allocate a fresh label for the entry point
lgraphOfAGraph :: CmmAGraphScoped -> UniqSM CmmGraph
-- | use the given BlockId as the label of the entry point
labelAGraph :: BlockId -> CmmAGraphScoped -> CmmGraph
stackStubExpr :: Width -> CmmExpr
mkNop :: CmmAGraph
mkAssign :: CmmReg -> CmmExpr -> CmmAGraph
mkStore :: CmmExpr -> CmmExpr -> CmmAGraph
mkUnsafeCall :: ForeignTarget -> [CmmFormal] -> [CmmActual] -> CmmAGraph
mkFinalCall :: DynFlags -> CmmExpr -> CCallConv -> [CmmExpr] -> UpdFrameOffset -> CmmAGraph
mkCallReturnsTo :: DynFlags -> CmmExpr -> Convention -> [CmmExpr] -> BlockId -> ByteOff -> UpdFrameOffset -> [CmmExpr] -> CmmAGraph
mkJumpReturnsTo :: DynFlags -> CmmExpr -> Convention -> [CmmExpr] -> BlockId -> ByteOff -> UpdFrameOffset -> CmmAGraph
mkJump :: DynFlags -> Convention -> CmmExpr -> [CmmExpr] -> UpdFrameOffset -> CmmAGraph
mkJumpExtra :: DynFlags -> Convention -> CmmExpr -> [CmmExpr] -> UpdFrameOffset -> [CmmExpr] -> CmmAGraph
-- | A jump where the caller says what the live GlobalRegs are. Used for
-- low-level hand-written Cmm.
mkRawJump :: DynFlags -> CmmExpr -> UpdFrameOffset -> [GlobalReg] -> CmmAGraph
mkCbranch :: CmmExpr -> BlockId -> BlockId -> Maybe Bool -> CmmAGraph
mkSwitch :: CmmExpr -> SwitchTargets -> CmmAGraph
mkReturn :: DynFlags -> CmmExpr -> [CmmExpr] -> UpdFrameOffset -> CmmAGraph
mkComment :: FastString -> CmmAGraph
mkCallEntry :: DynFlags -> Convention -> [CmmFormal] -> [CmmFormal] -> (Int, [GlobalReg], CmmAGraph)
mkBranch :: BlockId -> CmmAGraph
-- | Construct a CmmUnwind node for the given register and unwinding
-- expression.
mkUnwind :: GlobalReg -> CmmExpr -> CmmAGraph
copyInOflow :: DynFlags -> Convention -> Area -> [CmmFormal] -> [CmmFormal] -> (Int, [GlobalReg], CmmAGraph)
copyOutOflow :: DynFlags -> Convention -> Transfer -> Area -> [CmmExpr] -> UpdFrameOffset -> [CmmExpr] -> (Int, [GlobalReg], CmmAGraph)
noExtraStack :: [CmmExpr]
toCall :: CmmExpr -> Maybe BlockId -> UpdFrameOffset -> ByteOff -> ByteOff -> [GlobalReg] -> CmmAGraph
data Transfer
Call :: Transfer
JumpRet :: Transfer
Jump :: Transfer
Ret :: Transfer
instance GHC.Classes.Eq MkGraph.Transfer
module CmmBuildInfoTables
type CAFSet = Set CLabel
type CAFEnv = LabelMap CAFSet
-- | An analysis to find live CAFs.
cafAnal :: CmmGraph -> CAFEnv
doSRTs :: DynFlags -> TopSRT -> [(CAFEnv, [CmmDecl])] -> IO (TopSRT, [CmmDecl])
data TopSRT
emptySRT :: MonadUnique m => m TopSRT
isEmptySRT :: TopSRT -> Bool
srtToData :: TopSRT -> CmmGroup
instance Outputable.Outputable CmmBuildInfoTables.TopSRT
module CgUtils
-- | Fixup global registers so that they assign to locations within the
-- RegTable if they aren't pinned for the current target.
fixStgRegisters :: DynFlags -> RawCmmDecl -> RawCmmDecl
-- | This is the top-level module in the LLVM code generator.
module LlvmCodeGen
-- | Top-level of the LLVM Code generator
llvmCodeGen :: DynFlags -> Handle -> UniqSupply -> Stream IO RawCmmGroup () -> IO ()
-- | Read in assembly file and process
llvmFixupAsm :: DynFlags -> FilePath -> FilePath -> IO ()
-- | A module concerned with finding the free variables of an expression.
module CoreFVs
-- | Find all locally-defined free Ids or type variables in an expression
-- returning a non-deterministic set.
exprFreeVars :: CoreExpr -> VarSet
-- | Find all locally-defined free Ids or type variables in an expression
-- returning a deterministic set.
exprFreeVarsDSet :: CoreExpr -> DVarSet
-- | Find all locally-defined free Ids or type variables in an expression
-- returning a deterministically ordered list.
exprFreeVarsList :: CoreExpr -> [Var]
-- | Find all locally-defined free Ids in an expression
exprFreeIds :: CoreExpr -> IdSet
-- | Find all locally-defined free Ids in an expression returning a
-- deterministic set.
exprFreeIdsDSet :: CoreExpr -> DIdSet
-- | Find all locally-defined free Ids in an expression returning a
-- deterministically ordered list.
exprFreeIdsList :: CoreExpr -> [Id]
-- | Find all locally-defined free Ids in several expressions returning a
-- deterministic set.
exprsFreeIdsDSet :: [CoreExpr] -> DIdSet
-- | Find all locally-defined free Ids in several expressions returning a
-- deterministically ordered list.
exprsFreeIdsList :: [CoreExpr] -> [Id]
-- | Find all locally-defined free Ids or type variables in several
-- expressions returning a non-deterministic set.
exprsFreeVars :: [CoreExpr] -> VarSet
-- | Find all locally-defined free Ids or type variables in several
-- expressions returning a deterministically ordered list.
exprsFreeVarsList :: [CoreExpr] -> [Var]
-- | Find all locally defined free Ids in a binding group
bindFreeVars :: CoreBind -> VarSet
-- | Predicate on possible free variables: returns True iff the
-- variable is interesting
type InterestingVarFun = Var -> Bool
-- | Finds free variables in an expression selected by a predicate
exprSomeFreeVars :: InterestingVarFun -> CoreExpr -> VarSet
-- | Finds free variables in several expressions selected by a predicate
exprsSomeFreeVars :: InterestingVarFun -> [CoreExpr] -> VarSet
-- | Finds free variables in an expression selected by a predicate
-- returning a deterministically ordered list.
exprSomeFreeVarsList :: InterestingVarFun -> CoreExpr -> [Var]
-- | Finds free variables in several expressions selected by a predicate
-- returning a deterministically ordered list.
exprsSomeFreeVarsList :: InterestingVarFun -> [CoreExpr] -> [Var]
varTypeTyCoVars :: Var -> TyCoVarSet
varTypeTyCoFVs :: Var -> FV
idUnfoldingVars :: Id -> VarSet
idFreeVars :: Id -> VarSet
dIdFreeVars :: Id -> DVarSet
bndrRuleAndUnfoldingVarsDSet :: Id -> DVarSet
idFVs :: Id -> FV
idRuleVars :: Id -> VarSet
idRuleRhsVars :: (Activation -> Bool) -> Id -> VarSet
stableUnfoldingVars :: Unfolding -> Maybe VarSet
-- | Those variables free in the right hand side of a rule returned as a
-- non-deterministic set
ruleRhsFreeVars :: CoreRule -> VarSet
-- | Those variables free in the both the left right hand sides of a rule
-- returned as a non-deterministic set
ruleFreeVars :: CoreRule -> VarSet
-- | Those variables free in the right hand side of several rules
rulesFreeVars :: [CoreRule] -> VarSet
-- | Those variables free in the both the left right hand sides of rules
-- returned as a deterministic set
rulesFreeVarsDSet :: [CoreRule] -> DVarSet
-- | This finds all locally-defined free Ids on the left hand side of a
-- rule and returns them as a non-deterministic set
ruleLhsFreeIds :: CoreRule -> VarSet
-- | This finds all locally-defined free Ids on the left hand side of a
-- rule and returns them as a determinisitcally ordered list
ruleLhsFreeIdsList :: CoreRule -> [Var]
-- | Free variables of a vectorisation declaration
vectsFreeVars :: [CoreVect] -> VarSet
expr_fvs :: CoreExpr -> FV
orphNamesOfType :: Type -> NameSet
orphNamesOfCo :: Coercion -> NameSet
orphNamesOfAxiom :: CoAxiom br -> NameSet
orphNamesOfTypes :: [Type] -> NameSet
orphNamesOfCoCon :: CoAxiom br -> NameSet
-- | Finds the free external names of several expressions: see
-- exprOrphNames for details
exprsOrphNames :: [CoreExpr] -> NameSet
-- | orphNamesOfAxiom collects the names of the concrete types and type
-- constructors that make up the LHS of a type family instance, including
-- the family name itself.
--
-- For instance, given `type family Foo a b`: `type instance Foo (F (G (H
-- a))) b = ...` would yield [Foo,F,G,H]
--
-- Used in the implementation of ":info" in GHCi.
orphNamesOfFamInst :: FamInst -> NameSet
data FVAnn
-- | Every node in an expression annotated with its (non-global) free
-- variables, both Ids and TyVars, and type.
type CoreExprWithFVs = AnnExpr Id FVAnn
type CoreExprWithFVs' = AnnExpr' Id FVAnn
-- | Every node in a binding group annotated with its (non-global) free
-- variables, both Ids and TyVars, and type.
type CoreBindWithFVs = AnnBind Id FVAnn
-- | Every node in an expression annotated with its (non-global) free
-- variables, both Ids and TyVars, and type.
type CoreAltWithFVs = AnnAlt Id FVAnn
-- | Annotate a CoreExpr with its (non-global) free type and value
-- variables at every tree node
freeVars :: CoreExpr -> CoreExprWithFVs
freeVarsBind :: CoreBind -> DVarSet -> (CoreBindWithFVs, DVarSet)
-- | Inverse function to freeVars
freeVarsOf :: CoreExprWithFVs -> DIdSet
-- | Extract the vars free in an annotated expression's type
freeVarsOfType :: CoreExprWithFVs -> DTyCoVarSet
-- | Extract the vars reported in a FVAnn
freeVarsOfAnn :: FVAnn -> DIdSet
-- | Extract the type-level vars reported in a FVAnn
freeVarsOfTypeAnn :: FVAnn -> DTyCoVarSet
-- | Extract the type of an annotated expression. (This is cheap.)
exprTypeFV :: CoreExprWithFVs -> Type
module TcType
type TcType = Type
type TcSigmaType = TcType
type TcRhoType = TcType
type TcTauType = TcType
type TcPredType = PredType
type TcThetaType = ThetaType
type TcTyVar = TyVar
type TcTyVarSet = TyVarSet
type TcDTyVarSet = DTyVarSet
type TcTyCoVarSet = TyCoVarSet
type TcDTyCoVarSet = DTyCoVarSet
type TcKind = Kind
type TcCoVar = CoVar
type TcTyCoVar = Var
type TcTyVarBinder = TyVarBinder
type TcTyCon = TyCon
-- | An expected type to check against during type-checking. See Note
-- [ExpType] in TcMType, where you'll also find manipulators.
data ExpType
Check :: TcType -> ExpType
Infer :: !InferResult -> ExpType
data InferResult
IR :: Unique -> TcLevel -> Bool -> IORef (Maybe TcType) -> InferResult
[ir_uniq] :: InferResult -> Unique
[ir_lvl] :: InferResult -> TcLevel
[ir_inst] :: InferResult -> Bool
[ir_ref] :: InferResult -> IORef (Maybe TcType)
type ExpSigmaType = ExpType
type ExpRhoType = ExpType
-- | Make an ExpType suitable for checking.
mkCheckExpType :: TcType -> ExpType
-- | What to expect for an argument to a rebindable-syntax operator. Quite
-- like Type, but allows for holes to be filled in by tcSyntaxOp.
-- The callback called from tcSyntaxOp gets a list of types; the meaning
-- of these types is determined by a left-to-right depth-first traversal
-- of the SyntaxOpType tree. So if you pass in
--
--
-- SynAny `SynFun` (SynList `SynFun` SynType Int) `SynFun` SynAny
--
--
-- you'll get three types back: one for the first SynAny, the
-- element type of the list, and one for the last SynAny.
-- You don't get anything for the SynType, because you've said
-- positively that it should be an Int, and so it shall be.
--
-- This is defined here to avoid defining it in TcExpr.hs-boot.
data SyntaxOpType
-- | Any type
SynAny :: SyntaxOpType
-- | A rho type, deeply skolemised or instantiated as appropriate
SynRho :: SyntaxOpType
-- | A list type. You get back the element type of the list
SynList :: SyntaxOpType
-- | A function.
SynFun :: SyntaxOpType -> SyntaxOpType -> SyntaxOpType
-- | A known type.
SynType :: ExpType -> SyntaxOpType
-- | Like SynType but accepts a regular TcType
synKnownType :: TcType -> SyntaxOpType
-- | Like mkFunTys but for SyntaxOpType
mkSynFunTys :: [SyntaxOpType] -> ExpType -> SyntaxOpType
newtype TcLevel
TcLevel :: Int -> TcLevel
topTcLevel :: TcLevel
pushTcLevel :: TcLevel -> TcLevel
isTopTcLevel :: TcLevel -> Bool
strictlyDeeperThan :: TcLevel -> TcLevel -> Bool
sameDepthAs :: TcLevel -> TcLevel -> Bool
fmvTcLevel :: TcLevel -> TcLevel
tcTypeLevel :: TcType -> TcLevel
tcTyVarLevel :: TcTyVar -> TcLevel
maxTcLevel :: TcLevel -> TcLevel -> TcLevel
data UserTypeCtxt
FunSigCtxt :: Name -> Bool -> UserTypeCtxt
InfSigCtxt :: Name -> UserTypeCtxt
ExprSigCtxt :: UserTypeCtxt
TypeAppCtxt :: UserTypeCtxt
ConArgCtxt :: Name -> UserTypeCtxt
TySynCtxt :: Name -> UserTypeCtxt
PatSynCtxt :: Name -> UserTypeCtxt
PatSigCtxt :: UserTypeCtxt
RuleSigCtxt :: Name -> UserTypeCtxt
ResSigCtxt :: UserTypeCtxt
ForSigCtxt :: Name -> UserTypeCtxt
DefaultDeclCtxt :: UserTypeCtxt
InstDeclCtxt :: UserTypeCtxt
SpecInstCtxt :: UserTypeCtxt
ThBrackCtxt :: UserTypeCtxt
GenSigCtxt :: UserTypeCtxt
GhciCtxt :: UserTypeCtxt
ClassSCCtxt :: Name -> UserTypeCtxt
SigmaCtxt :: UserTypeCtxt
DataTyCtxt :: Name -> UserTypeCtxt
pprUserTypeCtxt :: UserTypeCtxt -> SDoc
isSigMaybe :: UserTypeCtxt -> Maybe Name
data TcTyVarDetails
SkolemTv :: TcLevel -> Bool -> TcTyVarDetails
FlatSkol :: TcType -> TcTyVarDetails
RuntimeUnk :: TcTyVarDetails
MetaTv :: MetaInfo -> IORef MetaDetails -> TcLevel -> TcTyVarDetails
[mtv_info] :: TcTyVarDetails -> MetaInfo
[mtv_ref] :: TcTyVarDetails -> IORef MetaDetails
[mtv_tclvl] :: TcTyVarDetails -> TcLevel
pprTcTyVarDetails :: TcTyVarDetails -> SDoc
vanillaSkolemTv :: TcTyVarDetails
superSkolemTv :: TcTyVarDetails
data MetaDetails
Flexi :: MetaDetails
Indirect :: TcType -> MetaDetails
data MetaInfo
TauTv :: MetaInfo
SigTv :: MetaInfo
FlatMetaTv :: MetaInfo
isImmutableTyVar :: TyVar -> Bool
isSkolemTyVar :: TcTyVar -> Bool
isMetaTyVar :: TcTyVar -> Bool
isMetaTyVarTy :: TcType -> Bool
isTyVarTy :: Type -> Bool
isSigTyVar :: Var -> Bool
isOverlappableTyVar :: TcTyVar -> Bool
isTyConableTyVar :: TcTyVar -> Bool
-- | True of FlatSkol skolems only
isFskTyVar :: TcTyVar -> Bool
isFmvTyVar :: TcTyVar -> Bool
-- | True of both given and wanted flatten-skolems (fak and usk)
isFlattenTyVar :: TcTyVar -> Bool
isAmbiguousTyVar :: TcTyVar -> Bool
metaTyVarRef :: TyVar -> IORef MetaDetails
metaTyVarInfo :: TcTyVar -> MetaInfo
isFlexi :: MetaDetails -> Bool
isIndirect :: MetaDetails -> Bool
isRuntimeUnkSkol :: TyVar -> Bool
metaTyVarTcLevel :: TcTyVar -> TcLevel
setMetaTyVarTcLevel :: TcTyVar -> TcLevel -> TcTyVar
metaTyVarTcLevel_maybe :: TcTyVar -> Maybe TcLevel
isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
isTouchableOrFmv :: TcLevel -> TcTyVar -> Bool
isFloatedTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
mkPhiTy :: [PredType] -> Type -> Type
-- | Make a sigma ty where all type variables are Inferred. That is,
-- they cannot be used with visible type application.
mkInfSigmaTy :: [TyVar] -> [PredType] -> Type -> Type
-- | Make a sigma ty where all type variables are "specified". That is,
-- they can be used with visible type application
mkSpecSigmaTy :: [TyVar] -> [PredType] -> Type -> Type
mkSigmaTy :: [TyVarBinder] -> [PredType] -> Type -> Type
mkNakedTyConApp :: TyCon -> [Type] -> Type
mkNakedAppTys :: Type -> [Type] -> Type
mkNakedAppTy :: Type -> Type -> Type
mkNakedCastTy :: Type -> Coercion -> Type
-- | Attempts to obtain the type variable underlying a Type, and
-- panics with the given message if this is not a type variable type. See
-- also getTyVar_maybe
getTyVar :: String -> Type -> TyVar
tcSplitForAllTy_maybe :: Type -> Maybe (TyVarBinder, Type)
-- | Like tcSplitPiTys, but splits off only named binders, returning
-- just the tycovars.
tcSplitForAllTys :: Type -> ([TyVar], Type)
-- | Splits a forall type into a list of TyBinders and the inner
-- type. Always succeeds, even if it returns an empty list.
tcSplitPiTys :: Type -> ([TyBinder], Type)
-- | Like tcSplitForAllTys, but splits off only named binders.
tcSplitForAllTyVarBndrs :: Type -> ([TyVarBinder], Type)
tcSplitPhiTy :: Type -> (ThetaType, Type)
tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type)
tcSplitFunTy_maybe :: Type -> Maybe (Type, Type)
tcSplitFunTys :: Type -> ([Type], Type)
tcFunArgTy :: Type -> Type
tcFunResultTy :: Type -> Type
-- | Strips off n *visible* arguments and returns the resulting type
tcFunResultTyN :: HasDebugCallStack => Arity -> Type -> Type
-- | Split off exactly the specified number argument types Returns (Left m)
-- if there are m missing arrows in the type (Right (tys,res))
-- if the type looks like t1 -> ... -> tn -> res
tcSplitFunTysN :: Arity -> TcRhoType -> Either Arity ([TcSigmaType], TcSigmaType)
tcSplitTyConApp :: Type -> (TyCon, [Type])
-- | Split a type constructor application into its type constructor and
-- applied types. Note that this may fail in the case of a FunTy
-- with an argument of unknown kind FunTy (e.g. FunTy (a :: k)
-- Int. since the kind of a isn't of the form TYPE
-- rep). Consequently, you may need to zonk your type before using
-- this function.
--
-- If you only need the TyCon, consider using
-- tcTyConAppTyCon_maybe.
tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
-- | Like tcSplitTyConApp_maybe but doesn't look through type
-- synonyms.
tcRepSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
-- | Like tcRepSplitTyConApp_maybe, but returns Nothing if,
--
--
-- - the type is structurally not a type constructor application,
-- or
-- - the type is a function type (e.g. application of funTyCon),
-- but we currently don't even enough information to fully determine its
-- RuntimeRep variables. For instance, FunTy (a :: k) Int.
--
--
-- By contrast tcRepSplitTyConApp_maybe panics in the second case.
--
-- The behavior here is needed during canonicalization; see Note [FunTy
-- and decomposing tycon applications] in TcCanonical for details.
tcRepSplitTyConApp_maybe' :: HasCallStack => Type -> Maybe (TyCon, [Type])
tcTyConAppTyCon :: Type -> TyCon
-- | Like tcRepSplitTyConApp_maybe, but only returns the
-- TyCon.
tcTyConAppTyCon_maybe :: Type -> Maybe TyCon
tcTyConAppArgs :: Type -> [Type]
tcSplitAppTy_maybe :: Type -> Maybe (Type, Type)
tcSplitAppTy :: Type -> (Type, Type)
tcSplitAppTys :: Type -> (Type, [Type])
-- | Does the AppTy split as in tcSplitAppTy_maybe, but assumes
-- that any coreView stuff is already done. Refuses to look through (c
-- => t)
tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type)
tcGetTyVar_maybe :: Type -> Maybe TyVar
tcGetTyVar :: String -> Type -> TyVar
-- | What is the role assigned to the next parameter of this type? Usually,
-- this will be Nominal, but if the type is a TyConApp, we
-- may be able to do better. The type does *not* have to be well-kinded
-- when applied for this to work!
nextRole :: Type -> Role
-- | Split a sigma type into its parts.
tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type)
-- | Split a sigma type into its parts, going underneath as many
-- ForAllTys as possible. For example, given this type synonym:
--
--
-- type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t
--
--
-- if you called tcSplitSigmaTy on this type:
--
--
-- forall s t a b. Each s t a b => Traversal s t a b
--
--
-- then it would return ([s,t,a,b], [Each s t a b], Traversal s t a
-- b). But if you instead called tcSplitNestedSigmaTys on
-- the type, it would return ([s,t,a,b,f], [Each s t a b, Applicative
-- f], (a -> f b) -> s -> f t).
tcSplitNestedSigmaTys :: Type -> ([TyVar], ThetaType, Type)
tcDeepSplitSigmaTy_maybe :: TcSigmaType -> Maybe ([TcType], [TyVar], ThetaType, TcSigmaType)
-- | Type equality on source types. Does not look through newtypes
-- or PredTypes, but it does look through type synonyms. This
-- first checks that the kinds of the types are equal and then checks
-- whether the types are equal, ignoring casts and coercions. (The kind
-- check is a recursive call, but since all kinds have type
-- Type, there is no need to check the types of kinds.) See also
-- Note [Non-trivial definitional equality] in TyCoRep.
eqType :: Type -> Type -> Bool
-- | Type equality on lists of types, looking through type synonyms but not
-- newtypes.
eqTypes :: [Type] -> [Type] -> Bool
nonDetCmpType :: Type -> Type -> Ordering
nonDetCmpTypes :: [Type] -> [Type] -> Ordering
-- | Compare types with respect to a (presumably) non-empty RnEnv2.
eqTypeX :: RnEnv2 -> Type -> Type -> Bool
-- | Like pickyEqTypeVis, but returns a Bool for convenience
pickyEqType :: TcType -> TcType -> Bool
tcEqType :: TcType -> TcType -> Bool
tcEqKind :: TcKind -> TcKind -> Bool
-- | Just like tcEqType, but will return True for types of different
-- kinds as long as their non-coercion structure is identical.
tcEqTypeNoKindCheck :: TcType -> TcType -> Bool
-- | Like tcEqType, but returns information about whether the
-- difference is visible in the case of a mismatch. Nothing :
-- the types are equal Just True : the types differ, and the
-- point of difference is visible Just False : the types differ,
-- and the point of difference is invisible
tcEqTypeVis :: TcType -> TcType -> Maybe Bool
isSigmaTy :: TcType -> Bool
isRhoTy :: TcType -> Bool
-- | Like isRhoTy, but also says True for Infer types
isRhoExpTy :: ExpType -> Bool
isOverloadedTy :: Type -> Bool
-- | Does a type represent a floating-point number?
isFloatingTy :: Type -> Bool
isDoubleTy :: Type -> Bool
isFloatTy :: Type -> Bool
isIntTy :: Type -> Bool
isWordTy :: Type -> Bool
-- | Is a type String?
isStringTy :: Type -> Bool
isIntegerTy :: Type -> Bool
isBoolTy :: Type -> Bool
isUnitTy :: Type -> Bool
isCharTy :: Type -> Bool
-- | Is a type a CallStack?
isCallStackTy :: Type -> Bool
-- | Is a PredType a CallStack implicit parameter?
--
-- If so, return the name of the parameter.
isCallStackPred :: PredType -> Maybe FastString
isTauTy :: Type -> Bool
isTauTyCon :: TyCon -> Bool
tcIsTyVarTy :: Type -> Bool
-- | Is this a ForAllTy with a named binder?
tcIsForAllTy :: Type -> Bool
-- | Is the type suitable to classify a given/wanted in the typechecker?
isPredTy :: Type -> Bool
isTyVarClassPred :: PredType -> Bool
-- | Does the given tyvar appear in the given type outside of any
-- non-newtypes? Assume we're looking for a. Says "yes" for
-- a, N a, b a, a b, b (N
-- a). Says "no" for [a], Maybe a, T a,
-- where N is a newtype and T is a datatype.
isTyVarExposed :: TcTyVar -> TcType -> Bool
-- | Is the equality a ~r ...a.... definitely insoluble or not? a ~r Maybe
-- a -- Definitely insoluble a ~N ...(F a)... -- Not definitely insoluble
-- -- Perhaps (F a) reduces to Int a ~R ...(N a)... -- Not definitely
-- insoluble -- Perhaps newtype N a = MkN Int See Note [Occurs check
-- error] in TcCanonical for the motivation for this function.
isInsolubleOccursCheck :: EqRel -> TcTyVar -> TcType -> Bool
checkValidClsArgs :: Bool -> Class -> [KindOrType] -> Bool
hasTyVarHead :: Type -> Bool
-- | True of all Nominal equalities that are solidly insoluble This means
-- all equalities *except* * Meta-tv non-SigTv on LHS * Meta-tv SigTv on
-- LHS, tyvar on right
isRigidEqPred :: TcLevel -> PredTree -> Bool
isRigidTy :: TcType -> Bool
deNoteType :: Type -> Type
orphNamesOfType :: Type -> NameSet
orphNamesOfCo :: Coercion -> NameSet
orphNamesOfTypes :: [Type] -> NameSet
orphNamesOfCoCon :: CoAxiom br -> NameSet
getDFunTyKey :: Type -> OccName
evVarPred_maybe :: EvVar -> Maybe PredType
evVarPred :: EvVar -> PredType
mkMinimalBySCs :: [PredType] -> [PredType]
transSuperClasses :: PredType -> [PredType]
-- | When inferring types, should we quantify over a given predicate?
-- Generally true of classes; generally false of equality constraints.
-- Equality constraints that mention quantified type variables and
-- implicit variables complicate the story. See Notes [Inheriting
-- implicit parameters] and [Quantifying over equality constraints]
pickQuantifiablePreds :: TyVarSet -> TcThetaType -> TcThetaType
pickCapturedPreds :: TyVarSet -> TcThetaType -> TcThetaType
immSuperClasses :: Class -> [Type] -> [PredType]
isImprovementPred :: PredType -> Bool
-- | Finds outermost type-family applications occuring in a type, after
-- expanding synonyms. In the list (F, tys) that is returned we guarantee
-- that tys matches F's arity. For example, given type family F a :: *
-- -> * (arity 1) calling tcTyFamInsts on (Maybe (F Int Bool) will
-- return (F, [Int]), not (F, [Int,Bool])
--
-- This is important for its use in deciding termination of type
-- instances (see Trac #11581). E.g. type instance G [Int] = ...(F Int
-- type)... we don't need to take type into account when
-- asking if the calls on the RHS are smaller than the LHS
tcTyFamInsts :: Type -> [(TyCon, [Type])]
-- | Check that a type does not contain any type family applications.
isTyFamFree :: Type -> Bool
exactTyCoVarsOfType :: Type -> TyCoVarSet
exactTyCoVarsOfTypes :: [Type] -> TyVarSet
-- | Worker for splitDepVarsOfType. This might output the same var
-- in both sets, if it's used in both a type and a kind. See Note
-- [CandidatesQTvs determinism and order] See Note [Dependent type
-- variables]
candidateQTyVarsOfType :: Type -> CandidatesQTvs
-- | Like splitDepVarsOfType, but over a list of types
candidateQTyVarsOfTypes :: [Type] -> CandidatesQTvs
data CandidatesQTvs
DV :: DTyCoVarSet -> DTyVarSet -> CandidatesQTvs
[dv_kvs] :: CandidatesQTvs -> DTyCoVarSet
[dv_tvs] :: CandidatesQTvs -> DTyVarSet
anyRewritableTyVar :: Bool -> (TcTyVar -> Bool) -> TcType -> Bool
-- | Find all variables bound anywhere in a type. See also Note
-- [Scope-check inferred kinds] in TcHsType
allBoundVariables :: Type -> TyVarSet
allBoundVariabless :: [Type] -> TyVarSet
isFFIArgumentTy :: DynFlags -> Safety -> Type -> Validity
isFFIImportResultTy :: DynFlags -> Type -> Validity
isFFIExportResultTy :: Type -> Validity
isFFIExternalTy :: Type -> Validity
isFFIDynTy :: Type -> Type -> Validity
isFFIPrimArgumentTy :: DynFlags -> Type -> Validity
isFFIPrimResultTy :: DynFlags -> Type -> Validity
isFFILabelTy :: Type -> Validity
isFFITy :: Type -> Bool
isFunPtrTy :: Type -> Bool
tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type)
-- | The key type representing kinds in the compiler.
type Kind = Type
typeKind :: Type -> Kind
liftedTypeKind :: Kind
constraintKind :: Kind
-- | This version considers Constraint to be distinct from *. Returns True
-- if the argument is equivalent to Type and False otherwise.
isLiftedTypeKind :: Kind -> Bool
-- | Returns True if the kind classifies unlifted types and False
-- otherwise. Note that this returns False for levity-polymorphic kinds,
-- which may be specialized to a kind that classifies unlifted types.
isUnliftedTypeKind :: Kind -> Bool
-- | Does this classify a type allowed to have values? Responds True to
-- things like *, #, TYPE Lifted, TYPE v, Constraint.
--
-- True of any sub-kind of OpenTypeKind
classifiesTypeWithValues :: Kind -> Bool
data Type
-- | A type of the form p of kind Constraint represents a
-- value whose type is the Haskell predicate p, where a
-- predicate is what occurs before the => in a Haskell type.
--
-- We use PredType as documentation to mark those types that we
-- guarantee to have this kind.
--
-- It can be expanded into its representation, but:
--
--
-- - The type checker must treat it as opaque
-- - The rest of the compiler treats it as transparent
--
--
-- Consider these examples:
--
--
-- f :: (Eq a) => a -> Int
-- g :: (?x :: Int -> Int) => a -> Int
-- h :: (r\l) => {r} => {l::Int | r}
--
--
-- Here the Eq a and ?x :: Int -> Int and
-- rl are all called "predicates"
type PredType = Type
-- | A collection of PredTypes
type ThetaType = [PredType]
-- | A TyBinder represents an argument to a function. TyBinders can
-- be dependent (Named) or nondependent (Anon). They may
-- also be visible or not. See Note [TyBinders]
data TyBinder
-- | Argument Flag
--
-- Is something required to appear in source Haskell (Required),
-- permitted by request (Specified) (visible type application), or
-- prohibited entirely from appearing in source Haskell
-- (Inferred)? See Note [TyBinders and ArgFlags] in TyCoRep
data ArgFlag
Required :: ArgFlag
Specified :: ArgFlag
Inferred :: ArgFlag
mkForAllTy :: TyVar -> ArgFlag -> Type -> Type
-- | Wraps foralls over the type using the provided TyVars from left
-- to right
mkForAllTys :: [TyVarBinder] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and
-- Inferred, a common case
mkInvForAllTys :: [TyVar] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and
-- specified, a common case
mkSpecForAllTys :: [TyVar] -> Type -> Type
-- | Make a dependent forall over an Inferred (as opposed to Specified)
-- variable
mkInvForAllTy :: TyVar -> Type -> Type
-- | Make an arrow type
mkFunTy :: Type -> Type -> Type
infixr 3 `mkFunTy`
-- | Make nested arrow types
mkFunTys :: [Type] -> Type -> Type
-- | A key function: builds a TyConApp or FunTy as
-- appropriate to its arguments. Applies its arguments to the constructor
-- from left to right.
mkTyConApp :: TyCon -> [Type] -> Type
-- | Applies a type to another, as in e.g. k a
mkAppTy :: Type -> Type -> Type
mkAppTys :: Type -> [Type] -> Type
-- | Create the plain type constructor type which has been applied to no
-- type arguments at all.
mkTyConTy :: TyCon -> Type
mkTyVarTy :: TyVar -> Type
mkTyVarTys :: [TyVar] -> [Type]
isClassPred :: PredType -> Bool
isEqPred :: PredType -> Bool
isNomEqPred :: PredType -> Bool
isIPPred :: PredType -> Bool
mkClassPred :: Class -> [Type] -> PredType
isDictLikeTy :: Type -> Bool
tcSplitDFunTy :: Type -> ([TyVar], [Type], Class, [Type])
tcSplitDFunHead :: Type -> (Class, [Type])
tcSplitMethodTy :: Type -> ([TyVar], PredType, Type)
-- | Is a tyvar of type RuntimeRep?
isRuntimeRepVar :: TyVar -> Bool
-- | Tests whether the given kind (which should look like TYPE x)
-- is something other than a constructor tree (that is, constructors at
-- every node).
isKindLevPoly :: Kind -> Bool
-- | Does this binder bind a visible argument?
isVisibleBinder :: TyBinder -> Bool
-- | Does this binder bind an invisible argument?
isInvisibleBinder :: TyBinder -> Bool
-- | Type & coercion substitution
--
-- The following invariants must hold of a TCvSubst:
--
--
-- - The in-scope set is needed only to guide the generation of
-- fresh uniques
-- - In particular, the kind of the type variables in the
-- in-scope set is not relevant
-- - The substitution is only applied ONCE! This is because in general
-- such application will not reach a fixed point.
--
data TCvSubst
TCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> TCvSubst
-- | A substitution of Types for TyVars and Kinds for
-- KindVars
type TvSubstEnv = TyVarEnv Type
emptyTCvSubst :: TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
zipTvSubst :: [TyVar] -> [Type] -> TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst
notElemTCvSubst :: Var -> TCvSubst -> Bool
unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
getTvSubstEnv :: TCvSubst -> TvSubstEnv
setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst
getTCvInScope :: TCvSubst -> InScopeSet
extendTCvInScope :: TCvSubst -> Var -> TCvSubst
extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst
extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst
extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)
extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst
isInScope :: Var -> TCvSubst -> Bool
mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst
-- | Make a TCvSubst with specified tyvar subst and empty covar subst
mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst
zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnv
zipCoEnv :: [CoVar] -> [Coercion] -> CvSubstEnv
-- | Substitute within a Type The substitution has to satisfy the
-- invariants described in Note [The substitution invariant].
substTy :: HasCallStack => TCvSubst -> Type -> Type
-- | Substitute within several Types The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTys :: HasCallStack => TCvSubst -> [Type] -> [Type]
-- | Type substitution, see zipTvSubst
substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type
-- | Substitute covars within a type
substTyWithCoVars :: [CoVar] -> [Coercion] -> Type -> Type
-- | Substitute within a Type after adding the free variables of the
-- type to the in-scope set. This is useful for the case when the free
-- variables aren't already in the in-scope set or easily available. See
-- also Note [The substitution invariant].
substTyAddInScope :: TCvSubst -> Type -> Type
-- | Substitute within a Type disabling the sanity checks. The
-- problems that the sanity checks in substTy catch are described in Note
-- [The substitution invariant]. The goal of #11371 is to migrate all the
-- calls of substTyUnchecked to substTy and remove this function. Please
-- don't use in new code.
substTyUnchecked :: TCvSubst -> Type -> Type
-- | Substitute within several Types disabling the sanity checks.
-- The problems that the sanity checks in substTys catch are described in
-- Note [The substitution invariant]. The goal of #11371 is to migrate
-- all the calls of substTysUnchecked to substTys and remove this
-- function. Please don't use in new code.
substTysUnchecked :: TCvSubst -> [Type] -> [Type]
-- | Substitute within a ThetaType disabling the sanity checks. The
-- problems that the sanity checks in substTys catch are described in
-- Note [The substitution invariant]. The goal of #11371 is to migrate
-- all the calls of substThetaUnchecked to substTheta and remove this
-- function. Please don't use in new code.
substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType
-- | Type substitution, see zipTvSubst. Disables sanity checks. The
-- problems that the sanity checks in substTy catch are described in Note
-- [The substitution invariant]. The goal of #11371 is to migrate all the
-- calls of substTyUnchecked to substTy and remove this function. Please
-- don't use in new code.
substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type
-- | Substitute within a Coercion disabling sanity checks. The
-- problems that the sanity checks in substCo catch are described in Note
-- [The substitution invariant]. The goal of #11371 is to migrate all the
-- calls of substCoUnchecked to substCo and remove this function. Please
-- don't use in new code.
substCoUnchecked :: TCvSubst -> Coercion -> Coercion
-- | Coercion substitution, see zipTvSubst. Disables sanity checks.
-- The problems that the sanity checks in substCo catch are described in
-- Note [The substitution invariant]. The goal of #11371 is to migrate
-- all the calls of substCoUnchecked to substCo and remove this function.
-- Please don't use in new code.
substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion
-- | Substitute within a ThetaType The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType
-- | See Type#type_classification for what an unlifted type is.
-- Panics on levity polymorphic types.
isUnliftedType :: HasDebugCallStack => Type -> Bool
isUnboxedTupleType :: Type -> Bool
-- | Returns true of types that are opaque to Haskell.
isPrimitiveType :: Type -> Bool
-- | Gives the typechecker view of a type. This unwraps synonyms but leaves
-- Constraint alone. c.f. coreView, which turns Constraint into
-- TYPE LiftedRep. Returns Nothing if no unwrapping happens. See also
-- Note [coreView vs tcView] in Type.
tcView :: Type -> Maybe Type
-- | This function Strips off the top layer only of a type synonym
-- application (if any) its underlying representation type. Returns
-- Nothing if there is nothing to look through. This function considers
-- Constraint to be a synonym of TYPE LiftedRep.
--
-- By being non-recursive and inlined, this case analysis gets
-- efficiently joined onto the case analysis that the caller is already
-- doing
coreView :: Type -> Maybe Type
-- | Returns free variables of a type, including kind variables as a
-- non-deterministic set. For type synonyms it does not expand the
-- synonym.
tyCoVarsOfType :: Type -> TyCoVarSet
-- | Returns free variables of types, including kind variables as a
-- non-deterministic set. For type synonyms it does not expand the
-- synonym.
tyCoVarsOfTypes :: [Type] -> TyCoVarSet
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a non-deterministic set.
closeOverKinds :: TyVarSet -> TyVarSet
-- | The worker for tyVarsOfType and tyVarsOfTypeList.
-- The previous implementation used unionVarSet which is O(n+m)
-- and can make the function quadratic. It's exported, so that it can be
-- composed with other functions that compute free variables. See Note
-- [FV naming conventions] in FV.
--
-- Eta-expanded because that makes it run faster (apparently) See Note
-- [FV eta expansion] in FV for explanation.
tyCoFVsOfType :: Type -> FV
tyCoFVsOfTypes :: [Type] -> FV
-- | tyVarsOfType that returns free variables of a type in a
-- deterministic set. For explanation of why using VarSet is not
-- deterministic see Note [Deterministic FV] in FV.
tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
-- | Returns free variables of types, including kind variables as a
-- deterministic set. For type synonyms it does not expand the
-- synonym.
tyCoVarsOfTypesDSet :: [Type] -> DTyCoVarSet
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a deterministic set.
closeOverKindsDSet :: DTyVarSet -> DTyVarSet
-- | tyVarsOfType that returns free variables of a type in
-- deterministic order. For explanation of why using VarSet is not
-- deterministic see Note [Deterministic FV] in FV.
tyCoVarsOfTypeList :: Type -> [TyCoVar]
-- | Returns free variables of types, including kind variables as a
-- deterministically ordered list. For type synonyms it does not
-- expand the synonym.
tyCoVarsOfTypesList :: [Type] -> [TyCoVar]
-- | Returns True if this type has no free variables. Should be the same as
-- isEmptyVarSet . tyCoVarsOfType, but faster in the non-forall case.
noFreeVarsOfType :: Type -> Bool
toTcType :: Type -> TcType
toTcTypeBag :: Bag EvVar -> Bag EvVar
pprKind :: Kind -> SDoc
pprParendKind :: Kind -> SDoc
pprSigmaType :: Type -> SDoc
pprType :: Type -> SDoc
pprParendType :: Type -> SDoc
pprTypeApp :: TyCon -> [Type] -> SDoc
pprTyThingCategory :: TyThing -> SDoc
tyThingCategory :: TyThing -> String
pprTheta :: ThetaType -> SDoc
pprThetaArrowTy :: ThetaType -> SDoc
pprClassPred :: Class -> [Type] -> SDoc
pprTvBndr :: TyVarBinder -> SDoc
pprTvBndrs :: [TyVarBinder] -> SDoc
type TypeSize = IntWithInf
sizeType :: Type -> TypeSize
sizeTypes :: [Type] -> TypeSize
-- | Do a topological sort on a list of tyvars, so that binders occur
-- before occurrences E.g. given [ a::k, k::*, b::k ] it'll return a
-- well-scoped list [ k::*, a::k, b::k ]
--
-- This is a deterministic sorting operation (that is, doesn't depend on
-- Uniques).
toposortTyVars :: [TyVar] -> [TyVar]
instance GHC.Classes.Ord TcType.TcLevel
instance GHC.Classes.Eq TcType.TcLevel
instance GHC.Base.Monoid TcType.CandidatesQTvs
instance Outputable.Outputable TcType.CandidatesQTvs
instance Outputable.Outputable TcType.ExpType
instance Outputable.Outputable TcType.InferResult
instance Outputable.Outputable TcType.MetaDetails
instance Outputable.Outputable TcType.TcLevel
module TcEvidence
data HsWrapper
WpHole :: HsWrapper
WpCompose :: HsWrapper -> HsWrapper -> HsWrapper
WpFun :: HsWrapper -> HsWrapper -> TcType -> SDoc -> HsWrapper
WpCast :: TcCoercionR -> HsWrapper
WpEvLam :: EvVar -> HsWrapper
WpEvApp :: EvTerm -> HsWrapper
WpTyLam :: TyVar -> HsWrapper
WpTyApp :: KindOrType -> HsWrapper
WpLet :: TcEvBinds -> HsWrapper
(<.>) :: HsWrapper -> HsWrapper -> HsWrapper
mkWpTyApps :: [Type] -> HsWrapper
mkWpEvApps :: [EvTerm] -> HsWrapper
mkWpEvVarApps :: [EvVar] -> HsWrapper
mkWpTyLams :: [TyVar] -> HsWrapper
mkWpLams :: [Var] -> HsWrapper
mkWpLet :: TcEvBinds -> HsWrapper
mkWpCastN :: TcCoercionN -> HsWrapper
mkWpCastR :: TcCoercionR -> HsWrapper
collectHsWrapBinders :: HsWrapper -> ([Var], HsWrapper)
mkWpFun :: HsWrapper -> HsWrapper -> TcType -> TcType -> SDoc -> HsWrapper
-- | mkWpFuns [(ty1, wrap1), (ty2, wrap2)] ty_res wrap_res, where
-- wrap1 :: ty1 "->" ty1' and wrap2 :: ty2 "->"
-- ty2', wrap3 :: ty3 "->" ty3' and ty_res is
-- either ty3 or ty3', gives a wrapper (ty1'
-- -> ty2' -> ty3) "->" (ty1 -> ty2 -> ty3'). Notice
-- that the result wrapper goes the other way round to all the others.
-- This is a result of sub-typing contravariance. The SDoc is a
-- description of what you were doing when you called mkWpFuns.
mkWpFuns :: [(TcType, HsWrapper)] -> TcType -> HsWrapper -> SDoc -> HsWrapper
idHsWrapper :: HsWrapper
isIdHsWrapper :: HsWrapper -> Bool
pprHsWrapper :: HsWrapper -> (Bool -> SDoc) -> SDoc
data TcEvBinds
TcEvBinds :: EvBindsVar -> TcEvBinds
EvBinds :: (Bag EvBind) -> TcEvBinds
data EvBindsVar
EvBindsVar :: Unique -> IORef EvBindMap -> IORef CoVarSet -> EvBindsVar
[ebv_uniq] :: EvBindsVar -> Unique
[ebv_binds] :: EvBindsVar -> IORef EvBindMap
[ebv_tcvs] :: EvBindsVar -> IORef CoVarSet
newtype EvBindMap
EvBindMap :: DVarEnv EvBind -> EvBindMap
[ev_bind_varenv] :: EvBindMap -> DVarEnv EvBind
emptyEvBindMap :: EvBindMap
extendEvBinds :: EvBindMap -> EvBind -> EvBindMap
lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind
evBindMapBinds :: EvBindMap -> Bag EvBind
foldEvBindMap :: (EvBind -> a -> a) -> a -> EvBindMap -> a
isEmptyEvBindMap :: EvBindMap -> Bool
data EvBind
EvBind :: EvVar -> EvTerm -> Bool -> EvBind
[eb_lhs] :: EvBind -> EvVar
[eb_rhs] :: EvBind -> EvTerm
[eb_is_given] :: EvBind -> Bool
emptyTcEvBinds :: TcEvBinds
isEmptyTcEvBinds :: TcEvBinds -> Bool
mkGivenEvBind :: EvVar -> EvTerm -> EvBind
mkWantedEvBind :: EvVar -> EvTerm -> EvBind
-- | Do SCC analysis on a bag of EvBinds.
sccEvBinds :: Bag EvBind -> [SCC EvBind]
evBindVar :: EvBind -> EvVar
data EvTerm
EvId :: EvId -> EvTerm
EvCoercion :: TcCoercion -> EvTerm
EvCast :: EvTerm -> TcCoercionR -> EvTerm
EvDFunApp :: DFunId -> [Type] -> [EvTerm] -> EvTerm
EvDelayedError :: Type -> FastString -> EvTerm
EvSuperClass :: EvTerm -> Int -> EvTerm
EvLit :: EvLit -> EvTerm
EvCallStack :: EvCallStack -> EvTerm
EvTypeable :: Type -> EvTypeable -> EvTerm
EvSelector :: Id -> [Type] -> [EvTerm] -> EvTerm
mkEvCast :: EvTerm -> TcCoercion -> EvTerm
evVarsOfTerm :: EvTerm -> VarSet
mkEvScSelectors :: EvTerm -> Class -> [TcType] -> [(TcPredType, EvTerm)]
data EvLit
EvNum :: Integer -> EvLit
EvStr :: FastString -> EvLit
evTermCoercion :: EvTerm -> TcCoercion
-- | Evidence for CallStack implicit parameters.
data EvCallStack
EvCsEmpty :: EvCallStack
-- | EvCsPushCall name loc stk represents a call to name,
-- occurring at loc, in a calling context stk.
EvCsPushCall :: Name -> RealSrcSpan -> EvTerm -> EvCallStack
-- | Instructions on how to make a Typeable dictionary. See Note
-- [Typeable evidence terms]
data EvTypeable
-- | Dictionary for Typeable T where T is a type
-- constructor with all of its kind variables saturated. The
-- [EvTerm] is Typeable evidence for the applied
-- kinds..
EvTypeableTyCon :: TyCon -> [EvTerm] -> EvTypeable
-- | Dictionary for Typeable (s t), given a dictionaries for
-- s and t.
EvTypeableTyApp :: EvTerm -> EvTerm -> EvTypeable
-- | Dictionary for Typeable (s -> t), given a dictionaries for
-- s and t.
EvTypeableTrFun :: EvTerm -> EvTerm -> EvTypeable
-- | Dictionary for a type literal, e.g. Typeable "foo" or
-- Typeable 3 The EvTerm is evidence of, e.g.,
-- KnownNat 3 (see Trac #10348)
EvTypeableTyLit :: EvTerm -> EvTypeable
type TcCoercion = Coercion
type TcCoercionR = CoercionR
type TcCoercionN = CoercionN
type TcCoercionP = CoercionP
-- | A coercion to be filled in by the type-checker. See Note [Coercion
-- holes]
data CoercionHole
data Role
Nominal :: Role
Representational :: Role
Phantom :: Role
data LeftOrRight
CLeft :: LeftOrRight
CRight :: LeftOrRight
pickLR :: LeftOrRight -> (a, a) -> a
mkTcReflCo :: Role -> TcType -> TcCoercion
mkTcNomReflCo :: TcType -> TcCoercionN
mkTcRepReflCo :: TcType -> TcCoercionR
mkTcTyConAppCo :: Role -> TyCon -> [TcCoercion] -> TcCoercion
mkTcAppCo :: TcCoercion -> TcCoercionN -> TcCoercion
mkTcFunCo :: Role -> TcCoercion -> TcCoercion -> TcCoercion
mkTcAxInstCo :: Role -> CoAxiom br -> BranchIndex -> [TcType] -> [TcCoercion] -> TcCoercion
mkTcUnbranchedAxInstCo :: CoAxiom Unbranched -> [TcType] -> [TcCoercion] -> TcCoercionR
mkTcForAllCo :: TyVar -> TcCoercionN -> TcCoercion -> TcCoercion
mkTcForAllCos :: [(TyVar, TcCoercionN)] -> TcCoercion -> TcCoercion
mkTcSymCo :: TcCoercion -> TcCoercion
mkTcTransCo :: TcCoercion -> TcCoercion -> TcCoercion
mkTcNthCo :: Int -> TcCoercion -> TcCoercion
mkTcLRCo :: LeftOrRight -> TcCoercion -> TcCoercion
mkTcSubCo :: TcCoercionN -> TcCoercionR
maybeTcSubCo :: EqRel -> TcCoercion -> TcCoercion
tcDowngradeRole :: Role -> Role -> TcCoercion -> TcCoercion
mkTcAxiomRuleCo :: CoAxiomRule -> [TcCoercion] -> TcCoercionR
mkTcCoherenceLeftCo :: TcCoercion -> TcCoercionN -> TcCoercion
mkTcCoherenceRightCo :: TcCoercion -> TcCoercionN -> TcCoercion
mkTcPhantomCo :: TcCoercionN -> TcType -> TcType -> TcCoercionP
mkTcKindCo :: TcCoercion -> TcCoercionN
tcCoercionKind :: TcCoercion -> Pair TcType
coVarsOfTcCo :: TcCoercion -> TcTyCoVarSet
mkTcCoVarCo :: CoVar -> TcCoercion
isTcReflCo :: TcCoercion -> Bool
tcCoercionRole :: TcCoercion -> Role
-- | Create a Coercion that unwraps an implicit-parameter or
-- overloaded-label dictionary to expose the underlying value. We expect
-- the Type to have the form `IP sym ty` or `IsLabel sym ty`, and
-- return a Coercion `co :: IP sym ty ~ ty` or `co :: IsLabel sym
-- ty ~ Proxy# sym -> ty`. See also Note [Type-checking overloaded
-- labels] in TcExpr.
unwrapIP :: Type -> CoercionR
-- | Create a Coercion that wraps a value in an implicit-parameter
-- dictionary. See unwrapIP.
wrapIP :: Type -> CoercionR
instance Data.Data.Data TcEvidence.EvTypeable
instance Data.Data.Data TcEvidence.EvTerm
instance Data.Data.Data TcEvidence.EvCallStack
instance Data.Data.Data TcEvidence.EvLit
instance Data.Data.Data TcEvidence.HsWrapper
instance Outputable.Outputable TcEvidence.HsWrapper
instance Data.Data.Data TcEvidence.TcEvBinds
instance Outputable.Outputable TcEvidence.TcEvBinds
instance Outputable.Outputable TcEvidence.EvBindsVar
instance Unique.Uniquable TcEvidence.EvBindsVar
instance Outputable.Outputable TcEvidence.EvBindMap
instance Outputable.Outputable TcEvidence.EvBind
instance Outputable.Outputable TcEvidence.EvTerm
instance Outputable.Outputable TcEvidence.EvCallStack
instance Outputable.Outputable TcEvidence.EvTypeable
instance Outputable.Outputable TcEvidence.EvLit
module PlaceHolder
-- | used as place holder in PostTc and PostRn values
data PlaceHolder
PlaceHolder :: PlaceHolder
-- | Types that are not defined until after type checking
-- | Types that are not defined until after renaming
placeHolderKind :: PlaceHolder
placeHolderFixity :: PlaceHolder
placeHolderType :: PlaceHolder
placeHolderTypeTc :: Type
placeHolderNames :: PlaceHolder
placeHolderNamesTc :: NameSet
placeHolderHsWrapper :: PlaceHolder
type DataId id = (DataIdPost id, DataIdPost (NameOrRdrName id))
type DataIdPost id = (Data id, Data (PostRn id NameSet), Data (PostRn id Fixity), Data (PostRn id Bool), Data (PostRn id Name), Data (PostRn id (Located Name)), Data (PostRn id [Name]), Data (PostRn id id), Data (PostTc id Type), Data (PostTc id Coercion), Data (PostTc id id), Data (PostTc id [Type]), Data (PostTc id ConLike), Data (PostTc id [ConLike]), Data (PostTc id HsWrapper), Data (PostTc id [FieldLabel]))
-- | Follow the id, but never beyond Name. This is used in a
-- HsMatchContext, for printing messages related to a
-- Match
-- | Constraint type to bundle up the requirement for OutputableBndr
-- on both the id and the NameOrRdrName type for it
type OutputableBndrId id = (OutputableBndr id, OutputableBndr (NameOrRdrName id))
instance Data.Data.Data PlaceHolder.PlaceHolder
module HsTypes
-- | Haskell Type
data HsType name
-- |
HsForAllTy :: [LHsTyVarBndr name] -> LHsType name -> HsType name
[hst_bndrs] :: HsType name -> [LHsTyVarBndr name]
[hst_body] :: HsType name -> LHsType name
HsQualTy :: LHsContext name -> LHsType name -> HsType name
[hst_ctxt] :: HsType name -> LHsContext name
[hst_body] :: HsType name -> LHsType name
-- |
HsTyVar :: Promoted -> (Located name) -> HsType name
-- |
HsAppsTy :: [LHsAppType name] -> HsType name
-- |
HsAppTy :: (LHsType name) -> (LHsType name) -> HsType name
-- |
HsFunTy :: (LHsType name) -> (LHsType name) -> HsType name
-- |
HsListTy :: (LHsType name) -> HsType name
-- |
HsPArrTy :: (LHsType name) -> HsType name
-- |
HsTupleTy :: HsTupleSort -> [LHsType name] -> HsType name
-- |
HsSumTy :: [LHsType name] -> HsType name
-- |
HsOpTy :: (LHsType name) -> (Located name) -> (LHsType name) -> HsType name
-- |
HsParTy :: (LHsType name) -> HsType name
-- |
-- (?x :: ty)
--
--
--
HsIParamTy :: (Located HsIPName) -> (LHsType name) -> HsType name
-- |
-- ty1 ~ ty2
--
--
--
HsEqTy :: (LHsType name) -> (LHsType name) -> HsType name
-- |
-- (ty :: kind)
--
--
--
HsKindSig :: (LHsType name) -> (LHsKind name) -> HsType name
-- |
HsSpliceTy :: (HsSplice name) -> (PostTc name Kind) -> HsType name
-- |
HsDocTy :: (LHsType name) -> LHsDocString -> HsType name
-- |
HsBangTy :: HsSrcBang -> (LHsType name) -> HsType name
-- |
HsRecTy :: [LConDeclField name] -> HsType name
-- |
HsCoreTy :: Type -> HsType name
-- |
HsExplicitListTy :: Promoted -> (PostTc name Kind) -> [LHsType name] -> HsType name
-- |
HsExplicitTupleTy :: [PostTc name Kind] -> [LHsType name] -> HsType name
-- |
HsTyLit :: HsTyLit -> HsType name
-- |
HsWildCardTy :: (HsWildCardInfo name) -> HsType name
-- | Located Haskell Type
type LHsType name = Located (HsType name) May have 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma' when in a list
-- | Haskell Kind
type HsKind name = HsType name
-- | Located Haskell Kind
type LHsKind name = Located (HsKind name) 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnDcolon'
-- | Haskell Type Variable Binder
data HsTyVarBndr name
UserTyVar :: (Located name) -> HsTyVarBndr name
-- |
KindedTyVar :: (Located name) -> (LHsKind name) -> HsTyVarBndr name
-- | Located Haskell Type Variable Binder
type LHsTyVarBndr name = Located (HsTyVarBndr name)
-- | Located Haskell Quantified Type Variables
data LHsQTyVars name
HsQTvs :: PostRn name [Name] -> [LHsTyVarBndr name] -> PostRn name NameSet -> LHsQTyVars name
[hsq_implicit] :: LHsQTyVars name -> PostRn name [Name]
[hsq_explicit] :: LHsQTyVars name -> [LHsTyVarBndr name]
[hsq_dependent] :: LHsQTyVars name -> PostRn name NameSet
-- | Haskell Implicit Binders
data HsImplicitBndrs name thing
HsIB :: PostRn name [Name] -> thing -> PostRn name Bool -> HsImplicitBndrs name thing
[hsib_vars] :: HsImplicitBndrs name thing -> PostRn name [Name]
[hsib_body] :: HsImplicitBndrs name thing -> thing
[hsib_closed] :: HsImplicitBndrs name thing -> PostRn name Bool
-- | Haskell Wildcard Binders
data HsWildCardBndrs name thing
HsWC :: PostRn name [Name] -> thing -> HsWildCardBndrs name thing
[hswc_wcs] :: HsWildCardBndrs name thing -> PostRn name [Name]
[hswc_body] :: HsWildCardBndrs name thing -> thing
-- | Located Haskell Signature Type
type LHsSigType name = HsImplicitBndrs name (LHsType name)
-- | Located Haskell Signature Wildcard Type
type LHsSigWcType name = HsWildCardBndrs name (LHsSigType name)
-- | Located Haskell Wildcard Type
type LHsWcType name = HsWildCardBndrs name (LHsType name)
-- | Haskell Tuple Sort
data HsTupleSort
HsUnboxedTuple :: HsTupleSort
HsBoxedTuple :: HsTupleSort
HsConstraintTuple :: HsTupleSort
HsBoxedOrConstraintTuple :: HsTupleSort
-- | Promoted data types.
data Promoted
Promoted :: Promoted
NotPromoted :: Promoted
-- | Haskell Context
type HsContext name = [LHsType name]
-- | Located Haskell Context
type LHsContext name = Located (HsContext name) 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnUnit'
-- | Haskell Type Literal
data HsTyLit
HsNumTy :: SourceText -> Integer -> HsTyLit
HsStrTy :: SourceText -> FastString -> HsTyLit
-- | These names are used early on to store the names of implicit
-- parameters. They completely disappear after type-checking.
newtype HsIPName
HsIPName :: FastString -> HsIPName
hsIPNameFS :: HsIPName -> FastString
-- | Haskell Application Type
data HsAppType name
HsAppInfix :: (Located name) -> HsAppType name
HsAppPrefix :: (LHsType name) -> HsAppType name
-- | Located Haskell Application Type
type LHsAppType name = Located (HsAppType name) 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSimpleQuote'
-- | Located Bang Type
type LBangType name = Located (BangType name)
-- | Bang Type
type BangType name = HsType name
-- | Haskell Source Bang
--
-- Bangs on data constructor arguments as the user wrote them in the
-- source code.
--
-- (HsSrcBang _ SrcUnpack SrcLazy) and (HsSrcBang _
-- SrcUnpack NoSrcStrict) (without StrictData) makes no sense, we
-- emit a warning (in checkValidDataCon) and treat it like (HsSrcBang
-- _ NoSrcUnpack SrcLazy)
data HsSrcBang
HsSrcBang :: SourceText -> SrcUnpackedness -> SrcStrictness -> HsSrcBang
-- | Haskell Implementation Bang
--
-- Bangs of data constructor arguments as generated by the compiler after
-- consulting HsSrcBang, flags, etc.
data HsImplBang
-- | Lazy field
HsLazy :: HsImplBang
-- | Strict but not unpacked field
HsStrict :: HsImplBang
-- | Strict and unpacked field co :: arg-ty ~ product-ty HsBang
HsUnpack :: (Maybe Coercion) -> HsImplBang
-- | Source Strictness
--
-- What strictness annotation the user wrote
data SrcStrictness
-- | Lazy, ie '~'
SrcLazy :: SrcStrictness
-- | Strict, ie !
SrcStrict :: SrcStrictness
-- | no strictness annotation
NoSrcStrict :: SrcStrictness
-- | Source Unpackedness
--
-- What unpackedness the user requested
data SrcUnpackedness
-- | {--} specified
SrcUnpack :: SrcUnpackedness
-- | {--} specified
SrcNoUnpack :: SrcUnpackedness
-- | no unpack pragma
NoSrcUnpack :: SrcUnpackedness
getBangType :: LHsType a -> LHsType a
getBangStrictness :: LHsType a -> HsSrcBang
-- | Constructor Declaration Field
data ConDeclField name
-- |
ConDeclField :: [LFieldOcc name] -> LBangType name -> Maybe LHsDocString -> ConDeclField name
-- | See Note [ConDeclField names]
[cd_fld_names] :: ConDeclField name -> [LFieldOcc name]
[cd_fld_type] :: ConDeclField name -> LBangType name
[cd_fld_doc] :: ConDeclField name -> Maybe LHsDocString
-- | Located Constructor Declaration Field
type LConDeclField name = Located (ConDeclField name) May have 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma' when in a list
pprConDeclFields :: (OutputableBndrId name) => [LConDeclField name] -> SDoc
updateGadtResult :: (Monad m) => (SDoc -> m ()) -> SDoc -> HsConDetails (LHsType Name) (Located [LConDeclField Name]) -> LHsType Name -> m (HsConDetails (LHsType Name) (Located [LConDeclField Name]), LHsType Name)
-- | Haskell Constructor Details
data HsConDetails arg rec
PrefixCon :: [arg] -> HsConDetails arg rec
RecCon :: rec -> HsConDetails arg rec
InfixCon :: arg -> arg -> HsConDetails arg rec
-- | Field Occurrence
--
-- Represents an *occurrence* of an unambiguous field. We store both the
-- RdrName the user originally wrote, and after the renamer, the
-- selector function.
data FieldOcc name
FieldOcc :: Located RdrName -> PostRn name name -> FieldOcc name
-- | See Note [Located RdrNames] in HsExpr
[rdrNameFieldOcc] :: FieldOcc name -> Located RdrName
[selectorFieldOcc] :: FieldOcc name -> PostRn name name
-- | Located Field Occurrence
type LFieldOcc name = Located (FieldOcc name)
mkFieldOcc :: Located RdrName -> FieldOcc RdrName
-- | Ambiguous Field Occurrence
--
-- Represents an *occurrence* of a field that is potentially ambiguous
-- after the renamer, with the ambiguity resolved by the typechecker. We
-- always store the RdrName that the user originally wrote, and
-- store the selector function after the renamer (for unambiguous
-- occurrences) or the typechecker (for ambiguous occurrences).
--
-- See Note [HsRecField and HsRecUpdField] in HsPat and Note
-- [Disambiguating record fields] in TcExpr. See Note [Located RdrNames]
-- in HsExpr
data AmbiguousFieldOcc name
Unambiguous :: (Located RdrName) -> (PostRn name name) -> AmbiguousFieldOcc name
Ambiguous :: (Located RdrName) -> (PostTc name name) -> AmbiguousFieldOcc name
mkAmbiguousFieldOcc :: Located RdrName -> AmbiguousFieldOcc RdrName
rdrNameAmbiguousFieldOcc :: AmbiguousFieldOcc name -> RdrName
selectorAmbiguousFieldOcc :: AmbiguousFieldOcc Id -> Id
unambiguousFieldOcc :: AmbiguousFieldOcc Id -> FieldOcc Id
ambiguousFieldOcc :: FieldOcc name -> AmbiguousFieldOcc name
newtype HsWildCardInfo name
AnonWildCard :: (PostRn name (Located Name)) -> HsWildCardInfo name
mkAnonWildCardTy :: HsType RdrName
wildCardName :: HsWildCardInfo Name -> Name
sameWildCard :: Located (HsWildCardInfo name) -> Located (HsWildCardInfo name) -> Bool
mkHsImplicitBndrs :: thing -> HsImplicitBndrs RdrName thing
mkHsWildCardBndrs :: thing -> HsWildCardBndrs RdrName thing
hsImplicitBody :: HsImplicitBndrs name thing -> thing
mkEmptyImplicitBndrs :: thing -> HsImplicitBndrs Name thing
mkEmptyWildCardBndrs :: thing -> HsWildCardBndrs Name thing
mkHsQTvs :: [LHsTyVarBndr RdrName] -> LHsQTyVars RdrName
hsQTvExplicit :: LHsQTyVars name -> [LHsTyVarBndr name]
emptyLHsQTvs :: LHsQTyVars Name
isEmptyLHsQTvs :: LHsQTyVars Name -> Bool
-- | Does this HsTyVarBndr come with an explicit kind annotation?
isHsKindedTyVar :: HsTyVarBndr name -> Bool
-- | Do all type variables in this LHsQTyVars come with kind
-- annotations?
hsTvbAllKinded :: LHsQTyVars name -> Bool
hsScopedTvs :: LHsSigType Name -> [Name]
hsWcScopedTvs :: LHsSigWcType Name -> [Name]
dropWildCards :: LHsSigWcType name -> LHsSigType name
hsTyVarName :: HsTyVarBndr name -> name
hsAllLTyVarNames :: LHsQTyVars Name -> [Name]
hsLTyVarLocNames :: LHsQTyVars name -> [Located name]
hsLTyVarName :: LHsTyVarBndr name -> name
hsLTyVarLocName :: LHsTyVarBndr name -> Located name
hsExplicitLTyVarNames :: LHsQTyVars name -> [name]
splitLHsInstDeclTy :: LHsSigType Name -> ([Name], LHsContext Name, LHsType Name)
getLHsInstDeclHead :: LHsSigType name -> LHsType name
getLHsInstDeclClass_maybe :: LHsSigType name -> Maybe (Located name)
splitLHsPatSynTy :: LHsType name -> ([LHsTyVarBndr name], LHsContext name, [LHsTyVarBndr name], LHsContext name, LHsType name)
splitLHsForAllTy :: LHsType name -> ([LHsTyVarBndr name], LHsType name)
splitLHsQualTy :: LHsType name -> (LHsContext name, LHsType name)
splitLHsSigmaTy :: LHsType name -> ([LHsTyVarBndr name], LHsContext name, LHsType name)
splitHsFunType :: LHsType Name -> ([LHsType Name], LHsType Name)
-- | Splits a [HsAppType name] (the payload of an HsAppsTy) into regions of
-- prefix types (normal types) and infix operators. If splitHsAppsTy
-- tys = (non_syms, syms), then tys starts with the first
-- element of non_syms followed by the first element of
-- syms followed by the next element of non_syms, etc.
-- It is guaranteed that the non_syms list has one more element than the
-- syms list.
splitHsAppsTy :: [LHsAppType name] -> ([[LHsType name]], [Located name])
splitHsAppTys :: LHsType Name -> [LHsType Name] -> (LHsType Name, [LHsType Name])
-- | Retrieves the head of an HsAppsTy, if this can be done unambiguously,
-- without consulting fixities.
getAppsTyHead_maybe :: [LHsAppType name] -> Maybe (LHsType name, [LHsType name], LexicalFixity)
hsTyGetAppHead_maybe :: LHsType name -> Maybe (Located name, [LHsType name])
mkHsOpTy :: LHsType name -> Located name -> LHsType name -> HsType name
mkHsAppTy :: LHsType name -> LHsType name -> LHsType name
mkHsAppTys :: LHsType name -> [LHsType name] -> LHsType name
ignoreParens :: LHsType name -> LHsType name
hsSigType :: LHsSigType name -> LHsType name
hsSigWcType :: LHsSigWcType name -> LHsType name
-- | Convert a LHsTyVarBndr to an equivalent LHsType.
hsLTyVarBndrToType :: LHsTyVarBndr name -> LHsType name
-- | Convert a LHsTyVarBndrs to a list of types. Works on *type* variable
-- only, no kind vars.
hsLTyVarBndrsToTypes :: LHsQTyVars name -> [LHsType name]
pprParendHsType :: (OutputableBndrId name) => HsType name -> SDoc
pprHsForAll :: (OutputableBndrId name) => [LHsTyVarBndr name] -> LHsContext name -> SDoc
pprHsForAllTvs :: (OutputableBndrId name) => [LHsTyVarBndr name] -> SDoc
-- | Version of pprHsForAll that can also print an extra-constraints
-- wildcard, e.g. _ => a -> Bool or (Show a, _) =>
-- a -> String. This underscore will be printed when the 'Maybe
-- SrcSpan' argument is a Just containing the location of the
-- extra-constraints wildcard. A special function for this is needed, as
-- the extra-constraints wildcard is removed from the actual context and
-- type, and stored in a separate field, thus just printing the type will
-- not print the extra-constraints wildcard.
pprHsForAllExtra :: (OutputableBndrId name) => Maybe SrcSpan -> [LHsTyVarBndr name] -> LHsContext name -> SDoc
pprHsContext :: (OutputableBndrId name) => HsContext name -> SDoc
pprHsContextNoArrow :: (OutputableBndrId name) => HsContext name -> SDoc
pprHsContextMaybe :: (OutputableBndrId name) => HsContext name -> Maybe SDoc
instance (Data.Data.Data rec, Data.Data.Data arg) => Data.Data.Data (HsTypes.HsConDetails arg rec)
instance GHC.Show.Show HsTypes.Promoted
instance GHC.Classes.Eq HsTypes.Promoted
instance Data.Data.Data HsTypes.Promoted
instance Data.Data.Data HsTypes.HsTupleSort
instance Data.Data.Data HsTypes.HsTyLit
instance Data.Data.Data HsTypes.HsIPName
instance GHC.Classes.Eq HsTypes.HsIPName
instance PlaceHolder.DataId name => Data.Data.Data (HsTypes.LHsQTyVars name)
instance (Data.Data.Data name, Data.Data.Data thing, Data.Data.Data (PlaceHolder.PostRn name [Name.Name]), Data.Data.Data (PlaceHolder.PostRn name GHC.Types.Bool)) => Data.Data.Data (HsTypes.HsImplicitBndrs name thing)
instance (Data.Data.Data name, Data.Data.Data thing, Data.Data.Data (PlaceHolder.PostRn name [Name.Name])) => Data.Data.Data (HsTypes.HsWildCardBndrs name thing)
instance PlaceHolder.DataId name => Data.Data.Data (HsTypes.HsTyVarBndr name)
instance PlaceHolder.DataId name => Data.Data.Data (HsTypes.HsType name)
instance PlaceHolder.DataId name => Data.Data.Data (HsTypes.HsWildCardInfo name)
instance PlaceHolder.DataId name => Data.Data.Data (HsTypes.HsAppType name)
instance PlaceHolder.DataId name => Data.Data.Data (HsTypes.ConDeclField name)
instance GHC.Classes.Eq (PlaceHolder.PostRn name name) => GHC.Classes.Eq (HsTypes.FieldOcc name)
instance GHC.Classes.Ord (PlaceHolder.PostRn name name) => GHC.Classes.Ord (HsTypes.FieldOcc name)
instance (Data.Data.Data name, Data.Data.Data (PlaceHolder.PostRn name name)) => Data.Data.Data (HsTypes.FieldOcc name)
instance (Data.Data.Data name, Data.Data.Data (PlaceHolder.PostRn name name), Data.Data.Data (PlaceHolder.PostTc name name)) => Data.Data.Data (HsTypes.AmbiguousFieldOcc name)
instance Outputable.Outputable (HsTypes.AmbiguousFieldOcc name)
instance Outputable.OutputableBndr (HsTypes.AmbiguousFieldOcc name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsTypes.LHsQTyVars name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsTypes.HsAppType name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsTypes.ConDeclField name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsTypes.HsType name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsTypes.HsTyVarBndr name)
instance Outputable.Outputable (HsTypes.FieldOcc name)
instance (Outputable.Outputable arg, Outputable.Outputable rec) => Outputable.Outputable (HsTypes.HsConDetails arg rec)
instance Outputable.Outputable (HsTypes.HsWildCardInfo name)
instance Outputable.Outputable HsTypes.HsTyLit
instance Outputable.Outputable HsTypes.HsIPName
instance Outputable.OutputableBndr HsTypes.HsIPName
instance Outputable.Outputable thing => Outputable.Outputable (HsTypes.HsWildCardBndrs name thing)
instance Outputable.Outputable thing => Outputable.Outputable (HsTypes.HsImplicitBndrs name thing)
module HsLit
-- | Haskell Literal
data HsLit
-- | Character
HsChar :: SourceText -> Char -> HsLit
-- | Unboxed character
HsCharPrim :: SourceText -> Char -> HsLit
-- | String
HsString :: SourceText -> FastString -> HsLit
-- | Packed bytes
HsStringPrim :: SourceText -> ByteString -> HsLit
-- | Genuinely an Int; arises from TcGenDeriv, and from
-- TRANSLATION
HsInt :: SourceText -> Integer -> HsLit
-- | literal Int#
HsIntPrim :: SourceText -> Integer -> HsLit
-- | literal Word#
HsWordPrim :: SourceText -> Integer -> HsLit
-- | literal Int64#
HsInt64Prim :: SourceText -> Integer -> HsLit
-- | literal Word64#
HsWord64Prim :: SourceText -> Integer -> HsLit
-- | Genuinely an integer; arises only from TRANSLATION (overloaded
-- literals are done with HsOverLit)
HsInteger :: SourceText -> Integer -> Type -> HsLit
-- | Genuinely a rational; arises only from TRANSLATION (overloaded
-- literals are done with HsOverLit)
HsRat :: FractionalLit -> Type -> HsLit
-- | Unboxed Float
HsFloatPrim :: FractionalLit -> HsLit
-- | Unboxed Double
HsDoublePrim :: FractionalLit -> HsLit
-- | Haskell Overloaded Literal
data HsOverLit id
OverLit :: OverLitVal -> PostRn id Bool -> HsExpr id -> PostTc id Type -> HsOverLit id
[ol_val] :: HsOverLit id -> OverLitVal
[ol_rebindable] :: HsOverLit id -> PostRn id Bool
[ol_witness] :: HsOverLit id -> HsExpr id
[ol_type] :: HsOverLit id -> PostTc id Type
-- | Overloaded Literal Value
data OverLitVal
-- | Integer-looking literals;
HsIntegral :: !SourceText -> !Integer -> OverLitVal
-- | Frac-looking literals
HsFractional :: !FractionalLit -> OverLitVal
-- | String-looking literals
HsIsString :: !SourceText -> !FastString -> OverLitVal
overLitType :: HsOverLit a -> PostTc a Type
pp_st_suffix :: SourceText -> SDoc -> SDoc -> SDoc
-- | pmPprHsLit pretty prints literals and is used when pretty printing
-- pattern match warnings. All are printed the same (i.e., without hashes
-- if they are primitive and not wrapped in constructors if they are
-- boxed). This happens mainly for too reasons: * We do not want to
-- expose their internal representation * The warnings become too messy
pmPprHsLit :: HsLit -> SDoc
instance Data.Data.Data HsLit.OverLitVal
instance Data.Data.Data HsLit.HsLit
instance PlaceHolder.DataId id => Data.Data.Data (HsLit.HsOverLit id)
instance GHC.Classes.Eq (HsLit.HsOverLit id)
instance GHC.Classes.Ord (HsLit.HsOverLit id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsLit.HsOverLit id)
instance GHC.Classes.Eq HsLit.OverLitVal
instance GHC.Classes.Ord HsLit.OverLitVal
instance Outputable.Outputable HsLit.OverLitVal
instance GHC.Classes.Eq HsLit.HsLit
instance Outputable.Outputable HsLit.HsLit
module HsBinds
-- | Haskell Local Bindings
type HsLocalBinds id = HsLocalBindsLR id id
-- | Located Haskell local bindings
type LHsLocalBinds id = Located (HsLocalBinds id)
-- | Haskell Local Bindings with separate Left and Right identifier types
--
-- Bindings in a 'let' expression or a 'where' clause
data HsLocalBindsLR idL idR
-- | Haskell Value Bindings
HsValBinds :: (HsValBindsLR idL idR) -> HsLocalBindsLR idL idR
-- | Haskell Implicit Parameter Bindings
HsIPBinds :: (HsIPBinds idR) -> HsLocalBindsLR idL idR
-- | Empty Local Bindings
EmptyLocalBinds :: HsLocalBindsLR idL idR
type LHsLocalBindsLR idL idR = Located (HsLocalBindsLR idL idR)
-- | Haskell Value Bindings
type HsValBinds id = HsValBindsLR id id
-- | Haskell Value bindings with separate Left and Right identifier types
-- (not implicit parameters) Used for both top level and nested bindings
-- May contain pattern synonym bindings
data HsValBindsLR idL idR
-- | Value Bindings In
--
-- Before renaming RHS; idR is always RdrName Not dependency analysed
-- Recursive by default
ValBindsIn :: (LHsBindsLR idL idR) -> [LSig idR] -> HsValBindsLR idL idR
-- | Value Bindings Out
--
-- After renaming RHS; idR can be Name or Id Dependency analysed, later
-- bindings in the list may depend on earlier ones.
ValBindsOut :: [(RecFlag, LHsBinds idL)] -> [LSig Name] -> HsValBindsLR idL idR
-- | Located Haskell Binding
type LHsBind id = LHsBindLR id id
-- | Located Haskell Bindings
type LHsBinds id = LHsBindsLR id id
-- | Haskell Binding
type HsBind id = HsBindLR id id
-- | Located Haskell Bindings with separate Left and Right identifier types
type LHsBindsLR idL idR = Bag (LHsBindLR idL idR)
-- | Located Haskell Binding with separate Left and Right identifier types
type LHsBindLR idL idR = Located (HsBindLR idL idR)
-- | Haskell Binding with separate Left and Right id's
data HsBindLR idL idR
-- | Function-like Binding
--
-- FunBind is used for both functions f x = e and variables
-- f = x -> e and strict variables !x = x + 1
--
-- Reason 1: Special case for type inference: see tcMonoBinds.
--
-- Reason 2: Instance decls can only have FunBinds, which is convenient.
-- If you change this, you'll need to change e.g. rnMethodBinds
--
-- But note that the form f :: a->a = ... parses as a pattern
-- binding, just like (f :: a -> a) = ...
--
-- Strict bindings have their strictness recorded in the
-- SrcStrictness of their MatchContext. See Note
-- [Varieties of binding pattern matches] for details about the
-- relationship between FunBind and PatBind.
--
-- AnnKeywordIds
--
--
FunBind :: Located idL -> MatchGroup idR (LHsExpr idR) -> HsWrapper -> PostRn idL NameSet -> [Tickish Id] -> HsBindLR idL idR
[fun_id] :: HsBindLR idL idR -> Located idL
-- | The payload
[fun_matches] :: HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
-- | Coercion from the type of the MatchGroup to the type of the Id.
-- Example:
--
--
-- f :: Int -> forall a. a -> a
-- f x y = y
--
--
-- Then the MatchGroup will have type (Int -> a' -> a') (with a
-- free type variable a'). The coercion will take a CoreExpr of this type
-- and convert it to a CoreExpr of type Int -> forall a'. a' -> a'
-- Notice that the coercion captures the free a'.
[fun_co_fn] :: HsBindLR idL idR -> HsWrapper
-- | After the renamer, this contains the locally-bound free variables of
-- this defn. See Note [Bind free vars]
[bind_fvs] :: HsBindLR idL idR -> PostRn idL NameSet
-- | Ticks to put on the rhs, if any
[fun_tick] :: HsBindLR idL idR -> [Tickish Id]
-- | Pattern Binding
--
-- The pattern is never a simple variable; That case is done by FunBind.
-- See Note [Varieties of binding pattern matches] for details about the
-- relationship between FunBind and PatBind.
PatBind :: LPat idL -> GRHSs idR (LHsExpr idR) -> PostTc idR Type -> PostRn idL NameSet -> ([Tickish Id], [[Tickish Id]]) -> HsBindLR idL idR
[pat_lhs] :: HsBindLR idL idR -> LPat idL
[pat_rhs] :: HsBindLR idL idR -> GRHSs idR (LHsExpr idR)
-- | Type of the GRHSs
[pat_rhs_ty] :: HsBindLR idL idR -> PostTc idR Type
-- | After the renamer, this contains the locally-bound free variables of
-- this defn. See Note [Bind free vars]
[bind_fvs] :: HsBindLR idL idR -> PostRn idL NameSet
-- | Ticks to put on the rhs, if any, and ticks to put on the bound
-- variables.
[pat_ticks] :: HsBindLR idL idR -> ([Tickish Id], [[Tickish Id]])
-- | Variable Binding
--
-- Dictionary binding and suchlike. All VarBinds are introduced by the
-- type checker
VarBind :: idL -> LHsExpr idR -> Bool -> HsBindLR idL idR
[var_id] :: HsBindLR idL idR -> idL
-- | Located only for consistency
[var_rhs] :: HsBindLR idL idR -> LHsExpr idR
-- | True = inline this binding regardless (used for implication
-- constraints only)
[var_inline] :: HsBindLR idL idR -> Bool
-- | Abstraction Bindings
AbsBinds :: [TyVar] -> [EvVar] -> [ABExport idL] -> [TcEvBinds] -> LHsBinds idL -> HsBindLR idL idR
[abs_tvs] :: HsBindLR idL idR -> [TyVar]
-- | Includes equality constraints
[abs_ev_vars] :: HsBindLR idL idR -> [EvVar]
-- | AbsBinds only gets used when idL = idR after renaming, but these need
-- to be idL's for the collect... code in HsUtil to have the right type
[abs_exports] :: HsBindLR idL idR -> [ABExport idL]
-- | Evidence bindings Why a list? See TcInstDcls Note [Typechecking plan
-- for instance declarations]
[abs_ev_binds] :: HsBindLR idL idR -> [TcEvBinds]
-- | Typechecked user bindings
[abs_binds] :: HsBindLR idL idR -> LHsBinds idL
-- | Abstraction Bindings Signature
AbsBindsSig :: [TyVar] -> [EvVar] -> idL -> TcSpecPrags -> TcEvBinds -> LHsBind idL -> HsBindLR idL idR
[abs_tvs] :: HsBindLR idL idR -> [TyVar]
-- | Includes equality constraints
[abs_ev_vars] :: HsBindLR idL idR -> [EvVar]
[abs_sig_export] :: HsBindLR idL idR -> idL
[abs_sig_prags] :: HsBindLR idL idR -> TcSpecPrags
[abs_sig_ev_bind] :: HsBindLR idL idR -> TcEvBinds
[abs_sig_bind] :: HsBindLR idL idR -> LHsBind idL
-- |
PatSynBind :: (PatSynBind idL idR) -> HsBindLR idL idR
-- | Abtraction Bindings Export
data ABExport id
ABE :: id -> id -> HsWrapper -> TcSpecPrags -> ABExport id
-- | Any INLINE pragmas is attached to this Id
[abe_poly] :: ABExport id -> id
[abe_mono] :: ABExport id -> id
-- | See Note [ABExport wrapper] Shape: (forall abs_tvs. abs_ev_vars =>
-- abe_mono) ~ abe_poly
[abe_wrap] :: ABExport id -> HsWrapper
-- | SPECIALISE pragmas
[abe_prags] :: ABExport id -> TcSpecPrags
-- |
--
-- Pattern Synonym binding
data PatSynBind idL idR
PSB :: Located idL -> PostRn idR NameSet -> HsPatSynDetails (Located idR) -> LPat idR -> HsPatSynDir idR -> PatSynBind idL idR
-- | Name of the pattern synonym
[psb_id] :: PatSynBind idL idR -> Located idL
-- | See Note [Bind free vars]
[psb_fvs] :: PatSynBind idL idR -> PostRn idR NameSet
-- | Formal parameter names
[psb_args] :: PatSynBind idL idR -> HsPatSynDetails (Located idR)
-- | Right-hand side
[psb_def] :: PatSynBind idL idR -> LPat idR
-- | Directionality
[psb_dir] :: PatSynBind idL idR -> HsPatSynDir idR
pprLHsBinds :: (OutputableBndrId idL, OutputableBndrId idR) => LHsBindsLR idL idR -> SDoc
pprLHsBindsForUser :: (OutputableBndrId idL, OutputableBndrId idR, OutputableBndrId id2) => LHsBindsLR idL idR -> [LSig id2] -> [SDoc]
pprDeclList :: [SDoc] -> SDoc
emptyLocalBinds :: HsLocalBindsLR a b
isEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
eqEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
isEmptyValBinds :: HsValBindsLR a b -> Bool
emptyValBindsIn :: HsValBindsLR a b
emptyValBindsOut :: HsValBindsLR a b
emptyLHsBinds :: LHsBindsLR idL idR
isEmptyLHsBinds :: LHsBindsLR idL idR -> Bool
plusHsValBinds :: HsValBinds a -> HsValBinds a -> HsValBinds a
ppr_monobind :: (OutputableBndrId idL, OutputableBndrId idR) => HsBindLR idL idR -> SDoc
pprTicks :: SDoc -> SDoc -> SDoc
-- | Haskell Implicit Parameter Bindings
data HsIPBinds id
IPBinds :: [LIPBind id] -> TcEvBinds -> HsIPBinds id
isEmptyIPBinds :: HsIPBinds id -> Bool
-- | Located Implicit Parameter Binding
--
-- May have AnnKeywordId : AnnSemi when in a list
type LIPBind id = Located (IPBind id)
-- | Implicit parameter bindings.
--
-- These bindings start off as (Left "x") in the parser and stay that way
-- until after type-checking when they are replaced with (Right d), where
-- "d" is the name of the dictionary holding the evidence for the
-- implicit parameter.
--
--
data IPBind id
IPBind :: (Either (Located HsIPName) id) -> (LHsExpr id) -> IPBind id
-- | Located Signature
type LSig name = Located (Sig name)
-- | Signatures and pragmas
data Sig name
-- | An ordinary type signature
--
--
-- f :: Num a => a -> a
--
--
-- After renaming, this list of Names contains the named and unnamed
-- wildcards brought into scope by this signature. For a signature _
-- -> _a -> Bool, the renamer will give the unnamed wildcard
-- _ a freshly generated name, e.g. _w. _w and
-- the named wildcard _a are then both replaced with fresh meta
-- vars in the type. Their names are stored in the type signature that
-- brought them into scope, in this third field to be more specific.
--
--
TypeSig :: [Located name] -> (LHsSigWcType name) -> Sig name
-- | A pattern synonym type signature
--
--
-- pattern Single :: () => (Show a) => a -> [a]
--
--
--
PatSynSig :: [Located name] -> (LHsSigType name) -> Sig name
-- | A signature for a class method False: ordinary class-method signature
-- True: generic-default class method signature e.g. class C a where op
-- :: a -> a -- Ordinary default op :: Eq a => a -> a -- Generic
-- default No wildcards allowed here
--
--
ClassOpSig :: Bool -> [Located name] -> (LHsSigType name) -> Sig name
-- | A type signature in generated code, notably the code generated for
-- record selectors. We simply record the desired Id itself, replete with
-- its name, type and IdDetails. Otherwise it's just like a type
-- signature: there should be an accompanying binding
IdSig :: Id -> Sig name
-- | An ordinary fixity declaration
--
--
-- infixl 8 ***
--
--
--
FixSig :: (FixitySig name) -> Sig name
-- | An inline pragma
--
--
-- {#- INLINE f #-}
--
--
--
InlineSig :: (Located name) -> InlinePragma -> Sig name
-- | A specialisation pragma
--
--
-- {-# SPECIALISE f :: Int -> Int #-}
--
--
--
SpecSig :: (Located name) -> [LHsSigType name] -> InlinePragma -> Sig name
-- | A specialisation pragma for instance declarations only
--
--
-- {-# SPECIALISE instance Eq [Int] #-}
--
--
-- (Class tys); should be a specialisation of the current instance
-- declaration
--
--
SpecInstSig :: SourceText -> (LHsSigType name) -> Sig name
-- | A minimal complete definition pragma
--
--
-- {-# MINIMAL a | (b, c | (d | e)) #-}
--
--
--
MinimalSig :: SourceText -> (LBooleanFormula (Located name)) -> Sig name
-- | A "set cost centre" pragma for declarations
--
--
-- {-# SCC funName #-}
--
--
-- or
--
--
-- {-# SCC funName "cost_centre_name" #-}
--
SCCFunSig :: SourceText -> (Located name) -> (Maybe (Located StringLiteral)) -> Sig name
-- | A complete match pragma
--
--
-- {-# COMPLETE C, D [:: T] #-}
--
--
-- Used to inform the pattern match checker about additional complete
-- matchings which, for example, arise from pattern synonym definitions.
CompleteMatchSig :: SourceText -> (Located [Located name]) -> (Maybe (Located name)) -> Sig name
-- | Located Fixity Signature
type LFixitySig name = Located (FixitySig name)
-- | Fixity Signature
data FixitySig name
FixitySig :: [Located name] -> Fixity -> FixitySig name
-- | Type checker Specialisation Pragmas
--
-- TcSpecPrags conveys SPECIALISE pragmas from the type
-- checker to the desugarer
data TcSpecPrags
-- | Super-specialised: a default method should be macro-expanded at every
-- call site
IsDefaultMethod :: TcSpecPrags
SpecPrags :: [LTcSpecPrag] -> TcSpecPrags
-- | Located Type checker Specification Pragmas
type LTcSpecPrag = Located TcSpecPrag
-- | Type checker Specification Pragma
data TcSpecPrag
-- | The Id to be specialised, an wrapper that specialises the polymorphic
-- function, and inlining spec for the specialised function
SpecPrag :: Id -> HsWrapper -> InlinePragma -> TcSpecPrag
noSpecPrags :: TcSpecPrags
hasSpecPrags :: TcSpecPrags -> Bool
isDefaultMethod :: TcSpecPrags -> Bool
isFixityLSig :: LSig name -> Bool
isTypeLSig :: LSig name -> Bool
isSpecLSig :: LSig name -> Bool
isSpecInstLSig :: LSig name -> Bool
isPragLSig :: LSig name -> Bool
isInlineLSig :: LSig name -> Bool
isMinimalLSig :: LSig name -> Bool
isSCCFunSig :: LSig name -> Bool
isCompleteMatchSig :: LSig name -> Bool
hsSigDoc :: Sig name -> SDoc
ppr_sig :: (OutputableBndrId name) => Sig name -> SDoc
pragBrackets :: SDoc -> SDoc
-- | Using SourceText in case the pragma was spelled differently or used
-- mixed case
pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc
pprVarSig :: (OutputableBndr id) => [id] -> SDoc -> SDoc
pprSpec :: (OutputableBndr id) => id -> SDoc -> InlinePragma -> SDoc
pprTcSpecPrags :: TcSpecPrags -> SDoc
pprMinimalSig :: (OutputableBndr name) => LBooleanFormula (Located name) -> SDoc
-- | Haskell Pattern Synonym Details
data HsPatSynDetails a
-- | Infix Pattern Synonym
InfixPatSyn :: a -> a -> HsPatSynDetails a
-- | Prefix Pattern Synonym
PrefixPatSyn :: [a] -> HsPatSynDetails a
-- | Record Pattern Synonym
RecordPatSyn :: [RecordPatSynField a] -> HsPatSynDetails a
-- | Record Pattern Synonym Field
data RecordPatSynField a
RecordPatSynField :: a -> a -> RecordPatSynField a
[recordPatSynSelectorId] :: RecordPatSynField a -> a
[recordPatSynPatVar] :: RecordPatSynField a -> a
-- | Haskell Pattern Synonym Direction
data HsPatSynDir id
Unidirectional :: HsPatSynDir id
ImplicitBidirectional :: HsPatSynDir id
ExplicitBidirectional :: (MatchGroup id (LHsExpr id)) -> HsPatSynDir id
instance Data.Data.Data a => Data.Data.Data (HsBinds.HsPatSynDetails a)
instance Data.Data.Data a => Data.Data.Data (HsBinds.RecordPatSynField a)
instance Data.Data.Data id => Data.Data.Data (HsBinds.ABExport id)
instance Data.Data.Data HsBinds.TcSpecPrags
instance Data.Data.Data HsBinds.TcSpecPrag
instance Data.Data.Data name => Data.Data.Data (HsBinds.FixitySig name)
instance (PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsBinds.HsLocalBindsLR idL idR)
instance (PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsBinds.HsValBindsLR idL idR)
instance (PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsBinds.HsBindLR idL idR)
instance (PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsBinds.PatSynBind idL idR)
instance PlaceHolder.DataId id => Data.Data.Data (HsBinds.HsIPBinds id)
instance PlaceHolder.DataId name => Data.Data.Data (HsBinds.IPBind name)
instance PlaceHolder.DataId name => Data.Data.Data (HsBinds.Sig name)
instance PlaceHolder.DataId id => Data.Data.Data (HsBinds.HsPatSynDir id)
instance (PlaceHolder.OutputableBndrId idL, PlaceHolder.OutputableBndrId idR) => Outputable.Outputable (HsBinds.HsLocalBindsLR idL idR)
instance (PlaceHolder.OutputableBndrId idL, PlaceHolder.OutputableBndrId idR) => Outputable.Outputable (HsBinds.HsValBindsLR idL idR)
instance (PlaceHolder.OutputableBndrId idL, PlaceHolder.OutputableBndrId idR) => Outputable.Outputable (HsBinds.HsBindLR idL idR)
instance (Outputable.OutputableBndr idL, PlaceHolder.OutputableBndrId idR) => Outputable.Outputable (HsBinds.PatSynBind idL idR)
instance GHC.Base.Functor HsBinds.HsPatSynDetails
instance Data.Foldable.Foldable HsBinds.HsPatSynDetails
instance Data.Traversable.Traversable HsBinds.HsPatSynDetails
instance GHC.Base.Functor HsBinds.RecordPatSynField
instance Outputable.Outputable a => Outputable.Outputable (HsBinds.RecordPatSynField a)
instance Data.Foldable.Foldable HsBinds.RecordPatSynField
instance Data.Traversable.Traversable HsBinds.RecordPatSynField
instance Outputable.OutputableBndr id => Outputable.Outputable (HsBinds.ABExport id)
instance Outputable.Outputable HsBinds.TcSpecPrag
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsBinds.Sig name)
instance Outputable.OutputableBndr name => Outputable.Outputable (HsBinds.FixitySig name)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsBinds.HsIPBinds id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsBinds.IPBind id)
module HsPat
-- | Pattern
--
--
data Pat id
-- | Wildcard Pattern The sole reason for a type on a WildPat is to support
-- hsPatType :: Pat Id -> Type
WildPat :: (PostTc id Type) -> Pat id
-- | Variable Pattern
VarPat :: (Located id) -> Pat id
-- | Lazy Pattern ^ - AnnKeywordId : AnnTilde
LazyPat :: (LPat id) -> Pat id
-- | As pattern ^ - AnnKeywordId : AnnAt
AsPat :: (Located id) -> (LPat id) -> Pat id
-- | Parenthesised pattern See Note [Parens in HsSyn] in HsExpr ^ -
-- AnnKeywordId : AnnOpen '(', AnnClose
-- ')'
ParPat :: (LPat id) -> Pat id
-- | Bang pattern ^ - AnnKeywordId : AnnBang
BangPat :: (LPat id) -> Pat id
-- | Syntactic List
--
--
ListPat :: [LPat id] -> (PostTc id Type) -> (Maybe (PostTc id Type, SyntaxExpr id)) -> Pat id
-- | Tuple sub-patterns
--
--
TuplePat :: [LPat id] -> Boxity -> [PostTc id Type] -> Pat id
-- | Anonymous sum pattern
--
--
SumPat :: (LPat id) -> ConTag -> Arity -> (PostTc id [Type]) -> Pat id
-- |
PArrPat :: [LPat id] -> (PostTc id Type) -> Pat id
-- | Constructor Pattern In
ConPatIn :: (Located id) -> (HsConPatDetails id) -> Pat id
-- | Constructor Pattern Out
ConPatOut :: Located ConLike -> [Type] -> [TyVar] -> [EvVar] -> TcEvBinds -> HsConPatDetails id -> HsWrapper -> Pat id
[pat_con] :: Pat id -> Located ConLike
[pat_arg_tys] :: Pat id -> [Type]
[pat_tvs] :: Pat id -> [TyVar]
[pat_dicts] :: Pat id -> [EvVar]
[pat_binds] :: Pat id -> TcEvBinds
[pat_args] :: Pat id -> HsConPatDetails id
[pat_wrap] :: Pat id -> HsWrapper
-- | View Pattern
ViewPat :: (LHsExpr id) -> (LPat id) -> (PostTc id Type) -> Pat id
-- | Splice Pattern (Includes quasi-quotes)
SplicePat :: (HsSplice id) -> Pat id
-- | Literal Pattern Used for *non-overloaded* literal patterns: Int, Int,
-- Char, String, etc.
LitPat :: HsLit -> Pat id
-- | Natural Pattern
--
--
NPat :: (Located (HsOverLit id)) -> (Maybe (SyntaxExpr id)) -> (SyntaxExpr id) -> (PostTc id Type) -> Pat id
-- | n+k pattern
NPlusKPat :: (Located id) -> (Located (HsOverLit id)) -> (HsOverLit id) -> (SyntaxExpr id) -> (SyntaxExpr id) -> (PostTc id Type) -> Pat id
-- | Pattern with a type signature
SigPatIn :: (LPat id) -> (LHsSigWcType id) -> Pat id
-- | Pattern with a type signature
SigPatOut :: (LPat id) -> Type -> Pat id
-- | Coercion Pattern
CoPat :: HsWrapper -> (Pat id) -> Type -> Pat id
type InPat id = LPat id
type OutPat id = LPat id
type LPat id = Located (Pat id)
-- | Haskell Constructor Pattern Details
type HsConPatDetails id = HsConDetails (LPat id) (HsRecFields id (LPat id))
hsConPatArgs :: HsConPatDetails id -> [LPat id]
-- | Haskell Record Fields
--
-- HsRecFields is used only for patterns and expressions (not data type
-- declarations)
data HsRecFields id arg
HsRecFields :: [LHsRecField id arg] -> Maybe Int -> HsRecFields id arg
[rec_flds] :: HsRecFields id arg -> [LHsRecField id arg]
[rec_dotdot] :: HsRecFields id arg -> Maybe Int
-- | Haskell Record Field
--
--
--
-- For details on above see note [Api annotations] in ApiAnnotation
data HsRecField' id arg
HsRecField :: Located id -> arg -> Bool -> HsRecField' id arg
[hsRecFieldLbl] :: HsRecField' id arg -> Located id
-- | Filled in by renamer when punning
[hsRecFieldArg] :: HsRecField' id arg -> arg
-- | Note [Punning]
[hsRecPun] :: HsRecField' id arg -> Bool
-- | Located Haskell Record Field
type LHsRecField' id arg = Located (HsRecField' id arg)
-- | Haskell Record Field
type HsRecField id arg = HsRecField' (FieldOcc id) arg
-- | Located Haskell Record Field
type LHsRecField id arg = Located (HsRecField id arg)
-- | Haskell Record Update Field
type HsRecUpdField id = HsRecField' (AmbiguousFieldOcc id) (LHsExpr id)
-- | Located Haskell Record Update Field
type LHsRecUpdField id = Located (HsRecUpdField id)
hsRecFields :: HsRecFields id arg -> [PostRn id id]
hsRecFieldSel :: HsRecField name arg -> Located (PostRn name name)
hsRecFieldId :: HsRecField Id arg -> Located Id
hsRecFieldsArgs :: HsRecFields id arg -> [arg]
hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc Id) arg -> Located Id
hsRecUpdFieldOcc :: HsRecField' (AmbiguousFieldOcc Id) arg -> LFieldOcc Id
hsRecUpdFieldRdr :: HsRecUpdField id -> Located RdrName
mkPrefixConPat :: DataCon -> [OutPat id] -> [Type] -> OutPat id
mkCharLitPat :: SourceText -> Char -> OutPat id
mkNilPat :: Type -> OutPat id
looksLazyPatBind :: HsBind id -> Bool
isBangedLPat :: LPat id -> Bool
isBangedPatBind :: HsBind id -> Bool
hsPatNeedsParens :: Pat a -> Bool
isIrrefutableHsPat :: (OutputableBndrId id) => LPat id -> Bool
collectEvVarsPats :: [Pat id] -> Bag EvVar
pprParendLPat :: (OutputableBndrId name) => LPat name -> SDoc
pprConArgs :: (OutputableBndrId id) => HsConPatDetails id -> SDoc
instance Data.Traversable.Traversable (HsPat.HsRecFields id)
instance Data.Foldable.Foldable (HsPat.HsRecFields id)
instance GHC.Base.Functor (HsPat.HsRecFields id)
instance Data.Traversable.Traversable (HsPat.HsRecField' id)
instance Data.Foldable.Foldable (HsPat.HsRecField' id)
instance GHC.Base.Functor (HsPat.HsRecField' id)
instance (Data.Data.Data arg, Data.Data.Data id) => Data.Data.Data (HsPat.HsRecField' id arg)
instance PlaceHolder.DataId id => Data.Data.Data (HsPat.Pat id)
instance (PlaceHolder.DataId id, Data.Data.Data arg) => Data.Data.Data (HsPat.HsRecFields id arg)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsPat.Pat name)
instance Outputable.Outputable arg => Outputable.Outputable (HsPat.HsRecFields id arg)
instance (Outputable.Outputable id, Outputable.Outputable arg) => Outputable.Outputable (HsPat.HsRecField' id arg)
module StgCmmClosure
type DynTag = Int
tagForCon :: DynFlags -> DataCon -> DynTag
isSmallFamily :: DynFlags -> Int -> Bool
-- | A *zero-indexed* constructor tag
type ConTagZ = Int
dataConTagZ :: DataCon -> ConTagZ
idPrimRep :: Id -> PrimRep
isVoidRep :: PrimRep -> Bool
isGcPtrRep :: PrimRep -> Bool
addIdReps :: [NonVoid Id] -> [NonVoid (PrimRep, Id)]
addArgReps :: [NonVoid StgArg] -> [NonVoid (PrimRep, StgArg)]
argPrimRep :: StgArg -> PrimRep
newtype NonVoid a
NonVoid :: a -> NonVoid a
fromNonVoid :: NonVoid a -> a
nonVoidIds :: [Id] -> [NonVoid Id]
nonVoidStgArgs :: [StgArg] -> [NonVoid StgArg]
-- | Used in places where some invariant ensures that all these Ids are
-- non-void; e.g. constructor field binders in case expressions. See Note
-- [Post-unarisation invariants] in UnariseStg.
assertNonVoidIds :: [Id] -> [NonVoid Id]
-- | Used in places where some invariant ensures that all these arguments
-- are non-void; e.g. constructor arguments. See Note [Post-unarisation
-- invariants] in UnariseStg.
assertNonVoidStgArgs :: [StgArg] -> [NonVoid StgArg]
data LambdaFormInfo
data StandardFormInfo
mkLFThunk :: Type -> TopLevelFlag -> [Id] -> UpdateFlag -> LambdaFormInfo
mkLFReEntrant :: TopLevelFlag -> [Id] -> [Id] -> ArgDescr -> LambdaFormInfo
mkConLFInfo :: DataCon -> LambdaFormInfo
mkSelectorLFInfo :: Id -> Int -> Bool -> LambdaFormInfo
mkApLFInfo :: Id -> UpdateFlag -> Arity -> LambdaFormInfo
mkLFImported :: Id -> LambdaFormInfo
mkLFArgument :: Id -> LambdaFormInfo
mkLFLetNoEscape :: LambdaFormInfo
mkLFStringLit :: LambdaFormInfo
lfDynTag :: DynFlags -> LambdaFormInfo -> DynTag
maybeIsLFCon :: LambdaFormInfo -> Maybe DataCon
isLFThunk :: LambdaFormInfo -> Bool
isLFReEntrant :: LambdaFormInfo -> Bool
lfUpdatable :: LambdaFormInfo -> Bool
data CgLoc
CmmLoc :: CmmExpr -> CgLoc
LneLoc :: BlockId -> [LocalReg] -> CgLoc
type SelfLoopInfo = (Id, BlockId, [LocalReg])
data CallMethod
EnterIt :: CallMethod
JumpToIt :: BlockId -> [LocalReg] -> CallMethod
ReturnIt :: CallMethod
SlowCall :: CallMethod
DirectEntry :: CLabel -> RepArity -> CallMethod
nodeMustPointToIt :: DynFlags -> LambdaFormInfo -> Bool
isKnownFun :: LambdaFormInfo -> Bool
funTag :: DynFlags -> ClosureInfo -> DynTag
tagForArity :: DynFlags -> RepArity -> DynTag
getCallMethod :: DynFlags -> Name -> Id -> LambdaFormInfo -> RepArity -> RepArity -> CgLoc -> Maybe SelfLoopInfo -> CallMethod
data ClosureInfo
mkClosureInfo :: DynFlags -> Bool -> Id -> LambdaFormInfo -> Int -> Int -> String -> ClosureInfo
-- | Convert from ClosureInfo to CmmInfoTable.
mkCmmInfo :: ClosureInfo -> CmmInfoTable
closureLFInfo :: ClosureInfo -> LambdaFormInfo
closureName :: ClosureInfo -> Name
closureInfoLabel :: ClosureInfo -> CLabel
staticClosureLabel :: ClosureInfo -> CLabel
closureSlowEntryLabel :: ClosureInfo -> CLabel
closureLocalEntryLabel :: DynFlags -> ClosureInfo -> CLabel
closureUpdReqd :: ClosureInfo -> Bool
closureSingleEntry :: ClosureInfo -> Bool
closureReEntrant :: ClosureInfo -> Bool
closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr)
isToplevClosure :: ClosureInfo -> Bool
blackHoleOnEntry :: ClosureInfo -> Bool
isStaticClosure :: ClosureInfo -> Bool
mkDataConInfoTable :: DynFlags -> DataCon -> Bool -> Int -> Int -> CmmInfoTable
cafBlackHoleInfoTable :: CmmInfoTable
indStaticInfoTable :: CmmInfoTable
staticClosureNeedsLink :: Bool -> CmmInfoTable -> Bool
instance GHC.Show.Show a => GHC.Show.Show (StgCmmClosure.NonVoid a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (StgCmmClosure.NonVoid a)
instance Outputable.Outputable a => Outputable.Outputable (StgCmmClosure.NonVoid a)
instance Outputable.Outputable StgCmmClosure.CgLoc
module StgCmmMonad
data FCode a
initC :: IO CgState
runC :: DynFlags -> Module -> CgState -> FCode a -> (a, CgState)
thenC :: FCode () -> FCode a -> FCode a
infixr 9 `thenC`
thenFC :: FCode a -> (a -> FCode c) -> FCode c
infixr 9 `thenFC`
listCs :: [FCode ()] -> FCode ()
returnFC :: a -> FCode a
fixC :: (a -> FCode a) -> FCode a
newUnique :: FCode Unique
newUniqSupply :: FCode UniqSupply
emitLabel :: BlockId -> FCode ()
emit :: CmmAGraph -> FCode ()
emitDecl :: CmmDecl -> FCode ()
emitProc :: Maybe CmmInfoTable -> CLabel -> [GlobalReg] -> CmmAGraphScoped -> Int -> FCode ()
emitProcWithConvention :: Convention -> Maybe CmmInfoTable -> CLabel -> [CmmFormal] -> CmmAGraphScoped -> FCode ()
emitProcWithStackFrame :: Convention -> Maybe CmmInfoTable -> CLabel -> [CmmFormal] -> [CmmFormal] -> CmmAGraphScoped -> Bool -> FCode ()
emitOutOfLine :: BlockId -> CmmAGraphScoped -> FCode ()
emitAssign :: CmmReg -> CmmExpr -> FCode ()
emitStore :: CmmExpr -> CmmExpr -> FCode ()
emitComment :: FastString -> FCode ()
emitTick :: CmmTickish -> FCode ()
emitUnwind :: [(GlobalReg, Maybe CmmExpr)] -> FCode ()
getCmm :: FCode () -> FCode CmmGroup
aGraphToGraph :: CmmAGraphScoped -> FCode CmmGraph
getCodeR :: FCode a -> FCode (a, CmmAGraph)
getCode :: FCode a -> FCode CmmAGraph
-- | Generate code into a fresh tick (sub-)scope and gather generated code
getCodeScoped :: FCode a -> FCode (a, CmmAGraphScoped)
getHeapUsage :: (VirtualHpOffset -> FCode a) -> FCode a
mkCmmIfThenElse :: CmmExpr -> CmmAGraph -> CmmAGraph -> FCode CmmAGraph
mkCmmIfThen :: CmmExpr -> CmmAGraph -> FCode CmmAGraph
mkCmmIfGoto :: CmmExpr -> BlockId -> FCode CmmAGraph
mkCmmIfThenElse' :: CmmExpr -> CmmAGraph -> CmmAGraph -> Maybe Bool -> FCode CmmAGraph
mkCmmIfThen' :: CmmExpr -> CmmAGraph -> Maybe Bool -> FCode CmmAGraph
mkCmmIfGoto' :: CmmExpr -> BlockId -> Maybe Bool -> FCode CmmAGraph
mkCall :: CmmExpr -> (Convention, Convention) -> [CmmFormal] -> [CmmExpr] -> UpdFrameOffset -> [CmmExpr] -> FCode CmmAGraph
mkCmmCall :: CmmExpr -> [CmmFormal] -> [CmmExpr] -> UpdFrameOffset -> FCode CmmAGraph
forkClosureBody :: FCode () -> FCode ()
forkLneBody :: FCode a -> FCode a
forkAlts :: [FCode a] -> FCode [a]
codeOnly :: FCode () -> FCode ()
-- | A *zero-indexed* constructor tag
type ConTagZ = Int
data Sequel
Return :: Sequel
AssignTo :: [LocalReg] -> Bool -> Sequel
data ReturnKind
AssignedDirectly :: ReturnKind
ReturnedTo :: BlockId -> ByteOff -> ReturnKind
withSequel :: Sequel -> FCode a -> FCode a
getSequel :: FCode Sequel
setTickyCtrLabel :: CLabel -> FCode a -> FCode a
getTickyCtrLabel :: FCode CLabel
-- | Places blocks generated by the given code into a fresh (sub-)scope.
-- This will make sure that Cmm annotations in our scope will apply to
-- the Cmm blocks generated therein - but not the other way around.
tickScope :: FCode a -> FCode a
-- | The current tick scope. We will assign this to generated blocks.
getTickScope :: FCode CmmTickScope
withUpdFrameOff :: UpdFrameOffset -> FCode a -> FCode a
getUpdFrameOff :: FCode UpdFrameOffset
initUpdFrameOff :: DynFlags -> UpdFrameOffset
data HeapUsage
HeapUsage :: VirtualHpOffset -> VirtualHpOffset -> HeapUsage
[virtHp] :: HeapUsage -> VirtualHpOffset
[realHp] :: HeapUsage -> VirtualHpOffset
type VirtualHpOffset = WordOff
initHpUsage :: HeapUsage
getHpUsage :: FCode HeapUsage
setHpUsage :: HeapUsage -> FCode ()
heapHWM :: HeapUsage -> VirtualHpOffset
setVirtHp :: VirtualHpOffset -> FCode ()
getVirtHp :: FCode VirtualHpOffset
setRealHp :: VirtualHpOffset -> FCode ()
getModuleName :: FCode Module
getState :: FCode CgState
setState :: CgState -> FCode ()
getSelfLoop :: FCode (Maybe SelfLoopInfo)
withSelfLoop :: SelfLoopInfo -> FCode a -> FCode a
getInfoDown :: FCode CgInfoDownwards
getDynFlags :: HasDynFlags m => m DynFlags
getThisPackage :: FCode UnitId
data CgIdInfo
CgIdInfo :: Id -> LambdaFormInfo -> CgLoc -> CgIdInfo
[cg_id] :: CgIdInfo -> Id
[cg_lf] :: CgIdInfo -> LambdaFormInfo
[cg_loc] :: CgIdInfo -> CgLoc
getBinds :: FCode CgBindings
setBinds :: CgBindings -> FCode ()
data CgInfoDownwards
MkCgInfoDown :: DynFlags -> Module -> UpdFrameOffset -> CLabel -> Sequel -> Maybe SelfLoopInfo -> CmmTickScope -> CgInfoDownwards
[cgd_dflags] :: CgInfoDownwards -> DynFlags
[cgd_mod] :: CgInfoDownwards -> Module
[cgd_updfr_off] :: CgInfoDownwards -> UpdFrameOffset
[cgd_ticky] :: CgInfoDownwards -> CLabel
[cgd_sequel] :: CgInfoDownwards -> Sequel
[cgd_self_loop] :: CgInfoDownwards -> Maybe SelfLoopInfo
[cgd_tick_scope] :: CgInfoDownwards -> CmmTickScope
data CgState
MkCgState :: CmmAGraph -> OrdList CmmDecl -> CgBindings -> HeapUsage -> UniqSupply -> CgState
[cgs_stmts] :: CgState -> CmmAGraph
[cgs_tops] :: CgState -> OrdList CmmDecl
[cgs_binds] :: CgState -> CgBindings
[cgs_hp_usg] :: CgState -> HeapUsage
[cgs_uniqs] :: CgState -> UniqSupply
instance GHC.Base.Functor StgCmmMonad.FCode
instance GHC.Base.Applicative StgCmmMonad.FCode
instance GHC.Base.Monad StgCmmMonad.FCode
instance UniqSupply.MonadUnique StgCmmMonad.FCode
instance DynFlags.HasDynFlags StgCmmMonad.FCode
instance Outputable.Outputable StgCmmMonad.Sequel
instance Outputable.Outputable StgCmmMonad.CgIdInfo
module StgCmmUtils
cgLit :: Literal -> FCode CmmLit
mkSimpleLit :: DynFlags -> Literal -> CmmLit
emitDataLits :: CLabel -> [CmmLit] -> FCode ()
mkDataLits :: Section -> CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt
emitRODataLits :: CLabel -> [CmmLit] -> FCode ()
mkRODataLits :: CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt
emitRtsCall :: UnitId -> FastString -> [(CmmExpr, ForeignHint)] -> Bool -> FCode ()
emitRtsCallWithResult :: LocalReg -> ForeignHint -> UnitId -> FastString -> [(CmmExpr, ForeignHint)] -> Bool -> FCode ()
emitRtsCallGen :: [(LocalReg, ForeignHint)] -> CLabel -> [(CmmExpr, ForeignHint)] -> Bool -> FCode ()
assignTemp :: CmmExpr -> FCode LocalReg
newTemp :: MonadUnique m => CmmType -> m LocalReg
newUnboxedTupleRegs :: Type -> FCode ([LocalReg], [ForeignHint])
emitMultiAssign :: [LocalReg] -> [CmmExpr] -> FCode ()
emitCmmLitSwitch :: CmmExpr -> [(Literal, CmmAGraphScoped)] -> CmmAGraphScoped -> FCode ()
emitSwitch :: CmmExpr -> [(ConTagZ, CmmAGraphScoped)] -> Maybe CmmAGraphScoped -> ConTagZ -> ConTagZ -> FCode ()
tagToClosure :: DynFlags -> TyCon -> CmmExpr -> CmmExpr
mkTaggedObjectLoad :: DynFlags -> LocalReg -> LocalReg -> ByteOff -> DynTag -> CmmAGraph
-- | Returns True if this global register is stored in a
-- caller-saves machine register.
callerSaves :: Platform -> GlobalReg -> Bool
callerSaveVolatileRegs :: DynFlags -> (CmmAGraph, CmmAGraph)
get_GlobalReg_addr :: DynFlags -> GlobalReg -> CmmExpr
cmmAndWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmOrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmNegate :: DynFlags -> CmmExpr -> CmmExpr
cmmEqWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmNeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmUGtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmSubWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmMulWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmAddWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmUShrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmOffsetExprW :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmOffsetExprB :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
cmmRegOffW :: DynFlags -> CmmReg -> WordOff -> CmmExpr
cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr
cmmLabelOffW :: DynFlags -> CLabel -> WordOff -> CmmLit
cmmLabelOffB :: CLabel -> ByteOff -> CmmLit
cmmOffsetW :: DynFlags -> CmmExpr -> WordOff -> CmmExpr
cmmOffsetB :: DynFlags -> CmmExpr -> ByteOff -> CmmExpr
cmmOffsetLitW :: DynFlags -> CmmLit -> WordOff -> CmmLit
cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit
cmmLoadIndexW :: DynFlags -> CmmExpr -> Int -> CmmType -> CmmExpr
cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr
cmmUntag :: DynFlags -> CmmExpr -> CmmExpr
cmmIsTagged :: DynFlags -> CmmExpr -> CmmExpr
addToMem :: CmmType -> CmmExpr -> Int -> CmmAGraph
addToMemE :: CmmType -> CmmExpr -> CmmExpr -> CmmAGraph
addToMemLblE :: CmmType -> CLabel -> CmmExpr -> CmmAGraph
addToMemLbl :: CmmType -> CLabel -> Int -> CmmAGraph
mkWordCLit :: DynFlags -> Integer -> CmmLit
newStringCLit :: String -> FCode CmmLit
newByteStringCLit :: [Word8] -> FCode CmmLit
blankWord :: DynFlags -> CmmStatic
module StgCmmProf
initCostCentres :: CollectedCCs -> FCode ()
ccType :: DynFlags -> CmmType
ccsType :: DynFlags -> CmmType
mkCCostCentre :: CostCentre -> CmmLit
mkCCostCentreStack :: CostCentreStack -> CmmLit
-- | Profiling header words in a dynamic closure
dynProfHdr :: DynFlags -> CmmExpr -> [CmmExpr]
-- | Record the allocation of a closure. The CmmExpr is the cost centre
-- stack to which to attribute the allocation.
profDynAlloc :: SMRep -> CmmExpr -> FCode ()
-- | Record the allocation of a closure (size is given by a CmmExpr) The
-- size must be in words, because the allocation counter in a CCS counts
-- in words.
profAlloc :: CmmExpr -> CmmExpr -> FCode ()
-- | The profiling header words in a static closure
staticProfHdr :: DynFlags -> CostCentreStack -> [CmmLit]
-- | Initialise the profiling field of an update frame
initUpdFrameProf :: CmmExpr -> FCode ()
enterCostCentreThunk :: CmmExpr -> FCode ()
enterCostCentreFun :: CostCentreStack -> CmmExpr -> FCode ()
costCentreFrom :: DynFlags -> CmmExpr -> CmmExpr
curCCS :: CmmExpr
storeCurCCS :: CmmExpr -> CmmAGraph
emitSetCCC :: CostCentre -> Bool -> Bool -> FCode ()
saveCurrentCostCentre :: FCode (Maybe LocalReg)
restoreCurrentCostCentre :: Maybe LocalReg -> FCode ()
ldvEnter :: CmmExpr -> FCode ()
-- | Called when a closure is entered, marks the closure as having been
-- "used". The closure is not an "inherently used" one. The closure is
-- not IND because that is not considered for LDV profiling.
ldvEnterClosure :: ClosureInfo -> CmmReg -> FCode ()
ldvRecordCreate :: CmmExpr -> FCode ()
-- | Our extended FCode monad.
module StgCmmExtCode
-- | Does a computation in the FCode monad, with a current environment and
-- a list of local declarations. Returns the resulting list of
-- declarations.
data CmmParse a
unEC :: CmmParse a -> String -> Env -> Decls -> FCode (Decls, a)
-- | The environment contains variable definitions or blockids.
data Named
-- | Holds CmmLit(CmmLabel ..) which gives the label type, eg, RtsLabel,
-- ForeignLabel, CmmLabel etc.
VarN :: CmmExpr -> Named
-- | A function name from this package
FunN :: UnitId -> Named
-- | A blockid of some code or data.
LabelN :: BlockId -> Named
-- | An environment of named things.
type Env = UniqFM Named
-- | Takes the variable decarations and imports from the monad and makes an
-- environment, which is looped back into the computation. In this way,
-- we can have embedded declarations that scope over the whole procedure,
-- and imports that scope over the entire module. Discards the local
-- declaration contained within decl'
loopDecls :: CmmParse a -> CmmParse a
-- | Get the current environment from the monad.
getEnv :: CmmParse Env
-- | Set context name for a sub-parse
withName :: String -> CmmParse a -> CmmParse a
-- | Get the current context name from the monad
getName :: CmmParse String
-- | Create a fresh local variable of a given type.
newLocal :: CmmType -> FastString -> CmmParse LocalReg
-- | Allocate a fresh label.
newLabel :: FastString -> CmmParse BlockId
newBlockId :: MonadUnique m => m BlockId
-- | Add add a local function to the environment.
newFunctionName :: FastString -> UnitId -> ExtCode
-- | Add an imported foreign label to the list of local declarations. If
-- this is done at the start of the module the declaration will scope
-- over the whole module.
newImport :: (FastString, CLabel) -> CmmParse ()
-- | Lookup the BlockId bound to the label with this name. If one hasn't
-- been bound yet, create a fresh one based on the Unique of the name.
lookupLabel :: FastString -> CmmParse BlockId
-- | Lookup the location of a named variable. Unknown names are treated as
-- if they had been 'import'ed from the runtime system. This saves us a
-- lot of bother in the RTS sources, at the expense of deferring some
-- errors to link time.
lookupName :: FastString -> CmmParse CmmExpr
-- | Lift an FCode computation into the CmmParse monad
code :: FCode a -> CmmParse a
emit :: CmmAGraph -> CmmParse ()
emitLabel :: BlockId -> CmmParse ()
emitAssign :: CmmReg -> CmmExpr -> CmmParse ()
emitStore :: CmmExpr -> CmmExpr -> CmmParse ()
getCode :: CmmParse a -> CmmParse CmmAGraph
getCodeR :: CmmParse a -> CmmParse (a, CmmAGraph)
getCodeScoped :: CmmParse a -> CmmParse (a, CmmAGraphScoped)
emitOutOfLine :: BlockId -> CmmAGraphScoped -> CmmParse ()
withUpdFrameOff :: UpdFrameOffset -> CmmParse () -> CmmParse ()
getUpdFrameOff :: CmmParse UpdFrameOffset
instance GHC.Base.Functor StgCmmExtCode.CmmParse
instance GHC.Base.Applicative StgCmmExtCode.CmmParse
instance GHC.Base.Monad StgCmmExtCode.CmmParse
instance UniqSupply.MonadUnique StgCmmExtCode.CmmParse
instance DynFlags.HasDynFlags StgCmmExtCode.CmmParse
module StgCmmEnv
data CgIdInfo
litIdInfo :: DynFlags -> Id -> LambdaFormInfo -> CmmLit -> CgIdInfo
lneIdInfo :: DynFlags -> Id -> [NonVoid Id] -> CgIdInfo
rhsIdInfo :: Id -> LambdaFormInfo -> FCode (CgIdInfo, LocalReg)
mkRhsInit :: DynFlags -> LocalReg -> LambdaFormInfo -> CmmExpr -> CmmAGraph
idInfoToAmode :: CgIdInfo -> CmmExpr
addBindC :: CgIdInfo -> FCode ()
addBindsC :: [CgIdInfo] -> FCode ()
bindArgsToRegs :: [NonVoid Id] -> FCode [LocalReg]
bindToReg :: NonVoid Id -> LambdaFormInfo -> FCode LocalReg
rebindToReg :: NonVoid Id -> FCode LocalReg
bindArgToReg :: NonVoid Id -> FCode LocalReg
idToReg :: DynFlags -> NonVoid Id -> LocalReg
getArgAmode :: NonVoid StgArg -> FCode CmmExpr
getNonVoidArgAmodes :: [StgArg] -> FCode [CmmExpr]
getCgIdInfo :: Id -> FCode CgIdInfo
maybeLetNoEscape :: CgIdInfo -> Maybe (BlockId, [LocalReg])
module StgCmmArgRep
data ArgRep
P :: ArgRep
N :: ArgRep
L :: ArgRep
V :: ArgRep
F :: ArgRep
D :: ArgRep
V16 :: ArgRep
V32 :: ArgRep
V64 :: ArgRep
toArgRep :: PrimRep -> ArgRep
argRepSizeW :: DynFlags -> ArgRep -> WordOff
argRepString :: ArgRep -> String
isNonV :: ArgRep -> Bool
idArgRep :: Id -> ArgRep
slowCallPattern :: [ArgRep] -> (FastString, RepArity)
instance Outputable.Outputable StgCmmArgRep.ArgRep
module StgCmmTicky
withNewTickyCounterFun :: Bool -> Name -> [NonVoid Id] -> FCode a -> FCode a
withNewTickyCounterLNE :: Name -> [NonVoid Id] -> FCode a -> FCode a
withNewTickyCounterThunk :: Bool -> Bool -> Name -> FCode a -> FCode a
withNewTickyCounterStdThunk :: Bool -> Name -> FCode a -> FCode a
withNewTickyCounterCon :: Name -> FCode a -> FCode a
tickyDynAlloc :: Maybe Id -> SMRep -> LambdaFormInfo -> FCode ()
tickyAllocHeap :: Bool -> VirtualHpOffset -> FCode ()
tickyAllocPrim :: CmmExpr -> CmmExpr -> CmmExpr -> FCode ()
tickyAllocThunk :: CmmExpr -> CmmExpr -> FCode ()
tickyAllocPAP :: CmmExpr -> CmmExpr -> FCode ()
tickyHeapCheck :: FCode ()
tickyStackCheck :: FCode ()
tickyUnknownCall :: FCode ()
tickyDirectCall :: RepArity -> [StgArg] -> FCode ()
tickyPushUpdateFrame :: FCode ()
tickyUpdateFrameOmitted :: FCode ()
tickyEnterDynCon :: FCode ()
tickyEnterStaticCon :: FCode ()
tickyEnterViaNode :: FCode ()
tickyEnterFun :: ClosureInfo -> FCode ()
tickyEnterThunk :: ClosureInfo -> FCode ()
tickyEnterStdThunk :: ClosureInfo -> FCode ()
tickyEnterLNE :: FCode ()
tickyUpdateBhCaf :: ClosureInfo -> FCode ()
tickyBlackHole :: Bool -> FCode ()
tickyUnboxedTupleReturn :: RepArity -> FCode ()
tickyReturnOldCon :: RepArity -> FCode ()
tickyReturnNewCon :: RepArity -> FCode ()
tickyKnownCallTooFewArgs :: FCode ()
tickyKnownCallExact :: FCode ()
tickyKnownCallExtraArgs :: FCode ()
tickySlowCall :: LambdaFormInfo -> [StgArg] -> FCode ()
tickySlowCallPat :: [PrimRep] -> FCode ()
module StgCmmLayout
mkArgDescr :: DynFlags -> [Id] -> ArgDescr
-- | emitCall conv fun args makes a call to the entry-code of
-- fun, using the call/return convention conv, passing
-- args, and returning the results to the current sequel.
emitCall :: (Convention, Convention) -> CmmExpr -> [CmmExpr] -> FCode ReturnKind
-- | Return multiple values to the sequel
--
-- If the sequel is Return
--
--
-- return (x,y)
--
--
-- If the sequel is AssignTo [p,q]
--
--
-- p=x; q=y;
--
emitReturn :: [CmmExpr] -> FCode ReturnKind
adjustHpBackwards :: FCode ()
emitClosureProcAndInfoTable :: Bool -> Id -> LambdaFormInfo -> CmmInfoTable -> [NonVoid Id] -> ((Int, LocalReg, [LocalReg]) -> FCode ()) -> FCode ()
emitClosureAndInfoTable :: CmmInfoTable -> Convention -> [LocalReg] -> FCode () -> FCode ()
slowCall :: CmmExpr -> [StgArg] -> FCode ReturnKind
directCall :: Convention -> CLabel -> RepArity -> [StgArg] -> FCode ReturnKind
mkVirtHeapOffsets :: DynFlags -> Bool -> [NonVoid (PrimRep, a)] -> (WordOff, WordOff, [(NonVoid a, ByteOff)])
-- | Just like mkVirtHeapOffsets, but for constructors
mkVirtConstrOffsets :: DynFlags -> [NonVoid (PrimRep, a)] -> (WordOff, WordOff, [(NonVoid a, ByteOff)])
-- | Just like mkVirtConstrOffsets, but used when we don't have the actual
-- arguments. Useful when e.g. generating info tables; we just need to
-- know sizes of pointer and non-pointer fields.
mkVirtConstrSizes :: DynFlags -> [NonVoid PrimRep] -> (WordOff, WordOff)
getHpRelOffset :: VirtualHpOffset -> FCode CmmExpr
data ArgRep
P :: ArgRep
N :: ArgRep
L :: ArgRep
V :: ArgRep
F :: ArgRep
D :: ArgRep
V16 :: ArgRep
V32 :: ArgRep
V64 :: ArgRep
toArgRep :: PrimRep -> ArgRep
argRepSizeW :: DynFlags -> ArgRep -> WordOff
module StgCmmHeap
getVirtHp :: FCode VirtualHpOffset
setVirtHp :: VirtualHpOffset -> FCode ()
setRealHp :: VirtualHpOffset -> FCode ()
getHpRelOffset :: VirtualHpOffset -> FCode CmmExpr
entryHeapCheck :: ClosureInfo -> Maybe LocalReg -> Int -> [LocalReg] -> FCode () -> FCode ()
altHeapCheck :: [LocalReg] -> FCode a -> FCode a
noEscapeHeapCheck :: [LocalReg] -> FCode a -> FCode a
altHeapCheckReturnsTo :: [LocalReg] -> Label -> ByteOff -> FCode a -> FCode a
heapStackCheckGen :: Maybe CmmExpr -> Maybe CmmExpr -> FCode ()
-- | lower-level version for CmmParse
entryHeapCheck' :: Bool -> CmmExpr -> Int -> [LocalReg] -> FCode () -> FCode ()
mkStaticClosureFields :: DynFlags -> CmmInfoTable -> CostCentreStack -> CafInfo -> [CmmLit] -> [CmmLit]
mkStaticClosure :: DynFlags -> CLabel -> CostCentreStack -> [CmmLit] -> [CmmLit] -> [CmmLit] -> [CmmLit] -> [CmmLit]
allocDynClosure :: Maybe Id -> CmmInfoTable -> LambdaFormInfo -> CmmExpr -> CmmExpr -> [(NonVoid StgArg, VirtualHpOffset)] -> FCode CmmExpr
allocDynClosureCmm :: Maybe Id -> CmmInfoTable -> LambdaFormInfo -> CmmExpr -> CmmExpr -> [(CmmExpr, ByteOff)] -> FCode CmmExpr
-- | Low-level heap object allocation.
allocHeapClosure :: SMRep -> CmmExpr -> CmmExpr -> [(CmmExpr, ByteOff)] -> FCode CmmExpr
emitSetDynHdr :: CmmExpr -> CmmExpr -> CmmExpr -> FCode ()
module StgCmmForeign
-- | emit code for a foreign call, and return the results to the sequel.
cgForeignCall :: ForeignCall -> [StgArg] -> Type -> FCode ReturnKind
emitPrimCall :: [CmmFormal] -> CallishMachOp -> [CmmActual] -> FCode ()
emitCCall :: [(CmmFormal, ForeignHint)] -> CmmExpr -> [(CmmActual, ForeignHint)] -> FCode ()
emitForeignCall :: Safety -> [CmmFormal] -> ForeignTarget -> [CmmActual] -> FCode ReturnKind
emitSaveThreadState :: FCode ()
-- | Produce code to save the current thread state to CurrentTSO
saveThreadState :: MonadUnique m => DynFlags -> m CmmAGraph
emitLoadThreadState :: FCode ()
-- | Produce code to load the current thread state from CurrentTSO
loadThreadState :: MonadUnique m => DynFlags -> m CmmAGraph
emitOpenNursery :: FCode ()
emitCloseNursery :: FCode ()
module StgCmmPrim
cgOpApp :: StgOp -> [StgArg] -> Type -> FCode ReturnKind
cgPrimOp :: [LocalReg] -> PrimOp -> [StgArg] -> FCode ()
-- | Decide whether an out-of-line primop should be replaced by an inline
-- implementation. This might happen e.g. if there's enough static
-- information, such as statically know arguments, to emit a more
-- efficient implementation inline.
--
-- Returns Nothing if this primop should use its out-of-line
-- implementation (defined elsewhere) and Just together with a
-- code generating function that takes the output regs as arguments
-- otherwise.
shouldInlinePrimOp :: DynFlags -> PrimOp -> [CmmExpr] -> Maybe ([LocalReg] -> FCode ())
module CmmLayoutStack
cmmLayoutStack :: DynFlags -> ProcPointSet -> ByteOff -> CmmGraph -> UniqSM (CmmGraph, LabelMap StackMap)
setInfoTableStackMap :: DynFlags -> LabelMap StackMap -> CmmDecl -> CmmDecl
instance Outputable.Outputable CmmLayoutStack.StackSlot
instance Outputable.Outputable CmmLayoutStack.StackMap
module InstEnv
-- | Dictionary Function Identifier
type DFunId = Id
type InstMatch = (ClsInst, [DFunInstType])
type ClsInstLookupResult = ([InstMatch], [ClsInst], [InstMatch])
-- | The semantics allowed for overlapping instances for a particular
-- instance. See Note [Safe Haskell isSafeOverlap] (in hs) for a
-- explanation of the isSafeOverlap field.
--
--
data OverlapFlag
OverlapFlag :: OverlapMode -> Bool -> OverlapFlag
[overlapMode] :: OverlapFlag -> OverlapMode
[isSafeOverlap] :: OverlapFlag -> Bool
data OverlapMode
-- | This instance must not overlap another NoOverlap instance.
-- However, it may be overlapped by Overlapping instances, and it
-- may overlap Overlappable instances.
NoOverlap :: SourceText -> OverlapMode
-- | Silently ignore this instance if you find a more specific one that
-- matches the constraint you are trying to resolve
--
-- Example: constraint (Foo [Int]) instance Foo [Int] instance {--} Foo
-- [a]
--
-- Since the second instance has the Overlappable flag, the first
-- instance will be chosen (otherwise its ambiguous which to choose)
Overlappable :: SourceText -> OverlapMode
-- | Silently ignore any more general instances that may be used to solve
-- the constraint.
--
-- Example: constraint (Foo [Int]) instance {--} Foo [Int] instance Foo
-- [a]
--
-- Since the first instance has the Overlapping flag, the second---more
-- general---instance will be ignored (otherwise it is ambiguous which to
-- choose)
Overlapping :: SourceText -> OverlapMode
-- | Equivalent to having both Overlapping and Overlappable
-- flags.
Overlaps :: SourceText -> OverlapMode
-- | Behave like Overlappable and Overlapping, and in addition pick an an
-- arbitrary one if there are multiple matching candidates, and don't
-- worry about later instantiation
--
-- Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int]
-- instance Foo [a] Without the Incoherent flag, we'd complain that
-- instantiating b would change which instance was chosen. See
-- also note [Incoherent instances] in InstEnv
Incoherent :: SourceText -> OverlapMode
setOverlapModeMaybe :: OverlapFlag -> Maybe OverlapMode -> OverlapFlag
-- | A type-class instance. Note that there is some tricky laziness at work
-- here. See Note [ClsInst laziness and the rough-match fields] for more
-- details.
data ClsInst
ClsInst :: Name -> [Maybe Name] -> Name -> [TyVar] -> Class -> [Type] -> DFunId -> OverlapFlag -> IsOrphan -> ClsInst
-- | Class name
[is_cls_nm] :: ClsInst -> Name
-- | Top of type args
[is_tcs] :: ClsInst -> [Maybe Name]
-- | is_dfun_name = idName . is_dfun.
--
-- We use is_dfun_name for the visibility check,
-- instIsVisible, which needs to know the Module which the
-- dictionary is defined in. However, we cannot use the Module
-- attached to is_dfun since doing so would mean we would
-- potentially pull in an entire interface file unnecessarily. This was
-- the cause of #12367.
[is_dfun_name] :: ClsInst -> Name
[is_tvs] :: ClsInst -> [TyVar]
[is_cls] :: ClsInst -> Class
[is_tys] :: ClsInst -> [Type]
[is_dfun] :: ClsInst -> DFunId
[is_flag] :: ClsInst -> OverlapFlag
[is_orphan] :: ClsInst -> IsOrphan
type DFunInstType = Maybe Type
pprInstance :: ClsInst -> SDoc
pprInstanceHdr :: ClsInst -> SDoc
pprInstances :: [ClsInst] -> SDoc
instanceHead :: ClsInst -> ([TyVar], Class, [Type])
instanceSig :: ClsInst -> ([TyVar], [Type], Class, [Type])
mkLocalInstance :: DFunId -> OverlapFlag -> [TyVar] -> Class -> [Type] -> ClsInst
mkImportedInstance :: Name -> [Maybe Name] -> Name -> DFunId -> OverlapFlag -> IsOrphan -> ClsInst
instanceDFunId :: ClsInst -> DFunId
tidyClsInstDFun :: (DFunId -> DFunId) -> ClsInst -> ClsInst
instanceRoughTcs :: ClsInst -> [Maybe Name]
-- | A fuzzy comparison function for class instances, intended for sorting
-- instances before displaying them to the user.
fuzzyClsInstCmp :: ClsInst -> ClsInst -> Ordering
-- | Collects the names of concrete types and type constructors that make
-- up the head of a class instance. For instance, given `class Foo a b`:
--
-- `instance Foo (Either (Maybe Int) a) Bool` would yield [Either, Maybe,
-- Int, Bool]
--
-- Used in the implementation of ":info" in GHCi.
--
-- The tcSplitSigmaTy is because of instance Foo a => Baz T
-- where ... The decl is an orphan if Baz and T are both not locally
-- defined, even if Foo *is* locally defined
orphNamesOfClsInst :: ClsInst -> NameSet
-- | InstEnvs represents the combination of the global type class
-- instance environment, the local type class instance environment, and
-- the set of transitively reachable orphan modules (according to what
-- modules have been directly imported) used to test orphan instance
-- visibility.
data InstEnvs
InstEnvs :: InstEnv -> InstEnv -> VisibleOrphanModules -> InstEnvs
[ie_global] :: InstEnvs -> InstEnv
[ie_local] :: InstEnvs -> InstEnv
[ie_visible] :: InstEnvs -> VisibleOrphanModules
-- | Set of visible orphan modules, according to what modules have been
-- directly imported. This is based off of the dep_orphs field, which
-- records transitively reachable orphan modules (modules that define
-- orphan instances).
type VisibleOrphanModules = ModuleSet
type InstEnv = UniqDFM ClsInstEnv
emptyInstEnv :: InstEnv
extendInstEnv :: InstEnv -> ClsInst -> InstEnv
deleteFromInstEnv :: InstEnv -> ClsInst -> InstEnv
-- | True when when the instance heads are the same e.g. both are Eq
-- [(a,b)] Used for overriding in GHCi Obviously should be insenstive to
-- alpha-renaming
identicalClsInstHead :: ClsInst -> ClsInst -> Bool
extendInstEnvList :: InstEnv -> [ClsInst] -> InstEnv
-- | Look up an instance in the given instance environment. The given class
-- application must match exactly one instance and the match may not
-- contain any flexi type variables. If the lookup is unsuccessful, yield
-- 'Left errorMessage'.
lookupUniqueInstEnv :: InstEnvs -> Class -> [Type] -> Either MsgDoc (ClsInst, [Type])
-- | See Note [Rules for instance lookup] ^ See Note [Safe Haskell
-- Overlapping Instances] in TcSimplify ^ See Note [Safe Haskell
-- Overlapping Instances Implementation] in TcSimplify
lookupInstEnv :: Bool -> InstEnvs -> Class -> [Type] -> ClsInstLookupResult
instEnvElts :: InstEnv -> [ClsInst]
-- | Checks for an exact match of ClsInst in the instance environment. We
-- use this when we do signature checking in TcRnDriver
memberInstEnv :: InstEnv -> ClsInst -> Bool
-- | Test if an instance is visible, by checking that its origin module is
-- in VisibleOrphanModules. See Note [Instance lookup and orphan
-- instances]
instIsVisible :: VisibleOrphanModules -> ClsInst -> Bool
classInstances :: InstEnvs -> Class -> [ClsInst]
instanceBindFun :: TyCoVar -> BindFlag
instanceCantMatch :: [Maybe Name] -> [Maybe Name] -> Bool
roughMatchTcs :: [Type] -> [Maybe Name]
isOverlappable :: ClsInst -> Bool
isOverlapping :: ClsInst -> Bool
isIncoherent :: ClsInst -> Bool
instance Data.Data.Data InstEnv.ClsInst
instance Outputable.Outputable InstEnv.ClsInstEnv
instance Name.NamedThing InstEnv.ClsInst
instance Outputable.Outputable InstEnv.ClsInst
module OptCoercion
-- | optCoercion applies a substitution to a coercion, *and* optimises it
-- to reduce its size
optCoercion :: TCvSubst -> Coercion -> NormalCo
-- | Check to make sure that an AxInstCo is internally consistent. Returns
-- the conflicting branch, if it exists See Note [Conflict checking with
-- AxiomInstCo]
checkAxInstCo :: Coercion -> Maybe CoAxBranch
-- | Abstract syntax of global declarations.
--
-- Definitions for: SynDecl and ConDecl,
-- ClassDecl, InstDecl, DefaultDecl and
-- ForeignDecl.
module HsDecls
-- | A Haskell Declaration
data HsDecl id
-- | Type or Class Declaration
TyClD :: (TyClDecl id) -> HsDecl id
-- | Instance declaration
InstD :: (InstDecl id) -> HsDecl id
-- | Deriving declaration
DerivD :: (DerivDecl id) -> HsDecl id
-- | Value declaration
ValD :: (HsBind id) -> HsDecl id
-- | Signature declaration
SigD :: (Sig id) -> HsDecl id
-- | 'default' declaration
DefD :: (DefaultDecl id) -> HsDecl id
-- | Foreign declaration
ForD :: (ForeignDecl id) -> HsDecl id
-- | Warning declaration
WarningD :: (WarnDecls id) -> HsDecl id
-- | Annotation declaration
AnnD :: (AnnDecl id) -> HsDecl id
-- | Rule declaration
RuleD :: (RuleDecls id) -> HsDecl id
-- | Vectorise declaration
VectD :: (VectDecl id) -> HsDecl id
-- | Splice declaration (Includes quasi-quotes)
SpliceD :: (SpliceDecl id) -> HsDecl id
-- | Documentation comment declaration
DocD :: (DocDecl) -> HsDecl id
-- | Role annotation declaration
RoleAnnotD :: (RoleAnnotDecl id) -> HsDecl id
type LHsDecl id = Located (HsDecl id) When in a list this may have - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSemi'
-- | Haskell Data type Definition
data HsDataDefn name
-- | Declares a data type or newtype, giving its constructors
-- data/newtype T a = constrs data/newtype instance T [a] =
-- constrs
HsDataDefn :: NewOrData -> LHsContext name -> Maybe (Located CType) -> Maybe (LHsKind name) -> [LConDecl name] -> HsDeriving name -> HsDataDefn name
[dd_ND] :: HsDataDefn name -> NewOrData
-- | Context
[dd_ctxt] :: HsDataDefn name -> LHsContext name
[dd_cType] :: HsDataDefn name -> Maybe (Located CType)
-- | Optional kind signature.
--
-- (Just k) for a GADT-style data, or data
-- instance decl, with explicit kind sig
--
-- Always Nothing for H98-syntax decls
[dd_kindSig] :: HsDataDefn name -> Maybe (LHsKind name)
-- | Data constructors
--
-- For data T a = T1 | T2 a the LConDecls all have
-- ConDeclH98. For data T a where { T1 :: T a } the
-- LConDecls all have ConDeclGADT.
[dd_cons] :: HsDataDefn name -> [LConDecl name]
-- | Optional 'deriving' claues
[dd_derivs] :: HsDataDefn name -> HsDeriving name
-- | Haskell Deriving clause
type HsDeriving name = Located [LHsDerivingClause name] The optional @deriving@ clauses of a data declaration. "Clauses" is plural because one can specify multiple deriving clauses using the @-XDerivingStrategies@ language extension. The list of 'LHsDerivingClause's corresponds to exactly what the user requested to derive, in order. If no deriving clauses were specified, the list is empty.
-- | A single deriving clause of a data declaration.
--
--
data HsDerivingClause name
HsDerivingClause :: Maybe (Located DerivStrategy) -> Located [LHsSigType name] -> HsDerivingClause name
-- | The user-specified strategy (if any) to use when deriving
-- deriv_clause_tys.
[deriv_clause_strategy] :: HsDerivingClause name -> Maybe (Located DerivStrategy)
-- | The types to derive.
--
-- It uses LHsSigTypes because, with
-- -XGeneralizedNewtypeDeriving, we can mention type variables
-- that aren't bound by the datatype, e.g.
--
--
-- data T b = ... deriving (C [a])
--
--
-- should produce a derived instance for C [a] (T b).
[deriv_clause_tys] :: HsDerivingClause name -> Located [LHsSigType name]
type LHsDerivingClause name = Located (HsDerivingClause name)
-- | A type or class declaration.
data TyClDecl name
-- |
-- type/data family T :: *->*
--
--
--
-- - AnnKeywordId : AnnType, AnnData,
-- AnnFamily,AnnDcolon, AnnWhere,AnnOpenP,
-- AnnDcolon,AnnCloseP, AnnEqual,AnnRarrow,
-- AnnVbar
--
FamDecl :: FamilyDecl name -> TyClDecl name
[tcdFam] :: TyClDecl name -> FamilyDecl name
-- | type declaration
--
--
SynDecl :: Located name -> LHsQTyVars name -> LexicalFixity -> LHsType name -> PostRn name NameSet -> TyClDecl name
-- | Type constructor
[tcdLName] :: TyClDecl name -> Located name
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl name -> LHsQTyVars name
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl name -> LexicalFixity
-- | RHS of type declaration
[tcdRhs] :: TyClDecl name -> LHsType name
[tcdFVs] :: TyClDecl name -> PostRn name NameSet
-- | data declaration
--
--
DataDecl :: Located name -> LHsQTyVars name -> LexicalFixity -> HsDataDefn name -> PostRn name Bool -> PostRn name NameSet -> TyClDecl name
-- | Type constructor
[tcdLName] :: TyClDecl name -> Located name
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl name -> LHsQTyVars name
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl name -> LexicalFixity
[tcdDataDefn] :: TyClDecl name -> HsDataDefn name
-- | does this have a CUSK?
[tcdDataCusk] :: TyClDecl name -> PostRn name Bool
[tcdFVs] :: TyClDecl name -> PostRn name NameSet
-- |
ClassDecl :: LHsContext name -> Located name -> LHsQTyVars name -> LexicalFixity -> [Located (FunDep (Located name))] -> [LSig name] -> LHsBinds name -> [LFamilyDecl name] -> [LTyFamDefltEqn name] -> [LDocDecl] -> PostRn name NameSet -> TyClDecl name
-- | Context...
[tcdCtxt] :: TyClDecl name -> LHsContext name
-- | Type constructor
[tcdLName] :: TyClDecl name -> Located name
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl name -> LHsQTyVars name
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl name -> LexicalFixity
-- | Functional deps
[tcdFDs] :: TyClDecl name -> [Located (FunDep (Located name))]
-- | Methods' signatures
[tcdSigs] :: TyClDecl name -> [LSig name]
-- | Default methods
[tcdMeths] :: TyClDecl name -> LHsBinds name
-- | Associated types;
[tcdATs] :: TyClDecl name -> [LFamilyDecl name]
-- | Associated type defaults
[tcdATDefs] :: TyClDecl name -> [LTyFamDefltEqn name]
-- | Haddock docs
[tcdDocs] :: TyClDecl name -> [LDocDecl]
[tcdFVs] :: TyClDecl name -> PostRn name NameSet
-- | Located Declaration of a Type or Class
type LTyClDecl name = Located (TyClDecl name)
-- | Type or Class Group
data TyClGroup name
TyClGroup :: [LTyClDecl name] -> [LRoleAnnotDecl name] -> [LInstDecl name] -> TyClGroup name
[group_tyclds] :: TyClGroup name -> [LTyClDecl name]
[group_roles] :: TyClGroup name -> [LRoleAnnotDecl name]
[group_instds] :: TyClGroup name -> [LInstDecl name]
mkTyClGroup :: [LTyClDecl name] -> [LInstDecl name] -> TyClGroup name
emptyTyClGroup :: TyClGroup name
tyClGroupTyClDecls :: [TyClGroup name] -> [LTyClDecl name]
tyClGroupInstDecls :: [TyClGroup name] -> [LInstDecl name]
tyClGroupRoleDecls :: [TyClGroup name] -> [LRoleAnnotDecl name]
-- | type class
isClassDecl :: TyClDecl name -> Bool
-- | True = argument is a data/newtype
-- declaration.
isDataDecl :: TyClDecl name -> Bool
-- | type or type instance declaration
isSynDecl :: TyClDecl name -> Bool
tcdName :: TyClDecl name -> name
-- | type/data family declaration
isFamilyDecl :: TyClDecl name -> Bool
-- | type family declaration
isTypeFamilyDecl :: TyClDecl name -> Bool
-- | data family declaration
isDataFamilyDecl :: TyClDecl name -> Bool
-- | open type family info
isOpenTypeFamilyInfo :: FamilyInfo name -> Bool
-- | closed type family info
isClosedTypeFamilyInfo :: FamilyInfo name -> Bool
tyFamInstDeclName :: TyFamInstDecl name -> name
tyFamInstDeclLName :: TyFamInstDecl name -> Located name
countTyClDecls :: [TyClDecl name] -> (Int, Int, Int, Int, Int)
pprTyClDeclFlavour :: TyClDecl a -> SDoc
tyClDeclLName :: TyClDecl name -> Located name
tyClDeclTyVars :: TyClDecl name -> LHsQTyVars name
-- | Does this declaration have a complete, user-supplied kind signature?
-- See Note [Complete user-supplied kind signatures]
hsDeclHasCusk :: TyClDecl Name -> Bool
-- | Does this family declaration have a complete, user-supplied kind
-- signature?
famDeclHasCusk :: Maybe Bool -> FamilyDecl name -> Bool
-- | type Family Declaration
data FamilyDecl name
-- |
FamilyDecl :: FamilyInfo name -> Located name -> LHsQTyVars name -> LexicalFixity -> LFamilyResultSig name -> Maybe (LInjectivityAnn name) -> FamilyDecl name
[fdInfo] :: FamilyDecl name -> FamilyInfo name
[fdLName] :: FamilyDecl name -> Located name
[fdTyVars] :: FamilyDecl name -> LHsQTyVars name
[fdFixity] :: FamilyDecl name -> LexicalFixity
[fdResultSig] :: FamilyDecl name -> LFamilyResultSig name
[fdInjectivityAnn] :: FamilyDecl name -> Maybe (LInjectivityAnn name)
-- | Located type Family Declaration
type LFamilyDecl name = Located (FamilyDecl name)
-- | Instance Declaration
data InstDecl name
ClsInstD :: ClsInstDecl name -> InstDecl name
[cid_inst] :: InstDecl name -> ClsInstDecl name
DataFamInstD :: DataFamInstDecl name -> InstDecl name
[dfid_inst] :: InstDecl name -> DataFamInstDecl name
TyFamInstD :: TyFamInstDecl name -> InstDecl name
[tfid_inst] :: InstDecl name -> TyFamInstDecl name
-- | Located Instance Declaration
type LInstDecl name = Located (InstDecl name)
data NewOrData
-- |
-- newtype Blah ...
--
NewType :: NewOrData
-- |
-- data Blah ...
--
DataType :: NewOrData
data FamilyInfo name
DataFamily :: FamilyInfo name
OpenTypeFamily :: FamilyInfo name
-- | Nothing if we're in an hs-boot file and the user said "type
-- family Foo x where .."
ClosedTypeFamily :: (Maybe [LTyFamInstEqn name]) -> FamilyInfo name
-- | Type Family Instance Declaration
data TyFamInstDecl name
-- |
TyFamInstDecl :: LTyFamInstEqn name -> PostRn name NameSet -> TyFamInstDecl name
[tfid_eqn] :: TyFamInstDecl name -> LTyFamInstEqn name
[tfid_fvs] :: TyFamInstDecl name -> PostRn name NameSet
-- | Located Type Family Instance Declaration
type LTyFamInstDecl name = Located (TyFamInstDecl name)
instDeclDataFamInsts :: [LInstDecl name] -> [DataFamInstDecl name]
-- | Data Family Instance Declaration
data DataFamInstDecl name
-- |
DataFamInstDecl :: Located name -> HsTyPats name -> LexicalFixity -> HsDataDefn name -> PostRn name NameSet -> DataFamInstDecl name
[dfid_tycon] :: DataFamInstDecl name -> Located name
[dfid_pats] :: DataFamInstDecl name -> HsTyPats name
-- | Fixity used in the declaration
[dfid_fixity] :: DataFamInstDecl name -> LexicalFixity
[dfid_defn] :: DataFamInstDecl name -> HsDataDefn name
[dfid_fvs] :: DataFamInstDecl name -> PostRn name NameSet
-- | Located Data Family Instance Declaration
type LDataFamInstDecl name = Located (DataFamInstDecl name)
pprDataFamInstFlavour :: DataFamInstDecl name -> SDoc
-- | Type Family Equation
--
-- One equation in a type family instance declaration See Note [Type
-- family instance declarations in HsSyn]
data TyFamEqn name pats
-- |
TyFamEqn :: Located name -> pats -> LexicalFixity -> LHsType name -> TyFamEqn name pats
[tfe_tycon] :: TyFamEqn name pats -> Located name
[tfe_pats] :: TyFamEqn name pats -> pats
-- | Fixity used in the declaration
[tfe_fixity] :: TyFamEqn name pats -> LexicalFixity
[tfe_rhs] :: TyFamEqn name pats -> LHsType name
-- | Type Family Instance Equation
type TyFamInstEqn name = TyFamEqn name (HsTyPats name)
-- | Located Type Family Instance Equation
type LTyFamInstEqn name = Located (TyFamInstEqn name) May have 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSemi' when in a list
-- | Type Family Default Equation
type TyFamDefltEqn name = TyFamEqn name (LHsQTyVars name)
-- | Located Type Family Default Equation
type LTyFamDefltEqn name = Located (TyFamDefltEqn name)
-- | Haskell Type Patterns
type HsTyPats name = HsImplicitBndrs name [LHsType name] Type patterns (with kind and type bndrs) See Note [Family instance declaration binders]
-- | Located Class Instance Declaration
type LClsInstDecl name = Located (ClsInstDecl name)
-- | Class Instance Declaration
data ClsInstDecl name
-- |
ClsInstDecl :: LHsSigType name -> LHsBinds name -> [LSig name] -> [LTyFamInstDecl name] -> [LDataFamInstDecl name] -> Maybe (Located OverlapMode) -> ClsInstDecl name
[cid_poly_ty] :: ClsInstDecl name -> LHsSigType name
[cid_binds] :: ClsInstDecl name -> LHsBinds name
[cid_sigs] :: ClsInstDecl name -> [LSig name]
[cid_tyfam_insts] :: ClsInstDecl name -> [LTyFamInstDecl name]
[cid_datafam_insts] :: ClsInstDecl name -> [LDataFamInstDecl name]
-- |
[cid_overlap_mode] :: ClsInstDecl name -> Maybe (Located OverlapMode)
-- | Deriving Declaration
data DerivDecl name
DerivDecl :: LHsSigType name -> Maybe (Located DerivStrategy) -> Maybe (Located OverlapMode) -> DerivDecl name
[deriv_type] :: DerivDecl name -> LHsSigType name
[deriv_strategy] :: DerivDecl name -> Maybe (Located DerivStrategy)
-- |
[deriv_overlap_mode] :: DerivDecl name -> Maybe (Located OverlapMode)
-- | Located Deriving Declaration
type LDerivDecl name = Located (DerivDecl name)
-- | Located Rule Declarations
type LRuleDecls name = Located (RuleDecls name)
-- | Rule Declarations
data RuleDecls name
HsRules :: SourceText -> [LRuleDecl name] -> RuleDecls name
[rds_src] :: RuleDecls name -> SourceText
[rds_rules] :: RuleDecls name -> [LRuleDecl name]
-- | Rule Declaration
data RuleDecl name
-- |
HsRule :: (Located (SourceText, RuleName)) -> Activation -> [LRuleBndr name] -> (Located (HsExpr name)) -> (PostRn name NameSet) -> (Located (HsExpr name)) -> (PostRn name NameSet) -> RuleDecl name
-- | Located Rule Declaration
type LRuleDecl name = Located (RuleDecl name)
-- | Rule Binder
data RuleBndr name
RuleBndr :: (Located name) -> RuleBndr name
-- |
RuleBndrSig :: (Located name) -> (LHsSigWcType name) -> RuleBndr name
-- | Located Rule Binder
type LRuleBndr name = Located (RuleBndr name)
collectRuleBndrSigTys :: [RuleBndr name] -> [LHsSigWcType name]
flattenRuleDecls :: [LRuleDecls name] -> [LRuleDecl name]
pprFullRuleName :: Located (SourceText, RuleName) -> SDoc
-- | Vectorise Declaration
data VectDecl name
-- |
HsVect :: SourceText -> (Located name) -> (LHsExpr name) -> VectDecl name
-- |
HsNoVect :: SourceText -> (Located name) -> VectDecl name
-- |
HsVectTypeIn :: SourceText -> Bool -> (Located name) -> (Maybe (Located name)) -> VectDecl name
HsVectTypeOut :: Bool -> TyCon -> (Maybe TyCon) -> VectDecl name
-- |
HsVectClassIn :: SourceText -> (Located name) -> VectDecl name
HsVectClassOut :: Class -> VectDecl name
HsVectInstIn :: (LHsSigType name) -> VectDecl name
HsVectInstOut :: ClsInst -> VectDecl name
-- | Located Vectorise Declaration
type LVectDecl name = Located (VectDecl name)
lvectDeclName :: NamedThing name => LVectDecl name -> Name
lvectInstDecl :: LVectDecl name -> Bool
-- | Default Declaration
data DefaultDecl name
-- |
DefaultDecl :: [LHsType name] -> DefaultDecl name
-- | Located Default Declaration
type LDefaultDecl name = Located (DefaultDecl name)
data SpliceExplicitFlag
-- | = $(f x y)
ExplicitSplice :: SpliceExplicitFlag
-- | = f x y, i.e. a naked top level expression
ImplicitSplice :: SpliceExplicitFlag
-- | Splice Declaration
data SpliceDecl id
SpliceDecl :: (Located (HsSplice id)) -> SpliceExplicitFlag -> SpliceDecl id
-- | Located Splice Declaration
type LSpliceDecl name = Located (SpliceDecl name)
-- | Foreign Declaration
data ForeignDecl name
ForeignImport :: Located name -> LHsSigType name -> PostTc name Coercion -> ForeignImport -> ForeignDecl name
[fd_name] :: ForeignDecl name -> Located name
[fd_sig_ty] :: ForeignDecl name -> LHsSigType name
[fd_co] :: ForeignDecl name -> PostTc name Coercion
[fd_fi] :: ForeignDecl name -> ForeignImport
-- |
ForeignExport :: Located name -> LHsSigType name -> PostTc name Coercion -> ForeignExport -> ForeignDecl name
[fd_name] :: ForeignDecl name -> Located name
[fd_sig_ty] :: ForeignDecl name -> LHsSigType name
[fd_co] :: ForeignDecl name -> PostTc name Coercion
[fd_fe] :: ForeignDecl name -> ForeignExport
-- | Located Foreign Declaration
type LForeignDecl name = Located (ForeignDecl name)
data ForeignImport
CImport :: (Located CCallConv) -> (Located Safety) -> (Maybe Header) -> CImportSpec -> (Located SourceText) -> ForeignImport
data ForeignExport
CExport :: (Located CExportSpec) -> (Located SourceText) -> ForeignExport
noForeignImportCoercionYet :: PlaceHolder
noForeignExportCoercionYet :: PlaceHolder
data CImportSpec
CLabel :: CLabelString -> CImportSpec
CFunction :: CCallTarget -> CImportSpec
CWrapper :: CImportSpec
-- |
-- data T b = forall a. Eq a => MkT a b
-- MkT :: forall b a. Eq a => MkT a b
--
-- data T b where
-- MkT1 :: Int -> T Int
--
-- data T = Int MkT Int
-- | MkT2
--
-- data T a where
-- Int MkT Int :: T Int
--
--
--
--
-- data Constructor Declaration
data ConDecl name
ConDeclGADT :: [Located name] -> LHsSigType name -> Maybe LHsDocString -> ConDecl name
[con_names] :: ConDecl name -> [Located name]
-- | The type after the ‘::’
[con_type] :: ConDecl name -> LHsSigType name
-- | A possible Haddock comment.
[con_doc] :: ConDecl name -> Maybe LHsDocString
ConDeclH98 :: Located name -> Maybe (LHsQTyVars name) -> Maybe (LHsContext name) -> HsConDeclDetails name -> Maybe LHsDocString -> ConDecl name
[con_name] :: ConDecl name -> Located name
[con_qvars] :: ConDecl name -> Maybe (LHsQTyVars name)
-- | User-written context (if any)
[con_cxt] :: ConDecl name -> Maybe (LHsContext name)
-- | Arguments
[con_details] :: ConDecl name -> HsConDeclDetails name
-- | A possible Haddock comment.
[con_doc] :: ConDecl name -> Maybe LHsDocString
-- | Located data Constructor Declaration
type LConDecl name = Located (ConDecl name) May have 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnSemi' when in a GADT constructor list
-- | Haskell data Constructor Declaration Details
type HsConDeclDetails name = HsConDetails (LBangType name) (Located [LConDeclField name])
hsConDeclArgTys :: HsConDeclDetails name -> [LBangType name]
getConNames :: ConDecl name -> [Located name]
getConDetails :: ConDecl name -> HsConDeclDetails name
gadtDeclDetails :: LHsSigType name -> (HsConDeclDetails name, LHsType name, LHsContext name, [LHsTyVarBndr name])
-- | Documentation comment Declaration
data DocDecl
DocCommentNext :: HsDocString -> DocDecl
DocCommentPrev :: HsDocString -> DocDecl
DocCommentNamed :: String -> HsDocString -> DocDecl
DocGroup :: Int -> HsDocString -> DocDecl
-- | Located Documentation comment Declaration
type LDocDecl = Located (DocDecl)
docDeclDoc :: DocDecl -> HsDocString
-- | Warning pragma Declaration
data WarnDecl name
Warning :: [Located name] -> WarningTxt -> WarnDecl name
-- | Located Warning pragma Declaration
type LWarnDecl name = Located (WarnDecl name)
-- | Warning pragma Declarations
data WarnDecls name
Warnings :: SourceText -> [LWarnDecl name] -> WarnDecls name
[wd_src] :: WarnDecls name -> SourceText
[wd_warnings] :: WarnDecls name -> [LWarnDecl name]
-- | Located Warning Declarations
type LWarnDecls name = Located (WarnDecls name)
-- | Annotation Declaration
data AnnDecl name
-- |
HsAnnotation :: SourceText -> (AnnProvenance name) -> (Located (HsExpr name)) -> AnnDecl name
-- | Located Annotation Declaration
type LAnnDecl name = Located (AnnDecl name)
-- | Annotation Provenance
data AnnProvenance name
ValueAnnProvenance :: (Located name) -> AnnProvenance name
TypeAnnProvenance :: (Located name) -> AnnProvenance name
ModuleAnnProvenance :: AnnProvenance name
annProvenanceName_maybe :: AnnProvenance name -> Maybe name
-- | Role Annotation Declaration
data RoleAnnotDecl name
-- |
RoleAnnotDecl :: (Located name) -> [Located (Maybe Role)] -> RoleAnnotDecl name
-- | Located Role Annotation Declaration
type LRoleAnnotDecl name = Located (RoleAnnotDecl name)
roleAnnotDeclName :: RoleAnnotDecl name -> name
-- | type Family Result Signature
data FamilyResultSig name
-- |
NoSig :: FamilyResultSig name
-- |
KindSig :: (LHsKind name) -> FamilyResultSig name
-- |
TyVarSig :: (LHsTyVarBndr name) -> FamilyResultSig name
-- | Located type Family Result Signature
type LFamilyResultSig name = Located (FamilyResultSig name)
-- | If the user supplied an injectivity annotation it is represented using
-- InjectivityAnn. At the moment this is a single injectivity condition -
-- see Note [Injectivity annotation]. `Located name` stores the LHS of
-- injectivity condition. `[Located name]` stores the RHS of injectivity
-- condition. Example:
--
-- type family Foo a b c = r | r -> a c where ...
--
-- This will be represented as "InjectivityAnn r [a,
-- c]"
data InjectivityAnn name
-- |
InjectivityAnn :: (Located name) -> [Located name] -> InjectivityAnn name
-- | Located Injectivity Annotation
type LInjectivityAnn name = Located (InjectivityAnn name)
-- | Maybe return name of the result type variable
resultVariableName :: FamilyResultSig a -> Maybe a
-- | Haskell Group
--
-- A HsDecl is categorised into a HsGroup before being fed
-- to the renamer.
data HsGroup id
HsGroup :: HsValBinds id -> [LSpliceDecl id] -> [TyClGroup id] -> [LDerivDecl id] -> [LFixitySig id] -> [LDefaultDecl id] -> [LForeignDecl id] -> [LWarnDecls id] -> [LAnnDecl id] -> [LRuleDecls id] -> [LVectDecl id] -> [LDocDecl] -> HsGroup id
[hs_valds] :: HsGroup id -> HsValBinds id
[hs_splcds] :: HsGroup id -> [LSpliceDecl id]
[hs_tyclds] :: HsGroup id -> [TyClGroup id]
[hs_derivds] :: HsGroup id -> [LDerivDecl id]
[hs_fixds] :: HsGroup id -> [LFixitySig id]
[hs_defds] :: HsGroup id -> [LDefaultDecl id]
[hs_fords] :: HsGroup id -> [LForeignDecl id]
[hs_warnds] :: HsGroup id -> [LWarnDecls id]
[hs_annds] :: HsGroup id -> [LAnnDecl id]
[hs_ruleds] :: HsGroup id -> [LRuleDecls id]
[hs_vects] :: HsGroup id -> [LVectDecl id]
[hs_docs] :: HsGroup id -> [LDocDecl]
emptyRdrGroup :: HsGroup a
emptyRnGroup :: HsGroup a
appendGroups :: HsGroup a -> HsGroup a -> HsGroup a
hsGroupInstDecls :: HsGroup id -> [LInstDecl id]
instance Data.Data.Data name => Data.Data.Data (HsDecls.RoleAnnotDecl name)
instance GHC.Base.Functor HsDecls.AnnProvenance
instance Data.Data.Data name => Data.Data.Data (HsDecls.AnnProvenance name)
instance Data.Data.Data name => Data.Data.Data (HsDecls.WarnDecls name)
instance Data.Data.Data name => Data.Data.Data (HsDecls.WarnDecl name)
instance Data.Data.Data HsDecls.DocDecl
instance Data.Data.Data HsDecls.ForeignExport
instance Data.Data.Data HsDecls.ForeignImport
instance Data.Data.Data HsDecls.CImportSpec
instance Data.Data.Data HsDecls.NewOrData
instance GHC.Classes.Eq HsDecls.NewOrData
instance Data.Data.Data name => Data.Data.Data (HsDecls.InjectivityAnn name)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.HsDecl id)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.HsGroup id)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.SpliceDecl id)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.TyClDecl id)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.TyClGroup id)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.FamilyResultSig name)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.FamilyDecl id)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.FamilyInfo name)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.HsDataDefn id)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.HsDerivingClause id)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.ConDecl name)
instance (PlaceHolder.DataId name, Data.Data.Data pats) => Data.Data.Data (HsDecls.TyFamEqn name pats)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.TyFamInstDecl name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.DataFamInstDecl name)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.ClsInstDecl id)
instance PlaceHolder.DataId id => Data.Data.Data (HsDecls.InstDecl id)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.DerivDecl name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.DefaultDecl name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.ForeignDecl name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.RuleDecls name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.RuleDecl name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.RuleBndr name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.VectDecl name)
instance PlaceHolder.DataId name => Data.Data.Data (HsDecls.AnnDecl name)
instance Data.Foldable.Foldable HsDecls.AnnProvenance
instance Data.Traversable.Traversable HsDecls.AnnProvenance
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.HsDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.HsGroup name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.TyClGroup name)
instance Outputable.OutputableBndr name => Outputable.Outputable (HsDecls.RoleAnnotDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.AnnDecl name)
instance Outputable.OutputableBndr name => Outputable.Outputable (HsDecls.WarnDecls name)
instance Outputable.OutputableBndr name => Outputable.Outputable (HsDecls.WarnDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.TyClDecl name)
instance Outputable.Outputable HsDecls.DocDecl
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.VectDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.RuleDecls name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.RuleDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.RuleBndr name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.ForeignDecl name)
instance Outputable.Outputable HsDecls.ForeignExport
instance Outputable.Outputable HsDecls.ForeignImport
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.DefaultDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.DerivDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.InstDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.ClsInstDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.DataFamInstDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.TyFamInstDecl name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.FamilyDecl name)
instance Outputable.Outputable (HsDecls.FamilyInfo name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.HsDataDefn name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.ConDecl name)
instance Outputable.Outputable HsDecls.NewOrData
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.HsDerivingClause name)
instance PlaceHolder.OutputableBndrId name => Outputable.Outputable (HsDecls.SpliceDecl name)
-- | Abstract Haskell syntax for expressions.
module HsExpr
-- | Located Haskell Expression
type LHsExpr id = Located (HsExpr id) May have 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma' when in a list
-- | Post-Type checking Expression
--
-- PostTcExpr is an evidence expression attached to the syntax tree by
-- the type checker (c.f. postTcType).
type PostTcExpr = HsExpr Id
-- | Post-Type checking Table
--
-- We use a PostTcTable where there are a bunch of pieces of evidence,
-- more than is convenient to keep individually.
type PostTcTable = [(Name, PostTcExpr)]
noPostTcExpr :: PostTcExpr
noPostTcTable :: PostTcTable
-- | Syntax Expression
--
-- SyntaxExpr is like PostTcExpr, but it's filled in a little
-- earlier, by the renamer. It's used for rebindable syntax.
--
-- E.g. (>>=) is filled in before the renamer by the
-- appropriate Name for (>>=), and then
-- instantiated by the type checker with its type args etc
--
-- This should desugar to
--
--
-- syn_res_wrap $ syn_expr (syn_arg_wraps[0] arg0)
-- (syn_arg_wraps[1] arg1) ...
--
--
-- where the actual arguments come from elsewhere in the AST. This could
-- be defined using PostRn and PostTc and such, but
-- it's harder to get it all to work out that way. (noSyntaxExpr
-- is hard to write, for example.)
data SyntaxExpr id
SyntaxExpr :: HsExpr id -> [HsWrapper] -> HsWrapper -> SyntaxExpr id
[syn_expr] :: SyntaxExpr id -> HsExpr id
[syn_arg_wraps] :: SyntaxExpr id -> [HsWrapper]
[syn_res_wrap] :: SyntaxExpr id -> HsWrapper
-- | This is used for rebindable-syntax pieces that are too polymorphic for
-- tcSyntaxOp (trS_fmap and the mzip in ParStmt)
noExpr :: HsExpr id
noSyntaxExpr :: SyntaxExpr id
-- | Make a 'SyntaxExpr Name' (the "rn" is because this is used in the
-- renamer), missing its HsWrappers.
mkRnSyntaxExpr :: Name -> SyntaxExpr Name
-- | Command Syntax Table (for Arrow syntax)
type CmdSyntaxTable id = [(Name, HsExpr id)]
-- | An unbound variable; used for treating out-of-scope variables as
-- expression holes
data UnboundVar
-- | An (unqualified) out-of-scope variable, together with the GlobalRdrEnv
-- with respect to which it is unbound
OutOfScope :: OccName -> GlobalRdrEnv -> UnboundVar
-- | A "true" expression hole (_ or _x)
TrueExprHole :: OccName -> UnboundVar
unboundVarOcc :: UnboundVar -> OccName
-- | A Haskell expression.
data HsExpr id
-- | Variable
HsVar :: (Located id) -> HsExpr id
-- | Unbound variable; also used for "holes" (_ or _x). Turned from HsVar
-- to HsUnboundVar by the renamer, when it finds an out-of-scope variable
-- or hole. Turned into HsVar by type checker, to support deferred type
-- errors.
HsUnboundVar :: UnboundVar -> HsExpr id
-- | After typechecker only; must be different HsVar for pretty printing
HsConLikeOut :: ConLike -> HsExpr id
-- | Variable pointing to record selector Not in use after typechecking
HsRecFld :: (AmbiguousFieldOcc id) -> HsExpr id
-- | Overloaded label (Note [Overloaded labels] in GHC.OverloadedLabels)
-- Just id means RebindableSyntax is in use, and gives
-- the id of the in-scope fromLabel. NB: Not in use after
-- typechecking
HsOverLabel :: (Maybe id) -> FastString -> HsExpr id
-- | Implicit parameter (not in use after typechecking)
HsIPVar :: HsIPName -> HsExpr id
-- | Overloaded literals
HsOverLit :: (HsOverLit id) -> HsExpr id
-- | Simple (non-overloaded) literals
HsLit :: HsLit -> HsExpr id
-- | Lambda abstraction. Currently always a single match
--
--
HsLam :: (MatchGroup id (LHsExpr id)) -> HsExpr id
-- | Lambda-case
--
--
HsLamCase :: (MatchGroup id (LHsExpr id)) -> HsExpr id
-- | Application
HsApp :: (LHsExpr id) -> (LHsExpr id) -> HsExpr id
-- | Visible type application
--
-- Explicit type argument; e.g f @Int x y NB: Has wildcards, but no
-- implicit quantification
--
--
HsAppType :: (LHsExpr id) -> (LHsWcType id) -> HsExpr id
HsAppTypeOut :: (LHsExpr id) -> (LHsWcType Name) -> HsExpr id
-- | Operator applications: NB Bracketed ops such as (+) come out as Vars.
OpApp :: (LHsExpr id) -> (LHsExpr id) -> (PostRn id Fixity) -> (LHsExpr id) -> HsExpr id
-- | Negation operator. Contains the negated expression and the name of
-- negate
--
--
NegApp :: (LHsExpr id) -> (SyntaxExpr id) -> HsExpr id
-- | Parenthesised expr; see Note [Parens in HsSyn]
HsPar :: (LHsExpr id) -> HsExpr id
SectionL :: (LHsExpr id) -> (LHsExpr id) -> HsExpr id
SectionR :: (LHsExpr id) -> (LHsExpr id) -> HsExpr id
-- | Used for explicit tuples and sections thereof
--
--
ExplicitTuple :: [LHsTupArg id] -> Boxity -> HsExpr id
-- | Used for unboxed sum types
--
--
--
-- There will be multiple AnnVbar, (1 - alternative) before the
-- expression, (arity - alternative) after it
ExplicitSum :: ConTag -> Arity -> (LHsExpr id) -> (PostTc id [Type]) -> HsExpr id
-- |
HsCase :: (LHsExpr id) -> (MatchGroup id (LHsExpr id)) -> HsExpr id
-- |
HsIf :: (Maybe (SyntaxExpr id)) -> (LHsExpr id) -> (LHsExpr id) -> (LHsExpr id) -> HsExpr id
-- | Multi-way if
--
--
HsMultiIf :: (PostTc id Type) -> [LGRHS id (LHsExpr id)] -> HsExpr id
-- | let(rec)
--
--
HsLet :: (LHsLocalBinds id) -> (LHsExpr id) -> HsExpr id
-- |
HsDo :: (HsStmtContext Name) -> (Located [ExprLStmt id]) -> (PostTc id Type) -> HsExpr id
-- | Syntactic list: [a,b,c,...]
--
--
ExplicitList :: (PostTc id Type) -> (Maybe (SyntaxExpr id)) -> [LHsExpr id] -> HsExpr id
-- | Syntactic parallel array: [:e1, ..., en:]
--
--
ExplicitPArr :: (PostTc id Type) -> [LHsExpr id] -> HsExpr id
-- | Record construction
--
--
RecordCon :: Located id -> PostTc id ConLike -> PostTcExpr -> HsRecordBinds id -> HsExpr id
[rcon_con_name] :: HsExpr id -> Located id
[rcon_con_like] :: HsExpr id -> PostTc id ConLike
[rcon_con_expr] :: HsExpr id -> PostTcExpr
[rcon_flds] :: HsExpr id -> HsRecordBinds id
-- | Record update
--
--
RecordUpd :: LHsExpr id -> [LHsRecUpdField id] -> PostTc id [ConLike] -> PostTc id [Type] -> PostTc id [Type] -> PostTc id HsWrapper -> HsExpr id
[rupd_expr] :: HsExpr id -> LHsExpr id
[rupd_flds] :: HsExpr id -> [LHsRecUpdField id]
[rupd_cons] :: HsExpr id -> PostTc id [ConLike]
[rupd_in_tys] :: HsExpr id -> PostTc id [Type]
[rupd_out_tys] :: HsExpr id -> PostTc id [Type]
[rupd_wrap] :: HsExpr id -> PostTc id HsWrapper
-- | Expression with an explicit type signature. e :: type
--
--
ExprWithTySig :: (LHsExpr id) -> (LHsSigWcType id) -> HsExpr id
ExprWithTySigOut :: (LHsExpr id) -> (LHsSigWcType Name) -> HsExpr id
-- | Arithmetic sequence
--
--
ArithSeq :: PostTcExpr -> (Maybe (SyntaxExpr id)) -> (ArithSeqInfo id) -> HsExpr id
-- | Arithmetic sequence for parallel array
--
--
-- [:e1..e2:] or [:e1, e2..e3:]
--
--
--
PArrSeq :: PostTcExpr -> (ArithSeqInfo id) -> HsExpr id
-- |
HsSCC :: SourceText -> StringLiteral -> (LHsExpr id) -> HsExpr id
-- |
HsCoreAnn :: SourceText -> StringLiteral -> (LHsExpr id) -> HsExpr id
-- |
HsBracket :: (HsBracket id) -> HsExpr id
HsRnBracketOut :: (HsBracket Name) -> [PendingRnSplice] -> HsExpr id
HsTcBracketOut :: (HsBracket Name) -> [PendingTcSplice] -> HsExpr id
-- |
HsSpliceE :: (HsSplice id) -> HsExpr id
-- | proc notation for Arrows
--
--
HsProc :: (LPat id) -> (LHsCmdTop id) -> HsExpr id
-- |
HsStatic :: (PostRn id NameSet) -> (LHsExpr id) -> HsExpr id
-- |
HsArrApp :: (LHsExpr id) -> (LHsExpr id) -> (PostTc id Type) -> HsArrAppType -> Bool -> HsExpr id
-- |
HsArrForm :: (LHsExpr id) -> (Maybe Fixity) -> [LHsCmdTop id] -> HsExpr id
HsTick :: (Tickish id) -> (LHsExpr id) -> HsExpr id
HsBinTick :: Int -> Int -> (LHsExpr id) -> HsExpr id
-- |
-- - AnnKeywordId : AnnOpen, AnnOpen '{-#
-- GENERATED', AnnVal,AnnVal,
-- AnnColon,AnnVal, AnnMinus,
-- AnnVal,AnnColon, AnnVal, AnnClose
-- '#-}'
--
HsTickPragma :: SourceText -> (StringLiteral, (Int, Int), (Int, Int)) -> ((SourceText, SourceText), (SourceText, SourceText)) -> (LHsExpr id) -> HsExpr id
EWildPat :: HsExpr id
-- |
EAsPat :: (Located id) -> (LHsExpr id) -> HsExpr id
-- |
EViewPat :: (LHsExpr id) -> (LHsExpr id) -> HsExpr id
-- |
ELazyPat :: (LHsExpr id) -> HsExpr id
HsWrap :: HsWrapper -> (HsExpr id) -> HsExpr id
-- | Located Haskell Tuple Argument
--
-- HsTupArg is used for tuple sections (,a,) is
-- represented by ExplicitTuple [Missing ty1, Present a, Missing
-- ty3] Which in turn stands for (x:ty1 y:ty2. (x,a,y))
type LHsTupArg id = Located (HsTupArg id)
-- |
--
-- Haskell Tuple Argument
data HsTupArg id
-- | The argument
Present :: (LHsExpr id) -> HsTupArg id
-- | The argument is missing, but this is its type
Missing :: (PostTc id Type) -> HsTupArg id
tupArgPresent :: LHsTupArg id -> Bool
pprLExpr :: (OutputableBndrId id) => LHsExpr id -> SDoc
pprExpr :: (OutputableBndrId id) => HsExpr id -> SDoc
isQuietHsExpr :: HsExpr id -> Bool
pprBinds :: (OutputableBndrId idL, OutputableBndrId idR) => HsLocalBindsLR idL idR -> SDoc
ppr_lexpr :: (OutputableBndrId id) => LHsExpr id -> SDoc
ppr_expr :: forall id. (OutputableBndrId id) => HsExpr id -> SDoc
-- | Located Haskell Wildcard Type Expression
data LHsWcTypeX
LHsWcTypeX :: (LHsWcType id) -> LHsWcTypeX
ppr_apps :: (OutputableBndrId id) => HsExpr id -> [Either (LHsExpr id) LHsWcTypeX] -> SDoc
pprExternalSrcLoc :: (StringLiteral, (Int, Int), (Int, Int)) -> SDoc
pprDebugParendExpr :: (OutputableBndrId id) => LHsExpr id -> SDoc
pprParendLExpr :: (OutputableBndrId id) => LHsExpr id -> SDoc
pprParendExpr :: (OutputableBndrId id) => HsExpr id -> SDoc
hsExprNeedsParens :: HsExpr id -> Bool
isAtomicHsExpr :: HsExpr id -> Bool
-- | Located Haskell Command (for arrow syntax)
type LHsCmd id = Located (HsCmd id)
-- | Haskell Command (e.g. a "statement" in an Arrow proc block)
data HsCmd id
-- |
HsCmdArrApp :: (LHsExpr id) -> (LHsExpr id) -> (PostTc id Type) -> HsArrAppType -> Bool -> HsCmd id
-- |
HsCmdArrForm :: (LHsExpr id) -> LexicalFixity -> (Maybe Fixity) -> [LHsCmdTop id] -> HsCmd id
HsCmdApp :: (LHsCmd id) -> (LHsExpr id) -> HsCmd id
-- |
HsCmdLam :: (MatchGroup id (LHsCmd id)) -> HsCmd id
-- |
HsCmdPar :: (LHsCmd id) -> HsCmd id
-- |
HsCmdCase :: (LHsExpr id) -> (MatchGroup id (LHsCmd id)) -> HsCmd id
-- |
HsCmdIf :: (Maybe (SyntaxExpr id)) -> (LHsExpr id) -> (LHsCmd id) -> (LHsCmd id) -> HsCmd id
-- |
HsCmdLet :: (LHsLocalBinds id) -> (LHsCmd id) -> HsCmd id
-- |
HsCmdDo :: (Located [CmdLStmt id]) -> (PostTc id Type) -> HsCmd id
HsCmdWrap :: HsWrapper -> (HsCmd id) -> HsCmd id
-- | Haskell Array Application Type
data HsArrAppType
HsHigherOrderApp :: HsArrAppType
HsFirstOrderApp :: HsArrAppType
-- | Top-level command, introducing a new arrow. This may occur inside a
-- proc (where the stack is empty) or as an argument of a command-forming
-- operator.
--
-- Located Haskell Top-level Command
type LHsCmdTop id = Located (HsCmdTop id)
-- | Haskell Top-level Command
data HsCmdTop id
HsCmdTop :: (LHsCmd id) -> (PostTc id Type) -> (PostTc id Type) -> (CmdSyntaxTable id) -> HsCmdTop id
pprLCmd :: (OutputableBndrId id) => LHsCmd id -> SDoc
pprCmd :: (OutputableBndrId id) => HsCmd id -> SDoc
isQuietHsCmd :: HsCmd id -> Bool
ppr_lcmd :: (OutputableBndrId id) => LHsCmd id -> SDoc
ppr_cmd :: forall id. (OutputableBndrId id) => HsCmd id -> SDoc
pprCmdArg :: (OutputableBndrId id) => HsCmdTop id -> SDoc
-- | Haskell Record Bindings
type HsRecordBinds id = HsRecFields id (LHsExpr id)
data MatchGroup id body
MG :: Located [LMatch id body] -> [PostTc id Type] -> PostTc id Type -> Origin -> MatchGroup id body
[mg_alts] :: MatchGroup id body -> Located [LMatch id body]
[mg_arg_tys] :: MatchGroup id body -> [PostTc id Type]
[mg_res_ty] :: MatchGroup id body -> PostTc id Type
[mg_origin] :: MatchGroup id body -> Origin
-- | Located Match
--
-- May have AnnKeywordId : AnnSemi when in a list
type LMatch id body = Located (Match id body)
data Match id body
Match :: HsMatchContext (NameOrRdrName id) -> [LPat id] -> (Maybe (LHsType id)) -> (GRHSs id body) -> Match id body
[m_ctxt] :: Match id body -> HsMatchContext (NameOrRdrName id)
[m_pats] :: Match id body -> [LPat id]
[m_type] :: Match id body -> (Maybe (LHsType id))
[m_grhss] :: Match id body -> (GRHSs id body)
isInfixMatch :: Match id body -> Bool
isEmptyMatchGroup :: MatchGroup id body -> Bool
-- | Is there only one RHS in this list of matches?
isSingletonMatchGroup :: [LMatch id body] -> Bool
matchGroupArity :: MatchGroup id body -> Arity
hsLMatchPats :: LMatch id body -> [LPat id]
-- | Guarded Right-Hand Sides
--
-- GRHSs are used both for pattern bindings and for Matches
--
--
data GRHSs id body
GRHSs :: [LGRHS id body] -> LHsLocalBinds id -> GRHSs id body
-- | Guarded RHSs
[grhssGRHSs] :: GRHSs id body -> [LGRHS id body]
-- | The where clause
[grhssLocalBinds] :: GRHSs id body -> LHsLocalBinds id
-- | Located Guarded Right-Hand Side
type LGRHS id body = Located (GRHS id body)
-- | Guarded Right Hand Side.
data GRHS id body
GRHS :: [GuardLStmt id] -> body -> GRHS id body
pprMatches :: (OutputableBndrId idR, Outputable body) => MatchGroup idR body -> SDoc
pprFunBind :: (OutputableBndrId idR, Outputable body) => MatchGroup idR body -> SDoc
pprPatBind :: forall bndr id body. (OutputableBndrId bndr, OutputableBndrId id, Outputable body) => LPat bndr -> GRHSs id body -> SDoc
pprMatch :: (OutputableBndrId idR, Outputable body) => Match idR body -> SDoc
pprGRHSs :: (OutputableBndrId idR, Outputable body) => HsMatchContext idL -> GRHSs idR body -> SDoc
pprGRHS :: (OutputableBndrId idR, Outputable body) => HsMatchContext idL -> GRHS idR body -> SDoc
pp_rhs :: Outputable body => HsMatchContext idL -> body -> SDoc
-- | Located do block Statement
type LStmt id body = Located (StmtLR id id body)
-- | Located Statement with separate Left and Right id's
type LStmtLR idL idR body = Located (StmtLR idL idR body)
-- | do block Statement
type Stmt id body = StmtLR id id body
-- | Command Located Statement
type CmdLStmt id = LStmt id (LHsCmd id)
-- | Command Statement
type CmdStmt id = Stmt id (LHsCmd id)
-- | Expression Located Statement
type ExprLStmt id = LStmt id (LHsExpr id)
-- | Expression Statement
type ExprStmt id = Stmt id (LHsExpr id)
-- | Guard Located Statement
type GuardLStmt id = LStmt id (LHsExpr id)
-- | Guard Statement
type GuardStmt id = Stmt id (LHsExpr id)
-- | Ghci Located Statemnt
type GhciLStmt id = LStmt id (LHsExpr id)
-- | Ghci Statement
type GhciStmt id = Stmt id (LHsExpr id)
-- | API Annotations when in qualifier lists or guards -
-- AnnKeywordId : AnnVbar, AnnComma,AnnThen,
-- AnnBy,AnnBy, AnnGroup,AnnUsing
data StmtLR idL idR body
LastStmt :: body -> Bool -> (SyntaxExpr idR) -> StmtLR idL idR body
BindStmt :: (LPat idL) -> body -> (SyntaxExpr idR) -> (SyntaxExpr idR) -> (PostTc idR Type) -> StmtLR idL idR body
-- | ApplicativeStmt represents an applicative expression built with
-- $ and *. It is generated by the renamer, and is
-- desugared into the appropriate applicative expression by the
-- desugarer, but it is intended to be invisible in error messages.
--
-- For full details, see Note [ApplicativeDo] in RnExpr
ApplicativeStmt :: [(SyntaxExpr idR, ApplicativeArg idL idR)] -> (Maybe (SyntaxExpr idR)) -> (PostTc idR Type) -> StmtLR idL idR body
BodyStmt :: body -> (SyntaxExpr idR) -> (SyntaxExpr idR) -> (PostTc idR Type) -> StmtLR idL idR body
-- |
LetStmt :: (LHsLocalBindsLR idL idR) -> StmtLR idL idR body
ParStmt :: [ParStmtBlock idL idR] -> (HsExpr idR) -> (SyntaxExpr idR) -> (PostTc idR Type) -> StmtLR idL idR body
TransStmt :: TransForm -> [ExprLStmt idL] -> [(idR, idR)] -> LHsExpr idR -> Maybe (LHsExpr idR) -> SyntaxExpr idR -> SyntaxExpr idR -> PostTc idR Type -> HsExpr idR -> StmtLR idL idR body
[trS_form] :: StmtLR idL idR body -> TransForm
[trS_stmts] :: StmtLR idL idR body -> [ExprLStmt idL]
[trS_bndrs] :: StmtLR idL idR body -> [(idR, idR)]
[trS_using] :: StmtLR idL idR body -> LHsExpr idR
[trS_by] :: StmtLR idL idR body -> Maybe (LHsExpr idR)
[trS_ret] :: StmtLR idL idR body -> SyntaxExpr idR
[trS_bind] :: StmtLR idL idR body -> SyntaxExpr idR
[trS_bind_arg_ty] :: StmtLR idL idR body -> PostTc idR Type
[trS_fmap] :: StmtLR idL idR body -> HsExpr idR
-- |
RecStmt :: [LStmtLR idL idR body] -> [idR] -> [idR] -> SyntaxExpr idR -> SyntaxExpr idR -> SyntaxExpr idR -> PostTc idR Type -> [PostTcExpr] -> [PostTcExpr] -> PostTc idR Type -> StmtLR idL idR body
[recS_stmts] :: StmtLR idL idR body -> [LStmtLR idL idR body]
[recS_later_ids] :: StmtLR idL idR body -> [idR]
[recS_rec_ids] :: StmtLR idL idR body -> [idR]
[recS_bind_fn] :: StmtLR idL idR body -> SyntaxExpr idR
[recS_ret_fn] :: StmtLR idL idR body -> SyntaxExpr idR
[recS_mfix_fn] :: StmtLR idL idR body -> SyntaxExpr idR
[recS_bind_ty] :: StmtLR idL idR body -> PostTc idR Type
[recS_later_rets] :: StmtLR idL idR body -> [PostTcExpr]
[recS_rec_rets] :: StmtLR idL idR body -> [PostTcExpr]
[recS_ret_ty] :: StmtLR idL idR body -> PostTc idR Type
data TransForm
ThenForm :: TransForm
GroupForm :: TransForm
-- | Parenthesised Statement Block
data ParStmtBlock idL idR
ParStmtBlock :: [ExprLStmt idL] -> [idR] -> (SyntaxExpr idR) -> ParStmtBlock idL idR
-- | Applicative Argument
data ApplicativeArg idL idR
ApplicativeArgOne :: (LPat idL) -> (LHsExpr idL) -> ApplicativeArg idL idR
ApplicativeArgMany :: [ExprLStmt idL] -> (HsExpr idL) -> (LPat idL) -> ApplicativeArg idL idR
pprStmt :: forall idL idR body. (OutputableBndrId idL, OutputableBndrId idR, Outputable body) => (StmtLR idL idR body) -> SDoc
pprTransformStmt :: (OutputableBndrId id) => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDoc
pprTransStmt :: Outputable body => Maybe body -> body -> TransForm -> SDoc
pprBy :: Outputable body => Maybe body -> SDoc
pprDo :: (OutputableBndrId id, Outputable body) => HsStmtContext any -> [LStmt id body] -> SDoc
ppr_do_stmts :: (OutputableBndrId idL, OutputableBndrId idR, Outputable body) => [LStmtLR idL idR body] -> SDoc
pprComp :: (OutputableBndrId id, Outputable body) => [LStmt id body] -> SDoc
pprQuals :: (OutputableBndrId id, Outputable body) => [LStmt id body] -> SDoc
-- | Haskell Splice
data HsSplice id
HsTypedSplice :: SpliceDecoration -> id -> (LHsExpr id) -> HsSplice id
HsUntypedSplice :: SpliceDecoration -> id -> (LHsExpr id) -> HsSplice id
HsQuasiQuote :: id -> id -> SrcSpan -> FastString -> HsSplice id
HsSpliced :: ThModFinalizers -> (HsSplicedThing id) -> HsSplice id
-- | A splice can appear with various decorations wrapped around it. This
-- data type captures explicitly how it was originally written, for use
-- in the pretty printer.
data SpliceDecoration
-- | $( splice ) or $$( splice )
HasParens :: SpliceDecoration
-- | $splice or $$splice
HasDollar :: SpliceDecoration
-- | bare splice
NoParens :: SpliceDecoration
isTypedSplice :: HsSplice id -> Bool
-- | Finalizers produced by a splice with addModFinalizer
--
-- See Note [Delaying modFinalizers in untyped splices] in RnSplice. For
-- how this is used.
newtype ThModFinalizers
ThModFinalizers :: [ForeignRef (Q ())] -> ThModFinalizers
-- | Haskell Spliced Thing
--
-- Values that can result from running a splice.
data HsSplicedThing id
-- | Haskell Spliced Expression
HsSplicedExpr :: (HsExpr id) -> HsSplicedThing id
-- | Haskell Spliced Type
HsSplicedTy :: (HsType id) -> HsSplicedThing id
-- | Haskell Spliced Pattern
HsSplicedPat :: (Pat id) -> HsSplicedThing id
type SplicePointName = Name
-- | Pending Renamer Splice
data PendingRnSplice
PendingRnSplice :: UntypedSpliceFlavour -> SplicePointName -> (LHsExpr Name) -> PendingRnSplice
data UntypedSpliceFlavour
UntypedExpSplice :: UntypedSpliceFlavour
UntypedPatSplice :: UntypedSpliceFlavour
UntypedTypeSplice :: UntypedSpliceFlavour
UntypedDeclSplice :: UntypedSpliceFlavour
-- | Pending Type-checker Splice
data PendingTcSplice
PendingTcSplice :: SplicePointName -> (LHsExpr Id) -> PendingTcSplice
pprPendingSplice :: (OutputableBndrId id) => SplicePointName -> LHsExpr id -> SDoc
pprSpliceDecl :: (OutputableBndrId id) => HsSplice id -> SpliceExplicitFlag -> SDoc
ppr_splice_decl :: (OutputableBndrId id) => HsSplice id -> SDoc
pprSplice :: (OutputableBndrId id) => HsSplice id -> SDoc
ppr_quasi :: OutputableBndr id => id -> id -> FastString -> SDoc
ppr_splice :: (OutputableBndrId id) => SDoc -> id -> LHsExpr id -> SDoc -> SDoc
-- | Haskell Bracket
data HsBracket id
ExpBr :: (LHsExpr id) -> HsBracket id
PatBr :: (LPat id) -> HsBracket id
DecBrL :: [LHsDecl id] -> HsBracket id
DecBrG :: (HsGroup id) -> HsBracket id
TypBr :: (LHsType id) -> HsBracket id
VarBr :: Bool -> id -> HsBracket id
TExpBr :: (LHsExpr id) -> HsBracket id
isTypedBracket :: HsBracket id -> Bool
pprHsBracket :: (OutputableBndrId id) => HsBracket id -> SDoc
thBrackets :: SDoc -> SDoc -> SDoc
thTyBrackets :: SDoc -> SDoc
-- | Arithmetic Sequence Information
data ArithSeqInfo id
From :: (LHsExpr id) -> ArithSeqInfo id
FromThen :: (LHsExpr id) -> (LHsExpr id) -> ArithSeqInfo id
FromTo :: (LHsExpr id) -> (LHsExpr id) -> ArithSeqInfo id
FromThenTo :: (LHsExpr id) -> (LHsExpr id) -> (LHsExpr id) -> ArithSeqInfo id
pp_dotdot :: SDoc
-- | Haskell Match Context
--
-- Context of a pattern match. This is more subtle than it would seem.
-- See Note [Varieties of pattern matches].
data HsMatchContext id
-- | A pattern matching on an argument of a function binding
FunRhs :: Located id -> LexicalFixity -> SrcStrictness -> HsMatchContext id
-- | function binder of f
[mc_fun] :: HsMatchContext id -> Located id
-- | fixing of f
[mc_fixity] :: HsMatchContext id -> LexicalFixity
-- | was the pattern banged? See Note [Varieties of binding pattern
-- matches]
[mc_strictness] :: HsMatchContext id -> SrcStrictness
-- | Patterns of a lambda
LambdaExpr :: HsMatchContext id
-- | Patterns and guards on a case alternative
CaseAlt :: HsMatchContext id
-- | Guards of a multi-way if alternative
IfAlt :: HsMatchContext id
-- | Patterns of a proc
ProcExpr :: HsMatchContext id
-- | A pattern binding eg [y] <- e = e
PatBindRhs :: HsMatchContext id
-- | Record update [used only in DsExpr to tell matchWrapper what sort of
-- runtime error message to generate]
RecUpd :: HsMatchContext id
-- | Pattern of a do-stmt, list comprehension, pattern guard, etc
StmtCtxt :: (HsStmtContext id) -> HsMatchContext id
-- | A Template Haskell pattern splice
ThPatSplice :: HsMatchContext id
-- | A Template Haskell pattern quotation [p| (a,b) |]
ThPatQuote :: HsMatchContext id
-- | A pattern synonym declaration
PatSyn :: HsMatchContext id
isPatSynCtxt :: HsMatchContext id -> Bool
-- | Haskell Statement Context
data HsStmtContext id
ListComp :: HsStmtContext id
MonadComp :: HsStmtContext id
-- | Parallel array comprehension
PArrComp :: HsStmtContext id
-- | do { ... }
DoExpr :: HsStmtContext id
-- | mdo { ... } ie recursive do-expression
MDoExpr :: HsStmtContext id
-- | do-notation in an arrow-command context
ArrowExpr :: HsStmtContext id
-- | A command-line Stmt in GHCi pat <- rhs
GhciStmtCtxt :: HsStmtContext id
-- | Pattern guard for specified thing
PatGuard :: (HsMatchContext id) -> HsStmtContext id
-- | A branch of a parallel stmt
ParStmtCtxt :: (HsStmtContext id) -> HsStmtContext id
-- | A branch of a transform stmt
TransStmtCtxt :: (HsStmtContext id) -> HsStmtContext id
isListCompExpr :: HsStmtContext id -> Bool
isMonadCompExpr :: HsStmtContext id -> Bool
-- | Should pattern match failure in a HsStmtContext be desugared
-- using MonadFail?
isMonadFailStmtContext :: HsStmtContext id -> Bool
matchSeparator :: HsMatchContext id -> SDoc
pprMatchContext :: (Outputable (NameOrRdrName id), Outputable id) => HsMatchContext id -> SDoc
pprMatchContextNoun :: (Outputable (NameOrRdrName id), Outputable id) => HsMatchContext id -> SDoc
pprAStmtContext :: (Outputable id, Outputable (NameOrRdrName id)) => HsStmtContext id -> SDoc
pprStmtContext :: (Outputable id, Outputable (NameOrRdrName id)) => HsStmtContext id -> SDoc
matchContextErrString :: Outputable id => HsMatchContext id -> SDoc
pprMatchInCtxt :: (OutputableBndrId idR, Outputable (NameOrRdrName (NameOrRdrName idR)), Outputable body) => Match idR body -> SDoc
pprStmtInCtxt :: (OutputableBndrId idL, OutputableBndrId idR, Outputable body) => HsStmtContext idL -> StmtLR idL idR body -> SDoc
instance Data.Data.Data HsExpr.UnboundVar
instance Data.Data.Data HsExpr.PendingRnSplice
instance Data.Data.Data HsExpr.PendingTcSplice
instance GHC.Base.Functor HsExpr.HsMatchContext
instance GHC.Base.Functor HsExpr.HsStmtContext
instance Data.Data.Data HsExpr.UntypedSpliceFlavour
instance GHC.Show.Show HsExpr.SpliceDecoration
instance GHC.Classes.Eq HsExpr.SpliceDecoration
instance Data.Data.Data HsExpr.SpliceDecoration
instance Data.Data.Data HsExpr.TransForm
instance Data.Data.Data HsExpr.HsArrAppType
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.SyntaxExpr id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsExpr id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsTupArg id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsCmd id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsCmdTop id)
instance (Data.Data.Data body, PlaceHolder.DataId id) => Data.Data.Data (HsExpr.MatchGroup id body)
instance (Data.Data.Data body, PlaceHolder.DataId id) => Data.Data.Data (HsExpr.Match id body)
instance (Data.Data.Data body, PlaceHolder.DataId id) => Data.Data.Data (HsExpr.GRHSs id body)
instance (Data.Data.Data body, PlaceHolder.DataId id) => Data.Data.Data (HsExpr.GRHS id body)
instance (Data.Data.Data body, PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsExpr.StmtLR idL idR body)
instance (PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsExpr.ParStmtBlock idL idR)
instance (PlaceHolder.DataId idL, PlaceHolder.DataId idR) => Data.Data.Data (HsExpr.ApplicativeArg idL idR)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsSplice id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsSplicedThing id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.HsBracket id)
instance PlaceHolder.DataId id => Data.Data.Data (HsExpr.ArithSeqInfo id)
instance PlaceHolder.DataIdPost id => Data.Data.Data (HsExpr.HsMatchContext id)
instance PlaceHolder.DataIdPost id => Data.Data.Data (HsExpr.HsStmtContext id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.SyntaxExpr id)
instance Outputable.Outputable HsExpr.UnboundVar
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.HsExpr id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.HsCmd id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.HsCmdTop id)
instance (PlaceHolder.OutputableBndrId idR, Outputable.Outputable body) => Outputable.Outputable (HsExpr.Match idR body)
instance PlaceHolder.OutputableBndrId idL => Outputable.Outputable (HsExpr.ParStmtBlock idL idR)
instance (PlaceHolder.OutputableBndrId idL, PlaceHolder.OutputableBndrId idR, Outputable.Outputable body) => Outputable.Outputable (HsExpr.StmtLR idL idR body)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.HsSplicedThing id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.HsSplice id)
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.HsBracket id)
instance Outputable.Outputable HsExpr.PendingRnSplice
instance Outputable.Outputable HsExpr.PendingTcSplice
instance PlaceHolder.OutputableBndrId id => Outputable.Outputable (HsExpr.ArithSeqInfo id)
instance Outputable.OutputableBndr id => Outputable.Outputable (HsExpr.HsMatchContext id)
instance (Outputable.Outputable id, Outputable.Outputable (PlaceHolder.NameOrRdrName id)) => Outputable.Outputable (HsExpr.HsStmtContext id)
instance Data.Data.Data HsExpr.ThModFinalizers
instance Outputable.Outputable HsExpr.SpliceDecoration
module HsUtils
mkHsPar :: LHsExpr id -> LHsExpr id
mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name
mkHsAppType :: LHsExpr name -> LHsWcType name -> LHsExpr name
mkHsAppTypeOut :: LHsExpr Id -> LHsWcType Name -> LHsExpr Id
-- | A simple case alternative with a single pattern, no binds, no guards;
-- pre-typechecking
mkHsCaseAlt :: LPat id -> (Located (body id)) -> LMatch id (Located (body id))
mkSimpleMatch :: HsMatchContext (NameOrRdrName id) -> [LPat id] -> Located (body id) -> LMatch id (Located (body id))
unguardedGRHSs :: Located (body id) -> GRHSs id (Located (body id))
unguardedRHS :: SrcSpan -> Located (body id) -> [LGRHS id (Located (body id))]
mkMatchGroup :: (PostTc name Type ~ PlaceHolder) => Origin -> [LMatch name (Located (body name))] -> MatchGroup name (Located (body name))
mkMatch :: HsMatchContext (NameOrRdrName id) -> [LPat id] -> LHsExpr id -> Located (HsLocalBinds id) -> LMatch id (LHsExpr id)
-- | Make a prefix, non-strict function HsMatchContext
mkPrefixFunRhs :: Located id -> HsMatchContext id
mkHsLam :: [LPat RdrName] -> LHsExpr RdrName -> LHsExpr RdrName
mkHsIf :: LHsExpr id -> LHsExpr id -> LHsExpr id -> HsExpr id
mkHsWrap :: HsWrapper -> HsExpr id -> HsExpr id
mkLHsWrap :: HsWrapper -> LHsExpr id -> LHsExpr id
mkHsWrapCo :: TcCoercionN -> HsExpr id -> HsExpr id
mkHsWrapCoR :: TcCoercionR -> HsExpr id -> HsExpr id
mkLHsWrapCo :: TcCoercionN -> LHsExpr id -> LHsExpr id
mkHsDictLet :: TcEvBinds -> LHsExpr Id -> LHsExpr Id
mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr Id -> LHsExpr Id
mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id
mkHsDo :: HsStmtContext Name -> [ExprLStmt RdrName] -> HsExpr RdrName
mkHsComp :: HsStmtContext Name -> [ExprLStmt RdrName] -> LHsExpr RdrName -> HsExpr RdrName
mkHsWrapPat :: HsWrapper -> Pat id -> Type -> Pat id
mkHsWrapPatCo :: TcCoercionN -> Pat id -> Type -> Pat id
mkLHsPar :: LHsExpr name -> LHsExpr name
mkHsCmdWrap :: HsWrapper -> HsCmd id -> HsCmd id
mkLHsCmdWrap :: HsWrapper -> LHsCmd id -> LHsCmd id
nlHsTyApp :: name -> [Type] -> LHsExpr name
nlHsTyApps :: name -> [Type] -> [LHsExpr name] -> LHsExpr name
nlHsVar :: id -> LHsExpr id
nlHsDataCon :: DataCon -> LHsExpr Id
nlHsLit :: HsLit -> LHsExpr id
nlHsApp :: LHsExpr id -> LHsExpr id -> LHsExpr id
nlHsApps :: id -> [LHsExpr id] -> LHsExpr id
nlHsSyntaxApps :: SyntaxExpr id -> [LHsExpr id] -> LHsExpr id
nlHsIntLit :: Integer -> LHsExpr id
nlHsVarApps :: id -> [id] -> LHsExpr id
nlHsDo :: HsStmtContext Name -> [LStmt RdrName (LHsExpr RdrName)] -> LHsExpr RdrName
nlHsOpApp :: LHsExpr id -> id -> LHsExpr id -> LHsExpr id
nlHsLam :: LMatch RdrName (LHsExpr RdrName) -> LHsExpr RdrName
nlHsPar :: LHsExpr id -> LHsExpr id
nlHsIf :: LHsExpr id -> LHsExpr id -> LHsExpr id -> LHsExpr id
nlHsCase :: LHsExpr RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> LHsExpr RdrName
nlList :: [LHsExpr RdrName] -> LHsExpr RdrName
mkLHsTupleExpr :: [LHsExpr a] -> LHsExpr a
mkLHsVarTuple :: [a] -> LHsExpr a
missingTupArg :: HsTupArg RdrName
-- | Converting a Type to an HsType RdrName This is needed to implement
-- GeneralizedNewtypeDeriving.
--
-- Note that we use getRdrName extensively, which generates Exact
-- RdrNames rather than strings.
typeToLHsType :: Type -> LHsType RdrName
-- | Lifts a "small" constructor into a "big" constructor by recursive
-- decompositon
mkChunkified :: ([a] -> a) -> [a] -> a
-- | Split a list into lists that are small enough to have a corresponding
-- tuple arity. The sub-lists of the result all have length <=
-- mAX_TUPLE_SIZE But there may be more than mAX_TUPLE_SIZE
-- sub-lists
chunkify :: [a] -> [[a]]
mkFunBind :: Located RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> HsBind RdrName
mkVarBind :: id -> LHsExpr id -> LHsBind id
mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr RdrName -> LHsBind RdrName
mk_easy_FunBind :: SrcSpan -> RdrName -> [LPat RdrName] -> LHsExpr RdrName -> LHsBind RdrName
mkTopFunBind :: Origin -> Located Name -> [LMatch Name (LHsExpr Name)] -> HsBind Name
mkPatSynBind :: Located RdrName -> HsPatSynDetails (Located RdrName) -> LPat RdrName -> HsPatSynDir RdrName -> HsBind RdrName
-- | If any of the matches in the FunBind are infix, the
-- FunBind is considered infix.
isInfixFunBind :: HsBindLR id1 id2 -> Bool
mkHsIntegral :: SourceText -> Integer -> PostTc RdrName Type -> HsOverLit RdrName
mkHsFractional :: FractionalLit -> PostTc RdrName Type -> HsOverLit RdrName
mkHsIsString :: SourceText -> FastString -> PostTc RdrName Type -> HsOverLit RdrName
mkHsString :: String -> HsLit
mkHsStringPrimLit :: FastString -> HsLit
mkNPat :: Located (HsOverLit RdrName) -> Maybe (SyntaxExpr RdrName) -> Pat RdrName
mkNPlusKPat :: Located RdrName -> Located (HsOverLit RdrName) -> Pat RdrName
nlVarPat :: id -> LPat id
nlLitPat :: HsLit -> LPat id
nlConVarPat :: RdrName -> [RdrName] -> LPat RdrName
nlConVarPatName :: Name -> [Name] -> LPat Name
nlConPat :: RdrName -> [LPat RdrName] -> LPat RdrName
nlConPatName :: Name -> [LPat Name] -> LPat Name
nlInfixConPat :: id -> LPat id -> LPat id -> LPat id
nlNullaryConPat :: id -> LPat id
nlWildConPat :: DataCon -> LPat RdrName
nlWildPat :: LPat RdrName
nlWildPatName :: LPat Name
nlWildPatId :: LPat Id
nlTuplePat :: [LPat id] -> Boxity -> LPat id
mkParPat :: LPat name -> LPat name
nlParPat :: LPat name -> LPat name
mkBigLHsVarTup :: [id] -> LHsExpr id
mkBigLHsTup :: [LHsExpr id] -> LHsExpr id
mkBigLHsVarPatTup :: [id] -> LPat id
mkBigLHsPatTup :: [LPat id] -> LPat id
mkHsAppTy :: LHsType name -> LHsType name -> LHsType name
mkHsAppTys :: LHsType name -> [LHsType name] -> LHsType name
userHsTyVarBndrs :: SrcSpan -> [name] -> [LHsTyVarBndr name]
userHsLTyVarBndrs :: SrcSpan -> [Located name] -> [LHsTyVarBndr name]
mkLHsSigType :: LHsType RdrName -> LHsSigType RdrName
mkLHsSigWcType :: LHsType RdrName -> LHsSigWcType RdrName
mkClassOpSigs :: [LSig RdrName] -> [LSig RdrName]
mkHsSigEnv :: forall a. (LSig Name -> Maybe ([Located Name], a)) -> [LSig Name] -> NameEnv a
nlHsAppTy :: LHsType name -> LHsType name -> LHsType name
nlHsTyVar :: name -> LHsType name
nlHsFunTy :: LHsType name -> LHsType name -> LHsType name
nlHsParTy :: LHsType name -> LHsType name
nlHsTyConApp :: name -> [LHsType name] -> LHsType name
mkTransformStmt :: (PostTc idR Type ~ PlaceHolder) => [ExprLStmt idL] -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
mkTransformByStmt :: (PostTc idR Type ~ PlaceHolder) => [ExprLStmt idL] -> LHsExpr idR -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
mkBodyStmt :: Located (bodyR RdrName) -> StmtLR idL RdrName (Located (bodyR RdrName))
mkBindStmt :: (PostTc idR Type ~ PlaceHolder) => LPat idL -> Located (bodyR idR) -> StmtLR idL idR (Located (bodyR idR))
mkTcBindStmt :: LPat Id -> Located (bodyR Id) -> StmtLR Id Id (Located (bodyR Id))
mkLastStmt :: Located (bodyR idR) -> StmtLR idL idR (Located (bodyR idR))
emptyTransStmt :: (PostTc idR Type ~ PlaceHolder) => StmtLR idL idR (LHsExpr idR)
mkGroupUsingStmt :: (PostTc idR Type ~ PlaceHolder) => [ExprLStmt idL] -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
mkGroupByUsingStmt :: (PostTc idR Type ~ PlaceHolder) => [ExprLStmt idL] -> LHsExpr idR -> LHsExpr idR -> StmtLR idL idR (LHsExpr idL)
emptyRecStmt :: StmtLR idL RdrName bodyR
emptyRecStmtName :: StmtLR Name Name bodyR
emptyRecStmtId :: StmtLR Id Id bodyR
mkRecStmt :: [LStmtLR idL RdrName bodyR] -> StmtLR idL RdrName bodyR
mkHsSpliceTy :: SpliceDecoration -> LHsExpr RdrName -> HsType RdrName
mkHsSpliceE :: SpliceDecoration -> LHsExpr RdrName -> HsExpr RdrName
mkHsSpliceTE :: SpliceDecoration -> LHsExpr RdrName -> HsExpr RdrName
mkUntypedSplice :: SpliceDecoration -> LHsExpr RdrName -> HsSplice RdrName
mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice RdrName
unqualQuasiQuote :: RdrName
noRebindableInfo :: PlaceHolder
-- | Should we treat this as an unlifted bind? This will be true for any
-- bind that binds an unlifted variable, but we must be careful around
-- AbsBinds. See Note [Unlifted id check in isUnliftedHsBind]. For usage
-- information, see Note [Strict binds check] is DsBinds.
isUnliftedHsBind :: HsBind Id -> Bool
-- | Is a binding a strict variable bind (e.g. !x = ...)?
isBangedBind :: HsBind Id -> Bool
collectLocalBinders :: HsLocalBindsLR idL idR -> [idL]
collectHsValBinders :: HsValBindsLR idL idR -> [idL]
collectHsBindListBinders :: [LHsBindLR idL idR] -> [idL]
collectHsIdBinders :: HsValBindsLR idL idR -> [idL]
collectHsBindsBinders :: LHsBindsLR idL idR -> [idL]
collectHsBindBinders :: HsBindLR idL idR -> [idL]
collectMethodBinders :: LHsBindsLR RdrName idR -> [Located RdrName]
collectPatBinders :: LPat a -> [a]
collectPatsBinders :: [LPat a] -> [a]
collectLStmtsBinders :: [LStmtLR idL idR body] -> [idL]
collectStmtsBinders :: [StmtLR idL idR body] -> [idL]
collectLStmtBinders :: LStmtLR idL idR body -> [idL]
collectStmtBinders :: StmtLR idL idR body -> [idL]
-- | Returns all the binding names of the decl. The first one is
hsLTyClDeclBinders :: Located (TyClDecl name) -> ([Located name], [LFieldOcc name])
hsTyClForeignBinders :: [TyClGroup Name] -> [LForeignDecl Name] -> [Name]
hsPatSynSelectors :: HsValBinds id -> [id]
getPatSynBinds :: [(RecFlag, LHsBinds id)] -> [PatSynBind id id]
hsForeignDeclsBinders :: [LForeignDecl name] -> [Located name]
hsGroupBinders :: HsGroup Name -> [Name]
hsDataFamInstBinders :: DataFamInstDecl name -> ([Located name], [LFieldOcc name])
hsDataDefnBinders :: HsDataDefn name -> ([Located name], [LFieldOcc name])
lStmtsImplicits :: [LStmtLR Name idR (Located (body idR))] -> NameSet
hsValBindsImplicits :: HsValBindsLR Name idR -> NameSet
lPatImplicits :: LPat Name -> NameSet
module HsSyn
data Fixity
-- | Haskell Module
--
-- All we actually declare here is the top-level structure for a module.
data HsModule name
-- | AnnKeywordIds
--
--
HsModule :: Maybe (Located ModuleName) -> Maybe (Located [LIE name]) -> [LImportDecl name] -> [LHsDecl name] -> Maybe (Located WarningTxt) -> Maybe LHsDocString -> HsModule name
-- | Nothing: "module X where" is omitted (in which case the next
-- field is Nothing too)
[hsmodName] :: HsModule name -> Maybe (Located ModuleName)
-- | Export list
--
--
-- - Nothing: export list omitted, so export everything
-- - Just []: export nothing
-- - Just [...]: as you would expect...
-- - AnnKeywordIds : AnnOpen ,AnnClose
--
[hsmodExports] :: HsModule name -> Maybe (Located [LIE name])
-- | We snaffle interesting stuff out of the imported interfaces early on,
-- adding that info to TyDecls/etc; so this list is often empty,
-- downstream.
[hsmodImports] :: HsModule name -> [LImportDecl name]
-- | Type, class, value, and interface signature decls
[hsmodDecls] :: HsModule name -> [LHsDecl name]
-- | reason/explanation for warning/deprecation of this module
--
--
[hsmodDeprecMessage] :: HsModule name -> Maybe (Located WarningTxt)
-- | Haddock module info and description, unparsed
--
--
[hsmodHaddockModHeader] :: HsModule name -> Maybe LHsDocString
instance PlaceHolder.DataId name => Data.Data.Data (HsSyn.HsModule name)
instance (PlaceHolder.OutputableBndrId name, OccName.HasOccName name) => Outputable.Outputable (HsSyn.HsModule name)
module RdrHsSyn
mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id
mkHsIntegral :: SourceText -> Integer -> PostTc RdrName Type -> HsOverLit RdrName
mkHsFractional :: FractionalLit -> PostTc RdrName Type -> HsOverLit RdrName
mkHsIsString :: SourceText -> FastString -> PostTc RdrName Type -> HsOverLit RdrName
mkHsDo :: HsStmtContext Name -> [ExprLStmt RdrName] -> HsExpr RdrName
mkSpliceDecl :: LHsExpr RdrName -> HsDecl RdrName
mkRoleAnnotDecl :: SrcSpan -> Located RdrName -> [Located (Maybe FastString)] -> P (LRoleAnnotDecl RdrName)
mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Located (a, [Located (FunDep (Located RdrName))]) -> OrdList (LHsDecl RdrName) -> P (LTyClDecl RdrName)
mkTyData :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Maybe (LHsKind RdrName) -> [LConDecl RdrName] -> HsDeriving RdrName -> P (LTyClDecl RdrName)
mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (Located CType) -> Located (Maybe (LHsContext RdrName), LHsType RdrName) -> Maybe (LHsKind RdrName) -> [LConDecl RdrName] -> HsDeriving RdrName -> P (LInstDecl RdrName)
mkTySynonym :: SrcSpan -> LHsType RdrName -> LHsType RdrName -> P (LTyClDecl RdrName)
mkTyFamInstEqn :: LHsType RdrName -> LHsType RdrName -> P (TyFamInstEqn RdrName, [AddAnn])
mkTyFamInst :: SrcSpan -> LTyFamInstEqn RdrName -> P (LInstDecl RdrName)
mkFamDecl :: SrcSpan -> FamilyInfo RdrName -> LHsType RdrName -> Located (FamilyResultSig RdrName) -> Maybe (LInjectivityAnn RdrName) -> P (LTyClDecl RdrName)
mkLHsSigType :: LHsType RdrName -> LHsSigType RdrName
splitCon :: LHsType RdrName -> P (Located RdrName, HsConDeclDetails RdrName)
mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma
mkPatSynMatchGroup :: Located RdrName -> Located (OrdList (LHsDecl RdrName)) -> P (MatchGroup RdrName (LHsExpr RdrName))
mkRecConstrOrUpdate :: LHsExpr RdrName -> SrcSpan -> ([LHsRecField RdrName (LHsExpr RdrName)], Bool) -> P (HsExpr RdrName)
-- | mkClassDecl builds a RdrClassDecl, filling in the names for tycon and
-- datacon by deriving them from the name of the class. We fill in the
-- names for the tycon and datacon corresponding to the class, by
-- deriving them from the name of the class itself. This saves recording
-- the names in the interface file (which would be equally good).
mkTyClD :: LTyClDecl n -> LHsDecl n
mkInstD :: LInstDecl n -> LHsDecl n
mkRdrRecordCon :: Located RdrName -> HsRecordBinds RdrName -> HsExpr RdrName
mkRdrRecordUpd :: LHsExpr RdrName -> [LHsRecUpdField RdrName] -> HsExpr RdrName
-- | This rather gruesome function is used mainly by the parser. When
-- parsing:
--
--
-- data T a = T | T1 Int
--
--
-- we parse the data constructors as types because of parser
-- ambiguities, so then we need to change the type constr to a
-- data constr
--
-- The exact-name case can occur when parsing:
--
--
-- data [] a = [] | a : [a]
--
--
-- For the exact-name case we return an original name.
setRdrNameSpace :: RdrName -> NameSpace -> RdrName
cvBindGroup :: OrdList (LHsDecl RdrName) -> P (HsValBinds RdrName)
cvBindsAndSigs :: OrdList (LHsDecl RdrName) -> P (LHsBinds RdrName, [LSig RdrName], [LFamilyDecl RdrName], [LTyFamInstDecl RdrName], [LDataFamInstDecl RdrName], [LDocDecl])
-- | Function definitions are restructured here. Each is assumed to be
-- recursive initially, and non recursive definitions are discovered by
-- the dependency analyser.
cvTopDecls :: OrdList (LHsDecl RdrName) -> [LHsDecl RdrName]
placeHolderPunRhs :: LHsExpr RdrName
mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, Located RdrName, LHsSigType RdrName) -> P (HsDecl RdrName)
parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText -> Maybe ForeignImport
mkExport :: Located CCallConv -> (Located StringLiteral, Located RdrName, LHsSigType RdrName) -> P (HsDecl RdrName)
mkExtName :: RdrName -> CLabelString
mkGadtDecl :: [Located RdrName] -> LHsSigType RdrName -> ConDecl RdrName
mkConDeclH98 :: Located RdrName -> Maybe [LHsTyVarBndr RdrName] -> LHsContext RdrName -> HsConDeclDetails RdrName -> ConDecl RdrName
mkATDefault :: LTyFamInstDecl RdrName -> Either (SrcSpan, SDoc) (LTyFamDefltEqn RdrName)
checkPrecP :: Located (SourceText, Int) -> P (Located (SourceText, Int))
checkContext :: LHsType RdrName -> P ([AddAnn], LHsContext RdrName)
checkPattern :: SDoc -> LHsExpr RdrName -> P (LPat RdrName)
bang_RDR :: RdrName
checkPatterns :: SDoc -> [LHsExpr RdrName] -> P [LPat RdrName]
checkMonadComp :: P (HsStmtContext Name)
checkCommand :: LHsExpr RdrName -> P (LHsCmd RdrName)
checkValDef :: SDoc -> SrcStrictness -> LHsExpr RdrName -> Maybe (LHsType RdrName) -> Located (a, GRHSs RdrName (LHsExpr RdrName)) -> P ([AddAnn], HsBind RdrName)
checkValSigLhs :: LHsExpr RdrName -> P (Located RdrName)
checkDoAndIfThenElse :: LHsExpr RdrName -> Bool -> LHsExpr RdrName -> Bool -> LHsExpr RdrName -> P ()
checkRecordSyntax :: Outputable a => Located a -> P (Located a)
parseErrorSDoc :: SrcSpan -> SDoc -> P a
-- | Transform btype_no_ops with strict_mark's into HsEqTy's (((~a) ~b) c)
-- ~d ==> ((~a) ~ (b c)) ~ d
splitTilde :: LHsType RdrName -> P (LHsType RdrName)
-- | Transform tyapps with strict_marks into uses of twiddle [~a, ~b, c,
-- ~d] ==> (~a) ~ b c ~ d
splitTildeApps :: [LHsAppType RdrName] -> P [LHsAppType RdrName]
data ImpExpSubSpec
ImpExpAbs :: ImpExpSubSpec
ImpExpAll :: ImpExpSubSpec
ImpExpList :: [Located ImpExpQcSpec] -> ImpExpSubSpec
ImpExpAllWith :: [Located ImpExpQcSpec] -> ImpExpSubSpec
data ImpExpQcSpec
ImpExpQcName :: (Located RdrName) -> ImpExpQcSpec
ImpExpQcType :: (Located RdrName) -> ImpExpQcSpec
ImpExpQcWildcard :: ImpExpQcSpec
mkModuleImpExp :: Located ImpExpQcSpec -> ImpExpSubSpec -> P (IE RdrName)
mkTypeImpExp :: Located RdrName -> P (Located RdrName)
mkImpExpSubSpec :: [Located ImpExpQcSpec] -> P ([AddAnn], ImpExpSubSpec)
checkImportSpec :: Located [LIE RdrName] -> P (Located [LIE RdrName])
data SumOrTuple
Sum :: ConTag -> Arity -> (LHsExpr RdrName) -> SumOrTuple
Tuple :: [LHsTupArg RdrName] -> SumOrTuple
mkSumOrTuple :: Boxity -> SrcSpan -> SumOrTuple -> P (HsExpr RdrName)
module PmExpr
-- | Lifted expressions for pattern match checking.
data PmExpr
PmExprVar :: Name -> PmExpr
PmExprCon :: ConLike -> [PmExpr] -> PmExpr
PmExprLit :: PmLit -> PmExpr
PmExprEq :: PmExpr -> PmExpr -> PmExpr
PmExprOther :: (HsExpr Id) -> PmExpr
-- | Literals (simple and overloaded ones) for pattern match checking.
data PmLit
PmSLit :: HsLit -> PmLit
PmOLit :: Bool -> (HsOverLit Id) -> PmLit
-- | Term equalities
type SimpleEq = (Id, PmExpr)
type ComplexEq = (PmExpr, PmExpr)
-- | Lift a SimpleEq to a ComplexEq
toComplex :: SimpleEq -> ComplexEq
-- | Equality between literals for pattern match checking.
eqPmLit :: PmLit -> PmLit -> Bool
-- | Expression True
truePmExpr :: PmExpr
-- | Expression False
falsePmExpr :: PmExpr
-- | Check whether a PmExpr is syntactically equal to term True.
isTruePmExpr :: PmExpr -> Bool
-- | Check whether a PmExpr is syntactically equal to term False.
isFalsePmExpr :: PmExpr -> Bool
-- | Check if an expression is lifted or not
isNotPmExprOther :: PmExpr -> Bool
lhsExprToPmExpr :: LHsExpr Id -> PmExpr
hsExprToPmExpr :: HsExpr Id -> PmExpr
-- | Substitute in a complex equality. We return (Left eq) if the
-- substitution affected the equality or (Right eq) if nothing happened.
substComplexEq :: Name -> PmExpr -> ComplexEq -> Either ComplexEq ComplexEq
filterComplex :: [ComplexEq] -> [PmNegLitCt]
pprPmExprWithParens :: PmExpr -> PmPprM SDoc
runPmPprM :: PmPprM a -> [PmNegLitCt] -> (a, [(SDoc, [PmLit])])
instance Outputable.Outputable PmExpr.PmExpr
instance Outputable.Outputable PmExpr.PmLit
-- | Types for the per-module compiler
module HscTypes
-- | HscEnv is like Session, except that some of the fields are
-- immutable. An HscEnv is used to compile a single module from plain
-- Haskell source code (after preprocessing) to either C, assembly or
-- C--. Things like the module graph don't change during a single
-- compilation.
--
-- Historical note: "hsc" used to be the name of the compiler binary,
-- when there was a separate driver and compiler. To compile a single
-- module, the driver would invoke hsc on the source code... so nowadays
-- we think of hsc as the layer of the compiler that deals with compiling
-- a single module.
data HscEnv
HscEnv :: DynFlags -> [Target] -> ModuleGraph -> InteractiveContext -> HomePackageTable -> {-# UNPACK #-} !(IORef ExternalPackageState) -> {-# UNPACK #-} !(IORef NameCache) -> {-# UNPACK #-} !(IORef FinderCache) -> Maybe (Module, IORef TypeEnv) -> MVar (Maybe IServ) -> HscEnv
-- | The dynamic flag settings
[hsc_dflags] :: HscEnv -> DynFlags
-- | The targets (or roots) of the current session
[hsc_targets] :: HscEnv -> [Target]
-- | The module graph of the current session
[hsc_mod_graph] :: HscEnv -> ModuleGraph
-- | The context for evaluating interactive statements
[hsc_IC] :: HscEnv -> InteractiveContext
-- | The home package table describes already-compiled home-package
-- modules, excluding the module we are compiling right now. (In
-- one-shot mode the current module is the only home-package module, so
-- hsc_HPT is empty. All other modules count as "external-package"
-- modules. However, even in GHCi mode, hi-boot interfaces are
-- demand-loaded into the external-package table.)
--
-- hsc_HPT is not mutable because we only demand-load external
-- packages; the home package is eagerly loaded, module by module, by the
-- compilation manager.
--
-- The HPT may contain modules compiled earlier by --make but
-- not actually below the current module in the dependency graph.
--
-- (This changes a previous invariant: changed Jan 05.)
[hsc_HPT] :: HscEnv -> HomePackageTable
-- | Information about the currently loaded external packages. This is
-- mutable because packages will be demand-loaded during a compilation
-- run as required.
[hsc_EPS] :: HscEnv -> {-# UNPACK #-} !(IORef ExternalPackageState)
-- | As with hsc_EPS, this is side-effected by compiling to reflect
-- sucking in interface files. They cache the state of external interface
-- files, in effect.
[hsc_NC] :: HscEnv -> {-# UNPACK #-} !(IORef NameCache)
-- | The cached result of performing finding in the file system
[hsc_FC] :: HscEnv -> {-# UNPACK #-} !(IORef FinderCache)
-- | Used for one-shot compilation only, to initialise the
-- IfGblEnv. See tcg_type_env_var for TcGblEnv.
-- See also Note [hsc_type_env_var hack]
[hsc_type_env_var] :: HscEnv -> Maybe (Module, IORef TypeEnv)
-- | interactive server process. Created the first time it is needed.
[hsc_iserv] :: HscEnv -> MVar (Maybe IServ)
-- | Retrieve the ExternalPackageState cache.
hscEPS :: HscEnv -> IO ExternalPackageState
-- | The FinderCache maps modules to the result of searching for
-- that module. It records the results of searching for modules along the
-- search path. On :load, we flush the entire contents of this
-- cache.
type FinderCache = InstalledModuleEnv InstalledFindResult
-- | The result of searching for an imported module.
--
-- NB: FindResult manages both user source-import lookups (which can
-- result in Module) as well as direct imports for interfaces
-- (which always result in InstalledModule).
data FindResult
-- | The module was found
Found :: ModLocation -> Module -> FindResult
-- | The requested package was not found
NoPackage :: UnitId -> FindResult
-- | _Error_: both in multiple packages
FoundMultiple :: [(Module, ModuleOrigin)] -> FindResult
-- | Not found
NotFound :: [FilePath] -> Maybe UnitId -> [UnitId] -> [UnitId] -> [ModuleSuggestion] -> FindResult
[fr_paths] :: FindResult -> [FilePath]
[fr_pkg] :: FindResult -> Maybe UnitId
[fr_mods_hidden] :: FindResult -> [UnitId]
[fr_pkgs_hidden] :: FindResult -> [UnitId]
[fr_suggestions] :: FindResult -> [ModuleSuggestion]
data InstalledFindResult
InstalledFound :: ModLocation -> InstalledModule -> InstalledFindResult
InstalledNoPackage :: InstalledUnitId -> InstalledFindResult
InstalledNotFound :: [FilePath] -> (Maybe InstalledUnitId) -> InstalledFindResult
-- | A compilation target.
--
-- A target may be supplied with the actual text of the module. If so,
-- use this instead of the file contents (this is for use in an IDE where
-- the file hasn't been saved by the user yet).
data Target
Target :: TargetId -> Bool -> Maybe (StringBuffer, UTCTime) -> Target
-- | module or filename
[targetId] :: Target -> TargetId
-- | object code allowed?
[targetAllowObjCode] :: Target -> Bool
-- | in-memory text buffer?
[targetContents] :: Target -> Maybe (StringBuffer, UTCTime)
data TargetId
-- | A module name: search for the file
TargetModule :: ModuleName -> TargetId
-- | A filename: preprocess & parse it to find the module name. If
-- specified, the Phase indicates how to compile this file (which phase
-- to start from). Nothing indicates the starting phase should be
-- determined from the suffix of the filename.
TargetFile :: FilePath -> (Maybe Phase) -> TargetId
pprTarget :: Target -> SDoc
pprTargetId :: TargetId -> SDoc
-- | A ModuleGraph contains all the nodes from the home package (only).
-- There will be a node for each source module, plus a node for each
-- hi-boot module.
--
-- The graph is not necessarily stored in topologically-sorted order. Use
-- topSortModuleGraph and flattenSCC to achieve this.
type ModuleGraph = [ModSummary]
emptyMG :: ModuleGraph
-- | Status of a compilation to hard-code
data HscStatus
HscNotGeneratingCode :: HscStatus
HscUpToDate :: HscStatus
HscUpdateBoot :: HscStatus
HscUpdateSig :: HscStatus
HscRecomp :: CgGuts -> ModSummary -> HscStatus
data IServ
IServ :: Pipe -> ProcessHandle -> IORef (UniqFM (Ptr ())) -> [HValueRef] -> IServ
[iservPipe] :: IServ -> Pipe
[iservProcess] :: IServ -> ProcessHandle
[iservLookupSymbolCache] :: IServ -> IORef (UniqFM (Ptr ()))
[iservPendingFrees] :: IServ -> [HValueRef]
newtype Hsc a
Hsc :: (HscEnv -> WarningMessages -> IO (a, WarningMessages)) -> Hsc a
runHsc :: HscEnv -> Hsc a -> IO a
runInteractiveHsc :: HscEnv -> Hsc a -> IO a
-- | The ModDetails is essentially a cache for information in the
-- ModIface for home modules only. Information relating to
-- packages will be loaded into global environments in
-- ExternalPackageState.
data ModDetails
ModDetails :: [AvailInfo] -> !TypeEnv -> ![ClsInst] -> ![FamInst] -> ![CoreRule] -> ![Annotation] -> !VectInfo -> [CompleteMatch] -> ModDetails
[md_exports] :: ModDetails -> [AvailInfo]
-- | Local type environment for this particular module Includes Ids,
-- TyCons, PatSyns
[md_types] :: ModDetails -> !TypeEnv
-- | DFunIds for the instances in this module
[md_insts] :: ModDetails -> ![ClsInst]
[md_fam_insts] :: ModDetails -> ![FamInst]
-- | Domain may include Ids from other modules
[md_rules] :: ModDetails -> ![CoreRule]
-- | Annotations present in this module: currently they only annotate
-- things also declared in this module
[md_anns] :: ModDetails -> ![Annotation]
-- | Module vectorisation information
[md_vect_info] :: ModDetails -> !VectInfo
-- | Complete match pragmas for this module
[md_complete_sigs] :: ModDetails -> [CompleteMatch]
-- | Constructs an empty ModDetails
emptyModDetails :: ModDetails
-- | A ModGuts is carried through the compiler, accumulating stuff as it
-- goes There is only one ModGuts at any time, the one for the module
-- being compiled right now. Once it is compiled, a ModIface and
-- ModDetails are extracted and the ModGuts is discarded.
data ModGuts
ModGuts :: !Module -> HscSource -> SrcSpan -> ![AvailInfo] -> !Dependencies -> ![Usage] -> !Bool -> !GlobalRdrEnv -> !FixityEnv -> ![TyCon] -> ![ClsInst] -> ![FamInst] -> ![PatSyn] -> ![CoreRule] -> !CoreProgram -> !ForeignStubs -> ![(ForeignSrcLang, String)] -> !Warnings -> [Annotation] -> [CompleteMatch] -> !HpcInfo -> !(Maybe ModBreaks) -> ![CoreVect] -> !VectInfo -> InstEnv -> FamInstEnv -> SafeHaskellMode -> Bool -> ModGuts
-- | Module being compiled
[mg_module] :: ModGuts -> !Module
-- | Whether it's an hs-boot module
[mg_hsc_src] :: ModGuts -> HscSource
-- | For error messages from inner passes
[mg_loc] :: ModGuts -> SrcSpan
-- | What it exports
[mg_exports] :: ModGuts -> ![AvailInfo]
-- | What it depends on, directly or otherwise
[mg_deps] :: ModGuts -> !Dependencies
-- | What was used? Used for interfaces.
[mg_usages] :: ModGuts -> ![Usage]
-- | Did we run a TH splice?
[mg_used_th] :: ModGuts -> !Bool
-- | Top-level lexical environment
[mg_rdr_env] :: ModGuts -> !GlobalRdrEnv
-- | Fixities declared in this module. Used for creating interface files.
[mg_fix_env] :: ModGuts -> !FixityEnv
-- | TyCons declared in this module (includes TyCons for classes)
[mg_tcs] :: ModGuts -> ![TyCon]
-- | Class instances declared in this module
[mg_insts] :: ModGuts -> ![ClsInst]
-- | Family instances declared in this module
[mg_fam_insts] :: ModGuts -> ![FamInst]
-- | Pattern synonyms declared in this module
[mg_patsyns] :: ModGuts -> ![PatSyn]
-- | Before the core pipeline starts, contains See Note [Overall plumbing
-- for rules] in Rules.hs
[mg_rules] :: ModGuts -> ![CoreRule]
-- | Bindings for this module
[mg_binds] :: ModGuts -> !CoreProgram
-- | Foreign exports declared in this module
[mg_foreign] :: ModGuts -> !ForeignStubs
-- | Files to be compiled with the C compiler
[mg_foreign_files] :: ModGuts -> ![(ForeignSrcLang, String)]
-- | Warnings declared in the module
[mg_warns] :: ModGuts -> !Warnings
-- | Annotations declared in this module
[mg_anns] :: ModGuts -> [Annotation]
-- | Complete Matches
[mg_complete_sigs] :: ModGuts -> [CompleteMatch]
-- | Coverage tick boxes in the module
[mg_hpc_info] :: ModGuts -> !HpcInfo
-- | Breakpoints for the module
[mg_modBreaks] :: ModGuts -> !(Maybe ModBreaks)
-- | Vectorisation declarations in this module (produced by desugarer &
-- consumed by vectoriser)
[mg_vect_decls] :: ModGuts -> ![CoreVect]
-- | Pool of vectorised declarations in the module
[mg_vect_info] :: ModGuts -> !VectInfo
-- | Class instance environment for home-package modules (including
-- this one); c.f. tcg_inst_env
[mg_inst_env] :: ModGuts -> InstEnv
-- | Type-family instance environment for home-package modules
-- (including this one); c.f. tcg_fam_inst_env
[mg_fam_inst_env] :: ModGuts -> FamInstEnv
-- | Safe Haskell mode
[mg_safe_haskell] :: ModGuts -> SafeHaskellMode
-- | Do we need to trust our own package for Safe Haskell? See Note
-- [RnNames . Trust Own Package]
[mg_trust_pkg] :: ModGuts -> Bool
-- | A restricted form of ModGuts for code generation purposes
data CgGuts
CgGuts :: !Module -> [TyCon] -> CoreProgram -> !ForeignStubs -> ![(ForeignSrcLang, String)] -> ![InstalledUnitId] -> !HpcInfo -> !(Maybe ModBreaks) -> [SptEntry] -> CgGuts
-- | Module being compiled
[cg_module] :: CgGuts -> !Module
-- | Algebraic data types (including ones that started life as classes);
-- generate constructors and info tables. Includes newtypes, just for the
-- benefit of External Core
[cg_tycons] :: CgGuts -> [TyCon]
-- | The tidied main bindings, including previously-implicit bindings for
-- record and class selectors, and data constructor wrappers. But *not*
-- data constructor workers; reason: we we regard them as part of the
-- code-gen of tycons
[cg_binds] :: CgGuts -> CoreProgram
-- | Foreign export stubs
[cg_foreign] :: CgGuts -> !ForeignStubs
[cg_foreign_files] :: CgGuts -> ![(ForeignSrcLang, String)]
-- | Dependent packages, used to generate #includes for C code gen
[cg_dep_pkgs] :: CgGuts -> ![InstalledUnitId]
-- | Program coverage tick box information
[cg_hpc_info] :: CgGuts -> !HpcInfo
-- | Module breakpoints
[cg_modBreaks] :: CgGuts -> !(Maybe ModBreaks)
-- | Static pointer table entries for static forms defined in the module.
-- See Note [Grand plan for static forms] in StaticPtrTable
[cg_spt_entries] :: CgGuts -> [SptEntry]
-- | Foreign export stubs
data ForeignStubs
-- | We don't have any stubs
NoStubs :: ForeignStubs
-- | There are some stubs. Parameters:
--
-- 1) Header file prototypes for "foreign exported" functions
--
-- 2) C stubs to use when calling "foreign exported" functions
ForeignStubs :: SDoc -> SDoc -> ForeignStubs
appendStubC :: ForeignStubs -> SDoc -> ForeignStubs
-- | Records the modules directly imported by a module for extracting e.g.
-- usage information, and also to give better error message
type ImportedMods = ModuleEnv [ImportedBy]
-- | If a module was "imported" by the user, we associate it with more
-- detailed usage information ImportedModsVal; a module imported
-- by the system only gets used for usage information.
data ImportedBy
ImportedByUser :: ImportedModsVal -> ImportedBy
ImportedBySystem :: ImportedBy
importedByUser :: [ImportedBy] -> [ImportedModsVal]
data ImportedModsVal
ImportedModsVal :: ModuleName -> SrcSpan -> IsSafeImport -> Bool -> GlobalRdrEnv -> Bool -> ImportedModsVal
-- | The name the module is imported with
[imv_name] :: ImportedModsVal -> ModuleName
-- | the source span of the whole import
[imv_span] :: ImportedModsVal -> SrcSpan
-- | whether this is a safe import
[imv_is_safe] :: ImportedModsVal -> IsSafeImport
-- | whether this is an "hiding" import
[imv_is_hiding] :: ImportedModsVal -> Bool
-- | all the things the module could provide
[imv_all_exports] :: ImportedModsVal -> GlobalRdrEnv
-- | whether this is a qualified import
[imv_qualified] :: ImportedModsVal -> Bool
-- | An entry to be inserted into a module's static pointer table. See Note
-- [Grand plan for static forms] in StaticPtrTable.
data SptEntry
SptEntry :: Id -> Fingerprint -> SptEntry
data ForeignSrcLang :: *
LangC :: ForeignSrcLang
LangCxx :: ForeignSrcLang
LangObjc :: ForeignSrcLang
LangObjcxx :: ForeignSrcLang
-- | A single node in a ModuleGraph. The nodes of the module graph
-- are one of:
--
--
-- - A regular Haskell source module
-- - A hi-boot source module
--
data ModSummary
ModSummary :: Module -> HscSource -> ModLocation -> UTCTime -> Maybe UTCTime -> Maybe UTCTime -> [(Maybe FastString, Located ModuleName)] -> [(Maybe FastString, Located ModuleName)] -> Maybe HsParsedModule -> FilePath -> DynFlags -> Maybe StringBuffer -> ModSummary
-- | Identity of the module
[ms_mod] :: ModSummary -> Module
-- | The module source either plain Haskell or hs-boot
[ms_hsc_src] :: ModSummary -> HscSource
-- | Location of the various files belonging to the module
[ms_location] :: ModSummary -> ModLocation
-- | Timestamp of source file
[ms_hs_date] :: ModSummary -> UTCTime
-- | Timestamp of object, if we have one
[ms_obj_date] :: ModSummary -> Maybe UTCTime
-- | Timestamp of hi file, if we *only* are typechecking (it is
-- Nothing otherwise. See Note [Recompilation checking when
-- typechecking only] and #9243
[ms_iface_date] :: ModSummary -> Maybe UTCTime
-- | Source imports of the module
[ms_srcimps] :: ModSummary -> [(Maybe FastString, Located ModuleName)]
-- | Non-source imports of the module from the module *text*
[ms_textual_imps] :: ModSummary -> [(Maybe FastString, Located ModuleName)]
-- | The parsed, nonrenamed source, if we have it. This is also used to
-- support "inline module syntax" in Backpack files.
[ms_parsed_mod] :: ModSummary -> Maybe HsParsedModule
-- | Filename of preprocessed source file
[ms_hspp_file] :: ModSummary -> FilePath
-- | Cached flags from OPTIONS, INCLUDE and
-- LANGUAGE pragmas in the modules source code
[ms_hspp_opts] :: ModSummary -> DynFlags
-- | The actual preprocessed source, if we have it
[ms_hspp_buf] :: ModSummary -> Maybe StringBuffer
ms_imps :: ModSummary -> [(Maybe FastString, Located ModuleName)]
ms_installed_mod :: ModSummary -> InstalledModule
ms_mod_name :: ModSummary -> ModuleName
showModMsg :: DynFlags -> HscTarget -> Bool -> ModSummary -> String
-- | Did this ModSummary originate from a hs-boot file?
isBootSummary :: ModSummary -> Bool
msHsFilePath :: ModSummary -> FilePath
msHiFilePath :: ModSummary -> FilePath
msObjFilePath :: ModSummary -> FilePath
-- | Indicates whether a given module's source has been modified since it
-- was last compiled.
data SourceModified
-- | the source has been modified
SourceModified :: SourceModified
-- | the source has not been modified. Compilation may or may not be
-- necessary, depending on whether any dependencies have changed since we
-- last compiled.
SourceUnmodified :: SourceModified
-- | the source has not been modified, and furthermore all of its
-- (transitive) dependencies are up to date; it definitely does not need
-- to be recompiled. This is important for two reasons: (a) we can omit
-- the version check in checkOldIface, and (b) if the module used TH
-- splices we don't need to force recompilation.
SourceUnmodifiedAndStable :: SourceModified
data HscSource
HsSrcFile :: HscSource
HsBootFile :: HscSource
HsigFile :: HscSource
isHsBootOrSig :: HscSource -> Bool
hscSourceString :: HscSource -> String
-- | Helps us find information about modules in the home package
type HomePackageTable = DModuleNameEnv HomeModInfo
-- | Information about modules in the package being compiled
data HomeModInfo
HomeModInfo :: !ModIface -> !ModDetails -> !(Maybe Linkable) -> HomeModInfo
-- | The basic loaded interface file: every loaded module has one of these,
-- even if it is imported from another package
[hm_iface] :: HomeModInfo -> !ModIface
-- | Extra information that has been created from the ModIface for
-- the module, typically during typechecking
[hm_details] :: HomeModInfo -> !ModDetails
-- | The actual artifact we would like to link to access things in this
-- module.
--
-- hm_linkable might be Nothing:
--
--
-- - If this is an .hs-boot module
-- - Temporarily during compilation if we pruned away the old linkable
-- because it was out of date.
--
--
-- After a complete compilation (load), all hm_linkable
-- fields in the HomePackageTable will be Just.
--
-- When re-linking a module (HscNoRecomp), we construct the
-- HomeModInfo by building a new ModDetails from the old
-- ModIface (only).
[hm_linkable] :: HomeModInfo -> !(Maybe Linkable)
-- | Constructs an empty HomePackageTable
emptyHomePackageTable :: HomePackageTable
lookupHpt :: HomePackageTable -> ModuleName -> Maybe HomeModInfo
eltsHpt :: HomePackageTable -> [HomeModInfo]
filterHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> HomePackageTable
allHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> Bool
mapHpt :: (HomeModInfo -> HomeModInfo) -> HomePackageTable -> HomePackageTable
delFromHpt :: HomePackageTable -> ModuleName -> HomePackageTable
addToHpt :: HomePackageTable -> ModuleName -> HomeModInfo -> HomePackageTable
addListToHpt :: HomePackageTable -> [(ModuleName, HomeModInfo)] -> HomePackageTable
lookupHptDirectly :: HomePackageTable -> Unique -> Maybe HomeModInfo
listToHpt :: [(ModuleName, HomeModInfo)] -> HomePackageTable
hptCompleteSigs :: HscEnv -> [CompleteMatch]
-- | Find all the instance declarations (of classes and families) from the
-- Home Package Table filtered by the provided predicate function. Used
-- in tcRnImports, to select the instances that are in the
-- transitive closure of imports from the currently compiled module.
hptInstances :: HscEnv -> (ModuleName -> Bool) -> ([ClsInst], [FamInst])
-- | Get rules from modules "below" this one (in the dependency sense)
hptRules :: HscEnv -> [(ModuleName, IsBootInterface)] -> [CoreRule]
-- | Get the combined VectInfo of all modules in the home package table. In
-- contrast to instances and rules, we don't care whether the modules are
-- "below" us in the dependency sense. The VectInfo of those modules not
-- "below" us does not affect the compilation of the current module.
hptVectInfo :: HscEnv -> VectInfo
pprHPT :: HomePackageTable -> SDoc
hptObjs :: HomePackageTable -> [FilePath]
-- | Information about other packages that we have slurped in by reading
-- their interface files
data ExternalPackageState
EPS :: !(ModuleNameEnv (ModuleName, IsBootInterface)) -> !PackageIfaceTable -> InstalledModuleEnv (UniqDSet ModuleName) -> !PackageTypeEnv -> !PackageInstEnv -> !PackageFamInstEnv -> !PackageRuleBase -> !PackageVectInfo -> !PackageAnnEnv -> !PackageCompleteMatchMap -> !(ModuleEnv FamInstEnv) -> !EpsStats -> ExternalPackageState
-- | In OneShot mode (only), home-package modules accumulate in the
-- external package state, and are sucked in lazily. For these home-pkg
-- modules (only) we need to record which are boot modules. We set this
-- field after loading all the explicitly-imported interfaces, but before
-- doing anything else
--
-- The ModuleName part is not necessary, but it's useful for debug
-- prints, and it's convenient because this field comes direct from
-- imp_dep_mods
[eps_is_boot] :: ExternalPackageState -> !(ModuleNameEnv (ModuleName, IsBootInterface))
-- | The ModIfaces for modules in external packages whose interfaces
-- we have opened. The declarations in these interface files are held in
-- the eps_decls, eps_inst_env, eps_fam_inst_env
-- and eps_rules fields of this record, not in the
-- mi_decls fields of the interface we have sucked in.
--
-- What is in the PIT is:
--
--
-- - The Module
-- - Fingerprint info
-- - Its exports
-- - Fixities
-- - Deprecations and warnings
--
[eps_PIT] :: ExternalPackageState -> !PackageIfaceTable
-- | Cache for mi_free_holes. Ordinarily, we can rely on the
-- eps_PIT for this information, EXCEPT that when we do dependency
-- analysis, we need to look at the Dependencies of our imports to
-- determine what their precise free holes are
-- (moduleFreeHolesPrecise). We don't want to repeatedly reread
-- in the interface for every import, so cache it here. When the PIT gets
-- filled in we can drop these entries.
[eps_free_holes] :: ExternalPackageState -> InstalledModuleEnv (UniqDSet ModuleName)
-- | Result of typechecking all the external package interface files we
-- have sucked in. The domain of the mapping is external-package modules
[eps_PTE] :: ExternalPackageState -> !PackageTypeEnv
-- | The total InstEnv accumulated from all the external-package
-- modules
[eps_inst_env] :: ExternalPackageState -> !PackageInstEnv
-- | The total FamInstEnv accumulated from all the external-package
-- modules
[eps_fam_inst_env] :: ExternalPackageState -> !PackageFamInstEnv
-- | The total RuleEnv accumulated from all the external-package
-- modules
[eps_rule_base] :: ExternalPackageState -> !PackageRuleBase
-- | The total VectInfo accumulated from all the external-package
-- modules
[eps_vect_info] :: ExternalPackageState -> !PackageVectInfo
-- | The total AnnEnv accumulated from all the external-package
-- modules
[eps_ann_env] :: ExternalPackageState -> !PackageAnnEnv
-- | The total CompleteMatchMap accumulated from all the
-- external-package modules
[eps_complete_matches] :: ExternalPackageState -> !PackageCompleteMatchMap
-- | The family instances accumulated from external packages, keyed off the
-- module that declared them
[eps_mod_fam_inst_env] :: ExternalPackageState -> !(ModuleEnv FamInstEnv)
-- | Stastics about what was loaded from external packages
[eps_stats] :: ExternalPackageState -> !EpsStats
-- | Accumulated statistics about what we are putting into the
-- ExternalPackageState. "In" means stuff that is just read
-- from interface files, "Out" means actually sucked in and type-checked
data EpsStats
EpsStats :: !Int -> EpsStats
[n_ifaces_in, n_decls_in, n_decls_out, n_rules_in, n_rules_out, n_insts_in, n_insts_out] :: EpsStats -> !Int
-- | Add stats for one newly-read interface
addEpsInStats :: EpsStats -> Int -> Int -> Int -> EpsStats
type PackageTypeEnv = TypeEnv
-- | Helps us find information about modules in the imported packages
type PackageIfaceTable = ModuleEnv ModIface
-- | Constructs an empty PackageIfaceTable
emptyPackageIfaceTable :: PackageIfaceTable
-- | Find the ModIface for a Module, searching in both the
-- loaded home and external package module information
lookupIfaceByModule :: DynFlags -> HomePackageTable -> PackageIfaceTable -> Module -> Maybe ModIface
-- | Constructs an empty ModIface
emptyModIface :: Module -> ModIface
lookupHptByModule :: HomePackageTable -> Module -> Maybe HomeModInfo
type PackageInstEnv = InstEnv
type PackageFamInstEnv = FamInstEnv
type PackageRuleBase = RuleBase
type PackageCompleteMatchMap = CompleteMatchMap
mkSOName :: Platform -> FilePath -> FilePath
mkHsSOName :: Platform -> FilePath -> FilePath
soExt :: Platform -> FilePath
-- | The supported metaprogramming result types
data MetaRequest
MetaE :: (LHsExpr RdrName -> MetaResult) -> MetaRequest
MetaP :: (LPat RdrName -> MetaResult) -> MetaRequest
MetaT :: (LHsType RdrName -> MetaResult) -> MetaRequest
MetaD :: ([LHsDecl RdrName] -> MetaResult) -> MetaRequest
MetaAW :: (Serialized -> MetaResult) -> MetaRequest
-- | data constructors not exported to ensure correct result type
data MetaResult
metaRequestE :: Functor f => MetaHook f -> LHsExpr Id -> f (LHsExpr RdrName)
metaRequestP :: Functor f => MetaHook f -> LHsExpr Id -> f (LPat RdrName)
metaRequestT :: Functor f => MetaHook f -> LHsExpr Id -> f (LHsType RdrName)
metaRequestD :: Functor f => MetaHook f -> LHsExpr Id -> f [LHsDecl RdrName]
metaRequestAW :: Functor f => MetaHook f -> LHsExpr Id -> f Serialized
type MetaHook f = MetaRequest -> LHsExpr Id -> f MetaResult
-- | Deal with gathering annotations in from all possible places and
-- combining them into a single AnnEnv
prepareAnnotations :: HscEnv -> Maybe ModGuts -> IO AnnEnv
-- | Interactive context, recording information about the state of the
-- context in which statements are executed in a GHC session.
data InteractiveContext
InteractiveContext :: DynFlags -> Int -> [InteractiveImport] -> [TyThing] -> GlobalRdrEnv -> ([ClsInst], [FamInst]) -> FixityEnv -> Maybe [Type] -> [Resume] -> Name -> Name -> Maybe FilePath -> InteractiveContext
-- | The DynFlags used to evaluate interative expressions and
-- statements.
[ic_dflags] :: InteractiveContext -> DynFlags
-- | Each GHCi stmt or declaration brings some new things into scope. We
-- give them names like interactive:Ghci9.T, where the ic_index is the
-- '9'. The ic_mod_index is incremented whenever we add something to
-- ic_tythings See Note [The interactive package]
[ic_mod_index] :: InteractiveContext -> Int
-- | The GHCi top-level scope (ic_rn_gbl_env) is extended with these
-- imports
--
-- This field is only stored here so that the client can retrieve it with
-- GHC.getContext. GHC itself doesn't use it, but does reset it to empty
-- sometimes (such as before a GHC.load). The context is set with
-- GHC.setContext.
[ic_imports] :: InteractiveContext -> [InteractiveImport]
-- | TyThings defined by the user, in reverse order of definition (ie most
-- recent at the front) See Note [ic_tythings]
[ic_tythings] :: InteractiveContext -> [TyThing]
-- | The cached GlobalRdrEnv, built by setContext and updated
-- regularly It contains everything in scope at the command line,
-- including everything in ic_tythings
[ic_rn_gbl_env] :: InteractiveContext -> GlobalRdrEnv
-- | All instances and family instances created during this session. These
-- are grabbed en masse after each update to be sure that proper
-- overlapping is retained. That is, rather than re-check the overlapping
-- each time we update the context, we just take the results from the
-- instance code that already does that.
[ic_instances] :: InteractiveContext -> ([ClsInst], [FamInst])
-- | Fixities declared in let statements
[ic_fix_env] :: InteractiveContext -> FixityEnv
-- | The current default types, set by a 'default' declaration
[ic_default] :: InteractiveContext -> Maybe [Type]
-- | The stack of breakpoint contexts
[ic_resume] :: InteractiveContext -> [Resume]
-- | The monad that GHCi is executing in
[ic_monad] :: InteractiveContext -> Name
-- | The function that is used for printing results of expressions in ghci
-- and -e mode.
[ic_int_print] :: InteractiveContext -> Name
[ic_cwd] :: InteractiveContext -> Maybe FilePath
-- | Constructs an empty InteractiveContext.
emptyInteractiveContext :: DynFlags -> InteractiveContext
-- | Get the PrintUnqualified function based on the flags and this
-- InteractiveContext
icPrintUnqual :: DynFlags -> InteractiveContext -> PrintUnqualified
-- | This function returns the list of visible TyThings (useful for e.g.
-- showBindings)
icInScopeTTs :: InteractiveContext -> [TyThing]
-- | Add TyThings to the GlobalRdrEnv, earlier ones in the list shadowing
-- later ones, and shadowing existing entries in the GlobalRdrEnv.
icExtendGblRdrEnv :: GlobalRdrEnv -> [TyThing] -> GlobalRdrEnv
-- | extendInteractiveContext is called with new TyThings recently defined
-- to update the InteractiveContext to include them. Ids are easily
-- removed when shadowed, but Classes and TyCons are not. Some work could
-- be done to determine whether they are entirely shadowed, but as you
-- could still have references to them (e.g. instances for classes or
-- values of the type for TyCons), it's not clear whether removing them
-- is even the appropriate behavior.
extendInteractiveContext :: InteractiveContext -> [TyThing] -> [ClsInst] -> [FamInst] -> Maybe [Type] -> FixityEnv -> InteractiveContext
extendInteractiveContextWithIds :: InteractiveContext -> [Id] -> InteractiveContext
substInteractiveContext :: InteractiveContext -> TCvSubst -> InteractiveContext
setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext
icInteractiveModule :: InteractiveContext -> Module
data InteractiveImport
-- | Bring the exports of a particular module (filtered by an import decl)
-- into scope
IIDecl :: (ImportDecl RdrName) -> InteractiveImport
-- | Bring into scope the entire top-level envt of of this module,
-- including the things imported into it.
IIModule :: ModuleName -> InteractiveImport
setInteractivePackage :: HscEnv -> HscEnv
-- | Creates some functions that work out the best ways to format names for
-- the user according to a set of heuristics.
mkPrintUnqualified :: DynFlags -> GlobalRdrEnv -> PrintUnqualified
pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc
-- | Creates a function for formatting packages based on two heuristics:
-- (1) don't qualify if the package in question is "main", and (2) only
-- qualify with a unit id if the package ID would be ambiguous.
mkQualPackage :: DynFlags -> QueryQualifyPackage
-- | Creates a function for formatting modules based on two heuristics: (1)
-- if the module is the current module, don't qualify, and (2) if there
-- is only one exposed package which exports this module, don't qualify.
mkQualModule :: DynFlags -> QueryQualifyModule
-- | A function which only qualifies package names if necessary; but
-- qualifies all other identifiers.
pkgQual :: DynFlags -> PrintUnqualified
-- | A ModIface plus a ModDetails summarises everything we
-- know about a compiled module. The ModIface is the stuff
-- *before* linking, and can be written out to an interface file. The
-- 'ModDetails is after linking and can be completely recovered from just
-- the ModIface.
--
-- When we read an interface file, we also construct a ModIface
-- from it, except that we explicitly make the mi_decls and a few
-- other fields empty; as when reading we consolidate the declarations
-- etc. into a number of indexed maps and environments in the
-- ExternalPackageState.
data ModIface
ModIface :: !Module -> !(Maybe Module) -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !WhetherHasOrphans -> !WhetherHasFamInst -> !HscSource -> Dependencies -> [Usage] -> ![IfaceExport] -> !Fingerprint -> !Bool -> [(OccName, Fixity)] -> Warnings -> [IfaceAnnotation] -> [(Fingerprint, IfaceDecl)] -> !(Maybe GlobalRdrEnv) -> [IfaceClsInst] -> [IfaceFamInst] -> [IfaceRule] -> !Fingerprint -> !IfaceVectInfo -> (OccName -> Maybe WarningTxt) -> (OccName -> Maybe Fixity) -> (OccName -> Maybe (OccName, Fingerprint)) -> !AnyHpcUsage -> !IfaceTrustInfo -> !Bool -> [IfaceCompleteMatch] -> ModIface
-- | Name of the module we are for
[mi_module] :: ModIface -> !Module
-- | Are we a sig of another mod?
[mi_sig_of] :: ModIface -> !(Maybe Module)
-- | Hash of the whole interface
[mi_iface_hash] :: ModIface -> !Fingerprint
-- | Hash of the ABI only
[mi_mod_hash] :: ModIface -> !Fingerprint
-- | Hash of the important flags used when compiling this module
[mi_flag_hash] :: ModIface -> !Fingerprint
-- | Whether this module has orphans
[mi_orphan] :: ModIface -> !WhetherHasOrphans
-- | Whether this module has family instances. See Note [The type family
-- instance consistency story].
[mi_finsts] :: ModIface -> !WhetherHasFamInst
-- | Boot? Signature?
[mi_hsc_src] :: ModIface -> !HscSource
-- | The dependencies of the module. This is consulted for
-- directly-imported modules, but not for anything else (hence lazy)
[mi_deps] :: ModIface -> Dependencies
-- | Usages; kept sorted so that it's easy to decide whether to write a new
-- iface file (changing usages doesn't affect the hash of this module)
-- NOT STRICT! we read this field lazily from the interface file It is
-- *only* consulted by the recompilation checker
[mi_usages] :: ModIface -> [Usage]
-- | Exports Kept sorted by (mod,occ), to make version comparisons easier
-- Records the modules that are the declaration points for things
-- exported by this module, and the OccNames of those things
[mi_exports] :: ModIface -> ![IfaceExport]
-- | Hash of export list
[mi_exp_hash] :: ModIface -> !Fingerprint
-- | Module required TH splices when it was compiled. This disables
-- recompilation avoidance (see #481).
[mi_used_th] :: ModIface -> !Bool
-- | Fixities NOT STRICT! we read this field lazily from the interface file
[mi_fixities] :: ModIface -> [(OccName, Fixity)]
-- | Warnings NOT STRICT! we read this field lazily from the interface file
[mi_warns] :: ModIface -> Warnings
-- | Annotations NOT STRICT! we read this field lazily from the interface
-- file
[mi_anns] :: ModIface -> [IfaceAnnotation]
-- | Type, class and variable declarations The hash of an Id changes if its
-- fixity or deprecations change (as well as its type of course) Ditto
-- data constructors, class operations, except that the hash of the
-- parent class/tycon changes
[mi_decls] :: ModIface -> [(Fingerprint, IfaceDecl)]
-- | Binds all the things defined at the top level in the original
-- source code for this module. which is NOT the same as mi_exports,
-- nor mi_decls (which may contains declarations for things not actually
-- defined by the user). Used for GHCi and for inspecting the contents of
-- modules via the GHC API only.
--
-- (We need the source file to figure out the top-level environment, if
-- we didn't compile this module from source then this field contains
-- Nothing).
--
-- Strictly speaking this field should live in the HomeModInfo,
-- but that leads to more plumbing.
[mi_globals] :: ModIface -> !(Maybe GlobalRdrEnv)
-- | Sorted class instance
[mi_insts] :: ModIface -> [IfaceClsInst]
-- | Sorted family instances
[mi_fam_insts] :: ModIface -> [IfaceFamInst]
-- | Sorted rules
[mi_rules] :: ModIface -> [IfaceRule]
-- | Hash for orphan rules, class and family instances, and vectorise
-- pragmas combined
[mi_orphan_hash] :: ModIface -> !Fingerprint
-- | Vectorisation information
[mi_vect_info] :: ModIface -> !IfaceVectInfo
-- | Cached lookup for mi_warns
[mi_warn_fn] :: ModIface -> OccName -> Maybe WarningTxt
-- | Cached lookup for mi_fixities
[mi_fix_fn] :: ModIface -> OccName -> Maybe Fixity
-- | Cached lookup for mi_decls. The Nothing in
-- mi_hash_fn means that the thing isn't in decls. It's useful to
-- know that when seeing if we are up to date wrt. the old interface. The
-- OccName is the parent of the name, if it has one.
[mi_hash_fn] :: ModIface -> OccName -> Maybe (OccName, Fingerprint)
-- | True if this program uses Hpc at any point in the program.
[mi_hpc] :: ModIface -> !AnyHpcUsage
-- | Safe Haskell Trust information for this module.
[mi_trust] :: ModIface -> !IfaceTrustInfo
-- | Do we require the package this module resides in be trusted to trust
-- this module? This is used for the situation where a module is Safe (so
-- doesn't require the package be trusted itself) but imports some
-- trustworthy modules from its own package (which does require its own
-- package be trusted). See Note [RnNames . Trust Own Package]
[mi_trust_pkg] :: ModIface -> !Bool
[mi_complete_sigs] :: ModIface -> [IfaceCompleteMatch]
-- | Constructs the cache for the mi_warn_fn field of a
-- ModIface
mkIfaceWarnCache :: Warnings -> OccName -> Maybe WarningTxt
-- | Constructs cache for the mi_hash_fn field of a ModIface
mkIfaceHashCache :: [(Fingerprint, IfaceDecl)] -> (OccName -> Maybe (OccName, Fingerprint))
-- | Creates cached lookup for the mi_fix_fn field of
-- ModIface
mkIfaceFixCache :: [(OccName, Fixity)] -> OccName -> Maybe Fixity
emptyIfaceWarnCache :: OccName -> Maybe WarningTxt
-- | Old-style accessor for whether or not the ModIface came from an
-- hs-boot file.
mi_boot :: ModIface -> Bool
-- | Lookups up a (possibly cached) fixity from a ModIface. If one
-- cannot be found, defaultFixity is returned instead.
mi_fix :: ModIface -> OccName -> Fixity
-- | The semantic module for this interface; e.g., if it's a interface for
-- a signature, if mi_module is p[A=A]:A,
-- mi_semantic_module will be A.
mi_semantic_module :: ModIface -> Module
-- | The "precise" free holes, e.g., the signatures that this
-- ModIface depends on.
mi_free_holes :: ModIface -> UniqDSet ModuleName
-- | Given a set of free holes, and a unit identifier, rename the free
-- holes according to the instantiation of the unit identifier. For
-- example, if we have A and B free, and our unit identity is
-- p[A=C,B=impl:B], the renamed free holes are just C.
renameFreeHoles :: UniqDSet ModuleName -> [(ModuleName, Module)] -> UniqDSet ModuleName
-- | Fixity environment mapping names to their fixities
type FixityEnv = NameEnv FixItem
-- | Fixity information for an Name. We keep the OccName in the
-- range so that we can generate an interface from it
data FixItem
FixItem :: OccName -> Fixity -> FixItem
lookupFixity :: FixityEnv -> Name -> Fixity
emptyFixityEnv :: FixityEnv
-- | A global typecheckable-thing, essentially anything that has a name.
-- Not to be confused with a TcTyThing, which is also a
-- typecheckable thing but in the *local* context. See TcEnv for
-- how to retrieve a TyThing given a Name.
data TyThing
AnId :: Id -> TyThing
AConLike :: ConLike -> TyThing
ATyCon :: TyCon -> TyThing
ACoAxiom :: (CoAxiom Branched) -> TyThing
-- | The Names that a TyThing should bring into scope. Used to build the
-- GlobalRdrEnv for the InteractiveContext.
tyThingAvailInfo :: TyThing -> [AvailInfo]
-- | Get the TyCon from a TyThing if it is a type constructor
-- thing. Panics otherwise
tyThingTyCon :: TyThing -> TyCon
-- | Get the DataCon from a TyThing if it is a data
-- constructor thing. Panics otherwise
tyThingDataCon :: TyThing -> DataCon
-- | Get the ConLike from a TyThing if it is a data
-- constructor thing. Panics otherwise
tyThingConLike :: TyThing -> ConLike
-- | Get the Id from a TyThing if it is a id *or* data
-- constructor thing. Panics otherwise
tyThingId :: TyThing -> Id
-- | Get the CoAxiom from a TyThing if it is a coercion axiom
-- thing. Panics otherwise
tyThingCoAxiom :: TyThing -> CoAxiom Branched
-- | tyThingParent_maybe x returns (Just p) when pprTyThingInContext should
-- print a declaration for p (albeit with some "..." in it) when asked to
-- show x It returns the *immediate* parent. So a datacon returns its
-- tycon but the tycon could be the associated type of a class, so it in
-- turn might have a parent.
tyThingParent_maybe :: TyThing -> Maybe TyThing
tyThingsTyCoVars :: [TyThing] -> TyCoVarSet
-- | Determine the TyThings brought into scope by another
-- TyThing other than itself. For example, Id's don't have
-- any implicit TyThings as they just bring themselves into scope, but
-- classes bring their dictionary datatype, type constructor and some
-- selector functions into scope, just for a start!
implicitTyThings :: TyThing -> [TyThing]
implicitTyConThings :: TyCon -> [TyThing]
implicitClassThings :: Class -> [TyThing]
-- | Returns True if there should be no interface-file declaration
-- for this thing on its own: either it is built-in, or it is part of
-- some other declaration, or it is generated implicitly by some other
-- declaration.
isImplicitTyThing :: TyThing -> Bool
-- | A map from Names to TyThings, constructed by
-- typechecking local declarations or interface files
type TypeEnv = NameEnv TyThing
-- | Find the TyThing for the given Name by using all the
-- resources at our disposal: the compiled modules in the
-- HomePackageTable and the compiled modules in other packages
-- that live in PackageTypeEnv. Note that this does NOT look up
-- the TyThing in the module being compiled: you have to do that
-- yourself, if desired
lookupType :: DynFlags -> HomePackageTable -> PackageTypeEnv -> Name -> Maybe TyThing
-- | As lookupType, but with a marginally easier-to-use interface if
-- you have a HscEnv
lookupTypeHscEnv :: HscEnv -> Name -> IO (Maybe TyThing)
mkTypeEnv :: [TyThing] -> TypeEnv
emptyTypeEnv :: TypeEnv
typeEnvFromEntities :: [Id] -> [TyCon] -> [FamInst] -> TypeEnv
mkTypeEnvWithImplicits :: [TyThing] -> TypeEnv
extendTypeEnv :: TypeEnv -> TyThing -> TypeEnv
extendTypeEnvList :: TypeEnv -> [TyThing] -> TypeEnv
extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnv
plusTypeEnv :: TypeEnv -> TypeEnv -> TypeEnv
lookupTypeEnv :: TypeEnv -> Name -> Maybe TyThing
typeEnvElts :: TypeEnv -> [TyThing]
typeEnvTyCons :: TypeEnv -> [TyCon]
typeEnvIds :: TypeEnv -> [Id]
typeEnvPatSyns :: TypeEnv -> [PatSyn]
typeEnvDataCons :: TypeEnv -> [DataCon]
typeEnvCoAxioms :: TypeEnv -> [CoAxiom Branched]
typeEnvClasses :: TypeEnv -> [Class]
-- | Class that abstracts out the common ability of the monads in GHC to
-- lookup a TyThing in the monadic environment by Name.
-- Provides a number of related convenience functions for accessing
-- particular kinds of TyThing
class Monad m => MonadThings m
lookupThing :: MonadThings m => Name -> m TyThing
lookupId :: MonadThings m => Name -> m Id
lookupDataCon :: MonadThings m => Name -> m DataCon
lookupTyCon :: MonadThings m => Name -> m TyCon
-- | Records whether a module has orphans. An "orphan" is one of:
--
--
-- - An instance declaration in a module other than the definition
-- module for one of the type constructors or classes in the instance
-- head
-- - A transformation rule in a module other than the one defining the
-- function in the head of the rule
-- - A vectorisation pragma
--
type WhetherHasOrphans = Bool
-- | Did this module originate from a *-boot file?
type IsBootInterface = Bool
-- | Records modules for which changes may force recompilation of this
-- module See wiki:
-- http://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/RecompilationAvoidance
--
-- This differs from Dependencies. A module X may be in the dep_mods of
-- this module (via an import chain) but if we don't use anything from X
-- it won't appear in our Usage
data Usage
-- | Module from another package
UsagePackageModule :: Module -> Fingerprint -> IsSafeImport -> Usage
-- | External package module depended on
[usg_mod] :: Usage -> Module
-- | Cached module fingerprint
[usg_mod_hash] :: Usage -> Fingerprint
-- | Was this module imported as a safe import
[usg_safe] :: Usage -> IsSafeImport
-- | Module from the current package | A file upon which the module
-- depends, e.g. a CPP #include, or using TH's addDependentFile
UsageHomeModule :: ModuleName -> Fingerprint -> [(OccName, Fingerprint)] -> Maybe Fingerprint -> IsSafeImport -> Usage
-- | Name of the module
[usg_mod_name] :: Usage -> ModuleName
-- | Cached module fingerprint
[usg_mod_hash] :: Usage -> Fingerprint
-- | Entities we depend on, sorted by occurrence name and fingerprinted.
-- NB: usages are for parent names only, e.g. type constructors but not
-- the associated data constructors.
[usg_entities] :: Usage -> [(OccName, Fingerprint)]
-- | Fingerprint for the export list of this module, if we directly
-- imported it (and hence we depend on its export list)
[usg_exports] :: Usage -> Maybe Fingerprint
-- | Was this module imported as a safe import
[usg_safe] :: Usage -> IsSafeImport
UsageFile :: FilePath -> Fingerprint -> Usage
-- | External file dependency. From a CPP #include or TH addDependentFile.
-- Should be absolute.
[usg_file_path] :: Usage -> FilePath
-- | Fingerprint of the file contents.
[usg_file_hash] :: Usage -> Fingerprint
-- | A requirement which was merged into this one.
UsageMergedRequirement :: Module -> Fingerprint -> Usage
-- | External package module depended on
[usg_mod] :: Usage -> Module
-- | Cached module fingerprint
[usg_mod_hash] :: Usage -> Fingerprint
-- | Dependency information about ALL modules and packages below this one
-- in the import hierarchy.
--
-- Invariant: the dependencies of a module M never includes
-- M.
--
-- Invariant: none of the lists contain duplicates.
data Dependencies
Deps :: [(ModuleName, IsBootInterface)] -> [(InstalledUnitId, Bool)] -> [Module] -> [Module] -> Dependencies
-- | All home-package modules transitively below this one I.e. modules that
-- this one imports, or that are in the dep_mods of those
-- directly-imported modules
[dep_mods] :: Dependencies -> [(ModuleName, IsBootInterface)]
-- | All packages transitively below this module I.e. packages to which
-- this module's direct imports belong, or that are in the dep_pkgs of
-- those modules The bool indicates if the package is required to be
-- trusted when the module is imported as a safe import (Safe Haskell).
-- See Note [RnNames . Tracking Trust Transitively]
[dep_pkgs] :: Dependencies -> [(InstalledUnitId, Bool)]
-- | Transitive closure of orphan modules (whether home or external pkg).
--
-- (Possible optimization: don't include family instance orphans as they
-- are anyway included in dep_finsts. But then be careful about
-- code which relies on dep_orphs having the complete list!) This does
-- NOT include us, unlike imp_orphs.
[dep_orphs] :: Dependencies -> [Module]
-- | Transitive closure of depended upon modules which contain family
-- instances (whether home or external). This is used by
-- checkFamInstConsistency. This does NOT include us, unlike
-- imp_finsts. See Note [The type family instance consistency
-- story].
[dep_finsts] :: Dependencies -> [Module]
noDependencies :: Dependencies
updNameCacheIO :: HscEnv -> (NameCache -> (NameCache, c)) -> IO c
-- | The original names declared of a certain module that are exported
type IfaceExport = AvailInfo
-- | Warning information for a module
data Warnings
-- | Nothing deprecated
NoWarnings :: Warnings
-- | Whole module deprecated
WarnAll :: WarningTxt -> Warnings
-- | Some specific things deprecated
WarnSome :: [(OccName, WarningTxt)] -> Warnings
-- | Warning Text
--
-- reason/explanation from a WARNING or DEPRECATED pragma
data WarningTxt
WarningTxt :: (Located SourceText) -> [Located StringLiteral] -> WarningTxt
DeprecatedTxt :: (Located SourceText) -> [Located StringLiteral] -> WarningTxt
plusWarns :: Warnings -> Warnings -> Warnings
-- | Information we can use to dynamically link modules into the compiler
data Linkable
LM :: UTCTime -> Module -> [Unlinked] -> Linkable
-- | Time at which this linkable was built (i.e. when the bytecodes were
-- produced, or the mod date on the files)
[linkableTime] :: Linkable -> UTCTime
-- | The linkable module itself
[linkableModule] :: Linkable -> Module
-- | Those files and chunks of code we have yet to link.
--
-- INVARIANT: A valid linkable always has at least one Unlinked
-- item. If this list is empty, the Linkable represents a fake linkable,
-- which is generated in HscNothing mode to avoid recompiling modules.
--
-- ToDo: Do items get removed from this list when they get linked?
[linkableUnlinked] :: Linkable -> [Unlinked]
isObjectLinkable :: Linkable -> Bool
linkableObjs :: Linkable -> [FilePath]
-- | Objects which have yet to be linked by the compiler
data Unlinked
-- | An object file (.o)
DotO :: FilePath -> Unlinked
-- | Static archive file (.a)
DotA :: FilePath -> Unlinked
-- | Dynamically linked library file (.so, .dll, .dylib)
DotDLL :: FilePath -> Unlinked
-- | A byte-code object, lives only in memory. Also carries some static
-- pointer table entries which should be loaded along with the BCOs. See
-- Note [Grant plan for static forms] in StaticPtrTable.
BCOs :: CompiledByteCode -> [SptEntry] -> Unlinked
data CompiledByteCode
-- | Is this an actual file on disk we can link in somehow?
isObject :: Unlinked -> Bool
-- | Retrieve the filename of the linkable if possible. Panic if it is a
-- byte-code object
nameOfObject :: Unlinked -> FilePath
-- | Is this a bytecode linkable with no file on disk?
isInterpretable :: Unlinked -> Bool
-- | Retrieve the compiled byte-code if possible. Panic if it is a
-- file-based linkable
byteCodeOfObject :: Unlinked -> CompiledByteCode
-- | Information about a modules use of Haskell Program Coverage
data HpcInfo
HpcInfo :: Int -> Int -> HpcInfo
[hpcInfoTickCount] :: HpcInfo -> Int
[hpcInfoHash] :: HpcInfo -> Int
NoHpcInfo :: AnyHpcUsage -> HpcInfo
-- | Is hpc used anywhere on the module *tree*?
[hpcUsed] :: HpcInfo -> AnyHpcUsage
emptyHpcInfo :: AnyHpcUsage -> HpcInfo
-- | Find out if HPC is used by this module or any of the modules it
-- depends upon
isHpcUsed :: HpcInfo -> AnyHpcUsage
-- | This is used to signal if one of my imports used HPC instrumentation
-- even if there is no module-local HPC usage
type AnyHpcUsage = Bool
-- | All the information about the breakpoints for a module
data ModBreaks
ModBreaks :: ForeignRef BreakArray -> !(Array BreakIndex SrcSpan) -> !(Array BreakIndex [OccName]) -> !(Array BreakIndex [String]) -> !(Array BreakIndex (RemotePtr CostCentre)) -> IntMap CgBreakInfo -> ModBreaks
-- | The array of flags, one per breakpoint, indicating which breakpoints
-- are enabled.
[modBreaks_flags] :: ModBreaks -> ForeignRef BreakArray
-- | An array giving the source span of each breakpoint.
[modBreaks_locs] :: ModBreaks -> !(Array BreakIndex SrcSpan)
-- | An array giving the names of the free variables at each breakpoint.
[modBreaks_vars] :: ModBreaks -> !(Array BreakIndex [OccName])
-- | An array giving the names of the declarations enclosing each
-- breakpoint.
[modBreaks_decls] :: ModBreaks -> !(Array BreakIndex [String])
-- | Array pointing to cost centre for each breakpoint
[modBreaks_ccs] :: ModBreaks -> !(Array BreakIndex (RemotePtr CostCentre))
-- | info about each breakpoint from the bytecode generator
[modBreaks_breakInfo] :: ModBreaks -> IntMap CgBreakInfo
-- | Construct an empty ModBreaks
emptyModBreaks :: ModBreaks
-- | Vectorisation information for ModGuts, ModDetails and
-- ExternalPackageState; see also documentation at
-- GlobalEnv.
--
-- NB: The following tables may also include Vars, TyCons
-- and DataCons from imported modules, which have been
-- subsequently vectorised in the current module.
data VectInfo
VectInfo :: DVarEnv (Var, Var) -> NameEnv (TyCon, TyCon) -> NameEnv (DataCon, DataCon) -> DVarSet -> NameSet -> VectInfo
-- | (f, f_v) keyed on f
[vectInfoVar] :: VectInfo -> DVarEnv (Var, Var)
-- | (T, T_v) keyed on T
[vectInfoTyCon] :: VectInfo -> NameEnv (TyCon, TyCon)
-- | (C, C_v) keyed on C
[vectInfoDataCon] :: VectInfo -> NameEnv (DataCon, DataCon)
-- | set of parallel variables
[vectInfoParallelVars] :: VectInfo -> DVarSet
-- | set of parallel type constructors
[vectInfoParallelTyCons] :: VectInfo -> NameSet
-- | Vectorisation information for ModIface; i.e, the vectorisation
-- information propagated across module boundaries.
--
-- NB: The field ifaceVectInfoVar explicitly contains the workers
-- of data constructors as well as class selectors — i.e., their mappings
-- are not implicitly generated from the data types. Moreover,
-- whether the worker of a data constructor is in ifaceVectInfoVar
-- determines whether that data constructor was vectorised (or is part of
-- an abstractly vectorised type constructor).
data IfaceVectInfo
IfaceVectInfo :: [Name] -> [Name] -> [Name] -> [Name] -> [Name] -> IfaceVectInfo
-- | All variables in here have a vectorised variant
[ifaceVectInfoVar] :: IfaceVectInfo -> [Name]
-- | All TyCons in here have a vectorised variant; the name of the
-- vectorised variant and those of its data constructors are determined
-- by mkVectTyConOcc and mkVectDataConOcc; the names of the
-- isomorphisms are determined by mkVectIsoOcc
[ifaceVectInfoTyCon] :: IfaceVectInfo -> [Name]
-- | The vectorised form of all the TyCons in here coincides with
-- the unconverted form; the name of the isomorphisms is determined by
-- mkVectIsoOcc
[ifaceVectInfoTyConReuse] :: IfaceVectInfo -> [Name]
[ifaceVectInfoParallelVars] :: IfaceVectInfo -> [Name]
[ifaceVectInfoParallelTyCons] :: IfaceVectInfo -> [Name]
noVectInfo :: VectInfo
plusVectInfo :: VectInfo -> VectInfo -> VectInfo
noIfaceVectInfo :: IfaceVectInfo
isNoIfaceVectInfo :: IfaceVectInfo -> Bool
-- | Safe Haskell information for ModIface Simply a wrapper around
-- SafeHaskellMode to sepperate iface and flags
data IfaceTrustInfo
getSafeMode :: IfaceTrustInfo -> SafeHaskellMode
setSafeMode :: SafeHaskellMode -> IfaceTrustInfo
noIfaceTrustInfo :: IfaceTrustInfo
trustInfoToNum :: IfaceTrustInfo -> Word8
numToTrustInfo :: Word8 -> IfaceTrustInfo
-- | Is an import a safe import?
type IsSafeImport = Bool
data HsParsedModule
HsParsedModule :: Located (HsModule RdrName) -> [FilePath] -> ApiAnns -> HsParsedModule
[hpm_module] :: HsParsedModule -> Located (HsModule RdrName)
-- | extra source files (e.g. from #includes). The lexer collects these
-- from '# file line' pragmas, which the C preprocessor
-- leaves behind. These files and their timestamps are stored in the .hi
-- file, so that we can force recompilation if any of them change (#3589)
[hpm_src_files] :: HsParsedModule -> [FilePath]
[hpm_annotations] :: HsParsedModule -> ApiAnns
-- | A source error is an error that is caused by one or more errors in the
-- source code. A SourceError is thrown by many functions in the
-- compilation pipeline. Inside GHC these errors are merely printed via
-- log_action, but API clients may treat them differently, for
-- example, insert them into a list box. If you want the default
-- behaviour, use the idiom:
--
--
-- handleSourceError printExceptionAndWarnings $ do
-- ... api calls that may fail ...
--
--
-- The SourceErrors error messages can be accessed via
-- srcErrorMessages. This list may be empty if the compiler failed
-- due to -Werror (Opt_WarnIsError).
--
-- See printExceptionAndWarnings for more information on what to
-- take care of when writing a custom error handler.
data SourceError
-- | An error thrown if the GHC API is used in an incorrect fashion.
data GhcApiError
mkSrcErr :: ErrorMessages -> SourceError
srcErrorMessages :: SourceError -> ErrorMessages
mkApiErr :: DynFlags -> SDoc -> GhcApiError
throwOneError :: MonadIO m => ErrMsg -> m ab
-- | Perform the given action and call the exception handler if the action
-- throws a SourceError. See SourceError for more
-- information.
handleSourceError :: (ExceptionMonad m) => (SourceError -> m a) -> m a -> m a
handleFlagWarnings :: DynFlags -> [Located String] -> IO ()
-- | Given a bag of warnings, turn them into an exception if -Werror is
-- enabled, or print them out otherwise.
printOrThrowWarnings :: DynFlags -> Bag WarnMsg -> IO ()
-- | A list of conlikes which represents a complete pattern match. These
-- arise from COMPLETE signatures.
data CompleteMatch
CompleteMatch :: [Name] -> Name -> CompleteMatch
-- | The ConLikes that form a covering family (e.g. Nothing, Just)
[completeMatchConLikes] :: CompleteMatch -> [Name]
-- | The TyCon that they cover (e.g. Maybe)
[completeMatchTyCon] :: CompleteMatch -> Name
-- | A map keyed by the completeMatchTyCon.
type CompleteMatchMap = UniqFM [CompleteMatch]
mkCompleteMatchMap :: [CompleteMatch] -> CompleteMatchMap
extendCompleteMatchMap :: CompleteMatchMap -> [CompleteMatch] -> CompleteMatchMap
instance GHC.Classes.Eq HscTypes.Usage
instance GHC.Classes.Eq HscTypes.Dependencies
instance GHC.Classes.Eq HscTypes.Warnings
instance GHC.Classes.Eq HscTypes.TargetId
instance GHC.Base.Functor HscTypes.Hsc
instance GHC.Base.Applicative HscTypes.Hsc
instance GHC.Base.Monad HscTypes.Hsc
instance Control.Monad.IO.Class.MonadIO HscTypes.Hsc
instance DynFlags.HasDynFlags HscTypes.Hsc
instance Outputable.Outputable HscTypes.CompleteMatch
instance Outputable.Outputable HscTypes.Linkable
instance Outputable.Outputable HscTypes.Unlinked
instance Outputable.Outputable HscTypes.ModSummary
instance Binary.Binary HscTypes.ModIface
instance Outputable.Outputable HscTypes.IfaceTrustInfo
instance Binary.Binary HscTypes.IfaceTrustInfo
instance Binary.Binary HscTypes.Usage
instance Outputable.Outputable HscTypes.IfaceVectInfo
instance Binary.Binary HscTypes.IfaceVectInfo
instance Outputable.Outputable HscTypes.VectInfo
instance Binary.Binary HscTypes.Dependencies
instance Outputable.Outputable HscTypes.FixItem
instance Binary.Binary HscTypes.Warnings
instance Outputable.Outputable HscTypes.InteractiveImport
instance Outputable.Outputable HscTypes.SptEntry
instance Outputable.Outputable HscTypes.Target
instance Outputable.Outputable HscTypes.TargetId
instance GHC.Show.Show HscTypes.GhcApiError
instance GHC.Exception.Exception HscTypes.GhcApiError
instance GHC.Show.Show HscTypes.SourceError
instance GHC.Exception.Exception HscTypes.SourceError
module TcRnTypes
type TcRnIf a b = IOEnv (Env a b)
type TcRn = TcRnIf TcGblEnv TcLclEnv
-- | Historical "type-checking monad" (now it's just TcRn).
type TcM = TcRn
-- | Historical "renaming monad" (now it's just TcRn).
type RnM = TcRn
type IfM lcl = TcRnIf IfGblEnv lcl
type IfL = IfM IfLclEnv
type IfG = IfM ()
-- | Type alias for IORef; the convention is we'll use this for
-- mutable bits of data in TcGblEnv which are updated during
-- typechecking and returned at the end.
type TcRef a = IORef a
data Env gbl lcl
Env :: HscEnv -> {-# UNPACK #-} !(IORef UniqSupply) -> gbl -> lcl -> Env gbl lcl
[env_top] :: Env gbl lcl -> HscEnv
[env_us] :: Env gbl lcl -> {-# UNPACK #-} !(IORef UniqSupply)
[env_gbl] :: Env gbl lcl -> gbl
[env_lcl] :: Env gbl lcl -> lcl
-- | TcGblEnv describes the top-level of the module at the point at
-- which the typechecker is finished work. It is this structure that is
-- handed on to the desugarer For state that needs to be updated during
-- the typechecking phase and returned at end, use a TcRef (=
-- IORef).
data TcGblEnv
TcGblEnv :: Module -> Module -> HscSource -> GlobalRdrEnv -> Maybe [Type] -> FixityEnv -> RecFieldEnv -> TypeEnv -> TcRef TypeEnv -> InstEnv -> FamInstEnv -> AnnEnv -> NameEnv [([FamInst], FamInstEnv)] -> [AvailInfo] -> ImportAvails -> DefUses -> TcRef [GlobalRdrElt] -> TcRef NameSet -> TcRef Bool -> TcRef Bool -> TcRef (Set RealSrcSpan) -> TcRef OccSet -> [(Module, Fingerprint)] -> Maybe [Located (IE Name)] -> [LImportDecl Name] -> Maybe (HsGroup Name) -> TcRef [FilePath] -> TcRef [LHsDecl RdrName] -> TcRef [(ForeignSrcLang, String)] -> TcRef NameSet -> TcRef [TcM ()] -> TcRef (Map TypeRep Dynamic) -> TcRef (Maybe (ForeignRef (IORef QState))) -> Bag EvBind -> Maybe Id -> LHsBinds Id -> NameSet -> [LTcSpecPrag] -> Warnings -> [Annotation] -> [TyCon] -> [ClsInst] -> [FamInst] -> [LRuleDecl Id] -> [LForeignDecl Id] -> [LVectDecl Id] -> [PatSyn] -> Maybe LHsDocString -> AnyHpcUsage -> SelfBootInfo -> Maybe Name -> TcRef (Bool, WarningMessages) -> [TcPluginSolver] -> RealSrcSpan -> TcRef WantedConstraints -> [CompleteMatch] -> TcGblEnv
-- | Module being compiled
[tcg_mod] :: TcGblEnv -> Module
-- | If a signature, the backing module See also Note [Identity versus
-- semantic module]
[tcg_semantic_mod] :: TcGblEnv -> Module
-- | What kind of module (regular Haskell, hs-boot, hsig)
[tcg_src] :: TcGblEnv -> HscSource
-- | Top level envt; used during renaming
[tcg_rdr_env] :: TcGblEnv -> GlobalRdrEnv
-- | Types used for defaulting. Nothing => no default
-- decl
[tcg_default] :: TcGblEnv -> Maybe [Type]
-- | Just for things in this module
[tcg_fix_env] :: TcGblEnv -> FixityEnv
-- | Just for things in this module See Note [The interactive package] in
-- HscTypes
[tcg_field_env] :: TcGblEnv -> RecFieldEnv
-- | Global type env for the module we are compiling now. All TyCons and
-- Classes (for this module) end up in here right away, along with their
-- derived constructors, selectors.
--
-- (Ids defined in this module start in the local envt, though they move
-- to the global envt during zonking)
--
-- NB: for what "things in this module" means, see Note [The interactive
-- package] in HscTypes
[tcg_type_env] :: TcGblEnv -> TypeEnv
[tcg_type_env_var] :: TcGblEnv -> TcRef TypeEnv
-- | Instance envt for all home-package modules; Includes the dfuns
-- in tcg_insts
[tcg_inst_env] :: TcGblEnv -> InstEnv
-- | Ditto for family instances
[tcg_fam_inst_env] :: TcGblEnv -> FamInstEnv
-- | And for annotations
[tcg_ann_env] :: TcGblEnv -> AnnEnv
-- | Family instances we have to check for consistency. Invariant: each
-- FamInst in the list's fi_fam matches the key of the entry in the
-- NameEnv. This gets consumed by
-- checkRecFamInstConsistency. See Note [Don't check hs-boot
-- type family instances too early]
[tcg_pending_fam_checks] :: TcGblEnv -> NameEnv [([FamInst], FamInstEnv)]
-- | What is exported
[tcg_exports] :: TcGblEnv -> [AvailInfo]
-- | Information about what was imported from where, including things bound
-- in this module. Also store Safe Haskell info here about transative
-- trusted packaage requirements.
[tcg_imports] :: TcGblEnv -> ImportAvails
-- | What is defined in this module and what is used.
[tcg_dus] :: TcGblEnv -> DefUses
-- | Records occurrences of imported entities See Note [Tracking unused
-- binding and imports]
[tcg_used_gres] :: TcGblEnv -> TcRef [GlobalRdrElt]
-- | Locally-defined top-level names to keep alive.
--
-- "Keep alive" means give them an Exported flag, so that the simplifier
-- does not discard them as dead code, and so that they are exposed in
-- the interface file (but not to export to the user).
--
-- Some things, like dict-fun Ids and default-method Ids are "born" with
-- the Exported flag on, for exactly the above reason, but some we only
-- discover as we go. Specifically:
--
--
-- - The to/from functions for generic data types
-- - Top-level variables appearing free in the RHS of an orphan
-- rule
-- - Top-level variables appearing free in a TH bracket
--
[tcg_keep] :: TcGblEnv -> TcRef NameSet
-- | True = Template Haskell syntax used.
--
-- We need this so that we can generate a dependency on the Template
-- Haskell package, because the desugarer is going to emit loads of
-- references to TH symbols. The reference is implicit rather than
-- explicit, so we have to zap a mutable variable.
[tcg_th_used] :: TcGblEnv -> TcRef Bool
-- | True = A Template Haskell splice was used.
--
-- Splices disable recompilation avoidance (see #481)
[tcg_th_splice_used] :: TcGblEnv -> TcRef Bool
-- | Locations of the top-level splices; used for providing details on
-- scope in error messages for out-of-scope variables
[tcg_th_top_level_locs] :: TcGblEnv -> TcRef (Set RealSrcSpan)
-- | Allows us to choose unique DFun names.
[tcg_dfun_n] :: TcGblEnv -> TcRef OccSet
-- | The requirements we merged with; we always have to recompile if any of
-- these changed.
[tcg_merged] :: TcGblEnv -> [(Module, Fingerprint)]
[tcg_rn_exports] :: TcGblEnv -> Maybe [Located (IE Name)]
[tcg_rn_imports] :: TcGblEnv -> [LImportDecl Name]
-- | Renamed decls, maybe. Nothing = Don't retain renamed
-- decls.
[tcg_rn_decls] :: TcGblEnv -> Maybe (HsGroup Name)
-- | dependencies from addDependentFile
[tcg_dependent_files] :: TcGblEnv -> TcRef [FilePath]
-- | Top-level declarations from addTopDecls
[tcg_th_topdecls] :: TcGblEnv -> TcRef [LHsDecl RdrName]
-- | Foreign files emitted from TH.
[tcg_th_foreign_files] :: TcGblEnv -> TcRef [(ForeignSrcLang, String)]
-- | Exact names bound in top-level declarations in tcg_th_topdecls
[tcg_th_topnames] :: TcGblEnv -> TcRef NameSet
-- | Template Haskell module finalizers.
--
-- They are computations in the TcM monad rather than Q
-- because we set them to use particular local environments.
[tcg_th_modfinalizers] :: TcGblEnv -> TcRef [TcM ()]
[tcg_th_state] :: TcGblEnv -> TcRef (Map TypeRep Dynamic)
-- | Template Haskell state
[tcg_th_remote_state] :: TcGblEnv -> TcRef (Maybe (ForeignRef (IORef QState)))
[tcg_ev_binds] :: TcGblEnv -> Bag EvBind
[tcg_tr_module] :: TcGblEnv -> Maybe Id
[tcg_binds] :: TcGblEnv -> LHsBinds Id
[tcg_sigs] :: TcGblEnv -> NameSet
[tcg_imp_specs] :: TcGblEnv -> [LTcSpecPrag]
[tcg_warns] :: TcGblEnv -> Warnings
[tcg_anns] :: TcGblEnv -> [Annotation]
[tcg_tcs] :: TcGblEnv -> [TyCon]
[tcg_insts] :: TcGblEnv -> [ClsInst]
[tcg_fam_insts] :: TcGblEnv -> [FamInst]
[tcg_rules] :: TcGblEnv -> [LRuleDecl Id]
[tcg_fords] :: TcGblEnv -> [LForeignDecl Id]
[tcg_vects] :: TcGblEnv -> [LVectDecl Id]
[tcg_patsyns] :: TcGblEnv -> [PatSyn]
-- | Maybe Haddock header docs
[tcg_doc_hdr] :: TcGblEnv -> Maybe LHsDocString
-- | True if any part of the prog uses hpc instrumentation.
[tcg_hpc] :: TcGblEnv -> AnyHpcUsage
-- | Whether this module has a corresponding hi-boot file
[tcg_self_boot] :: TcGblEnv -> SelfBootInfo
-- | The Name of the main function, if this module is the main module.
[tcg_main] :: TcGblEnv -> Maybe Name
-- | Has the typechecker inferred this module as -XSafe (Safe Haskell) See
-- Note [Safe Haskell Overlapping Instances Implementation], although
-- this is used for more than just that failure case.
[tcg_safeInfer] :: TcGblEnv -> TcRef (Bool, WarningMessages)
-- | A list of user-defined plugins for the constraint solver.
[tcg_tc_plugins] :: TcGblEnv -> [TcPluginSolver]
-- | The RealSrcSpan this module came from
[tcg_top_loc] :: TcGblEnv -> RealSrcSpan
-- | Wanted constraints of static forms. See Note [Constraints in static
-- forms].
[tcg_static_wc] :: TcGblEnv -> TcRef WantedConstraints
[tcg_complete_matches] :: TcGblEnv -> [CompleteMatch]
data TcLclEnv
TcLclEnv :: RealSrcSpan -> [ErrCtxt] -> TcLevel -> ThStage -> ThBindEnv -> ArrowCtxt -> LocalRdrEnv -> TcTypeEnv -> TcIdBinderStack -> TidyEnv -> TcRef TcTyVarSet -> TcRef WantedConstraints -> TcRef Messages -> TcLclEnv
[tcl_loc] :: TcLclEnv -> RealSrcSpan
[tcl_ctxt] :: TcLclEnv -> [ErrCtxt]
[tcl_tclvl] :: TcLclEnv -> TcLevel
[tcl_th_ctxt] :: TcLclEnv -> ThStage
[tcl_th_bndrs] :: TcLclEnv -> ThBindEnv
[tcl_arrow_ctxt] :: TcLclEnv -> ArrowCtxt
[tcl_rdr] :: TcLclEnv -> LocalRdrEnv
[tcl_env] :: TcLclEnv -> TcTypeEnv
[tcl_bndrs] :: TcLclEnv -> TcIdBinderStack
[tcl_tidy] :: TcLclEnv -> TidyEnv
[tcl_tyvars] :: TcLclEnv -> TcRef TcTyVarSet
[tcl_lie] :: TcLclEnv -> TcRef WantedConstraints
[tcl_errs] :: TcLclEnv -> TcRef Messages
data IfGblEnv
IfGblEnv :: SDoc -> Maybe (Module, IfG TypeEnv) -> IfGblEnv
[if_doc] :: IfGblEnv -> SDoc
[if_rec_types] :: IfGblEnv -> Maybe (Module, IfG TypeEnv)
data IfLclEnv
IfLclEnv :: Module -> Bool -> SDoc -> Maybe NameShape -> Maybe TypeEnv -> FastStringEnv TyVar -> FastStringEnv Id -> IfLclEnv
[if_mod] :: IfLclEnv -> Module
[if_boot] :: IfLclEnv -> Bool
[if_loc] :: IfLclEnv -> SDoc
[if_nsubst] :: IfLclEnv -> Maybe NameShape
[if_implicits_env] :: IfLclEnv -> Maybe TypeEnv
[if_tv_env] :: IfLclEnv -> FastStringEnv TyVar
[if_id_env] :: IfLclEnv -> FastStringEnv Id
tcVisibleOrphanMods :: TcGblEnv -> ModuleSet
-- | FrontendResult describes the result of running the frontend of
-- a Haskell module. Usually, you'll get a FrontendTypecheck,
-- since running the frontend involves typechecking a program, but for an
-- hs-boot merge you'll just get a ModIface, since no actual typechecking
-- occurred.
--
-- This data type really should be in HscTypes, but it needs to have a
-- TcGblEnv which is only defined here.
data FrontendResult
FrontendTypecheck :: TcGblEnv -> FrontendResult
type ErrCtxt = (Bool, TidyEnv -> TcM (TidyEnv, MsgDoc))
type RecFieldEnv = NameEnv [FieldLabel]
-- | ImportAvails summarises what was imported from where,
-- irrespective of whether the imported things are actually used or not.
-- It is used:
--
--
-- - when processing the export list,
-- - when constructing usage info for the interface file,
-- - to identify the list of directly imported modules for
-- initialisation purposes and for optimised overlap checking of family
-- instances,
-- - when figuring out what things are really unused
--
data ImportAvails
ImportAvails :: ImportedMods -> ModuleNameEnv (ModuleName, IsBootInterface) -> Set InstalledUnitId -> Set InstalledUnitId -> Bool -> [Module] -> [Module] -> ImportAvails
-- | Domain is all directly-imported modules
--
-- See the documentation on ImportedModsVal in HscTypes for the meaning
-- of the fields.
--
-- We need a full ModuleEnv rather than a ModuleNameEnv here, because we
-- might be importing modules of the same name from different packages.
-- (currently not the case, but might be in the future).
[imp_mods] :: ImportAvails -> ImportedMods
-- | Home-package modules needed by the module being compiled
--
-- It doesn't matter whether any of these dependencies are actually
-- used when compiling the module; they are listed if they are
-- below it at all. For example, suppose M imports A which imports X.
-- Then compiling M might not need to consult X.hi, but X is still listed
-- in M's dependencies.
[imp_dep_mods] :: ImportAvails -> ModuleNameEnv (ModuleName, IsBootInterface)
-- | Packages needed by the module being compiled, whether directly, or via
-- other modules in this package, or via modules imported from other
-- packages.
[imp_dep_pkgs] :: ImportAvails -> Set InstalledUnitId
-- | This is strictly a subset of imp_dep_pkgs and records the packages the
-- current module needs to trust for Safe Haskell compilation to succeed.
-- A package is required to be trusted if we are dependent on a
-- trustworthy module in that package. While perhaps making imp_dep_pkgs
-- a tuple of (UnitId, Bool) where True for the bool indicates the
-- package is required to be trusted is the more logical design, doing so
-- complicates a lot of code not concerned with Safe Haskell. See Note
-- [RnNames . Tracking Trust Transitively]
[imp_trust_pkgs] :: ImportAvails -> Set InstalledUnitId
-- | Do we require that our own package is trusted? This is to handle
-- efficiently the case where a Safe module imports a Trustworthy module
-- that resides in the same package as it. See Note [RnNames . Trust Own
-- Package]
[imp_trust_own_pkg] :: ImportAvails -> Bool
-- | Orphan modules below us in the import tree (and maybe including us for
-- imported modules)
[imp_orphs] :: ImportAvails -> [Module]
-- | Family instance modules below us in the import tree (and maybe
-- including us for imported modules)
[imp_finsts] :: ImportAvails -> [Module]
emptyImportAvails :: ImportAvails
-- | Union two ImportAvails
--
-- This function is a key part of Import handling, basically for each
-- import we create a separate ImportAvails structure and then union them
-- all together with this function.
plusImportAvails :: ImportAvails -> ImportAvails -> ImportAvails
data WhereFrom
ImportByUser :: IsBootInterface -> WhereFrom
ImportBySystem :: WhereFrom
ImportByPlugin :: WhereFrom
mkModDeps :: [(ModuleName, IsBootInterface)] -> ModuleNameEnv (ModuleName, IsBootInterface)
modDepsElts :: ModuleNameEnv (ModuleName, IsBootInterface) -> [(ModuleName, IsBootInterface)]
type TcTypeEnv = NameEnv TcTyThing
type TcIdBinderStack = [TcIdBinder]
data TcIdBinder
TcIdBndr :: TcId -> TopLevelFlag -> TcIdBinder
TcIdBndr_ExpType :: Name -> ExpType -> TopLevelFlag -> TcIdBinder
-- | A typecheckable thing available in a local context. Could be
-- AGlobal TyThing, but also lexically scoped variables,
-- etc. See TcEnv for how to retrieve a TyThing given a
-- Name.
data TcTyThing
AGlobal :: TyThing -> TcTyThing
ATcId :: TcId -> IdBindingInfo -> TcTyThing
[tct_id] :: TcTyThing -> TcId
[tct_info] :: TcTyThing -> IdBindingInfo
ATyVar :: Name -> TcTyVar -> TcTyThing
ATcTyCon :: TyCon -> TcTyThing
APromotionErr :: PromotionErr -> TcTyThing
data PromotionErr
TyConPE :: PromotionErr
ClassPE :: PromotionErr
FamDataConPE :: PromotionErr
PatSynPE :: PromotionErr
RecDataConPE :: PromotionErr
NoDataKindsTC :: PromotionErr
NoDataKindsDC :: PromotionErr
NoTypeInTypeTC :: PromotionErr
NoTypeInTypeDC :: PromotionErr
-- | IdBindingInfo describes how an Id is bound.
--
-- It is used for the following purposes: a) for static forms in
-- TcExpr.checkClosedInStaticForm and b) to figure out when a nested
-- binding can be generalised, in TcBinds.decideGeneralisationPlan.
data IdBindingInfo
NotLetBound :: IdBindingInfo
ClosedLet :: IdBindingInfo
NonClosedLet :: RhsNames -> ClosedTypeId -> IdBindingInfo
type ClosedTypeId = Bool
type RhsNames = NameSet
-- | IsGroupClosed describes a group of mutually-recursive bindings
data IsGroupClosed
IsGroupClosed :: (NameEnv RhsNames) -> ClosedTypeId -> IsGroupClosed
data SelfBootInfo
NoSelfBoot :: SelfBootInfo
SelfBoot :: ModDetails -> NameSet -> SelfBootInfo
[sb_mds] :: SelfBootInfo -> ModDetails
[sb_tcs] :: SelfBootInfo -> NameSet
pprTcTyThingCategory :: TcTyThing -> SDoc
pprPECategory :: PromotionErr -> SDoc
-- | A list of conlikes which represents a complete pattern match. These
-- arise from COMPLETE signatures.
data CompleteMatch
CompleteMatch :: [Name] -> Name -> CompleteMatch
-- | The ConLikes that form a covering family (e.g. Nothing, Just)
[completeMatchConLikes] :: CompleteMatch -> [Name]
-- | The TyCon that they cover (e.g. Maybe)
[completeMatchTyCon] :: CompleteMatch -> Name
type DsM = TcRnIf DsGblEnv DsLclEnv
data DsLclEnv
DsLclEnv :: DsMetaEnv -> RealSrcSpan -> Bag EvVar -> Bag SimpleEq -> IORef Int -> DsLclEnv
[dsl_meta] :: DsLclEnv -> DsMetaEnv
[dsl_loc] :: DsLclEnv -> RealSrcSpan
[dsl_dicts] :: DsLclEnv -> Bag EvVar
[dsl_tm_cs] :: DsLclEnv -> Bag SimpleEq
[dsl_pm_iter] :: DsLclEnv -> IORef Int
data DsGblEnv
DsGblEnv :: Module -> FamInstEnv -> PrintUnqualified -> IORef Messages -> (IfGblEnv, IfLclEnv) -> GlobalRdrEnv -> PArrBuiltin -> CompleteMatchMap -> DsGblEnv
[ds_mod] :: DsGblEnv -> Module
[ds_fam_inst_env] :: DsGblEnv -> FamInstEnv
[ds_unqual] :: DsGblEnv -> PrintUnqualified
[ds_msgs] :: DsGblEnv -> IORef Messages
[ds_if_env] :: DsGblEnv -> (IfGblEnv, IfLclEnv)
[ds_dph_env] :: DsGblEnv -> GlobalRdrEnv
[ds_parr_bi] :: DsGblEnv -> PArrBuiltin
[ds_complete_matches] :: DsGblEnv -> CompleteMatchMap
data PArrBuiltin
PArrBuiltin :: Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> PArrBuiltin
-- | lengthP
[lengthPVar] :: PArrBuiltin -> Var
-- | replicateP
[replicatePVar] :: PArrBuiltin -> Var
-- | singletonP
[singletonPVar] :: PArrBuiltin -> Var
-- | mapP
[mapPVar] :: PArrBuiltin -> Var
-- | filterP
[filterPVar] :: PArrBuiltin -> Var
-- | zipP
[zipPVar] :: PArrBuiltin -> Var
-- | crossMapP
[crossMapPVar] :: PArrBuiltin -> Var
-- | (!:)
[indexPVar] :: PArrBuiltin -> Var
-- | emptyP
[emptyPVar] :: PArrBuiltin -> Var
-- | (+:+)
[appPVar] :: PArrBuiltin -> Var
-- | enumFromToP
[enumFromToPVar] :: PArrBuiltin -> Var
-- | enumFromThenToP
[enumFromThenToPVar] :: PArrBuiltin -> Var
type DsMetaEnv = NameEnv DsMetaVal
data DsMetaVal
DsBound :: Id -> DsMetaVal
DsSplice :: (HsExpr Id) -> DsMetaVal
-- | A map keyed by the completeMatchTyCon.
type CompleteMatchMap = UniqFM [CompleteMatch]
mkCompleteMatchMap :: [CompleteMatch] -> CompleteMatchMap
extendCompleteMatchMap :: CompleteMatchMap -> [CompleteMatch] -> CompleteMatchMap
data ThStage
Splice :: SpliceType -> ThStage
RunSplice :: (TcRef [ForeignRef (Q ())]) -> ThStage
Comp :: ThStage
Brack :: ThStage -> PendingStuff -> ThStage
data SpliceType
Typed :: SpliceType
Untyped :: SpliceType
data PendingStuff
RnPendingUntyped :: (TcRef [PendingRnSplice]) -> PendingStuff
RnPendingTyped :: PendingStuff
TcPending :: (TcRef [PendingTcSplice]) -> (TcRef WantedConstraints) -> PendingStuff
topStage :: ThStage
topAnnStage :: ThStage
topSpliceStage :: ThStage
type ThLevel = Int
impLevel :: ThLevel
outerLevel :: ThLevel
thLevel :: ThStage -> ThLevel
data ForeignSrcLang :: *
LangC :: ForeignSrcLang
LangCxx :: ForeignSrcLang
LangObjc :: ForeignSrcLang
LangObjcxx :: ForeignSrcLang
data ArrowCtxt
NoArrowCtxt :: ArrowCtxt
ArrowCtxt :: LocalRdrEnv -> (TcRef WantedConstraints) -> ArrowCtxt
type TcSigFun = Name -> Maybe TcSigInfo
data TcSigInfo
TcIdSig :: TcIdSigInfo -> TcSigInfo
TcPatSynSig :: TcPatSynInfo -> TcSigInfo
data TcIdSigInfo
CompleteSig :: TcId -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo
[sig_bndr] :: TcIdSigInfo -> TcId
[sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt
[sig_loc] :: TcIdSigInfo -> SrcSpan
PartialSig :: Name -> LHsSigWcType Name -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo
[psig_name] :: TcIdSigInfo -> Name
[psig_hs_ty] :: TcIdSigInfo -> LHsSigWcType Name
[sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt
[sig_loc] :: TcIdSigInfo -> SrcSpan
data TcIdSigInst
TISI :: TcIdSigInfo -> [(Name, TcTyVar)] -> TcThetaType -> TcSigmaType -> [(Name, TcTyVar)] -> Maybe TcTyVar -> TcIdSigInst
[sig_inst_sig] :: TcIdSigInst -> TcIdSigInfo
[sig_inst_skols] :: TcIdSigInst -> [(Name, TcTyVar)]
[sig_inst_theta] :: TcIdSigInst -> TcThetaType
[sig_inst_tau] :: TcIdSigInst -> TcSigmaType
[sig_inst_wcs] :: TcIdSigInst -> [(Name, TcTyVar)]
[sig_inst_wcx] :: TcIdSigInst -> Maybe TcTyVar
data TcPatSynInfo
TPSI :: Name -> [TyVarBinder] -> [TyVar] -> TcThetaType -> [TyVar] -> TcThetaType -> TcSigmaType -> TcPatSynInfo
[patsig_name] :: TcPatSynInfo -> Name
[patsig_implicit_bndrs] :: TcPatSynInfo -> [TyVarBinder]
[patsig_univ_bndrs] :: TcPatSynInfo -> [TyVar]
[patsig_req] :: TcPatSynInfo -> TcThetaType
[patsig_ex_bndrs] :: TcPatSynInfo -> [TyVar]
[patsig_prov] :: TcPatSynInfo -> TcThetaType
[patsig_body_ty] :: TcPatSynInfo -> TcSigmaType
isPartialSig :: TcIdSigInst -> Bool
-- | No signature or a partial signature
hasCompleteSig :: TcSigFun -> Name -> Bool
type Xi = Type
data Ct
CDictCan :: CtEvidence -> Class -> [Xi] -> Bool -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_class] :: Ct -> Class
[cc_tyargs] :: Ct -> [Xi]
[cc_pend_sc] :: Ct -> Bool
CIrredEvCan :: CtEvidence -> Ct
[cc_ev] :: Ct -> CtEvidence
CTyEqCan :: CtEvidence -> TcTyVar -> TcType -> EqRel -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_tyvar] :: Ct -> TcTyVar
[cc_rhs] :: Ct -> TcType
[cc_eq_rel] :: Ct -> EqRel
CFunEqCan :: CtEvidence -> TyCon -> [Xi] -> TcTyVar -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_fun] :: Ct -> TyCon
[cc_tyargs] :: Ct -> [Xi]
[cc_fsk] :: Ct -> TcTyVar
CNonCanonical :: CtEvidence -> Ct
[cc_ev] :: Ct -> CtEvidence
CHoleCan :: CtEvidence -> Hole -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_hole] :: Ct -> Hole
type Cts = Bag Ct
emptyCts :: Cts
andCts :: Cts -> Cts -> Cts
andManyCts :: [Cts] -> Cts
pprCts :: Cts -> SDoc
singleCt :: Ct -> Cts
listToCts :: [Ct] -> Cts
ctsElts :: Cts -> [Ct]
consCts :: Ct -> Cts -> Cts
snocCts :: Cts -> Ct -> Cts
extendCtsList :: Cts -> [Ct] -> Cts
isEmptyCts :: Cts -> Bool
isCTyEqCan :: Ct -> Bool
isCFunEqCan :: Ct -> Bool
isPendingScDict :: Ct -> Maybe Ct
-- | True if taking superclasses of givens, or of wanteds (to perhaps
-- expose more equalities or functional dependencies) might help to solve
-- this constraint. See Note [When superclasses help]
superClassesMightHelp :: Ct -> Bool
isCDictCan_Maybe :: Ct -> Maybe Class
isCFunEqCan_maybe :: Ct -> Maybe (TyCon, [Type])
isCIrredEvCan :: Ct -> Bool
isCNonCanonical :: Ct -> Bool
isWantedCt :: Ct -> Bool
isDerivedCt :: Ct -> Bool
isGivenCt :: Ct -> Bool
isHoleCt :: Ct -> Bool
isOutOfScopeCt :: Ct -> Bool
isExprHoleCt :: Ct -> Bool
isTypeHoleCt :: Ct -> Bool
isUserTypeErrorCt :: Ct -> Bool
-- | A constraint is considered to be a custom type error, if it contains
-- custom type errors anywhere in it. See Note [Custom type errors in
-- constraints]
getUserTypeErrorMsg :: Ct -> Maybe Type
ctEvidence :: Ct -> CtEvidence
ctLoc :: Ct -> CtLoc
setCtLoc :: Ct -> CtLoc -> Ct
ctPred :: Ct -> PredType
-- | Get the flavour of the given Ct
ctFlavour :: Ct -> CtFlavour
-- | Get the equality relation for the given Ct
ctEqRel :: Ct -> EqRel
ctOrigin :: Ct -> CtOrigin
-- | Makes a new equality predicate with the same role as the given
-- evidence.
mkTcEqPredLikeEv :: CtEvidence -> TcType -> TcType -> TcType
mkNonCanonical :: CtEvidence -> Ct
mkNonCanonicalCt :: Ct -> Ct
mkGivens :: CtLoc -> [EvId] -> [Ct]
ctEvPred :: CtEvidence -> TcPredType
ctEvLoc :: CtEvidence -> CtLoc
ctEvOrigin :: CtEvidence -> CtOrigin
-- | Get the equality relation relevant for a CtEvidence
ctEvEqRel :: CtEvidence -> EqRel
ctEvTerm :: CtEvidence -> EvTerm
ctEvCoercion :: CtEvidence -> Coercion
ctEvId :: CtEvidence -> TcId
-- | Returns free variables of constraints as a non-deterministic set
tyCoVarsOfCt :: Ct -> TcTyCoVarSet
-- | Returns free variables of a bag of constraints as a non-deterministic
-- set. See Note [Deterministic FV] in FV.
tyCoVarsOfCts :: Cts -> TcTyCoVarSet
-- | Returns free variables of constraints as a deterministically ordered.
-- list. See Note [Deterministic FV] in FV.
tyCoVarsOfCtList :: Ct -> [TcTyCoVar]
-- | Returns free variables of a bag of constraints as a deterministically
-- odered list. See Note [Deterministic FV] in FV.
tyCoVarsOfCtsList :: Cts -> [TcTyCoVar]
data WantedConstraints
WC :: Cts -> Bag Implication -> Cts -> WantedConstraints
[wc_simple] :: WantedConstraints -> Cts
[wc_impl] :: WantedConstraints -> Bag Implication
[wc_insol] :: WantedConstraints -> Cts
insolubleWC :: WantedConstraints -> Bool
emptyWC :: WantedConstraints
isEmptyWC :: WantedConstraints -> Bool
andWC :: WantedConstraints -> WantedConstraints -> WantedConstraints
unionsWC :: [WantedConstraints] -> WantedConstraints
mkSimpleWC :: [CtEvidence] -> WantedConstraints
mkImplicWC :: Bag Implication -> WantedConstraints
addInsols :: WantedConstraints -> Bag Ct -> WantedConstraints
getInsolubles :: WantedConstraints -> Cts
insolublesOnly :: WantedConstraints -> WantedConstraints
addSimples :: WantedConstraints -> Bag Ct -> WantedConstraints
addImplics :: WantedConstraints -> Bag Implication -> WantedConstraints
-- | Returns free variables of WantedConstraints as a non-deterministic
-- set. See Note [Deterministic FV] in FV.
tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet
dropDerivedWC :: WantedConstraints -> WantedConstraints
dropDerivedSimples :: Cts -> Cts
dropDerivedInsols :: Cts -> Cts
-- | Returns free variables of WantedConstraints as a deterministically
-- ordered list. See Note [Deterministic FV] in FV.
tyCoVarsOfWCList :: WantedConstraints -> [TyCoVar]
trulyInsoluble :: Ct -> Bool
isDroppableDerivedLoc :: CtLoc -> Bool
insolubleImplic :: Implication -> Bool
arisesFromGivens :: Ct -> Bool
data Implication
Implic :: TcLevel -> [TcTyVar] -> SkolemInfo -> [EvVar] -> Bool -> TcLclEnv -> WantedConstraints -> EvBindsVar -> VarSet -> ImplicStatus -> Implication
[ic_tclvl] :: Implication -> TcLevel
[ic_skols] :: Implication -> [TcTyVar]
[ic_info] :: Implication -> SkolemInfo
[ic_given] :: Implication -> [EvVar]
[ic_no_eqs] :: Implication -> Bool
[ic_env] :: Implication -> TcLclEnv
[ic_wanted] :: Implication -> WantedConstraints
[ic_binds] :: Implication -> EvBindsVar
[ic_needed] :: Implication -> VarSet
[ic_status] :: Implication -> ImplicStatus
data ImplicStatus
IC_Solved :: VarSet -> [EvVar] -> ImplicStatus
[ics_need] :: ImplicStatus -> VarSet
[ics_dead] :: ImplicStatus -> [EvVar]
IC_Insoluble :: ImplicStatus
IC_Unsolved :: ImplicStatus
isInsolubleStatus :: ImplicStatus -> Bool
isSolvedStatus :: ImplicStatus -> Bool
-- | See Note [SubGoalDepth]
data SubGoalDepth
initialSubGoalDepth :: SubGoalDepth
maxSubGoalDepth :: SubGoalDepth -> SubGoalDepth -> SubGoalDepth
bumpSubGoalDepth :: SubGoalDepth -> SubGoalDepth
subGoalDepthExceeded :: DynFlags -> SubGoalDepth -> Bool
data CtLoc
CtLoc :: CtOrigin -> TcLclEnv -> Maybe TypeOrKind -> !SubGoalDepth -> CtLoc
[ctl_origin] :: CtLoc -> CtOrigin
[ctl_env] :: CtLoc -> TcLclEnv
[ctl_t_or_k] :: CtLoc -> Maybe TypeOrKind
[ctl_depth] :: CtLoc -> !SubGoalDepth
ctLocSpan :: CtLoc -> RealSrcSpan
ctLocEnv :: CtLoc -> TcLclEnv
ctLocLevel :: CtLoc -> TcLevel
ctLocOrigin :: CtLoc -> CtOrigin
ctLocTypeOrKind_maybe :: CtLoc -> Maybe TypeOrKind
ctLocDepth :: CtLoc -> SubGoalDepth
bumpCtLocDepth :: CtLoc -> CtLoc
setCtLocOrigin :: CtLoc -> CtOrigin -> CtLoc
setCtLocEnv :: CtLoc -> TcLclEnv -> CtLoc
setCtLocSpan :: CtLoc -> RealSrcSpan -> CtLoc
data CtOrigin
GivenOrigin :: SkolemInfo -> CtOrigin
OccurrenceOf :: Name -> CtOrigin
OccurrenceOfRecSel :: RdrName -> CtOrigin
AppOrigin :: CtOrigin
SpecPragOrigin :: UserTypeCtxt -> CtOrigin
TypeEqOrigin :: TcType -> TcType -> Maybe ErrorThing -> CtOrigin
[uo_actual] :: CtOrigin -> TcType
[uo_expected] :: CtOrigin -> TcType
-- | The thing that has type "actual"
[uo_thing] :: CtOrigin -> Maybe ErrorThing
KindEqOrigin :: TcType -> (Maybe TcType) -> CtOrigin -> (Maybe TypeOrKind) -> CtOrigin
IPOccOrigin :: HsIPName -> CtOrigin
OverLabelOrigin :: FastString -> CtOrigin
LiteralOrigin :: (HsOverLit Name) -> CtOrigin
NegateOrigin :: CtOrigin
ArithSeqOrigin :: (ArithSeqInfo Name) -> CtOrigin
PArrSeqOrigin :: (ArithSeqInfo Name) -> CtOrigin
SectionOrigin :: CtOrigin
TupleOrigin :: CtOrigin
ExprSigOrigin :: CtOrigin
PatSigOrigin :: CtOrigin
PatOrigin :: CtOrigin
ProvCtxtOrigin :: (PatSynBind Name Name) -> CtOrigin
RecordUpdOrigin :: CtOrigin
ViewPatOrigin :: CtOrigin
ScOrigin :: TypeSize -> CtOrigin
DerivOrigin :: CtOrigin
DerivOriginDC :: DataCon -> Int -> CtOrigin
DerivOriginCoerce :: Id -> Type -> Type -> CtOrigin
StandAloneDerivOrigin :: CtOrigin
DefaultOrigin :: CtOrigin
DoOrigin :: CtOrigin
DoPatOrigin :: (LPat Name) -> CtOrigin
MCompOrigin :: CtOrigin
MCompPatOrigin :: (LPat Name) -> CtOrigin
IfOrigin :: CtOrigin
ProcOrigin :: CtOrigin
AnnOrigin :: CtOrigin
FunDepOrigin1 :: PredType -> CtLoc -> PredType -> CtLoc -> CtOrigin
FunDepOrigin2 :: PredType -> CtOrigin -> PredType -> SrcSpan -> CtOrigin
HoleOrigin :: CtOrigin
UnboundOccurrenceOf :: OccName -> CtOrigin
ListOrigin :: CtOrigin
StaticOrigin :: CtOrigin
FailablePattern :: (LPat TcId) -> CtOrigin
Shouldn'tHappenOrigin :: String -> CtOrigin
InstProvidedOrigin :: Module -> ClsInst -> CtOrigin
exprCtOrigin :: HsExpr Name -> CtOrigin
-- | Extract a suitable CtOrigin from a HsExpr
lexprCtOrigin :: LHsExpr Name -> CtOrigin
-- | Extract a suitable CtOrigin from a MatchGroup
matchesCtOrigin :: MatchGroup Name (LHsExpr Name) -> CtOrigin
-- | Extract a suitable CtOrigin from guarded RHSs
grhssCtOrigin :: GRHSs Name (LHsExpr Name) -> CtOrigin
-- | A thing that can be stored for error message generation only. It is
-- stored with a function to zonk and tidy the thing.
data ErrorThing
ErrorThing :: a -> (Maybe Arity) -> (TidyEnv -> a -> TcM (TidyEnv, a)) -> ErrorThing
-- | Make an ErrorThing that doesn't need tidying or zonking
mkErrorThing :: Outputable a => a -> ErrorThing
-- | Retrieve the # of arguments in the error thing, if known
errorThingNumArgs_maybe :: ErrorThing -> Maybe Arity
-- | Flag to see whether we're type-checking terms or kind-checking types
data TypeOrKind
TypeLevel :: TypeOrKind
KindLevel :: TypeOrKind
isTypeLevel :: TypeOrKind -> Bool
isKindLevel :: TypeOrKind -> Bool
pprCtOrigin :: CtOrigin -> SDoc
pprCtLoc :: CtLoc -> SDoc
pushErrCtxt :: CtOrigin -> ErrCtxt -> CtLoc -> CtLoc
pushErrCtxtSameOrigin :: ErrCtxt -> CtLoc -> CtLoc
data SkolemInfo
SigSkol :: UserTypeCtxt -> TcType -> [(Name, TcTyVar)] -> SkolemInfo
ClsSkol :: Class -> SkolemInfo
DerivSkol :: Type -> SkolemInfo
InstSkol :: SkolemInfo
InstSC :: TypeSize -> SkolemInfo
DataSkol :: SkolemInfo
FamInstSkol :: SkolemInfo
PatSkol :: ConLike -> (HsMatchContext Name) -> SkolemInfo
ArrowSkol :: SkolemInfo
IPSkol :: [HsIPName] -> SkolemInfo
RuleSkol :: RuleName -> SkolemInfo
InferSkol :: [(Name, TcType)] -> SkolemInfo
BracketSkol :: SkolemInfo
UnifyForAllSkol :: TcType -> SkolemInfo
UnkSkol :: SkolemInfo
pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
pprSkolInfo :: SkolemInfo -> SDoc
termEvidenceAllowed :: SkolemInfo -> Bool
data CtEvidence
CtGiven :: TcPredType -> EvVar -> CtLoc -> CtEvidence
[ctev_pred] :: CtEvidence -> TcPredType
[ctev_evar] :: CtEvidence -> EvVar
[ctev_loc] :: CtEvidence -> CtLoc
CtWanted :: TcPredType -> TcEvDest -> ShadowInfo -> CtLoc -> CtEvidence
[ctev_pred] :: CtEvidence -> TcPredType
[ctev_dest] :: CtEvidence -> TcEvDest
[ctev_nosh] :: CtEvidence -> ShadowInfo
[ctev_loc] :: CtEvidence -> CtLoc
CtDerived :: TcPredType -> CtLoc -> CtEvidence
[ctev_pred] :: CtEvidence -> TcPredType
[ctev_loc] :: CtEvidence -> CtLoc
-- | A place for type-checking evidence to go after it is generated. Wanted
-- equalities are always HoleDest; other wanteds are always EvVarDest.
data TcEvDest
-- | bind this var to the evidence EvVarDest is always used for
-- non-type-equalities e.g. class constraints
EvVarDest :: EvVar -> TcEvDest
-- | fill in this hole with the evidence HoleDest is always used for
-- type-equalities See Note [Coercion holes] in TyCoRep
HoleDest :: CoercionHole -> TcEvDest
mkGivenLoc :: TcLevel -> SkolemInfo -> TcLclEnv -> CtLoc
mkKindLoc :: TcType -> TcType -> CtLoc -> CtLoc
-- | Take a CtLoc and moves it to the kind level
toKindLoc :: CtLoc -> CtLoc
isWanted :: CtEvidence -> Bool
isGiven :: CtEvidence -> Bool
isDerived :: CtEvidence -> Bool
isGivenOrWDeriv :: CtFlavour -> Bool
-- | Get the role relevant for a CtEvidence
ctEvRole :: CtEvidence -> Role
data TcPlugin
TcPlugin :: TcPluginM s -> (s -> TcPluginSolver) -> (s -> TcPluginM ()) -> TcPlugin
-- | Initialize plugin, when entering type-checker.
[tcPluginInit] :: TcPlugin -> TcPluginM s
-- | Solve some constraints. TODO: WRITE MORE DETAILS ON HOW THIS WORKS.
[tcPluginSolve] :: TcPlugin -> s -> TcPluginSolver
-- | Clean up after the plugin, when exiting the type-checker.
[tcPluginStop] :: TcPlugin -> s -> TcPluginM ()
data TcPluginResult
-- | The plugin found a contradiction. The returned constraints are removed
-- from the inert set, and recorded as insoluble.
TcPluginContradiction :: [Ct] -> TcPluginResult
-- | The first field is for constraints that were solved. These are removed
-- from the inert set, and the evidence for them is recorded. The second
-- field contains new work, that should be processed by the constraint
-- solver.
TcPluginOk :: [(EvTerm, Ct)] -> [Ct] -> TcPluginResult
type TcPluginSolver = [Ct] -> [Ct] -> [Ct] -> TcPluginM TcPluginResult
data TcPluginM a
runTcPluginM :: TcPluginM a -> EvBindsVar -> TcM a
-- | This function provides an escape for direct access to the TcM
-- monad. It should not be used lightly, and the provided
-- TcPluginM API should be favoured instead.
unsafeTcPluginTcM :: TcM a -> TcPluginM a
-- | Access the EvBindsVar carried by the TcPluginM during
-- constraint solving. Returns Nothing if invoked during
-- tcPluginInit or tcPluginStop.
getEvBindsTcPluginM :: TcPluginM EvBindsVar
data CtFlavour
Given :: CtFlavour
Wanted :: ShadowInfo -> CtFlavour
Derived :: CtFlavour
data ShadowInfo
WDeriv :: ShadowInfo
WOnly :: ShadowInfo
ctEvFlavour :: CtEvidence -> CtFlavour
-- | Whether or not one Ct can rewrite another is determined by its
-- flavour and its equality relation. See also Note [Flavours with roles]
-- in TcSMonad
type CtFlavourRole = (CtFlavour, EqRel)
-- | Extract the flavour, role, and boxity from a CtEvidence
ctEvFlavourRole :: CtEvidence -> CtFlavourRole
-- | Extract the flavour, role, and boxity from a Ct
ctFlavourRole :: Ct -> CtFlavourRole
eqCanRewriteFR :: CtFlavourRole -> CtFlavourRole -> Bool
eqMayRewriteFR :: CtFlavourRole -> CtFlavourRole -> Bool
eqCanDischarge :: CtEvidence -> CtEvidence -> Bool
funEqCanDischarge :: CtEvidence -> CtEvidence -> (SwapFlag, Bool)
funEqCanDischargeF :: CtFlavour -> CtFlavour -> (SwapFlag, Bool)
pprEvVarTheta :: [EvVar] -> SDoc
pprEvVars :: [EvVar] -> SDoc
pprEvVarWithType :: EvVar -> SDoc
type TcId = Id
type TcIdSet = IdSet
-- | An expression or type hole
data Hole
-- | Either an out-of-scope variable or a "true" hole in an expression
-- (TypedHoles)
ExprHole :: UnboundVar -> Hole
-- | A hole in a type (PartialTypeSignatures)
TypeHole :: OccName -> Hole
holeOcc :: Hole -> OccName
-- | A NameShape is a substitution on Names that can be used
-- to refine the identities of a hole while we are renaming interfaces
-- (see RnModIface). Specifically, a NameShape for
-- ns_module_name A, defines a mapping from
-- {A.T} (for some OccName T) to some arbitrary
-- other Name.
--
-- The most intruiging thing about a NameShape, however, is how
-- it's constructed. A NameShape is *implied* by the exported
-- AvailInfos of the implementor of an interface: if an
-- implementor of signature H exports M.T, you
-- implicitly define a substitution from {H.T} to M.T.
-- So a NameShape is computed from the list of AvailInfos
-- that are exported by the implementation of a module, or successively
-- merged together by the export lists of signatures which are joining
-- together.
--
-- It's not the most obvious way to go about doing this, but it does seem
-- to work!
--
-- NB: Can't boot this and put it in NameShape because then we start
-- pulling in too many DynFlags things.
data NameShape
NameShape :: ModuleName -> [AvailInfo] -> OccEnv Name -> NameShape
[ns_mod_name] :: NameShape -> ModuleName
[ns_exports] :: NameShape -> [AvailInfo]
[ns_map] :: NameShape -> OccEnv Name
instance GHC.Classes.Eq TcRnTypes.TypeOrKind
instance Outputable.Outputable TcRnTypes.SubGoalDepth
instance GHC.Classes.Ord TcRnTypes.SubGoalDepth
instance GHC.Classes.Eq TcRnTypes.SubGoalDepth
instance GHC.Classes.Eq TcRnTypes.CtFlavour
instance GHC.Classes.Eq TcRnTypes.ShadowInfo
instance Module.ContainsModule TcRnTypes.TcGblEnv
instance Outputable.Outputable TcRnTypes.ThStage
instance Outputable.Outputable TcRnTypes.Ct
instance Outputable.Outputable TcRnTypes.WantedConstraints
instance Outputable.Outputable TcRnTypes.Implication
instance Outputable.Outputable TcRnTypes.CtEvidence
instance Outputable.Outputable TcRnTypes.CtOrigin
instance Outputable.Outputable TcRnTypes.ErrorThing
instance GHC.Base.Functor TcRnTypes.TcPluginM
instance GHC.Base.Applicative TcRnTypes.TcPluginM
instance GHC.Base.Monad TcRnTypes.TcPluginM
instance Control.Monad.Fail.MonadFail TcRnTypes.TcPluginM
instance Outputable.Outputable TcRnTypes.TypeOrKind
instance Outputable.Outputable TcRnTypes.SkolemInfo
instance Outputable.Outputable TcRnTypes.CtFlavour
instance Outputable.Outputable TcRnTypes.TcEvDest
instance Outputable.Outputable TcRnTypes.ImplicStatus
instance Outputable.Outputable TcRnTypes.TcSigInfo
instance Outputable.Outputable TcRnTypes.TcPatSynInfo
instance Outputable.Outputable TcRnTypes.TcIdSigInst
instance Outputable.Outputable TcRnTypes.TcIdSigInfo
instance Outputable.Outputable TcRnTypes.WhereFrom
instance Outputable.Outputable TcRnTypes.TcTyThing
instance Outputable.Outputable TcRnTypes.IdBindingInfo
instance Outputable.Outputable TcRnTypes.PromotionErr
instance Outputable.Outputable TcRnTypes.TcIdBinder
instance OccName.HasOccName TcRnTypes.TcIdBinder
instance Module.ContainsModule TcRnTypes.DsGblEnv
instance DynFlags.ContainsDynFlags (TcRnTypes.Env gbl lcl)
instance Module.ContainsModule gbl => Module.ContainsModule (TcRnTypes.Env gbl lcl)
module TcTypeNats
typeNatTyCons :: [TyCon]
typeNatCoAxiomRules :: Map FastString CoAxiomRule
data BuiltInSynFamily
BuiltInSynFamily :: ([Type] -> Maybe (CoAxiomRule, [Type], Type)) -> ([Type] -> Type -> [TypeEqn]) -> ([Type] -> Type -> [Type] -> Type -> [TypeEqn]) -> BuiltInSynFamily
[sfMatchFam] :: BuiltInSynFamily -> [Type] -> Maybe (CoAxiomRule, [Type], Type)
[sfInteractTop] :: BuiltInSynFamily -> [Type] -> Type -> [TypeEqn]
[sfInteractInert] :: BuiltInSynFamily -> [Type] -> Type -> [Type] -> Type -> [TypeEqn]
typeNatAddTyCon :: TyCon
typeNatMulTyCon :: TyCon
typeNatExpTyCon :: TyCon
typeNatLeqTyCon :: TyCon
typeNatSubTyCon :: TyCon
typeNatCmpTyCon :: TyCon
typeSymbolCmpTyCon :: TyCon
typeSymbolAppendTyCon :: TyCon
module RnHsDoc
rnHsDoc :: HsDocString -> RnM HsDocString
rnLHsDoc :: LHsDocString -> RnM LHsDocString
rnMbLHsDoc :: Maybe LHsDocString -> RnM (Maybe LHsDocString)
module TcRnMonad
-- | Setup the initial typechecking environment
initTc :: HscEnv -> HscSource -> Bool -> Module -> RealSrcSpan -> TcM r -> IO (Messages, Maybe r)
-- | Run a TcM action in the context of an existing GblEnv.
initTcWithGbl :: HscEnv -> TcGblEnv -> RealSrcSpan -> TcM r -> IO (Messages, Maybe r)
initTcInteractive :: HscEnv -> TcM a -> IO (Messages, Maybe a)
initTcForLookup :: HscEnv -> TcM a -> IO a
initTcRnIf :: Char -> HscEnv -> gbl -> lcl -> TcRnIf gbl lcl a -> IO a
discardResult :: TcM a -> TcM ()
getTopEnv :: TcRnIf gbl lcl HscEnv
updTopEnv :: (HscEnv -> HscEnv) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
getGblEnv :: TcRnIf gbl lcl gbl
updGblEnv :: (gbl -> gbl) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
setGblEnv :: gbl -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
getLclEnv :: TcRnIf gbl lcl lcl
updLclEnv :: (lcl -> lcl) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
setLclEnv :: lcl' -> TcRnIf gbl lcl' a -> TcRnIf gbl lcl a
getEnvs :: TcRnIf gbl lcl (gbl, lcl)
setEnvs :: (gbl', lcl') -> TcRnIf gbl' lcl' a -> TcRnIf gbl lcl a
xoptM :: Extension -> TcRnIf gbl lcl Bool
doptM :: DumpFlag -> TcRnIf gbl lcl Bool
goptM :: GeneralFlag -> TcRnIf gbl lcl Bool
woptM :: WarningFlag -> TcRnIf gbl lcl Bool
setXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
unsetXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
-- | Do it flag is true
whenDOptM :: DumpFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
whenWOptM :: WarningFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
whenXOptM :: Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
getGhcMode :: TcRnIf gbl lcl GhcMode
withDoDynamicToo :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a
getEpsVar :: TcRnIf gbl lcl (TcRef ExternalPackageState)
getEps :: TcRnIf gbl lcl ExternalPackageState
-- | Update the external package state. Returns the second result of the
-- modifier function.
--
-- This is an atomic operation and forces evaluation of the modified EPS
-- in order to avoid space leaks.
updateEps :: (ExternalPackageState -> (ExternalPackageState, a)) -> TcRnIf gbl lcl a
-- | Update the external package state.
--
-- This is an atomic operation and forces evaluation of the modified EPS
-- in order to avoid space leaks.
updateEps_ :: (ExternalPackageState -> ExternalPackageState) -> TcRnIf gbl lcl ()
getHpt :: TcRnIf gbl lcl HomePackageTable
getEpsAndHpt :: TcRnIf gbl lcl (ExternalPackageState, HomePackageTable)
newArrowScope :: TcM a -> TcM a
escapeArrowScope :: TcM a -> TcM a
newUnique :: TcRnIf gbl lcl Unique
newUniqueSupply :: TcRnIf gbl lcl UniqSupply
newName :: OccName -> TcM Name
newNameAt :: OccName -> SrcSpan -> TcM Name
cloneLocalName :: Name -> TcM Name
newSysName :: OccName -> TcRnIf gbl lcl Name
newSysLocalId :: FastString -> TcType -> TcRnIf gbl lcl TcId
newSysLocalIds :: FastString -> [TcType] -> TcRnIf gbl lcl [TcId]
newTcRef :: a -> TcRnIf gbl lcl (TcRef a)
readTcRef :: TcRef a -> TcRnIf gbl lcl a
writeTcRef :: TcRef a -> a -> TcRnIf gbl lcl ()
updTcRef :: TcRef a -> (a -> a) -> TcRnIf gbl lcl ()
traceTc :: String -> SDoc -> TcRn ()
traceRn :: String -> SDoc -> TcRn ()
-- | Output a doc if the given DumpFlag is set.
--
-- By default this logs to stdout However, if the `-ddump-to-file` flag
-- is set, then this will dump output to a file
--
-- Just a wrapper for dumpSDoc
traceOptTcRn :: DumpFlag -> SDoc -> TcRn ()
-- | Unconditionally dump some trace output
--
-- The DumpFlag is used only to set the output filename for
-- --dump-to-file, not to decide whether or not to output That part is
-- done by the caller
traceTcRn :: DumpFlag -> SDoc -> TcRn ()
getPrintUnqualified :: DynFlags -> TcRn PrintUnqualified
-- | Like logInfoTcRn, but for user consumption
printForUserTcRn :: SDoc -> TcRn ()
traceIf :: SDoc -> TcRnIf m n ()
traceHiDiffs :: SDoc -> TcRnIf m n ()
traceOptIf :: DumpFlag -> SDoc -> TcRnIf m n ()
debugTc :: TcM () -> TcM ()
getIsGHCi :: TcRn Bool
getGHCiMonad :: TcRn Name
getInteractivePrintName :: TcRn Name
tcIsHsBootOrSig :: TcRn Bool
tcSelfBootInfo :: TcRn SelfBootInfo
getGlobalRdrEnv :: TcRn GlobalRdrEnv
getRdrEnvs :: TcRn (GlobalRdrEnv, LocalRdrEnv)
getImports :: TcRn ImportAvails
getFixityEnv :: TcRn FixityEnv
extendFixityEnv :: [(Name, FixItem)] -> RnM a -> RnM a
getRecFieldEnv :: TcRn RecFieldEnv
getDeclaredDefaultTys :: TcRn (Maybe [Type])
addDependentFiles :: [FilePath] -> TcRn ()
getSrcSpanM :: TcRn SrcSpan
setSrcSpan :: SrcSpan -> TcRn a -> TcRn a
addLocM :: (a -> TcM b) -> Located a -> TcM b
wrapLocM :: (a -> TcM b) -> Located a -> TcM (Located b)
wrapLocFstM :: (a -> TcM (b, c)) -> Located a -> TcM (Located b, c)
wrapLocSndM :: (a -> TcM (b, c)) -> Located a -> TcM (b, Located c)
getErrsVar :: TcRn (TcRef Messages)
setErrsVar :: TcRef Messages -> TcRn a -> TcRn a
addErr :: MsgDoc -> TcRn ()
failWith :: MsgDoc -> TcRn a
failAt :: SrcSpan -> MsgDoc -> TcRn a
addErrAt :: SrcSpan -> MsgDoc -> TcRn ()
addErrs :: [(SrcSpan, MsgDoc)] -> TcRn ()
checkErr :: Bool -> MsgDoc -> TcRn ()
addMessages :: Messages -> TcRn ()
discardWarnings :: TcRn a -> TcRn a
mkLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ErrMsg
mkErrDocAt :: SrcSpan -> ErrDoc -> TcRn ErrMsg
addLongErrAt :: SrcSpan -> MsgDoc -> MsgDoc -> TcRn ()
reportErrors :: [ErrMsg] -> TcM ()
reportError :: ErrMsg -> TcRn ()
reportWarning :: WarnReason -> ErrMsg -> TcRn ()
recoverM :: TcRn r -> TcRn r -> TcRn r
-- | Drop elements of the input that fail, so the result list can be
-- shorter than the argument list
mapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b]
-- | Succeeds if applying the argument to all members of the lists
-- succeeds, but nevertheless runs it on all arguments, to collect all
-- errors.
mapAndReportM :: (a -> TcRn b) -> [a] -> TcRn [b]
-- | The accumulator is not updated if the action fails
foldAndRecoverM :: (b -> a -> TcRn b) -> b -> [a] -> TcRn b
tryTc :: TcRn a -> TcRn (Messages, Maybe a)
askNoErrs :: TcRn a -> TcRn (a, Bool)
discardErrs :: TcRn a -> TcRn a
tryTcDiscardingErrs :: TcM r -> TcM r -> TcM r
checkNoErrs :: TcM r -> TcM r
whenNoErrs :: TcM () -> TcM ()
ifErrsM :: TcRn r -> TcRn r -> TcRn r
failIfErrsM :: TcRn ()
checkTH :: a -> String -> TcRn ()
failTH :: Outputable a => a -> String -> TcRn x
getErrCtxt :: TcM [ErrCtxt]
setErrCtxt :: [ErrCtxt] -> TcM a -> TcM a
-- | Add a fixed message to the error context. This message should not do
-- any tidying.
addErrCtxt :: MsgDoc -> TcM a -> TcM a
-- | Add a message to the error context. This message may do tidying.
addErrCtxtM :: (TidyEnv -> TcM (TidyEnv, MsgDoc)) -> TcM a -> TcM a
-- | Add a fixed landmark message to the error context. A landmark message
-- is always sure to be reported, even if there is a lot of context. It
-- also doesn't count toward the maximum number of contexts reported.
addLandmarkErrCtxt :: MsgDoc -> TcM a -> TcM a
-- | Variant of addLandmarkErrCtxt that allows for monadic
-- operations and tidying.
addLandmarkErrCtxtM :: (TidyEnv -> TcM (TidyEnv, MsgDoc)) -> TcM a -> TcM a
updCtxt :: ([ErrCtxt] -> [ErrCtxt]) -> TcM a -> TcM a
popErrCtxt :: TcM a -> TcM a
getCtLocM :: CtOrigin -> Maybe TypeOrKind -> TcM CtLoc
setCtLocM :: CtLoc -> TcM a -> TcM a
addErrTc :: MsgDoc -> TcM ()
addErrsTc :: [MsgDoc] -> TcM ()
addErrTcM :: (TidyEnv, MsgDoc) -> TcM ()
mkErrTcM :: (TidyEnv, MsgDoc) -> TcM ErrMsg
failWithTc :: MsgDoc -> TcM a
failWithTcM :: (TidyEnv, MsgDoc) -> TcM a
checkTc :: Bool -> MsgDoc -> TcM ()
checkTcM :: Bool -> (TidyEnv, MsgDoc) -> TcM ()
failIfTc :: Bool -> MsgDoc -> TcM ()
failIfTcM :: Bool -> (TidyEnv, MsgDoc) -> TcM ()
-- | Display a warning if a condition is met. and the warning is enabled
warnIf :: WarnReason -> Bool -> MsgDoc -> TcRn ()
-- | Display a warning if a condition is met.
warnTc :: WarnReason -> Bool -> MsgDoc -> TcM ()
-- | Display a warning if a condition is met.
warnTcM :: WarnReason -> Bool -> (TidyEnv, MsgDoc) -> TcM ()
-- | Display a warning in the current context.
addWarnTc :: WarnReason -> MsgDoc -> TcM ()
-- | Display a warning in a given context.
addWarnTcM :: WarnReason -> (TidyEnv, MsgDoc) -> TcM ()
-- | Display a warning for the current source location.
addWarn :: WarnReason -> MsgDoc -> TcRn ()
-- | Display a warning for a given source location.
addWarnAt :: WarnReason -> SrcSpan -> MsgDoc -> TcRn ()
-- | Display a warning, with an optional flag, for the current source
-- location.
add_warn :: WarnReason -> MsgDoc -> MsgDoc -> TcRn ()
tcInitTidyEnv :: TcM TidyEnv
-- | Get a TidyEnv that includes mappings for all vars free in the
-- given type. Useful when tidying open types.
tcInitOpenTidyEnv :: [TyCoVar] -> TcM TidyEnv
mkErrInfo :: TidyEnv -> [ErrCtxt] -> TcM SDoc
newTcEvBinds :: TcM EvBindsVar
addTcEvBind :: EvBindsVar -> EvBind -> TcM ()
getTcEvTyCoVars :: EvBindsVar -> TcM TyCoVarSet
getTcEvBindsMap :: EvBindsVar -> TcM EvBindMap
chooseUniqueOccTc :: (OccSet -> OccName) -> TcM OccName
getConstraintVar :: TcM (TcRef WantedConstraints)
setConstraintVar :: TcRef WantedConstraints -> TcM a -> TcM a
emitConstraints :: WantedConstraints -> TcM ()
emitStaticConstraints :: WantedConstraints -> TcM ()
emitSimple :: Ct -> TcM ()
emitSimples :: Cts -> TcM ()
emitImplication :: Implication -> TcM ()
emitImplications :: Bag Implication -> TcM ()
emitInsoluble :: Ct -> TcM ()
-- | Throw out any constraints emitted by the thing_inside
discardConstraints :: TcM a -> TcM a
captureConstraints :: TcM a -> TcM (a, WantedConstraints)
tryCaptureConstraints :: TcM a -> TcM (Either IOEnvFailure a, WantedConstraints)
pushLevelAndCaptureConstraints :: TcM a -> TcM (TcLevel, WantedConstraints, a)
pushTcLevelM_ :: TcM a -> TcM a
pushTcLevelM :: TcM a -> TcM (a, TcLevel)
getTcLevel :: TcM TcLevel
setTcLevel :: TcLevel -> TcM a -> TcM a
isTouchableTcM :: TcTyVar -> TcM Bool
getLclTypeEnv :: TcM TcTypeEnv
setLclTypeEnv :: TcLclEnv -> TcM a -> TcM a
traceTcConstraints :: String -> TcM ()
emitWildCardHoleConstraints :: [(Name, TcTyVar)] -> TcM ()
recordThUse :: TcM ()
recordThSpliceUse :: TcM ()
-- | When generating an out-of-scope error message for a variable matching
-- a binding in a later inter-splice group, the typechecker uses the
-- splice locations to provide details in the message about the scope of
-- that binding.
recordTopLevelSpliceLoc :: SrcSpan -> TcM ()
getTopLevelSpliceLocs :: TcM (Set RealSrcSpan)
keepAlive :: Name -> TcRn ()
getStage :: TcM ThStage
getStageAndBindLevel :: Name -> TcRn (Maybe (TopLevelFlag, ThLevel, ThStage))
setStage :: ThStage -> TcM a -> TcRn a
-- | Adds the given modFinalizers to the global environment and set them to
-- use the current local environment.
addModFinalizersWithLclEnv :: ThModFinalizers -> TcM ()
-- | Mark that safe inference has failed See Note [Safe Haskell Overlapping
-- Instances Implementation] although this is used for more than just
-- that failure case.
recordUnsafeInfer :: WarningMessages -> TcM ()
-- | Figure out the final correct safe haskell mode
finalSafeMode :: DynFlags -> TcGblEnv -> IO SafeHaskellMode
-- | Switch instances to safe instances if we're in Safe mode.
fixSafeInstances :: SafeHaskellMode -> [ClsInst] -> [ClsInst]
getLocalRdrEnv :: RnM LocalRdrEnv
setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a
mkIfLclEnv :: Module -> SDoc -> Bool -> IfLclEnv
-- | Run an IfG (top-level interface monad) computation inside an
-- existing TcRn (typecheck-renaming monad) computation by
-- initializing an IfGblEnv based on TcGblEnv.
initIfaceTcRn :: IfG a -> TcRn a
initIfaceCheck :: SDoc -> HscEnv -> IfG a -> IO a
initIfaceLcl :: Module -> SDoc -> Bool -> IfL a -> IfM lcl a
-- | Initialize interface typechecking, but with a NameShape to
-- apply when typechecking top-level OccNames (see
-- lookupIfaceTop)
initIfaceLclWithSubst :: Module -> SDoc -> Bool -> NameShape -> IfL a -> IfM lcl a
initIfaceLoad :: HscEnv -> IfG a -> IO a
getIfModule :: IfL Module
failIfM :: MsgDoc -> IfL a
forkM_maybe :: SDoc -> IfL a -> IfL (Maybe a)
forkM :: SDoc -> IfL a -> IfL a
setImplicitEnvM :: TypeEnv -> IfL a -> IfL a
-- | A convenient wrapper for taking a MaybeErr MsgDoc a and
-- throwing an exception if it is an error.
withException :: TcRnIf gbl lcl (MaybeErr MsgDoc a) -> TcRnIf gbl lcl a
instance UniqSupply.MonadUnique (IOEnv.IOEnv (TcRnTypes.Env gbl lcl))
module TcMType
type TcTyVar = TyVar
type TcKind = Kind
type TcType = Type
type TcTauType = TcType
type TcThetaType = ThetaType
type TcTyVarSet = TyVarSet
newFlexiTyVar :: Kind -> TcM TcTyVar
newFlexiTyVarTy :: Kind -> TcM TcType
newFlexiTyVarTys :: Int -> Kind -> TcM [TcType]
-- | Create a tyvar that can be a lifted or unlifted type. Returns alpha ::
-- TYPE kappa, where both alpha and kappa are fresh
newOpenFlexiTyVarTy :: TcM TcType
newOpenTypeKind :: TcM TcKind
newMetaKindVar :: TcM TcKind
newMetaKindVars :: Int -> TcM [TcKind]
newMetaTyVarTyAtLevel :: TcLevel -> TcKind -> TcM TcType
cloneMetaTyVar :: TcTyVar -> TcM TcTyVar
newFmvTyVar :: TcType -> TcM TcTyVar
newFskTyVar :: TcType -> TcM TcTyVar
readMetaTyVar :: TyVar -> TcM MetaDetails
writeMetaTyVar :: TcTyVar -> TcType -> TcM ()
newMetaDetails :: MetaInfo -> TcM TcTyVarDetails
isFilledMetaTyVar :: TyVar -> TcM Bool
isUnfilledMetaTyVar :: TyVar -> TcM Bool
-- | An expected type to check against during type-checking. See Note
-- [ExpType] in TcMType, where you'll also find manipulators.
data ExpType
Check :: TcType -> ExpType
Infer :: !InferResult -> ExpType
type ExpSigmaType = ExpType
type ExpRhoType = ExpType
-- | Make an ExpType suitable for checking.
mkCheckExpType :: TcType -> ExpType
newInferExpType :: Bool -> TcM ExpType
newInferExpTypeInst :: TcM ExpRhoType
-- | Make an ExpType suitable for inferring a type of kind * or #.
newInferExpTypeNoInst :: TcM ExpSigmaType
-- | Extract a type out of an ExpType. Otherwise, panics.
readExpType :: ExpType -> TcM TcType
-- | Extract a type out of an ExpType, if one exists. But one should always
-- exist. Unless you're quite sure you know what you're doing.
readExpType_maybe :: ExpType -> TcM (Maybe TcType)
-- | Extracts the expected type if there is one, or generates a new TauTv
-- if there isn't.
expTypeToType :: ExpType -> TcM TcType
-- | Returns the expected type when in checking mode.
checkingExpType_maybe :: ExpType -> Maybe TcType
-- | Returns the expected type when in checking mode. Panics if in
-- inference mode.
checkingExpType :: String -> ExpType -> TcType
-- | Turn a (Infer hole) type into a (Check alpha), where alpha is a fresh
-- unification variable
tauifyExpType :: ExpType -> TcM ExpType
inferResultToType :: InferResult -> TcM Type
genInstSkolTyVarsX :: SrcSpan -> TCvSubst -> [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TcTyVar])
newEvVar :: TcPredType -> TcRnIf gbl lcl EvVar
newEvVars :: TcThetaType -> TcM [EvVar]
newDict :: Class -> [TcType] -> TcM DictId
newWanted :: CtOrigin -> Maybe TypeOrKind -> PredType -> TcM CtEvidence
newWanteds :: CtOrigin -> ThetaType -> TcM [CtEvidence]
cloneWanted :: Ct -> TcM CtEvidence
cloneWC :: WantedConstraints -> TcM WantedConstraints
-- | Emits a new Wanted. Deals with both equalities and non-equalities.
emitWanted :: CtOrigin -> TcPredType -> TcM EvTerm
-- | Emits a new equality constraint
emitWantedEq :: CtOrigin -> TypeOrKind -> Role -> TcType -> TcType -> TcM Coercion
-- | Creates a new EvVar and immediately emits it as a Wanted. No equality
-- predicates here.
emitWantedEvVar :: CtOrigin -> TcPredType -> TcM EvVar
emitWantedEvVars :: CtOrigin -> [TcPredType] -> TcM [EvVar]
newTcEvBinds :: TcM EvBindsVar
addTcEvBind :: EvBindsVar -> EvBind -> TcM ()
newCoercionHole :: TcM CoercionHole
-- | Put a value in a coercion hole
fillCoercionHole :: CoercionHole -> Coercion -> TcM ()
-- | Is a coercion hole filled in?
isFilledCoercionHole :: CoercionHole -> TcM Bool
-- | Retrieve the contents of a coercion hole. Panics if the hole is
-- unfilled
unpackCoercionHole :: CoercionHole -> TcM Coercion
-- | Retrieve the contents of a coercion hole, if it is filled
unpackCoercionHole_maybe :: CoercionHole -> TcM (Maybe Coercion)
-- | Check that a coercion is appropriate for filling a hole. (The hole
-- itself is needed only for printing. NB: This must be lazy in
-- the coercion, as it's used in TcHsSyn in the presence of knots. Always
-- returns the checked coercion, but this return value is necessary so
-- that the input coercion is forced only when the output is forced.
checkCoercionHole :: Coercion -> CoercionHole -> Role -> Type -> Type -> TcM Coercion
newMetaTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar])
newMetaTyVarX :: TCvSubst -> TyVar -> TcM (TCvSubst, TcTyVar)
newMetaTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar])
newMetaSigTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar])
newMetaSigTyVarX :: TCvSubst -> TyVar -> TcM (TCvSubst, TcTyVar)
newSigTyVar :: Name -> Kind -> TcM TcTyVar
newWildCardX :: TCvSubst -> TyVar -> TcM (TCvSubst, TcTyVar)
tcInstType :: ([TyVar] -> TcM (TCvSubst, [TcTyVar])) -> Id -> TcM ([(Name, TcTyVar)], TcThetaType, TcType)
-- | Given a list of [TyVar], skolemize the type variables,
-- returning a substitution mapping the original tyvars to the skolems,
-- and the list of newly bound skolems. See also tcInstSkolTyVars' for a
-- precondition. The resulting skolems are non-overlappable; see Note
-- [Overlap and deriving] for an example where this matters.
tcInstSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar])
tcInstSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar])
tcInstSuperSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar])
tcSkolDFunType :: DFunId -> TcM ([TcTyVar], TcThetaType, TcType)
tcSuperSkolTyVars :: [TyVar] -> (TCvSubst, [TcTyVar])
instSkolTyCoVars :: TcTyVarMaker -> [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TyCoVar])
-- | Give fresh uniques to a bunch of TyVars, but they stay as TyVars,
-- rather than becoming TcTyVars Used in FamInst.newFamInst, and
-- Inst.newClsInst
freshenTyVarBndrs :: [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TyVar])
-- | Give fresh uniques to a bunch of CoVars Used in FamInst.newFamInst
freshenCoVarBndrsX :: TCvSubst -> [CoVar] -> TcRnIf gbl lcl (TCvSubst, [CoVar])
zonkTidyTcType :: TidyEnv -> TcType -> TcM (TidyEnv, TcType)
zonkTidyOrigin :: TidyEnv -> CtOrigin -> TcM (TidyEnv, CtOrigin)
-- | Make an ErrorThing storing a type.
mkTypeErrorThing :: TcType -> ErrorThing
-- | Make an ErrorThing storing a type, with some extra args known
-- about
mkTypeErrorThingArgs :: TcType -> Int -> ErrorThing
tidyEvVar :: TidyEnv -> EvVar -> EvVar
tidyCt :: TidyEnv -> Ct -> Ct
tidySkolemInfo :: TidyEnv -> SkolemInfo -> SkolemInfo
skolemiseRuntimeUnk :: TcTyVar -> TcM TyVar
zonkTcTyVar :: TcTyVar -> TcM TcType
zonkTcTyVars :: [TcTyVar] -> TcM [TcType]
zonkTcTyVarToTyVar :: TcTyVar -> TcM TcTyVar
zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet
zonkTcTypeAndFV :: TcType -> TcM DTyCoVarSet
zonkTyCoVarsAndFVList :: [TyCoVar] -> TcM [TyCoVar]
-- | Zonk a type and call candidateQTyVarsOfType on it. Works within
-- the knot.
zonkTcTypeAndSplitDepVars :: TcType -> TcM CandidatesQTvs
zonkTcTypesAndSplitDepVars :: [TcType] -> TcM CandidatesQTvs
zonkQuantifiedTyVar :: Bool -> TcTyVar -> TcM (Maybe TcTyVar)
defaultTyVar :: Bool -> TcTyVar -> TcM Bool
quantifyTyVars :: TcTyCoVarSet -> CandidatesQTvs -> TcM [TcTyVar]
quantifyZonkedTyVars :: TcTyCoVarSet -> CandidatesQTvs -> TcM [TcTyVar]
zonkTcTyCoVarBndr :: TcTyCoVar -> TcM TcTyCoVar
zonkTcTyVarBinder :: TyVarBndr TcTyVar vis -> TcM (TyVarBndr TcTyVar vis)
zonkTcType :: TcType -> TcM TcType
zonkTcTypes :: [TcType] -> TcM [TcType]
-- | Zonk a coercion -- really, just zonk any types in the coercion
zonkCo :: Coercion -> TcM Coercion
zonkTyCoVarKind :: TyCoVar -> TcM TyCoVar
-- | A suitable TyCoMapper for zonking a type inside the knot, and before
-- all metavars are filled in.
zonkTcTypeMapper :: TyCoMapper () TcM
zonkEvVar :: EvVar -> TcM EvVar
zonkWC :: WantedConstraints -> TcM WantedConstraints
zonkSimples :: Cts -> TcM Cts
zonkId :: TcId -> TcM TcId
zonkCt :: Ct -> TcM Ct
zonkSkolemInfo :: SkolemInfo -> TcM SkolemInfo
-- | tcGetGlobalTyCoVars returns a fully-zonked set of *scoped*
-- tyvars free in the environment. To improve subsequent calls to the
-- same function it writes the zonked set back into the environment. Note
-- that this returns all variables free in anything (term-level or
-- type-level) in scope. We thus don't have to worry about clashes with
-- things that are not in scope, because if they are reachable, then
-- they'll be returned here.
tcGetGlobalTyCoVars :: TcM TcTyVarSet
-- | According to the rules around representation polymorphism (see
-- https://ghc.haskell.org/trac/ghc/wiki/NoSubKinds), no binder
-- can have a representation-polymorphic type. This check ensures that we
-- respect this rule. It is a bit regrettable that this error occurs in
-- zonking, after which we should have reported all errors. But it's hard
-- to see where else to do it, because this can be discovered only after
-- all solving is done. And, perhaps most importantly, this isn't really
-- a compositional property of a type system, so it's not a terrible
-- surprise that the check has to go in an awkward spot.
ensureNotLevPoly :: Type -> SDoc -> TcM ()
checkForLevPoly :: SDoc -> Type -> TcM ()
checkForLevPolyX :: Monad m => (SDoc -> m ()) -> SDoc -> Type -> m ()
formatLevPolyErr :: Type -> SDoc
module TcAnnotations
tcAnnotations :: [LAnnDecl Name] -> TcM [Annotation]
annCtxt :: (OutputableBndrId id) => AnnDecl id -> SDoc
module TcHsSyn
hsLitType :: HsLit -> TcType
hsLPatType :: OutPat Id -> Type
hsPatType :: Pat Id -> Type
mkHsDictLet :: TcEvBinds -> LHsExpr Id -> LHsExpr Id
mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name
mkHsAppTy :: LHsType name -> LHsType name -> LHsType name
-- | A simple case alternative with a single pattern, no binds, no guards;
-- pre-typechecking
mkHsCaseAlt :: LPat id -> (Located (body id)) -> LMatch id (Located (body id))
nlHsIntLit :: Integer -> LHsExpr id
shortCutLit :: DynFlags -> OverLitVal -> TcType -> Maybe (HsExpr TcId)
hsOverLitName :: OverLitVal -> Name
-- | Returns the type of the whole pattern
conLikeResTy :: ConLike -> [Type] -> Type
type TcId = Id
type TcIdSet = IdSet
zonkTopDecls :: Bag EvBind -> LHsBinds TcId -> [LRuleDecl TcId] -> [LVectDecl TcId] -> [LTcSpecPrag] -> [LForeignDecl TcId] -> TcM (TypeEnv, Bag EvBind, LHsBinds Id, [LForeignDecl Id], [LTcSpecPrag], [LRuleDecl Id], [LVectDecl Id])
zonkTopExpr :: HsExpr TcId -> TcM (HsExpr Id)
zonkTopLExpr :: LHsExpr TcId -> TcM (LHsExpr Id)
zonkTopBndrs :: [TcId] -> TcM [Id]
zonkTyBndrsX :: ZonkEnv -> [TcTyVar] -> TcM (ZonkEnv, [TyVar])
zonkTyVarBindersX :: ZonkEnv -> [TyVarBndr TcTyVar vis] -> TcM (ZonkEnv, [TyVarBndr TyVar vis])
zonkTyVarBinderX :: ZonkEnv -> TyVarBndr TcTyVar vis -> TcM (ZonkEnv, TyVarBndr TyVar vis)
emptyZonkEnv :: ZonkEnv
mkEmptyZonkEnv :: UnboundTyVarZonker -> ZonkEnv
zonkTcTypeToType :: ZonkEnv -> TcType -> TcM Type
zonkTcTypeToTypes :: ZonkEnv -> [TcType] -> TcM [Type]
zonkTyVarOcc :: ZonkEnv -> TyVar -> TcM TcType
zonkCoToCo :: ZonkEnv -> Coercion -> TcM Coercion
zonkSigType :: TcType -> TcM Type
zonkEvBinds :: ZonkEnv -> Bag EvBind -> TcM (ZonkEnv, Bag EvBind)
instance Outputable.Outputable TcHsSyn.ZonkEnv
module TmOracle
-- | Lifted expressions for pattern match checking.
data PmExpr
PmExprVar :: Name -> PmExpr
PmExprCon :: ConLike -> [PmExpr] -> PmExpr
PmExprLit :: PmLit -> PmExpr
PmExprEq :: PmExpr -> PmExpr -> PmExpr
PmExprOther :: (HsExpr Id) -> PmExpr
-- | Literals (simple and overloaded ones) for pattern match checking.
data PmLit
PmSLit :: HsLit -> PmLit
PmOLit :: Bool -> (HsOverLit Id) -> PmLit
-- | Term equalities
type SimpleEq = (Id, PmExpr)
type ComplexEq = (PmExpr, PmExpr)
-- | The type of substitutions.
type PmVarEnv = NameEnv PmExpr
-- | Expression False
falsePmExpr :: PmExpr
-- | Equality between literals for pattern match checking.
eqPmLit :: PmLit -> PmLit -> Bool
filterComplex :: [ComplexEq] -> [PmNegLitCt]
-- | Check if an expression is lifted or not
isNotPmExprOther :: PmExpr -> Bool
runPmPprM :: PmPprM a -> [PmNegLitCt] -> (a, [(SDoc, [PmLit])])
lhsExprToPmExpr :: LHsExpr Id -> PmExpr
hsExprToPmExpr :: HsExpr Id -> PmExpr
pprPmExprWithParens :: PmExpr -> PmPprM SDoc
-- | External interface to the term oracle.
tmOracle :: TmState -> [ComplexEq] -> Maybe TmState
-- | The state of the term oracle (includes complex constraints that cannot
-- progress unless we get more information).
type TmState = ([ComplexEq], TmOracleEnv)
-- | Initial state of the oracle.
initialTmState :: TmState
-- | Solve a complex equality (top-level).
solveOneEq :: TmState -> ComplexEq -> Maybe TmState
-- | When we know that a variable is fresh, we do not actually have to
-- check whether anything changes, we know that nothing does. Hence,
-- extendSubst simply extends the substitution, unlike what
-- extendSubstAndSolve does.
extendSubst :: Id -> PmExpr -> TmState -> TmState
-- | Check whether a constraint (x ~ BOT) can succeed, given the resulting
-- state of the term oracle.
canDiverge :: Name -> TmState -> Bool
-- | Lift a SimpleEq to a ComplexEq
toComplex :: SimpleEq -> ComplexEq
-- | Apply an (un-flattened) substitution to an expression.
exprDeepLookup :: PmVarEnv -> PmExpr -> PmExpr
-- | Type of a PmLit
pmLitType :: PmLit -> Type
-- | Flatten the DAG (Could be improved in terms of performance.).
flattenPmVarEnv :: PmVarEnv -> PmVarEnv
module StgCmmHpc
initHpc :: Module -> HpcInfo -> FCode ()
mkTickBox :: DynFlags -> Module -> Int -> CmmAGraph
-- | The CompPipeline monad and associated ops
--
-- Defined in separate module so that it can safely be imported from
-- Hooks
module PipelineMonad
newtype CompPipeline a
P :: (PipeEnv -> PipeState -> IO (PipeState, a)) -> CompPipeline a
[unP] :: CompPipeline a -> PipeEnv -> PipeState -> IO (PipeState, a)
evalP :: CompPipeline a -> PipeEnv -> PipeState -> IO a
data PhasePlus
RealPhase :: Phase -> PhasePlus
HscOut :: HscSource -> ModuleName -> HscStatus -> PhasePlus
data PipeEnv
PipeEnv :: Phase -> String -> String -> String -> PipelineOutput -> PipeEnv
-- | Stop just before this phase
[stop_phase] :: PipeEnv -> Phase
-- | basename of original input source
[src_filename] :: PipeEnv -> String
-- | basename of original input source
[src_basename] :: PipeEnv -> String
-- | its extension
[src_suffix] :: PipeEnv -> String
-- | says where to put the pipeline output
[output_spec] :: PipeEnv -> PipelineOutput
data PipeState
PipeState :: HscEnv -> Maybe ModLocation -> [FilePath] -> PipeState
-- | only the DynFlags change in the HscEnv. The DynFlags change at various
-- points, for example when we read the OPTIONS_GHC pragmas in the Cpp
-- phase.
[hsc_env] :: PipeState -> HscEnv
-- | the ModLocation. This is discovered during compilation, in the Hsc
-- phase where we read the module header.
[maybe_loc] :: PipeState -> Maybe ModLocation
-- | additional object files resulting from compiling foreign code. They
-- come from two sources: foreign stubs, and add{C,Cxx,Objc,Objcxx}File
-- from template haskell
[foreign_os] :: PipeState -> [FilePath]
data PipelineOutput
-- | Output should be to a temporary file: we're going to run more
-- compilation steps on this output later.
Temporary :: PipelineOutput
-- | We want a persistent file, i.e. a file in the current directory
-- derived from the input filename, but with the appropriate extension.
-- eg. in "ghc -c Foo.hs" the output goes into ./Foo.o.
Persistent :: PipelineOutput
-- | The output must go into the specific outputFile in DynFlags. We don't
-- store the filename in the constructor as it changes when doing
-- -dynamic-too.
SpecificFile :: PipelineOutput
getPipeEnv :: CompPipeline PipeEnv
getPipeState :: CompPipeline PipeState
setDynFlags :: DynFlags -> CompPipeline ()
setModLocation :: ModLocation -> CompPipeline ()
setForeignOs :: [FilePath] -> CompPipeline ()
instance GHC.Show.Show PipelineMonad.PipelineOutput
instance GHC.Base.Functor PipelineMonad.CompPipeline
instance GHC.Base.Applicative PipelineMonad.CompPipeline
instance GHC.Base.Monad PipelineMonad.CompPipeline
instance Control.Monad.IO.Class.MonadIO PipelineMonad.CompPipeline
instance DynFlags.HasDynFlags PipelineMonad.CompPipeline
instance Outputable.Outputable PipelineMonad.PhasePlus
module IfaceEnv
newGlobalBinder :: Module -> OccName -> SrcSpan -> TcRnIf a b Name
newInteractiveBinder :: HscEnv -> OccName -> SrcSpan -> IO Name
externaliseName :: Module -> Name -> TcRnIf m n Name
-- | Look up a top-level name from the current Iface module
lookupIfaceTop :: OccName -> IfL Name
-- | Look up the Name for a given Module and OccName.
-- Consider alternately using lookupIfaceTop if you're in the
-- IfL monad and Module is simply that of the
-- ModIface you are typechecking.
lookupOrig :: Module -> OccName -> TcRnIf a b Name
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
newIfaceName :: OccName -> IfL Name
newIfaceNames :: [OccName] -> IfL [Name]
extendIfaceIdEnv :: [Id] -> IfL a -> IfL a
extendIfaceTyVarEnv :: [TyVar] -> IfL a -> IfL a
tcIfaceLclId :: FastString -> IfL Id
tcIfaceTyVar :: FastString -> IfL TyVar
lookupIfaceVar :: IfaceBndr -> IfL (Maybe TyCoVar)
lookupIfaceTyVar :: IfaceTvBndr -> IfL (Maybe TyVar)
extendIfaceEnvs :: [TyCoVar] -> IfL a -> IfL a
-- | Set the Module of a Name.
setNameModule :: Maybe Module -> Name -> TcRnIf m n Name
ifaceExportNames :: [IfaceExport] -> TcRnIf gbl lcl [AvailInfo]
allocateGlobalBinder :: NameCache -> Module -> OccName -> SrcSpan -> (NameCache, Name)
updNameCache :: (NameCache -> (NameCache, c)) -> TcRnIf a b c
mkNameCacheUpdater :: TcRnIf a b NameCacheUpdater
-- | A function that atomically updates the name cache given a modifier
-- function. The second result of the modifier function will be the
-- result of the IO action.
newtype NameCacheUpdater
NCU :: (forall c. (NameCache -> (NameCache, c)) -> IO c) -> NameCacheUpdater
[updateNameCache] :: NameCacheUpdater -> forall c. (NameCache -> (NameCache, c)) -> IO c
module NameShape
-- | A NameShape is a substitution on Names that can be used
-- to refine the identities of a hole while we are renaming interfaces
-- (see RnModIface). Specifically, a NameShape for
-- ns_module_name A, defines a mapping from
-- {A.T} (for some OccName T) to some arbitrary
-- other Name.
--
-- The most intruiging thing about a NameShape, however, is how
-- it's constructed. A NameShape is *implied* by the exported
-- AvailInfos of the implementor of an interface: if an
-- implementor of signature H exports M.T, you
-- implicitly define a substitution from {H.T} to M.T.
-- So a NameShape is computed from the list of AvailInfos
-- that are exported by the implementation of a module, or successively
-- merged together by the export lists of signatures which are joining
-- together.
--
-- It's not the most obvious way to go about doing this, but it does seem
-- to work!
--
-- NB: Can't boot this and put it in NameShape because then we start
-- pulling in too many DynFlags things.
data NameShape
NameShape :: ModuleName -> [AvailInfo] -> OccEnv Name -> NameShape
[ns_mod_name] :: NameShape -> ModuleName
[ns_exports] :: NameShape -> [AvailInfo]
[ns_map] :: NameShape -> OccEnv Name
-- | Create an empty NameShape (i.e., the renaming that would occur
-- with an implementing module with no exports) for a specific hole
-- mod_name.
emptyNameShape :: ModuleName -> NameShape
-- | Create a NameShape corresponding to an implementing module for
-- the hole mod_name that exports a list of AvailInfos.
mkNameShape :: ModuleName -> [AvailInfo] -> NameShape
-- | Given an existing NameShape, merge it with a list of
-- AvailInfos with Backpack style mix-in linking. This is used
-- solely when merging signatures together: we successively merge the
-- exports of each signature until we have the final, full exports of the
-- merged signature.
--
-- What makes this operation nontrivial is what we are supposed to do
-- when we want to merge in an export for M.T when we already have an
-- existing export {H.T}. What should happen in this case is that {H.T}
-- should be unified with M.T: we've determined a more *precise*
-- identity for the export at OccName T.
--
-- Note that we don't do unrestricted unification: only name holes from
-- ns_mod_name ns are flexible. This is because we have a much
-- more restricted notion of shaping than in Backpack'14: we do shaping
-- *as* we do type-checking. Thus, once we shape a signature, its exports
-- are *final* and we're not allowed to refine them further,
extendNameShape :: HscEnv -> NameShape -> [AvailInfo] -> IO (Either SDoc NameShape)
-- | The export list associated with this NameShape (i.e., what the
-- exports of an implementing module which induces this NameShape
-- would be.)
nameShapeExports :: NameShape -> [AvailInfo]
-- | Given a Name, substitute it according to the NameShape
-- implied substitution, i.e. map {A.T} to M.T, if the
-- implementing module exports M.T.
substNameShape :: NameShape -> Name -> Name
-- | Like substNameShape, but returns Nothing if no
-- substitution works.
maybeSubstNameShape :: NameShape -> Name -> Maybe Name
-- | This module implements interface renaming, which is used to rewrite
-- interface files on the fly when we are doing indefinite typechecking
-- and need instantiations of modules which do not necessarily exist yet.
module RnModIface
-- | What we have is a generalized ModIface, which corresponds to a module
-- that looks like p[A=A]:B. We need a *specific* ModIface, e.g.
-- p[A=q():A]:B (or maybe even p[A=B]:B) which we load up (either
-- to merge it, or to just use during typechecking).
--
-- Suppose we have:
--
-- p[A=A]:M ==> p[A=q():A]:M
--
-- Substitute all occurrences of A with q():A (renameHoleModule).
-- Then, for any Name of form {A.T}, replace the Name with the Name
-- according to the exports of the implementing module. This works even
-- for p[A=B]:M, since we just read in the exports of B.hi, which
-- is assumed to be ready now.
--
-- This function takes an optional NameShape, which can be used to
-- further refine the identities in this interface: suppose we read a
-- declaration for {H.T} but we actually know that this should be Foo.T;
-- then we'll also rename this (this is used when loading an interface to
-- merge it into a requirement.)
rnModIface :: HscEnv -> [(ModuleName, Module)] -> Maybe NameShape -> ModIface -> IO (Either ErrorMessages ModIface)
-- | Rename just the exports of a ModIface. Useful when we're doing
-- shaping prior to signature merging.
rnModExports :: HscEnv -> [(ModuleName, Module)] -> ModIface -> IO (Either ErrorMessages [AvailInfo])
tcRnModIface :: [(ModuleName, Module)] -> Maybe NameShape -> ModIface -> TcM ModIface
tcRnModExports :: [(ModuleName, Module)] -> ModIface -> TcM [AvailInfo]
module DebuggerUtils
-- | Given a data constructor in the heap, find its Name. The info tables
-- for data constructors have a field which records the source name of
-- the constructor as a Ptr Word8 (UTF-8 encoded string). The format is:
--
--
-- Package:Module.Name
--
--
-- We use this string to lookup the interpreter's internal representation
-- of the name using the lookupOrig.
dataConInfoPtrToName :: Ptr () -> TcM (Either String Name)
module Hooks
data Hooks
-- | Hooks can be used by GHC API clients to replace parts of the compiler
-- pipeline. If a hook is not installed, GHC uses the default built-in
-- behaviour
emptyHooks :: Hooks
lookupHook :: (Hooks -> Maybe a) -> a -> DynFlags -> a
getHooked :: (Functor f, HasDynFlags f) => (Hooks -> Maybe a) -> a -> f a
dsForeignsHook :: Hooks -> Maybe ([LForeignDecl Id] -> DsM (ForeignStubs, OrdList (Id, CoreExpr)))
tcForeignImportsHook :: Hooks -> Maybe ([LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt))
tcForeignExportsHook :: Hooks -> Maybe ([LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt))
hscFrontendHook :: Hooks -> Maybe (ModSummary -> Hsc FrontendResult)
hscCompileCoreExprHook :: Hooks -> Maybe (HscEnv -> SrcSpan -> CoreExpr -> IO ForeignHValue)
ghcPrimIfaceHook :: Hooks -> Maybe ModIface
runPhaseHook :: Hooks -> Maybe (PhasePlus -> FilePath -> DynFlags -> CompPipeline (PhasePlus, FilePath))
runMetaHook :: Hooks -> Maybe (MetaHook TcM)
linkHook :: Hooks -> Maybe (GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag)
runRnSpliceHook :: Hooks -> Maybe (HsSplice Name -> RnM (HsSplice Name))
getValueSafelyHook :: Hooks -> Maybe (HscEnv -> Name -> Type -> IO (Maybe HValue))
createIservProcessHook :: Hooks -> Maybe (CreateProcess -> IO ProcessHandle)
module GhcMonad
-- | A monad that has all the features needed by GHC API calls.
--
-- In short, a GHC monad
--
--
-- - allows embedding of IO actions,
-- - can log warnings,
-- - allows handling of (extensible) exceptions, and
-- - maintains a current session.
--
--
-- If you do not use Ghc or GhcT, make sure to call
-- initGhcMonad before any call to the GHC API functions can
-- occur.
class (Functor m, MonadIO m, ExceptionMonad m, HasDynFlags m) => GhcMonad m
getSession :: GhcMonad m => m HscEnv
setSession :: GhcMonad m => HscEnv -> m ()
-- | A minimal implementation of a GhcMonad. If you need a custom
-- monad, e.g., to maintain additional state consider wrapping this monad
-- or using GhcT.
newtype Ghc a
Ghc :: (Session -> IO a) -> Ghc a
[unGhc] :: Ghc a -> Session -> IO a
-- | A monad transformer to add GHC specific features to another monad.
--
-- Note that the wrapped monad must support IO and handling of
-- exceptions.
newtype GhcT m a
GhcT :: (Session -> m a) -> GhcT m a
[unGhcT] :: GhcT m a -> Session -> m a
liftGhcT :: m a -> GhcT m a
-- | Reflect a computation in the Ghc monad into the IO
-- monad.
--
-- You can use this to call functions returning an action in the
-- Ghc monad inside an IO action. This is needed for some
-- (too restrictive) callback arguments of some library functions:
--
--
-- libFunc :: String -> (Int -> IO a) -> IO a
-- ghcFunc :: Int -> Ghc a
--
-- ghcFuncUsingLibFunc :: String -> Ghc a -> Ghc a
-- ghcFuncUsingLibFunc str =
-- reifyGhc $ \s ->
-- libFunc $ \i -> do
-- reflectGhc (ghcFunc i) s
--
reflectGhc :: Ghc a -> Session -> IO a
reifyGhc :: (Session -> IO a) -> Ghc a
-- | Grabs the DynFlags from the Session
getSessionDynFlags :: GhcMonad m => m DynFlags
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => forall a. () => IO a -> m a
-- | The Session is a handle to the complete state of a compilation
-- session. A compilation session consists of a set of modules
-- constituting the current program or library, the context for
-- interactive evaluation, and various caches.
data Session
Session :: !(IORef HscEnv) -> Session
-- | Call the argument with the current session.
withSession :: GhcMonad m => (HscEnv -> m a) -> m a
-- | Set the current session to the result of applying the current session
-- to the argument.
modifySession :: GhcMonad m => (HscEnv -> HscEnv) -> m ()
-- | Call an action with a temporarily modified Session.
withTempSession :: GhcMonad m => (HscEnv -> HscEnv) -> m a -> m a
-- | A monad that allows logging of warnings.
logWarnings :: GhcMonad m => WarningMessages -> m ()
-- | Print the error message and all warnings. Useful inside exception
-- handlers. Clears warnings after printing.
printException :: GhcMonad m => SourceError -> m ()
-- | A function called to log warnings and errors.
type WarnErrLogger = forall m. GhcMonad m => Maybe SourceError -> m ()
defaultWarnErrLogger :: WarnErrLogger
instance GHC.Base.Functor m => GHC.Base.Functor (GhcMonad.GhcT m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (GhcMonad.GhcT m)
instance GHC.Base.Monad m => GHC.Base.Monad (GhcMonad.GhcT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (GhcMonad.GhcT m)
instance Exception.ExceptionMonad m => Exception.ExceptionMonad (GhcMonad.GhcT m)
instance Control.Monad.IO.Class.MonadIO m => DynFlags.HasDynFlags (GhcMonad.GhcT m)
instance Exception.ExceptionMonad m => GhcMonad.GhcMonad (GhcMonad.GhcT m)
instance GHC.Base.Functor GhcMonad.Ghc
instance GHC.Base.Applicative GhcMonad.Ghc
instance GHC.Base.Monad GhcMonad.Ghc
instance Control.Monad.IO.Class.MonadIO GhcMonad.Ghc
instance Control.Monad.Fix.MonadFix GhcMonad.Ghc
instance Exception.ExceptionMonad GhcMonad.Ghc
instance DynFlags.HasDynFlags GhcMonad.Ghc
instance GhcMonad.GhcMonad GhcMonad.Ghc
-- | Interacting with the interpreter, whether it is running on an external
-- process or in the current process.
module GHCi
-- | Execute an action of type IO [a], returning
-- ForeignHValues for each of the results.
evalStmt :: HscEnv -> Bool -> EvalExpr ForeignHValue -> IO (EvalStatus_ [ForeignHValue] [HValueRef])
data EvalStatus_ a b :: * -> * -> *
EvalComplete :: Word64 -> EvalResult a -> EvalStatus_ a b
EvalBreak :: Bool -> HValueRef -> Int -> Int -> RemoteRef ResumeContext b -> RemotePtr CostCentreStack -> EvalStatus_ a b
type EvalStatus a = EvalStatus_ a a
data EvalResult a :: * -> *
EvalException :: SerializableException -> EvalResult a
EvalSuccess :: a -> EvalResult a
-- | We can pass simple expressions to EvalStmt, consisting of values and
-- application. This allows us to wrap the statement to be executed in
-- another function, which is used by GHCi to implement :set args and
-- :set prog. It might be worthwhile to extend this little language in
-- the future.
data EvalExpr a :: * -> *
EvalThis :: a -> EvalExpr a
EvalApp :: EvalExpr a -> EvalExpr a -> EvalExpr a
resumeStmt :: HscEnv -> Bool -> ForeignRef (ResumeContext [HValueRef]) -> IO (EvalStatus_ [ForeignHValue] [HValueRef])
abandonStmt :: HscEnv -> ForeignRef (ResumeContext [HValueRef]) -> IO ()
-- | Execute an action of type IO ()
evalIO :: HscEnv -> ForeignHValue -> IO ()
-- | Execute an action of type IO String
evalString :: HscEnv -> ForeignHValue -> IO String
-- | Execute an action of type String -> IO String
evalStringToIOString :: HscEnv -> ForeignHValue -> String -> IO String
-- | Allocate and store the given bytes in memory, returning a pointer to
-- the memory in the remote process.
mallocData :: HscEnv -> ByteString -> IO (RemotePtr ())
-- | Create a set of BCOs that may be mutually recursive.
createBCOs :: HscEnv -> [ResolvedBCO] -> IO [HValueRef]
addSptEntry :: HscEnv -> Fingerprint -> ForeignHValue -> IO ()
mkCostCentres :: HscEnv -> String -> [(String, String)] -> IO [RemotePtr CostCentre]
costCentreStackInfo :: HscEnv -> RemotePtr CostCentreStack -> IO [String]
newBreakArray :: HscEnv -> Int -> IO (ForeignRef BreakArray)
enableBreakpoint :: HscEnv -> ForeignRef BreakArray -> Int -> Bool -> IO ()
breakpointStatus :: HscEnv -> ForeignRef BreakArray -> Int -> IO Bool
getBreakpointVar :: HscEnv -> ForeignHValue -> Int -> IO (Maybe ForeignHValue)
initObjLinker :: HscEnv -> IO ()
lookupSymbol :: HscEnv -> FastString -> IO (Maybe (Ptr ()))
lookupClosure :: HscEnv -> String -> IO (Maybe HValueRef)
-- | loadDLL loads a dynamic library using the OS's native linker (i.e.
-- dlopen() on Unix, LoadLibrary() on Windows). It takes either an
-- absolute pathname to the file, or a relative filename (e.g.
-- "libfoo.so" or "foo.dll"). In the latter case, loadDLL searches the
-- standard locations for the appropriate library.
--
-- Returns:
--
-- Nothing => success Just err_msg => failure
loadDLL :: HscEnv -> String -> IO (Maybe String)
loadArchive :: HscEnv -> String -> IO ()
loadObj :: HscEnv -> String -> IO ()
unloadObj :: HscEnv -> String -> IO ()
addLibrarySearchPath :: HscEnv -> String -> IO (Ptr ())
removeLibrarySearchPath :: HscEnv -> Ptr () -> IO Bool
resolveObjs :: HscEnv -> IO SuccessFlag
findSystemLibrary :: HscEnv -> String -> IO (Maybe String)
-- | Run a command in the interpreter's context. With
-- -fexternal-interpreter, the command is serialized and sent to
-- an external iserv process, and the response is deserialized (hence the
-- Binary constraint). With -fno-external-interpreter
-- we execute the command directly here.
iservCmd :: Binary a => HscEnv -> Message a -> IO a
-- | A Message a is a message that returns a value of type
-- a. These are requests sent from GHC to the server.
data Message a :: * -> *
-- | Exit the iserv process
[Shutdown] :: Message ()
[InitLinker] :: Message ()
[LookupSymbol] :: Message Maybe RemotePtr ()
[LookupClosure] :: Message Maybe HValueRef
[LoadDLL] :: Message Maybe String
[LoadArchive] :: Message ()
[LoadObj] :: Message ()
[UnloadObj] :: Message ()
[AddLibrarySearchPath] :: Message RemotePtr ()
[RemoveLibrarySearchPath] :: Message Bool
[ResolveObjs] :: Message Bool
[FindSystemLibrary] :: Message Maybe String
-- | Create a set of BCO objects, and return HValueRefs to them Note: Each
-- ByteString contains a Binary-encoded [ResolvedBCO], not a ResolvedBCO.
-- The list is to allow us to serialise the ResolvedBCOs in parallel. See
-- createBCOs in compilerghciGHCi.hsc.
[CreateBCOs] :: Message [HValueRef]
-- | Release HValueRefs
[FreeHValueRefs] :: Message ()
-- | Add entries to the Static Pointer Table
[AddSptEntry] :: Message ()
-- | Malloc some data and return a RemotePtr to it
[MallocData] :: Message RemotePtr ()
[MallocStrings] :: Message [RemotePtr ()]
-- | Calls prepareForeignCall
[PrepFFI] :: Message RemotePtr C_ffi_cif
-- | Free data previously created by PrepFFI
[FreeFFI] :: Message ()
-- | Create an info table for a constructor
[MkConInfoTable] :: Message RemotePtr StgInfoTable
-- | Evaluate a statement
[EvalStmt] :: Message EvalStatus_ [HValueRef] [HValueRef]
-- | Resume evaluation of a statement after a breakpoint
[ResumeStmt] :: Message EvalStatus_ [HValueRef] [HValueRef]
-- | Abandon evaluation of a statement after a breakpoint
[AbandonStmt] :: Message ()
-- | Evaluate something of type IO String
[EvalString] :: Message EvalResult String
-- | Evaluate something of type String -> IO String
[EvalStringToString] :: Message EvalResult String
-- | Evaluate something of type IO ()
[EvalIO] :: Message EvalResult ()
-- | Create a set of CostCentres with the same module name
[MkCostCentres] :: Message [RemotePtr CostCentre]
-- | Show a CostCentreStack as a [String]
[CostCentreStackInfo] :: Message [String]
-- | Create a new array of breakpoint flags
[NewBreakArray] :: Message RemoteRef BreakArray
-- | Enable a breakpoint
[EnableBreakpoint] :: Message ()
-- | Query the status of a breakpoint (True = enabled)
[BreakpointStatus] :: Message Bool
-- | Get a reference to a free variable at a breakpoint
[GetBreakpointVar] :: Message Maybe HValueRef
-- | Start a new TH module, return a state token that should be
[StartTH] :: Message RemoteRef IORef QState
-- | Evaluate a TH computation.
--
-- Returns a ByteString, because we have to force the result before
-- returning it to ensure there are no errors lurking in it. The TH types
-- don't have NFData instances, and even if they did, we have to
-- serialize the value anyway, so we might as well serialize it to force
-- it.
[RunTH] :: Message QResult ByteString
-- | Run the given mod finalizers.
[RunModFinalizers] :: Message QResult ()
-- | Grab a lock on the IServ and do something with it. Overloaded
-- because this is used from TcM as well as IO.
withIServ :: (MonadIO m, ExceptionMonad m) => HscEnv -> (IServ -> m a) -> m a
stopIServ :: HscEnv -> IO ()
-- | Send a Message and receive the response from the iserv process
iservCall :: Binary a => IServ -> Message a -> IO a
-- | Read a value from the iserv process
readIServ :: IServ -> Get a -> IO a
-- | Send a value to the iserv process
writeIServ :: IServ -> Put -> IO ()
purgeLookupSymbolCache :: HscEnv -> IO ()
freeHValueRefs :: HscEnv -> [HValueRef] -> IO ()
-- | Creates a ForeignRef that will automatically release the
-- RemoteRef when it is no longer referenced.
mkFinalizedHValue :: HscEnv -> RemoteRef a -> IO (ForeignRef a)
-- | Convert a ForeignRef to the value it references directly. This
-- only works when the interpreter is running in the same process as the
-- compiler, so it fails when -fexternal-interpreter is on.
wormhole :: DynFlags -> ForeignRef a -> IO a
-- | Convert an RemoteRef to the value it references directly. This
-- only works when the interpreter is running in the same process as the
-- compiler, so it fails when -fexternal-interpreter is on.
wormholeRef :: DynFlags -> RemoteRef a -> IO a
mkEvalOpts :: DynFlags -> Bool -> EvalOpts
fromEvalResult :: EvalResult a -> IO a
module Finder
flushFinderCaches :: HscEnv -> IO ()
-- | The result of searching for an imported module.
--
-- NB: FindResult manages both user source-import lookups (which can
-- result in Module) as well as direct imports for interfaces
-- (which always result in InstalledModule).
data FindResult
-- | The module was found
Found :: ModLocation -> Module -> FindResult
-- | The requested package was not found
NoPackage :: UnitId -> FindResult
-- | _Error_: both in multiple packages
FoundMultiple :: [(Module, ModuleOrigin)] -> FindResult
-- | Not found
NotFound :: [FilePath] -> Maybe UnitId -> [UnitId] -> [UnitId] -> [ModuleSuggestion] -> FindResult
[fr_paths] :: FindResult -> [FilePath]
[fr_pkg] :: FindResult -> Maybe UnitId
[fr_mods_hidden] :: FindResult -> [UnitId]
[fr_pkgs_hidden] :: FindResult -> [UnitId]
[fr_suggestions] :: FindResult -> [ModuleSuggestion]
-- | Locate a module that was imported by the user. We have the module's
-- name, and possibly a package name. Without a package name, this
-- function will use the search path and the known exposed packages to
-- find the module, if a package is specified then only that package is
-- searched for the module.
findImportedModule :: HscEnv -> ModuleName -> Maybe FastString -> IO FindResult
-- | Locate a plugin module requested by the user, for a compiler plugin.
-- This consults the same set of exposed packages as
-- findImportedModule, unless -hide-all-plugin-packages
-- or -plugin-package are specified.
findPluginModule :: HscEnv -> ModuleName -> IO FindResult
-- | Locate a specific Module. The purpose of this function is to
-- create a ModLocation for a given Module, that is to find
-- out where the files associated with this module live. It is used when
-- reading the interface for a module mentioned by another interface, for
-- example (a "system import").
findExactModule :: HscEnv -> InstalledModule -> IO InstalledFindResult
findHomeModule :: HscEnv -> ModuleName -> IO FindResult
findExposedPackageModule :: HscEnv -> ModuleName -> Maybe FastString -> IO FindResult
mkHomeModLocation :: DynFlags -> ModuleName -> FilePath -> IO ModLocation
mkHomeModLocation2 :: DynFlags -> ModuleName -> FilePath -> String -> IO ModLocation
mkHiOnlyModLocation :: DynFlags -> Suffix -> FilePath -> String -> IO ModLocation
-- | Constructs the filename of a .hi file for a given source file. Does
-- not check whether the .hi file exists
mkHiPath :: DynFlags -> FilePath -> String -> FilePath
-- | Constructs the filename of a .o file for a given source file. Does
-- not check whether the .o file exists
mkObjPath :: DynFlags -> FilePath -> String -> FilePath
addHomeModuleToFinder :: HscEnv -> ModuleName -> ModLocation -> IO Module
uncacheModule :: HscEnv -> ModuleName -> IO ()
mkStubPaths :: DynFlags -> ModuleName -> ModLocation -> FilePath
findObjectLinkableMaybe :: Module -> ModLocation -> IO (Maybe Linkable)
findObjectLinkable :: Module -> FilePath -> UTCTime -> IO Linkable
cannotFindModule :: DynFlags -> ModuleName -> FindResult -> SDoc
cannotFindInterface :: DynFlags -> ModuleName -> InstalledFindResult -> SDoc
module DsUsage
mkUsageInfo :: HscEnv -> Module -> ImportedMods -> NameSet -> [FilePath] -> [(Module, Fingerprint)] -> IO [Usage]
mkUsedNames :: TcGblEnv -> NameSet
-- | Extract information from the rename and typecheck phases to produce a
-- dependencies information for the module being compiled.
mkDependencies :: TcGblEnv -> IO Dependencies
module CmmPipeline
-- | Top level driver for C-- pipeline
cmmPipeline :: HscEnv -> TopSRT -> CmmGroup -> IO (TopSRT, CmmGroup)
-- | ByteCodeLink: Bytecode assembler and linker
module ByteCodeLink
type ClosureEnv = NameEnv (Name, ForeignHValue)
emptyClosureEnv :: ClosureEnv
extendClosureEnv :: ClosureEnv -> [(Name, ForeignHValue)] -> ClosureEnv
linkBCO :: HscEnv -> ItblEnv -> ClosureEnv -> NameEnv Int -> RemoteRef BreakArray -> UnlinkedBCO -> IO ResolvedBCO
lookupStaticPtr :: HscEnv -> FastString -> IO (Ptr ())
lookupIE :: HscEnv -> ItblEnv -> Name -> IO (Ptr ())
nameToCLabel :: Name -> String -> FastString
linkFail :: String -> String -> IO a
-- | ByteCodeItbls: Generate infotables for interpreter-made bytecodes
module ByteCodeItbls
mkITbls :: HscEnv -> [TyCon] -> IO ItblEnv
-- | Statistics for per-module compilations
--
-- (c) The GRASP/AQUA Project, Glasgow University, 1993-1998
module HscStats
-- | Source Statistics
ppSourceStats :: Bool -> Located (HsModule RdrName) -> SDoc
-- | Contains a debug function to dump parts of the hsSyn AST. It uses a
-- syb traversal which falls back to displaying based on the constructor
-- name, so can be used to dump anything having a Data.Data
-- instance.
module HsDumpAst
-- | Show a GHC syntax tree. This parameterised because it is also used for
-- comparing ASTs in ppr roundtripping tests, where the SrcSpan's are
-- blanked out, to avoid comparing locations, only structure
showAstData :: Data a => BlankSrcSpan -> a -> String
data BlankSrcSpan
BlankSrcSpan :: BlankSrcSpan
NoBlankSrcSpan :: BlankSrcSpan
instance GHC.Show.Show HsDumpAst.BlankSrcSpan
instance GHC.Classes.Eq HsDumpAst.BlankSrcSpan
module HaddockUtils
addFieldDoc :: LConDeclField a -> Maybe LHsDocString -> LConDeclField a
addFieldDocs :: [LConDeclField a] -> Maybe LHsDocString -> [LConDeclField a]
addConDoc :: LConDecl a -> Maybe LHsDocString -> LConDecl a
addConDocs :: [LConDecl a] -> Maybe LHsDocString -> [LConDecl a]
addConDocFirst :: [LConDecl a] -> Maybe LHsDocString -> [LConDecl a]
module Coverage
addTicksToBinds :: HscEnv -> Module -> ModLocation -> NameSet -> [TyCon] -> LHsBinds Id -> IO (LHsBinds Id, HpcInfo, Maybe ModBreaks)
hpcInitCode :: Module -> HpcInfo -> SDoc
instance GHC.Classes.Eq Coverage.TickishType
instance GHC.Classes.Eq Coverage.TickDensity
instance GHC.Base.Functor Coverage.TM
instance GHC.Base.Applicative Coverage.TM
instance GHC.Base.Monad Coverage.TM
instance DynFlags.HasDynFlags Coverage.TM
instance UniqSupply.MonadUnique Coverage.TM
module Convert
convertToHsExpr :: SrcSpan -> Exp -> Either MsgDoc (LHsExpr RdrName)
convertToPat :: SrcSpan -> Pat -> Either MsgDoc (LPat RdrName)
convertToHsDecls :: SrcSpan -> [Dec] -> Either MsgDoc [LHsDecl RdrName]
convertToHsType :: SrcSpan -> Type -> Either MsgDoc (LHsType RdrName)
thRdrNameGuesses :: Name -> [RdrName]
instance GHC.Base.Functor Convert.CvtM
instance GHC.Base.Applicative Convert.CvtM
instance GHC.Base.Monad Convert.CvtM
-- | This is the syntax for bkp files which are parsed in 'ghc --backpack'
-- mode. This syntax is used purely for testing purposes.
module BkpSyn
data HsUnitId n
HsUnitId :: (Located n) -> [LHsModuleSubst n] -> HsUnitId n
type LHsUnitId n = Located (HsUnitId n)
type HsModuleSubst n = (Located ModuleName, LHsModuleId n)
type LHsModuleSubst n = Located (HsModuleSubst n)
data HsModuleId n
HsModuleVar :: (Located ModuleName) -> HsModuleId n
HsModuleId :: (LHsUnitId n) -> (Located ModuleName) -> HsModuleId n
type LHsModuleId n = Located (HsModuleId n)
data HsComponentId
HsComponentId :: PackageName -> ComponentId -> HsComponentId
[hsPackageName] :: HsComponentId -> PackageName
[hsComponentId] :: HsComponentId -> ComponentId
type LHsUnit n = Located (HsUnit n)
-- | Top level unit declaration in a Backpack file.
data HsUnit n
HsUnit :: Located n -> [LHsUnitDecl n] -> HsUnit n
[hsunitName] :: HsUnit n -> Located n
[hsunitBody] :: HsUnit n -> [LHsUnitDecl n]
type LHsUnitDecl n = Located (HsUnitDecl n)
data HsUnitDecl n
DeclD :: HsDeclType -> (Located ModuleName) -> (Maybe (Located (HsModule RdrName))) -> HsUnitDecl n
IncludeD :: (IncludeDecl n) -> HsUnitDecl n
-- | A declaration in a package, e.g. a module or signature definition, or
-- an include.
data HsDeclType
ModuleD :: HsDeclType
SignatureD :: HsDeclType
-- | An include of another unit
data IncludeDecl n
IncludeDecl :: LHsUnitId n -> Maybe [LRenaming] -> Bool -> IncludeDecl n
[idUnitId] :: IncludeDecl n -> LHsUnitId n
[idModRenaming] :: IncludeDecl n -> Maybe [LRenaming]
-- | Is this a dependency signature include? If so, we don't
-- compile this include when we instantiate this unit (as there should
-- not be any modules brought into scope.)
[idSignatureInclude] :: IncludeDecl n -> Bool
type LRenaming = Located Renaming
-- | Rename a module from one name to another. The identity renaming means
-- that the module should be brought into scope.
data Renaming
Renaming :: Located ModuleName -> Maybe (Located ModuleName) -> Renaming
[renameFrom] :: Renaming -> Located ModuleName
[renameTo] :: Renaming -> Maybe (Located ModuleName)
instance Outputable.Outputable BkpSyn.HsComponentId
-- | This module provides the generated Happy parser for Haskell. It
-- exports a number of parsers which may be used in any library that uses
-- the GHC API. A common usage pattern is to initialize the parser state
-- with a given string and then parse that string:
--
--
-- runParser :: DynFlags -> String -> P a -> ParseResult a
-- runParser flags str parser = unP parser parseState
-- where
-- filename = "<interactive>"
-- location = mkRealSrcLoc (mkFastString filename) 1 1
-- buffer = stringToStringBuffer str
-- parseState = mkPState flags buffer location
--
module Parser
parseModule :: P Located HsModule RdrName
parseSignature :: P Located HsModule RdrName
parseImport :: P LImportDecl RdrName
parseStatement :: P LStmt RdrName LHsExpr RdrName
parseBackpack :: P [LHsUnit PackageName]
parseDeclaration :: P LHsDecl RdrName
parseExpression :: P LHsExpr RdrName
parsePattern :: P LPat RdrName
parseTypeSignature :: P LHsDecl RdrName
parseStmt :: P Maybe LStmt RdrName LHsExpr RdrName
parseIdentifier :: P Located RdrName
parseType :: P LHsType RdrName
parseHeader :: P Located HsModule RdrName
-- | Parsing the top of a Haskell source file to get its module name,
-- imports and options.
--
-- (c) Simon Marlow 2005 (c) Lemmih 2006
module HeaderInfo
-- | Parse the imports of a source file.
--
-- Throws a SourceError if parsing fails.
getImports :: DynFlags -> StringBuffer -> FilePath -> FilePath -> IO ([(Maybe FastString, Located ModuleName)], [(Maybe FastString, Located ModuleName)], Located ModuleName)
mkPrelImports :: ModuleName -> SrcSpan -> Bool -> [LImportDecl RdrName] -> [LImportDecl RdrName]
-- | Parse OPTIONS and LANGUAGE pragmas of the source file.
--
-- Throws a SourceError if flag parsing fails (including
-- unsupported flags.)
getOptionsFromFile :: DynFlags -> FilePath -> IO [Located String]
-- | Parse OPTIONS and LANGUAGE pragmas of the source file.
--
-- Throws a SourceError if flag parsing fails (including
-- unsupported flags.)
getOptions :: DynFlags -> StringBuffer -> FilePath -> [Located String]
optionsErrorMsgs :: DynFlags -> [String] -> [Located String] -> FilePath -> Messages
-- | Complain about non-dynamic flags in OPTIONS pragmas.
--
-- Throws a SourceError if the input list is non-empty claiming
-- that the input flags are unknown.
checkProcessArgsResult :: MonadIO m => DynFlags -> [Located String] -> m ()
-- | Commonly useful utilites for manipulating the Core language
module CoreUtils
-- | Wrap the given expression in the coercion safely, dropping identity
-- coercions and coalescing nested coercions
mkCast :: CoreExpr -> Coercion -> CoreExpr
-- | Wraps the given expression in the source annotation, dropping the
-- annotation if possible.
mkTick :: Tickish Id -> CoreExpr -> CoreExpr
mkTicks :: [Tickish Id] -> CoreExpr -> CoreExpr
mkTickNoHNF :: Tickish Id -> CoreExpr -> CoreExpr
tickHNFArgs :: Tickish Id -> CoreExpr -> CoreExpr
-- | bindNonRec x r b produces either:
--
--
-- let x = r in b
--
--
-- or:
--
--
-- case r of x { _DEFAULT_ -> b }
--
--
-- depending on whether we have to use a case or let
-- binding for the expression (see needsCaseBinding). It's used by
-- the desugarer to avoid building bindings that give Core Lint a heart
-- attack, although actually the simplifier deals with them perfectly
-- well. See also mkCoreLet
bindNonRec :: Id -> CoreExpr -> CoreExpr -> CoreExpr
-- | Tests whether we have to use a case rather than let
-- binding for this expression as per the invariants of CoreExpr:
-- see CoreSyn#let_app_invariant
needsCaseBinding :: Type -> CoreExpr -> Bool
-- | This guy constructs the value that the scrutinee must have given that
-- you are in one particular branch of a case
mkAltExpr :: AltCon -> [CoreBndr] -> [Type] -> CoreExpr
-- | Extract the default case alternative
findDefault :: [(AltCon, [a], b)] -> ([(AltCon, [a], b)], Maybe b)
addDefault :: [(AltCon, [a], b)] -> Maybe b -> [(AltCon, [a], b)]
-- | Find the case alternative corresponding to a particular constructor:
-- panics if no such constructor exists
findAlt :: AltCon -> [(AltCon, a, b)] -> Maybe (AltCon, a, b)
isDefaultAlt :: (AltCon, a, b) -> Bool
-- | Merge alternatives preserving order; alternatives in the first
-- argument shadow ones in the second
mergeAlts :: [(AltCon, a, b)] -> [(AltCon, a, b)] -> [(AltCon, a, b)]
-- | Given:
--
--
-- case (C a b x y) of
-- C b x y -> ...
--
--
-- We want to drop the leading type argument of the scrutinee leaving the
-- arguments to match against the pattern
trimConArgs :: AltCon -> [CoreArg] -> [CoreArg]
filterAlts :: TyCon -> [Type] -> [AltCon] -> [(AltCon, [Var], a)] -> ([AltCon], [(AltCon, [Var], a)])
combineIdenticalAlts :: [AltCon] -> [CoreAlt] -> (Bool, [AltCon], [CoreAlt])
refineDefaultAlt :: [Unique] -> TyCon -> [Type] -> [AltCon] -> [CoreAlt] -> (Bool, [CoreAlt])
-- | Recover the type of a well-typed Core expression. Fails when applied
-- to the actual Type expression as it cannot really be said to
-- have a type
exprType :: CoreExpr -> Type
-- | Returns the type of the alternatives right hand side
coreAltType :: CoreAlt -> Type
-- | Returns the type of the first alternative, which should be the same as
-- for all alternatives
coreAltsType :: [CoreAlt] -> Type
-- | Is this expression levity polymorphic? This should be the same as
-- saying (isKindLevPoly . typeKind . exprType) but much faster.
isExprLevPoly :: CoreExpr -> Bool
exprIsDupable :: DynFlags -> CoreExpr -> Bool
exprIsTrivial :: CoreExpr -> Bool
getIdFromTrivialExpr :: CoreExpr -> Id
exprIsBottom :: CoreExpr -> Bool
getIdFromTrivialExpr_maybe :: CoreExpr -> Maybe Id
exprIsCheap :: CoreExpr -> Bool
exprIsExpandable :: CoreExpr -> Bool
exprIsOk :: CheapAppFun -> CoreExpr -> Bool
type CheapAppFun = Id -> Arity -> Bool
-- | exprIsHNF returns true for expressions that are certainly
-- already evaluated to head normal form. This is used to
-- decide whether it's ok to change:
--
--
-- case x of _ -> e
--
--
-- into:
--
--
-- e
--
--
-- and to decide whether it's safe to discard a seq.
--
-- So, it does not treat variables as evaluated, unless they say
-- they are. However, it does treat partial applications and
-- constructor applications as values, even if their arguments are
-- non-trivial, provided the argument type is lifted. For example, both
-- of these are values:
--
--
-- (:) (f x) (map f xs)
-- map (...redex...)
--
--
-- because seq on such things completes immediately.
--
-- For unlifted argument types, we have to be careful:
--
--
-- C (f x :: Int#)
--
--
-- Suppose f x diverges; then C (f x) is not a value.
-- However this can't happen: see CoreSyn#let_app_invariant. This
-- invariant states that arguments of unboxed type must be
-- ok-for-speculation (or trivial).
exprIsHNF :: CoreExpr -> Bool
-- | exprOkForSpeculation returns True of an expression that is:
--
--
-- - Safe to evaluate even if normal order eval might not evaluate the
-- expression at all, or
-- - Safe not to evaluate even if normal order would do so
--
--
-- It is usually called on arguments of unlifted type, but not always In
-- particular, Simplify.rebuildCase calls it on lifted types when a
-- 'case' is a plain seq. See the example in Note
-- [exprOkForSpeculation: case expressions] below
--
-- Precisely, it returns True iff: a) The expression guarantees
-- to terminate, b) soon, c) without causing a write side effect (e.g.
-- writing a mutable variable) d) without throwing a Haskell exception e)
-- without risking an unchecked runtime exception (array out of bounds,
-- divide by zero)
--
-- For exprOkForSideEffects the list is the same, but omitting
-- (e).
--
-- Note that exprIsHNF implies exprOkForSpeculation exprOkForSpeculation
-- implies exprOkForSideEffects
--
-- See Note [PrimOp can_fail and has_side_effects] in PrimOp and Note
-- [Implementation: how can_fail/has_side_effects affect transformations]
--
-- As an example of the considerations in this test, consider:
--
--
-- let x = case y# +# 1# of { r# -> I# r# }
-- in E
--
--
-- being translated to:
--
--
-- case y# +# 1# of { r# ->
-- let x = I# r#
-- in E
-- }
--
--
-- We can only do this if the y + 1 is ok for speculation: it
-- has no side effects, and can't diverge or raise an exception.
exprOkForSpeculation :: CoreExpr -> Bool
-- | exprOkForSpeculation returns True of an expression that is:
--
--
-- - Safe to evaluate even if normal order eval might not evaluate the
-- expression at all, or
-- - Safe not to evaluate even if normal order would do so
--
--
-- It is usually called on arguments of unlifted type, but not always In
-- particular, Simplify.rebuildCase calls it on lifted types when a
-- 'case' is a plain seq. See the example in Note
-- [exprOkForSpeculation: case expressions] below
--
-- Precisely, it returns True iff: a) The expression guarantees
-- to terminate, b) soon, c) without causing a write side effect (e.g.
-- writing a mutable variable) d) without throwing a Haskell exception e)
-- without risking an unchecked runtime exception (array out of bounds,
-- divide by zero)
--
-- For exprOkForSideEffects the list is the same, but omitting
-- (e).
--
-- Note that exprIsHNF implies exprOkForSpeculation exprOkForSpeculation
-- implies exprOkForSideEffects
--
-- See Note [PrimOp can_fail and has_side_effects] in PrimOp and Note
-- [Implementation: how can_fail/has_side_effects affect transformations]
--
-- As an example of the considerations in this test, consider:
--
--
-- let x = case y# +# 1# of { r# -> I# r# }
-- in E
--
--
-- being translated to:
--
--
-- case y# +# 1# of { r# ->
-- let x = I# r#
-- in E
-- }
--
--
-- We can only do this if the y + 1 is ok for speculation: it
-- has no side effects, and can't diverge or raise an exception.
exprOkForSideEffects :: CoreExpr -> Bool
exprIsWorkFree :: CoreExpr -> Bool
-- | Returns True of expressions that are too big to be compared
-- by cheapEqExpr
exprIsBig :: Expr b -> Bool
-- | Similar to exprIsHNF but includes CONLIKE functions as well as
-- data constructors. Conlike arguments are considered interesting by the
-- inliner.
exprIsConLike :: CoreExpr -> Bool
-- | This function is called only on *top-level* right-hand sides. Returns
-- True if the RHS can be allocated statically in the output,
-- with no thunks involved at all.
rhsIsStatic :: Platform -> (Name -> Bool) -> (Integer -> CoreExpr) -> CoreExpr -> Bool
isCheapApp :: CheapAppFun
isExpandableApp :: CheapAppFun
exprIsLiteralString :: CoreExpr -> Bool
-- | Can we bind this CoreExpr at the top level?
exprIsTopLevelBindable :: CoreExpr -> Type -> Bool
-- | A cheap equality test which bales out fast! If it returns
-- True the arguments are definitely equal, otherwise, they may
-- or may not be equal.
--
-- See also exprIsBig
cheapEqExpr :: Expr b -> Expr b -> Bool
-- | Cheap expression equality test, can ignore ticks by type.
cheapEqExpr' :: (Tickish Id -> Bool) -> Expr b -> Expr b -> Bool
eqExpr :: InScopeSet -> CoreExpr -> CoreExpr -> Bool
-- | Finds differences between core expressions, modulo alpha and renaming.
-- Setting top means that the IdInfo of bindings will
-- be checked for differences as well.
diffExpr :: Bool -> RnEnv2 -> CoreExpr -> CoreExpr -> [SDoc]
-- | Finds differences between core bindings, see diffExpr.
--
-- The main problem here is that while we expect the binds to have the
-- same order in both lists, this is not guaranteed. To do this properly
-- we'd either have to do some sort of unification or check all possible
-- mappings, which would be seriously expensive. So instead we simply
-- match single bindings as far as we can. This leaves us just with
-- mutually recursive and/or mismatching bindings, which we then
-- speculatively match by ordering them. It's by no means perfect, but
-- gets the job done well enough.
diffBinds :: Bool -> RnEnv2 -> [(Var, CoreExpr)] -> [(Var, CoreExpr)] -> ([SDoc], RnEnv2)
tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr
-- | If the expression is a Type, converts. Otherwise, panics. NB:
-- This does not convert Coercion to CoercionTy.
exprToType :: CoreExpr -> Type
-- | If the expression is a Coercion, converts.
exprToCoercion_maybe :: CoreExpr -> Maybe Coercion
-- | A more efficient version of applyTypeToArg when we have several
-- arguments. The first argument is just for debugging, and gives some
-- context
applyTypeToArgs :: CoreExpr -> Type -> [CoreExpr] -> Type
-- | Determines the type resulting from applying an expression with given
-- type to a given argument expression
applyTypeToArg :: Type -> CoreExpr -> Type
dataConRepInstPat :: [Unique] -> DataCon -> [Type] -> ([TyVar], [Id])
dataConRepFSInstPat :: [FastString] -> [Unique] -> DataCon -> [Type] -> ([TyVar], [Id])
-- | True if the type has no non-bottom elements, e.g. when it is an empty
-- datatype, or a GADT with non-satisfiable type parameters, e.g. Int :~:
-- Bool. See Note [Bottoming expressions]
--
-- See Note [No alternatives lint check] for another use of this
-- function.
isEmptyTy :: Type -> Bool
-- | Strip ticks satisfying a predicate from top of an expression
stripTicksTop :: (Tickish Id -> Bool) -> Expr b -> ([Tickish Id], Expr b)
-- | Strip ticks satisfying a predicate from top of an expression,
-- returning the remaining expression
stripTicksTopE :: (Tickish Id -> Bool) -> Expr b -> Expr b
-- | Strip ticks satisfying a predicate from top of an expression,
-- returning the ticks
stripTicksTopT :: (Tickish Id -> Bool) -> Expr b -> [Tickish Id]
-- | Completely strip ticks satisfying a predicate from an expression. Note
-- this is O(n) in the size of the expression!
stripTicksE :: (Tickish Id -> Bool) -> Expr b -> Expr b
stripTicksT :: (Tickish Id -> Bool) -> Expr b -> [Tickish Id]
-- | collectMakeStaticArgs (makeStatic t srcLoc e) yields Just
-- (makeStatic, t, srcLoc, e).
--
-- Returns Nothing for every other expression.
collectMakeStaticArgs :: CoreExpr -> Maybe (CoreExpr, Type, CoreExpr, CoreExpr)
-- | Does this binding bind a join point (or a recursive group of join
-- points)?
isJoinBind :: CoreBind -> Bool
module SAT
doStaticArgs :: UniqSupply -> CoreProgram -> CoreProgram
module OccurAnal
occurAnalysePgm :: Module -> (Activation -> Bool) -> [CoreRule] -> [CoreVect] -> VarSet -> CoreProgram -> CoreProgram
occurAnalyseExpr :: CoreExpr -> CoreExpr
occurAnalyseExpr_NoBinderSwap :: CoreExpr -> CoreExpr
instance Outputable.Outputable OccurAnal.Details
instance Outputable.Outputable OccurAnal.UsageDetails
instance Outputable.Outputable OccurAnal.OccEncl
-- | Handy functions for creating much Core syntax
module MkCore
-- | Bind a binding group over an expression, using a let or
-- case as appropriate (see CoreSyn#let_app_invariant)
mkCoreLet :: CoreBind -> CoreExpr -> CoreExpr
-- | Bind a list of binding groups over an expression. The leftmost binding
-- group becomes the outermost group in the resulting expression
mkCoreLets :: [CoreBind] -> CoreExpr -> CoreExpr
-- | Construct an expression which represents the application of one
-- expression to the other
mkCoreApp :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr
infixl 4 `mkCoreApp`
-- | Construct an expression which represents the application of a number
-- of expressions to another. The leftmost expression in the list is
-- applied first Respects the let/app invariant by building a case
-- expression where necessary See CoreSyn Note [CoreSyn let/app
-- invariant]
mkCoreApps :: CoreExpr -> [CoreExpr] -> CoreExpr
infixl 4 `mkCoreApps`
-- | Construct an expression which represents the application of a number
-- of expressions to that of a data constructor expression. The leftmost
-- expression in the list is applied first
mkCoreConApps :: DataCon -> [CoreExpr] -> CoreExpr
-- | Create a lambda where the given expression has a number of variables
-- bound over it. The leftmost binder is that bound by the outermost
-- lambda in the result
mkCoreLams :: [CoreBndr] -> CoreExpr -> CoreExpr
mkWildCase :: CoreExpr -> Type -> Type -> [CoreAlt] -> CoreExpr
mkIfThenElse :: CoreExpr -> CoreExpr -> CoreExpr -> CoreExpr
-- | Make a wildcard binder. This is typically used when you need a
-- binder that you expect to use only at a *binding* site. Do not use it
-- at occurrence sites because it has a single, fixed unique, and it's
-- very easy to get into difficulties with shadowing. That's why it is
-- used so little. See Note [WildCard binders] in SimplEnv
mkWildValBinder :: Type -> Id
mkWildEvBinder :: PredType -> EvVar
sortQuantVars :: [Var] -> [Var]
castBottomExpr :: CoreExpr -> Type -> CoreExpr
-- | Create a CoreExpr which will evaluate to the a Word
-- with the given value
mkWordExpr :: DynFlags -> Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Word
mkWordExprWord :: DynFlags -> Word -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given Int
mkIntExpr :: DynFlags -> Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given Int
mkIntExprInt :: DynFlags -> Int -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Integer
mkIntegerExpr :: MonadThings m => Integer -> m CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Natural
--
-- TODO: should we add LitNatural to Core?
mkNaturalExpr :: MonadThings m => Integer -> m CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Float
mkFloatExpr :: Float -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Double
mkDoubleExpr :: Double -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Char
mkCharExpr :: Char -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- String
mkStringExpr :: MonadThings m => String -> m CoreExpr
-- | Create a CoreExpr which will evaluate to a string morally
-- equivalent to the given FastString
mkStringExprFS :: MonadThings m => FastString -> m CoreExpr
mkStringExprFSWith :: Monad m => (Name -> m Id) -> FastString -> m CoreExpr
data FloatBind
FloatLet :: CoreBind -> FloatBind
FloatCase :: CoreExpr -> Id -> AltCon -> [Var] -> FloatBind
wrapFloat :: FloatBind -> CoreExpr -> CoreExpr
-- | Build a small tuple holding the specified variables One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkCoreVarTup :: [Id] -> CoreExpr
-- | Build the type of a small tuple that holds the specified variables
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkCoreVarTupTy :: [Id] -> Type
-- | Build a small tuple holding the specified expressions One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkCoreTup :: [CoreExpr] -> CoreExpr
-- | Build a small unboxed tuple holding the specified expressions, with
-- the given types. The types must be the types of the expressions. Do
-- not include the RuntimeRep specifiers; this function calculates them
-- for you. Does not flatten one-tuples; see Note [Flattening
-- one-tuples]
mkCoreUbxTup :: [Type] -> [CoreExpr] -> CoreExpr
-- | Make a core tuple of the given boxity
mkCoreTupBoxity :: Boxity -> [CoreExpr] -> CoreExpr
-- | The unit expression
unitExpr :: CoreExpr
-- | Build a big tuple holding the specified variables One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkBigCoreVarTup :: [Id] -> CoreExpr
mkBigCoreVarTup1 :: [Id] -> CoreExpr
-- | Build the type of a big tuple that holds the specified variables
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkBigCoreVarTupTy :: [Id] -> Type
-- | Build the type of a big tuple that holds the specified type of thing
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkBigCoreTupTy :: [Type] -> Type
-- | Build a big tuple holding the specified expressions One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkBigCoreTup :: [CoreExpr] -> CoreExpr
-- | mkSmallTupleSelector1 is like mkSmallTupleSelector but
-- one-tuples are NOT flattened (see Note [Flattening one-tuples])
--
-- Like mkTupleSelector but for tuples that are guaranteed never
-- to be "big".
--
--
-- mkSmallTupleSelector [x] x v e = [| e |]
-- mkSmallTupleSelector [x,y,z] x v e = [| case e of v { (x,y,z) -> x } |]
--
mkSmallTupleSelector :: [Id] -> Id -> Id -> CoreExpr -> CoreExpr
-- | As mkTupleCase, but for a tuple that is small enough to be
-- guaranteed not to need nesting.
mkSmallTupleCase :: [Id] -> CoreExpr -> Id -> CoreExpr -> CoreExpr
-- | mkTupleSelector1 is like mkTupleSelector but one-tuples
-- are NOT flattened (see Note [Flattening one-tuples])
--
-- Builds a selector which scrutises the given expression and extracts
-- the one name from the list given. If you want the no-shadowing rule to
-- apply, the caller is responsible for making sure that none of these
-- names are in scope.
--
-- If there is just one Id in the tuple, then the selector is just
-- the identity.
--
-- If necessary, we pattern match on a "big" tuple.
mkTupleSelector :: [Id] -> Id -> Id -> CoreExpr -> CoreExpr
-- | Builds a selector which scrutises the given expression and extracts
-- the one name from the list given. If you want the no-shadowing rule to
-- apply, the caller is responsible for making sure that none of these
-- names are in scope.
--
-- If there is just one Id in the tuple, then the selector is just
-- the identity.
--
-- If necessary, we pattern match on a "big" tuple.
mkTupleSelector1 :: [Id] -> Id -> Id -> CoreExpr -> CoreExpr
-- | A generalization of mkTupleSelector, allowing the body of the
-- case to be an arbitrary expression.
--
-- To avoid shadowing, we use uniques to invent new variables.
--
-- If necessary we pattern match on a "big" tuple.
mkTupleCase :: UniqSupply -> [Id] -> CoreExpr -> Id -> CoreExpr -> CoreExpr
-- | Makes a list [] for lists of the specified type
mkNilExpr :: Type -> CoreExpr
-- | Makes a list (:) for lists of the specified type
mkConsExpr :: Type -> CoreExpr -> CoreExpr -> CoreExpr
-- | Make a list containing the given expressions, where the list has the
-- given type
mkListExpr :: Type -> [CoreExpr] -> CoreExpr
-- | Make a fully applied foldr expression
mkFoldrExpr :: MonadThings m => Type -> Type -> CoreExpr -> CoreExpr -> CoreExpr -> m CoreExpr
-- | Make a build expression applied to a locally-bound worker
-- function
mkBuildExpr :: (MonadThings m, MonadUnique m) => Type -> ((Id, Type) -> (Id, Type) -> m CoreExpr) -> m CoreExpr
-- | Makes a Nothing for the specified type
mkNothingExpr :: Type -> CoreExpr
-- | Makes a Just from a value of the specified type
mkJustExpr :: Type -> CoreExpr -> CoreExpr
mkRuntimeErrorApp :: Id -> Type -> String -> CoreExpr
mkImpossibleExpr :: Type -> CoreExpr
mkAbsentErrorApp :: Type -> String -> CoreExpr
errorIds :: [Id]
rEC_CON_ERROR_ID :: Id
iRREFUT_PAT_ERROR_ID :: Id
rUNTIME_ERROR_ID :: Id
nON_EXHAUSTIVE_GUARDS_ERROR_ID :: Id
nO_METHOD_BINDING_ERROR_ID :: Id
pAT_ERROR_ID :: Id
rEC_SEL_ERROR_ID :: Id
aBSENT_ERROR_ID :: Id
tYPE_ERROR_ID :: Id
instance Outputable.Outputable MkCore.FloatBind
module CoreSubst
-- | A substitution environment, containing Id, TyVar, and
-- CoVar substitutions.
--
-- Some invariants apply to how you use the substitution:
--
--
-- - The in-scope set contains at least those Ids and
-- TyVars that will be in scope after applying the
-- substitution to a term. Precisely, the in-scope set must be a superset
-- of the free vars of the substitution range that might possibly clash
-- with locally-bound variables in the thing being substituted in.
-- - You may apply the substitution only once
--
--
-- There are various ways of setting up the in-scope set such that the
-- first of these invariants hold:
--
--
-- - Arrange that the in-scope set really is all the things in
-- scope
-- - Arrange that it's the free vars of the range of the
-- substitution
-- - Make it empty, if you know that all the free vars of the
-- substitution are fresh, and hence can't possibly clash
--
data Subst
Subst :: InScopeSet -> IdSubstEnv -> TvSubstEnv -> CvSubstEnv -> Subst
-- | A substitution of Types for TyVars and Kinds for
-- KindVars
type TvSubstEnv = TyVarEnv Type
-- | An environment for substituting for Ids
type IdSubstEnv = IdEnv CoreExpr
-- | A set of variables that are in scope at some point "Secrets of the
-- Glasgow Haskell Compiler inliner" Section 3.2 provides the motivation
-- for this abstraction.
data InScopeSet
-- | De-shadowing the program is sometimes a useful pre-pass. It can be
-- done simply by running over the bindings with an empty substitution,
-- because substitution returns a result that has no-shadowing
-- guaranteed.
--
-- (Actually, within a single type there might still be shadowing,
-- because substTy is a no-op for the empty substitution, but
-- that's probably OK.)
--
--
-- - Aug 09 This function is not used in GHC at the moment, but
-- seems so short and simple that I'm going to leave it here
--
deShadowBinds :: CoreProgram -> CoreProgram
-- | Substitutes for the Ids within the WorkerInfo given
-- the new function Id
substSpec :: Subst -> Id -> RuleInfo -> RuleInfo
substRulesForImportedIds :: Subst -> [CoreRule] -> [CoreRule]
-- | See substTy
substTy :: Subst -> Type -> Type
-- | See substCo
substCo :: Subst -> Coercion -> Coercion
substExpr :: SDoc -> Subst -> CoreExpr -> CoreExpr
-- | Apply a substitution to an entire CoreExpr. Remember, you may
-- only apply the substitution once: see
-- CoreSubst#apply_once
--
-- Do *not* attempt to short-cut in the case of an empty substitution!
-- See Note [Extending the Subst]
substExprSC :: SDoc -> Subst -> CoreExpr -> CoreExpr
-- | Apply a substitution to an entire CoreBind, additionally
-- returning an updated Subst that should be used by subsequent
-- substitutions.
substBind :: Subst -> CoreBind -> (Subst, CoreBind)
-- | Apply a substitution to an entire CoreBind, additionally
-- returning an updated Subst that should be used by subsequent
-- substitutions.
substBindSC :: Subst -> CoreBind -> (Subst, CoreBind)
-- | Substitutes for the Ids within an unfolding
substUnfolding :: Subst -> Unfolding -> Unfolding
-- | Substitutes for the Ids within an unfolding
substUnfoldingSC :: Subst -> Unfolding -> Unfolding
-- | Find the substitution for an Id in the Subst
lookupIdSubst :: SDoc -> Subst -> Id -> CoreExpr
-- | Find the substitution for a TyVar in the Subst
lookupTCvSubst :: Subst -> TyVar -> Type
substIdOcc :: Subst -> Id -> Id
substTickish :: Subst -> Tickish Id -> Tickish Id
substDVarSet :: Subst -> DVarSet -> DVarSet
-- | Substitute into some IdInfo with regard to the supplied new
-- Id.
substIdInfo :: Subst -> Id -> IdInfo -> Maybe IdInfo
emptySubst :: Subst
mkEmptySubst :: InScopeSet -> Subst
mkSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> IdSubstEnv -> Subst
-- | Simultaneously substitute for a bunch of variables No left-right
-- shadowing ie the substitution for (x y. e) a1 a2 so neither x nor y
-- scope over a1 a2
mkOpenSubst :: InScopeSet -> [(Var, CoreArg)] -> Subst
-- | Find the in-scope set: see CoreSubst#in_scope_invariant
substInScope :: Subst -> InScopeSet
isEmptySubst :: Subst -> Bool
-- | Add a substitution for an Id to the Subst: you must
-- ensure that the in-scope set is such that the
-- CoreSubst#in_scope_invariant is true after extending the
-- substitution like this
extendIdSubst :: Subst -> Id -> CoreExpr -> Subst
-- | Adds multiple Id substitutions to the Subst: see also
-- extendIdSubst
extendIdSubstList :: Subst -> [(Id, CoreExpr)] -> Subst
extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
-- | Adds multiple TyVar substitutions to the Subst: see also
-- extendTvSubst
extendTvSubstList :: Subst -> [(TyVar, Type)] -> Subst
-- | Add a substitution appropriate to the thing being substituted (whether
-- an expression, type, or coercion). See also extendIdSubst,
-- extendTvSubst, extendCvSubst
extendSubst :: Subst -> Var -> CoreArg -> Subst
-- | Add a substitution as appropriate to each of the terms being
-- substituted (whether expressions, types, or coercions). See also
-- extendSubst.
extendSubstList :: Subst -> [(Var, CoreArg)] -> Subst
extendSubstWithVar :: Subst -> Var -> Var -> Subst
-- | Remove all substitutions for Ids and Vars that might
-- have been built up while preserving the in-scope set
zapSubstEnv :: Subst -> Subst
-- | Add the Var to the in-scope set, but do not remove any existing
-- substitutions for it
addInScopeSet :: Subst -> VarSet -> Subst
-- | Add the Var to the in-scope set: as a side effect, and remove
-- any existing substitutions for it
extendInScope :: Subst -> Var -> Subst
-- | Add the Vars to the in-scope set: see also extendInScope
extendInScopeList :: Subst -> [Var] -> Subst
-- | Optimized version of extendInScopeList that can be used if you
-- are certain all the things being added are Ids and hence none
-- are TyVars or CoVars
extendInScopeIds :: Subst -> [Id] -> Subst
isInScope :: Var -> Subst -> Bool
setInScope :: Subst -> InScopeSet -> Subst
getTCvSubst :: Subst -> TCvSubst
-- | Add a substitution for a TyVar to the Subst The
-- TyVar *must* be a real TyVar, and not a CoVar You must ensure
-- that the in-scope set is such that the
-- CoreSubst#in_scope_invariant is true after extending the
-- substitution like this.
extendTvSubst :: Subst -> TyVar -> Type -> Subst
-- | Add a substitution from a CoVar to a Coercion to the
-- Subst: you must ensure that the in-scope set is such that the
-- CoreSubst#in_scope_invariant is true after extending the
-- substitution like this
extendCvSubst :: Subst -> CoVar -> Coercion -> Subst
delBndr :: Subst -> Var -> Subst
delBndrs :: Subst -> [Var] -> Subst
-- | Substitutes a Var for another one according to the Subst
-- given, returning the result and an updated Subst that should be
-- used by subsequent substitutions. IdInfo is preserved by this
-- process, although it is substituted into appropriately.
substBndr :: Subst -> Var -> (Subst, Var)
-- | Applies substBndr to a number of Vars, accumulating a
-- new Subst left-to-right
substBndrs :: Subst -> [Var] -> (Subst, [Var])
-- | Substitute in a mutually recursive group of Ids
substRecBndrs :: Subst -> [Id] -> (Subst, [Id])
substTyVarBndr :: Subst -> TyVar -> (Subst, TyVar)
substCoVarBndr :: Subst -> TyVar -> (Subst, TyVar)
cloneBndr :: Subst -> Unique -> Var -> (Subst, Var)
cloneBndrs :: Subst -> UniqSupply -> [Var] -> (Subst, [Var])
-- | Very similar to substBndr, but it always allocates a new
-- Unique for each variable in its output. It substitutes the
-- IdInfo though.
cloneIdBndr :: Subst -> UniqSupply -> Id -> (Subst, Id)
-- | Applies cloneIdBndr to a number of Ids, accumulating a
-- final substitution from left to right
cloneIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id])
-- | Clone a mutually recursive group of Ids
cloneRecIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id])
instance Outputable.Outputable CoreSubst.Subst
module CSE
cseProgram :: CoreProgram -> CoreProgram
cseOneExpr :: InExpr -> OutExpr
-- | Arity and eta expansion
module CoreArity
-- | manifestArity sees how many leading value lambdas there are, after
-- looking through casts
manifestArity :: CoreExpr -> Arity
joinRhsArity :: CoreExpr -> JoinArity
-- | An approximate, fast, version of exprEtaExpandArity
exprArity :: CoreExpr -> Arity
typeArity :: Type -> [OneShotInfo]
exprEtaExpandArity :: DynFlags -> CoreExpr -> Arity
-- | The Arity returned is the number of value args the expression can be
-- applied to without doing much work
findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> Arity
type CheapFun = CoreExpr -> Maybe Type -> Bool
-- | etaExpand n e returns an expression with the same meaning as
-- e, but with arity n.
--
-- Given:
--
--
-- e' = etaExpand n e
--
--
-- We should have that:
--
--
-- ty = exprType e = exprType e'
--
etaExpand :: Arity -> CoreExpr -> CoreExpr
-- | Split an expression into the given number of binders and a body,
-- eta-expanding if necessary. Counts value *and* type binders.
etaExpandToJoinPoint :: JoinArity -> CoreExpr -> ([CoreBndr], CoreExpr)
etaExpandToJoinPointRule :: JoinArity -> CoreRule -> CoreRule
exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, StrictSig)
instance Outputable.Outputable CoreArity.EtaInfo
module CoreOpt
simpleOptPgm :: DynFlags -> Module -> CoreProgram -> [CoreRule] -> [CoreVect] -> IO (CoreProgram, [CoreRule], [CoreVect])
simpleOptExpr :: CoreExpr -> CoreExpr
simpleOptExprWith :: Subst -> InExpr -> OutExpr
-- | Returns Just (bndr,rhs) if the binding is a join point: If it's a
-- JoinId, just return it If it's not yet a JoinId but is always
-- tail-called, make it into a JoinId and return it. In the latter case,
-- eta-expand the RHS if necessary, to make the lambdas explicit, as is
-- required for join points
--
-- Precondition: the InBndr has been occurrence-analysed, so its OccInfo
-- is valid
joinPointBinding_maybe :: InBndr -> InExpr -> Maybe (InBndr, InExpr)
joinPointBindings_maybe :: [(InBndr, InExpr)] -> Maybe [(InBndr, InExpr)]
-- | Returns Just (dc, [t1..tk], [x1..xn]) if the argument
-- expression is a *saturated* constructor application of the form dc
-- t1..tk x1 .. xn, where t1..tk are the *universally-qantified*
-- type args of dc
exprIsConApp_maybe :: InScopeEnv -> CoreExpr -> Maybe (DataCon, [Type], [CoreExpr])
exprIsLiteral_maybe :: InScopeEnv -> CoreExpr -> Maybe Literal
exprIsLambda_maybe :: InScopeEnv -> CoreExpr -> Maybe (Var, CoreExpr, [Tickish Id])
pushCoArg :: Coercion -> CoreArg -> Maybe (CoreArg, Coercion)
pushCoValArg :: Coercion -> Maybe (Coercion, Coercion)
pushCoTyArg :: Coercion -> Type -> Maybe (Type, Coercion)
collectBindersPushingCo :: CoreExpr -> ([Var], CoreExpr)
instance Outputable.Outputable CoreOpt.SimpleOptEnv
module CoreUnfold
-- | Records the unfolding of an identifier, which is approximately
-- the form the identifier would have if we substituted its definition in
-- for the identifier. This type should be treated as abstract everywhere
-- except in CoreUnfold
data Unfolding
-- | UnfoldingGuidance says when unfolding should take place
data UnfoldingGuidance
-- | There is no known Unfolding
noUnfolding :: Unfolding
mkImplicitUnfolding :: DynFlags -> CoreExpr -> Unfolding
mkUnfolding :: DynFlags -> UnfoldingSource -> Bool -> Bool -> CoreExpr -> Unfolding
mkCoreUnfolding :: UnfoldingSource -> Bool -> CoreExpr -> UnfoldingGuidance -> Unfolding
mkTopUnfolding :: DynFlags -> Bool -> CoreExpr -> Unfolding
mkSimpleUnfolding :: DynFlags -> CoreExpr -> Unfolding
mkWorkerUnfolding :: DynFlags -> (CoreExpr -> CoreExpr) -> Unfolding -> Unfolding
-- | Make an unfolding that may be used unsaturated (ug_unsat_ok =
-- unSaturatedOk) and that is reported as having its manifest arity (the
-- number of outer lambdas applications will resolve before doing any
-- work).
mkInlineUnfolding :: CoreExpr -> Unfolding
-- | Make an unfolding that will be used once the RHS has been saturated to
-- the given arity.
mkInlineUnfoldingWithArity :: Arity -> CoreExpr -> Unfolding
mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding
mkWwInlineRule :: CoreExpr -> Arity -> Unfolding
mkCompulsoryUnfolding :: CoreExpr -> Unfolding
mkDFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding
specUnfolding :: [Var] -> (CoreExpr -> CoreExpr) -> Arity -> Unfolding -> Unfolding
data ArgSummary
TrivArg :: ArgSummary
NonTrivArg :: ArgSummary
ValueArg :: ArgSummary
couldBeSmallEnoughToInline :: DynFlags -> Int -> CoreExpr -> Bool
inlineBoringOk :: CoreExpr -> Bool
certainlyWillInline :: DynFlags -> IdInfo -> Maybe Unfolding
smallEnoughToInline :: DynFlags -> Unfolding -> Bool
callSiteInline :: DynFlags -> Id -> Bool -> Bool -> [ArgSummary] -> CallCtxt -> Maybe CoreExpr
data CallCtxt
BoringCtxt :: CallCtxt
RhsCtxt :: CallCtxt
DiscArgCtxt :: CallCtxt
RuleArgCtxt :: CallCtxt
ValAppCtxt :: CallCtxt
CaseCtxt :: CallCtxt
-- | Returns Just (dc, [t1..tk], [x1..xn]) if the argument
-- expression is a *saturated* constructor application of the form dc
-- t1..tk x1 .. xn, where t1..tk are the *universally-qantified*
-- type args of dc
exprIsConApp_maybe :: InScopeEnv -> CoreExpr -> Maybe (DataCon, [Type], [CoreExpr])
exprIsLiteral_maybe :: InScopeEnv -> CoreExpr -> Maybe Literal
instance Outputable.Outputable CoreUnfold.CallCtxt
instance Outputable.Outputable CoreUnfold.ArgSummary
instance Outputable.Outputable CoreUnfold.ExprSize
module PrelRules
primOpRules :: Name -> PrimOp -> Maybe CoreRule
builtinRules :: [CoreRule]
-- | Match the scrutinee of a case and potentially return a new scrutinee
-- and a function to apply to each literal alternative.
caseRules :: DynFlags -> CoreExpr -> Maybe (CoreExpr, Integer -> Integer)
instance GHC.Base.Functor PrelRules.RuleM
instance GHC.Base.Applicative PrelRules.RuleM
instance GHC.Base.Monad PrelRules.RuleM
instance Control.Monad.Fail.MonadFail PrelRules.RuleM
instance GHC.Base.Alternative PrelRules.RuleM
instance GHC.Base.MonadPlus PrelRules.RuleM
instance DynFlags.HasDynFlags PrelRules.RuleM
module LiberateCase
liberateCase :: DynFlags -> CoreProgram -> CoreProgram
module CoreTidy
tidyExpr :: TidyEnv -> CoreExpr -> CoreExpr
tidyVarOcc :: TidyEnv -> Var -> Var
tidyRule :: TidyEnv -> CoreRule -> CoreRule
tidyRules :: TidyEnv -> [CoreRule] -> [CoreRule]
tidyUnfolding :: TidyEnv -> Unfolding -> Unfolding -> Unfolding
-- | Functions for collecting together and applying rewrite rules to a
-- module. The CoreRule datatype itself is declared elsewhere.
module Rules
emptyRuleBase :: RuleBase
mkRuleBase :: [CoreRule] -> RuleBase
extendRuleBaseList :: RuleBase -> [CoreRule] -> RuleBase
unionRuleBase :: RuleBase -> RuleBase -> RuleBase
pprRuleBase :: RuleBase -> SDoc
-- | Report partial matches for rules beginning with the specified string
-- for the purposes of error reporting
ruleCheckProgram :: CompilerPhase -> String -> RuleEnv -> CoreProgram -> SDoc
-- | Make a RuleInfo containing a number of CoreRules,
-- suitable for putting into an IdInfo
mkRuleInfo :: [CoreRule] -> RuleInfo
extendRuleInfo :: RuleInfo -> [CoreRule] -> RuleInfo
addRuleInfo :: RuleInfo -> RuleInfo -> RuleInfo
addIdSpecialisations :: Id -> [CoreRule] -> Id
-- | Gather all the rules for locally bound identifiers from the supplied
-- bindings
rulesOfBinds :: [CoreBind] -> [CoreRule]
getRules :: RuleEnv -> Id -> [CoreRule]
pprRulesForUser :: DynFlags -> [CoreRule] -> SDoc
-- | The main rule matching function. Attempts to apply all (active)
-- supplied rules to this instance of an application in a given context,
-- returning the rule applied and the resulting expression if successful.
lookupRule :: DynFlags -> InScopeEnv -> (Activation -> Bool) -> Id -> [CoreExpr] -> [CoreRule] -> Maybe (CoreRule, CoreExpr)
-- | Used to make CoreRule for an Id defined in the module
-- being compiled. See also CoreRule
mkRule :: Module -> Bool -> Bool -> RuleName -> Activation -> Name -> [CoreBndr] -> [CoreExpr] -> CoreExpr -> CoreRule
-- | Find the "top" free names of several expressions. Such names are
-- either:
--
--
-- - The function finally being applied to in an application chain (if
-- that name is a GlobalId: see Var#globalvslocal), or
-- - The TyCon if the expression is a Type
--
--
-- This is used for the fast-match-check for rules; if the top names
-- don't match, the rest can't
roughTopNames :: [CoreExpr] -> [Maybe Name]
module MkId
mkDictFunId :: Name -> [TyVar] -> ThetaType -> Class -> [Type] -> Id
mkDictFunTy :: [TyVar] -> ThetaType -> Class -> [Type] -> Type
mkDictSelId :: Name -> Class -> Id
mkDictSelRhs :: Class -> Int -> CoreExpr
mkPrimOpId :: PrimOp -> Id
mkFCallId :: DynFlags -> Unique -> ForeignCall -> Type -> Id
wrapNewTypeBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
unwrapNewTypeBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
wrapFamInstBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
unwrapFamInstScrut :: TyCon -> [Type] -> CoreExpr -> CoreExpr
wrapTypeUnbranchedFamInstBody :: CoAxiom Unbranched -> [Type] -> [Coercion] -> CoreExpr -> CoreExpr
unwrapTypeUnbranchedFamInstScrut :: CoAxiom Unbranched -> [Type] -> [Coercion] -> CoreExpr -> CoreExpr
-- | Data Constructor Boxer
newtype DataConBoxer
DCB :: ([Type] -> [Var] -> UniqSM ([Var], [CoreBind])) -> DataConBoxer
mkDataConRep :: DynFlags -> FamInstEnvs -> Name -> Maybe [HsImplBang] -> DataCon -> UniqSM DataConRep
mkDataConWorkId :: Name -> DataCon -> Id
wiredInIds :: [Id]
ghcPrimIds :: [Id]
unsafeCoerceName :: Name
unsafeCoerceId :: Id
realWorldPrimId :: Id
voidPrimId :: Id
voidArgId :: Id
nullAddrId :: Id
seqId :: Id
lazyId :: Id
lazyIdKey :: Unique
runRWId :: Id
coercionTokenId :: Id
magicDictId :: Id
coerceId :: Id
proxyHashId :: Id
noinlineId :: Id
noinlineIdName :: Name
module UnariseStg
unarise :: UniqSupply -> [StgTopBinding] -> [StgTopBinding]
instance Outputable.Outputable UnariseStg.UnariseVal
module SimplStg
stg2stg :: DynFlags -> Module -> [StgTopBinding] -> IO ([StgTopBinding], CollectedCCs)
-- | Functions for converting Core things to interface file things.
module ToIface
toIfaceTvBndr :: TyVar -> IfaceTvBndr
toIfaceTvBndrs :: [TyVar] -> [IfaceTvBndr]
toIfaceIdBndr :: Id -> (IfLclName, IfaceType)
toIfaceBndr :: Var -> IfaceBndr
toIfaceForAllBndr :: TyVarBinder -> IfaceForAllBndr
toIfaceTyVarBinders :: [TyVarBndr TyVar vis] -> [TyVarBndr IfaceTvBndr vis]
toIfaceTyVar :: TyVar -> FastString
toIfaceType :: Type -> IfaceType
toIfaceTypeX :: VarSet -> Type -> IfaceType
toIfaceKind :: Type -> IfaceType
toIfaceTcArgs :: TyCon -> [Type] -> IfaceTcArgs
toIfaceTyCon :: TyCon -> IfaceTyCon
toIfaceTyCon_name :: Name -> IfaceTyCon
toIfaceTyLit :: TyLit -> IfaceTyLit
tidyToIfaceType :: TidyEnv -> Type -> IfaceType
tidyToIfaceContext :: TidyEnv -> ThetaType -> IfaceContext
tidyToIfaceTcArgs :: TidyEnv -> TyCon -> [Type] -> IfaceTcArgs
toIfaceCoercion :: Coercion -> IfaceCoercion
patSynToIfaceDecl :: PatSyn -> IfaceDecl
toIfaceExpr :: CoreExpr -> IfaceExpr
toIfaceBang :: TidyEnv -> HsImplBang -> IfaceBang
toIfaceSrcBang :: HsSrcBang -> IfaceSrcBang
toIfaceLetBndr :: Id -> IfaceLetBndr
toIfaceIdDetails :: IdDetails -> IfaceIdDetails
toIfaceIdInfo :: IdInfo -> IfaceIdInfo
toIfUnfolding :: Bool -> Unfolding -> Maybe IfaceInfoItem
toIfaceOneShot :: Id -> IfaceOneShot
toIfaceTickish :: Tickish Id -> Maybe IfaceTickish
toIfaceBind :: Bind Id -> IfaceBinding
toIfaceAlt :: (AltCon, [Var], CoreExpr) -> (IfaceConAlt, [FastString], IfaceExpr)
toIfaceCon :: AltCon -> IfaceConAlt
toIfaceApp :: Expr CoreBndr -> [Arg CoreBndr] -> IfaceExpr
toIfaceVar :: Id -> IfaceExpr
-- | The PrelInfo interface to the compiler's prelude knowledge.
--
-- This module serves as the central gathering point for names which the
-- compiler knows something about. This includes functions for,
--
--
-- - discerning whether a Name is known-key
-- - given a Unique, looking up its corresponding known-key
-- Name
--
--
-- See Note [Known-key names] and Note [About wired-in things] for
-- information about the two types of prelude things in GHC.
module PrelInfo
-- | Is a Name known-key?
isKnownKeyName :: Name -> Bool
-- | Given a Unique lookup its associated Name if it
-- corresponds to a known-key thing.
lookupKnownKeyName :: Unique -> Maybe Name
-- | This list is used to ensure that when you say "Prelude.map" in your
-- source code, or in an interface file, you get a Name with the correct
-- known key (See Note [Known-key names] in PrelNames)
knownKeyNames :: [Name]
wiredInIds :: [Id]
ghcPrimIds :: [Id]
primOpRules :: Name -> PrimOp -> Maybe CoreRule
builtinRules :: [CoreRule]
ghcPrimExports :: [IfaceExport]
primOpId :: PrimOp -> Id
maybeCharLikeCon :: DataCon -> Bool
maybeIntLikeCon :: DataCon -> Bool
isNumericClass :: Class -> Bool
isStandardClass :: Class -> Bool
module StgCmmCon
cgTopRhsCon :: DynFlags -> Id -> DataCon -> [NonVoid StgArg] -> (CgIdInfo, FCode ())
buildDynCon :: Id -> Bool -> CostCentreStack -> DataCon -> [NonVoid StgArg] -> FCode (CgIdInfo, FCode CmmAGraph)
bindConArgs :: AltCon -> LocalReg -> [NonVoid Id] -> FCode [LocalReg]
module StgCmmExpr
cgExpr :: StgExpr -> FCode ReturnKind
module StgCmmBind
cgTopRhsClosure :: DynFlags -> RecFlag -> Id -> CostCentreStack -> StgBinderInfo -> UpdateFlag -> [Id] -> StgExpr -> (CgIdInfo, FCode ())
cgBind :: StgBinding -> FCode ()
emitBlackHoleCode :: CmmExpr -> FCode ()
pushUpdateFrame :: CLabel -> CmmExpr -> FCode () -> FCode ()
emitUpdateFrame :: DynFlags -> CmmExpr -> CLabel -> CmmExpr -> FCode ()
module CmmParse
parseCmmFile :: DynFlags -> FilePath -> IO (Messages, Maybe CmmGroup)
module StgCmm
codeGen :: DynFlags -> Module -> [TyCon] -> CollectedCCs -> [StgTopBinding] -> HpcInfo -> Stream IO CmmGroup ()
-- | Binary interface file support.
module BinIface
-- | Write an interface file
writeBinIface :: DynFlags -> FilePath -> ModIface -> IO ()
-- | Read an interface file
readBinIface :: CheckHiWay -> TraceBinIFaceReading -> FilePath -> TcRnIf a b ModIface
getSymtabName :: NameCacheUpdater -> Dictionary -> SymbolTable -> BinHandle -> IO Name
getDictFastString :: Dictionary -> BinHandle -> IO FastString
data CheckHiWay
CheckHiWay :: CheckHiWay
IgnoreHiWay :: CheckHiWay
data TraceBinIFaceReading
TraceBinIFaceReading :: TraceBinIFaceReading
QuietBinIFaceReading :: TraceBinIFaceReading
instance GHC.Classes.Eq BinIface.TraceBinIFaceReading
instance GHC.Classes.Eq BinIface.CheckHiWay
-- | This module manages storing the various GHC option flags in a modules
-- interface file as part of the recompilation checking infrastructure.
module FlagChecker
-- | Produce a fingerprint of a DynFlags value. We only base the
-- finger print on important fields in DynFlags so that the
-- recompilation checker can use this fingerprint.
--
-- NB: The Module parameter is the Module recorded by the
-- *interface* file, not the actual Module according to our
-- DynFlags.
fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ()) -> IO Fingerprint
module CoreToStg
coreToStg :: DynFlags -> Module -> CoreProgram -> [StgTopBinding]
coreExprToStg :: CoreExpr -> StgExpr
instance GHC.Classes.Eq CoreToStg.HowBound
instance GHC.Classes.Eq CoreToStg.LetInfo
instance GHC.Base.Functor CoreToStg.CtsM
instance GHC.Base.Applicative CoreToStg.CtsM
instance GHC.Base.Monad CoreToStg.CtsM
instance Control.Monad.Fix.MonadFix CoreToStg.CtsM
module LoadIface
tcLookupImported_maybe :: Name -> TcM (MaybeErr MsgDoc TyThing)
importDecl :: Name -> IfM lcl (MaybeErr MsgDoc TyThing)
checkWiredInTyCon :: TyCon -> TcM ()
ifCheckWiredInThing :: TyThing -> IfL ()
-- | Load interface directly for a fully qualified Module. (This is
-- a fairly rare operation, but in particular it is used to load orphan
-- modules in order to pull their instances into the global package table
-- and to handle some operations in GHCi).
loadModuleInterface :: SDoc -> Module -> TcM ModIface
-- | Load interfaces for a collection of modules.
loadModuleInterfaces :: SDoc -> [Module] -> TcM ()
-- | Load the interface corresponding to an import directive in
-- source code. On a failure, fail in the monad with an error message.
loadSrcInterface :: SDoc -> ModuleName -> IsBootInterface -> Maybe FastString -> RnM ModIface
-- | Like loadSrcInterface, but returns a MaybeErr.
loadSrcInterface_maybe :: SDoc -> ModuleName -> IsBootInterface -> Maybe FastString -> RnM (MaybeErr MsgDoc ModIface)
-- | Loads the interface for a given Name. Should only be called for an
-- imported name; otherwise loadSysInterface may not find the interface
loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
-- | Loads the interface for a given Module.
loadInterfaceForModule :: SDoc -> Module -> TcRn ModIface
loadInterface :: SDoc -> Module -> WhereFrom -> IfM lcl (MaybeErr MsgDoc ModIface)
-- | Loads a system interface and throws an exception if it fails
loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
-- | Loads a user interface and throws an exception if it fails. The first
-- parameter indicates whether we should import the boot variant of the
-- module
loadUserInterface :: Bool -> SDoc -> Module -> IfM lcl ModIface
loadPluginInterface :: SDoc -> Module -> IfM lcl ModIface
findAndReadIface :: SDoc -> InstalledModule -> Module -> IsBootInterface -> TcRnIf gbl lcl (MaybeErr MsgDoc (ModIface, FilePath))
readIface :: Module -> FilePath -> TcRnIf gbl lcl (MaybeErr MsgDoc ModIface)
loadDecls :: Bool -> [(Fingerprint, IfaceDecl)] -> IfL [(Name, TyThing)]
initExternalPackageState :: ExternalPackageState
-- | Compute the signatures which must be compiled in order to load the
-- interface for a Module. The output of this function is always a
-- subset of moduleFreeHoles; it is more precise because in
-- signature p[A=A,B=B]:B, although the free holes
-- are A and B, B might not depend on A at all!
--
-- If this is invoked on a signature, this does NOT include the signature
-- itself; e.g. precise free module holes of
-- p[A=A,B=B]:B never includes B.
moduleFreeHolesPrecise :: SDoc -> Module -> TcRnIf gbl lcl (MaybeErr MsgDoc (UniqDSet ModuleName))
pprModIfaceSimple :: ModIface -> SDoc
ifaceStats :: ExternalPackageState -> SDoc
pprModIface :: ModIface -> SDoc
-- | Read binary interface, and print it out
showIface :: HscEnv -> FilePath -> IO ()
instance Outputable.Outputable HscTypes.Warnings
module TcEnv
-- | A global typecheckable-thing, essentially anything that has a name.
-- Not to be confused with a TcTyThing, which is also a
-- typecheckable thing but in the *local* context. See TcEnv for
-- how to retrieve a TyThing given a Name.
data TyThing
AnId :: Id -> TyThing
AConLike :: ConLike -> TyThing
ATyCon :: TyCon -> TyThing
ACoAxiom :: (CoAxiom Branched) -> TyThing
-- | A typecheckable thing available in a local context. Could be
-- AGlobal TyThing, but also lexically scoped variables,
-- etc. See TcEnv for how to retrieve a TyThing given a
-- Name.
data TcTyThing
AGlobal :: TyThing -> TcTyThing
ATcId :: TcId -> IdBindingInfo -> TcTyThing
[tct_id] :: TcTyThing -> TcId
[tct_info] :: TcTyThing -> IdBindingInfo
ATyVar :: Name -> TcTyVar -> TcTyThing
ATcTyCon :: TyCon -> TcTyThing
APromotionErr :: PromotionErr -> TcTyThing
type TcId = Id
data InstInfo a
InstInfo :: ClsInst -> InstBindings a -> InstInfo a
[iSpec] :: InstInfo a -> ClsInst
[iBinds] :: InstInfo a -> InstBindings a
iDFunId :: InstInfo a -> DFunId
pprInstInfoDetails :: (OutputableBndrId a) => InstInfo a -> SDoc
simpleInstInfoClsTy :: InstInfo a -> (Class, Type)
simpleInstInfoTy :: InstInfo a -> Type
simpleInstInfoTyCon :: InstInfo a -> TyCon
data InstBindings a
InstBindings :: [Name] -> LHsBinds a -> [LSig a] -> [Extension] -> Bool -> InstBindings a
[ib_tyvars] :: InstBindings a -> [Name]
[ib_binds] :: InstBindings a -> LHsBinds a
[ib_pragmas] :: InstBindings a -> [LSig a]
[ib_extensions] :: InstBindings a -> [Extension]
[ib_derived] :: InstBindings a -> Bool
tcExtendGlobalEnv :: [TyThing] -> TcM r -> TcM r
tcExtendTyConEnv :: [TyCon] -> TcM r -> TcM r
tcExtendGlobalEnvImplicit :: [TyThing] -> TcM r -> TcM r
setGlobalTypeEnv :: TcGblEnv -> TypeEnv -> TcM TcGblEnv
tcExtendGlobalValEnv :: [Id] -> TcM a -> TcM a
tcLookupLocatedGlobal :: Located Name -> TcM TyThing
tcLookupGlobal :: Name -> TcM TyThing
tcLookupTyCon :: Name -> TcM TyCon
tcLookupClass :: Name -> TcM Class
tcLookupDataCon :: Name -> TcM DataCon
tcLookupPatSyn :: Name -> TcM PatSyn
tcLookupConLike :: Name -> TcM ConLike
tcLookupLocatedGlobalId :: Located Name -> TcM Id
tcLookupLocatedTyCon :: Located Name -> TcM TyCon
tcLookupLocatedClass :: Located Name -> TcM Class
tcLookupAxiom :: Name -> TcM (CoAxiom Branched)
lookupGlobal :: HscEnv -> Name -> IO TyThing
tcExtendKindEnv :: NameEnv TcTyThing -> TcM r -> TcM r
tcExtendKindEnvList :: [(Name, TcTyThing)] -> TcM r -> TcM r
tcExtendTyVarEnv :: [TyVar] -> TcM r -> TcM r
tcExtendTyVarEnv2 :: [(Name, TcTyVar)] -> TcM r -> TcM r
tcExtendLetEnv :: TopLevelFlag -> TcSigFun -> IsGroupClosed -> [TcId] -> TcM a -> TcM a
tcExtendSigIds :: TopLevelFlag -> [TcId] -> TcM a -> TcM a
tcExtendRecIds :: [(Name, TcId)] -> TcM a -> TcM a
tcExtendIdEnv :: [TcId] -> TcM a -> TcM a
tcExtendIdEnv1 :: Name -> TcId -> TcM a -> TcM a
tcExtendIdEnv2 :: [(Name, TcId)] -> TcM a -> TcM a
tcExtendIdBndrs :: [TcIdBinder] -> TcM a -> TcM a
tcExtendLocalTypeEnv :: TcLclEnv -> [(Name, TcTyThing)] -> TcM TcLclEnv
isTypeClosedLetBndr :: Id -> Bool
tcLookup :: Name -> TcM TcTyThing
tcLookupLocated :: Located Name -> TcM TcTyThing
tcLookupLocalIds :: [Name] -> TcM [TcId]
tcLookupId :: Name -> TcM Id
tcLookupTyVar :: Name -> TcM TcTyVar
tcLookupLcl_maybe :: Name -> TcM (Maybe TcTyThing)
getInLocalScope :: TcM (Name -> Bool)
wrongThingErr :: String -> TcTyThing -> Name -> TcM a
pprBinders :: [Name] -> SDoc
tcAddDataFamConPlaceholders :: [LInstDecl Name] -> TcM a -> TcM a
tcAddPatSynPlaceholders :: [PatSynBind Name Name] -> TcM a -> TcM a
getTypeSigNames :: [LSig Name] -> NameSet
tcExtendRecEnv :: [(Name, TyThing)] -> TcM r -> TcM r
tcLookupInstance :: Class -> [Type] -> TcM ClsInst
tcGetInstEnvs :: TcM InstEnvs
tcExtendRules :: [LRuleDecl Id] -> TcM a -> TcM a
tcGetDefaultTys :: TcM ([Type], (Bool, Bool))
-- | tcGetGlobalTyCoVars returns a fully-zonked set of *scoped*
-- tyvars free in the environment. To improve subsequent calls to the
-- same function it writes the zonked set back into the environment. Note
-- that this returns all variables free in anything (term-level or
-- type-level) in scope. We thus don't have to worry about clashes with
-- things that are not in scope, because if they are reachable, then
-- they'll be returned here.
tcGetGlobalTyCoVars :: TcM TcTyVarSet
checkWellStaged :: SDoc -> ThLevel -> ThLevel -> TcM ()
tcMetaTy :: Name -> TcM Type
thLevel :: ThStage -> ThLevel
topIdLvl :: Id -> ThLevel
isBrackStage :: ThStage -> Bool
-- | Make a name for the dict fun for an instance decl. It's an *external*
-- name, like other top-level names, and hence must be made with
-- newGlobalBinder.
newDFunName :: Class -> [Type] -> SrcSpan -> TcM Name
-- | Special case of newDFunName to generate dict fun name for a
-- single TyCon.
newDFunName' :: Class -> TyCon -> TcM Name
newFamInstTyConName :: Located Name -> [Type] -> TcM Name
newFamInstAxiomName :: Located Name -> [[Type]] -> TcM Name
mkStableIdFromString :: String -> Type -> SrcSpan -> (OccName -> OccName) -> TcM TcId
mkStableIdFromName :: Name -> Type -> SrcSpan -> (OccName -> OccName) -> TcM TcId
mkWrapperName :: (MonadIO m, HasDynFlags m, HasModule m) => String -> String -> m FastString
instance PlaceHolder.OutputableBndrId a => Outputable.Outputable (TcEnv.InstInfo a)
instance HscTypes.MonadThings (IOEnv.IOEnv (TcRnTypes.Env TcRnTypes.TcGblEnv TcRnTypes.TcLclEnv))
-- | Code generation for the Static Pointer Table
--
-- (c) 2014 I/O Tweag
--
-- Each module that uses static keyword declares an
-- initialization function of the form hs_spt_init_module() which
-- is emitted into the _stub.c file and annotated with
-- attribute((constructor)) so that it gets executed at startup
-- time.
--
-- The function's purpose is to call hs_spt_insert to insert the static
-- pointers of this module in the hashtable of the RTS, and it looks
-- something like this:
--
--
-- static void hs_hpc_init_Main(void) __attribute__((constructor));
-- static void hs_hpc_init_Main(void) {
--
-- static StgWord64 k0[2] = {16252233372134256ULL,7370534374096082ULL};
-- extern StgPtr Main_r2wb_closure;
-- hs_spt_insert(k0, &Main_r2wb_closure);
--
-- static StgWord64 k1[2] = {12545634534567898ULL,5409674567544151ULL};
-- extern StgPtr Main_r2wc_closure;
-- hs_spt_insert(k1, &Main_r2wc_closure);
--
-- }
--
--
-- where the constants are fingerprints produced from the static forms.
--
-- The linker must find the definitions matching the extern StgPtr
-- name declarations. For this to work, the identifiers of
-- static pointers need to be exported. This is done in
-- SetLevels.newLvlVar.
--
-- There is also a finalization function for the time when the module is
-- unloaded.
--
--
-- static void hs_hpc_fini_Main(void) __attribute__((destructor));
-- static void hs_hpc_fini_Main(void) {
--
-- static StgWord64 k0[2] = {16252233372134256ULL,7370534374096082ULL};
-- hs_spt_remove(k0);
--
-- static StgWord64 k1[2] = {12545634534567898ULL,5409674567544151ULL};
-- hs_spt_remove(k1);
--
-- }
--
module StaticPtrTable
-- | Replaces all bindings of the form
--
--
-- b = /\ ... -> makeStatic location value
--
--
-- with
--
--
-- b = /\ ... ->
-- StaticPtr key (StaticPtrInfo "pkg key" "module" location) value
--
--
-- where a distinct key is generated for each binding.
--
-- It also yields the C stub that inserts these bindings into the static
-- pointer table.
sptCreateStaticBinds :: HscEnv -> Module -> CoreProgram -> IO ([SptEntry], CoreProgram)
-- | sptModuleInitCode module fps is a C stub to insert the static
-- entries of module into the static pointer table.
--
-- fps is a list associating each binding corresponding to a
-- static entry with its fingerprint.
sptModuleInitCode :: Module -> [SptEntry] -> SDoc
module CoreMonad
data CoreToDo
CoreDoSimplify :: Int -> SimplifierMode -> CoreToDo
CoreDoPluginPass :: String -> PluginPass -> CoreToDo
CoreDoFloatInwards :: CoreToDo
CoreDoFloatOutwards :: FloatOutSwitches -> CoreToDo
CoreLiberateCase :: CoreToDo
CoreDoPrintCore :: CoreToDo
CoreDoStaticArgs :: CoreToDo
CoreDoCallArity :: CoreToDo
CoreDoStrictness :: CoreToDo
CoreDoWorkerWrapper :: CoreToDo
CoreDoSpecialising :: CoreToDo
CoreDoSpecConstr :: CoreToDo
CoreCSE :: CoreToDo
CoreDoRuleCheck :: CompilerPhase -> String -> CoreToDo
CoreDoVectorisation :: CoreToDo
CoreDoNothing :: CoreToDo
CoreDoPasses :: [CoreToDo] -> CoreToDo
CoreDesugar :: CoreToDo
CoreDesugarOpt :: CoreToDo
CoreTidy :: CoreToDo
CorePrep :: CoreToDo
CoreOccurAnal :: CoreToDo
runWhen :: Bool -> CoreToDo -> CoreToDo
runMaybe :: Maybe a -> (a -> CoreToDo) -> CoreToDo
data SimplifierMode
SimplMode :: [String] -> CompilerPhase -> Bool -> Bool -> Bool -> Bool -> SimplifierMode
[sm_names] :: SimplifierMode -> [String]
[sm_phase] :: SimplifierMode -> CompilerPhase
[sm_rules] :: SimplifierMode -> Bool
[sm_inline] :: SimplifierMode -> Bool
[sm_case_case] :: SimplifierMode -> Bool
[sm_eta_expand] :: SimplifierMode -> Bool
data FloatOutSwitches
FloatOutSwitches :: Maybe Int -> Bool -> Bool -> Bool -> FloatOutSwitches
-- | Just n = float lambdas to top level, if doing so will abstract
-- over n or fewer value variables Nothing = float all lambdas to
-- top level, regardless of how many free variables Just 0 is the vanilla
-- case: float a lambda iff it has no free vars
[floatOutLambdas] :: FloatOutSwitches -> Maybe Int
-- | True = float constants to top level, even if they do not escape
-- a lambda
[floatOutConstants] :: FloatOutSwitches -> Bool
-- | True = float out over-saturated applications based on arity
-- information. See Note [Floating over-saturated applications] in
-- SetLevels
[floatOutOverSatApps] :: FloatOutSwitches -> Bool
-- | Allow floating to the top level only.
[floatToTopLevelOnly] :: FloatOutSwitches -> Bool
pprPassDetails :: CoreToDo -> SDoc
-- | A description of the plugin pass itself
type PluginPass = ModGuts -> CoreM ModGuts
bindsOnlyPass :: (CoreProgram -> CoreM CoreProgram) -> ModGuts -> CoreM ModGuts
data SimplCount
doSimplTick :: DynFlags -> Tick -> SimplCount -> SimplCount
doFreeSimplTick :: Tick -> SimplCount -> SimplCount
simplCountN :: SimplCount -> Int
pprSimplCount :: SimplCount -> SDoc
plusSimplCount :: SimplCount -> SimplCount -> SimplCount
zeroSimplCount :: DynFlags -> SimplCount
isZeroSimplCount :: SimplCount -> Bool
hasDetailedCounts :: SimplCount -> Bool
data Tick
PreInlineUnconditionally :: Id -> Tick
PostInlineUnconditionally :: Id -> Tick
UnfoldingDone :: Id -> Tick
RuleFired :: FastString -> Tick
LetFloatFromLet :: Tick
EtaExpansion :: Id -> Tick
EtaReduction :: Id -> Tick
BetaReduction :: Id -> Tick
CaseOfCase :: Id -> Tick
KnownBranch :: Id -> Tick
CaseMerge :: Id -> Tick
AltMerge :: Id -> Tick
CaseElim :: Id -> Tick
CaseIdentity :: Id -> Tick
FillInCaseDefault :: Id -> Tick
BottomFound :: Tick
SimplifierDone :: Tick
-- | The monad used by Core-to-Core passes to access common state, register
-- simplification statistics and so on
data CoreM a
runCoreM :: HscEnv -> RuleBase -> UniqSupply -> Module -> ModuleSet -> PrintUnqualified -> SrcSpan -> CoreM a -> IO (a, SimplCount)
getHscEnv :: CoreM HscEnv
getRuleBase :: CoreM RuleBase
getModule :: HasModule m => m Module
getDynFlags :: HasDynFlags m => m DynFlags
-- | The original name cache is the current mapping from Module and
-- OccName to a compiler-wide unique Name
getOrigNameCache :: CoreM OrigNameCache
getPackageFamInstEnv :: CoreM PackageFamInstEnv
getVisibleOrphanMods :: CoreM ModuleSet
getPrintUnqualified :: CoreM PrintUnqualified
getSrcSpanM :: CoreM SrcSpan
addSimplCount :: SimplCount -> CoreM ()
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => forall a. () => IO a -> m a
-- | Lift an IO operation into CoreM while consuming its
-- SimplCount
liftIOWithCount :: IO (SimplCount, a) -> CoreM a
-- | Lift an IO operation with 1 argument into another monad
liftIO1 :: MonadIO m => (a -> IO b) -> a -> m b
-- | Lift an IO operation with 2 arguments into another monad
liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
-- | Lift an IO operation with 3 arguments into another monad
liftIO3 :: MonadIO m => (a -> b -> c -> IO d) -> a -> b -> c -> m d
-- | Lift an IO operation with 4 arguments into another monad
liftIO4 :: MonadIO m => (a -> b -> c -> d -> IO e) -> a -> b -> c -> d -> m e
-- | Deprecated: It is not necessary to call reinitializeGlobals. Since
-- GHC 8.2, this function is a no-op and will be removed in GHC 8.4
reinitializeGlobals :: CoreM ()
-- | Get all annotations of a given type. This happens lazily, that is no
-- deserialization will take place until the [a] is actually demanded and
-- the [a] can also be empty (the UniqFM is not filtered).
--
-- This should be done once at the start of a Core-to-Core pass that uses
-- annotations.
--
-- See Note [Annotations]
getAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (UniqFM [a])
-- | Get at most one annotation of a given type per Unique.
getFirstAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (UniqFM a)
-- | Output a message to the screen
putMsg :: SDoc -> CoreM ()
-- | Output a String message to the screen
putMsgS :: String -> CoreM ()
-- | Output an error to the screen. Does not cause the compiler to die.
errorMsg :: SDoc -> CoreM ()
-- | Output an error to the screen. Does not cause the compiler to die.
errorMsgS :: String -> CoreM ()
warnMsg :: SDoc -> CoreM ()
-- | Output a fatal error to the screen. Does not cause the compiler to
-- die.
fatalErrorMsg :: SDoc -> CoreM ()
-- | Output a fatal error to the screen. Does not cause the compiler to
-- die.
fatalErrorMsgS :: String -> CoreM ()
-- | Outputs a debugging message at verbosity level of -v or
-- higher
debugTraceMsg :: SDoc -> CoreM ()
-- | Output a string debugging message at verbosity level of -v or
-- higher
debugTraceMsgS :: String -> CoreM ()
-- | Show some labelled SDoc if a particular flag is set or at a
-- verbosity level of -v -ddump-most or higher
dumpIfSet_dyn :: DumpFlag -> String -> SDoc -> CoreM ()
-- | Attempt to convert a Template Haskell name to one that GHC can
-- understand. Original TH names such as those you get when you use the
-- 'foo syntax will be translated to their equivalent GHC name
-- exactly. Qualified or unqualified TH names will be dynamically bound
-- to names in the module being compiled, if possible. Exact TH names
-- will be bound to the name they represent, exactly.
thNameToGhcName :: Name -> CoreM (Maybe Name)
instance Outputable.Outputable CoreMonad.CoreToDo
instance GHC.Base.Functor CoreMonad.CoreM
instance GHC.Base.Monad CoreMonad.CoreM
instance GHC.Base.Applicative CoreMonad.CoreM
instance GHC.Base.Alternative CoreMonad.CoreM
instance GHC.Base.MonadPlus CoreMonad.CoreM
instance UniqSupply.MonadUnique CoreMonad.CoreM
instance Control.Monad.IO.Class.MonadIO CoreMonad.CoreM
instance DynFlags.HasDynFlags CoreMonad.CoreM
instance Module.HasModule CoreMonad.CoreM
instance HscTypes.MonadThings CoreMonad.CoreM
instance Outputable.Outputable CoreMonad.Tick
instance GHC.Classes.Eq CoreMonad.Tick
instance GHC.Classes.Ord CoreMonad.Tick
instance Outputable.Outputable CoreMonad.FloatOutSwitches
instance Outputable.Outputable CoreMonad.SimplifierMode
module Specialise
-- | Specialise calls to type-class overloaded functions occuring in a
-- program.
specProgram :: ModGuts -> CoreM ModGuts
specUnfolding :: [Var] -> (CoreExpr -> CoreExpr) -> Arity -> Unfolding -> Unfolding
instance GHC.Base.Functor Specialise.SpecM
instance GHC.Base.Applicative Specialise.SpecM
instance GHC.Base.Monad Specialise.SpecM
instance Control.Monad.Fail.MonadFail Specialise.SpecM
instance UniqSupply.MonadUnique Specialise.SpecM
instance DynFlags.HasDynFlags Specialise.SpecM
instance Module.HasModule Specialise.SpecM
instance Outputable.Outputable Specialise.UsageDetails
instance Outputable.Outputable Specialise.CallInfoSet
instance Outputable.Outputable Specialise.CallInfo
instance Outputable.Outputable Specialise.CallKey
module SimplMonad
data SimplM result
initSmpl :: DynFlags -> RuleEnv -> (FamInstEnv, FamInstEnv) -> UniqSupply -> Int -> SimplM a -> IO (a, SimplCount)
traceSmpl :: String -> SDoc -> SimplM ()
getSimplRules :: SimplM RuleEnv
getFamEnvs :: SimplM (FamInstEnv, FamInstEnv)
-- | A monad for generating unique identifiers
class Monad m => MonadUnique m
-- | Get a new UniqueSupply
getUniqueSupplyM :: MonadUnique m => m UniqSupply
-- | Get a new unique identifier
getUniqueM :: MonadUnique m => m Unique
-- | Get an infinite list of new unique identifiers
getUniquesM :: MonadUnique m => m [Unique]
newId :: FastString -> Type -> SimplM Id
data SimplCount
tick :: Tick -> SimplM ()
freeTick :: Tick -> SimplM ()
checkedTick :: Tick -> SimplM ()
getSimplCount :: SimplM SimplCount
zeroSimplCount :: DynFlags -> SimplCount
pprSimplCount :: SimplCount -> SDoc
plusSimplCount :: SimplCount -> SimplCount -> SimplCount
isZeroSimplCount :: SimplCount -> Bool
instance GHC.Base.Functor SimplMonad.SimplM
instance GHC.Base.Applicative SimplMonad.SimplM
instance GHC.Base.Monad SimplMonad.SimplM
instance UniqSupply.MonadUnique SimplMonad.SimplM
instance DynFlags.HasDynFlags SimplMonad.SimplM
instance Control.Monad.IO.Class.MonadIO SimplMonad.SimplM
module SimplEnv
setMode :: SimplifierMode -> SimplEnv -> SimplEnv
getMode :: SimplEnv -> SimplifierMode
updMode :: (SimplifierMode -> SimplifierMode) -> SimplEnv -> SimplEnv
data SimplEnv
SimplEnv :: SimplifierMode -> TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> InScopeSet -> Floats -> JoinFloats -> SimplEnv
[seMode] :: SimplEnv -> SimplifierMode
[seTvSubst] :: SimplEnv -> TvSubstEnv
[seCvSubst] :: SimplEnv -> CvSubstEnv
[seIdSubst] :: SimplEnv -> SimplIdSubst
[seInScope] :: SimplEnv -> InScopeSet
[seFloats] :: SimplEnv -> Floats
[seJoinFloats] :: SimplEnv -> JoinFloats
type StaticEnv = SimplEnv
pprSimplEnv :: SimplEnv -> SDoc
mkSimplEnv :: SimplifierMode -> SimplEnv
extendIdSubst :: SimplEnv -> Id -> SimplSR -> SimplEnv
extendTvSubst :: SimplEnv -> TyVar -> Type -> SimplEnv
extendCvSubst :: SimplEnv -> CoVar -> Coercion -> SimplEnv
zapSubstEnv :: SimplEnv -> SimplEnv
setSubstEnv :: SimplEnv -> TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> SimplEnv
getInScope :: SimplEnv -> InScopeSet
setInScopeAndZapFloats :: SimplEnv -> SimplEnv -> SimplEnv
setInScopeSet :: SimplEnv -> InScopeSet -> SimplEnv
modifyInScope :: SimplEnv -> CoreBndr -> SimplEnv
addNewInScopeIds :: SimplEnv -> [CoreBndr] -> SimplEnv
getSimplRules :: SimplM RuleEnv
-- | A substitution result.
data SimplSR
DoneEx :: OutExpr -> SimplSR
DoneId :: OutId -> SimplSR
ContEx :: TvSubstEnv -> CvSubstEnv -> SimplIdSubst -> InExpr -> SimplSR
mkContEx :: SimplEnv -> InExpr -> SimplSR
substId :: SimplEnv -> InId -> SimplSR
lookupRecBndr :: SimplEnv -> InId -> OutId
refineFromInScope :: InScopeSet -> Var -> Var
isJoinIdInEnv_maybe :: SimplEnv -> InId -> Maybe JoinArity
simplNonRecBndr :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
simplNonRecJoinBndr :: SimplEnv -> OutType -> InBndr -> SimplM (SimplEnv, OutBndr)
simplRecBndrs :: SimplEnv -> [InBndr] -> SimplM SimplEnv
simplRecJoinBndrs :: SimplEnv -> OutType -> [InBndr] -> SimplM SimplEnv
simplBinder :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
simplBinders :: SimplEnv -> [InBndr] -> SimplM (SimplEnv, [OutBndr])
substTy :: SimplEnv -> Type -> Type
substTyVar :: SimplEnv -> TyVar -> Type
getTCvSubst :: SimplEnv -> TCvSubst
substCo :: SimplEnv -> Coercion -> Coercion
substCoVar :: SimplEnv -> CoVar -> Coercion
data Floats
emptyFloats :: Floats
isEmptyFloats :: SimplEnv -> Bool
addNonRec :: SimplEnv -> OutId -> OutExpr -> SimplEnv
addFloats :: SimplEnv -> SimplEnv -> SimplEnv
extendFloats :: SimplEnv -> OutBind -> SimplEnv
wrapFloats :: SimplEnv -> OutExpr -> OutExpr
setFloats :: SimplEnv -> SimplEnv -> SimplEnv
zapFloats :: SimplEnv -> SimplEnv
addRecFloats :: SimplEnv -> SimplEnv -> SimplEnv
mapFloats :: SimplEnv -> ((Id, CoreExpr) -> (Id, CoreExpr)) -> SimplEnv
doFloatFromRhs :: TopLevelFlag -> RecFlag -> Bool -> OutExpr -> SimplEnv -> Bool
getFloatBinds :: SimplEnv -> [CoreBind]
type JoinFloats = OrdList OutBind
emptyJoinFloats :: JoinFloats
isEmptyJoinFloats :: SimplEnv -> Bool
wrapJoinFloats :: SimplEnv -> OutExpr -> OutExpr
zapJoinFloats :: SimplEnv -> SimplEnv
restoreJoinFloats :: SimplEnv -> SimplEnv -> SimplEnv
getJoinFloatBinds :: SimplEnv -> [CoreBind]
instance Outputable.Outputable SimplEnv.Floats
instance Outputable.Outputable SimplEnv.FloatFlag
instance Outputable.Outputable SimplEnv.SimplSR
module SimplUtils
mkLam :: SimplEnv -> [OutBndr] -> OutExpr -> SimplCont -> SimplM OutExpr
mkCase :: DynFlags -> OutExpr -> OutId -> OutType -> [OutAlt] -> SimplM OutExpr
prepareAlts :: OutExpr -> OutId -> [InAlt] -> SimplM ([AltCon], [InAlt])
tryEtaExpandRhs :: SimplEnv -> RecFlag -> OutId -> OutExpr -> SimplM (Arity, OutExpr)
preInlineUnconditionally :: DynFlags -> SimplEnv -> TopLevelFlag -> InId -> InExpr -> Bool
postInlineUnconditionally :: DynFlags -> SimplEnv -> TopLevelFlag -> OutId -> OccInfo -> OutExpr -> Unfolding -> Bool
activeUnfolding :: SimplEnv -> Id -> Bool
activeRule :: SimplEnv -> Activation -> Bool
getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv
simplEnvForGHCi :: DynFlags -> SimplEnv
updModeForStableUnfoldings :: Activation -> SimplifierMode -> SimplifierMode
updModeForRules :: SimplifierMode -> SimplifierMode
data SimplCont
Stop :: OutType -> CallCtxt -> SimplCont
CastIt :: OutCoercion -> SimplCont -> SimplCont
ApplyToVal :: DupFlag -> InExpr -> StaticEnv -> SimplCont -> SimplCont
[sc_dup] :: SimplCont -> DupFlag
[sc_arg] :: SimplCont -> InExpr
[sc_env] :: SimplCont -> StaticEnv
[sc_cont] :: SimplCont -> SimplCont
ApplyToTy :: OutType -> OutType -> SimplCont -> SimplCont
[sc_arg_ty] :: SimplCont -> OutType
[sc_hole_ty] :: SimplCont -> OutType
[sc_cont] :: SimplCont -> SimplCont
Select :: DupFlag -> InId -> [InAlt] -> StaticEnv -> SimplCont -> SimplCont
[sc_dup] :: SimplCont -> DupFlag
[sc_bndr] :: SimplCont -> InId
[sc_alts] :: SimplCont -> [InAlt]
[sc_env] :: SimplCont -> StaticEnv
[sc_cont] :: SimplCont -> SimplCont
StrictBind :: InId -> [InBndr] -> InExpr -> StaticEnv -> SimplCont -> SimplCont
StrictArg :: ArgInfo -> CallCtxt -> SimplCont -> SimplCont
TickIt :: (Tickish Id) -> SimplCont -> SimplCont
data DupFlag
NoDup :: DupFlag
Simplified :: DupFlag
OkToDup :: DupFlag
isSimplified :: DupFlag -> Bool
contIsDupable :: SimplCont -> Bool
contResultType :: SimplCont -> OutType
contHoleType :: SimplCont -> OutType
contIsTrivial :: SimplCont -> Bool
contArgs :: SimplCont -> (Bool, [ArgSummary], SimplCont)
countArgs :: SimplCont -> Int
mkBoringStop :: OutType -> SimplCont
mkRhsStop :: OutType -> SimplCont
mkLazyArgStop :: OutType -> CallCtxt -> SimplCont
contIsRhsOrArg :: SimplCont -> Bool
interestingCallContext :: SimplCont -> CallCtxt
data ArgInfo
ArgInfo :: OutId -> [ArgSpec] -> OutType -> FunRules -> Bool -> [Bool] -> [Int] -> ArgInfo
[ai_fun] :: ArgInfo -> OutId
[ai_args] :: ArgInfo -> [ArgSpec]
[ai_type] :: ArgInfo -> OutType
[ai_rules] :: ArgInfo -> FunRules
[ai_encl] :: ArgInfo -> Bool
[ai_strs] :: ArgInfo -> [Bool]
[ai_discs] :: ArgInfo -> [Int]
data ArgSpec
ValArg :: OutExpr -> ArgSpec
TyArg :: OutType -> OutType -> ArgSpec
[as_arg_ty] :: ArgSpec -> OutType
[as_hole_ty] :: ArgSpec -> OutType
CastBy :: OutCoercion -> ArgSpec
mkArgInfo :: Id -> [CoreRule] -> Int -> SimplCont -> ArgInfo
addValArgTo :: ArgInfo -> OutExpr -> ArgInfo
addCastTo :: ArgInfo -> OutCoercion -> ArgInfo
addTyArgTo :: ArgInfo -> OutType -> ArgInfo
argInfoExpr :: OutId -> [ArgSpec] -> OutExpr
argInfoAppArgs :: [ArgSpec] -> [OutExpr]
pushSimplifiedArgs :: SimplEnv -> [ArgSpec] -> SimplCont -> SimplCont
abstractFloats :: [OutTyVar] -> SimplEnv -> OutExpr -> SimplM ([OutBind], OutExpr)
instance Outputable.Outputable SimplUtils.SimplCont
instance Outputable.Outputable SimplUtils.ArgSpec
instance Outputable.Outputable SimplUtils.DupFlag
module Simplify
simplTopBinds :: SimplEnv -> [InBind] -> SimplM SimplEnv
simplExpr :: SimplEnv -> CoreExpr -> SimplM CoreExpr
simplRules :: SimplEnv -> Maybe Name -> [CoreRule] -> SimplM [CoreRule]
module SetLevels
setLevels :: FloatOutSwitches -> CoreProgram -> UniqSupply -> [LevelledBind]
data Level
Level :: Int -> Int -> LevelType -> Level
data LevelType
BndrLvl :: LevelType
JoinCeilLvl :: LevelType
tOP_LEVEL :: Level
isJoinCeilLvl :: Level -> Bool
asJoinCeilLvl :: Level -> Level
type LevelledBind = TaggedBind FloatSpec
type LevelledExpr = TaggedExpr FloatSpec
type LevelledBndr = TaggedBndr FloatSpec
data FloatSpec
FloatMe :: Level -> FloatSpec
StayPut :: Level -> FloatSpec
floatSpecLevel :: FloatSpec -> Level
incMinorLvl :: Level -> Level
ltMajLvl :: Level -> Level -> Bool
ltLvl :: Level -> Level -> Bool
isTopLvl :: Level -> Bool
instance GHC.Classes.Eq SetLevels.LevelType
instance Outputable.Outputable SetLevels.FloatSpec
instance Outputable.Outputable SetLevels.Level
instance GHC.Classes.Eq SetLevels.Level
module Plugins
data FrontendPlugin
FrontendPlugin :: FrontendPluginAction -> FrontendPlugin
[frontend] :: FrontendPlugin -> FrontendPluginAction
defaultFrontendPlugin :: FrontendPlugin
-- | Plugin is the core compiler plugin data type. Try to avoid
-- constructing one of these directly, and just modify some fields of
-- defaultPlugin instead: this is to try and preserve source-code
-- compatibility when we add fields to this.
--
-- Nonetheless, this API is preliminary and highly likely to change in
-- the future.
data Plugin
Plugin :: ([CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]) -> ([CommandLineOption] -> Maybe TcPlugin) -> Plugin
-- | Modify the Core pipeline that will be used for compilation. This is
-- called as the Core pipeline is built for every module being compiled,
-- and plugins get the opportunity to modify the pipeline in a
-- nondeterministic order.
[installCoreToDos] :: Plugin -> [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
-- | An optional typechecker plugin, which may modify the behaviour of the
-- constraint solver.
[tcPlugin] :: Plugin -> [CommandLineOption] -> Maybe TcPlugin
-- | Command line options gathered from the -PModule.Name:stuff syntax are
-- given to you as this type
type CommandLineOption = String
-- | Default plugin: does nothing at all! For compatibility reasons you
-- should base all your plugin definitions on this default value.
defaultPlugin :: Plugin
module FloatOut
floatOutwards :: FloatOutSwitches -> DynFlags -> UniqSupply -> CoreProgram -> IO CoreProgram
instance Outputable.Outputable FloatOut.FloatBinds
module FloatIn
floatInwards :: ModGuts -> CoreM ModGuts
module RnEnv
newTopSrcBinder :: Located RdrName -> RnM Name
lookupLocatedTopBndrRn :: Located RdrName -> RnM (Located Name)
lookupTopBndrRn :: RdrName -> RnM Name
lookupLocatedOccRn :: Located RdrName -> RnM (Located Name)
lookupOccRn :: RdrName -> RnM Name
lookupOccRn_maybe :: RdrName -> RnM (Maybe Name)
lookupLocalOccRn_maybe :: RdrName -> RnM (Maybe Name)
lookupInfoOccRn :: RdrName -> RnM [Name]
lookupLocalOccThLvl_maybe :: Name -> RnM (Maybe (TopLevelFlag, ThLevel))
lookupTypeOccRn :: RdrName -> RnM Name
lookupKindOccRn :: RdrName -> RnM Name
lookupGlobalOccRn :: RdrName -> RnM Name
lookupGlobalOccRn_maybe :: RdrName -> RnM (Maybe Name)
-- | Like lookupOccRn_maybe, but with a more informative result if
-- the RdrName happens to be a record selector:
--
--
-- - Nothing -> name not in scope (no error reported)
-- - Just (Left x) -> name uniquely refers to x, or there is a name
-- clash (reported)
-- - Just (Right xs) -> name refers to one or more record selectors;
-- if overload_ok was False, this list will be a singleton.
--
lookupOccRn_overloaded :: Bool -> RdrName -> RnM (Maybe (Either Name [FieldOcc Name]))
lookupGlobalOccRn_overloaded :: Bool -> RdrName -> RnM (Maybe (Either Name [FieldOcc Name]))
-- | Lookup an Exact RdrName. See Note [Looking up Exact
-- RdrNames]. This adds an error if the name cannot be found.
lookupExactOcc :: Name -> RnM Name
reportUnboundName :: RdrName -> RnM Name
-- | Called from the typechecker (TcErrors) when we find an unbound
-- variable
unknownNameSuggestions :: DynFlags -> GlobalRdrEnv -> LocalRdrEnv -> ImportAvails -> RdrName -> SDoc
addNameClashErrRn :: RdrName -> [GlobalRdrElt] -> RnM ()
data HsSigCtxt
TopSigCtxt :: NameSet -> HsSigCtxt
LocalBindCtxt :: NameSet -> HsSigCtxt
ClsDeclCtxt :: Name -> HsSigCtxt
InstDeclCtxt :: NameSet -> HsSigCtxt
HsBootCtxt :: NameSet -> HsSigCtxt
RoleAnnotCtxt :: NameSet -> HsSigCtxt
lookupLocalTcNames :: HsSigCtxt -> SDoc -> RdrName -> RnM [(RdrName, Name)]
lookupSigOccRn :: HsSigCtxt -> Sig RdrName -> Located RdrName -> RnM (Located Name)
-- | Lookup a name in relation to the names in a HsSigCtxt
lookupSigCtxtOccRn :: HsSigCtxt -> SDoc -> Located RdrName -> RnM (Located Name)
lookupFixityRn :: Name -> RnM Fixity
-- | lookupFixityRn_help returns (True, fixity) if it finds
-- a Fixity in a local environment or from an interface file.
-- Otherwise, it returns (False, fixity) (e.g., for unbound
-- Names or Names without user-supplied fixity
-- declarations).
lookupFixityRn_help :: Name -> RnM (Bool, Fixity)
-- | Look up the fixity of a (possibly ambiguous) occurrence of a record
-- field selector. We use lookupFixityRn' so that we can specifiy
-- the OccName as the field label, which might be different to the
-- OccName of the selector Name if
-- DuplicateRecordFields is in use (Trac #1173). If there are
-- multiple possible selectors with different fixities, generate an
-- error.
lookupFieldFixityRn :: AmbiguousFieldOcc Name -> RnM Fixity
lookupTyFixityRn :: Located Name -> RnM Fixity
lookupInstDeclBndr :: Name -> SDoc -> RdrName -> RnM Name
lookupRecFieldOcc :: Maybe Name -> SDoc -> RdrName -> RnM Name
lookupFamInstName :: Maybe Name -> Located RdrName -> RnM (Located Name)
lookupConstructorFields :: Name -> RnM [FieldLabel]
lookupSyntaxName :: Name -> RnM (SyntaxExpr Name, FreeVars)
lookupSyntaxName' :: Name -> RnM Name
lookupSyntaxNames :: [Name] -> RnM ([HsExpr Name], FreeVars)
lookupIfThenElse :: RnM (Maybe (SyntaxExpr Name), FreeVars)
lookupGreAvailRn :: RdrName -> RnM (Name, AvailInfo)
getLookupOccRn :: RnM (Name -> Maybe Name)
mkUnboundName :: OccName -> Name
mkUnboundNameRdr :: RdrName -> Name
isUnboundName :: Name -> Bool
addUsedGRE :: Bool -> GlobalRdrElt -> RnM ()
addUsedGREs :: [GlobalRdrElt] -> RnM ()
addUsedDataCons :: GlobalRdrEnv -> TyCon -> RnM ()
newLocalBndrRn :: Located RdrName -> RnM Name
newLocalBndrsRn :: [Located RdrName] -> RnM [Name]
bindLocalNames :: [Name] -> RnM a -> RnM a
bindLocalNamesFV :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
type MiniFixityEnv = FastStringEnv (Located Fixity)
addLocalFixities :: MiniFixityEnv -> [Name] -> RnM a -> RnM a
bindLocatedLocalsFV :: [Located RdrName] -> ([Name] -> RnM (a, FreeVars)) -> RnM (a, FreeVars)
bindLocatedLocalsRn :: [Located RdrName] -> ([Name] -> RnM a) -> RnM a
extendTyVarEnvFVRn :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
type RoleAnnotEnv = NameEnv (LRoleAnnotDecl Name)
emptyRoleAnnotEnv :: RoleAnnotEnv
mkRoleAnnotEnv :: [LRoleAnnotDecl Name] -> RoleAnnotEnv
lookupRoleAnnot :: RoleAnnotEnv -> Name -> Maybe (LRoleAnnotDecl Name)
getRoleAnnots :: [Name] -> RoleAnnotEnv -> ([LRoleAnnotDecl Name], RoleAnnotEnv)
checkDupRdrNames :: [Located RdrName] -> RnM ()
checkShadowedRdrNames :: [Located RdrName] -> RnM ()
checkDupNames :: [Name] -> RnM ()
checkDupAndShadowedNames :: (GlobalRdrEnv, LocalRdrEnv) -> [Name] -> RnM ()
dupNamesErr :: Outputable n => (n -> SrcSpan) -> [n] -> RnM ()
checkTupSize :: Int -> RnM ()
addFvRn :: FreeVars -> RnM (thing, FreeVars) -> RnM (thing, FreeVars)
mapFvRn :: (a -> RnM (b, FreeVars)) -> [a] -> RnM ([b], FreeVars)
mapMaybeFvRn :: (a -> RnM (b, FreeVars)) -> Maybe a -> RnM (Maybe b, FreeVars)
mapFvRnCPS :: (a -> (b -> RnM c) -> RnM c) -> [a] -> ([b] -> RnM c) -> RnM c
warnUnusedMatches :: [Name] -> FreeVars -> RnM ()
warnUnusedTypePatterns :: [Name] -> FreeVars -> RnM ()
warnUnusedTopBinds :: [GlobalRdrElt] -> RnM ()
warnUnusedLocalBinds :: [Name] -> FreeVars -> RnM ()
-- | Make a map from selector names to field labels and parent tycon names,
-- to be used when reporting unused record fields.
mkFieldEnv :: GlobalRdrEnv -> NameEnv (FieldLabelString, Name)
dataTcOccs :: RdrName -> [RdrName]
kindSigErr :: Outputable a => a -> SDoc
perhapsForallMsg :: SDoc
unknownSubordinateErr :: SDoc -> RdrName -> SDoc
data HsDocContext
TypeSigCtx :: SDoc -> HsDocContext
PatCtx :: HsDocContext
SpecInstSigCtx :: HsDocContext
DefaultDeclCtx :: HsDocContext
ForeignDeclCtx :: (Located RdrName) -> HsDocContext
DerivDeclCtx :: HsDocContext
RuleCtx :: FastString -> HsDocContext
TyDataCtx :: (Located RdrName) -> HsDocContext
TySynCtx :: (Located RdrName) -> HsDocContext
TyFamilyCtx :: (Located RdrName) -> HsDocContext
FamPatCtx :: (Located RdrName) -> HsDocContext
ConDeclCtx :: [Located Name] -> HsDocContext
ClassDeclCtx :: (Located RdrName) -> HsDocContext
ExprWithTySigCtx :: HsDocContext
TypBrCtx :: HsDocContext
HsTypeCtx :: HsDocContext
GHCiCtx :: HsDocContext
SpliceTypeCtx :: (LHsType RdrName) -> HsDocContext
ClassInstanceCtx :: HsDocContext
VectDeclCtx :: (Located RdrName) -> HsDocContext
GenericCtx :: SDoc -> HsDocContext
pprHsDocContext :: HsDocContext -> SDoc
inHsDocContext :: HsDocContext -> SDoc
withHsDocContext :: HsDocContext -> SDoc -> SDoc
instance Outputable.Outputable RnEnv.HsSigCtxt
module RnTypes
rnHsType :: HsDocContext -> HsType RdrName -> RnM (HsType Name, FreeVars)
rnLHsType :: HsDocContext -> LHsType RdrName -> RnM (LHsType Name, FreeVars)
rnLHsTypes :: HsDocContext -> [LHsType RdrName] -> RnM ([LHsType Name], FreeVars)
rnContext :: HsDocContext -> LHsContext RdrName -> RnM (LHsContext Name, FreeVars)
rnHsKind :: HsDocContext -> HsKind RdrName -> RnM (HsKind Name, FreeVars)
rnLHsKind :: HsDocContext -> LHsKind RdrName -> RnM (LHsKind Name, FreeVars)
rnHsSigType :: HsDocContext -> LHsSigType RdrName -> RnM (LHsSigType Name, FreeVars)
rnHsWcType :: HsDocContext -> LHsWcType RdrName -> RnM (LHsWcType Name, FreeVars)
rnHsSigWcType :: HsDocContext -> LHsSigWcType RdrName -> RnM (LHsSigWcType Name, FreeVars)
rnHsSigWcTypeScoped :: HsDocContext -> LHsSigWcType RdrName -> (LHsSigWcType Name -> RnM (a, FreeVars)) -> RnM (a, FreeVars)
rnLHsInstType :: SDoc -> LHsSigType RdrName -> RnM (LHsSigType Name, FreeVars)
newTyVarNameRn :: Maybe a -> Located RdrName -> RnM Name
-- | Extract all wild cards from a type.
collectAnonWildCards :: LHsType Name -> [Name]
rnConDeclFields :: HsDocContext -> [FieldLabel] -> [LConDeclField RdrName] -> RnM ([LConDeclField Name], FreeVars)
rnLTyVar :: Located RdrName -> RnM (Located Name)
mkOpAppRn :: LHsExpr Name -> LHsExpr Name -> Fixity -> LHsExpr Name -> RnM (HsExpr Name)
mkNegAppRn :: LHsExpr id -> SyntaxExpr id -> RnM (HsExpr id)
mkOpFormRn :: LHsCmdTop Name -> LHsExpr Name -> Fixity -> LHsCmdTop Name -> RnM (HsCmd Name)
mkConOpPatRn :: Located Name -> Fixity -> LPat Name -> LPat Name -> RnM (Pat Name)
checkPrecMatch :: Name -> MatchGroup Name body -> RnM ()
checkSectionPrec :: FixityDirection -> HsExpr RdrName -> LHsExpr Name -> LHsExpr Name -> RnM ()
bindLHsTyVarBndr :: HsDocContext -> Maybe a -> NameSet -> NameSet -> LHsTyVarBndr RdrName -> ([Name] -> NameSet -> LHsTyVarBndr Name -> RnM (b, FreeVars)) -> RnM (b, FreeVars)
bindSigTyVarsFV :: [Name] -> RnM (a, FreeVars) -> RnM (a, FreeVars)
bindHsQTyVars :: forall a b. HsDocContext -> Maybe SDoc -> Maybe a -> [Located RdrName] -> (LHsQTyVars RdrName) -> (LHsQTyVars Name -> NameSet -> RnM (b, FreeVars)) -> RnM (b, FreeVars)
-- | Simply bring a bunch of RdrNames into scope. No checking for validity,
-- at all. The binding location is taken from the location on each name.
bindLRdrNames :: [Located RdrName] -> ([Name] -> RnM (a, FreeVars)) -> RnM (a, FreeVars)
-- | Finds free type and kind variables in a type, without duplicates, and
-- without variables that are already in scope in LocalRdrEnv NB: this
-- includes named wildcards, which look like perfectly ordinary type
-- variables at this point
extractFilteredRdrTyVars :: LHsType RdrName -> RnM FreeKiTyVars
extractHsTyRdrTyVars :: LHsType RdrName -> RnM FreeKiTyVars
-- | Extracts free type and kind variables from types in a list. When the
-- same name occurs multiple times in the types, only the first
-- occurrence is returned and the rest is filtered out. See Note [Kind
-- and type-variable binders]
extractHsTysRdrTyVars :: [LHsType RdrName] -> RnM FreeKiTyVars
-- | Extracts free type and kind variables from types in a list. When the
-- same name occurs multiple times in the types, all occurrences are
-- returned.
extractHsTysRdrTyVarsDups :: [LHsType RdrName] -> RnM FreeKiTyVars
-- | Removes multiple occurrences of the same name from FreeKiTyVars.
rmDupsInRdrTyVars :: FreeKiTyVars -> FreeKiTyVars
extractRdrKindSigVars :: LFamilyResultSig RdrName -> RnM [Located RdrName]
extractDataDefnKindVars :: HsDataDefn RdrName -> RnM [Located RdrName]
freeKiTyVarsAllVars :: FreeKiTyVars -> [Located RdrName]
freeKiTyVarsKindVars :: FreeKiTyVars -> [Located RdrName]
freeKiTyVarsTypeVars :: FreeKiTyVars -> [Located RdrName]
instance Outputable.Outputable RnTypes.FreeKiTyVars
instance Outputable.Outputable RnTypes.OpName
instance Outputable.Outputable RnTypes.RnTyKiEnv
instance Outputable.Outputable RnTypes.RnTyKiWhat
module RnPat
rnPat :: HsMatchContext Name -> LPat RdrName -> (LPat Name -> RnM (a, FreeVars)) -> RnM (a, FreeVars)
rnPats :: HsMatchContext Name -> [LPat RdrName] -> ([LPat Name] -> RnM (a, FreeVars)) -> RnM (a, FreeVars)
rnBindPat :: NameMaker -> LPat RdrName -> RnM (LPat Name, FreeVars)
rnPatAndThen :: NameMaker -> Pat RdrName -> CpsRn (Pat Name)
data NameMaker
applyNameMaker :: NameMaker -> Located RdrName -> RnM (Located Name)
localRecNameMaker :: MiniFixityEnv -> NameMaker
topRecNameMaker :: MiniFixityEnv -> NameMaker
isTopRecNameMaker :: NameMaker -> Bool
rnHsRecFields :: forall arg. HsRecFieldContext -> (SrcSpan -> RdrName -> arg) -> HsRecFields RdrName (Located arg) -> RnM ([LHsRecField Name (Located arg)], FreeVars)
data HsRecFieldContext
HsRecFieldCon :: Name -> HsRecFieldContext
HsRecFieldPat :: Name -> HsRecFieldContext
HsRecFieldUpd :: HsRecFieldContext
rnHsRecUpdFields :: [LHsRecUpdField RdrName] -> RnM ([LHsRecUpdField Name], FreeVars)
data CpsRn b
liftCps :: RnM a -> CpsRn a
rnLit :: HsLit -> RnM ()
rnOverLit :: HsOverLit t -> RnM (HsOverLit Name, FreeVars)
checkTupSize :: Int -> RnM ()
patSigErr :: Outputable a => a -> SDoc
instance GHC.Base.Functor RnPat.CpsRn
instance GHC.Base.Applicative RnPat.CpsRn
instance GHC.Base.Monad RnPat.CpsRn
module RnNames
-- | Process Import Decls. See rnImportDecl for a description of
-- what the return types represent. Note: Do the non SOURCE ones first,
-- so that we get a helpful warning for SOURCE ones that are unnecessary
rnImports :: [LImportDecl RdrName] -> RnM ([LImportDecl Name], GlobalRdrEnv, ImportAvails, AnyHpcUsage)
getLocalNonValBinders :: MiniFixityEnv -> HsGroup RdrName -> RnM ((TcGblEnv, TcLclEnv), NameSet)
newRecordSelector :: Bool -> [Name] -> LFieldOcc RdrName -> RnM FieldLabel
extendGlobalRdrEnvRn :: [AvailInfo] -> MiniFixityEnv -> RnM (TcGblEnv, TcLclEnv)
-- | make a GlobalRdrEnv where all the elements point to the same
-- Provenance (useful for "hiding" imports, or imports with no details).
gresFromAvails :: Maybe ImportSpec -> [AvailInfo] -> [GlobalRdrElt]
-- | Calculate the ImportAvails induced by an import of a particular
-- interface, but without imp_mods.
calculateAvails :: DynFlags -> ModIface -> IsSafeImport -> IsBootInterface -> ImportedBy -> ImportAvails
reportUnusedNames :: Maybe (Located [LIE RdrName]) -> TcGblEnv -> RnM ()
checkConName :: RdrName -> TcRn ()
mkChildEnv :: [GlobalRdrElt] -> NameEnv [GlobalRdrElt]
findChildren :: NameEnv [a] -> Name -> [a]
dodgyMsg :: (OutputableBndr n, HasOccName n) => SDoc -> n -> SDoc
module TcRnExports
tcRnExports :: Bool -> Maybe (Located [LIE RdrName]) -> TcGblEnv -> RnM TcGblEnv
exports_from_avail :: Maybe (Located [LIE RdrName]) -> GlobalRdrEnv -> ImportAvails -> Module -> RnM (Maybe [LIE Name], [AvailInfo])
instance GHC.Base.Monoid TcRnExports.DisambigInfo
instance Outputable.Outputable TcRnExports.ChildLookupResult
instance GHC.Base.Monoid TcRnExports.ChildLookupResult
module RnBinds
rnTopBindsLHS :: MiniFixityEnv -> HsValBinds RdrName -> RnM (HsValBindsLR Name RdrName)
rnTopBindsBoot :: NameSet -> HsValBindsLR Name RdrName -> RnM (HsValBinds Name, DefUses)
rnValBindsRHS :: HsSigCtxt -> HsValBindsLR Name RdrName -> RnM (HsValBinds Name, DefUses)
rnLocalBindsAndThen :: HsLocalBinds RdrName -> (HsLocalBinds Name -> FreeVars -> RnM (result, FreeVars)) -> RnM (result, FreeVars)
rnLocalValBindsLHS :: MiniFixityEnv -> HsValBinds RdrName -> RnM ([Name], HsValBindsLR Name RdrName)
rnLocalValBindsRHS :: NameSet -> HsValBindsLR Name RdrName -> RnM (HsValBinds Name, DefUses)
rnMethodBinds :: Bool -> Name -> [Name] -> LHsBinds RdrName -> [LSig RdrName] -> RnM (LHsBinds Name, [LSig Name], FreeVars)
renameSigs :: HsSigCtxt -> [LSig RdrName] -> RnM ([LSig Name], FreeVars)
rnMatchGroup :: Outputable (body RdrName) => HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> MatchGroup RdrName (Located (body RdrName)) -> RnM (MatchGroup Name (Located (body Name)), FreeVars)
rnGRHSs :: HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> GRHSs RdrName (Located (body RdrName)) -> RnM (GRHSs Name (Located (body Name)), FreeVars)
rnGRHS :: HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> LGRHS RdrName (Located (body RdrName)) -> RnM (LGRHS Name (Located (body Name)), FreeVars)
makeMiniFixityEnv :: [LFixitySig RdrName] -> RnM MiniFixityEnv
type MiniFixityEnv = FastStringEnv (Located Fixity)
data HsSigCtxt
TopSigCtxt :: NameSet -> HsSigCtxt
LocalBindCtxt :: NameSet -> HsSigCtxt
ClsDeclCtxt :: Name -> HsSigCtxt
InstDeclCtxt :: NameSet -> HsSigCtxt
HsBootCtxt :: NameSet -> HsSigCtxt
RoleAnnotCtxt :: NameSet -> HsSigCtxt
module RnSource
-- | rnSourceDecl "renames" declarations. It simultaneously
-- performs dependency analysis and precedence parsing. It also does the
-- following error checks:
--
--
-- - Checks that tyvars are used properly. This includes checking for
-- undefined tyvars, and tyvars in contexts that are ambiguous. (Some of
-- this checking has now been moved to module TcMonoType, since
-- we don't have functional dependency information at this point.)
-- - Checks that all variable occurrences are defined.
-- - Checks the (..) etc constraints in the export list.
--
--
-- Brings the binders of the group into scope in the appropriate places;
-- does NOT assume that anything is in scope already
rnSrcDecls :: HsGroup RdrName -> RnM (TcGblEnv, HsGroup Name)
addTcgDUs :: TcGblEnv -> DefUses -> TcGblEnv
findSplice :: [LHsDecl RdrName] -> RnM (HsGroup RdrName, Maybe (SpliceDecl RdrName, [LHsDecl RdrName]))
module RnSplice
rnTopSpliceDecls :: HsSplice RdrName -> RnM ([LHsDecl RdrName], FreeVars)
rnSpliceType :: HsSplice RdrName -> PostTc Name Kind -> RnM (HsType Name, FreeVars)
rnSpliceExpr :: HsSplice RdrName -> RnM (HsExpr Name, FreeVars)
-- | Rename a splice pattern. See Note [rnSplicePat]
rnSplicePat :: HsSplice RdrName -> RnM (Either (Pat RdrName) (Pat Name), FreeVars)
rnSpliceDecl :: SpliceDecl RdrName -> RnM (SpliceDecl Name, FreeVars)
rnBracket :: HsExpr RdrName -> HsBracket RdrName -> RnM (HsExpr Name, FreeVars)
checkThLocalName :: Name -> RnM ()
-- | outputs splice information for 2 flags which have different output
-- formats: `-ddump-splices` and `-dth-dec-file`
traceSplice :: SpliceInfo -> TcM ()
-- | The splice data to be logged
data SpliceInfo
SpliceInfo :: String -> Maybe (LHsExpr Name) -> Bool -> SDoc -> SpliceInfo
[spliceDescription] :: SpliceInfo -> String
[spliceSource] :: SpliceInfo -> Maybe (LHsExpr Name)
[spliceIsDecl] :: SpliceInfo -> Bool
[spliceGenerated] :: SpliceInfo -> SDoc
module RnExpr
rnLExpr :: LHsExpr RdrName -> RnM (LHsExpr Name, FreeVars)
rnExpr :: HsExpr RdrName -> RnM (HsExpr Name, FreeVars)
-- | Rename some Stmts
rnStmts :: Outputable (body RdrName) => HsStmtContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> [LStmt RdrName (Located (body RdrName))] -> ([Name] -> RnM (thing, FreeVars)) -> RnM (([LStmt Name (Located (body Name))], thing), FreeVars)
-- | Module for constructing ModIface values (interface files),
-- writing them to disk and comparing two versions to see if
-- recompilation is required.
module MkIface
mkIface :: HscEnv -> Maybe Fingerprint -> ModDetails -> ModGuts -> IO (ModIface, Bool)
-- | make an interface from the results of typechecking only. Useful for
-- non-optimising compilation, or where we aren't generating any object
-- code at all (HscNothing).
mkIfaceTc :: HscEnv -> Maybe Fingerprint -> SafeHaskellMode -> ModDetails -> TcGblEnv -> IO (ModIface, Bool)
writeIfaceFile :: DynFlags -> FilePath -> ModIface -> IO ()
-- | Top level function to check if the version of an old interface file is
-- equivalent to the current source file the user asked us to compile. If
-- the same, we can avoid recompilation. We return a tuple where the
-- first element is a bool saying if we should recompile the object file
-- and the second is maybe the interface file, where Nothng means to
-- rebuild the interface file not use the exisitng one.
checkOldIface :: HscEnv -> ModSummary -> SourceModified -> Maybe ModIface -> IO (RecompileRequired, Maybe ModIface)
data RecompileRequired
-- | everything is up to date, recompilation is not required
UpToDate :: RecompileRequired
-- | The .hs file has been touched, or the .o/.hi file does not exist
MustCompile :: RecompileRequired
-- | The .o/.hi files are up to date, but something else has changed to
-- force recompilation; the String says what (one-line summary)
RecompBecause :: String -> RecompileRequired
recompileRequired :: RecompileRequired -> Bool
mkIfaceExports :: [AvailInfo] -> [IfaceExport]
tyThingToIfaceDecl :: TyThing -> IfaceDecl
instance GHC.Classes.Eq MkIface.RecompileRequired
instance Outputable.Outputable MkIface.IfaceDeclExtras
instance Binary.Binary MkIface.IfaceDeclExtras
instance Binary.Binary MkIface.IfaceIdExtras
module PprTyThing
-- | Pretty-prints a TyThing.
pprTyThing :: ShowSub -> TyThing -> SDoc
-- | Pretty-prints a TyThing in context: that is, if the entity is a
-- data constructor, record selector, or class method, then the entity's
-- parent declaration is pretty-printed with irrelevant parts omitted.
pprTyThingInContext :: ShowSub -> TyThing -> SDoc
-- | Pretty-prints a TyThing with its defining location.
pprTyThingLoc :: TyThing -> SDoc
-- | Like pprTyThingInContext, but adds the defining location.
pprTyThingInContextLoc :: TyThing -> SDoc
-- | Pretty-prints the TyThing header. For functions and data
-- constructors the function is equivalent to pprTyThing but for
-- type constructors and classes it prints only the header part of the
-- declaration.
pprTyThingHdr :: TyThing -> SDoc
pprTypeForUser :: Type -> SDoc
-- | Pretty-prints a FamInst (type/data family instance) with its
-- defining location.
pprFamInst :: FamInst -> SDoc
module FamInst
type FamInstEnvs = (FamInstEnv, FamInstEnv)
tcGetFamInstEnvs :: TcM FamInstEnvs
-- | Check family instance consistency, given:
--
--
-- - The list of all modules transitively imported by us which define a
-- family instance (these are the ones we have to check for consistency),
-- and
-- - The list of modules which we directly imported (these specify the
-- sets of family instance defining modules which are already known to be
-- consistent).
--
--
-- See Note [Checking family instance consistency] for more details, and
-- Note [The type family instance consistency story] for the big picture.
--
-- This function doesn't check ALL instances for consistency, only ones
-- that aren't involved in recursive knot-tying loops; see Note [Don't
-- check hs-boot type family instances too early]. It returns a modified
-- TcGblEnv that has saved the instances that need to be checked
-- later; use checkRecFamInstConsistency to check those.
checkFamInstConsistency :: [Module] -> [Module] -> TcM TcGblEnv
tcExtendLocalFamInstEnv :: [FamInst] -> TcM a -> TcM a
-- | Like tcLookupDataFamInst_maybe, but returns the arguments back
-- if there is no data family to unwrap. Returns a Representational
-- coercion
tcLookupDataFamInst :: FamInstEnvs -> TyCon -> [TcType] -> (TyCon, [TcType], Coercion)
-- | Converts a data family type (eg F [a]) to its representation type (eg
-- FList a) and returns a coercion between the two: co :: F [a] ~R FList
-- a.
tcLookupDataFamInst_maybe :: FamInstEnvs -> TyCon -> [TcType] -> Maybe (TyCon, [TcType], Coercion)
-- | If co :: T ts ~ rep_ty then:
--
--
-- instNewTyCon_maybe T ts = Just (rep_ty, co)
--
--
-- Checks for a newtype, and for being saturated Just like
-- Coercion.instNewTyCon_maybe, but returns a TcCoercion
tcInstNewTyCon_maybe :: TyCon -> [TcType] -> Maybe (TcType, TcCoercion)
-- | tcTopNormaliseNewTypeTF_maybe gets rid of top-level newtypes,
-- potentially looking through newtype instances.
--
-- It is only used by the type inference engine (specifically, when
-- solving representational equality), and hence it is careful to unwrap
-- only if the relevant data constructor is in scope. That's why it get a
-- GlobalRdrEnv argument.
--
-- It is careful not to unwrap data/newtype instances if it can't
-- continue unwrapping. Such care is necessary for proper error messages.
--
-- It does not look through type families. It does not normalise
-- arguments to a tycon.
--
-- If the result is Just (rep_ty, (co, gres), rep_ty), then co : ty ~R
-- rep_ty gres are the GREs for the data constructors that had to be in
-- scope
tcTopNormaliseNewTypeTF_maybe :: FamInstEnvs -> GlobalRdrEnv -> Type -> Maybe ((Bag GlobalRdrElt, TcCoercion), Type)
-- | Given a TyCon that has been incorporated into the type
-- environment (the knot is tied), if it is a type family, check that all
-- deferred instances for it are consistent. See Note [Don't check
-- hs-boot type family instances too early]
checkRecFamInstConsistency :: TyCon -> TcM ()
newFamInst :: FamFlavor -> CoAxiom Unbranched -> TcRnIf gbl lcl FamInst
-- | Build a list of injectivity errors together with their source
-- locations.
makeInjectivityErrors :: CoAxiom br -> CoAxBranch -> [Bool] -> [CoAxBranch] -> [(SDoc, SrcSpan)]
injTyVarsOfType :: TcTauType -> TcTyVarSet
injTyVarsOfTypes :: [Type] -> VarSet
instance GHC.Classes.Eq FamInst.ModulePair
instance GHC.Classes.Ord FamInst.ModulePair
instance Outputable.Outputable FamInst.ModulePair
module FunDeps
data FunDepEqn loc
FDEqn :: [TyVar] -> [TypeEqn] -> PredType -> PredType -> loc -> FunDepEqn loc
[fd_qtvs] :: FunDepEqn loc -> [TyVar]
[fd_eqs] :: FunDepEqn loc -> [TypeEqn]
[fd_pred1] :: FunDepEqn loc -> PredType
[fd_pred2] :: FunDepEqn loc -> PredType
[fd_loc] :: FunDepEqn loc -> loc
pprEquation :: FunDepEqn a -> SDoc
improveFromInstEnv :: InstEnvs -> (PredType -> SrcSpan -> loc) -> PredType -> [FunDepEqn loc]
improveFromAnother :: loc -> PredType -> PredType -> [FunDepEqn loc]
checkInstCoverage :: Bool -> Class -> [PredType] -> [Type] -> Validity
checkFunDeps :: InstEnvs -> ClsInst -> [ClsInst]
pprFundeps :: Outputable a => [FunDep a] -> SDoc
instance Outputable.Outputable (FunDeps.FunDepEqn a)
module Inst
deeplySkolemise :: TcSigmaType -> TcM (HsWrapper, [(Name, TyVar)], [EvVar], TcRhoType)
-- | Instantiate all outer type variables and any context. Never looks
-- through arrows.
topInstantiate :: CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcRhoType)
-- | Instantiate all outer Inferred binders and any context. Never
-- looks through arrows or specified type variables. Used for visible
-- type application.
topInstantiateInferred :: CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcSigmaType)
deeplyInstantiate :: CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcRhoType)
instCall :: CtOrigin -> [TcType] -> TcThetaType -> TcM HsWrapper
instDFunType :: DFunId -> [DFunInstType] -> TcM ([TcType], TcThetaType)
instStupidTheta :: CtOrigin -> TcThetaType -> TcM ()
instTyVarsWith :: CtOrigin -> [TyVar] -> [TcType] -> TcM TCvSubst
newWanted :: CtOrigin -> Maybe TypeOrKind -> PredType -> TcM CtEvidence
newWanteds :: CtOrigin -> ThetaType -> TcM [CtEvidence]
-- | This is used to instantiate binders when type-checking *types* only.
-- See also Note [Bidirectional type checking]
tcInstBinders :: [TyBinder] -> TcM (TCvSubst, [TcType])
-- | This is used to instantiate binders when type-checking *types* only.
-- The VarEnv Kind gives some known instantiations. See also
-- Note [Bidirectional type checking]
tcInstBindersX :: TCvSubst -> Maybe (VarEnv Kind) -> [TyBinder] -> TcM (TCvSubst, [TcType])
-- | Used only in *types*
tcInstBinderX :: Maybe (VarEnv Kind) -> TCvSubst -> TyBinder -> TcM (TCvSubst, TcType)
newOverloadedLit :: HsOverLit Name -> ExpRhoType -> TcM (HsOverLit TcId)
mkOverLit :: OverLitVal -> TcM HsLit
newClsInst :: Maybe OverlapMode -> Name -> [TyVar] -> ThetaType -> Class -> [Type] -> TcM ClsInst
tcGetInsts :: TcM [ClsInst]
tcGetInstEnvs :: TcM InstEnvs
getOverlapFlag :: Maybe OverlapMode -> TcM OverlapFlag
tcExtendLocalInstEnv :: [ClsInst] -> TcM a -> TcM a
instCallConstraints :: CtOrigin -> TcThetaType -> TcM HsWrapper
newMethodFromName :: CtOrigin -> Name -> TcRhoType -> TcM (HsExpr TcId)
tcSyntaxName :: CtOrigin -> TcType -> (Name, HsExpr Name) -> TcM (Name, HsExpr TcId)
-- | Returns free variables of WantedConstraints as a non-deterministic
-- set. See Note [Deterministic FV] in FV.
tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet
-- | Returns free variables of constraints as a non-deterministic set
tyCoVarsOfCt :: Ct -> TcTyCoVarSet
-- | Returns free variables of a bag of constraints as a non-deterministic
-- set. See Note [Deterministic FV] in FV.
tyCoVarsOfCts :: Cts -> TcTyCoVarSet
module TcUnify
tcWrapResult :: HsExpr Name -> HsExpr TcId -> TcSigmaType -> ExpRhoType -> TcM (HsExpr TcId)
-- | Sometimes we don't have a HsExpr Name to hand, and this is
-- more convenient.
tcWrapResultO :: CtOrigin -> HsExpr TcId -> TcSigmaType -> ExpRhoType -> TcM (HsExpr TcId)
-- | Take an "expected type" and strip off quantifiers to expose the type
-- underneath, binding the new skolems for the thing_inside. The
-- returned HsWrapper has type specific_ty ->
-- expected_ty.
tcSkolemise :: UserTypeCtxt -> TcSigmaType -> ([TcTyVar] -> TcType -> TcM result) -> TcM (HsWrapper, result)
-- | Variant of tcSkolemise that takes an ExpType
tcSkolemiseET :: UserTypeCtxt -> ExpSigmaType -> (ExpRhoType -> TcM result) -> TcM (HsWrapper, result)
-- | Call this variant when you are in a higher-rank situation and you know
-- the right-hand type is deeply skolemised.
tcSubTypeHR :: Outputable a => CtOrigin -> Maybe a -> TcSigmaType -> ExpRhoType -> TcM HsWrapper
tcSubTypeO :: CtOrigin -> UserTypeCtxt -> TcSigmaType -> ExpRhoType -> TcM HsWrapper
tcSubType_NC :: UserTypeCtxt -> TcSigmaType -> TcSigmaType -> TcM HsWrapper
tcSubTypeDS :: CtOrigin -> UserTypeCtxt -> TcSigmaType -> ExpRhoType -> TcM HsWrapper
tcSubTypeDS_NC_O :: Outputable a => CtOrigin -> UserTypeCtxt -> Maybe a -> TcSigmaType -> ExpRhoType -> TcM HsWrapper
tcSubTypeET :: CtOrigin -> UserTypeCtxt -> ExpSigmaType -> TcSigmaType -> TcM HsWrapper
checkConstraints :: SkolemInfo -> [TcTyVar] -> [EvVar] -> TcM result -> TcM (TcEvBinds, result)
buildImplicationFor :: TcLevel -> SkolemInfo -> [TcTyVar] -> [EvVar] -> WantedConstraints -> TcM (Bag Implication, TcEvBinds)
unifyType :: Outputable a => Maybe a -> TcTauType -> TcTauType -> TcM TcCoercionN
unifyTheta :: TcThetaType -> TcThetaType -> TcM [TcCoercionN]
unifyKind :: Outputable a => Maybe a -> TcKind -> TcKind -> TcM CoercionN
-- | Use this instead of Nothing when calling unifyType
-- without a good "thing" (where the "thing" has the "actual" type passed
-- in) This has an Outputable instance, avoiding amgiguity
-- problems.
noThing :: Maybe (HsExpr Name)
uType :: CtOrigin -> TypeOrKind -> TcType -> TcType -> TcM Coercion
promoteTcType :: TcLevel -> TcType -> TcM (TcCoercion, TcType)
swapOverTyVars :: TcTyVar -> TcTyVar -> Bool
canSolveByUnification :: TcLevel -> TcTyVar -> TcType -> Bool
tcInferInst :: (ExpRhoType -> TcM a) -> TcM (a, TcRhoType)
-- | Infer a type using a fresh ExpType See also Note [ExpType] in TcMType
-- Does not attempt to instantiate the inferred type
tcInferNoInst :: (ExpSigmaType -> TcM a) -> TcM (a, TcSigmaType)
matchExpectedListTy :: TcRhoType -> TcM (TcCoercionN, TcRhoType)
matchExpectedPArrTy :: TcRhoType -> TcM (TcCoercionN, TcRhoType)
matchExpectedTyConApp :: TyCon -> TcRhoType -> TcM (TcCoercionN, [TcSigmaType])
matchExpectedAppTy :: TcRhoType -> TcM (TcCoercion, (TcSigmaType, TcSigmaType))
matchExpectedFunTys :: forall a. SDoc -> Arity -> ExpRhoType -> ([ExpSigmaType] -> ExpRhoType -> TcM a) -> TcM (a, HsWrapper)
matchActualFunTys :: Outputable a => SDoc -> CtOrigin -> Maybe a -> Arity -> TcSigmaType -> TcM (HsWrapper, [TcSigmaType], TcSigmaType)
-- | Variant of matchActualFunTys that works when supplied only part
-- (that is, to the right of some arrows) of the full function type
matchActualFunTysPart :: Outputable a => SDoc -> CtOrigin -> Maybe a -> Arity -> TcSigmaType -> [TcSigmaType] -> Arity -> TcM (HsWrapper, [TcSigmaType], TcSigmaType)
-- | Breaks apart a function kind into its pieces.
matchExpectedFunKind :: Arity -> TcType -> TcKind -> TcM (Coercion, TcKind, TcKind)
wrapFunResCoercion :: [TcType] -> HsWrapper -> TcM HsWrapper
occCheckExpand :: TcTyVar -> TcType -> Maybe TcType
metaTyVarUpdateOK :: DynFlags -> TcTyVar -> TcType -> Maybe TcType
occCheckForErrors :: DynFlags -> TcTyVar -> Type -> OccCheckResult ()
data OccCheckResult a
OC_OK :: a -> OccCheckResult a
OC_Bad :: OccCheckResult a
OC_Occurs :: OccCheckResult a
instance GHC.Base.Functor TcUnify.OccCheckResult
instance GHC.Base.Applicative TcUnify.OccCheckResult
instance GHC.Base.Monad TcUnify.OccCheckResult
module RtClosureInspect
cvObtainTerm :: HscEnv -> Int -> Bool -> RttiType -> HValue -> IO Term
cvReconstructType :: HscEnv -> Int -> GhciType -> HValue -> IO (Maybe Type)
improveRTTIType :: HscEnv -> RttiType -> RttiType -> Maybe TCvSubst
data Term
Term :: RttiType -> Either String DataCon -> HValue -> [Term] -> Term
[ty] :: Term -> RttiType
[dc] :: Term -> Either String DataCon
[val] :: Term -> HValue
[subTerms] :: Term -> [Term]
Prim :: RttiType -> [Word] -> Term
[ty] :: Term -> RttiType
[value] :: Term -> [Word]
Suspension :: ClosureType -> RttiType -> HValue -> Maybe Name -> Term
[ctype] :: Term -> ClosureType
[ty] :: Term -> RttiType
[val] :: Term -> HValue
[bound_to] :: Term -> Maybe Name
NewtypeWrap :: RttiType -> Either String DataCon -> Term -> Term
[ty] :: Term -> RttiType
[dc] :: Term -> Either String DataCon
[wrapped_term] :: Term -> Term
RefWrap :: RttiType -> Term -> Term
[ty] :: Term -> RttiType
[wrapped_term] :: Term -> Term
isTerm :: Term -> Bool
isSuspension :: Term -> Bool
isPrim :: Term -> Bool
isFun :: Term -> Bool
isFunLike :: Term -> Bool
isNewtypeWrap :: Term -> Bool
isFullyEvaluated :: DynFlags -> a -> IO Bool
isFullyEvaluatedTerm :: Term -> Bool
termType :: Term -> RttiType
mapTermType :: (RttiType -> Type) -> Term -> Term
termTyCoVars :: Term -> TyCoVarSet
foldTerm :: TermFold a -> Term -> a
data TermFold a
TermFold :: TermProcessor a a -> (RttiType -> [Word] -> a) -> (ClosureType -> RttiType -> HValue -> Maybe Name -> a) -> (RttiType -> Either String DataCon -> a -> a) -> (RttiType -> a -> a) -> TermFold a
[fTerm] :: TermFold a -> TermProcessor a a
[fPrim] :: TermFold a -> RttiType -> [Word] -> a
[fSuspension] :: TermFold a -> ClosureType -> RttiType -> HValue -> Maybe Name -> a
[fNewtypeWrap] :: TermFold a -> RttiType -> Either String DataCon -> a -> a
[fRefWrap] :: TermFold a -> RttiType -> a -> a
foldTermM :: Monad m => TermFoldM m a -> Term -> m a
data TermFoldM m a
TermFoldM :: TermProcessor a (m a) -> (RttiType -> [Word] -> m a) -> (ClosureType -> RttiType -> HValue -> Maybe Name -> m a) -> (RttiType -> Either String DataCon -> a -> m a) -> (RttiType -> a -> m a) -> TermFoldM m a
[fTermM] :: TermFoldM m a -> TermProcessor a (m a)
[fPrimM] :: TermFoldM m a -> RttiType -> [Word] -> m a
[fSuspensionM] :: TermFoldM m a -> ClosureType -> RttiType -> HValue -> Maybe Name -> m a
[fNewtypeWrapM] :: TermFoldM m a -> RttiType -> Either String DataCon -> a -> m a
[fRefWrapM] :: TermFoldM m a -> RttiType -> a -> m a
idTermFold :: TermFold Term
pprTerm :: TermPrinter -> TermPrinter
-- | Takes a list of custom printers with a explicit recursion knot and a
-- term, and returns the output of the first successful printer, or the
-- default printer
cPprTerm :: Monad m => CustomTermPrinter m -> Term -> m SDoc
cPprTermBase :: forall m. Monad m => CustomTermPrinter m
type CustomTermPrinter m = TermPrinterM m -> [Precedence -> Term -> (m (Maybe SDoc))]
data Closure
Closure :: ClosureType -> Ptr () -> StgInfoTable -> Array Int HValue -> [Word] -> Closure
[tipe] :: Closure -> ClosureType
[infoPtr] :: Closure -> Ptr ()
[infoTable] :: Closure -> StgInfoTable
[ptrs] :: Closure -> Array Int HValue
[nonPtrs] :: Closure -> [Word]
getClosureData :: DynFlags -> a -> IO Closure
data ClosureType
Constr :: ClosureType
Fun :: ClosureType
Thunk :: Int -> ClosureType
ThunkSelector :: ClosureType
Blackhole :: ClosureType
AP :: ClosureType
PAP :: ClosureType
Indirection :: Int -> ClosureType
MutVar :: Int -> ClosureType
MVar :: Int -> ClosureType
Other :: Int -> ClosureType
isConstr :: ClosureType -> Bool
isIndirection :: ClosureType -> Bool
instance GHC.Classes.Eq RtClosureInspect.ClosureType
instance GHC.Show.Show RtClosureInspect.ClosureType
instance Outputable.Outputable RtClosureInspect.Term
instance Outputable.Outputable RtClosureInspect.ClosureType
module TcErrors
-- | Report unsolved goals as errors or warnings. We may also turn some
-- into deferred run-time errors if `-fdefer-type-errors` is on.
reportUnsolved :: WantedConstraints -> TcM (Bag EvBind)
-- | Report *all* unsolved goals as errors, even if -fdefer-type-errors is
-- on However, do not make any evidence bindings, because we don't have
-- any convenient place to put them. See Note [Deferring coercion errors
-- to runtime] Used by solveEqualities for kind equalities (see Note
-- [Fail fast on kind errors] in TcSimplify] and for simplifyDefault.
reportAllUnsolved :: WantedConstraints -> TcM ()
-- | Report all unsolved goals as warnings (but without deferring any
-- errors to run-time). See Note [Safe Haskell Overlapping Instances
-- Implementation] in TcSimplify
warnAllUnsolved :: WantedConstraints -> TcM ()
warnDefaulting :: [Ct] -> Type -> TcM ()
solverDepthErrorTcS :: CtLoc -> TcType -> TcM a
instance Outputable.Outputable TcErrors.ReportErrCtxt
instance Outputable.Outputable TcErrors.HoleChoice
instance Outputable.Outputable TcErrors.TypeErrorChoice
instance Outputable.Outputable TcErrors.Report
instance Data.Semigroup.Semigroup TcErrors.Report
instance GHC.Base.Monoid TcErrors.Report
module TcSMonad
data WorkList
WL :: [Ct] -> [Ct] -> [Ct] -> [CtEvidence] -> Bag Implication -> WorkList
[wl_eqs] :: WorkList -> [Ct]
[wl_funeqs] :: WorkList -> [Ct]
[wl_rest] :: WorkList -> [Ct]
[wl_deriv] :: WorkList -> [CtEvidence]
[wl_implics] :: WorkList -> Bag Implication
isEmptyWorkList :: WorkList -> Bool
emptyWorkList :: WorkList
extendWorkListNonEq :: Ct -> WorkList -> WorkList
extendWorkListCt :: Ct -> WorkList -> WorkList
extendWorkListDerived :: CtLoc -> CtEvidence -> WorkList -> WorkList
extendWorkListCts :: [Ct] -> WorkList -> WorkList
extendWorkListEq :: Ct -> WorkList -> WorkList
extendWorkListFunEq :: Ct -> WorkList -> WorkList
appendWorkList :: WorkList -> WorkList -> WorkList
extendWorkListImplic :: Bag Implication -> WorkList -> WorkList
selectNextWorkItem :: TcS (Maybe Ct)
workListSize :: WorkList -> Int
workListWantedCount :: WorkList -> Int
getWorkList :: TcS WorkList
updWorkListTcS :: (WorkList -> WorkList) -> TcS ()
data TcS a
runTcS :: TcS a -> TcM (a, EvBindMap)
-- | This variant of runTcS will keep solving, even when only
-- Deriveds are left around. It also doesn't return any evidence, as
-- callers won't need it.
runTcSDeriveds :: TcS a -> TcM a
runTcSWithEvBinds :: EvBindsVar -> TcS a -> TcM a
failTcS :: SDoc -> TcS a
warnTcS :: WarningFlag -> SDoc -> TcS ()
addErrTcS :: SDoc -> TcS ()
-- | This can deal only with equality constraints.
runTcSEqualities :: TcS a -> TcM a
nestTcS :: TcS a -> TcS a
nestImplicTcS :: EvBindsVar -> TcLevel -> TcS a -> TcS a
setEvBindsTcS :: EvBindsVar -> TcS a -> TcS a
buildImplication :: SkolemInfo -> [TcTyVar] -> [EvVar] -> TcS result -> TcS (Bag Implication, TcEvBinds, result)
runTcPluginTcS :: TcPluginM a -> TcS a
addUsedGRE :: Bool -> GlobalRdrElt -> TcS ()
addUsedGREs :: [GlobalRdrElt] -> TcS ()
panicTcS :: SDoc -> TcS a
traceTcS :: String -> SDoc -> TcS ()
traceFireTcS :: CtEvidence -> SDoc -> TcS ()
bumpStepCountTcS :: TcS ()
csTraceTcS :: SDoc -> TcS ()
wrapErrTcS :: TcM a -> TcS a
wrapWarnTcS :: TcM a -> TcS a
data MaybeNew
Fresh :: CtEvidence -> MaybeNew
Cached :: EvTerm -> MaybeNew
freshGoals :: [MaybeNew] -> [CtEvidence]
isFresh :: MaybeNew -> Bool
getEvTerm :: MaybeNew -> EvTerm
newTcEvBinds :: TcS EvBindsVar
-- | Make a new equality CtEvidence
newWantedEq :: CtLoc -> Role -> TcType -> TcType -> TcS (CtEvidence, Coercion)
-- | Emit a new Wanted equality into the work-list
emitNewWantedEq :: CtLoc -> Role -> TcType -> TcType -> TcS Coercion
newWanted :: CtLoc -> PredType -> TcS MaybeNew
newWantedEvVar :: CtLoc -> TcPredType -> TcS MaybeNew
newWantedNC :: CtLoc -> PredType -> TcS CtEvidence
newWantedEvVarNC :: CtLoc -> TcPredType -> TcS CtEvidence
newDerivedNC :: CtLoc -> TcPredType -> TcS CtEvidence
-- | Make a new Id of the given type, bound (in the monad's EvBinds)
-- to the given term
newBoundEvVarId :: TcPredType -> EvTerm -> TcS EvVar
unifyTyVar :: TcTyVar -> TcType -> TcS ()
unflattenFmv :: TcTyVar -> TcType -> TcS ()
reportUnifications :: TcS a -> TcS (Int, a)
setEvBind :: EvBind -> TcS ()
-- | Equalities only
setWantedEq :: TcEvDest -> Coercion -> TcS ()
-- | Equalities only
setEqIfWanted :: CtEvidence -> Coercion -> TcS ()
-- | Good for equalities and non-equalities
setWantedEvTerm :: TcEvDest -> EvTerm -> TcS ()
setWantedEvBind :: EvVar -> EvTerm -> TcS ()
setEvBindIfWanted :: CtEvidence -> EvTerm -> TcS ()
newEvVar :: TcPredType -> TcS EvVar
newGivenEvVar :: CtLoc -> (TcPredType, EvTerm) -> TcS CtEvidence
newGivenEvVars :: CtLoc -> [(TcPredType, EvTerm)] -> TcS [CtEvidence]
emitNewDerived :: CtLoc -> TcPredType -> TcS ()
emitNewDeriveds :: CtLoc -> [TcPredType] -> TcS ()
emitNewDerivedEq :: CtLoc -> Role -> TcType -> TcType -> TcS ()
-- | Checks if the depth of the given location is too much. Fails if it's
-- too big, with an appropriate error message.
checkReductionDepth :: CtLoc -> TcType -> TcS ()
getInstEnvs :: TcS InstEnvs
getFamInstEnvs :: TcS (FamInstEnv, FamInstEnv)
getTopEnv :: TcS HscEnv
getGblEnv :: TcS TcGblEnv
getLclEnv :: TcS TcLclEnv
getTcEvBindsVar :: TcS EvBindsVar
getTcLevel :: TcS TcLevel
getTcEvBindsAndTCVs :: EvBindsVar -> TcS (EvBindMap, TyCoVarSet)
getTcEvBindsMap :: TcS EvBindMap
tcLookupClass :: Name -> TcS Class
tcLookupId :: Name -> TcS Id
data InertSet
IS :: InertCans -> ExactFunEqMap (TcCoercion, TcType, CtFlavour) -> DictMap CtEvidence -> InertSet
[inert_cans] :: InertSet -> InertCans
[inert_flat_cache] :: InertSet -> ExactFunEqMap (TcCoercion, TcType, CtFlavour)
[inert_solved_dicts] :: InertSet -> DictMap CtEvidence
data InertCans
IC :: InertEqs -> FunEqMap Ct -> DictMap Ct -> DictMap Ct -> Cts -> Cts -> Int -> InertCans
[inert_eqs] :: InertCans -> InertEqs
[inert_funeqs] :: InertCans -> FunEqMap Ct
[inert_dicts] :: InertCans -> DictMap Ct
-- | See Note [Safe Haskell Overlapping Instances Implementation] in
-- TcSimplify
[inert_safehask] :: InertCans -> DictMap Ct
[inert_irreds] :: InertCans -> Cts
[inert_insols] :: InertCans -> Cts
[inert_count] :: InertCans -> Int
updInertTcS :: (InertSet -> InertSet) -> TcS ()
updInertCans :: (InertCans -> InertCans) -> TcS ()
updInertDicts :: (DictMap Ct -> DictMap Ct) -> TcS ()
updInertIrreds :: (Cts -> Cts) -> TcS ()
getNoGivenEqs :: TcLevel -> [TcTyVar] -> TcS (Bool, Cts)
setInertCans :: InertCans -> TcS ()
getInertEqs :: TcS (DTyVarEnv EqualCtList)
getInertCans :: TcS InertCans
getInertGivens :: TcS [Ct]
getInertInsols :: TcS Cts
emptyInert :: InertSet
getTcSInerts :: TcS InertSet
setTcSInerts :: InertSet -> TcS ()
-- | Returns Given constraints that might, potentially, match the given
-- pred. This is used when checking to see if a Given might overlap with
-- an instance. See Note [Instance and Given overlap] in TcInteract.
matchableGivens :: CtLoc -> PredType -> InertSet -> Cts
prohibitedSuperClassSolve :: CtLoc -> CtLoc -> Bool
getUnsolvedInerts :: TcS (Bag Implication, Cts, Cts, Cts, Cts)
-- | Remove inert constraints from the InertCans, for use when a
-- typechecker plugin wishes to discard a given.
removeInertCts :: [Ct] -> InertCans -> InertCans
getPendingScDicts :: TcS [Ct]
addInertCan :: Ct -> TcS ()
addInertEq :: Ct -> TcS ()
insertFunEq :: FunEqMap a -> TyCon -> [Type] -> a -> FunEqMap a
emitInsoluble :: Ct -> TcS ()
emitWorkNC :: [CtEvidence] -> TcS ()
emitWork :: [Ct] -> TcS ()
isImprovable :: CtEvidence -> Bool
kickOutAfterUnification :: TcTyVar -> TcS Int
addInertSafehask :: InertCans -> Ct -> InertCans
insertSafeOverlapFailureTcS :: Ct -> TcS ()
updInertSafehask :: (DictMap Ct -> DictMap Ct) -> TcS ()
getSafeOverlapFailures :: TcS Cts
type DictMap a = TcAppMap a
emptyDictMap :: DictMap a
-- | Look up a dictionary inert. NB: the returned CtEvidence might
-- not match the input exactly. Note [Use loose types in inert set].
lookupInertDict :: InertCans -> Class -> [Type] -> Maybe CtEvidence
findDictsByClass :: DictMap a -> Class -> Bag a
addDict :: DictMap a -> Class -> [Type] -> a -> DictMap a
addDictsByClass :: DictMap Ct -> Class -> Bag Ct -> DictMap Ct
delDict :: DictMap a -> Class -> [Type] -> DictMap a
foldDicts :: (a -> b -> b) -> DictMap a -> b -> b
filterDicts :: (Ct -> Bool) -> DictMap Ct -> DictMap Ct
findDict :: DictMap a -> Class -> [Type] -> Maybe a
type EqualCtList = [Ct]
findTyEqs :: InertCans -> TyVar -> EqualCtList
foldTyEqs :: (Ct -> b -> b) -> InertEqs -> b -> b
isInInertEqs :: DTyVarEnv EqualCtList -> TcTyVar -> TcType -> Bool
lookupFlattenTyVar :: InertEqs -> TcTyVar -> TcType
lookupInertTyVar :: InertEqs -> TcTyVar -> Maybe TcType
addSolvedDict :: CtEvidence -> Class -> [Type] -> TcS ()
-- | Look up a solved inert. NB: the returned CtEvidence might not
-- match the input exactly. See Note [Use loose types in inert set].
lookupSolvedDict :: InertSet -> Class -> [Type] -> Maybe CtEvidence
foldIrreds :: (Ct -> b -> b) -> Cts -> b -> b
lookupFlatCache :: TyCon -> [Type] -> TcS (Maybe (TcCoercion, TcType, CtFlavour))
extendFlatCache :: TyCon -> [Type] -> (TcCoercion, TcType, CtFlavour) -> TcS ()
newFlattenSkolem :: CtFlavour -> CtLoc -> TyCon -> [TcType] -> TcS (CtEvidence, Coercion, TcTyVar)
updInertFunEqs :: (FunEqMap Ct -> FunEqMap Ct) -> TcS ()
findFunEq :: FunEqMap a -> TyCon -> [Type] -> Maybe a
findFunEqsByTyCon :: FunEqMap a -> TyCon -> [a]
instDFunType :: DFunId -> [DFunInstType] -> TcS ([TcType], TcThetaType)
newFlexiTcSTy :: Kind -> TcS TcType
instFlexi :: [TKVar] -> TcS TCvSubst
instFlexiX :: TCvSubst -> [TKVar] -> TcS TCvSubst
cloneMetaTyVar :: TcTyVar -> TcS TcTyVar
demoteUnfilledFmv :: TcTyVar -> TcS ()
tcInstType :: ([TyVar] -> TcM (TCvSubst, [TcTyVar])) -> Id -> TcS ([(Name, TcTyVar)], TcThetaType, TcType)
tcInstSkolTyVarsX :: TCvSubst -> [TyVar] -> TcS (TCvSubst, [TcTyVar])
data TcLevel
isTouchableMetaTyVarTcS :: TcTyVar -> TcS Bool
isFilledMetaTyVar_maybe :: TcTyVar -> TcS (Maybe Type)
isFilledMetaTyVar :: TcTyVar -> TcS Bool
zonkTyCoVarsAndFV :: TcTyCoVarSet -> TcS TcTyCoVarSet
zonkTcType :: TcType -> TcS TcType
zonkTcTypes :: [TcType] -> TcS [TcType]
zonkTcTyVar :: TcTyVar -> TcS TcType
zonkCo :: Coercion -> TcS Coercion
zonkTyCoVarsAndFVList :: [TcTyCoVar] -> TcS [TcTyCoVar]
zonkSimples :: Cts -> TcS Cts
zonkWC :: WantedConstraints -> TcS WantedConstraints
newTcRef :: a -> TcS (TcRef a)
readTcRef :: TcRef a -> TcS a
updTcRef :: TcRef a -> (a -> a) -> TcS ()
getDefaultInfo :: TcS ([Type], (Bool, Bool))
getDynFlags :: HasDynFlags m => m DynFlags
getGlobalRdrEnvTcS :: TcS GlobalRdrEnv
matchFam :: TyCon -> [Type] -> TcS (Maybe (Coercion, TcType))
matchFamTcM :: TyCon -> [Type] -> TcM (Maybe (Coercion, TcType))
checkWellStagedDFun :: PredType -> DFunId -> CtLoc -> TcS ()
pprEq :: TcType -> TcType -> SDoc
instance GHC.Base.Functor TcSMonad.TcS
instance GHC.Base.Applicative TcSMonad.TcS
instance GHC.Base.Monad TcSMonad.TcS
instance Control.Monad.Fail.MonadFail TcSMonad.TcS
instance UniqSupply.MonadUnique TcSMonad.TcS
instance DynFlags.HasDynFlags TcSMonad.TcS
instance Outputable.Outputable TcSMonad.InertSet
instance Outputable.Outputable TcSMonad.InertCans
instance Outputable.Outputable TcSMonad.WorkList
module TcFlatten
data FlattenMode
FM_FlattenAll :: FlattenMode
FM_SubstOnly :: FlattenMode
flatten :: FlattenMode -> CtEvidence -> TcType -> TcS (Xi, TcCoercion)
flattenManyNom :: CtEvidence -> [TcType] -> TcS ([Xi], [TcCoercion])
unflatten :: Cts -> Cts -> TcS Cts
instance GHC.Base.Monad TcFlatten.FlatM
instance GHC.Base.Functor TcFlatten.FlatM
instance GHC.Base.Applicative TcFlatten.FlatM
instance Outputable.Outputable TcFlatten.FlattenMode
module TcCanonical
canonicalize :: Ct -> TcS (StopOrContinue Ct)
unifyDerived :: CtLoc -> Role -> Pair TcType -> TcS ()
makeSuperClasses :: [Ct] -> TcS [Ct]
maybeSym :: SwapFlag -> TcCoercion -> TcCoercion
data StopOrContinue a
ContinueWith :: a -> StopOrContinue a
Stop :: CtEvidence -> SDoc -> StopOrContinue a
stopWith :: CtEvidence -> String -> TcS (StopOrContinue a)
continueWith :: a -> TcS (StopOrContinue a)
instance GHC.Base.Functor TcCanonical.StopOrContinue
instance Outputable.Outputable a => Outputable.Outputable (TcCanonical.StopOrContinue a)
module TcInteract
solveSimpleGivens :: [Ct] -> TcS ()
solveSimpleWanteds :: Cts -> TcS WantedConstraints
solveCallStack :: CtEvidence -> EvCallStack -> TcS ()
instance Outputable.Outputable TcInteract.LookupInstResult
instance Outputable.Outputable TcInteract.InteractResult
module TcSimplify
simplifyInfer :: TcLevel -> InferMode -> [TcIdSigInst] -> [(Name, TcTauType)] -> WantedConstraints -> TcM ([TcTyVar], [EvVar], TcEvBinds, Bool)
-- | How should we choose which constraints to quantify over?
data InferMode
-- | Apply the monomorphism restriction, never quantifying over any
-- constraints
ApplyMR :: InferMode
-- | See Note [TcRnExprMode] in TcRnDriver, the :type +d case; this mode
-- refuses to quantify over any defaultable constraint
EagerDefaulting :: InferMode
-- | Quantify over any constraint that satisfies
-- TcType.pickQuantifiablePreds
NoRestrictions :: InferMode
growThetaTyVars :: ThetaType -> TyCoVarSet -> TyVarSet
simplifyAmbiguityCheck :: Type -> WantedConstraints -> TcM ()
simplifyDefault :: ThetaType -> TcM ()
simplifyTop :: WantedConstraints -> TcM (Bag EvBind)
simplifyTopImplic :: Bag Implication -> TcM ()
captureTopConstraints :: TcM a -> TcM (a, WantedConstraints)
simplifyInteractive :: WantedConstraints -> TcM (Bag EvBind)
-- | Type-check a thing that emits only equality constraints, then solve
-- those constraints. Fails outright if there is trouble.
solveEqualities :: TcM a -> TcM a
simplifyWantedsTcM :: [CtEvidence] -> TcM WantedConstraints
tcCheckSatisfiability :: Bag EvVar -> TcM Bool
solveWanteds :: WantedConstraints -> TcS WantedConstraints
solveWantedsAndDrop :: WantedConstraints -> TcS WantedConstraints
approximateWC :: Bool -> WantedConstraints -> Cts
-- | This variant of runTcS will keep solving, even when only
-- Deriveds are left around. It also doesn't return any evidence, as
-- callers won't need it.
runTcSDeriveds :: TcS a -> TcM a
instance Outputable.Outputable TcSimplify.InferMode
module TcValidity
data Rank
data UserTypeCtxt
FunSigCtxt :: Name -> Bool -> UserTypeCtxt
InfSigCtxt :: Name -> UserTypeCtxt
ExprSigCtxt :: UserTypeCtxt
TypeAppCtxt :: UserTypeCtxt
ConArgCtxt :: Name -> UserTypeCtxt
TySynCtxt :: Name -> UserTypeCtxt
PatSynCtxt :: Name -> UserTypeCtxt
PatSigCtxt :: UserTypeCtxt
RuleSigCtxt :: Name -> UserTypeCtxt
ResSigCtxt :: UserTypeCtxt
ForSigCtxt :: Name -> UserTypeCtxt
DefaultDeclCtxt :: UserTypeCtxt
InstDeclCtxt :: UserTypeCtxt
SpecInstCtxt :: UserTypeCtxt
ThBrackCtxt :: UserTypeCtxt
GenSigCtxt :: UserTypeCtxt
GhciCtxt :: UserTypeCtxt
ClassSCCtxt :: Name -> UserTypeCtxt
SigmaCtxt :: UserTypeCtxt
DataTyCtxt :: Name -> UserTypeCtxt
checkValidType :: UserTypeCtxt -> Type -> TcM ()
checkValidMonoType :: Type -> TcM ()
-- | The kind expected in a certain context.
data ContextKind
-- | a specific kind
TheKind :: Kind -> ContextKind
-- | any kind will do
AnythingKind :: ContextKind
-- | something of the form TYPE _
OpenKind :: ContextKind
expectedKindInCtxt :: UserTypeCtxt -> ContextKind
checkValidTheta :: UserTypeCtxt -> ThetaType -> TcM ()
checkValidFamPats :: Maybe ClsInstInfo -> TyCon -> [TyVar] -> [CoVar] -> [Type] -> TcM ()
checkValidInstance :: UserTypeCtxt -> LHsSigType Name -> Type -> TcM ([TyVar], ThetaType, Class, [Type])
validDerivPred :: TyVarSet -> PredType -> Bool
checkInstTermination :: [TcType] -> ThetaType -> TcM ()
checkTySynRhs :: UserTypeCtxt -> TcType -> TcM ()
-- | Extra information about the parent instance declaration, needed when
-- type-checking associated types. The Class is the enclosing
-- class, the [TyVar] are the type variable of the instance decl, and and
-- the VarEnv Type maps class variables to their instance types.
type ClsInstInfo = (Class, [TyVar], VarEnv Type)
checkValidCoAxiom :: CoAxiom Branched -> TcM ()
checkValidCoAxBranch :: Maybe ClsInstInfo -> TyCon -> CoAxBranch -> TcM ()
-- | Do validity checks on a type family equation, including consistency
-- with any enclosing class instance head, termination, and lack of
-- polytypes.
checkValidTyFamEqn :: Maybe ClsInstInfo -> TyCon -> [TyVar] -> [CoVar] -> [Type] -> Type -> SrcSpan -> TcM ()
arityErr :: Outputable a => String -> a -> Int -> Int -> SDoc
badATErr :: Name -> Name -> SDoc
-- | Check a list of binders to see if they make a valid telescope. The key
-- property we're checking for is scoping. For example: > data
-- SameKind :: k -> k -> * > data X a k (b :: k) (c :: SameKind
-- a b) Kind inference says that a's kind should be k. But that's
-- impossible, because k isn't in scope when a is bound. This check has
-- to come before general validity checking, because once we
-- kind-generalise, this sort of problem is harder to spot (as we'll
-- generalise over the unbound k in a's type.) See also Note [Bad
-- telescopes].
checkValidTelescope :: SDoc -> [TyVar] -> SDoc -> TcM ()
-- | Like checkZonkValidTelescope, but returns the zonked tyvars
checkZonkValidTelescope :: SDoc -> [TyVar] -> SDoc -> TcM [TyVar]
-- | After inferring kinds of type variables, check to make sure that the
-- inferred kinds any of the type variables bound in a smaller scope.
-- This is a skolem escape check. See also Note [Bad telescopes].
checkValidInferredKinds :: [TyVar] -> TyVarSet -> SDoc -> TcM ()
allDistinctTyVars :: TyVarSet -> [KindOrType] -> Bool
module TcGenDeriv
type BagDerivStuff = Bag DerivStuff
data DerivStuff
DerivAuxBind :: AuxBindSpec -> DerivStuff
DerivFamInst :: FamInst -> DerivStuff
DerivHsBind :: (LHsBind RdrName, LSig RdrName) -> DerivStuff
gen_Eq_binds :: SrcSpan -> TyCon -> TcM (LHsBinds RdrName, BagDerivStuff)
gen_Ord_binds :: SrcSpan -> TyCon -> TcM (LHsBinds RdrName, BagDerivStuff)
gen_Enum_binds :: SrcSpan -> TyCon -> TcM (LHsBinds RdrName, BagDerivStuff)
gen_Bounded_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Ix_binds :: SrcSpan -> TyCon -> TcM (LHsBinds RdrName, BagDerivStuff)
gen_Show_binds :: (Name -> Fixity) -> SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Read_binds :: (Name -> Fixity) -> SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Data_binds :: SrcSpan -> TyCon -> TcM (LHsBinds RdrName, BagDerivStuff)
gen_Lift_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Newtype_binds :: SrcSpan -> Class -> [TyVar] -> [Type] -> Type -> TcM (LHsBinds RdrName, BagDerivStuff)
mkCoerceClassMethEqn :: Class -> [TyVar] -> [Type] -> Type -> Id -> Pair Type
genAuxBinds :: DynFlags -> SrcSpan -> BagDerivStuff -> SeparateBagsDerivStuff
ordOpTbl :: [(Type, (RdrName, RdrName, RdrName, RdrName, RdrName))]
boxConTbl :: [(Type, RdrName)]
litConTbl :: [(Type, LHsExpr RdrName -> LHsExpr RdrName)]
mkRdrFunBind :: Located RdrName -> [LMatch RdrName (LHsExpr RdrName)] -> LHsBind RdrName
error_Expr :: String -> LHsExpr RdrName
instance GHC.Classes.Eq TcGenDeriv.AuxBindSpec
module TcGenFunctor
data FFoldType a
FT :: a -> a -> a -> (a -> a -> a) -> (TyCon -> [a] -> a) -> (Type -> a -> a) -> a -> (TcTyVar -> a -> a) -> FFoldType a
-- | Does not contain variable
[ft_triv] :: FFoldType a -> a
-- | The variable itself
[ft_var] :: FFoldType a -> a
-- | The variable itself, contravariantly
[ft_co_var] :: FFoldType a -> a
-- | Function type
[ft_fun] :: FFoldType a -> a -> a -> a
-- | Tuple type
[ft_tup] :: FFoldType a -> TyCon -> [a] -> a
-- | Type app, variable only in last argument
[ft_ty_app] :: FFoldType a -> Type -> a -> a
-- | Type app, variable other than in last argument
[ft_bad_app] :: FFoldType a -> a
-- | Forall type
[ft_forall] :: FFoldType a -> TcTyVar -> a -> a
functorLikeTraverse :: forall a. TyVar -> FFoldType a -> Type -> a
deepSubtypesContaining :: TyVar -> Type -> [TcType]
foldDataConArgs :: FFoldType a -> DataCon -> [a]
gen_Functor_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Foldable_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Traversable_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
module TcGenGenerics
canDoGenerics :: TyCon -> Validity
canDoGenerics1 :: TyCon -> Validity
data GenericKind
Gen0 :: GenericKind
Gen1 :: GenericKind
gen_Generic_binds :: GenericKind -> TyCon -> [Type] -> TcM (LHsBinds RdrName, FamInst)
get_gen1_constrained_tys :: TyVar -> Type -> [Type]
module TcDerivUtils
data DerivSpec theta
DS :: SrcSpan -> Name -> [TyVar] -> theta -> Class -> [Type] -> TyCon -> Maybe OverlapMode -> DerivSpecMechanism -> DerivSpec theta
[ds_loc] :: DerivSpec theta -> SrcSpan
[ds_name] :: DerivSpec theta -> Name
[ds_tvs] :: DerivSpec theta -> [TyVar]
[ds_theta] :: DerivSpec theta -> theta
[ds_cls] :: DerivSpec theta -> Class
[ds_tys] :: DerivSpec theta -> [Type]
[ds_tc] :: DerivSpec theta -> TyCon
[ds_overlap] :: DerivSpec theta -> Maybe OverlapMode
[ds_mechanism] :: DerivSpec theta -> DerivSpecMechanism
pprDerivSpec :: Outputable theta => DerivSpec theta -> SDoc
data DerivSpecMechanism
DerivSpecStock :: (SrcSpan -> TyCon -> [Type] -> TcM (LHsBinds RdrName, BagDerivStuff)) -> DerivSpecMechanism
-- | The newtype rep type
DerivSpecNewtype :: Type -> DerivSpecMechanism
DerivSpecAnyClass :: DerivSpecMechanism
isDerivSpecStock :: DerivSpecMechanism -> Bool
isDerivSpecNewtype :: DerivSpecMechanism -> Bool
isDerivSpecAnyClass :: DerivSpecMechanism -> Bool
type DerivContext = Maybe ThetaType
data DerivStatus
CanDerive :: DerivStatus
DerivableClassError :: SDoc -> DerivStatus
DerivableViaInstance :: DerivStatus
NonDerivableClass :: SDoc -> DerivStatus
-- | A PredType annotated with the origin of the constraint
-- CtOrigin, and whether or the constraint deals in types or
-- kinds.
data PredOrigin
PredOrigin :: PredType -> CtOrigin -> TypeOrKind -> PredOrigin
-- | A list of wanted PredOrigin constraints
-- (to_wanted_origins) alongside any corresponding given
-- constraints (to_givens) and locally quantified type variables
-- (to_tvs).
--
-- In most cases, to_givens will be empty, as most deriving
-- mechanisms (e.g., stock and newtype deriving) do not require given
-- constraints. The exception is DeriveAnyClass, which can
-- involve given constraints. For example, if you tried to derive an
-- instance for the following class using DeriveAnyClass:
--
--
-- class Foo a where
-- bar :: a -> b -> String
-- default bar :: (Show a, Ix b) => a -> b -> String
-- bar = show
--
-- baz :: Eq a => a -> a -> Bool
-- default baz :: Ord a => a -> a -> Bool
-- baz x y = compare x y == EQ
--
--
-- Then it would generate two ThetaOrigins, one for each method:
--
--
-- [ ThetaOrigin { to_tvs = [b]
-- , to_givens = []
-- , to_wanted_origins = [Show a, Ix b] }
-- , ThetaOrigin { to_tvs = []
-- , to_givens = [Eq a]
-- , to_wanted_origins = [Ord a] }
-- ]
--
data ThetaOrigin
ThetaOrigin :: [TyVar] -> ThetaType -> [PredOrigin] -> ThetaOrigin
[to_tvs] :: ThetaOrigin -> [TyVar]
[to_givens] :: ThetaOrigin -> ThetaType
[to_wanted_origins] :: ThetaOrigin -> [PredOrigin]
mkPredOrigin :: CtOrigin -> TypeOrKind -> PredType -> PredOrigin
mkThetaOrigin :: CtOrigin -> TypeOrKind -> [TyVar] -> ThetaType -> ThetaType -> ThetaOrigin
mkThetaOriginFromPreds :: [PredOrigin] -> ThetaOrigin
substPredOrigin :: HasCallStack => TCvSubst -> PredOrigin -> PredOrigin
checkSideConditions :: DynFlags -> DerivContext -> Class -> [TcType] -> TyCon -> DerivStatus
hasStockDeriving :: Class -> Maybe (SrcSpan -> TyCon -> [Type] -> TcM (LHsBinds RdrName, BagDerivStuff))
canDeriveAnyClass :: DynFlags -> Validity
std_class_via_coercible :: Class -> Bool
non_coercible_class :: Class -> Bool
newDerivClsInst :: ThetaType -> DerivSpec theta -> TcM ClsInst
extendLocalInstEnv :: [ClsInst] -> TcM a -> TcM a
instance Outputable.Outputable TcDerivUtils.ThetaOrigin
instance Outputable.Outputable TcDerivUtils.PredOrigin
instance Outputable.Outputable theta => Outputable.Outputable (TcDerivUtils.DerivSpec theta)
instance Outputable.Outputable TcDerivUtils.DerivSpecMechanism
module TcDerivInfer
inferConstraints :: [TyVar] -> Class -> [TcType] -> TcType -> TyCon -> [TcType] -> DerivSpecMechanism -> TcM ([ThetaOrigin], [TyVar], [TcType])
simplifyInstanceContexts :: [DerivSpec [ThetaOrigin]] -> TcM [DerivSpec ThetaType]
-- | This module is not used by GHC itself. Rather, it exports all of the
-- functions and types you are likely to need when writing a plugin for
-- GHC. So authors of plugins can probably get away simply with saying
-- "import GhcPlugins".
--
-- Particularly interesting modules for plugin writers include
-- CoreSyn and CoreMonad.
module GhcPlugins
module CoreLint
lintCoreBindings :: DynFlags -> CoreToDo -> [Var] -> CoreProgram -> (Bag MsgDoc, Bag MsgDoc)
lintUnfolding :: DynFlags -> SrcLoc -> VarSet -> CoreExpr -> Maybe MsgDoc
lintPassResult :: HscEnv -> CoreToDo -> CoreProgram -> IO ()
lintInteractiveExpr :: String -> HscEnv -> CoreExpr -> IO ()
lintExpr :: DynFlags -> [Var] -> CoreExpr -> Maybe MsgDoc
-- | This checks whether a pass correctly looks through debug annotations
-- (SourceNote). This works a bit different from other
-- consistency checks: We check this by running the given task twice,
-- noting all differences between the results.
lintAnnots :: SDoc -> (ModGuts -> CoreM ModGuts) -> ModGuts -> CoreM ModGuts
endPass :: CoreToDo -> CoreProgram -> [CoreRule] -> CoreM ()
endPassIO :: HscEnv -> PrintUnqualified -> CoreToDo -> CoreProgram -> [CoreRule] -> IO ()
dumpPassResult :: DynFlags -> PrintUnqualified -> Maybe DumpFlag -> SDoc -> SDoc -> CoreProgram -> [CoreRule] -> IO ()
dumpIfSet :: DynFlags -> Bool -> CoreToDo -> SDoc -> SDoc -> IO ()
instance GHC.Classes.Eq CoreLint.StaticPtrCheck
instance GHC.Base.Functor CoreLint.LintM
instance GHC.Base.Applicative CoreLint.LintM
instance GHC.Base.Monad CoreLint.LintM
instance Control.Monad.Fail.MonadFail CoreLint.LintM
instance DynFlags.HasDynFlags CoreLint.LintM
module CorePrep
corePrepPgm :: HscEnv -> Module -> ModLocation -> CoreProgram -> [TyCon] -> IO CoreProgram
corePrepExpr :: DynFlags -> HscEnv -> CoreExpr -> IO CoreExpr
cvtLitInteger :: DynFlags -> Id -> Maybe DataCon -> Integer -> CoreExpr
lookupMkIntegerName :: DynFlags -> HscEnv -> IO Id
lookupIntegerSDataConName :: DynFlags -> HscEnv -> IO (Maybe DataCon)
instance Outputable.Outputable CorePrep.Floats
instance Outputable.Outputable CorePrep.OkToSpec
instance Outputable.Outputable CorePrep.FloatingBind
module TidyPgm
mkBootModDetailsTc :: HscEnv -> TcGblEnv -> IO ModDetails
tidyProgram :: HscEnv -> ModGuts -> IO (CgGuts, ModDetails)
globaliseAndTidyId :: Id -> Id
instance GHC.Base.Functor TidyPgm.DFFV
instance GHC.Base.Applicative TidyPgm.DFFV
instance GHC.Base.Monad TidyPgm.DFFV
module CallArity
callArityAnalProgram :: DynFlags -> CoreProgram -> CoreProgram
callArityRHS :: CoreExpr -> CoreExpr
-- | ByteCodeInstrs: Bytecode instruction definitions
module ByteCodeInstr
data BCInstr
STKCHECK :: Word -> BCInstr
PUSH_L :: !Word16 -> BCInstr
PUSH_LL :: !Word16 -> !Word16 -> BCInstr
PUSH_LLL :: !Word16 -> !Word16 -> !Word16 -> BCInstr
PUSH_G :: Name -> BCInstr
PUSH_PRIMOP :: PrimOp -> BCInstr
PUSH_BCO :: (ProtoBCO Name) -> BCInstr
PUSH_ALTS :: (ProtoBCO Name) -> BCInstr
PUSH_ALTS_UNLIFTED :: (ProtoBCO Name) -> ArgRep -> BCInstr
PUSH_UBX :: Literal -> Word16 -> BCInstr
PUSH_APPLY_N :: BCInstr
PUSH_APPLY_V :: BCInstr
PUSH_APPLY_F :: BCInstr
PUSH_APPLY_D :: BCInstr
PUSH_APPLY_L :: BCInstr
PUSH_APPLY_P :: BCInstr
PUSH_APPLY_PP :: BCInstr
PUSH_APPLY_PPP :: BCInstr
PUSH_APPLY_PPPP :: BCInstr
PUSH_APPLY_PPPPP :: BCInstr
PUSH_APPLY_PPPPPP :: BCInstr
SLIDE :: Word16 -> Word16 -> BCInstr
ALLOC_AP :: !Word16 -> BCInstr
ALLOC_AP_NOUPD :: !Word16 -> BCInstr
ALLOC_PAP :: !Word16 -> !Word16 -> BCInstr
MKAP :: !Word16 -> !Word16 -> BCInstr
MKPAP :: !Word16 -> !Word16 -> BCInstr
UNPACK :: !Word16 -> BCInstr
PACK :: DataCon -> !Word16 -> BCInstr
LABEL :: LocalLabel -> BCInstr
TESTLT_I :: Int -> LocalLabel -> BCInstr
TESTEQ_I :: Int -> LocalLabel -> BCInstr
TESTLT_W :: Word -> LocalLabel -> BCInstr
TESTEQ_W :: Word -> LocalLabel -> BCInstr
TESTLT_F :: Float -> LocalLabel -> BCInstr
TESTEQ_F :: Float -> LocalLabel -> BCInstr
TESTLT_D :: Double -> LocalLabel -> BCInstr
TESTEQ_D :: Double -> LocalLabel -> BCInstr
TESTLT_P :: Word16 -> LocalLabel -> BCInstr
TESTEQ_P :: Word16 -> LocalLabel -> BCInstr
CASEFAIL :: BCInstr
JMP :: LocalLabel -> BCInstr
CCALL :: Word16 -> (RemotePtr C_ffi_cif) -> Word16 -> BCInstr
SWIZZLE :: Word16 -> Word16 -> BCInstr
ENTER :: BCInstr
RETURN :: BCInstr
RETURN_UBX :: ArgRep -> BCInstr
BRK_FUN :: Word16 -> Unique -> (RemotePtr CostCentre) -> BCInstr
data ProtoBCO a
ProtoBCO :: a -> [BCInstr] -> [StgWord] -> Word16 -> Int -> Either [AnnAlt Id DVarSet] (AnnExpr Id DVarSet) -> [FFIInfo] -> ProtoBCO a
[protoBCOName] :: ProtoBCO a -> a
[protoBCOInstrs] :: ProtoBCO a -> [BCInstr]
[protoBCOBitmap] :: ProtoBCO a -> [StgWord]
[protoBCOBitmapSize] :: ProtoBCO a -> Word16
[protoBCOArity] :: ProtoBCO a -> Int
[protoBCOExpr] :: ProtoBCO a -> Either [AnnAlt Id DVarSet] (AnnExpr Id DVarSet)
[protoBCOFFIs] :: ProtoBCO a -> [FFIInfo]
bciStackUse :: BCInstr -> Word
instance Outputable.Outputable a => Outputable.Outputable (ByteCodeInstr.ProtoBCO a)
instance Outputable.Outputable ByteCodeInstr.BCInstr
-- | ByteCodeLink: Bytecode assembler and linker
module ByteCodeAsm
assembleBCOs :: HscEnv -> [ProtoBCO Name] -> [TyCon] -> [RemotePtr ()] -> Maybe ModBreaks -> IO CompiledByteCode
assembleOneBCO :: HscEnv -> ProtoBCO Name -> IO UnlinkedBCO
-- | Finds external references. Remember to remove the names defined by
-- this group of BCOs themselves
bcoFreeNames :: UnlinkedBCO -> UniqDSet Name
data SizedSeq a :: * -> *
sizeSS :: () => SizedSeq a -> Word
ssElts :: () => SizedSeq a -> [a]
iNTERP_STACK_CHECK_THRESH :: Int
instance GHC.Base.Functor ByteCodeAsm.Assembler
instance GHC.Base.Applicative ByteCodeAsm.Assembler
instance GHC.Base.Monad ByteCodeAsm.Assembler
-- | The dynamic linker for GHCi.
--
-- This module deals with the top-level issues of dynamic linking,
-- calling the object-code linker and the byte-code linker where
-- necessary.
module Linker
-- | Get the HValue associated with the given name.
--
-- May cause loading the module that contains the name.
--
-- Throws a ProgramError if loading fails or the name cannot be
-- found.
getHValue :: HscEnv -> Name -> IO ForeignHValue
-- | Display the persistent linker state.
showLinkerState :: DynFlags -> IO ()
-- | Link a single expression, including first linking packages and
-- modules that this expression depends on.
--
-- Raises an IO exception (ProgramError) if it can't find a
-- compiled version of the dependents to link.
linkExpr :: HscEnv -> SrcSpan -> UnlinkedBCO -> IO ForeignHValue
linkDecls :: HscEnv -> SrcSpan -> CompiledByteCode -> IO ()
-- | Unloading old objects ready for a new compilation sweep.
--
-- The compilation manager provides us with a list of linkables that it
-- considers "stable", i.e. won't be recompiled this time around. For
-- each of the modules current linked in memory,
--
--
-- - if the linkable is stable (and it's the same one -- the user may
-- have recompiled the module on the side), we keep it,
-- - otherwise, we unload it.
-- - we also implicitly unload all temporary bindings at this
-- point.
--
unload :: HscEnv -> [Linkable] -> IO ()
-- | Temporarily extend the linker state.
withExtendedLinkEnv :: (ExceptionMonad m) => [(Name, ForeignHValue)] -> m a -> m a
extendLinkEnv :: [(Name, ForeignHValue)] -> IO ()
deleteFromLinkEnv :: [Name] -> IO ()
extendLoadedPkgs :: [InstalledUnitId] -> IO ()
-- | Link exactly the specified packages, and their dependents (unless of
-- course they are already linked). The dependents are linked
-- automatically, and it doesn't matter what order you specify the input
-- packages.
linkPackages :: HscEnv -> [LinkerUnitId] -> IO ()
-- | Initialise the dynamic linker. This entails
--
-- a) Calling the C initialisation procedure,
--
-- b) Loading any packages specified on the command line,
--
-- c) Loading any packages specified on the command line, now held in the
-- -l options in v_Opt_l,
--
-- d) Loading any .o/.dll files specified on the command line,
-- now held in ldInputs,
--
-- e) Loading any MacOS frameworks.
--
-- NOTE: This function is idempotent; if called more than once, it does
-- nothing. This is useful in Template Haskell, where we call it before
-- trying to link.
initDynLinker :: HscEnv -> IO ()
linkModule :: HscEnv -> Module -> IO ()
linkCmdLineLibs :: HscEnv -> IO ()
-- | ByteCodeGen: Generate bytecode from Core
module ByteCodeGen
data UnlinkedBCO
byteCodeGen :: HscEnv -> Module -> CoreProgram -> [TyCon] -> Maybe ModBreaks -> IO CompiledByteCode
coreExprToBCOs :: HscEnv -> Module -> CoreExpr -> IO UnlinkedBCO
instance GHC.Classes.Ord ByteCodeGen.Discr
instance GHC.Classes.Eq ByteCodeGen.Discr
instance GHC.Base.Functor ByteCodeGen.BcM
instance GHC.Base.Applicative ByteCodeGen.BcM
instance GHC.Base.Monad ByteCodeGen.BcM
instance DynFlags.HasDynFlags ByteCodeGen.BcM
instance Outputable.Outputable ByteCodeGen.Discr
module BuildTyCl
buildDataCon :: FamInstEnvs -> Name -> Bool -> TyConRepName -> [HsSrcBang] -> Maybe [HsImplBang] -> [FieldLabel] -> [TyVarBinder] -> [TyVarBinder] -> [EqSpec] -> ThetaType -> [Type] -> Type -> TyCon -> TcRnIf m n DataCon
mkDataConUnivTyVarBinders :: [TyConBinder] -> [TyVarBinder]
buildPatSyn :: Name -> Bool -> (Id, Bool) -> Maybe (Id, Bool) -> ([TyVarBinder], ThetaType) -> ([TyVarBinder], ThetaType) -> [Type] -> Type -> [FieldLabel] -> PatSyn
type TcMethInfo = (Name, Type, Maybe (DefMethSpec (SrcSpan, Type)))
buildClass :: Name -> [TyConBinder] -> [Role] -> [FunDep TyVar] -> Maybe (ThetaType, [ClassATItem], [TcMethInfo], ClassMinimalDef) -> TcRnIf m n Class
-- | Monadic because it makes a Name for the coercion TyCon We pass the
-- Name of the parent TyCon, as well as the TyCon itself, because the
-- latter is part of a knot, whereas the former is not.
mkNewTyConRhs :: Name -> TyCon -> DataCon -> TcRnIf m n AlgTyConRhs
mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
newImplicitBinder :: Name -> (OccName -> OccName) -> TcRnIf m n Name
-- | Make the TyConRepName for this TyCon
newTyConRepName :: Name -> TcRnIf gbl lcl TyConRepName
module TcIface
tcLookupImported_maybe :: Name -> TcM (MaybeErr MsgDoc TyThing)
importDecl :: Name -> IfM lcl (MaybeErr MsgDoc TyThing)
checkWiredInTyCon :: TyCon -> TcM ()
tcHiBootIface :: HscSource -> Module -> TcRn SelfBootInfo
typecheckIface :: ModIface -> IfG ModDetails
-- | This is a very interesting function. Like typecheckIface, we want to
-- type check an interface file into a ModDetails. However, the use-case
-- for these ModDetails is different: we want to compare all of the
-- ModDetails to ensure they define compatible declarations, and then
-- merge them together. So in particular, we have to take a different
-- strategy for knot-tying: we first speculatively merge the declarations
-- to get the "base" truth for what we believe the types will be (this is
-- "type computation.") Then we read everything in relative to this truth
-- and check for compatibility.
--
-- During the merge process, we may need to nondeterministically pick a
-- particular declaration to use, if multiple signatures define the
-- declaration (mergeIfaceDecl). If, for all choices, there are no
-- type synonym cycles in the resulting merged graph, then we can show
-- that our choice cannot matter. Consider the set of entities which the
-- declarations depend on: by assumption of acyclicity, we can assume
-- that these have already been shown to be equal to each other
-- (otherwise merging will fail). Then it must be the case that all
-- candidate declarations here are type-equal (the choice doesn't matter)
-- or there is an inequality (in which case merging will fail.)
--
-- Unfortunately, the choice can matter if there is a cycle. Consider the
-- following merge:
--
-- signature H where { type A = C; type B = A; data C } signature H where
-- { type A = (); data B; type C = B }
--
-- If we pick type A = C as our representative, there will be a
-- cycle and merging will fail. But if we pick type A = () as
-- our representative, no cycle occurs, and we instead conclude that all
-- of the types are unit. So it seems that we either (a) need a stronger
-- acyclicity check which considers *all* possible choices from a merge,
-- or (b) we must find a selection of declarations which is acyclic, and
-- show that this is always the "best" choice we could have made (ezyang
-- conjectures this is the case but does not have a proof). For now this
-- is not implemented.
--
-- It's worth noting that at the moment, a data constructor and a type
-- synonym are never compatible. Consider:
--
-- signature H where { type Int=C; type B = Int; data C = Int} signature
-- H where { export Prelude.Int; data B; type C = B; }
--
-- This will be rejected, because the reexported Int in the second
-- signature (a proper data type) is never considered equal to a type
-- synonym. Perhaps this should be relaxed, where a type synonym in a
-- signature is considered implemented by a data type declaration which
-- matches the reference of the type synonym.
typecheckIfacesForMerging :: Module -> [ModIface] -> IORef TypeEnv -> IfM lcl (TypeEnv, [ModDetails])
-- | Typecheck a signature ModIface under the assumption that we
-- have instantiated it under some implementation (recorded in
-- mi_semantic_module) and want to check if the implementation
-- fills the signature.
--
-- This needs to operate slightly differently than typecheckIface
-- because (1) we have a NameShape, from the exports of the
-- implementing module, which we will use to give our top-level
-- declarations the correct Names even when the implementor
-- provided them with a reexport, and (2) we have to deal with DFun
-- silliness (see Note [rnIfaceNeverExported])
typecheckIfaceForInstantiate :: NameShape -> ModIface -> IfM lcl ModDetails
tcIfaceDecl :: Bool -> IfaceDecl -> IfL TyThing
tcIfaceInst :: IfaceClsInst -> IfL ClsInst
tcIfaceFamInst :: IfaceFamInst -> IfL FamInst
tcIfaceRules :: Bool -> [IfaceRule] -> IfL [CoreRule]
tcIfaceVectInfo :: Module -> TypeEnv -> IfaceVectInfo -> IfL VectInfo
tcIfaceAnnotations :: [IfaceAnnotation] -> IfL [Annotation]
tcIfaceCompleteSigs :: [IfaceCompleteMatch] -> IfL [CompleteMatch]
tcIfaceExpr :: IfaceExpr -> IfL CoreExpr
tcIfaceGlobal :: Name -> IfL TyThing
module TcHsType
kcHsSigType :: [Located Name] -> LHsSigType Name -> TcM ()
tcClassSigType :: [Located Name] -> LHsSigType Name -> TcM Type
tcHsSigType :: UserTypeCtxt -> LHsSigType Name -> TcM Type
tcHsSigWcType :: UserTypeCtxt -> LHsSigWcType Name -> TcM Type
tcHsPartialSigType :: UserTypeCtxt -> LHsSigWcType Name -> TcM ([(Name, TcTyVar)], Maybe TcTyVar, [TcTyVar], TcThetaType, TcType)
funsSigCtxt :: [Located Name] -> UserTypeCtxt
addSigCtxt :: UserTypeCtxt -> LHsType Name -> TcM a -> TcM a
pprSigCtxt :: UserTypeCtxt -> LHsType Name -> SDoc
tcHsClsInstType :: UserTypeCtxt -> LHsSigType Name -> TcM ([TyVar], ThetaType, Class, [Type])
tcHsDeriv :: LHsSigType Name -> TcM ([TyVar], Class, [Type], [Kind])
tcHsVectInst :: LHsSigType Name -> TcM (Class, [Type])
-- | Type-check a visible type application
tcHsTypeApp :: LHsWcType Name -> Kind -> TcM Type
data UserTypeCtxt
FunSigCtxt :: Name -> Bool -> UserTypeCtxt
InfSigCtxt :: Name -> UserTypeCtxt
ExprSigCtxt :: UserTypeCtxt
TypeAppCtxt :: UserTypeCtxt
ConArgCtxt :: Name -> UserTypeCtxt
TySynCtxt :: Name -> UserTypeCtxt
PatSynCtxt :: Name -> UserTypeCtxt
PatSigCtxt :: UserTypeCtxt
RuleSigCtxt :: Name -> UserTypeCtxt
ResSigCtxt :: UserTypeCtxt
ForSigCtxt :: Name -> UserTypeCtxt
DefaultDeclCtxt :: UserTypeCtxt
InstDeclCtxt :: UserTypeCtxt
SpecInstCtxt :: UserTypeCtxt
ThBrackCtxt :: UserTypeCtxt
GenSigCtxt :: UserTypeCtxt
GhciCtxt :: UserTypeCtxt
ClassSCCtxt :: Name -> UserTypeCtxt
SigmaCtxt :: UserTypeCtxt
DataTyCtxt :: Name -> UserTypeCtxt
tcImplicitTKBndrs :: [Name] -> TcM (a, TyVarSet) -> TcM ([TcTyVar], a)
-- | Convenient specialization
tcImplicitTKBndrsType :: [Name] -> TcM Type -> TcM ([TcTyVar], Type)
tcExplicitTKBndrs :: [LHsTyVarBndr Name] -> ([TyVar] -> TcM (a, TyVarSet)) -> TcM (a, TyVarSet)
kcLookupTcTyCon :: Name -> TcM TcTyCon
-- | Bring tycon tyvars into scope. This is used during the "kind-checking"
-- pass in TcTyClsDecls. (Never in getInitialKind, never in the
-- "type-checking"/desugaring pass.) Never emits constraints, though the
-- thing_inside might.
kcTyClTyVars :: Name -> TcM a -> TcM a
-- | Used for the type variables of a type or class decl on the second full
-- pass (type-checking/desugaring) in TcTyClDecls. This is *not* used in
-- the initial-kind run, nor in the "kind-checking" pass. Accordingly,
-- everything passed to the continuation is fully zonked.
--
-- (tcTyClTyVars T [a,b] thing_inside) where T : forall k1 k2 (a:k1 ->
-- *) (b:k1). k2 -> * calls thing_inside with arguments [k1,k2,a,b]
-- [k1:*, k2:*, Anon (k1 -> *), Anon k1] (k2 -> *) having also
-- extended the type environment with bindings for k1,k2,a,b
--
-- Never emits constraints.
--
-- The LHsTyVarBndrs is always user-written, and the full, generalised
-- kind of the tycon is available in the local env.
tcTyClTyVars :: Name -> ([TyConBinder] -> Kind -> TcM a) -> TcM a
tcDataKindSig :: Kind -> TcM ([TyConBinder], Kind)
tcWildCardBinders :: [Name] -> ([(Name, TcTyVar)] -> TcM a) -> TcM a
-- | Kind-check a LHsQTyVars. If the decl under consideration has a
-- complete, user-supplied kind signature (CUSK), generalise the result.
-- Used in getInitialKind (for tycon kinds and other kinds) and
-- in kind-checking (but not for tycon kinds, which are checked with
-- tcTyClDecls). See also Note [Complete user-supplied kind signatures]
-- in HsDecls.
--
-- This function does not do telescope checking.
kcHsTyVarBndrs :: Name -> Bool -> Bool -> Bool -> Bool -> LHsQTyVars Name -> TcM (Kind, r) -> TcM (TcTyCon, r)
tcHsLiftedType :: LHsType Name -> TcM TcType
tcHsOpenType :: LHsType Name -> TcM TcType
tcHsLiftedTypeNC :: LHsType Name -> TcM TcType
tcHsOpenTypeNC :: LHsType Name -> TcM TcType
tcLHsType :: LHsType Name -> TcM (TcType, TcKind)
tcCheckLHsType :: LHsType Name -> Kind -> TcM Type
tcHsContext :: LHsContext Name -> TcM [PredType]
tcLHsPredType :: LHsType Name -> TcM PredType
-- | Applies a type to a list of arguments. Always consumes all the
-- arguments, using matchExpectedFunKind as necessary. If you wish
-- to apply a type to a list of HsTypes, this is your function. Used for
-- type-checking types only.
tcInferApps :: Outputable fun => TcTyMode -> fun -> TcType -> TcKind -> [LHsType Name] -> TcM (TcType, TcKind)
-- | Apply a type of a given kind to a list of arguments. This instantiates
-- invisible parameters as necessary. However, it does *not* necessarily
-- apply all the arguments, if the kind runs out of binders. Never calls
-- matchExpectedFunKind; when the kind runs out of binders, this
-- stops processing. This takes an optional VarEnv Kind which
-- maps kind variables to kinds. These kinds should be used to
-- instantiate invisible kind variables; they come from an enclosing
-- class for an associated type/data family. This version will
-- instantiate all invisible arguments left over after the visible ones.
-- Used only when typechecking type/data family patterns (where we need
-- to instantiate all remaining invisible parameters; for example,
-- consider type family F :: k where F = Int; F = Maybe. We need
-- to instantiate the k.)
tcInferArgs :: Outputable fun => fun -> [TyConBinder] -> Maybe (VarEnv Kind) -> [LHsType Name] -> TcM (TCvSubst, [TyBinder], [TcType], [LHsType Name], Int)
-- | Type-check a thing that emits only equality constraints, then solve
-- those constraints. Fails outright if there is trouble.
solveEqualities :: TcM a -> TcM a
kindGeneralize :: TcType -> TcM [KindVar]
tcLHsKindSig :: LHsKind Name -> TcM Kind
tcHsPatSigType :: UserTypeCtxt -> LHsSigWcType Name -> TcM ([(Name, TcTyVar)], [(Name, TcTyVar)], TcType)
tcPatSig :: Bool -> LHsSigWcType Name -> ExpSigmaType -> TcM (TcType, [(Name, TcTyVar)], [(Name, TcTyVar)], HsWrapper)
-- | Make an appropriate message for an error in a function argument. Used
-- for both expressions and types.
funAppCtxt :: (Outputable fun, Outputable arg) => fun -> arg -> Int -> SDoc
instance Outputable.Outputable TcHsType.TcTyMode
module TcSigs
data TcSigInfo
TcIdSig :: TcIdSigInfo -> TcSigInfo
TcPatSynSig :: TcPatSynInfo -> TcSigInfo
data TcIdSigInfo
CompleteSig :: TcId -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo
[sig_bndr] :: TcIdSigInfo -> TcId
[sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt
[sig_loc] :: TcIdSigInfo -> SrcSpan
PartialSig :: Name -> LHsSigWcType Name -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo
[psig_name] :: TcIdSigInfo -> Name
[psig_hs_ty] :: TcIdSigInfo -> LHsSigWcType Name
[sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt
[sig_loc] :: TcIdSigInfo -> SrcSpan
data TcIdSigInst
data TcPatSynInfo
TPSI :: Name -> [TyVarBinder] -> [TyVar] -> TcThetaType -> [TyVar] -> TcThetaType -> TcSigmaType -> TcPatSynInfo
[patsig_name] :: TcPatSynInfo -> Name
[patsig_implicit_bndrs] :: TcPatSynInfo -> [TyVarBinder]
[patsig_univ_bndrs] :: TcPatSynInfo -> [TyVar]
[patsig_req] :: TcPatSynInfo -> TcThetaType
[patsig_ex_bndrs] :: TcPatSynInfo -> [TyVar]
[patsig_prov] :: TcPatSynInfo -> TcThetaType
[patsig_body_ty] :: TcPatSynInfo -> TcSigmaType
type TcSigFun = Name -> Maybe TcSigInfo
isPartialSig :: TcIdSigInst -> Bool
-- | No signature or a partial signature
hasCompleteSig :: TcSigFun -> Name -> Bool
tcIdSigName :: TcIdSigInfo -> Name
tcSigInfoName :: TcSigInfo -> Name
completeSigPolyId_maybe :: TcSigInfo -> Maybe TcId
tcTySigs :: [LSig Name] -> TcM ([TcId], TcSigFun)
tcUserTypeSig :: SrcSpan -> LHsSigWcType Name -> Maybe Name -> TcM TcIdSigInfo
completeSigFromId :: UserTypeCtxt -> Id -> TcIdSigInfo
tcInstSig :: TcIdSigInfo -> TcM TcIdSigInst
type TcPragEnv = NameEnv [LSig Name]
emptyPragEnv :: TcPragEnv
lookupPragEnv :: TcPragEnv -> Name -> [LSig Name]
extendPragEnv :: TcPragEnv -> (Name, LSig Name) -> TcPragEnv
mkPragEnv :: [LSig Name] -> LHsBinds Name -> TcPragEnv
tcSpecPrags :: Id -> [LSig Name] -> TcM [LTcSpecPrag]
tcSpecWrapper :: UserTypeCtxt -> TcType -> TcType -> TcM HsWrapper
tcImpPrags :: [LSig Name] -> TcM [LTcSpecPrag]
addInlinePrags :: TcId -> [LSig Name] -> TcM TcId
module TcPat
tcLetPat :: (Name -> Maybe TcId) -> LetBndrSpec -> LPat Name -> ExpSigmaType -> TcM a -> TcM (LPat TcId, a)
newLetBndr :: LetBndrSpec -> Name -> TcType -> TcM TcId
data LetBndrSpec
LetLclBndr :: LetBndrSpec
LetGblBndr :: TcPragEnv -> LetBndrSpec
tcPat :: HsMatchContext Name -> LPat Name -> ExpSigmaType -> TcM a -> TcM (LPat TcId, a)
-- | A variant of tcPat that takes a custom origin
tcPat_O :: HsMatchContext Name -> CtOrigin -> LPat Name -> ExpSigmaType -> TcM a -> TcM (LPat TcId, a)
tcPats :: HsMatchContext Name -> [LPat Name] -> [ExpSigmaType] -> TcM a -> TcM ([LPat TcId], a)
addDataConStupidTheta :: DataCon -> [TcType] -> TcM ()
badFieldCon :: ConLike -> FieldLabelString -> SDoc
polyPatSig :: TcType -> SDoc
instance Outputable.Outputable TcPat.LetBndrSpec
module TcDefaults
tcDefaults :: [LDefaultDecl Name] -> TcM (Maybe [Type])
module TcBinds
tcLocalBinds :: HsLocalBinds Name -> TcM thing -> TcM (HsLocalBinds TcId, thing)
tcTopBinds :: [(RecFlag, LHsBinds Name)] -> [LSig Name] -> TcM (TcGblEnv, TcLclEnv)
tcRecSelBinds :: HsValBinds Name -> TcM TcGblEnv
tcHsBootSigs :: [(RecFlag, LHsBinds Name)] -> [LSig Name] -> TcM [Id]
tcPolyCheck :: TcPragEnv -> TcIdSigInfo -> LHsBind Name -> TcM (LHsBinds TcId, [TcId])
tcVectDecls :: [LVectDecl Name] -> TcM ([LVectDecl TcId])
addTypecheckedBinds :: TcGblEnv -> [LHsBinds Id] -> TcGblEnv
chooseInferredQuantifiers :: TcThetaType -> TcTyVarSet -> [TcTyVar] -> Maybe TcIdSigInst -> TcM ([TyVarBinder], TcThetaType)
badBootDeclErr :: MsgDoc
instance Outputable.Outputable TcBinds.GeneralisationPlan
module TcTypeable
-- | Generate the Typeable bindings for a module. This is the only
-- entry-point of this module and is invoked by the typechecker driver in
-- tcRnSrcDecls.
--
-- See Note [Grand plan for Typeable] in TcTypeable.
mkTypeableBinds :: TcM TcGblEnv
instance GHC.Base.Monad TcTypeable.KindRepM
instance GHC.Base.Applicative TcTypeable.KindRepM
instance GHC.Base.Functor TcTypeable.KindRepM
module TcTyDecls
type RolesInfo = Name -> [Role]
inferRoles :: HscSource -> RoleAnnotEnv -> [TyCon] -> Name -> [Role]
-- | Checks if any of the passed in TyCons have cycles. Takes the
-- UnitId of the home package (as we can avoid checking those
-- TyCons: cycles never go through foreign packages) and the
-- corresponding LTyClDecl Name for each TyCon, so we can
-- give better error messages.
checkSynCycles :: UnitId -> [TyCon] -> [LTyClDecl Name] -> TcM ()
checkClassCycles :: Class -> Maybe SDoc
tcAddImplicits :: [TyCon] -> TcM TcGblEnv
mkDefaultMethodType :: Class -> Id -> DefMethSpec Type -> Type
mkRecSelBinds :: [TyCon] -> HsValBinds Name
mkOneRecordSelector :: [ConLike] -> RecSelParent -> FieldLabel -> (LSig Name, (RecFlag, LHsBinds Name))
instance GHC.Base.Functor TcTyDecls.RoleM
instance GHC.Base.Applicative TcTyDecls.RoleM
instance GHC.Base.Monad TcTyDecls.RoleM
instance GHC.Base.Functor TcTyDecls.SynCycleM
instance GHC.Base.Applicative TcTyDecls.SynCycleM
instance GHC.Base.Monad TcTyDecls.SynCycleM
module TcPatSyn
tcInferPatSynDecl :: PatSynBind Name Name -> TcM (LHsBinds Id, TcGblEnv)
tcCheckPatSynDecl :: PatSynBind Name Name -> TcPatSynInfo -> TcM (LHsBinds Id, TcGblEnv)
tcPatSynBuilderBind :: PatSynBind Name Name -> TcM (LHsBinds Id)
tcPatSynBuilderOcc :: PatSyn -> TcM (HsExpr TcId, TcSigmaType)
nonBidirectionalErr :: Outputable name => name -> TcM a
module TcMatches
tcMatchesFun :: Located Name -> MatchGroup Name (LHsExpr Name) -> ExpRhoType -> TcM (HsWrapper, MatchGroup TcId (LHsExpr TcId))
tcGRHS :: TcMatchCtxt body -> ExpRhoType -> GRHS Name (Located (body Name)) -> TcM (GRHS TcId (Located (body TcId)))
tcGRHSsPat :: GRHSs Name (LHsExpr Name) -> TcRhoType -> TcM (GRHSs TcId (LHsExpr TcId))
tcMatchesCase :: (Outputable (body Name)) => TcMatchCtxt body -> TcSigmaType -> MatchGroup Name (Located (body Name)) -> ExpRhoType -> TcM (MatchGroup TcId (Located (body TcId)))
tcMatchLambda :: SDoc -> TcMatchCtxt HsExpr -> MatchGroup Name (LHsExpr Name) -> ExpRhoType -> TcM (MatchGroup TcId (LHsExpr TcId), HsWrapper)
data TcMatchCtxt body
MC :: HsMatchContext Name -> (Located (body Name) -> ExpRhoType -> TcM (Located (body TcId))) -> TcMatchCtxt body
[mc_what] :: TcMatchCtxt body -> HsMatchContext Name
[mc_body] :: TcMatchCtxt body -> Located (body Name) -> ExpRhoType -> TcM (Located (body TcId))
type TcStmtChecker body rho_type = forall thing. HsStmtContext Name -> Stmt Name (Located (body Name)) -> rho_type -> (rho_type -> TcM thing) -> TcM (Stmt TcId (Located (body TcId)), thing)
type TcExprStmtChecker = TcStmtChecker HsExpr ExpRhoType
type TcCmdStmtChecker = TcStmtChecker HsCmd TcRhoType
tcStmts :: (Outputable (body Name)) => HsStmtContext Name -> TcStmtChecker body rho_type -> [LStmt Name (Located (body Name))] -> rho_type -> TcM [LStmt TcId (Located (body TcId))]
tcStmtsAndThen :: (Outputable (body Name)) => HsStmtContext Name -> TcStmtChecker body rho_type -> [LStmt Name (Located (body Name))] -> rho_type -> (rho_type -> TcM thing) -> TcM ([LStmt TcId (Located (body TcId))], thing)
tcDoStmts :: HsStmtContext Name -> Located [LStmt Name (LHsExpr Name)] -> ExpRhoType -> TcM (HsExpr TcId)
tcBody :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId)
tcDoStmt :: TcExprStmtChecker
tcGuardStmt :: TcExprStmtChecker
module TcArrows
tcProc :: InPat Name -> LHsCmdTop Name -> ExpRhoType -> TcM (OutPat TcId, LHsCmdTop TcId, TcCoercion)
module TcBackpack
-- | For a module modname of type HscSource, determine the
-- list of extra "imports" of other requirements which should be
-- considered part of the import of the requirement, because it
-- transitively depends on those requirements by imports of modules from
-- other packages. The situation is something like this:
--
-- unit p where signature A signature B import A
--
-- unit q where dependency p[A=A,B=B] signature A signature
-- B
--
-- Although q's B does not directly import A, we still have to make sure
-- we process A first, because the merging process will cause B to
-- indirectly import A. This function finds the TRANSITIVE closure of all
-- such imports we need to make.
findExtraSigImports' :: HscEnv -> HscSource -> ModuleName -> IO (UniqDSet ModuleName)
-- | findExtraSigImports, but in a convenient form for
-- GhcMake and TcRnDriver.
findExtraSigImports :: HscEnv -> HscSource -> ModuleName -> IO [(Maybe FastString, Located ModuleName)]
implicitRequirements' :: HscEnv -> [(Maybe FastString, Located ModuleName)] -> IO [ModuleName]
implicitRequirements :: HscEnv -> [(Maybe FastString, Located ModuleName)] -> IO [(Maybe FastString, Located ModuleName)]
-- | Given a UnitId, make sure it is well typed. This is because
-- unit IDs come from Cabal, which does not know if things are well-typed
-- or not; a component may have been filled with implementations for the
-- holes that don't actually fulfill the requirements.
--
-- INVARIANT: the UnitId is NOT a InstalledUnitId
checkUnitId :: UnitId -> TcM ()
-- | Top-level driver for signature instantiation (run when compiling an
-- hsig file.)
tcRnCheckUnitId :: HscEnv -> UnitId -> IO (Messages, Maybe ())
-- | Top-level driver for signature merging (run after typechecking an
-- hsig file).
tcRnMergeSignatures :: HscEnv -> HsParsedModule -> TcGblEnv -> ModIface -> IO (Messages, Maybe TcGblEnv)
-- | Given a local ModIface, merge all inherited requirements from
-- requirementMerges into this signature, producing a final
-- TcGblEnv that matches the local signature and all required
-- signatures.
mergeSignatures :: HsParsedModule -> TcGblEnv -> ModIface -> TcRn TcGblEnv
-- | Top-level driver for signature instantiation (run when compiling an
-- hsig file.)
tcRnInstantiateSignature :: HscEnv -> Module -> RealSrcSpan -> IO (Messages, Maybe TcGblEnv)
-- | Given tcg_mod, instantiate a ModIface from the
-- indefinite library to use the actual implementations of the relevant
-- entities, checking that the implementation matches the signature.
instantiateSignature :: TcRn TcGblEnv
module DsMonad
type DsM = TcRnIf DsGblEnv DsLclEnv
-- | Map each element of a structure to a monadic action, evaluate these
-- actions from left to right, and collect the results. For a version
-- that ignores the results see mapM_.
mapM :: Traversable t => forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m t b
-- | The mapAndUnzipM function maps its first argument over a list,
-- returning the result as a pair of lists. This function is mainly used
-- with complicated data structures or a state-transforming monad.
mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])
-- | Run a DsM action inside the IO monad.
initDs :: HscEnv -> TcGblEnv -> DsM a -> IO (Messages, Maybe a)
-- | Run a DsM action inside the TcM monad.
initDsTc :: DsM a -> TcM a
initTcDsForSolver :: TcM a -> DsM (Messages, Maybe a)
-- | Run a DsM action in the context of an existing ModGuts
initDsWithModGuts :: HscEnv -> ModGuts -> DsM a -> IO (Messages, Maybe a)
fixDs :: (a -> DsM a) -> DsM a
-- | Monadic version of foldl
foldlM :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m a
-- | Monadic version of foldr
foldrM :: (Monad m) => (b -> a -> m a) -> a -> [b] -> m a
whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
xoptM :: Extension -> TcRnIf gbl lcl Bool
-- | A functor with application, providing operations to
--
--
-- - embed pure expressions (pure), and
-- - sequence computations and combine their results (<*>
-- and liftA2).
--
--
-- A minimal complete definition must include implementations of
-- pure and of either <*> or liftA2. If it
-- defines both, then they must behave the same as their default
-- definitions:
--
-- (<*>) = liftA2 id
-- liftA2 f x y = f <$> x <*>
-- y
--
-- Further, any definition must satisfy the following:
--
--
--
-- The other methods have the following default definitions, which may be
-- overridden with equivalent specialized implementations:
--
--
--
-- As a consequence of these laws, the Functor instance for
-- f will satisfy
--
--
--
-- It may be useful to note that supposing
--
--
-- forall x y. p (q x y) = f x . g y
--
--
-- it follows from the above that
--
--
-- liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
--
--
-- If f is also a Monad, it should satisfy
--
--
--
-- (which implies that pure and <*> satisfy the
-- applicative functor laws).
class Functor f => Applicative (f :: * -> *)
-- | Lift a value.
pure :: Applicative f => a -> f a
-- | Sequential application.
--
-- A few functors support an implementation of <*> that is
-- more efficient than the default one.
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
-- | Sequence actions, discarding the value of the first argument.
(*>) :: Applicative f => f a -> f b -> f b
-- | Sequence actions, discarding the value of the second argument.
(<*) :: Applicative f => f a -> f b -> f a
-- | An infix synonym for fmap.
--
-- The name of this operator is an allusion to $. Note the
-- similarities between their types:
--
--
-- ($) :: (a -> b) -> a -> b
-- (<$>) :: Functor f => (a -> b) -> f a -> f b
--
--
-- Whereas $ is function application, <$> is
-- function application lifted over a Functor.
--
-- Examples
--
-- Convert from a Maybe Int to a
-- Maybe String using show:
--
--
-- >>> show <$> Nothing
-- Nothing
--
-- >>> show <$> Just 3
-- Just "3"
--
--
-- Convert from an Either Int Int to
-- an Either Int String using
-- show:
--
--
-- >>> show <$> Left 17
-- Left 17
--
-- >>> show <$> Right 17
-- Right "17"
--
--
-- Double each element of a list:
--
--
-- >>> (*2) <$> [1,2,3]
-- [2,4,6]
--
--
-- Apply even to the second element of a pair:
--
--
-- >>> even <$> (2,2)
-- (2,True)
--
(<$>) :: Functor f => (a -> b) -> f a -> f b
infixl 4 <$>
duplicateLocalDs :: Id -> DsM Id
newSysLocalDsNoLP :: Type -> DsM Id
newSysLocalDs :: Type -> DsM Id
newSysLocalsDsNoLP :: [Type] -> DsM [Id]
newSysLocalsDs :: [Type] -> DsM [Id]
newUniqueId :: Id -> Type -> DsM Id
newFailLocalDs :: Type -> DsM Id
newPredVarDs :: PredType -> DsM Var
getSrcSpanDs :: DsM SrcSpan
putSrcSpanDs :: SrcSpan -> DsM a -> DsM a
mkPrintUnqualifiedDs :: DsM PrintUnqualified
newUnique :: TcRnIf gbl lcl Unique
-- | Unique Supply
--
-- A value of type UniqSupply is unique, and it can supply
-- one distinct Unique. Also, from the supply, one can also
-- manufacture an arbitrary number of further UniqueSupply
-- values, which will be distinct from the first and from all others.
data UniqSupply
newUniqueSupply :: TcRnIf gbl lcl UniqSupply
getGhcModeDs :: DsM GhcMode
dsGetFamInstEnvs :: DsM FamInstEnvs
dsLookupGlobal :: Name -> DsM TyThing
dsLookupGlobalId :: Name -> DsM Id
-- | Get a name from Data.Array.Parallel for the desugarer, from the
-- ds_parr_bi component of the global desugerar environment.
dsDPHBuiltin :: (PArrBuiltin -> a) -> DsM a
dsLookupTyCon :: Name -> DsM TyCon
dsLookupDataCon :: Name -> DsM DataCon
dsLookupConLike :: Name -> DsM ConLike
data PArrBuiltin
PArrBuiltin :: Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> Var -> PArrBuiltin
-- | lengthP
[lengthPVar] :: PArrBuiltin -> Var
-- | replicateP
[replicatePVar] :: PArrBuiltin -> Var
-- | singletonP
[singletonPVar] :: PArrBuiltin -> Var
-- | mapP
[mapPVar] :: PArrBuiltin -> Var
-- | filterP
[filterPVar] :: PArrBuiltin -> Var
-- | zipP
[zipPVar] :: PArrBuiltin -> Var
-- | crossMapP
[crossMapPVar] :: PArrBuiltin -> Var
-- | (!:)
[indexPVar] :: PArrBuiltin -> Var
-- | emptyP
[emptyPVar] :: PArrBuiltin -> Var
-- | (+:+)
[appPVar] :: PArrBuiltin -> Var
-- | enumFromToP
[enumFromToPVar] :: PArrBuiltin -> Var
-- | enumFromThenToP
[enumFromThenToPVar] :: PArrBuiltin -> Var
-- | Lookup a name exported by Prim or Prim. Panic if there
-- isn't one, or if it is defined multiple times.
dsLookupDPHRdrEnv :: OccName -> DsM Name
-- | Lookup a name exported by Prim or Prim, returning
-- Nothing if it's not defined. Panic if it's defined multiple
-- times.
dsLookupDPHRdrEnv_maybe :: OccName -> DsM (Maybe Name)
-- | Populate ds_parr_bi from ds_dph_env.
dsInitPArrBuiltin :: DsM a -> DsM a
type DsMetaEnv = NameEnv DsMetaVal
data DsMetaVal
DsBound :: Id -> DsMetaVal
DsSplice :: (HsExpr Id) -> DsMetaVal
dsGetMetaEnv :: DsM (NameEnv DsMetaVal)
dsLookupMetaEnv :: Name -> DsM (Maybe DsMetaVal)
dsExtendMetaEnv :: DsMetaEnv -> DsM a -> DsM a
-- | Get in-scope type constraints (pm check)
getDictsDs :: DsM (Bag EvVar)
-- | Add in-scope type constraints (pm check)
addDictsDs :: Bag EvVar -> DsM a -> DsM a
-- | Get in-scope term constraints (pm check)
getTmCsDs :: DsM (Bag SimpleEq)
-- | Add in-scope term constraints (pm check)
addTmCsDs :: Bag SimpleEq -> DsM a -> DsM a
-- | Increase the counter for elapsed pattern match check iterations. If
-- the current counter is already over the limit, fail
incrCheckPmIterDs :: DsM Int
-- | Reset the counter for pattern match check iterations to zero
resetPmIterDs :: DsM ()
-- | The COMPLETE pragams provided by the user for a given
-- TyCon.
dsGetCompleteMatches :: TyCon -> DsM [CompleteMatch]
type DsWarning = (SrcSpan, SDoc)
-- | Emit a warning for the current source location NB: Warns whether or
-- not -Wxyz is set
warnDs :: WarnReason -> SDoc -> DsM ()
-- | Emit a warning only if the correct WarnReason is set in the DynFlags
warnIfSetDs :: WarningFlag -> SDoc -> DsM ()
errDs :: SDoc -> DsM ()
-- | Issue an error, but return the expression for (), so that we can
-- continue reporting errors.
errDsCoreExpr :: SDoc -> DsM CoreExpr
failWithDs :: SDoc -> DsM a
failDs :: DsM a
discardWarningsDs :: DsM a -> DsM a
askNoErrsDs :: DsM a -> DsM (a, Bool)
data DsMatchContext
DsMatchContext :: (HsMatchContext Name) -> SrcSpan -> DsMatchContext
data EquationInfo
EqnInfo :: [Pat Id] -> MatchResult -> EquationInfo
[eqn_pats] :: EquationInfo -> [Pat Id]
[eqn_rhs] :: EquationInfo -> MatchResult
data MatchResult
MatchResult :: CanItFail -> (CoreExpr -> DsM CoreExpr) -> MatchResult
type DsWrapper = CoreExpr -> CoreExpr
idDsWrapper :: DsWrapper
data CanItFail
CanFail :: CanItFail
CantFail :: CanItFail
orFail :: CanItFail -> CanItFail -> CanItFail
-- | Fail with an error message if the type is levity polymorphic.
dsNoLevPoly :: Type -> SDoc -> DsM ()
-- | Check an expression for levity polymorphism, failing if it is levity
-- polymorphic.
dsNoLevPolyExpr :: CoreExpr -> SDoc -> DsM ()
-- | Runs the thing_inside. If there are no errors, then returns the expr
-- given. Otherwise, returns unitExpr. This is useful for doing a bunch
-- of levity polymorphism checks and then avoiding making a core App. (If
-- we make a core App on a levity polymorphic argument, detecting how to
-- handle the let/app invariant might call isUnliftedType, which panics
-- on a levity polymorphic type.) See #12709 for an example of why this
-- machinery is necessary.
dsWhenNoErrs :: DsM a -> (a -> CoreExpr) -> DsM CoreExpr
instance Outputable.Outputable DsMonad.EquationInfo
instance Outputable.Outputable DsMonad.DsMatchContext
instance HscTypes.MonadThings (IOEnv.IOEnv (TcRnTypes.Env TcRnTypes.DsGblEnv TcRnTypes.DsLclEnv))
module TcExpr
tcPolyExpr :: LHsExpr Name -> TcSigmaType -> TcM (LHsExpr TcId)
tcMonoExpr :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId)
tcMonoExprNC :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId)
tcInferSigma :: LHsExpr Name -> TcM (LHsExpr TcId, TcSigmaType)
tcInferSigmaNC :: LHsExpr Name -> TcM (LHsExpr TcId, TcSigmaType)
tcInferRho :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType)
tcInferRhoNC :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType)
-- | Typecheck a syntax operator The operator is always a variable at this
-- stage (i.e. renamer output)
tcSyntaxOp :: CtOrigin -> SyntaxExpr Name -> [SyntaxOpType] -> ExpRhoType -> ([TcSigmaType] -> TcM a) -> TcM (a, SyntaxExpr TcId)
-- | Slightly more general version of tcSyntaxOp that allows the
-- caller to specify the shape of the result of the syntax operator
tcSyntaxOpGen :: CtOrigin -> SyntaxExpr Name -> [SyntaxOpType] -> SyntaxOpType -> ([TcSigmaType] -> TcM a) -> TcM (a, SyntaxExpr TcId)
-- | What to expect for an argument to a rebindable-syntax operator. Quite
-- like Type, but allows for holes to be filled in by tcSyntaxOp.
-- The callback called from tcSyntaxOp gets a list of types; the meaning
-- of these types is determined by a left-to-right depth-first traversal
-- of the SyntaxOpType tree. So if you pass in
--
--
-- SynAny `SynFun` (SynList `SynFun` SynType Int) `SynFun` SynAny
--
--
-- you'll get three types back: one for the first SynAny, the
-- element type of the list, and one for the last SynAny.
-- You don't get anything for the SynType, because you've said
-- positively that it should be an Int, and so it shall be.
--
-- This is defined here to avoid defining it in TcExpr.hs-boot.
data SyntaxOpType
-- | Any type
SynAny :: SyntaxOpType
-- | A rho type, deeply skolemised or instantiated as appropriate
SynRho :: SyntaxOpType
-- | A list type. You get back the element type of the list
SynList :: SyntaxOpType
-- | A function.
SynFun :: SyntaxOpType -> SyntaxOpType -> SyntaxOpType
-- | A known type.
SynType :: ExpType -> SyntaxOpType
-- | Like SynType but accepts a regular TcType
synKnownType :: TcType -> SyntaxOpType
tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr TcId)
addExprErrCtxt :: LHsExpr Name -> TcM a -> TcM a
getFixedTyVars :: [FieldLabelString] -> [TyVar] -> [ConLike] -> TyVarSet
module TcRules
tcRules :: [LRuleDecls Name] -> TcM [LRuleDecls TcId]
module TcForeign
tcForeignImports :: [LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt)
tcForeignExports :: [LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt)
isForeignImport :: LForeignDecl name -> Bool
isForeignExport :: LForeignDecl name -> Bool
tcFImport :: LForeignDecl Name -> TcM (Id, LForeignDecl Id, Bag GlobalRdrElt)
tcFExport :: ForeignDecl Name -> TcM (LHsBind Id, ForeignDecl Id, Bag GlobalRdrElt)
tcForeignImports' :: [LForeignDecl Name] -> TcM ([Id], [LForeignDecl Id], Bag GlobalRdrElt)
tcCheckFIType :: [Type] -> Type -> ForeignImport -> TcM ForeignImport
checkCTarget :: CCallTarget -> TcM ()
checkForeignArgs :: (Type -> Validity) -> [Type] -> TcM ()
-- | Check that the type has the form (IO t) or (t) , and that t satisfies
-- the given predicate. When calling this function, any newtype wrappers
-- (should) have been already dealt with by normaliseFfiType.
--
-- We also check that the Safe Haskell condition of FFI imports having
-- results in the IO monad holds.
checkForeignRes :: Bool -> Bool -> (Type -> Validity) -> Type -> TcM ()
normaliseFfiType :: Type -> TcM (Coercion, Type, Bag GlobalRdrElt)
nonIOok :: Bool
mustBeIO :: Bool
checkSafe :: Bool
noCheckSafe :: Bool
tcForeignExports' :: [LForeignDecl Name] -> TcM (LHsBinds TcId, [LForeignDecl TcId], Bag GlobalRdrElt)
tcCheckFEType :: Type -> ForeignExport -> TcM ForeignExport
-- | Utility functions for constructing Core syntax, principally for
-- desugaring
module DsUtils
data EquationInfo
EqnInfo :: [Pat Id] -> MatchResult -> EquationInfo
[eqn_pats] :: EquationInfo -> [Pat Id]
[eqn_rhs] :: EquationInfo -> MatchResult
firstPat :: EquationInfo -> Pat Id
shiftEqns :: [EquationInfo] -> [EquationInfo]
data MatchResult
MatchResult :: CanItFail -> (CoreExpr -> DsM CoreExpr) -> MatchResult
data CanItFail
CanFail :: CanItFail
CantFail :: CanItFail
data CaseAlt a
MkCaseAlt :: a -> [Var] -> HsWrapper -> MatchResult -> CaseAlt a
[alt_pat] :: CaseAlt a -> a
[alt_bndrs] :: CaseAlt a -> [Var]
[alt_wrapper] :: CaseAlt a -> HsWrapper
[alt_result] :: CaseAlt a -> MatchResult
cantFailMatchResult :: CoreExpr -> MatchResult
alwaysFailMatchResult :: MatchResult
extractMatchResult :: MatchResult -> CoreExpr -> DsM CoreExpr
combineMatchResults :: MatchResult -> MatchResult -> MatchResult
adjustMatchResult :: DsWrapper -> MatchResult -> MatchResult
adjustMatchResultDs :: (CoreExpr -> DsM CoreExpr) -> MatchResult -> MatchResult
mkCoLetMatchResult :: CoreBind -> MatchResult -> MatchResult
mkViewMatchResult :: Id -> CoreExpr -> MatchResult -> MatchResult
mkGuardedMatchResult :: CoreExpr -> MatchResult -> MatchResult
matchCanFail :: MatchResult -> Bool
mkEvalMatchResult :: Id -> Type -> MatchResult -> MatchResult
mkCoPrimCaseMatchResult :: Id -> Type -> [(Literal, MatchResult)] -> MatchResult
mkCoAlgCaseMatchResult :: DynFlags -> Id -> Type -> [CaseAlt DataCon] -> MatchResult
mkCoSynCaseMatchResult :: Id -> Type -> CaseAlt PatSyn -> MatchResult
wrapBind :: Var -> Var -> CoreExpr -> CoreExpr
wrapBinds :: [(Var, Var)] -> CoreExpr -> CoreExpr
mkErrorAppDs :: Id -> Type -> SDoc -> DsM CoreExpr
mkCoreAppDs :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr
mkCoreAppsDs :: SDoc -> CoreExpr -> [CoreExpr] -> CoreExpr
mkCastDs :: CoreExpr -> Coercion -> CoreExpr
seqVar :: Var -> CoreExpr -> CoreExpr
mkLHsVarPatTup :: [Id] -> LPat Id
mkLHsPatTup :: [LPat Id] -> LPat Id
mkVanillaTuplePat :: [OutPat Id] -> Boxity -> Pat Id
mkBigLHsVarTupId :: [Id] -> LHsExpr Id
mkBigLHsTupId :: [LHsExpr Id] -> LHsExpr Id
mkBigLHsVarPatTupId :: [Id] -> LPat Id
mkBigLHsPatTupId :: [LPat Id] -> LPat Id
mkSelectorBinds :: [[Tickish Id]] -> LPat Id -> CoreExpr -> DsM (Id, [(Id, CoreExpr)])
selectSimpleMatchVarL :: LPat Id -> DsM Id
selectMatchVars :: [Pat Id] -> DsM [Id]
selectMatchVar :: Pat Id -> DsM Id
mkOptTickBox :: [Tickish Id] -> CoreExpr -> CoreExpr
mkBinaryTickBox :: Int -> Int -> CoreExpr -> DsM CoreExpr
-- | Use -XStrict to add a ! or remove a ~
--
-- Examples: ~pat => pat -- when -XStrict (even if pat = ~pat') !pat
-- => !pat -- always pat => !pat -- when -XStrict pat => pat --
-- otherwise
decideBangHood :: DynFlags -> LPat id -> LPat id
-- | Unconditionally make a Pat strict.
addBang :: LPat id -> LPat id
module MatchLit
dsLit :: HsLit -> DsM CoreExpr
dsOverLit :: HsOverLit Id -> DsM CoreExpr
dsOverLit' :: DynFlags -> HsOverLit Id -> DsM CoreExpr
hsLitKey :: DynFlags -> HsLit -> Literal
tidyLitPat :: HsLit -> Pat Id
tidyNPat :: (HsLit -> Pat Id) -> HsOverLit Id -> Maybe (SyntaxExpr Id) -> SyntaxExpr Id -> Type -> Pat Id
matchLiterals :: [Id] -> Type -> [[EquationInfo]] -> DsM MatchResult
matchNPlusKPats :: [Id] -> Type -> [EquationInfo] -> DsM MatchResult
matchNPats :: [Id] -> Type -> [EquationInfo] -> DsM MatchResult
warnAboutIdentities :: DynFlags -> CoreExpr -> Type -> DsM ()
warnAboutOverflowedLiterals :: DynFlags -> HsOverLit Id -> DsM ()
warnAboutEmptyEnumerations :: DynFlags -> LHsExpr Id -> Maybe (LHsExpr Id) -> LHsExpr Id -> DsM ()
module DsMeta
dsBracket :: HsBracket Name -> [PendingTcSplice] -> DsM CoreExpr
module DsGRHSs
dsGuarded :: GRHSs Id (LHsExpr Id) -> Type -> DsM CoreExpr
dsGRHSs :: HsMatchContext Name -> [Pat Id] -> GRHSs Id (LHsExpr Id) -> Type -> DsM MatchResult
dsGRHS :: HsMatchContext Name -> Type -> LGRHS Id (LHsExpr Id) -> DsM MatchResult
isTrueLHsExpr :: LHsExpr Id -> Maybe (CoreExpr -> DsM CoreExpr)
module DsCCall
dsCCall :: CLabelString -> [CoreExpr] -> Safety -> Type -> DsM CoreExpr
mkFCall :: DynFlags -> Unique -> ForeignCall -> [CoreExpr] -> Type -> CoreExpr
unboxArg :: CoreExpr -> DsM (CoreExpr, CoreExpr -> CoreExpr)
boxResult :: Type -> DsM (Type, CoreExpr -> CoreExpr)
resultWrapper :: Type -> DsM (Maybe Type, CoreExpr -> CoreExpr)
module DsForeign
dsForeigns :: [LForeignDecl Id] -> DsM (ForeignStubs, OrdList Binding)
module DsBinds
-- | Desugar top level binds, strict binds are treated like normal binds
-- since there is no good time to force before first usage.
dsTopLHsBinds :: LHsBinds Id -> DsM (OrdList (Id, CoreExpr))
-- | Desugar all other kind of bindings, Ids of strict binds are returned
-- to later be forced in the binding group body, see Note [Desugar Strict
-- binds]
dsLHsBinds :: LHsBinds Id -> DsM ([Id], [(Id, CoreExpr)])
decomposeRuleLhs :: [Var] -> CoreExpr -> Either SDoc ([Var], Id, [CoreExpr])
dsSpec :: Maybe CoreExpr -> Located TcSpecPrag -> DsM (Maybe (OrdList (Id, CoreExpr), CoreRule))
dsHsWrapper :: HsWrapper -> DsM (CoreExpr -> CoreExpr)
dsTcEvBinds :: TcEvBinds -> DsM [CoreBind]
dsTcEvBinds_s :: [TcEvBinds] -> DsM [CoreBind]
dsEvBinds :: Bag EvBind -> DsM [CoreBind]
dsMkUserRule :: Module -> Bool -> RuleName -> Activation -> Name -> [CoreBndr] -> [CoreExpr] -> CoreExpr -> DsM CoreRule
module MatchCon
matchConFamily :: [Id] -> Type -> [[EquationInfo]] -> DsM MatchResult
matchPatSyn :: [Id] -> Type -> [EquationInfo] -> DsM MatchResult
module Check
-- | Check a single pattern binding (let)
checkSingle :: DynFlags -> DsMatchContext -> Id -> Pat Id -> DsM ()
-- | Check a matchgroup (case, functions, etc.)
checkMatches :: DynFlags -> DsMatchContext -> [Id] -> [LMatch Id (LHsExpr Id)] -> DsM ()
-- | Check whether any part of pattern match checking is enabled (does not
-- matter whether it is the redundancy check or the exhaustiveness
-- check).
isAnyPmCheckEnabled :: DynFlags -> DsMatchContext -> Bool
-- | Generate a simple equality when checking a case expression: case x of
-- { matches } When checking matches we record that (x ~ y) where y is
-- the initial uncovered. All matches will have to satisfy this equality.
genCaseTmCs1 :: Maybe (LHsExpr Id) -> [Id] -> Bag SimpleEq
-- | Generate equalities when checking a case expression: case x of { p1
-- -> e1; ... pn -> en } When we go deeper to check e.g. e1 we
-- record two equalities: (x ~ y), where y is the initial uncovered when
-- checking (p1; .. ; pn) and (x ~ p1).
genCaseTmCs2 :: Maybe (LHsExpr Id) -> [Pat Id] -> [Id] -> DsM (Bag SimpleEq)
instance GHC.Classes.Ord Check.Provenance
instance GHC.Classes.Eq Check.Provenance
instance GHC.Show.Show Check.Provenance
instance GHC.Show.Show Check.Diverged
instance GHC.Show.Show Check.Covered
instance Outputable.Outputable Check.PartialResult
instance GHC.Base.Monoid Check.PartialResult
instance Outputable.Outputable Check.Provenance
instance GHC.Base.Monoid Check.Provenance
instance Outputable.Outputable Check.Diverged
instance GHC.Base.Monoid Check.Diverged
instance Outputable.Outputable Check.Covered
instance GHC.Base.Monoid Check.Covered
instance Outputable.Outputable Check.ValVec
module Match
match :: [MatchId] -> Type -> [EquationInfo] -> DsM MatchResult
matchEquations :: HsMatchContext Name -> [MatchId] -> [EquationInfo] -> Type -> DsM CoreExpr
matchWrapper :: HsMatchContext Name -> Maybe (LHsExpr Id) -> MatchGroup Id (LHsExpr Id) -> DsM ([Id], CoreExpr)
matchSimply :: CoreExpr -> HsMatchContext Name -> LPat Id -> CoreExpr -> CoreExpr -> DsM CoreExpr
matchSinglePat :: CoreExpr -> HsMatchContext Name -> LPat Id -> Type -> MatchResult -> DsM MatchResult
module DsListComp
dsListComp :: [ExprLStmt Id] -> Type -> DsM CoreExpr
dsPArrComp :: [ExprStmt Id] -> DsM CoreExpr
dsMonadComp :: [ExprLStmt Id] -> DsM CoreExpr
module DsArrows
dsProcExpr :: LPat Id -> LHsCmdTop Id -> DsM CoreExpr
module DsExpr
dsExpr :: HsExpr Id -> DsM CoreExpr
dsLExpr :: LHsExpr Id -> DsM CoreExpr
-- | Variant of dsLExpr that ensures that the result is not levity
-- polymorphic. This should be used when the resulting expression will be
-- an argument to some other function. See Note [Levity polymorphism
-- checking] in DsMonad See Note [Levity polymorphism invariants] in
-- CoreSyn
dsLExprNoLP :: LHsExpr Id -> DsM CoreExpr
dsLocalBinds :: LHsLocalBinds Id -> CoreExpr -> DsM CoreExpr
dsValBinds :: HsValBinds Id -> CoreExpr -> DsM CoreExpr
dsLit :: HsLit -> DsM CoreExpr
dsSyntaxExpr :: SyntaxExpr Id -> [CoreExpr] -> DsM CoreExpr
module TcClassDcl
tcClassSigs :: Name -> [LSig Name] -> LHsBinds Name -> TcM [TcMethInfo]
tcClassDecl2 :: LTyClDecl Name -> TcM (LHsBinds Id)
findMethodBind :: Name -> LHsBinds Name -> TcPragEnv -> Maybe (LHsBind Name, SrcSpan, [LSig Name])
instantiateMethod :: Class -> Id -> [TcType] -> TcType
tcClassMinimalDef :: Name -> [LSig Name] -> [TcMethInfo] -> TcM ClassMinimalDef
type HsSigFun = Name -> Maybe (LHsSigType Name)
mkHsSigFun :: [LSig Name] -> HsSigFun
tcMkDeclCtxt :: TyClDecl Name -> SDoc
tcAddDeclCtxt :: TyClDecl Name -> TcM a -> TcM a
badMethodErr :: Outputable a => a -> Name -> SDoc
-- | Construct default instances for any associated types that aren't given
-- a user definition Returns [] or singleton
tcATDefault :: Bool -> SrcSpan -> TCvSubst -> NameSet -> ClassATItem -> TcM [FamInst]
module TcDeriv
tcDeriving :: [DerivInfo] -> [LDerivDecl Name] -> TcM (TcGblEnv, Bag (InstInfo Name), HsValBinds Name)
-- | Stuff needed to process a datatype's `deriving` clauses
data DerivInfo
DerivInfo :: TyCon -> [LHsDerivingClause Name] -> SDoc -> DerivInfo
-- | The data tycon for normal datatypes, or the *representation* tycon for
-- data families
[di_rep_tc] :: DerivInfo -> TyCon
[di_clauses] :: DerivInfo -> [LHsDerivingClause Name]
-- | error context
[di_ctxt] :: DerivInfo -> SDoc
-- | Extract `deriving` clauses of proper data type (skips data families)
mkDerivInfos :: [LTyClDecl Name] -> TcM [DerivInfo]
instance Outputable.Outputable TcDeriv.EarlyDerivSpec
module TcTyClsDecls
tcTyAndClassDecls :: [TyClGroup Name] -> TcM (TcGblEnv, [InstInfo Name], [DerivInfo])
tcAddImplicits :: [TyCon] -> TcM TcGblEnv
kcDataDefn :: Name -> HsTyPats Name -> HsDataDefn Name -> TcKind -> TcM ()
tcConDecls :: TyCon -> ([TyConBinder], Type) -> [LConDecl Name] -> TcM [DataCon]
dataDeclChecks :: Name -> NewOrData -> ThetaType -> [LConDecl Name] -> TcM Bool
checkValidTyCon :: TyCon -> TcM ()
tcFamTyPats :: FamTyConShape -> Maybe ClsInstInfo -> HsTyPats Name -> (TcKind -> TcM ()) -> ([TcTyVar] -> [TcType] -> TcKind -> TcM a) -> TcM a
tcTyFamInstEqn :: FamTyConShape -> Maybe ClsInstInfo -> LTyFamInstEqn Name -> TcM CoAxBranch
famTyConShape :: TyCon -> FamTyConShape
tcAddTyFamInstCtxt :: TyFamInstDecl Name -> TcM a -> TcM a
tcMkDataFamInstCtxt :: DataFamInstDecl Name -> SDoc
tcAddDataFamInstCtxt :: DataFamInstDecl Name -> TcM a -> TcM a
wrongKindOfFamily :: TyCon -> SDoc
dataConCtxt :: Outputable a => a -> SDoc
module TcInstDcls
tcInstDecls1 :: [LInstDecl Name] -> TcM (TcGblEnv, [InstInfo Name], [DerivInfo])
-- | Use DerivInfo for data family instances (produced by tcInstDecls1),
-- datatype declarations (TyClDecl), and standalone deriving declarations
-- (DerivDecl) to check and process all derived class instances.
tcInstDeclsDeriv :: [DerivInfo] -> [LTyClDecl Name] -> [LDerivDecl Name] -> TcM (TcGblEnv, [InstInfo Name], HsValBinds Name)
tcInstDecls2 :: [LTyClDecl Name] -> [InstInfo Name] -> TcM (LHsBinds Id)
module TcRnDriver
-- | The returned [Id] is the list of new Ids bound by this statement. It
-- can be used to extend the InteractiveContext via
-- extendInteractiveContext.
--
-- The returned TypecheckedHsExpr is of type IO [ () ], a list of the
-- bound values, coerced to ().
tcRnStmt :: HscEnv -> GhciLStmt RdrName -> IO (Messages, Maybe ([Id], LHsExpr Id, FixityEnv))
-- | tcRnExpr just finds the type of an expression
tcRnExpr :: HscEnv -> TcRnExprMode -> LHsExpr RdrName -> IO (Messages, Maybe Type)
-- | How should we infer a type? See Note [TcRnExprMode]
data TcRnExprMode
-- | Instantiate the type fully (:type)
TM_Inst :: TcRnExprMode
-- | Do not instantiate the type (:type +v)
TM_NoInst :: TcRnExprMode
-- | Default the type eagerly (:type +d)
TM_Default :: TcRnExprMode
tcRnType :: HscEnv -> Bool -> LHsType RdrName -> IO (Messages, Maybe (Type, Kind))
tcRnImportDecls :: HscEnv -> [LImportDecl RdrName] -> IO (Messages, Maybe GlobalRdrEnv)
-- | Find all the Names that this RdrName could mean, in GHCi
tcRnLookupRdrName :: HscEnv -> Located RdrName -> IO (Messages, Maybe [Name])
-- | ASSUMES that the module is either in the HomePackageTable or is
-- a package module with an interface on disk. If neither of these is
-- true, then the result will be an error indicating the interface could
-- not be found.
getModuleInterface :: HscEnv -> Module -> IO (Messages, Maybe ModIface)
tcRnDeclsi :: HscEnv -> [LHsDecl RdrName] -> IO (Messages, Maybe TcGblEnv)
isGHCiMonad :: HscEnv -> String -> IO (Messages, Maybe Name)
runTcInteractive :: HscEnv -> TcRn a -> IO (Messages, Maybe a)
tcRnLookupName :: HscEnv -> Name -> IO (Messages, Maybe TyThing)
tcRnGetInfo :: HscEnv -> Name -> IO (Messages, Maybe (TyThing, Fixity, [ClsInst], [FamInst]))
-- | Top level entry point for typechecker and renamer
tcRnModule :: HscEnv -> HscSource -> Bool -> HsParsedModule -> IO (Messages, Maybe TcGblEnv)
tcRnModuleTcRnM :: HscEnv -> HscSource -> HsParsedModule -> (Module, SrcSpan) -> TcRn TcGblEnv
tcTopSrcDecls :: HsGroup Name -> TcM (TcGblEnv, TcLclEnv)
rnTopSrcDecls :: HsGroup RdrName -> TcM (TcGblEnv, HsGroup Name)
-- | Compares the two things for equivalence between boot-file and normal
-- code. Returns Nothing on success or Just "some helpful
-- info for user" failure. If the difference will be apparent to the
-- user, Just empty is perfectly suitable.
checkBootDecl :: Bool -> TyThing -> TyThing -> Maybe SDoc
checkHiBootIface' :: [ClsInst] -> TypeEnv -> [AvailInfo] -> ModDetails -> TcM [(Id, Id)]
-- | findExtraSigImports, but in a convenient form for
-- GhcMake and TcRnDriver.
findExtraSigImports :: HscEnv -> HscSource -> ModuleName -> IO [(Maybe FastString, Located ModuleName)]
implicitRequirements :: HscEnv -> [(Maybe FastString, Located ModuleName)] -> IO [(Maybe FastString, Located ModuleName)]
-- | Given a UnitId, make sure it is well typed. This is because
-- unit IDs come from Cabal, which does not know if things are well-typed
-- or not; a component may have been filled with implementations for the
-- holes that don't actually fulfill the requirements.
--
-- INVARIANT: the UnitId is NOT a InstalledUnitId
checkUnitId :: UnitId -> TcM ()
-- | Given a local ModIface, merge all inherited requirements from
-- requirementMerges into this signature, producing a final
-- TcGblEnv that matches the local signature and all required
-- signatures.
mergeSignatures :: HsParsedModule -> TcGblEnv -> ModIface -> TcRn TcGblEnv
-- | Top-level driver for signature merging (run after typechecking an
-- hsig file).
tcRnMergeSignatures :: HscEnv -> HsParsedModule -> TcGblEnv -> ModIface -> IO (Messages, Maybe TcGblEnv)
-- | Given tcg_mod, instantiate a ModIface from the
-- indefinite library to use the actual implementations of the relevant
-- entities, checking that the implementation matches the signature.
instantiateSignature :: TcRn TcGblEnv
-- | Top-level driver for signature instantiation (run when compiling an
-- hsig file.)
tcRnInstantiateSignature :: HscEnv -> Module -> RealSrcSpan -> IO (Messages, Maybe TcGblEnv)
loadUnqualIfaces :: HscEnv -> InteractiveContext -> TcM ()
badReexportedBootThing :: DynFlags -> Bool -> Name -> Name -> SDoc
-- | Compares two things for equivalence between boot-file and normal code,
-- reporting an error if they don't match up.
checkBootDeclM :: Bool -> TyThing -> TyThing -> TcM ()
missingBootThing :: Bool -> Name -> String -> SDoc
module Desugar
-- | Main entry point to the desugarer.
deSugar :: HscEnv -> ModLocation -> TcGblEnv -> IO (Messages, Maybe ModGuts)
deSugarExpr :: HscEnv -> LHsExpr Id -> IO (Messages, Maybe CoreExpr)
-- | Builtin types and functions used by the vectoriser. These are all
-- defined in Prim.
module Vectorise.Builtins.Base
mAX_DPH_PROD :: Int
mAX_DPH_SUM :: Int
mAX_DPH_COMBINE :: Int
mAX_DPH_SCALAR_ARGS :: Int
aLL_DPH_PRIM_TYCONS :: [Name]
-- | Holds the names of the types and functions from Prim that are
-- used by the vectoriser.
data Builtins
Builtins :: TyCon -> TyCon -> TyCon -> Class -> TyCon -> TyCon -> Class -> TyCon -> DataCon -> Var -> Var -> NameEnv Var -> Var -> NameEnv Var -> Var -> NameEnv Var -> Array Int Var -> Array Int (NameEnv Var) -> Class -> Array Int Var -> TyCon -> Var -> Var -> Array Int TyCon -> TyCon -> Var -> Var -> TyCon -> Var -> Var -> Var -> Var -> Array Int Var -> Array Int Type -> Array Int Type -> Array Int CoreExpr -> Array Int CoreExpr -> Array Int CoreExpr -> Array (Int, Int) CoreExpr -> Var -> Builtins
-- | PArray
[parrayTyCon] :: Builtins -> TyCon
-- | PData
[pdataTyCon] :: Builtins -> TyCon
-- | PDatas
[pdatasTyCon] :: Builtins -> TyCon
-- | PR
[prClass] :: Builtins -> Class
-- | PR
[prTyCon] :: Builtins -> TyCon
-- | PRepr
[preprTyCon] :: Builtins -> TyCon
-- | PA
[paClass] :: Builtins -> Class
-- | PA
[paTyCon] :: Builtins -> TyCon
-- | PA
[paDataCon] :: Builtins -> DataCon
-- | PA
[paPRSel] :: Builtins -> Var
-- | replicatePD
[replicatePDVar] :: Builtins -> Var
-- | replicatePD_Int# etc.
[replicatePD_PrimVars] :: Builtins -> NameEnv Var
-- | emptyPD
[emptyPDVar] :: Builtins -> Var
-- | emptyPD_Int# etc.
[emptyPD_PrimVars] :: Builtins -> NameEnv Var
-- | packByTagPD
[packByTagPDVar] :: Builtins -> Var
-- | packByTagPD_Int# etc.
[packByTagPD_PrimVars] :: Builtins -> NameEnv Var
-- | combinePD
[combinePDVars] :: Builtins -> Array Int Var
-- | combine2PD_Int# etc.
[combinePD_PrimVarss] :: Builtins -> Array Int (NameEnv Var)
-- | Scalar
[scalarClass] :: Builtins -> Class
-- | map, zipWith, zipWith3
[scalarZips] :: Builtins -> Array Int Var
-- | Void
[voidTyCon] :: Builtins -> TyCon
-- | void
[voidVar] :: Builtins -> Var
-- | fromVoid
[fromVoidVar] :: Builtins -> Var
-- | Sum2 .. Sum3
[sumTyCons] :: Builtins -> Array Int TyCon
-- | Wrap
[wrapTyCon] :: Builtins -> TyCon
-- | pvoid
[pvoidVar] :: Builtins -> Var
-- | pvoids
[pvoidsVar] :: Builtins -> Var
-- | :->
[closureTyCon] :: Builtins -> TyCon
-- | closure
[closureVar] :: Builtins -> Var
-- | liftedClosure
[liftedClosureVar] :: Builtins -> Var
-- | $:
[applyVar] :: Builtins -> Var
-- | liftedApply
[liftedApplyVar] :: Builtins -> Var
-- | closure1 .. closure3
[closureCtrFuns] :: Builtins -> Array Int Var
-- | Sel2
[selTys] :: Builtins -> Array Int Type
-- | Sels2
[selsTys] :: Builtins -> Array Int Type
-- | lengthSels2
[selsLengths] :: Builtins -> Array Int CoreExpr
-- | replicate2
[selReplicates] :: Builtins -> Array Int CoreExpr
-- | tagsSel2
[selTagss] :: Builtins -> Array Int CoreExpr
-- | elementsSel2_0 .. elementsSel_2_1
[selElementss] :: Builtins -> Array (Int, Int) CoreExpr
-- | lc
[liftingContext] :: Builtins -> Var
selTy :: Int -> Builtins -> Type
selsTy :: Int -> Builtins -> Type
selReplicate :: Int -> Builtins -> CoreExpr
selTags :: Int -> Builtins -> CoreExpr
selElements :: Int -> Int -> Builtins -> CoreExpr
selsLength :: Int -> Builtins -> CoreExpr
sumTyCon :: Int -> Builtins -> TyCon
prodTyCon :: Int -> Builtins -> TyCon
prodDataCon :: Int -> Builtins -> DataCon
replicatePD_PrimVar :: TyCon -> Builtins -> Var
emptyPD_PrimVar :: TyCon -> Builtins -> Var
packByTagPD_PrimVar :: TyCon -> Builtins -> Var
combinePDVar :: Int -> Builtins -> Var
combinePD_PrimVar :: Int -> TyCon -> Builtins -> Var
scalarZip :: Int -> Builtins -> Var
closureCtrFun :: Int -> Builtins -> Var
module Vectorise.Builtins.Initialise
-- | Create the initial map of builtin types and functions.
initBuiltins :: DsM Builtins
-- | Get the mapping of names in the Prelude to names in the DPH library.
initBuiltinVars :: Builtins -> DsM [(Var, Var)]
module Vectorise.Builtins
mAX_DPH_SCALAR_ARGS :: Int
-- | Holds the names of the types and functions from Prim that are
-- used by the vectoriser.
data Builtins
Builtins :: TyCon -> TyCon -> TyCon -> Class -> TyCon -> TyCon -> Class -> TyCon -> DataCon -> Var -> Var -> NameEnv Var -> Var -> NameEnv Var -> Var -> NameEnv Var -> Array Int Var -> Array Int (NameEnv Var) -> Class -> Array Int Var -> TyCon -> Var -> Var -> Array Int TyCon -> TyCon -> Var -> Var -> TyCon -> Var -> Var -> Var -> Var -> Array Int Var -> Array Int Type -> Array Int Type -> Array Int CoreExpr -> Array Int CoreExpr -> Array Int CoreExpr -> Array (Int, Int) CoreExpr -> Var -> Builtins
-- | PArray
[parrayTyCon] :: Builtins -> TyCon
-- | PData
[pdataTyCon] :: Builtins -> TyCon
-- | PDatas
[pdatasTyCon] :: Builtins -> TyCon
-- | PR
[prClass] :: Builtins -> Class
-- | PR
[prTyCon] :: Builtins -> TyCon
-- | PRepr
[preprTyCon] :: Builtins -> TyCon
-- | PA
[paClass] :: Builtins -> Class
-- | PA
[paTyCon] :: Builtins -> TyCon
-- | PA
[paDataCon] :: Builtins -> DataCon
-- | PA
[paPRSel] :: Builtins -> Var
-- | replicatePD
[replicatePDVar] :: Builtins -> Var
-- | replicatePD_Int# etc.
[replicatePD_PrimVars] :: Builtins -> NameEnv Var
-- | emptyPD
[emptyPDVar] :: Builtins -> Var
-- | emptyPD_Int# etc.
[emptyPD_PrimVars] :: Builtins -> NameEnv Var
-- | packByTagPD
[packByTagPDVar] :: Builtins -> Var
-- | packByTagPD_Int# etc.
[packByTagPD_PrimVars] :: Builtins -> NameEnv Var
-- | combinePD
[combinePDVars] :: Builtins -> Array Int Var
-- | combine2PD_Int# etc.
[combinePD_PrimVarss] :: Builtins -> Array Int (NameEnv Var)
-- | Scalar
[scalarClass] :: Builtins -> Class
-- | map, zipWith, zipWith3
[scalarZips] :: Builtins -> Array Int Var
-- | Void
[voidTyCon] :: Builtins -> TyCon
-- | void
[voidVar] :: Builtins -> Var
-- | fromVoid
[fromVoidVar] :: Builtins -> Var
-- | Sum2 .. Sum3
[sumTyCons] :: Builtins -> Array Int TyCon
-- | Wrap
[wrapTyCon] :: Builtins -> TyCon
-- | pvoid
[pvoidVar] :: Builtins -> Var
-- | pvoids
[pvoidsVar] :: Builtins -> Var
-- | :->
[closureTyCon] :: Builtins -> TyCon
-- | closure
[closureVar] :: Builtins -> Var
-- | liftedClosure
[liftedClosureVar] :: Builtins -> Var
-- | $:
[applyVar] :: Builtins -> Var
-- | liftedApply
[liftedApplyVar] :: Builtins -> Var
-- | closure1 .. closure3
[closureCtrFuns] :: Builtins -> Array Int Var
-- | Sel2
[selTys] :: Builtins -> Array Int Type
-- | Sels2
[selsTys] :: Builtins -> Array Int Type
-- | lengthSels2
[selsLengths] :: Builtins -> Array Int CoreExpr
-- | replicate2
[selReplicates] :: Builtins -> Array Int CoreExpr
-- | tagsSel2
[selTagss] :: Builtins -> Array Int CoreExpr
-- | elementsSel2_0 .. elementsSel_2_1
[selElementss] :: Builtins -> Array (Int, Int) CoreExpr
-- | lc
[liftingContext] :: Builtins -> Var
selTy :: Int -> Builtins -> Type
selsTy :: Int -> Builtins -> Type
selReplicate :: Int -> Builtins -> CoreExpr
selTags :: Int -> Builtins -> CoreExpr
selElements :: Int -> Int -> Builtins -> CoreExpr
selsLength :: Int -> Builtins -> CoreExpr
sumTyCon :: Int -> Builtins -> TyCon
prodTyCon :: Int -> Builtins -> TyCon
prodDataCon :: Int -> Builtins -> DataCon
replicatePD_PrimVar :: TyCon -> Builtins -> Var
emptyPD_PrimVar :: TyCon -> Builtins -> Var
packByTagPD_PrimVar :: TyCon -> Builtins -> Var
combinePDVar :: Int -> Builtins -> Var
combinePD_PrimVar :: Int -> TyCon -> Builtins -> Var
scalarZip :: Int -> Builtins -> Var
closureCtrFun :: Int -> Builtins -> Var
-- | Create the initial map of builtin types and functions.
initBuiltins :: DsM Builtins
-- | Get the mapping of names in the Prelude to names in the DPH library.
initBuiltinVars :: Builtins -> DsM [(Var, Var)]
module Vectorise.Env
-- | Indicates what scope something (a variable) is in.
data Scope a b
Global :: a -> Scope a b
Local :: b -> Scope a b
-- | The local environment.
data LocalEnv
LocalEnv :: VarEnv (Var, Var) -> [TyVar] -> VarEnv CoreExpr -> FastString -> LocalEnv
-- | Mapping from local variables to their vectorised and lifted versions.
[local_vars] :: LocalEnv -> VarEnv (Var, Var)
-- | In-scope type variables.
[local_tyvars] :: LocalEnv -> [TyVar]
-- | Mapping from tyvars to their PA dictionaries.
[local_tyvar_pa] :: LocalEnv -> VarEnv CoreExpr
-- | Local binding name. This is only used to generate better names for
-- hoisted expressions.
[local_bind_name] :: LocalEnv -> FastString
-- | Create an empty local environment.
emptyLocalEnv :: LocalEnv
-- | The global environment: entities that exist at top-level.
data GlobalEnv
GlobalEnv :: Bool -> VarEnv Var -> DVarSet -> VarEnv (Maybe (Type, CoreExpr)) -> NameEnv TyCon -> NameSet -> NameEnv DataCon -> NameEnv Var -> NameEnv Var -> InstEnvs -> FamInstEnvs -> [(Var, CoreExpr)] -> GlobalEnv
-- | True implies to avoid vectorisation as far as possible.
[global_vect_avoid] :: GlobalEnv -> Bool
-- | Mapping from global variables to their vectorised versions — aka the
-- /vectorisation map/.
[global_vars] :: GlobalEnv -> VarEnv Var
-- | The domain of global_vars.
--
-- This information is not redundant as it is impossible to extract the
-- domain from a VarEnv (which is keyed on uniques alone).
-- Moreover, we have mapped variables that do not involve parallelism —
-- e.g., the workers of vectorised, but scalar data types. In addition,
-- workers of parallel data types that we could not vectorise also need
-- to be tracked.
[global_parallel_vars] :: GlobalEnv -> DVarSet
-- | Mapping from global variables that have a vectorisation declaration to
-- the right-hand side of that declaration and its type and mapping
-- variables that have NOVECTORISE declarations to Nothing.
[global_vect_decls] :: GlobalEnv -> VarEnv (Maybe (Type, CoreExpr))
-- | Mapping from TyCons to their vectorised versions. The vectorised
-- version will be identical to the original version if it is not changed
-- by vectorisation. In any case, if a tycon appears in the domain of
-- this mapping, it was successfully vectorised.
[global_tycons] :: GlobalEnv -> NameEnv TyCon
-- | Type constructors whose definition directly or indirectly includes a
-- parallel type, such as '[::]'.
--
-- NB: This information is not redundant as some types have got a mapping
-- in global_tycons (to a type other than themselves) and are
-- still not parallel. An example is '(->)'. Moreover, some types have
-- *not* got a mapping in global_tycons (because they couldn't be
-- vectorised), but still contain parallel types.
[global_parallel_tycons] :: GlobalEnv -> NameSet
-- | Mapping from DataCons to their vectorised versions.
[global_datacons] :: GlobalEnv -> NameEnv DataCon
-- | Mapping from TyCons to their PA dfuns.
[global_pa_funs] :: GlobalEnv -> NameEnv Var
-- | Mapping from TyCons to their PR dfuns.
[global_pr_funs] :: GlobalEnv -> NameEnv Var
-- | External package inst-env & home-package inst-env for class
-- instances.
[global_inst_env] :: GlobalEnv -> InstEnvs
-- | External package inst-env & home-package inst-env for family
-- instances.
[global_fam_inst_env] :: GlobalEnv -> FamInstEnvs
-- | Hoisted bindings — temporary storage for toplevel bindings during code
-- gen.
[global_bindings] :: GlobalEnv -> [(Var, CoreExpr)]
-- | Create an initial global environment.
--
-- We add scalar variables and type constructors identified by
-- vectorisation pragmas already here to the global table, so that we can
-- query scalarness during vectorisation, and especially, when
-- vectorising the scalar entities' definitions themselves.
initGlobalEnv :: Bool -> VectInfo -> [CoreVect] -> InstEnvs -> FamInstEnvs -> GlobalEnv
-- | Extend the list of global variables in an environment.
extendImportedVarsEnv :: [(Var, Var)] -> GlobalEnv -> GlobalEnv
-- | Extend the list of type family instances.
extendFamEnv :: [FamInst] -> GlobalEnv -> GlobalEnv
-- | Set the list of PA functions in an environment.
setPAFunsEnv :: [(Name, Var)] -> GlobalEnv -> GlobalEnv
-- | Set the list of PR functions in an environment.
setPRFunsEnv :: [(Name, Var)] -> GlobalEnv -> GlobalEnv
-- | Compute vectorisation information that goes into ModGuts (and
-- is stored in interface files). The incoming vectInfo is that
-- from the HscEnv and EPS. The outgoing one contains only
-- the declarations for the currently compiled module; this includes
-- variables, type constructors, and data constructors referenced in
-- VECTORISE pragmas, even if they are defined in an imported module.
--
-- The variables explicitly include class selectors and dfuns.
modVectInfo :: GlobalEnv -> [Id] -> [TyCon] -> [CoreVect] -> VectInfo -> VectInfo
-- | The Vectorisation monad.
module Vectorise.Monad.Base
-- | Vectorisation can either succeed with new envionment and a value, or
-- return with failure (including a description of the reason for
-- failure).
data VResult a
Yes :: GlobalEnv -> LocalEnv -> a -> VResult a
No :: SDoc -> VResult a
newtype VM a
VM :: (Builtins -> GlobalEnv -> LocalEnv -> DsM (VResult a)) -> VM a
[runVM] :: VM a -> Builtins -> GlobalEnv -> LocalEnv -> DsM (VResult a)
-- | Lift a desugaring computation into the vectorisation monad.
liftDs :: DsM a -> VM a
-- | Throw a pgmError saying we can't vectorise something.
cantVectorise :: DynFlags -> String -> SDoc -> a
-- | Like fromJust, but pgmError on Nothing.
maybeCantVectorise :: DynFlags -> String -> SDoc -> Maybe a -> a
-- | Like maybeCantVectorise but in a Monad.
maybeCantVectoriseM :: (Monad m, HasDynFlags m) => String -> SDoc -> m (Maybe a) -> m a
-- | Output a trace message if -ddump-vt-trace is active.
emitVt :: String -> SDoc -> VM ()
-- | Output a trace message if -ddump-vt-trace is active.
traceVt :: String -> SDoc -> VM ()
-- | Dump the given program conditionally.
dumpOptVt :: DumpFlag -> String -> SDoc -> VM ()
-- | Dump the given program unconditionally.
dumpVt :: String -> SDoc -> VM ()
-- | Return some result saying we've failed.
noV :: SDoc -> VM a
-- | Like traceNoV but also emit some trace message to stderr.
traceNoV :: String -> SDoc -> VM a
-- | If True then carry on, otherwise fail.
ensureV :: SDoc -> Bool -> VM ()
-- | Like ensureV but if we fail then emit some trace message to
-- stderr.
traceEnsureV :: String -> SDoc -> Bool -> VM ()
-- | If True then return the first argument, otherwise fail.
onlyIfV :: SDoc -> Bool -> VM a -> VM a
-- | Try some vectorisation computaton.
--
-- If it succeeds then return Just the result; otherwise, return
-- Nothing without emitting a failure message.
tryV :: VM a -> VM (Maybe a)
-- | Try some vectorisation computaton.
--
-- If it succeeds then return Just the result; otherwise, return
-- Nothing after emitting a failure message.
tryErrV :: VM a -> VM (Maybe a)
-- | If Just then return the value, otherwise fail.
maybeV :: SDoc -> VM (Maybe a) -> VM a
-- | Like maybeV but emit a message to stderr if we fail.
traceMaybeV :: String -> SDoc -> VM (Maybe a) -> VM a
-- | Try the first computation,
--
--
-- - if it succeeds then take the returned value,
-- - if it fails then run the second computation instead without
-- emitting a failure message.
--
orElseV :: VM a -> VM a -> VM a
-- | Try the first computation,
--
--
-- - if it succeeds then take the returned value,
-- - if it fails then run the second computation instead while emitting
-- a failure message.
--
orElseErrV :: VM a -> VM a -> VM a
-- | Fixpoint in the vectorisation monad.
fixV :: (a -> VM a) -> VM a
instance GHC.Base.Monad Vectorise.Monad.Base.VM
instance GHC.Base.Applicative Vectorise.Monad.Base.VM
instance GHC.Base.Functor Vectorise.Monad.Base.VM
instance Control.Monad.IO.Class.MonadIO Vectorise.Monad.Base.VM
instance DynFlags.HasDynFlags Vectorise.Monad.Base.VM
module Vectorise.Monad.Global
-- | Project something from the global environment.
readGEnv :: (GlobalEnv -> a) -> VM a
-- | Set the value of the global environment.
setGEnv :: GlobalEnv -> VM ()
-- | Update the global environment using the provided function.
updGEnv :: (GlobalEnv -> GlobalEnv) -> VM ()
-- | Should we avoid as much vectorisation as possible?
--
-- Set by '-f[no]-vectorisation-avoidance'
isVectAvoidanceAggressive :: VM Bool
-- | Add a mapping between a global var and its vectorised version to the
-- state.
defGlobalVar :: Var -> Var -> VM ()
-- | Remove the mapping of a variable in the vectorisation map.
undefGlobalVar :: Var -> VM ()
-- | Check whether a variable has a vectorisation declaration.
--
-- The first component of the result indicates whether the variable has a
-- NOVECTORISE declaration. The second component contains the
-- given type and expression in case of a VECTORISE declaration.
lookupVectDecl :: Var -> VM (Bool, Maybe (Type, CoreExpr))
-- | Get the set of global parallel variables.
globalParallelVars :: VM DVarSet
-- | Get the set of all parallel type constructors (those that may embed
-- parallelism) including both both those parallel type constructors
-- declared in an imported module and those declared in the current
-- module.
globalParallelTyCons :: VM NameSet
-- | Determine the vectorised version of a TyCon. The vectorisation
-- map in the global environment contains a vectorised version if the
-- original TyCon embeds any parallel arrays.
lookupTyCon :: TyCon -> VM (Maybe TyCon)
-- | Add a mapping between plain and vectorised TyCons to the global
-- environment.
--
-- The second argument is only to enable tracing for (mutually)
-- recursively defined type constructors, where we must not pull
-- at the vectorised type constructors (because that would pull too early
-- at the recursive knot).
defTyConName :: TyCon -> Name -> TyCon -> VM ()
-- | Add a mapping between plain and vectorised TyCons to the global
-- environment.
defTyCon :: TyCon -> TyCon -> VM ()
-- | Get the set of all vectorised type constructors.
globalVectTyCons :: VM (NameEnv TyCon)
-- | Lookup the vectorised version of a DataCon from the global
-- environment.
lookupDataCon :: DataCon -> VM (Maybe DataCon)
-- | Add the mapping between plain and vectorised DataCons to the
-- global environment.
defDataCon :: DataCon -> DataCon -> VM ()
-- | Lookup the PA dfun of a vectorised type constructor in the
-- global environment.
lookupTyConPA :: TyCon -> VM (Maybe Var)
-- | Associate vectorised type constructors with the dfun of their
-- PA instances in the global environment.
defTyConPAs :: [(TyCon, Var)] -> VM ()
lookupTyConPR :: TyCon -> VM (Maybe Var)
module Vectorise.Monad.InstEnv
existsInst :: Class -> [Type] -> VM Bool
lookupInst :: Class -> [Type] -> VM (DFunId, [Type])
lookupFamInst :: TyCon -> [Type] -> VM FamInstMatch
module Vectorise.Monad.Local
-- | Project something from the local environment.
readLEnv :: (LocalEnv -> a) -> VM a
-- | Set the local environment.
setLEnv :: LocalEnv -> VM ()
-- | Update the environment using the provided function.
updLEnv :: (LocalEnv -> LocalEnv) -> VM ()
-- | Perform a computation in its own local environment. This does not
-- alter the environment of the current state.
localV :: VM a -> VM a
-- | Perform a computation in an empty local environment.
closedV :: VM a -> VM a
-- | Get the name of the local binding currently being vectorised.
getBindName :: VM FastString
-- | Run a vectorisation computation in a local environment, with this id
-- set as the current binding.
inBind :: Id -> VM a -> VM a
-- | Lookup a PA tyvars from the local environment.
lookupTyVarPA :: Var -> VM (Maybe CoreExpr)
-- | Add a tyvar to the local environment.
defLocalTyVar :: TyVar -> VM ()
-- | Add mapping between a tyvar and pa dictionary to the local
-- environment.
defLocalTyVarWithPA :: TyVar -> CoreExpr -> VM ()
-- | Get the set of tyvars from the local environment.
localTyVars :: VM [TyVar]
-- | Computations in the vectorisation monad concerned with naming and
-- fresh variable generation.
module Vectorise.Monad.Naming
-- | Create a localised variant of a name, using the provided function to
-- transform its OccName.
--
-- If the name external, encode the original name's module into the new
-- OccName. The result is always an internal system name.
mkLocalisedName :: (Maybe String -> OccName -> OccName) -> Name -> VM Name
mkDerivedName :: (OccName -> OccName) -> Name -> VM Name
-- | Produce the vectorised variant of an Id with the given
-- vectorised type, while taking care that vectorised dfun ids must be
-- dfuns again.
--
-- Force the new name to be a system name and, if the original was an
-- external name, disambiguate the new name with the module name of the
-- original.
mkVectId :: Id -> Type -> VM Id
-- | Make a fresh instance of this var, with a new unique.
cloneVar :: Var -> VM Var
-- | Make a fresh exported variable with the given type.
newExportedVar :: OccName -> Type -> VM Var
-- | Make a fresh local variable with the given type. The variable's name
-- is formed using the given string as the prefix.
newLocalVar :: FastString -> Type -> VM Var
-- | Make several fresh local variables with the given types. The
-- variable's names are formed using the given string as the prefix.
newLocalVars :: FastString -> [Type] -> VM [Var]
-- | Make a new local dummy variable.
newDummyVar :: Type -> VM Var
-- | Make a fresh type variable with the given kind. The variable's name is
-- formed using the given string as the prefix.
newTyVar :: FastString -> Kind -> VM Var
-- | Make a fresh coercion variable with the given kind.
newCoVar :: FastString -> Kind -> VM Var
module Vectorise.Monad
-- | Run a vectorisation computation.
initV :: HscEnv -> ModGuts -> VectInfo -> VM a -> IO (Maybe (VectInfo, a))
-- | Lift a desugaring computation using the Builtins into the
-- vectorisation monad.
liftBuiltinDs :: (Builtins -> DsM a) -> VM a
-- | Project something from the set of builtins.
builtin :: (Builtins -> a) -> VM a
-- | Lift a function using the Builtins into the vectorisation
-- monad.
builtins :: (a -> Builtins -> b) -> VM (a -> b)
-- | Lookup the vectorised, and if local, also the lifted version of a
-- variable.
--
--
-- - If it's in the global environment we get the vectorised
-- version.
-- - If it's in the local environment we get both the vectorised and
-- lifted version.
--
lookupVar :: Var -> VM (Scope Var (Var, Var))
lookupVar_maybe :: Var -> VM (Maybe (Scope Var (Var, Var)))
-- | Mark the given variable as parallel — i.e., executing the associated
-- code might involve parallel array computations.
addGlobalParallelVar :: Var -> VM ()
-- | Mark the given type constructor as parallel — i.e., its values might
-- embed parallel arrays.
addGlobalParallelTyCon :: TyCon -> VM ()
module Vectorise.Type.Classify
-- | From a list of type constructors, extract those that can be
-- vectorised, returning them in two sets, where the first result list
-- must be vectorised and the second result list need not
-- be vectorised. The third result list are those type constructors
-- that we cannot convert (either because they use language extensions or
-- because they dependent on type constructors for which no vectorised
-- version is available).
--
-- NB: In order to be able to vectorise a type constructor, we require
-- members of the depending set (i.e., those type constructors that the
-- current one depends on) to be vectorised only if they are also
-- parallel (i.e., appear in the second argument to the function).
--
-- The first argument determines the conversion status of external
-- type constructors as follows:
--
--
-- - tycons which have converted versions are mapped to
-- True
-- - tycons which are not changed by vectorisation are mapped to
-- False
-- - tycons which haven't been converted (because they can't or weren't
-- vectorised) are not elements of the map
--
classifyTyCons :: UniqFM Bool -> NameSet -> [TyCon] -> ([TyCon], [TyCon], [TyCon], [TyCon])
-- | Simple vectorised constructors and projections.
module Vectorise.Vect
-- | Contains the vectorised and lifted versions of some thing.
type Vect a = (a, a)
type VVar = Vect Var
type VExpr = Vect CoreExpr
type VBind = Vect CoreBind
-- | Get the vectorised version of a thing.
vectorised :: Vect a -> a
-- | Get the lifted version of a thing.
lifted :: Vect a -> a
-- | Apply some function to both the vectorised and lifted versions of a
-- thing.
mapVect :: (a -> b) -> Vect a -> Vect b
-- | Get the type of a vectorised variable.
vVarType :: VVar -> Type
-- | Make a vectorised non-recursive binding.
vNonRec :: VVar -> VExpr -> VBind
-- | Make a vectorised recursive binding.
vRec :: [VVar] -> [VExpr] -> VBind
-- | Wrap a vectorised variable as a vectorised expression.
vVar :: VVar -> VExpr
-- | Wrap a vectorised type as a vectorised expression.
vType :: Type -> VExpr
-- | Make a vectorised note.
vTick :: Tickish Id -> VExpr -> VExpr
-- | Make a vectorised let expression.
vLet :: VBind -> VExpr -> VExpr
-- | Make a vectorised lambda abstraction.
--
-- The lifted version also binds the lifting context lc.
vLams :: Var -> [VVar] -> VExpr -> VExpr
-- | Apply an expression to a set of argument variables.
--
-- The lifted version is also applied to the variable of the lifting
-- context.
vVarApps :: Var -> VExpr -> [VVar] -> VExpr
vCaseDEFAULT :: VExpr -> VVar -> Type -> Type -> VExpr -> VExpr
module Vectorise.Utils.Base
voidType :: VM Type
newLocalVVar :: FastString -> Type -> VM VVar
mkDataConTag :: DynFlags -> DataCon -> CoreExpr
dataConTagZ :: DataCon -> Int
-- | Make an application of the Wrap type constructor.
mkWrapType :: Type -> VM Type
-- | Make an application of the closure type constructor.
mkClosureTypes :: [Type] -> Type -> VM Type
-- | Make an application of the PRepr type constructor.
mkPReprType :: Type -> VM Type
-- | Make an application of the PData tycon to some argument.
mkPDataType :: Type -> VM Type
-- | Make an application of the PDatas tycon to some argument.
mkPDatasType :: Type -> VM Type
-- | Checks if a type constructor is defined in Prim (e.g., 'Int#');
-- if so, returns it.
splitPrimTyCon :: Type -> Maybe TyCon
-- | Make a representational coercion to some builtin type.
mkBuiltinCo :: (Builtins -> TyCon) -> VM Coercion
-- | Apply the constructor wrapper of the Wrap newtype.
wrapNewTypeBodyOfWrap :: CoreExpr -> Type -> VM CoreExpr
-- | Strip the constructor wrapper of the Wrap newtype.
unwrapNewTypeBodyOfWrap :: CoreExpr -> Type -> VM CoreExpr
-- | Apply the constructor wrapper of the PData newtype
-- instance of Wrap.
wrapNewTypeBodyOfPDataWrap :: CoreExpr -> Type -> VM CoreExpr
-- | Strip the constructor wrapper of the PData newtype
-- instance of Wrap.
unwrapNewTypeBodyOfPDataWrap :: CoreExpr -> Type -> VM CoreExpr
-- | Apply the constructor wrapper of the PDatas newtype
-- instance of Wrap.
wrapNewTypeBodyOfPDatasWrap :: CoreExpr -> Type -> VM CoreExpr
-- | Strip the constructor wrapper of the PDatas newtype
-- instance of Wrap.
unwrapNewTypeBodyOfPDatasWrap :: CoreExpr -> Type -> VM CoreExpr
-- | Get the representation tycon of the PData data family for a
-- given type.
--
-- This tycon does not appear explicitly in the source program — see Note
-- [PData TyCons] in Description:
--
--
-- pdataReprTyCon {Sum2} = {PDataSum2}
--
--
-- The type for which we look up a PData instance may be more
-- specific than the type in the instance declaration. In that case the
-- second component of the result will be more specific than a set of
-- distinct type variables.
pdataReprTyCon :: Type -> VM (TyCon, [Type])
-- | Get the representation tycon of the PData data family for a
-- given type constructor.
--
-- For example, for a binary type constructor T, we determine
-- the representation type constructor for 'PData (T a b)'.
pdataReprTyConExact :: TyCon -> VM TyCon
-- | Get the representation tycon of the PDatas data family for a
-- given type constructor.
--
-- For example, for a binary type constructor T, we determine
-- the representation type constructor for 'PDatas (T a b)'.
pdatasReprTyConExact :: TyCon -> VM TyCon
-- | Unwrap a PData representation scrutinee.
pdataUnwrapScrut :: VExpr -> VM (CoreExpr, CoreExpr, DataCon)
-- | Get the representation tycon of the PRepr type family for a
-- given type.
preprFamInst :: Type -> VM FamInstMatch
module Vectorise.Utils.PADict
-- | Construct the PA argument type for the tyvar. For the tyvar (v :: *)
-- it's just PA v. For (v :: (* -> *) -> *) it's
--
--
-- forall (a :: * -> *). (forall (b :: *). PA b -> PA (a b)) -> PA (v a)
--
paDictArgType :: TyVar -> VM (Maybe Type)
-- | Get the PA dictionary for some type
paDictOfType :: Type -> VM CoreExpr
-- | Produce code that refers to a method of the PA class.
paMethod :: (Builtins -> Var) -> (TyCon -> Builtins -> Var) -> Type -> VM CoreExpr
-- | Get the PR dictionary for a type. The argument must be a
-- representation type.
prDictOfReprType :: Type -> VM CoreExpr
-- | Given a type ty, its PRepr synonym tycon and its type
-- arguments, return the PR PRepr ty. Suppose we have:
--
--
-- type instance PRepr (T a1 ... an) = t
--
--
-- which is internally translated into
--
--
-- type :R:PRepr a1 ... an = t
--
--
-- and the corresponding coercion. Then,
--
--
-- prDictOfPReprInstTyCon (T a1 ... an) :R:PRepr u1 ... un = PR (T u1 ... un)
--
--
-- Note that ty is only used for error messages
prDictOfPReprInstTyCon :: Type -> CoAxiom Unbranched -> [Type] -> VM CoreExpr
-- | Auxiliary functions to vectorise type abstractions.
module Vectorise.Utils.Poly
-- | Vectorise under the PA dictionary variables corresponding to
-- a set of type arguments.
--
-- The dictionary variables are new local variables that are entered into
-- the local vectorisation map.
--
-- The purpose of this function is to introduce the additional
-- PA dictionary arguments that are needed when vectorising type
-- abstractions.
polyAbstract :: [TyVar] -> ([Var] -> VM a) -> VM a
-- | Apply a expression to its type arguments as well as PA
-- dictionaries for these type arguments.
polyApply :: CoreExpr -> [Type] -> VM CoreExpr
-- | Apply a vectorised expression to a set of type arguments together with
-- PA dictionaries for these type arguments.
polyVApply :: VExpr -> [Type] -> VM VExpr
-- | Determine the number of PA dictionary arguments required for
-- a set of type variables (depends on their kinds).
polyArity :: [TyVar] -> VM Int
module Vectorise.Utils.Hoisting
-- | Records whether we should inline a particular binding.
data Inline
Inline :: Arity -> Inline
DontInline :: Inline
-- | Add to the arity contained within an Inline, if any.
addInlineArity :: Inline -> Int -> Inline
-- | Says to always inline a binding.
inlineMe :: Inline
hoistBinding :: Var -> CoreExpr -> VM ()
hoistExpr :: FastString -> CoreExpr -> Inline -> VM Var
hoistVExpr :: VExpr -> Inline -> VM VVar
-- | Hoist a polymorphic vectorised expression into a new top-level binding
-- (representing a closure function).
--
-- The hoisted expression is parameterised by (1) a set of type variables
-- and (2) a set of value variables that are passed as conventional type
-- and value arguments. The latter is implicitly extended by the set of
-- PA dictionaries required for the type variables.
hoistPolyVExpr :: [TyVar] -> [Var] -> Inline -> VM VExpr -> VM VExpr
takeHoisted :: VM [(Var, CoreExpr)]
-- | Utils concerning closure construction and application.
module Vectorise.Utils.Closure
-- | Make a closure.
mkClosure :: Type -> Type -> Type -> VExpr -> VExpr -> VM VExpr
-- | Make a closure application.
mkClosureApp :: Type -> Type -> VExpr -> VExpr -> VM VExpr
-- | Build a set of n closures corresponding to an n-ary
-- vectorised function. The length of the list of types of arguments
-- determines the arity.
--
-- In addition to a set of type variables, a set of value variables is
-- passed during closure construction. In contrast, the closure
-- environment and the arguments are passed during closure application.
buildClosures :: [TyVar] -> [Var] -> [VVar] -> [Type] -> Type -> VM VExpr -> VM VExpr
module Vectorise.Utils
collectAnnTypeArgs :: AnnExpr b ann -> (AnnExpr b ann, [Type])
collectAnnDictArgs :: AnnExpr Var ann -> (AnnExpr Var ann, [AnnExpr Var ann])
collectAnnTypeBinders :: AnnExpr Var ann -> ([Var], AnnExpr Var ann)
-- | Collect all consecutive value binders that are not dictionaries.
collectAnnValBinders :: AnnExpr Var ann -> ([Var], AnnExpr Var ann)
isAnnTypeArg :: AnnExpr b ann -> Bool
-- | Produce an array containing copies of a given element.
replicatePD :: CoreExpr -> CoreExpr -> VM CoreExpr
-- | An empty array of the given type.
emptyPD :: Type -> VM CoreExpr
-- | Select some elements from an array that correspond to a particular tag
-- value and pack them into a new array.
--
--
-- packByTagPD Int# [:23, 42, 95, 50, 27, 49:] 3 [:1, 2, 1, 2, 3, 2:] 2
-- ==> [:42, 50, 49:]
--
packByTagPD :: Type -> CoreExpr -> CoreExpr -> CoreExpr -> CoreExpr -> VM CoreExpr
-- | Combine some arrays based on a selector. The selector says which
-- source array to choose for each element of the resulting array.
combinePD :: Type -> CoreExpr -> CoreExpr -> [CoreExpr] -> VM CoreExpr
-- | Like replicatePD but use the lifting context in the vectoriser
-- state.
liftPD :: CoreExpr -> VM CoreExpr
isScalar :: Type -> VM Bool
zipScalars :: [Type] -> Type -> VM CoreExpr
scalarClosure :: [Type] -> Type -> CoreExpr -> CoreExpr -> VM CoreExpr
-- | Make a fresh local variable with the given type. The variable's name
-- is formed using the given string as the prefix.
newLocalVar :: FastString -> Type -> VM Var
module Vectorise.Type.Type
-- | Vectorise a type constructor. Unless there is a vectorised version
-- (stripped of embedded parallel arrays), the vectorised version is the
-- same as the original.
vectTyCon :: TyCon -> VM TyCon
-- | Produce the vectorised and lifted versions of a type.
--
-- NB: Here we are limited to properly handle predicates at the toplevel
-- only. Anything embedded in what is called the body_ty below
-- will end up as an argument to the type family PData.
vectAndLiftType :: Type -> VM (Type, Type)
-- | Vectorise a type.
--
-- For each quantified var we need to add a PA dictionary out the front
-- of the type. So forall a. C a => a -> a turns into forall a. PA
-- a => Cv a => a :-> a
vectType :: Type -> VM Type
-- | Vectorise variables and literals.
module Vectorise.Var
-- | Vectorise a binder variable, along with its attached type.
vectBndr :: Var -> VM VVar
-- | Vectorise a binder variable, along with its attached type, but give
-- the result a new name.
vectBndrNew :: Var -> FastString -> VM VVar
-- | Vectorise a binder then run a computation with that binder in scope.
vectBndrIn :: Var -> VM a -> VM (VVar, a)
-- | Vectorise a binder, give it a new name, then run a computation with
-- that binder in scope.
vectBndrNewIn :: Var -> FastString -> VM a -> VM (VVar, a)
-- | Vectorise some binders, then run a computation with them in scope.
vectBndrsIn :: [Var] -> VM a -> VM ([VVar], a)
-- | Vectorise a variable, producing the vectorised and lifted versions.
vectVar :: Var -> VM VExpr
-- | Constants are lifted by replication along the integer context in the
-- VM state for the number of elements in the result array.
vectConst :: CoreExpr -> VM VExpr
module Vectorise.Type.TyConDecl
-- | Vectorise some (possibly recursively defined) type constructors.
vectTyConDecls :: [TyCon] -> VM [TyCon]
module Vectorise.Convert
-- | Convert a vectorised expression such that it computes the
-- non-vectorised equivalent of its value.
--
-- For functions, we eta expand the function and convert the arguments
-- and result:
fromVect :: Type -> CoreExpr -> VM CoreExpr
-- | Compute a description of the generic representation that we use for a
-- user defined data type.
--
-- During vectorisation, we generate a PRepr and PA instance for each
-- user defined data type. The PA dictionary contains methods to convert
-- the user type to and from our generic representation. This module
-- computes a description of what that generic representation is.
module Vectorise.Generic.Description
-- | Describes the representation type of a data constructor field.
data CompRepr
Keep :: Type -> CoreExpr -> CompRepr
Wrap :: Type -> CompRepr
-- | Describes the representation type of the fields / components of a
-- constructor. If the data constructor has multiple fields then we
-- bundle them together into a generic product type.
data ProdRepr
-- | Data constructor has no fields.
EmptyProd :: ProdRepr
-- | Data constructor has a single field.
UnaryProd :: CompRepr -> ProdRepr
-- | Data constructor has several fields.
Prod :: TyCon -> TyCon -> TyCon -> [Type] -> [CompRepr] -> ProdRepr
-- | Representation tycon for the product (eg Tuple2)
[repr_tup_tc] :: ProdRepr -> TyCon
-- | PData version of the product tycon (eg PDataTuple2)
[repr_ptup_tc] :: ProdRepr -> TyCon
-- | PDatas version of the product tycon (eg PDatasTuple2s) Not all lifted
-- backends use PDatas.
[repr_ptups_tc] :: ProdRepr -> TyCon
-- | Types of each field.
[repr_comp_tys] :: ProdRepr -> [Type]
-- | Generic representation types for each field.
[repr_comps] :: ProdRepr -> [CompRepr]
-- | Describes the representation type of a data constructor.
data ConRepr
ConRepr :: DataCon -> ProdRepr -> ConRepr
[repr_dc] :: ConRepr -> DataCon
[repr_prod] :: ConRepr -> ProdRepr
-- | Describes the generic representation of a data type. If the data type
-- has multiple constructors then we bundle them together into a generic
-- sum type.
data SumRepr
-- | Data type has no data constructors.
EmptySum :: SumRepr
-- | Data type has a single constructor.
UnarySum :: ConRepr -> SumRepr
-- | Data type has multiple constructors.
Sum :: TyCon -> TyCon -> TyCon -> Type -> Type -> CoreExpr -> [Type] -> [ConRepr] -> SumRepr
-- | Representation tycon for the sum (eg Sum2)
[repr_sum_tc] :: SumRepr -> TyCon
-- | PData version of the sum tycon (eg PDataSum2) This TyCon doesn't
-- appear explicitly in the source program. See Note [PData TyCons].
[repr_psum_tc] :: SumRepr -> TyCon
-- | PDatas version of the sum tycon (eg PDatasSum2)
[repr_psums_tc] :: SumRepr -> TyCon
-- | Type of the selector (eg Sel2)
[repr_sel_ty] :: SumRepr -> Type
-- | Type of multi-selector (eg Sel2s)
[repr_sels_ty] :: SumRepr -> Type
-- | Function to get the length of a Sels of this type.
[repr_selsLength_v] :: SumRepr -> CoreExpr
-- | Type of each data constructor.
[repr_con_tys] :: SumRepr -> [Type]
-- | Generic representation types of each data constructor.
[repr_cons] :: SumRepr -> [ConRepr]
-- | Determine the generic representation of a data type, given its tycon.
tyConRepr :: TyCon -> VM SumRepr
-- | Yield the type of this sum representation.
sumReprType :: SumRepr -> VM Type
-- | Yield the original component type of a data constructor component
-- representation.
compOrigType :: CompRepr -> Type
instance Outputable.Outputable Vectorise.Generic.Description.SumRepr
instance Outputable.Outputable Vectorise.Generic.Description.ConRepr
instance Outputable.Outputable Vectorise.Generic.Description.ProdRepr
instance Outputable.Outputable Vectorise.Generic.Description.CompRepr
-- | Build instance tycons for the PData and PDatas type families.
--
-- TODO: the PData and PDatas cases are very similar. We should be able
-- to factor out the common parts.
module Vectorise.Generic.PData
-- | Build the PData instance tycon for a given type constructor.
buildPDataTyCon :: TyCon -> TyCon -> SumRepr -> VM FamInst
-- | Build the PDatas instance tycon for a given type constructor.
buildPDatasTyCon :: TyCon -> TyCon -> SumRepr -> VM FamInst
-- | Generate methods for the PA class.
--
-- TODO: there is a large amount of redundancy here between the a, PData
-- a, and PDatas a forms. See if we can factor some of this out.
module Vectorise.Generic.PAMethods
buildPReprTyCon :: TyCon -> TyCon -> SumRepr -> VM FamInst
buildPAScAndMethods :: VM [(String, PAInstanceBuilder)]
module Vectorise.Generic.PADict
-- | Build the PA dictionary function for some type and hoist it to top
-- level.
--
-- The PA dictionary holds fns that convert values to and from their
-- vectorised representations.
--
-- @Recall the definition: class PR (PRepr a) => PA a where toPRepr ::
-- a -> PRepr a fromPRepr :: PRepr a -> a toArrPRepr :: PData a
-- -> PData (PRepr a) fromArrPRepr :: PData (PRepr a) -> PData a
-- toArrPReprs :: PDatas a -> PDatas (PRepr a) fromArrPReprs :: PDatas
-- (PRepr a) -> PDatas a
--
-- Example: df :: forall a. PR (PRepr a) -> PA a -> PA (T a) df =
-- /a. (c:PR (PRepr a)) (d:PA a). MkPA c ($PR_df a d) ($toPRepr a d) ...
-- $dPR_df :: forall a. PA a -> PR (PRepr (T a)) $dPR_df = ....
-- $toRepr :: forall a. PA a -> T a -> PRepr (T a) $toPRepr = ...
-- The "..." stuff is filled in by buildPAScAndMethods @
buildPADict :: TyCon -> CoAxiom Unbranched -> TyCon -> TyCon -> SumRepr -> VM Var
module Vectorise.Type.Env
-- | Vectorise type constructor including class type constructors.
vectTypeEnv :: [TyCon] -> [CoreVect] -> [CoreVect] -> VM ([TyCon], [FamInst], [(Var, CoreExpr)])
-- | Vectorisation of expressions.
module Vectorise.Exp
-- | Vectorise a polymorphic expression that forms a *non-recursive*
-- binding.
--
-- Return Nothing if the expression is scalar; otherwise, the
-- first component of the result (which is of type Bool) indicates
-- whether the expression is parallel (i.e., whether it is tagged as
-- VIParr).
--
-- We have got the non-recursive case as a special case as it doesn't
-- require to compute vectorisation information twice.
vectTopExpr :: Var -> CoreExpr -> VM (Maybe (Bool, Inline, CoreExpr))
-- | Vectorise a recursive group of top-level polymorphic expressions.
--
-- Return Nothing if the expression group is scalar; otherwise,
-- the first component of the result (which is of type Bool)
-- indicates whether the expressions are parallel (i.e., whether they are
-- tagged as VIParr).
vectTopExprs :: [(Var, CoreExpr)] -> VM (Maybe (Bool, [(Inline, CoreExpr)]))
-- | Vectorise an expression of functional type, where all arguments and
-- the result are of primitive types (i.e., Int, Float,
-- Double etc., which have instances of the Scalar type
-- class) and which does not contain any subcomputations that involve
-- parallel arrays. Such functionals do not require the full blown
-- vectorisation transformation; instead, they can be lifted by
-- application of a member of the zipWith family (i.e., map,
-- zipWith, zipWith3', etc.)
--
-- Dictionary functions are also scalar functions (as dictionaries
-- themselves are not vectorised, instead they become dictionaries of
-- vectorised methods). We treat them differently, though see "Note
-- [Scalar dfuns]" in Vectorise.
vectScalarFun :: CoreExpr -> VM VExpr
-- | Vectorise a dictionary function that has a 'VECTORISE SCALAR instance'
-- pragma.
--
-- In other words, all methods in that dictionary are scalar functions —
-- to be vectorised with vectScalarFun. The dictionary "function"
-- itself may be a constant, though.
--
-- NB: You may think that we could implement this function guided by the
-- struture of the Core expression of the right-hand side of the
-- dictionary function. We cannot proceed like this as
-- vectScalarDFun must also work for *imported* dfuns, where we
-- don't necessarily have access to the Core code of the unvectorised
-- dfun.
--
-- Here an example — assume,
--
--
-- class Eq a where { (==) :: a -> a -> Bool }
-- instance (Eq a, Eq b) => Eq (a, b) where { (==) = ... }
-- {-# VECTORISE SCALAR instance Eq (a, b) }
--
--
-- The unvectorised dfun for the above instance has the following
-- signature:
--
--
-- $dEqPair :: forall a b. Eq a -> Eq b -> Eq (a, b)
--
--
-- We generate the following (scalar) vectorised dfun (liberally using TH
-- notation):
--
--
-- $v$dEqPair :: forall a b. V:Eq a -> V:Eq b -> V:Eq (a, b)
-- $v$dEqPair = /\a b -> \dEqa :: V:Eq a -> \dEqb :: V:Eq b ->
-- D:V:Eq $(vectScalarFun True recFns
-- [| (==) @(a, b) ($dEqPair @a @b $(unVect dEqa) $(unVect dEqb)) |])
--
--
-- NB: * '(,)' vectorises to '(,)' — hence, the type constructor in the
-- result type remains the same. * We share the '$(unVect di)'
-- sub-expressions between the different selectors, but duplicate the
-- application of the unvectorised dfun, to enable the dictionary
-- selection rules to fire.
vectScalarDFun :: Var -> VM CoreExpr
instance GHC.Show.Show Vectorise.Exp.VectAvoidInfo
instance GHC.Classes.Eq Vectorise.Exp.VectAvoidInfo
module Vectorise
-- | Vectorise a single module.
vectorise :: ModGuts -> CoreM ModGuts
module WwLib
mkWwBodies :: DynFlags -> FamInstEnvs -> VarSet -> Maybe JoinArity -> Type -> [Demand] -> DmdResult -> UniqSM (Maybe WwResult)
mkWWstr :: DynFlags -> FamInstEnvs -> [Var] -> UniqSM (Bool, [Var], CoreExpr -> CoreExpr, CoreExpr -> CoreExpr)
mkWorkerArgs :: DynFlags -> [Var] -> Type -> ([Var], [Var])
deepSplitProductType_maybe :: FamInstEnvs -> Type -> Maybe (DataCon, [Type], [(Type, StrictnessMark)], Coercion)
findTypeShape :: FamInstEnvs -> Type -> TypeShape
isWorkerSmallEnough :: DynFlags -> [Var] -> Bool
module WorkWrap
wwTopBinds :: DynFlags -> FamInstEnvs -> UniqSupply -> CoreProgram -> CoreProgram
module SpecConstr
specConstrProgram :: ModGuts -> CoreM ModGuts
data SpecConstrAnnotation :: *
NoSpecConstr :: SpecConstrAnnotation
ForceSpecConstr :: SpecConstrAnnotation
instance Outputable.Outputable SpecConstr.ScUsage
instance Outputable.Outputable SpecConstr.ArgOcc
instance Outputable.Outputable SpecConstr.Call
instance Outputable.Outputable SpecConstr.HowBound
instance Outputable.Outputable SpecConstr.Value
module DmdAnal
dmdAnalProgram :: DynFlags -> FamInstEnvs -> CoreProgram -> IO CoreProgram
instance Outputable.Outputable DmdAnal.AnalEnv
module SimplCore
core2core :: HscEnv -> ModGuts -> IO ModGuts
simplifyExpr :: DynFlags -> CoreExpr -> IO CoreExpr
module X86.Cond
data Cond
ALWAYS :: Cond
EQQ :: Cond
GE :: Cond
GEU :: Cond
GTT :: Cond
GU :: Cond
LE :: Cond
LEU :: Cond
LTT :: Cond
LU :: Cond
NE :: Cond
NEG :: Cond
POS :: Cond
CARRY :: Cond
OFLO :: Cond
PARITY :: Cond
NOTPARITY :: Cond
condUnsigned :: Cond -> Bool
condToSigned :: Cond -> Cond
condToUnsigned :: Cond -> Cond
-- | maybeFlipCond c returns Just c' if it is possible to
-- flip the arguments to the conditional c, and the new
-- condition should be c'.
maybeFlipCond :: Cond -> Maybe Cond
instance GHC.Classes.Eq X86.Cond.Cond
module X86.Regs
-- | regSqueeze_class reg Calculuate the maximum number of register colors
-- that could be denied to a node of this class due to having this reg as
-- a neighbour.
virtualRegSqueeze :: RegClass -> VirtualReg -> Int
realRegSqueeze :: RegClass -> RealReg -> Int
data Imm
ImmInt :: Int -> Imm
ImmInteger :: Integer -> Imm
ImmCLbl :: CLabel -> Imm
ImmLit :: SDoc -> Imm
ImmIndex :: CLabel -> Int -> Imm
ImmFloat :: Rational -> Imm
ImmDouble :: Rational -> Imm
ImmConstantSum :: Imm -> Imm -> Imm
ImmConstantDiff :: Imm -> Imm -> Imm
strImmLit :: String -> Imm
litToImm :: CmmLit -> Imm
data AddrMode
AddrBaseIndex :: EABase -> EAIndex -> Displacement -> AddrMode
ImmAddr :: Imm -> Int -> AddrMode
addrOffset :: AddrMode -> Int -> Maybe AddrMode
spRel :: DynFlags -> Int -> AddrMode
argRegs :: RegNo -> [Reg]
allArgRegs :: Platform -> [(Reg, Reg)]
allIntArgRegs :: Platform -> [Reg]
-- | these are the regs which we cannot assume stay alive over a C call.
callClobberedRegs :: Platform -> [Reg]
instrClobberedRegs :: Platform -> [Reg]
-- | The complete set of machine registers.
allMachRegNos :: Platform -> [RegNo]
-- | Take the class of a register.
classOfRealReg :: Platform -> RealReg -> RegClass
-- | Get the name of the register with this number.
showReg :: Platform -> RegNo -> String
data EABase
EABaseNone :: EABase
EABaseReg :: Reg -> EABase
EABaseRip :: EABase
data EAIndex
EAIndexNone :: EAIndex
EAIndex :: Reg -> Int -> EAIndex
addrModeRegs :: AddrMode -> [Reg]
eax :: Reg
ebx :: Reg
ecx :: Reg
edx :: Reg
esi :: Reg
edi :: Reg
ebp :: Reg
esp :: Reg
fake0 :: Reg
fake1 :: Reg
fake2 :: Reg
fake3 :: Reg
fake4 :: Reg
fake5 :: Reg
firstfake :: RegNo
rax :: Reg
rbx :: Reg
rcx :: Reg
rdx :: Reg
rsi :: Reg
rdi :: Reg
rbp :: Reg
rsp :: Reg
r8 :: Reg
r9 :: Reg
r10 :: Reg
r11 :: Reg
r12 :: Reg
r13 :: Reg
r14 :: Reg
r15 :: Reg
xmm0 :: Reg
xmm1 :: Reg
xmm2 :: Reg
xmm3 :: Reg
xmm4 :: Reg
xmm5 :: Reg
xmm6 :: Reg
xmm7 :: Reg
xmm8 :: Reg
xmm9 :: Reg
xmm10 :: Reg
xmm11 :: Reg
xmm12 :: Reg
xmm13 :: Reg
xmm14 :: Reg
xmm15 :: Reg
xmm :: RegNo -> Reg
ripRel :: Displacement -> AddrMode
allFPArgRegs :: Platform -> [Reg]
allocatableRegs :: Platform -> [RealReg]
module X86.RegInfo
mkVirtualReg :: Unique -> Format -> VirtualReg
regDotColor :: Platform -> RealReg -> SDoc
-- | Hard wired things related to registers. This is module is preventing
-- the native code generator being able to emit code for non-host
-- architectures.
--
-- TODO: Do a better job of the overloading, and eliminate this module.
-- We'd probably do better with a Register type class, and hook this to
-- Instruction somehow.
--
-- TODO: We should also make arch specific versions of
-- RegAlloc.Graph.TrivColorable
module TargetReg
targetVirtualRegSqueeze :: Platform -> RegClass -> VirtualReg -> Int
targetRealRegSqueeze :: Platform -> RegClass -> RealReg -> Int
targetClassOfRealReg :: Platform -> RealReg -> RegClass
targetMkVirtualReg :: Platform -> Unique -> Format -> VirtualReg
targetRegDotColor :: Platform -> RealReg -> SDoc
targetClassOfReg :: Platform -> Reg -> RegClass
module X86.Instr
data Instr
COMMENT :: FastString -> Instr
LOCATION :: Int -> Int -> Int -> String -> Instr
LDATA :: Section -> (Alignment, CmmStatics) -> Instr
NEWBLOCK :: BlockId -> Instr
UNWIND :: CLabel -> UnwindTable -> Instr
DELTA :: Int -> Instr
MOV :: Format -> Operand -> Operand -> Instr
CMOV :: Cond -> Format -> Operand -> Reg -> Instr
MOVZxL :: Format -> Operand -> Operand -> Instr
MOVSxL :: Format -> Operand -> Operand -> Instr
LEA :: Format -> Operand -> Operand -> Instr
ADD :: Format -> Operand -> Operand -> Instr
ADC :: Format -> Operand -> Operand -> Instr
SUB :: Format -> Operand -> Operand -> Instr
SBB :: Format -> Operand -> Operand -> Instr
MUL :: Format -> Operand -> Operand -> Instr
MUL2 :: Format -> Operand -> Instr
IMUL :: Format -> Operand -> Operand -> Instr
IMUL2 :: Format -> Operand -> Instr
DIV :: Format -> Operand -> Instr
IDIV :: Format -> Operand -> Instr
ADD_CC :: Format -> Operand -> Operand -> Instr
SUB_CC :: Format -> Operand -> Operand -> Instr
AND :: Format -> Operand -> Operand -> Instr
OR :: Format -> Operand -> Operand -> Instr
XOR :: Format -> Operand -> Operand -> Instr
NOT :: Format -> Operand -> Instr
NEGI :: Format -> Operand -> Instr
BSWAP :: Format -> Reg -> Instr
SHL :: Format -> Operand -> Operand -> Instr
SAR :: Format -> Operand -> Operand -> Instr
SHR :: Format -> Operand -> Operand -> Instr
BT :: Format -> Imm -> Operand -> Instr
NOP :: Instr
GMOV :: Reg -> Reg -> Instr
GLD :: Format -> AddrMode -> Reg -> Instr
GST :: Format -> Reg -> AddrMode -> Instr
GLDZ :: Reg -> Instr
GLD1 :: Reg -> Instr
GFTOI :: Reg -> Reg -> Instr
GDTOI :: Reg -> Reg -> Instr
GITOF :: Reg -> Reg -> Instr
GITOD :: Reg -> Reg -> Instr
GDTOF :: Reg -> Reg -> Instr
GADD :: Format -> Reg -> Reg -> Reg -> Instr
GDIV :: Format -> Reg -> Reg -> Reg -> Instr
GSUB :: Format -> Reg -> Reg -> Reg -> Instr
GMUL :: Format -> Reg -> Reg -> Reg -> Instr
GCMP :: Cond -> Reg -> Reg -> Instr
GABS :: Format -> Reg -> Reg -> Instr
GNEG :: Format -> Reg -> Reg -> Instr
GSQRT :: Format -> Reg -> Reg -> Instr
GSIN :: Format -> CLabel -> CLabel -> Reg -> Reg -> Instr
GCOS :: Format -> CLabel -> CLabel -> Reg -> Reg -> Instr
GTAN :: Format -> CLabel -> CLabel -> Reg -> Reg -> Instr
GFREE :: Instr
CVTSS2SD :: Reg -> Reg -> Instr
CVTSD2SS :: Reg -> Reg -> Instr
CVTTSS2SIQ :: Format -> Operand -> Reg -> Instr
CVTTSD2SIQ :: Format -> Operand -> Reg -> Instr
CVTSI2SS :: Format -> Operand -> Reg -> Instr
CVTSI2SD :: Format -> Operand -> Reg -> Instr
FDIV :: Format -> Operand -> Operand -> Instr
SQRT :: Format -> Operand -> Reg -> Instr
TEST :: Format -> Operand -> Operand -> Instr
CMP :: Format -> Operand -> Operand -> Instr
SETCC :: Cond -> Operand -> Instr
PUSH :: Format -> Operand -> Instr
POP :: Format -> Operand -> Instr
JMP :: Operand -> [Reg] -> Instr
JXX :: Cond -> BlockId -> Instr
JXX_GBL :: Cond -> Imm -> Instr
JMP_TBL :: Operand -> [Maybe BlockId] -> Section -> CLabel -> Instr
CALL :: (Either Imm Reg) -> [Reg] -> Instr
CLTD :: Format -> Instr
FETCHGOT :: Reg -> Instr
FETCHPC :: Reg -> Instr
POPCNT :: Format -> Operand -> Reg -> Instr
BSF :: Format -> Operand -> Reg -> Instr
BSR :: Format -> Operand -> Reg -> Instr
PREFETCH :: PrefetchVariant -> Format -> Operand -> Instr
LOCK :: Instr -> Instr
XADD :: Format -> Operand -> Operand -> Instr
CMPXCHG :: Format -> Operand -> Operand -> Instr
MFENCE :: Instr
data Operand
OpReg :: Reg -> Operand
OpImm :: Imm -> Operand
OpAddr :: AddrMode -> Operand
data PrefetchVariant
NTA :: PrefetchVariant
Lvl0 :: PrefetchVariant
Lvl1 :: PrefetchVariant
Lvl2 :: PrefetchVariant
data JumpDest
getJumpDestBlockId :: JumpDest -> Maybe BlockId
canShortcut :: Instr -> Maybe JumpDest
shortcutStatics :: (BlockId -> Maybe JumpDest) -> (Alignment, CmmStatics) -> (Alignment, CmmStatics)
shortcutJump :: (BlockId -> Maybe JumpDest) -> Instr -> Instr
i386_insert_ffrees :: [GenBasicBlock Instr] -> [GenBasicBlock Instr]
allocMoreStack :: Platform -> Int -> NatCmmDecl statics Instr -> UniqSM (NatCmmDecl statics Instr)
maxSpillSlots :: DynFlags -> Int
archWordFormat :: Bool -> Format
instance Instruction.Instruction X86.Instr.Instr
module X86.Ppr
pprNatCmmDecl :: NatCmmDecl (Alignment, CmmStatics) Instr -> SDoc
pprData :: CmmStatic -> SDoc
pprInstr :: Instr -> SDoc
pprFormat :: Format -> SDoc
pprImm :: Imm -> SDoc
pprDataItem :: CmmLit -> SDoc
instance Outputable.Outputable X86.Instr.Instr
module SPARC.Instr
-- | Register or immediate
data RI
RIReg :: Reg -> RI
RIImm :: Imm -> RI
-- | Check if a RI represents a zero value. - a literal zero - register
-- %g0, which is always zero.
riZero :: RI -> Bool
-- | Calculate the effective address which would be used by the
-- corresponding fpRel sequence.
fpRelEA :: Int -> Reg -> Instr
-- | Code to shift the stack pointer by n words.
moveSp :: Int -> Instr
-- | An instruction that will cause the one after it never to be exectuted
isUnconditionalJump :: Instr -> Bool
-- | SPARC instruction set. Not complete. This is only the ones we need.
data Instr
COMMENT :: FastString -> Instr
LDATA :: Section -> CmmStatics -> Instr
NEWBLOCK :: BlockId -> Instr
DELTA :: Int -> Instr
LD :: Format -> AddrMode -> Reg -> Instr
ST :: Format -> Reg -> AddrMode -> Instr
ADD :: Bool -> Bool -> Reg -> RI -> Reg -> Instr
SUB :: Bool -> Bool -> Reg -> RI -> Reg -> Instr
UMUL :: Bool -> Reg -> RI -> Reg -> Instr
SMUL :: Bool -> Reg -> RI -> Reg -> Instr
UDIV :: Bool -> Reg -> RI -> Reg -> Instr
SDIV :: Bool -> Reg -> RI -> Reg -> Instr
RDY :: Reg -> Instr
WRY :: Reg -> Reg -> Instr
AND :: Bool -> Reg -> RI -> Reg -> Instr
ANDN :: Bool -> Reg -> RI -> Reg -> Instr
OR :: Bool -> Reg -> RI -> Reg -> Instr
ORN :: Bool -> Reg -> RI -> Reg -> Instr
XOR :: Bool -> Reg -> RI -> Reg -> Instr
XNOR :: Bool -> Reg -> RI -> Reg -> Instr
SLL :: Reg -> RI -> Reg -> Instr
SRL :: Reg -> RI -> Reg -> Instr
SRA :: Reg -> RI -> Reg -> Instr
SETHI :: Imm -> Reg -> Instr
NOP :: Instr
FABS :: Format -> Reg -> Reg -> Instr
FADD :: Format -> Reg -> Reg -> Reg -> Instr
FCMP :: Bool -> Format -> Reg -> Reg -> Instr
FDIV :: Format -> Reg -> Reg -> Reg -> Instr
FMOV :: Format -> Reg -> Reg -> Instr
FMUL :: Format -> Reg -> Reg -> Reg -> Instr
FNEG :: Format -> Reg -> Reg -> Instr
FSQRT :: Format -> Reg -> Reg -> Instr
FSUB :: Format -> Reg -> Reg -> Reg -> Instr
FxTOy :: Format -> Format -> Reg -> Reg -> Instr
BI :: Cond -> Bool -> BlockId -> Instr
BF :: Cond -> Bool -> BlockId -> Instr
JMP :: AddrMode -> Instr
JMP_TBL :: AddrMode -> [Maybe BlockId] -> CLabel -> Instr
CALL :: (Either Imm Reg) -> Int -> Bool -> Instr
-- | The maximum number of spill slots available on the C stack. If we use
-- up all of the slots, then we're screwed.
--
-- Why do we reserve 64 bytes, instead of using the whole thing?? -- BL
-- 20090215
maxSpillSlots :: DynFlags -> Int
instance Instruction.Instruction SPARC.Instr.Instr
module SPARC.ShortcutJump
data JumpDest
DestBlockId :: BlockId -> JumpDest
DestImm :: Imm -> JumpDest
getJumpDestBlockId :: JumpDest -> Maybe BlockId
canShortcut :: Instr -> Maybe JumpDest
shortcutJump :: (BlockId -> Maybe JumpDest) -> Instr -> Instr
shortcutStatics :: (BlockId -> Maybe JumpDest) -> CmmStatics -> CmmStatics
shortBlockId :: (BlockId -> Maybe JumpDest) -> BlockId -> CLabel
module SPARC.Ppr
pprNatCmmDecl :: NatCmmDecl CmmStatics Instr -> SDoc
pprBasicBlock :: LabelMap CmmStatics -> NatBasicBlock Instr -> SDoc
pprData :: CmmStatic -> SDoc
-- | Pretty print an instruction.
pprInstr :: Instr -> SDoc
-- | Pretty print a format for an instruction suffix.
pprFormat :: Format -> SDoc
-- | Pretty print an immediate value.
pprImm :: Imm -> SDoc
-- | Pretty print a data item.
pprDataItem :: CmmLit -> SDoc
instance Outputable.Outputable SPARC.Instr.Instr
-- | One ounce of sanity checking is worth 10000000000000000 ounces of
-- staring blindly at assembly code trying to find the problem..
module SPARC.CodeGen.Sanity
-- | Enforce intra-block invariants.
checkBlock :: CmmBlock -> NatBasicBlock Instr -> NatBasicBlock Instr
-- | Expand out synthetic instructions into single machine instrs.
module SPARC.CodeGen.Expand
-- | Expand out synthetic instructions in this top level thing
expandTop :: NatCmmDecl CmmStatics Instr -> NatCmmDecl CmmStatics Instr
module SPARC.CodeGen.Base
-- | InstrBlocks are the insn sequences generated by the insn
-- selectors. They are really trees of insns to facilitate fast
-- appending, where a left-to-right traversal yields the insns in the
-- correct order.
type InstrBlock = OrdList Instr
-- | Condition codes passed up the tree.
data CondCode
CondCode :: Bool -> Cond -> InstrBlock -> CondCode
-- | a.k.a Register64 Reg is the lower 32-bit temporary which
-- contains the result. Use getHiVRegFromLo to find the other VRegUnique.
--
-- Rules of this simplified insn selection game are therefore that the
-- returned Reg may be modified
data ChildCode64
ChildCode64 :: InstrBlock -> Reg -> ChildCode64
-- | Holds code that references a memory address.
data Amode
Amode :: AddrMode -> InstrBlock -> Amode
-- | Code to produce a result into a register. If the result must go in a
-- specific register, it comes out as Fixed. Otherwise, the parent can
-- decide which register to put it in.
data Register
Fixed :: Format -> Reg -> InstrBlock -> Register
Any :: Format -> (Reg -> InstrBlock) -> Register
-- | Change the format field in a Register.
setFormatOfRegister :: Register -> Format -> Register
-- | Grab the Reg for a CmmReg
getRegisterReg :: Platform -> CmmReg -> Reg
mangleIndexTree :: DynFlags -> CmmExpr -> CmmExpr
-- | Carries interesting info for debugging / profiling of the graph
-- coloring register allocator.
module RegAlloc.Graph.Stats
-- | Holds interesting statistics from the register allocator.
data RegAllocStats statics instr
RegAllocStatsStart :: [LiveCmmDecl statics instr] -> Graph VirtualReg RegClass RealReg -> SpillCostInfo -> RegAllocStats statics instr
-- | Initial code, with liveness.
[raLiveCmm] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
-- | The initial, uncolored graph.
[raGraph] :: RegAllocStats statics instr -> Graph VirtualReg RegClass RealReg
-- | Information to help choose which regs to spill.
[raSpillCosts] :: RegAllocStats statics instr -> SpillCostInfo
RegAllocStatsSpill :: [LiveCmmDecl statics instr] -> Graph VirtualReg RegClass RealReg -> UniqFM VirtualReg -> SpillStats -> SpillCostInfo -> [LiveCmmDecl statics instr] -> RegAllocStats statics instr
-- | Code we tried to allocate registers for.
[raCode] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
-- | The initial, uncolored graph.
[raGraph] :: RegAllocStats statics instr -> Graph VirtualReg RegClass RealReg
-- | The regs that were coalesced.
[raCoalesced] :: RegAllocStats statics instr -> UniqFM VirtualReg
-- | Spiller stats.
[raSpillStats] :: RegAllocStats statics instr -> SpillStats
-- | Information to help choose which regs to spill.
[raSpillCosts] :: RegAllocStats statics instr -> SpillCostInfo
-- | Code with spill instructions added.
[raSpilled] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
RegAllocStatsColored :: [LiveCmmDecl statics instr] -> Graph VirtualReg RegClass RealReg -> Graph VirtualReg RegClass RealReg -> UniqFM VirtualReg -> [LiveCmmDecl statics instr] -> [LiveCmmDecl statics instr] -> [LiveCmmDecl statics instr] -> [NatCmmDecl statics instr] -> (Int, Int, Int) -> RegAllocStats statics instr
-- | Code we tried to allocate registers for.
[raCode] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
-- | The initial, uncolored graph.
[raGraph] :: RegAllocStats statics instr -> Graph VirtualReg RegClass RealReg
-- | Coalesced and colored graph.
[raGraphColored] :: RegAllocStats statics instr -> Graph VirtualReg RegClass RealReg
-- | The regs that were coalesced.
[raCoalesced] :: RegAllocStats statics instr -> UniqFM VirtualReg
-- | Code with coalescings applied.
[raCodeCoalesced] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
-- | Code with vregs replaced by hregs.
[raPatched] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
-- | Code with unneeded spill/reloads cleaned out.
[raSpillClean] :: RegAllocStats statics instr -> [LiveCmmDecl statics instr]
-- | Final code.
[raFinal] :: RegAllocStats statics instr -> [NatCmmDecl statics instr]
-- | Spill/reload/reg-reg moves present in this code.
[raSRMs] :: RegAllocStats statics instr -> (Int, Int, Int)
-- | Do all the different analysis on this list of RegAllocStats
pprStats :: [RegAllocStats statics instr] -> Graph VirtualReg RegClass RealReg -> SDoc
-- | Dump a table of how many spill loads / stores were inserted for each
-- vreg.
pprStatsSpills :: [RegAllocStats statics instr] -> SDoc
-- | Dump a table of how long vregs tend to live for in the initial code.
pprStatsLifetimes :: [RegAllocStats statics instr] -> SDoc
-- | Dump a table of how many conflicts vregs tend to have in the initial
-- code.
pprStatsConflict :: [RegAllocStats statics instr] -> SDoc
-- | For every vreg, dump it's how many conflicts it has and its lifetime
-- good for making a scatter plot.
pprStatsLifeConflict :: [RegAllocStats statics instr] -> Graph VirtualReg RegClass RealReg -> SDoc
-- | Count spillreloadreg-reg moves. Lets us see how well the
-- register allocator has done.
countSRMs :: Instruction instr => LiveCmmDecl statics instr -> (Int, Int, Int)
addSRM :: (Int, Int, Int) -> (Int, Int, Int) -> (Int, Int, Int)
instance (Outputable.Outputable statics, Outputable.Outputable instr) => Outputable.Outputable (RegAlloc.Graph.Stats.RegAllocStats statics instr)
-- | Graph coloring register allocator.
module RegAlloc.Graph.Main
-- | The top level of the graph coloring register allocator.
regAlloc :: (Outputable statics, Outputable instr, Instruction instr) => DynFlags -> UniqFM (UniqSet RealReg) -> UniqSet Int -> [LiveCmmDecl statics instr] -> UniqSM ([NatCmmDecl statics instr], [RegAllocStats statics instr])
module PPC.Instr
archWordFormat :: Bool -> Format
data RI
RIReg :: Reg -> RI
RIImm :: Imm -> RI
data Instr
COMMENT :: FastString -> Instr
LDATA :: Section -> CmmStatics -> Instr
NEWBLOCK :: BlockId -> Instr
DELTA :: Int -> Instr
LD :: Format -> Reg -> AddrMode -> Instr
LDFAR :: Format -> Reg -> AddrMode -> Instr
LA :: Format -> Reg -> AddrMode -> Instr
ST :: Format -> Reg -> AddrMode -> Instr
STFAR :: Format -> Reg -> AddrMode -> Instr
STU :: Format -> Reg -> AddrMode -> Instr
LIS :: Reg -> Imm -> Instr
LI :: Reg -> Imm -> Instr
MR :: Reg -> Reg -> Instr
CMP :: Format -> Reg -> RI -> Instr
CMPL :: Format -> Reg -> RI -> Instr
BCC :: Cond -> BlockId -> Instr
BCCFAR :: Cond -> BlockId -> Instr
JMP :: CLabel -> Instr
MTCTR :: Reg -> Instr
BCTR :: [Maybe BlockId] -> (Maybe CLabel) -> Instr
BL :: CLabel -> [Reg] -> Instr
BCTRL :: [Reg] -> Instr
ADD :: Reg -> Reg -> RI -> Instr
ADDO :: Reg -> Reg -> Reg -> Instr
ADDC :: Reg -> Reg -> Reg -> Instr
ADDE :: Reg -> Reg -> Reg -> Instr
ADDZE :: Reg -> Reg -> Instr
ADDIS :: Reg -> Reg -> Imm -> Instr
SUBF :: Reg -> Reg -> Reg -> Instr
SUBFO :: Reg -> Reg -> Reg -> Instr
SUBFC :: Reg -> Reg -> RI -> Instr
SUBFE :: Reg -> Reg -> Reg -> Instr
MULL :: Format -> Reg -> Reg -> RI -> Instr
MULLO :: Format -> Reg -> Reg -> Reg -> Instr
MFOV :: Format -> Reg -> Instr
MULHU :: Format -> Reg -> Reg -> Reg -> Instr
DIV :: Format -> Bool -> Reg -> Reg -> Reg -> Instr
AND :: Reg -> Reg -> RI -> Instr
ANDC :: Reg -> Reg -> Reg -> Instr
OR :: Reg -> Reg -> RI -> Instr
ORIS :: Reg -> Reg -> Imm -> Instr
XOR :: Reg -> Reg -> RI -> Instr
XORIS :: Reg -> Reg -> Imm -> Instr
EXTS :: Format -> Reg -> Reg -> Instr
CNTLZ :: Format -> Reg -> Reg -> Instr
NEG :: Reg -> Reg -> Instr
NOT :: Reg -> Reg -> Instr
SL :: Format -> Reg -> Reg -> RI -> Instr
SR :: Format -> Reg -> Reg -> RI -> Instr
SRA :: Format -> Reg -> Reg -> RI -> Instr
RLWINM :: Reg -> Reg -> Int -> Int -> Int -> Instr
CLRLI :: Format -> Reg -> Reg -> Int -> Instr
CLRRI :: Format -> Reg -> Reg -> Int -> Instr
FADD :: Format -> Reg -> Reg -> Reg -> Instr
FSUB :: Format -> Reg -> Reg -> Reg -> Instr
FMUL :: Format -> Reg -> Reg -> Reg -> Instr
FDIV :: Format -> Reg -> Reg -> Reg -> Instr
FABS :: Reg -> Reg -> Instr
FNEG :: Reg -> Reg -> Instr
FCMP :: Reg -> Reg -> Instr
FCTIWZ :: Reg -> Reg -> Instr
FCTIDZ :: Reg -> Reg -> Instr
FCFID :: Reg -> Reg -> Instr
FRSP :: Reg -> Reg -> Instr
CRNOR :: Int -> Int -> Int -> Instr
MFCR :: Reg -> Instr
MFLR :: Reg -> Instr
FETCHPC :: Reg -> Instr
LWSYNC :: Instr
NOP :: Instr
UPDATE_SP :: Format -> Imm -> Instr
-- | The size of a minimal stackframe header including minimal parameter
-- save area.
stackFrameHeaderSize :: DynFlags -> Int
-- | The number of spill slots available without allocating more.
maxSpillSlots :: DynFlags -> Int
allocMoreStack :: Platform -> Int -> NatCmmDecl statics Instr -> UniqSM (NatCmmDecl statics Instr)
makeFarBranches :: LabelMap CmmStatics -> [NatBasicBlock Instr] -> [NatBasicBlock Instr]
instance Instruction.Instruction PPC.Instr.Instr
module PPC.RegInfo
data JumpDest
DestBlockId :: BlockId -> JumpDest
getJumpDestBlockId :: JumpDest -> Maybe BlockId
canShortcut :: Instr -> Maybe JumpDest
shortcutJump :: (BlockId -> Maybe JumpDest) -> Instr -> Instr
shortcutStatics :: (BlockId -> Maybe JumpDest) -> CmmStatics -> CmmStatics
module PPC.Ppr
pprNatCmmDecl :: NatCmmDecl CmmStatics Instr -> SDoc
instance Outputable.Outputable PPC.Instr.Instr
module NCGMonad
data NatM_State
NatM_State :: UniqSupply -> Int -> [(CLabel)] -> Maybe Reg -> DynFlags -> Module -> ModLocation -> DwarfFiles -> LabelMap DebugBlock -> NatM_State
[natm_us] :: NatM_State -> UniqSupply
[natm_delta] :: NatM_State -> Int
[natm_imports] :: NatM_State -> [(CLabel)]
[natm_pic] :: NatM_State -> Maybe Reg
[natm_dflags] :: NatM_State -> DynFlags
[natm_this_module] :: NatM_State -> Module
[natm_modloc] :: NatM_State -> ModLocation
[natm_fileid] :: NatM_State -> DwarfFiles
[natm_debug_map] :: NatM_State -> LabelMap DebugBlock
mkNatM_State :: UniqSupply -> Int -> DynFlags -> Module -> ModLocation -> DwarfFiles -> LabelMap DebugBlock -> NatM_State
data NatM result
initNat :: NatM_State -> NatM a -> (a, NatM_State)
addImportNat :: CLabel -> NatM ()
getUniqueNat :: NatM Unique
mapAccumLNat :: (acc -> x -> NatM (acc, y)) -> acc -> [x] -> NatM (acc, [y])
setDeltaNat :: Int -> NatM ()
getDeltaNat :: NatM Int
getThisModuleNat :: NatM Module
getBlockIdNat :: NatM BlockId
getNewLabelNat :: NatM CLabel
getNewRegNat :: Format -> NatM Reg
getNewRegPairNat :: Format -> NatM (Reg, Reg)
getPicBaseMaybeNat :: NatM (Maybe Reg)
getPicBaseNat :: Format -> NatM Reg
getDynFlags :: HasDynFlags m => m DynFlags
getModLoc :: NatM ModLocation
getFileId :: FastString -> NatM Int
getDebugBlock :: Label -> NatM (Maybe DebugBlock)
type DwarfFiles = UniqFM (FastString, Int)
instance GHC.Base.Functor NCGMonad.NatM
instance GHC.Base.Applicative NCGMonad.NatM
instance GHC.Base.Monad NCGMonad.NatM
instance UniqSupply.MonadUnique NCGMonad.NatM
instance DynFlags.HasDynFlags NCGMonad.NatM
module SPARC.CodeGen.CondCode
getCondCode :: CmmExpr -> NatM CondCode
condIntCode :: Cond -> CmmExpr -> CmmExpr -> NatM CondCode
condFltCode :: Cond -> CmmExpr -> CmmExpr -> NatM CondCode
module SPARC.CodeGen.Amode
-- | Generate code to reference a memory address.
getAmode :: CmmExpr -> NatM Amode
-- | Evaluation of 64 bit values on 32 bit platforms.
module SPARC.CodeGen.Gen64
-- | Code to assign a 64 bit value to memory.
assignMem_I64Code :: CmmExpr -> CmmExpr -> NatM InstrBlock
-- | Code to assign a 64 bit value to a register.
assignReg_I64Code :: CmmReg -> CmmExpr -> NatM InstrBlock
-- | Get the value of an expression into a 64 bit register.
iselExpr64 :: CmmExpr -> NatM ChildCode64
-- | Evaluation of 32 bit values.
module SPARC.CodeGen.Gen32
-- | The dual to getAnyReg: compute an expression into a register, but we
-- don't mind which one it is.
getSomeReg :: CmmExpr -> NatM (Reg, InstrBlock)
-- | Make code to evaluate a 32 bit expression.
getRegister :: CmmExpr -> NatM Register
module PIC
cmmMakeDynamicReference :: CmmMakeDynamicReferenceM m => DynFlags -> ReferenceKind -> CLabel -> m CmmExpr
class Monad m => CmmMakeDynamicReferenceM m
addImport :: CmmMakeDynamicReferenceM m => CLabel -> m ()
getThisModule :: CmmMakeDynamicReferenceM m => m Module
data ReferenceKind
DataReference :: ReferenceKind
CallReference :: ReferenceKind
JumpReference :: ReferenceKind
needImportedSymbols :: DynFlags -> Arch -> OS -> Bool
pprImportedSymbol :: DynFlags -> Platform -> CLabel -> SDoc
pprGotDeclaration :: DynFlags -> Arch -> OS -> SDoc
initializePicBase_ppc :: Arch -> OS -> Reg -> [NatCmmDecl CmmStatics Instr] -> NatM [NatCmmDecl CmmStatics Instr]
initializePicBase_x86 :: Arch -> OS -> Reg -> [NatCmmDecl (Alignment, CmmStatics) Instr] -> NatM [NatCmmDecl (Alignment, CmmStatics) Instr]
instance GHC.Classes.Eq PIC.ReferenceKind
instance PIC.CmmMakeDynamicReferenceM NCGMonad.NatM
module X86.CodeGen
cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl (Alignment, CmmStatics) Instr]
generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl (Alignment, CmmStatics) Instr)
extractUnwindPoints :: [Instr] -> [UnwindPoint]
-- | InstrBlocks are the insn sequences generated by the insn
-- selectors. They are really trees of insns to facilitate fast
-- appending, where a left-to-right traversal yields the insns in the
-- correct order.
type InstrBlock = OrdList Instr
module SPARC.CodeGen
-- | Top level code generation
cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl CmmStatics Instr]
generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl CmmStatics Instr)
-- | InstrBlocks are the insn sequences generated by the insn
-- selectors. They are really trees of insns to facilitate fast
-- appending, where a left-to-right traversal yields the insns in the
-- correct order.
type InstrBlock = OrdList Instr
module PPC.CodeGen
-- | InstrBlocks are the insn sequences generated by the insn
-- selectors. They are really trees of insns to facilitate fast
-- appending, where a left-to-right traversal (pre-order?) yields the
-- insns in the correct order.
cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl CmmStatics Instr]
generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl CmmStatics Instr)
-- | InstrBlocks are the insn sequences generated by the insn
-- selectors. They are really trees of insns to facilitate fast
-- appending, where a left-to-right traversal yields the insns in the
-- correct order.
type InstrBlock = OrdList Instr
-- | Free regs map for x86_64
module RegAlloc.Linear.X86_64.FreeRegs
newtype FreeRegs
FreeRegs :: Word64 -> FreeRegs
noFreeRegs :: FreeRegs
releaseReg :: RealReg -> FreeRegs -> FreeRegs
initFreeRegs :: Platform -> FreeRegs
getFreeRegs :: Platform -> RegClass -> FreeRegs -> [RealReg]
allocateReg :: RealReg -> FreeRegs -> FreeRegs
instance GHC.Show.Show RegAlloc.Linear.X86_64.FreeRegs.FreeRegs
-- | Free regs map for i386
module RegAlloc.Linear.X86.FreeRegs
newtype FreeRegs
FreeRegs :: Word32 -> FreeRegs
noFreeRegs :: FreeRegs
releaseReg :: RealReg -> FreeRegs -> FreeRegs
initFreeRegs :: Platform -> FreeRegs
getFreeRegs :: Platform -> RegClass -> FreeRegs -> [RealReg]
allocateReg :: RealReg -> FreeRegs -> FreeRegs
instance GHC.Show.Show RegAlloc.Linear.X86.FreeRegs.FreeRegs
module RegAlloc.Linear.FreeRegs
class Show freeRegs => FR freeRegs
frAllocateReg :: FR freeRegs => Platform -> RealReg -> freeRegs -> freeRegs
frGetFreeRegs :: FR freeRegs => Platform -> RegClass -> freeRegs -> [RealReg]
frInitFreeRegs :: FR freeRegs => Platform -> freeRegs
frReleaseReg :: FR freeRegs => Platform -> RealReg -> freeRegs -> freeRegs
maxSpillSlots :: DynFlags -> Int
instance RegAlloc.Linear.FreeRegs.FR RegAlloc.Linear.X86.FreeRegs.FreeRegs
instance RegAlloc.Linear.FreeRegs.FR RegAlloc.Linear.X86_64.FreeRegs.FreeRegs
instance RegAlloc.Linear.FreeRegs.FR RegAlloc.Linear.PPC.FreeRegs.FreeRegs
instance RegAlloc.Linear.FreeRegs.FR RegAlloc.Linear.SPARC.FreeRegs.FreeRegs
-- | Handles joining of a jump instruction to its targets.
module RegAlloc.Linear.JoinToTargets
-- | For a jump instruction at the end of a block, generate fixup code so
-- its vregs are in the correct regs for its destination.
joinToTargets :: (FR freeRegs, Instruction instr) => BlockMap RegSet -> BlockId -> instr -> RegM freeRegs ([NatBasicBlock instr], instr)
module RegAlloc.Linear.Main
regAlloc :: (Outputable instr, Instruction instr) => DynFlags -> LiveCmmDecl statics instr -> UniqSM (NatCmmDecl statics instr, Maybe Int, Maybe RegAllocStats)
-- | Constants describing the DWARF format. Most of this simply mirrors
-- usrinclude/dwarf.h.
module Dwarf.Constants
-- | Language ID used for Haskell.
dW_LANG_Haskell :: Word
dW_TAG_compile_unit :: Word
dW_TAG_subroutine_type :: Word
dW_TAG_file_type :: Word
dW_TAG_subprogram :: Word
dW_TAG_lexical_block :: Word
dW_TAG_base_type :: Word
dW_TAG_structure_type :: Word
dW_TAG_pointer_type :: Word
dW_TAG_array_type :: Word
dW_TAG_subrange_type :: Word
dW_TAG_typedef :: Word
dW_TAG_variable :: Word
dW_TAG_arg_variable :: Word
dW_TAG_auto_variable :: Word
dW_TAG_ghc_src_note :: Word
dW_AT_name :: Word
dW_AT_stmt_list :: Word
dW_AT_low_pc :: Word
dW_AT_high_pc :: Word
dW_AT_language :: Word
dW_AT_comp_dir :: Word
dW_AT_producer :: Word
dW_AT_external :: Word
dW_AT_frame_base :: Word
dW_AT_use_UTF8 :: Word
dW_AT_MIPS_linkage_name :: Word
dW_AT_ghc_tick_parent :: Word
dW_AT_ghc_span_file :: Word
dW_AT_ghc_span_start_line :: Word
dW_AT_ghc_span_start_col :: Word
dW_AT_ghc_span_end_line :: Word
dW_AT_ghc_span_end_col :: Word
dW_CHILDREN_no :: Word8
dW_CHILDREN_yes :: Word8
dW_FORM_addr :: Word
dW_FORM_data2 :: Word
dW_FORM_data4 :: Word
dW_FORM_string :: Word
dW_FORM_flag :: Word
dW_FORM_block1 :: Word
dW_FORM_ref4 :: Word
dW_FORM_ref_addr :: Word
dW_FORM_flag_present :: Word
dW_ATE_address :: Word
dW_ATE_boolean :: Word
dW_ATE_float :: Word
dW_ATE_signed :: Word
dW_ATE_signed_char :: Word
dW_ATE_unsigned :: Word
dW_ATE_unsigned_char :: Word
dW_CFA_set_loc :: Word8
dW_CFA_undefined :: Word8
dW_CFA_same_value :: Word8
dW_CFA_def_cfa :: Word8
dW_CFA_def_cfa_offset :: Word8
dW_CFA_def_cfa_expression :: Word8
dW_CFA_expression :: Word8
dW_CFA_offset_extended_sf :: Word8
dW_CFA_def_cfa_offset_sf :: Word8
dW_CFA_def_cfa_sf :: Word8
dW_CFA_val_offset :: Word8
dW_CFA_val_expression :: Word8
dW_CFA_offset :: Word8
dW_OP_addr :: Word8
dW_OP_deref :: Word8
dW_OP_consts :: Word8
dW_OP_minus :: Word8
dW_OP_mul :: Word8
dW_OP_plus :: Word8
dW_OP_lit0 :: Word8
dW_OP_breg0 :: Word8
dW_OP_call_frame_cfa :: Word8
dwarfInfoSection :: SDoc
dwarfAbbrevSection :: SDoc
dwarfLineSection :: SDoc
dwarfFrameSection :: SDoc
dwarfGhcSection :: SDoc
dwarfARangesSection :: SDoc
dwarfSection :: String -> SDoc
dwarfInfoLabel :: LitString
dwarfAbbrevLabel :: LitString
dwarfLineLabel :: LitString
dwarfFrameLabel :: LitString
-- | Mapping of registers to DWARF register numbers
dwarfRegNo :: Platform -> Reg -> Word8
-- | Virtual register number to use for return address.
dwarfReturnRegNo :: Platform -> Word8
module Dwarf.Types
-- | Individual dwarf records. Each one will be encoded as an entry in the
-- .debug_info section.
data DwarfInfo
DwarfCompileUnit :: [DwarfInfo] -> String -> String -> String -> CLabel -> CLabel -> LitString -> DwarfInfo
[dwChildren] :: DwarfInfo -> [DwarfInfo]
[dwName] :: DwarfInfo -> String
[dwProducer] :: DwarfInfo -> String
[dwCompDir] :: DwarfInfo -> String
[dwLowLabel] :: DwarfInfo -> CLabel
[dwHighLabel] :: DwarfInfo -> CLabel
[dwLineLabel] :: DwarfInfo -> LitString
DwarfSubprogram :: [DwarfInfo] -> String -> CLabel -> Maybe CLabel -> DwarfInfo
[dwChildren] :: DwarfInfo -> [DwarfInfo]
[dwName] :: DwarfInfo -> String
[dwLabel] :: DwarfInfo -> CLabel
-- | label of DIE belonging to the parent tick
[dwParent] :: DwarfInfo -> Maybe CLabel
DwarfBlock :: [DwarfInfo] -> CLabel -> Maybe CLabel -> DwarfInfo
[dwChildren] :: DwarfInfo -> [DwarfInfo]
[dwLabel] :: DwarfInfo -> CLabel
[dwMarker] :: DwarfInfo -> Maybe CLabel
DwarfSrcNote :: RealSrcSpan -> DwarfInfo
[dwSrcSpan] :: DwarfInfo -> RealSrcSpan
-- | Generate assembly for DWARF data
pprDwarfInfo :: Bool -> DwarfInfo -> SDoc
-- | Abbreviation declaration. This explains the binary encoding we use for
-- representing DwarfInfo. Be aware that this must be updated
-- along with pprDwarfInfo.
pprAbbrevDecls :: Bool -> SDoc
-- | A DWARF address range. This is used by the debugger to quickly locate
-- which compilation unit a given address belongs to. This type assumes a
-- non-segmented address-space.
data DwarfARange
DwarfARange :: CLabel -> CLabel -> DwarfARange
[dwArngStartLabel] :: DwarfARange -> CLabel
[dwArngEndLabel] :: DwarfARange -> CLabel
-- | Print assembler directives corresponding to a DWARF
-- .debug_aranges address table entry.
pprDwarfARanges :: [DwarfARange] -> Unique -> SDoc
-- | Information about unwind instructions for a procedure. This
-- corresponds to a "Common Information Entry" (CIE) in DWARF.
data DwarfFrame
DwarfFrame :: CLabel -> UnwindTable -> [DwarfFrameProc] -> DwarfFrame
[dwCieLabel] :: DwarfFrame -> CLabel
[dwCieInit] :: DwarfFrame -> UnwindTable
[dwCieProcs] :: DwarfFrame -> [DwarfFrameProc]
-- | Unwind instructions for an individual procedure. Corresponds to a
-- "Frame Description Entry" (FDE) in DWARF.
data DwarfFrameProc
DwarfFrameProc :: CLabel -> Bool -> [DwarfFrameBlock] -> DwarfFrameProc
[dwFdeProc] :: DwarfFrameProc -> CLabel
[dwFdeHasInfo] :: DwarfFrameProc -> Bool
-- | List of blocks. Order must match asm!
[dwFdeBlocks] :: DwarfFrameProc -> [DwarfFrameBlock]
-- | Unwind instructions for a block. Will become part of the containing
-- FDE.
data DwarfFrameBlock
DwarfFrameBlock :: Bool -> [UnwindPoint] -> DwarfFrameBlock
[dwFdeBlkHasInfo] :: DwarfFrameBlock -> Bool
-- | these unwind points must occur in the same order as they occur in the
-- block
[dwFdeUnwind] :: DwarfFrameBlock -> [UnwindPoint]
-- | Header for the .debug_frame section. Here we emit the "Common
-- Information Entry" record that etablishes general call frame
-- parameters and the default stack layout.
pprDwarfFrame :: DwarfFrame -> SDoc
-- | Assembly for a single byte of constant DWARF data
pprByte :: Word8 -> SDoc
-- | Assembly for a two-byte constant integer
pprHalf :: Word16 -> SDoc
-- | Assembly for 4 bytes of dynamic DWARF data
pprData4' :: SDoc -> SDoc
-- | Assembly for a DWARF word of dynamic data. This means 32 bit, as we
-- are generating 32 bit DWARF.
pprDwWord :: SDoc -> SDoc
-- | Assembly for a machine word of dynamic data. Depends on the
-- architecture we are currently generating code for.
pprWord :: SDoc -> SDoc
-- | Prints a number in "little endian base 128" format. The idea is to
-- optimize for small numbers by stopping once all further bytes would be
-- 0. The highest bit in every byte signals whether there are further
-- bytes to read.
pprLEBWord :: Word -> SDoc
-- | Same as pprLEBWord, but for a signed number
pprLEBInt :: Int -> SDoc
-- | Align assembly at (machine) word boundary
wordAlign :: SDoc
-- | Generate an offset into another section. This is tricky because this
-- is handled differently depending on platform: Mac Os expects us to
-- calculate the offset using assembler arithmetic. Linux expects us to
-- just reference the target directly, and will figure out on their own
-- that we actually need an offset. Finally, Windows has a special
-- directive to refer to relative offsets. Fun.
sectionOffset :: SDoc -> SDoc -> SDoc
instance GHC.Enum.Enum Dwarf.Types.DwarfAbbrev
instance GHC.Classes.Eq Dwarf.Types.DwarfAbbrev
instance Outputable.Outputable Dwarf.Types.DwarfFrameBlock
module Dwarf
-- | Generate DWARF/debug information
dwarfGen :: DynFlags -> ModLocation -> UniqSupply -> [DebugBlock] -> IO (SDoc, UniqSupply)
module AsmCodeGen
nativeCodeGen :: DynFlags -> Module -> ModLocation -> Handle -> UniqSupply -> Stream IO RawCmmGroup () -> IO UniqSupply
-- | Complete native code generation phase for a single top-level chunk of
-- Cmm. Dumping the output of each stage along the way. Global conflict
-- graph and NGC stats
cmmNativeGen :: (Outputable statics, Outputable instr, Instruction instr) => DynFlags -> Module -> ModLocation -> NcgImpl statics instr jumpDest -> UniqSupply -> DwarfFiles -> LabelMap DebugBlock -> RawCmmDecl -> Int -> IO (UniqSupply, DwarfFiles, [NatCmmDecl statics instr], [CLabel], Maybe [RegAllocStats statics instr], Maybe [RegAllocStats], LabelMap [UnwindPoint])
data NcgImpl statics instr jumpDest
NcgImpl :: (RawCmmDecl -> NatM [NatCmmDecl statics instr]) -> (instr -> Maybe (NatCmmDecl statics instr)) -> (jumpDest -> Maybe BlockId) -> (instr -> Maybe jumpDest) -> ((BlockId -> Maybe jumpDest) -> statics -> statics) -> ((BlockId -> Maybe jumpDest) -> instr -> instr) -> (NatCmmDecl statics instr -> SDoc) -> Int -> [RealReg] -> ([NatCmmDecl statics instr] -> [NatCmmDecl statics instr]) -> ([NatCmmDecl statics instr] -> [NatCmmDecl statics instr]) -> (Int -> NatCmmDecl statics instr -> UniqSM (NatCmmDecl statics instr)) -> (LabelMap CmmStatics -> [NatBasicBlock instr] -> [NatBasicBlock instr]) -> ([instr] -> [UnwindPoint]) -> NcgImpl statics instr jumpDest
[cmmTopCodeGen] :: NcgImpl statics instr jumpDest -> RawCmmDecl -> NatM [NatCmmDecl statics instr]
[generateJumpTableForInstr] :: NcgImpl statics instr jumpDest -> instr -> Maybe (NatCmmDecl statics instr)
[getJumpDestBlockId] :: NcgImpl statics instr jumpDest -> jumpDest -> Maybe BlockId
[canShortcut] :: NcgImpl statics instr jumpDest -> instr -> Maybe jumpDest
[shortcutStatics] :: NcgImpl statics instr jumpDest -> (BlockId -> Maybe jumpDest) -> statics -> statics
[shortcutJump] :: NcgImpl statics instr jumpDest -> (BlockId -> Maybe jumpDest) -> instr -> instr
[pprNatCmmDecl] :: NcgImpl statics instr jumpDest -> NatCmmDecl statics instr -> SDoc
[maxSpillSlots] :: NcgImpl statics instr jumpDest -> Int
[allocatableRegs] :: NcgImpl statics instr jumpDest -> [RealReg]
[ncg_x86fp_kludge] :: NcgImpl statics instr jumpDest -> [NatCmmDecl statics instr] -> [NatCmmDecl statics instr]
[ncgExpandTop] :: NcgImpl statics instr jumpDest -> [NatCmmDecl statics instr] -> [NatCmmDecl statics instr]
[ncgAllocMoreStack] :: NcgImpl statics instr jumpDest -> Int -> NatCmmDecl statics instr -> UniqSM (NatCmmDecl statics instr)
[ncgMakeFarBranches] :: NcgImpl statics instr jumpDest -> LabelMap CmmStatics -> [NatBasicBlock instr] -> [NatBasicBlock instr]
-- | given the instruction sequence of a block, produce a list of the
-- block's UnwindPoints See Note [What is this unwinding
-- business?] in Debug and Note [Unwinding information in the NCG] in
-- this module.
[extractUnwindPoints] :: NcgImpl statics instr jumpDest -> [instr] -> [UnwindPoint]
x86NcgImpl :: DynFlags -> NcgImpl (Alignment, CmmStatics) Instr JumpDest
instance GHC.Base.Functor AsmCodeGen.CmmOptM
instance GHC.Base.Applicative AsmCodeGen.CmmOptM
instance GHC.Base.Monad AsmCodeGen.CmmOptM
instance PIC.CmmMakeDynamicReferenceM AsmCodeGen.CmmOptM
instance DynFlags.HasDynFlags AsmCodeGen.CmmOptM
module CodeOutput
codeOutput :: DynFlags -> Module -> FilePath -> ModLocation -> ForeignStubs -> [(ForeignSrcLang, String)] -> [InstalledUnitId] -> Stream IO RawCmmGroup () -> IO (FilePath, (Bool, Maybe FilePath), [(ForeignSrcLang, FilePath)])
outputForeignStubs :: DynFlags -> Module -> ModLocation -> ForeignStubs -> IO (Bool, Maybe FilePath)
-- | Main API for compiling plain Haskell source code.
--
-- This module implements compilation of a Haskell source. It is
-- not concerned with preprocessing of source files; this is
-- handled in DriverPipeline.
--
-- There are various entry points depending on what mode we're in:
-- "batch" mode (--make), "one-shot" mode (-c,
-- -S etc.), and "interactive" mode (GHCi). There are also entry
-- points for individual passes: parsing, typechecking/renaming,
-- desugaring, and simplification.
--
-- All the functions here take an HscEnv as a parameter, but none
-- of them return a new one: HscEnv is treated as an immutable
-- value from here on in (although it has mutable components, for the
-- caches).
--
-- We use the Hsc monad to deal with warning messages consistently:
-- specifically, while executing within an Hsc monad, warnings are
-- collected. When a Hsc monad returns to an IO monad, the warnings are
-- printed, or compilation aborts if the -Werror flag is
-- enabled.
--
-- (c) The GRASP/AQUA Project, Glasgow University, 1993-2000
module HscMain
newHscEnv :: DynFlags -> IO HscEnv
type Messager = HscEnv -> (Int, Int) -> RecompileRequired -> ModSummary -> IO ()
batchMsg :: Messager
-- | Status of a compilation to hard-code
data HscStatus
HscNotGeneratingCode :: HscStatus
HscUpToDate :: HscStatus
HscUpdateBoot :: HscStatus
HscUpdateSig :: HscStatus
HscRecomp :: CgGuts -> ModSummary -> HscStatus
hscIncrementalCompile :: Bool -> Maybe TcGblEnv -> Maybe Messager -> HscEnv -> ModSummary -> SourceModified -> Maybe ModIface -> (Int, Int) -> IO (HscStatus, HomeModInfo)
hscCompileCmmFile :: HscEnv -> FilePath -> FilePath -> IO ()
-- | Compile to hard-code.
hscGenHardCode :: HscEnv -> CgGuts -> ModSummary -> FilePath -> IO (FilePath, Maybe FilePath, [(ForeignSrcLang, FilePath)])
hscInteractive :: HscEnv -> CgGuts -> ModSummary -> IO (Maybe FilePath, CompiledByteCode, [SptEntry])
-- | parse a file, returning the abstract syntax
hscParse :: HscEnv -> ModSummary -> IO HsParsedModule
-- | Rename and typecheck a module, additionally returning the renamed
-- syntax
hscTypecheckRename :: HscEnv -> ModSummary -> HsParsedModule -> IO (TcGblEnv, RenamedStuff)
-- | Convert a typechecked module to Core
hscDesugar :: HscEnv -> ModSummary -> TcGblEnv -> IO ModGuts
-- | Make a ModDetails from the results of typechecking. Used when
-- typechecking only, as opposed to full compilation.
makeSimpleDetails :: HscEnv -> TcGblEnv -> IO ModDetails
hscSimplify :: HscEnv -> ModGuts -> IO ModGuts
-- | Check that a module is safe to import.
--
-- We return True to indicate the import is safe and False otherwise
-- although in the False case an exception may be thrown first.
hscCheckSafe :: HscEnv -> Module -> SrcSpan -> IO Bool
-- | Return if a module is trusted and the pkgs it depends on to be
-- trusted.
hscGetSafe :: HscEnv -> Module -> SrcSpan -> IO (Bool, Set InstalledUnitId)
hscParseIdentifier :: HscEnv -> String -> IO (Located RdrName)
hscTcRcLookupName :: HscEnv -> Name -> IO (Maybe TyThing)
hscTcRnGetInfo :: HscEnv -> Name -> IO (Maybe (TyThing, Fixity, [ClsInst], [FamInst]))
hscIsGHCiMonad :: HscEnv -> String -> IO Name
hscGetModuleInterface :: HscEnv -> Module -> IO ModIface
-- | Rename some import declarations
hscRnImportDecls :: HscEnv -> [LImportDecl RdrName] -> IO GlobalRdrEnv
-- | Lookup things in the compiler's environment
hscTcRnLookupRdrName :: HscEnv -> Located RdrName -> IO [Name]
-- | Compile a stmt all the way to an HValue, but don't run it
--
-- We return Nothing to indicate an empty statement (or comment only),
-- not a parse error.
hscStmt :: HscEnv -> String -> IO (Maybe ([Id], ForeignHValue, FixityEnv))
-- | Compile a stmt all the way to an HValue, but don't run it
--
-- We return Nothing to indicate an empty statement (or comment only),
-- not a parse error.
hscStmtWithLocation :: HscEnv -> String -> String -> Int -> IO (Maybe ([Id], ForeignHValue, FixityEnv))
hscParsedStmt :: HscEnv -> GhciLStmt RdrName -> IO (Maybe ([Id], ForeignHValue, FixityEnv))
-- | Compile a decls
hscDecls :: HscEnv -> String -> IO ([TyThing], InteractiveContext)
-- | Compile a decls
hscDeclsWithLocation :: HscEnv -> String -> String -> Int -> IO ([TyThing], InteractiveContext)
-- | Typecheck an expression (but don't run it)
hscTcExpr :: HscEnv -> TcRnExprMode -> String -> IO Type
-- | How should we infer a type? See Note [TcRnExprMode]
data TcRnExprMode
-- | Instantiate the type fully (:type)
TM_Inst :: TcRnExprMode
-- | Do not instantiate the type (:type +v)
TM_NoInst :: TcRnExprMode
-- | Default the type eagerly (:type +d)
TM_Default :: TcRnExprMode
hscImport :: HscEnv -> String -> IO (ImportDecl RdrName)
-- | Find the kind of a type Currently this does *not* generalise the kinds
-- of the type
hscKcType :: HscEnv -> Bool -> String -> IO (Type, Kind)
hscParseExpr :: String -> Hsc (LHsExpr RdrName)
hscCompileCoreExpr :: HscEnv -> SrcSpan -> CoreExpr -> IO ForeignHValue
hscCompileCoreExpr' :: HscEnv -> SrcSpan -> CoreExpr -> IO ForeignHValue
hscParse' :: ModSummary -> Hsc HsParsedModule
hscSimplify' :: ModGuts -> Hsc ModGuts
hscDesugar' :: ModLocation -> TcGblEnv -> Hsc ModGuts
tcRnModule' :: HscEnv -> ModSummary -> Bool -> HsParsedModule -> Hsc TcGblEnv
getHscEnv :: Hsc HscEnv
hscSimpleIface' :: TcGblEnv -> Maybe Fingerprint -> Hsc (ModIface, Bool, ModDetails)
hscNormalIface' :: ModGuts -> Maybe Fingerprint -> Hsc (ModIface, Bool, ModDetails, CgGuts)
oneShotMsg :: HscEnv -> RecompileRequired -> IO ()
-- | Given a ModSummary, parses and typechecks it, returning the
-- TcGblEnv resulting from type-checking.
hscFileFrontEnd :: ModSummary -> Hsc TcGblEnv
genericHscFrontend :: ModSummary -> Hsc FrontendResult
dumpIfaceStats :: HscEnv -> IO ()
-- | Deal with errors and warnings returned by a compilation step
--
-- In order to reduce dependencies to other parts of the compiler,
-- functions outside the "main" parts of GHC return warnings and errors
-- as a parameter and signal success via by wrapping the result in a
-- Maybe type. This function logs the returned warnings and
-- propagates errors as exceptions (of type SourceError).
--
-- This function assumes the following invariants:
--
--
-- - If the second result indicates success (is of the form 'Just x'),
-- there must be no error messages in the first result.
-- - If there are no error messages, but the second result indicates
-- failure there should be warnings in the first result. That is, if the
-- action failed, it must have been due to the warnings (i.e.,
-- -Werror).
--
ioMsgMaybe :: IO (Messages, Maybe a) -> Hsc a
showModuleIndex :: (Int, Int) -> String
-- | Load the given static-pointer table entries into the interpreter. See
-- Note [Grand plan for static forms] in StaticPtrTable.
hscAddSptEntries :: HscEnv -> [SptEntry] -> IO ()
module TcSplice
tcSpliceExpr :: HsSplice Name -> ExpRhoType -> TcM (HsExpr TcId)
tcTypedBracket :: HsBracket Name -> ExpRhoType -> TcM (HsExpr TcId)
tcUntypedBracket :: HsBracket Name -> [PendingRnSplice] -> ExpRhoType -> TcM (HsExpr TcId)
runAnnotation :: CoreAnnTarget -> LHsExpr Name -> TcM Annotation
runMetaE :: LHsExpr Id -> TcM (LHsExpr RdrName)
runMetaP :: LHsExpr Id -> TcM (LPat RdrName)
runMetaT :: LHsExpr Id -> TcM (LHsType RdrName)
runMetaD :: LHsExpr Id -> TcM [LHsDecl RdrName]
runQuasi :: Q a -> TcM a
tcTopSpliceExpr :: SpliceType -> TcM (LHsExpr Id) -> TcM (LHsExpr Id)
lookupThName_maybe :: Name -> TcM (Maybe Name)
defaultRunMeta :: MetaHook TcM
runMeta' :: Bool -> (hs_syn -> SDoc) -> (SrcSpan -> ForeignHValue -> TcM (Either MsgDoc hs_syn)) -> LHsExpr Id -> TcM hs_syn
runRemoteModFinalizers :: ThModFinalizers -> TcM ()
-- | Releases the external interpreter state.
finishTH :: TcM ()
instance Language.Haskell.TH.Syntax.Quasi TcRnTypes.TcM
module InteractiveEval
data Resume
Resume :: String -> ForeignRef (ResumeContext [HValueRef]) -> ([TyThing], GlobalRdrEnv) -> [Id] -> ForeignHValue -> Maybe BreakInfo -> SrcSpan -> String -> RemotePtr CostCentreStack -> [History] -> Int -> Resume
[resumeStmt] :: Resume -> String
[resumeContext] :: Resume -> ForeignRef (ResumeContext [HValueRef])
[resumeBindings] :: Resume -> ([TyThing], GlobalRdrEnv)
[resumeFinalIds] :: Resume -> [Id]
[resumeApStack] :: Resume -> ForeignHValue
[resumeBreakInfo] :: Resume -> Maybe BreakInfo
[resumeSpan] :: Resume -> SrcSpan
[resumeDecl] :: Resume -> String
[resumeCCS] :: Resume -> RemotePtr CostCentreStack
[resumeHistory] :: Resume -> [History]
[resumeHistoryIx] :: Resume -> Int
data History
History :: ForeignHValue -> BreakInfo -> [String] -> History
[historyApStack] :: History -> ForeignHValue
[historyBreakInfo] :: History -> BreakInfo
[historyEnclosingDecls] :: History -> [String]
-- | Run a statement in the current interactive context.
execStmt :: GhcMonad m => String -> ExecOptions -> m ExecResult
data ExecOptions
ExecOptions :: SingleStep -> String -> Int -> (ForeignHValue -> EvalExpr ForeignHValue) -> ExecOptions
-- | stepping mode
[execSingleStep] :: ExecOptions -> SingleStep
-- | filename (for errors)
[execSourceFile] :: ExecOptions -> String
-- | line number (for errors)
[execLineNumber] :: ExecOptions -> Int
[execWrap] :: ExecOptions -> ForeignHValue -> EvalExpr ForeignHValue
-- | default ExecOptions
execOptions :: ExecOptions
data ExecResult
ExecComplete :: Either SomeException [Name] -> Word64 -> ExecResult
[execResult] :: ExecResult -> Either SomeException [Name]
[execAllocation] :: ExecResult -> Word64
ExecBreak :: [Name] -> Maybe BreakInfo -> ExecResult
[breakNames] :: ExecResult -> [Name]
[breakInfo] :: ExecResult -> Maybe BreakInfo
resumeExec :: GhcMonad m => (SrcSpan -> Bool) -> SingleStep -> m ExecResult
runDecls :: GhcMonad m => String -> m [Name]
-- | Run some declarations and return any user-visible names that were
-- brought into scope.
runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name]
-- | Returns True if passed string is a statement.
isStmt :: DynFlags -> String -> Bool
-- | Returns True if passed string has an import declaration.
hasImport :: DynFlags -> String -> Bool
-- | Returns True if passed string is an import declaration.
isImport :: DynFlags -> String -> Bool
-- | Returns True if passed string is a declaration but not
-- a splice.
isDecl :: DynFlags -> String -> Bool
parseImportDecl :: GhcMonad m => String -> m (ImportDecl RdrName)
data SingleStep
RunToCompletion :: SingleStep
SingleStep :: SingleStep
RunAndLogSteps :: SingleStep
abandon :: GhcMonad m => m Bool
abandonAll :: GhcMonad m => m Bool
getResumeContext :: GhcMonad m => m [Resume]
getHistorySpan :: HscEnv -> History -> SrcSpan
getModBreaks :: HomeModInfo -> ModBreaks
getHistoryModule :: History -> Module
back :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String)
forward :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String)
-- | Set the interactive evaluation context.
--
-- (setContext imports) sets the ic_imports field (which in turn
-- determines what is in scope at the prompt) to imports, and
-- constructs the ic_rn_glb_env environment to reflect it.
--
-- We retain in scope all the things defined at the prompt, and kept in
-- ic_tythings. (Indeed, they shadow stuff from ic_imports.)
setContext :: GhcMonad m => [InteractiveImport] -> m ()
-- | Get the interactive evaluation context, consisting of a pair of the
-- set of modules from which we take the full top-level scope, and the
-- set of modules from which we take just the exports respectively.
getContext :: GhcMonad m => m [InteractiveImport]
availsToGlobalRdrEnv :: ModuleName -> [AvailInfo] -> GlobalRdrEnv
-- | Returns all names in scope in the current interactive context
getNamesInScope :: GhcMonad m => m [Name]
-- | Returns all RdrNames in scope in the current interactive
-- context, excluding any that are internally-generated.
getRdrNamesInScope :: GhcMonad m => m [RdrName]
-- | Returns True if the specified module is interpreted, and
-- hence has its full top-level scope available.
moduleIsInterpreted :: GhcMonad m => Module -> m Bool
-- | Looks up an identifier in the current interactive context (for :info)
-- Filter the instances by the ones whose tycons (or clases resp) are in
-- scope (qualified or otherwise). Otherwise we list a whole lot too
-- many! The exact choice of which ones to show, and which to hide, is a
-- judgement call. (see Trac #1581)
getInfo :: GhcMonad m => Bool -> Name -> m (Maybe (TyThing, Fixity, [ClsInst], [FamInst]))
-- | Get the type of an expression Returns the type as described by
-- TcRnExprMode
exprType :: GhcMonad m => TcRnExprMode -> String -> m Type
-- | Get the kind of a type
typeKind :: GhcMonad m => Bool -> String -> m (Type, Kind)
-- | Parses a string as an identifier, and returns the list of Names
-- that the identifier can refer to in the current interactive context.
parseName :: GhcMonad m => String -> m [Name]
showModule :: GhcMonad m => ModSummary -> m String
moduleIsBootOrNotObjectLinkable :: GhcMonad m => ModSummary -> m Bool
-- | Parse an expression, the parsed expression can be further processed
-- and passed to compileParsedExpr.
parseExpr :: GhcMonad m => String -> m (LHsExpr RdrName)
compileParsedExpr :: GhcMonad m => LHsExpr RdrName -> m HValue
-- | Compile an expression, run it and deliver the resulting HValue.
compileExpr :: GhcMonad m => String -> m HValue
-- | Compile an expression, run it and return the result as a Dynamic.
dynCompileExpr :: GhcMonad m => String -> m Dynamic
-- | Compile an expression, run it and deliver the resulting HValue.
compileExprRemote :: GhcMonad m => String -> m ForeignHValue
-- | Compile an parsed expression (before renaming), run it and deliver the
-- resulting HValue.
compileParsedExprRemote :: GhcMonad m => LHsExpr RdrName -> m ForeignHValue
data Term
Term :: RttiType -> Either String DataCon -> HValue -> [Term] -> Term
[ty] :: Term -> RttiType
[dc] :: Term -> Either String DataCon
[val] :: Term -> HValue
[subTerms] :: Term -> [Term]
Prim :: RttiType -> [Word] -> Term
[ty] :: Term -> RttiType
[value] :: Term -> [Word]
Suspension :: ClosureType -> RttiType -> HValue -> Maybe Name -> Term
[ctype] :: Term -> ClosureType
[ty] :: Term -> RttiType
[val] :: Term -> HValue
[bound_to] :: Term -> Maybe Name
NewtypeWrap :: RttiType -> Either String DataCon -> Term -> Term
[ty] :: Term -> RttiType
[dc] :: Term -> Either String DataCon
[wrapped_term] :: Term -> Term
RefWrap :: RttiType -> Term -> Term
[ty] :: Term -> RttiType
[wrapped_term] :: Term -> Term
obtainTermFromId :: HscEnv -> Int -> Bool -> Id -> IO Term
obtainTermFromVal :: HscEnv -> Int -> Bool -> Type -> a -> IO Term
reconstructType :: HscEnv -> Int -> Id -> IO (Maybe Type)
module DriverPipeline
oneShot :: HscEnv -> Phase -> [(String, Maybe Phase)] -> IO ()
compileFile :: HscEnv -> Phase -> (FilePath, Maybe Phase) -> IO FilePath
linkBinary :: DynFlags -> [FilePath] -> [InstalledUnitId] -> IO ()
-- | Just preprocess a file, put the result in a temp. file (used by the
-- compilation manager during the summary phase).
--
-- We return the augmented DynFlags, because they contain the result of
-- slurping in the OPTIONS pragmas
preprocess :: HscEnv -> (FilePath, Maybe Phase) -> IO (DynFlags, FilePath)
-- | Compile
--
-- Compile a single module, under the control of the compilation manager.
--
-- This is the interface between the compilation manager and the compiler
-- proper (hsc), where we deal with tedious details like reading the
-- OPTIONS pragma from the source file, converting the C or assembly that
-- GHC produces into an object file, and compiling FFI stub files.
--
-- NB. No old interface can also mean that the source has changed.
compileOne :: HscEnv -> ModSummary -> Int -> Int -> Maybe ModIface -> Maybe Linkable -> SourceModified -> IO HomeModInfo
compileOne' :: Maybe TcGblEnv -> Maybe Messager -> HscEnv -> ModSummary -> Int -> Int -> Maybe ModIface -> Maybe Linkable -> SourceModified -> IO HomeModInfo
link :: GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag
data PhasePlus
RealPhase :: Phase -> PhasePlus
HscOut :: HscSource -> ModuleName -> HscStatus -> PhasePlus
newtype CompPipeline a
P :: (PipeEnv -> PipeState -> IO (PipeState, a)) -> CompPipeline a
[unP] :: CompPipeline a -> PipeEnv -> PipeState -> IO (PipeState, a)
data PipeEnv
PipeEnv :: Phase -> String -> String -> String -> PipelineOutput -> PipeEnv
-- | Stop just before this phase
[stop_phase] :: PipeEnv -> Phase
-- | basename of original input source
[src_filename] :: PipeEnv -> String
-- | basename of original input source
[src_basename] :: PipeEnv -> String
-- | its extension
[src_suffix] :: PipeEnv -> String
-- | says where to put the pipeline output
[output_spec] :: PipeEnv -> PipelineOutput
data PipeState
PipeState :: HscEnv -> Maybe ModLocation -> [FilePath] -> PipeState
-- | only the DynFlags change in the HscEnv. The DynFlags change at various
-- points, for example when we read the OPTIONS_GHC pragmas in the Cpp
-- phase.
[hsc_env] :: PipeState -> HscEnv
-- | the ModLocation. This is discovered during compilation, in the Hsc
-- phase where we read the module header.
[maybe_loc] :: PipeState -> Maybe ModLocation
-- | additional object files resulting from compiling foreign code. They
-- come from two sources: foreign stubs, and add{C,Cxx,Objc,Objcxx}File
-- from template haskell
[foreign_os] :: PipeState -> [FilePath]
-- | Computes the next output filename after we run next_phase.
-- Like getOutputFilename, but it operates in the
-- CompPipeline monad (which specifies all of the ambient
-- information.)
phaseOutputFilename :: Phase -> CompPipeline FilePath
-- | Computes the next output filename for something in the compilation
-- pipeline. This is controlled by several variables:
--
--
-- - Phase: the last phase to be run (e.g. stopPhase).
-- This is used to tell if we're in the last phase or not, because in
-- that case flags like -o may be important.
-- - PipelineOutput: is this intended to be a Temporary
-- or Persistent build output? Temporary files just go in a fresh
-- temporary name.
-- - String: what was the basename of the original input
-- file?
-- - DynFlags: the obvious thing
-- - Phase: the phase we want to determine the output filename
-- of.
-- - Maybe ModLocation: the ModLocation of the module
-- we're compiling; this can be used to override the default output of an
-- object file. (TODO: do we actually need this?)
--
getOutputFilename :: Phase -> PipelineOutput -> String -> DynFlags -> Phase -> Maybe ModLocation -> IO FilePath
getPipeState :: CompPipeline PipeState
getPipeEnv :: CompPipeline PipeEnv
-- | What phase to run after one of the backend code generators has run
hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase
getLocation :: HscSource -> ModuleName -> CompPipeline ModLocation
setModLocation :: ModLocation -> CompPipeline ()
setDynFlags :: DynFlags -> CompPipeline ()
-- | Each phase in the pipeline returns the next phase to execute, and the
-- name of the file in which the output was placed.
--
-- We must do things dynamically this way, because we often don't know
-- what the rest of the phases will be until part-way through the
-- compilation: for example, an {--} at the beginning of a source file
-- can change the latter stages of the pipeline from taking the LLVM
-- route to using the native code generator.
runPhase :: PhasePlus -> FilePath -> DynFlags -> CompPipeline (PhasePlus, FilePath)
exeFileName :: Bool -> DynFlags -> FilePath
mkExtraObjToLinkIntoBinary :: DynFlags -> IO FilePath
mkNoteObjsToLinkIntoBinary :: DynFlags -> [InstalledUnitId] -> IO [FilePath]
maybeCreateManifest :: DynFlags -> FilePath -> IO [FilePath]
linkingNeeded :: DynFlags -> Bool -> [Linkable] -> [InstalledUnitId] -> IO Bool
checkLinkInfo :: DynFlags -> [InstalledUnitId] -> FilePath -> IO Bool
writeInterfaceOnlyMode :: DynFlags -> Bool
module GhcMake
-- | Perform a dependency analysis starting from the current targets and
-- update the session with the new module graph.
--
-- Dependency analysis entails parsing the import directives and
-- may therefore require running certain preprocessors.
--
-- Note that each ModSummary in the module graph caches its
-- DynFlags. These DynFlags are determined by the
-- current session DynFlags and the OPTIONS and
-- LANGUAGE pragmas of the parsed module. Thus if you want
-- changes to the DynFlags to take effect you need to call this
-- function again.
depanal :: GhcMonad m => [ModuleName] -> Bool -> m ModuleGraph
-- | Try to load the program. See LoadHowMuch for the different
-- modes.
--
-- This function implements the core of GHC's --make mode. It
-- preprocesses, compiles and loads the specified modules, avoiding
-- re-compilation wherever possible. Depending on the target (see
-- hscTarget) compiling and loading may result in files being
-- created on disk.
--
-- Calls the defaultWarnErrLogger after each compiling each
-- module, whether successful or not.
--
-- Throw a SourceError if errors are encountered before the actual
-- compilation starts (e.g., during dependency analysis). All other
-- errors are reported using the defaultWarnErrLogger.
load :: GhcMonad m => LoadHowMuch -> m SuccessFlag
-- | Generalized version of load which also supports a custom
-- Messager (for reporting progress) and ModuleGraph
-- (generally produced by calling depanal.
load' :: GhcMonad m => LoadHowMuch -> Maybe Messager -> ModuleGraph -> m SuccessFlag
-- | Describes which modules of the module graph need to be loaded.
data LoadHowMuch
-- | Load all targets and its dependencies.
LoadAllTargets :: LoadHowMuch
-- | Load only the given module and its dependencies.
LoadUpTo :: ModuleName -> LoadHowMuch
-- | Load only the dependencies of the given module, but not the module
-- itself.
LoadDependenciesOf :: ModuleName -> LoadHowMuch
-- | Topological sort of the module graph
--
-- Calculate SCCs of the module graph, possibly dropping the hi-boot
-- nodes The resulting list of strongly-connected-components is in
-- topologically sorted order, starting with the module(s) at the bottom
-- of the dependency graph (ie compile them first) and ending with the
-- ones at the top.
--
-- Drop hi-boot nodes (first boolean arg)?
--
--
-- - False: treat the hi-boot summaries as nodes of the graph,
-- so the graph must be acyclic
-- - True: eliminate the hi-boot nodes, and instead pretend
-- the a source-import of Foo is an import of Foo The resulting graph has
-- no hi-boot nodes, but can be cyclic
--
topSortModuleGraph :: Bool -> [ModSummary] -> Maybe ModuleName -> [SCC ModSummary]
-- | Like ms_home_imps, but for SOURCE imports.
ms_home_srcimps :: ModSummary -> [Located ModuleName]
-- | All of the (possibly) home module imports from a ModSummary;
-- that is to say, each of these module names could be a home import if
-- an appropriately named file existed. (This is in contrast to package
-- qualified imports, which are guaranteed not to be home imports.)
ms_home_imps :: ModSummary -> [Located ModuleName]
-- | Bool indicating if a module is a boot module or not. We need to
-- treat boot modules specially when building compilation graphs, since
-- they break cycles. Regular source files and signature files are
-- treated equivalently.
data IsBoot
IsBoot :: IsBoot
NotBoot :: IsBoot
summariseModule :: HscEnv -> NodeMap ModSummary -> IsBoot -> Located ModuleName -> Bool -> Maybe (StringBuffer, UTCTime) -> [ModuleName] -> IO (Maybe (Either ErrMsg ModSummary))
-- | Tests if an HscSource is a boot file, primarily for
-- constructing elements of BuildModule.
hscSourceToIsBoot :: HscSource -> IsBoot
-- | findExtraSigImports, but in a convenient form for
-- GhcMake and TcRnDriver.
findExtraSigImports :: HscEnv -> HscSource -> ModuleName -> IO [(Maybe FastString, Located ModuleName)]
implicitRequirements :: HscEnv -> [(Maybe FastString, Located ModuleName)] -> IO [(Maybe FastString, Located ModuleName)]
noModError :: DynFlags -> SrcSpan -> ModuleName -> FindResult -> ErrMsg
cyclicModuleErr :: [ModSummary] -> SDoc
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode)
type SummaryNode = (ModSummary, Int, [Int])
instance GHC.Read.Read GhcMake.IsBoot
instance GHC.Show.Show GhcMake.IsBoot
instance GHC.Classes.Eq GhcMake.IsBoot
instance GHC.Classes.Ord GhcMake.IsBoot
module GHC
-- | Install some default exception handlers and run the inner computation.
-- Unless you want to handle exceptions yourself, you should wrap this
-- around the top level of your program. The default handlers output the
-- error message(s) to stderr and exit cleanly.
defaultErrorHandler :: (ExceptionMonad m) => FatalMessager -> FlushOut -> m a -> m a
-- | This function is no longer necessary, cleanup is now done by
-- runGhc/runGhcT.
-- | Deprecated: Cleanup is now done by runGhc/runGhcT
defaultCleanupHandler :: (ExceptionMonad m) => DynFlags -> m a -> m a
prettyPrintGhcErrors :: ExceptionMonad m => DynFlags -> m a -> m a
-- | Temporarily install standard signal handlers for catching ^C, which
-- just throw an exception in the current thread.
withSignalHandlers :: (ExceptionMonad m, MonadIO m) => m a -> m a
withCleanupSession :: GhcMonad m => m a -> m a
-- | A minimal implementation of a GhcMonad. If you need a custom
-- monad, e.g., to maintain additional state consider wrapping this monad
-- or using GhcT.
data Ghc a
-- | A monad transformer to add GHC specific features to another monad.
--
-- Note that the wrapped monad must support IO and handling of
-- exceptions.
data GhcT m a
-- | A monad that has all the features needed by GHC API calls.
--
-- In short, a GHC monad
--
--
-- - allows embedding of IO actions,
-- - can log warnings,
-- - allows handling of (extensible) exceptions, and
-- - maintains a current session.
--
--
-- If you do not use Ghc or GhcT, make sure to call
-- initGhcMonad before any call to the GHC API functions can
-- occur.
class (Functor m, MonadIO m, ExceptionMonad m, HasDynFlags m) => GhcMonad m
getSession :: GhcMonad m => m HscEnv
setSession :: GhcMonad m => HscEnv -> m ()
-- | HscEnv is like Session, except that some of the fields are
-- immutable. An HscEnv is used to compile a single module from plain
-- Haskell source code (after preprocessing) to either C, assembly or
-- C--. Things like the module graph don't change during a single
-- compilation.
--
-- Historical note: "hsc" used to be the name of the compiler binary,
-- when there was a separate driver and compiler. To compile a single
-- module, the driver would invoke hsc on the source code... so nowadays
-- we think of hsc as the layer of the compiler that deals with compiling
-- a single module.
data HscEnv
-- | Run function for the Ghc monad.
--
-- It initialises the GHC session and warnings via initGhcMonad.
-- Each call to this function will create a new session which should not
-- be shared among several threads.
--
-- Any errors not handled inside the Ghc action are propagated as
-- IO exceptions.
runGhc :: Maybe FilePath -> Ghc a -> IO a
-- | Run function for GhcT monad transformer.
--
-- It initialises the GHC session and warnings via initGhcMonad.
-- Each call to this function will create a new session which should not
-- be shared among several threads.
runGhcT :: ExceptionMonad m => Maybe FilePath -> GhcT m a -> m a
-- | Initialise a GHC session.
--
-- If you implement a custom GhcMonad you must call this function
-- in the monad run function. It will initialise the session variable and
-- clear all warnings.
--
-- The first argument should point to the directory where GHC's library
-- files reside. More precisely, this should be the output of ghc
-- --print-libdir of the version of GHC the module using this API is
-- compiled with. For portability, you should use the ghc-paths
-- package, available at
-- http://hackage.haskell.org/package/ghc-paths.
initGhcMonad :: GhcMonad m => Maybe FilePath -> m ()
-- | Generalised version of catch, allowing an arbitrary exception
-- handling monad instead of just IO.
gcatch :: (ExceptionMonad m, Exception e) => m a -> (e -> m a) -> m a
-- | Generalised version of bracket, allowing an arbitrary exception
-- handling monad instead of just IO.
gbracket :: ExceptionMonad m => m a -> (a -> m b) -> (a -> m c) -> m c
-- | Generalised version of finally, allowing an arbitrary exception
-- handling monad instead of just IO.
gfinally :: ExceptionMonad m => m a -> m b -> m a
-- | Print the error message and all warnings. Useful inside exception
-- handlers. Clears warnings after printing.
printException :: GhcMonad m => SourceError -> m ()
-- | Perform the given action and call the exception handler if the action
-- throws a SourceError. See SourceError for more
-- information.
handleSourceError :: (ExceptionMonad m) => (SourceError -> m a) -> m a -> m a
-- | Determines whether a set of modules requires Template Haskell.
--
-- Note that if the session's DynFlags enabled Template Haskell
-- when depanal was called, then each module in the returned
-- module graph will have Template Haskell enabled whether it is actually
-- needed or not.
needsTemplateHaskell :: ModuleGraph -> Bool
-- | Contains not only a collection of GeneralFlags but also a
-- plethora of information relating to the compilation of a single file
-- or GHC session
data DynFlags
DynFlags :: GhcMode -> GhcLink -> HscTarget -> Settings -> Int -> Int -> Int -> Int -> Int -> Int -> Maybe String -> [Int] -> Maybe Int -> Bool -> Maybe Int -> Maybe Int -> Int -> Int -> Maybe Int -> Maybe Int -> Int -> Maybe Int -> Maybe Int -> Int -> [FilePath] -> Module -> Maybe String -> IntWithInf -> IntWithInf -> InstalledUnitId -> Maybe ComponentId -> Maybe [(ModuleName, Module)] -> [Way] -> String -> String -> Maybe (String, Int) -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> String -> String -> String -> IORef Bool -> String -> String -> Maybe FilePath -> Maybe [Set String] -> Maybe String -> Maybe String -> Maybe String -> DynLibLoader -> Maybe FilePath -> Maybe FilePath -> [Option] -> [String] -> [String] -> [String] -> [String] -> Maybe String -> RtsOptsEnabled -> Bool -> String -> [ModuleName] -> [(ModuleName, String)] -> [String] -> Hooks -> FilePath -> Bool -> [ModuleName] -> [String] -> [PackageDBFlag] -> [IgnorePackageFlag] -> [PackageFlag] -> [PackageFlag] -> [TrustFlag] -> Maybe FilePath -> Maybe [(FilePath, [PackageConfig])] -> PackageState -> IORef [FilePath] -> IORef (Map FilePath FilePath) -> IORef [FilePath] -> IORef Int -> IORef (Set FilePath) -> IntSet -> IntSet -> IntSet -> IntSet -> Maybe Language -> SafeHaskellMode -> Bool -> Bool -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> [OnOff Extension] -> IntSet -> Int -> Int -> Int -> Int -> Float -> Int -> Bool -> Int -> Int -> IO (Maybe LogOutput) -> LogAction -> LogFinaliser -> FlushOut -> FlushErr -> Maybe String -> [String] -> Int -> Int -> Bool -> OverridingBool -> Bool -> Scheme -> ProfAuto -> Maybe String -> IORef (ModuleEnv Int) -> Maybe SseVersion -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> IORef (Maybe LinkerInfo) -> IORef (Maybe CompilerInfo) -> Int -> Int -> Int -> Bool -> Maybe Int -> Int -> Int -> DynFlags
[ghcMode] :: DynFlags -> GhcMode
[ghcLink] :: DynFlags -> GhcLink
[hscTarget] :: DynFlags -> HscTarget
[settings] :: DynFlags -> Settings
-- | Verbosity level: see Note [Verbosity levels]
[verbosity] :: DynFlags -> Int
-- | Optimisation level
[optLevel] :: DynFlags -> Int
-- | How much debug information to produce
[debugLevel] :: DynFlags -> Int
-- | Number of simplifier phases
[simplPhases] :: DynFlags -> Int
-- | Max simplifier iterations
[maxSimplIterations] :: DynFlags -> Int
-- | Max no iterations for pm checking
[maxPmCheckIterations] :: DynFlags -> Int
[ruleCheck] :: DynFlags -> Maybe String
-- | Additional demand analysis
[strictnessBefore] :: DynFlags -> [Int]
-- | The number of modules to compile in parallel in --make mode, where
-- Nothing ==> compile as many in parallel as there are CPUs.
[parMakeCount] :: DynFlags -> Maybe Int
-- | Enable RTS timing statistics?
[enableTimeStats] :: DynFlags -> Bool
-- | The heap size to set.
[ghcHeapSize] :: DynFlags -> Maybe Int
-- | Maximum number of bindings from the type envt to show in type error
-- messages
[maxRelevantBinds] :: DynFlags -> Maybe Int
-- | Maximum number of unmatched patterns to show in non-exhaustiveness
-- warnings
[maxUncoveredPatterns] :: DynFlags -> Int
-- | Multiplier for simplifier ticks
[simplTickFactor] :: DynFlags -> Int
-- | Threshold for SpecConstr
[specConstrThreshold] :: DynFlags -> Maybe Int
-- | Max number of specialisations for any one function
[specConstrCount] :: DynFlags -> Maybe Int
-- | Max number of specialisations for recursive types Not optional;
-- otherwise ForceSpecConstr can diverge.
[specConstrRecursive] :: DynFlags -> Int
-- | Threshold for LiberateCase
[liberateCaseThreshold] :: DynFlags -> Maybe Int
-- | Arg count for lambda floating See CoreMonad.FloatOutSwitches
[floatLamArgs] :: DynFlags -> Maybe Int
-- | Simplification history size
[historySize] :: DynFlags -> Int
[importPaths] :: DynFlags -> [FilePath]
[mainModIs] :: DynFlags -> Module
[mainFunIs] :: DynFlags -> Maybe String
-- | Typechecker maximum stack depth
[reductionDepth] :: DynFlags -> IntWithInf
-- | Number of iterations in the constraints solver Typically only 1 is
-- needed
[solverIterations] :: DynFlags -> IntWithInf
[thisInstalledUnitId] :: DynFlags -> InstalledUnitId
[thisComponentId_] :: DynFlags -> Maybe ComponentId
[thisUnitIdInsts_] :: DynFlags -> Maybe [(ModuleName, Module)]
-- | Way flags from the command line
[ways] :: DynFlags -> [Way]
-- | The global "way" (e.g. "p" for prof)
[buildTag] :: DynFlags -> String
-- | The RTS "way"
[rtsBuildTag] :: DynFlags -> String
[splitInfo] :: DynFlags -> Maybe (String, Int)
[objectDir] :: DynFlags -> Maybe String
[dylibInstallName] :: DynFlags -> Maybe String
[hiDir] :: DynFlags -> Maybe String
[stubDir] :: DynFlags -> Maybe String
[dumpDir] :: DynFlags -> Maybe String
[objectSuf] :: DynFlags -> String
[hcSuf] :: DynFlags -> String
[hiSuf] :: DynFlags -> String
[canGenerateDynamicToo] :: DynFlags -> IORef Bool
[dynObjectSuf] :: DynFlags -> String
[dynHiSuf] :: DynFlags -> String
[dllSplitFile] :: DynFlags -> Maybe FilePath
[dllSplit] :: DynFlags -> Maybe [Set String]
[outputFile] :: DynFlags -> Maybe String
[dynOutputFile] :: DynFlags -> Maybe String
[outputHi] :: DynFlags -> Maybe String
[dynLibLoader] :: DynFlags -> DynLibLoader
-- | This is set by runPipeline based on where its output is going.
[dumpPrefix] :: DynFlags -> Maybe FilePath
-- | Override the dumpPrefix set by runPipeline. Set by
-- -ddump-file-prefix
[dumpPrefixForce] :: DynFlags -> Maybe FilePath
[ldInputs] :: DynFlags -> [Option]
[includePaths] :: DynFlags -> [String]
[libraryPaths] :: DynFlags -> [String]
[frameworkPaths] :: DynFlags -> [String]
[cmdlineFrameworks] :: DynFlags -> [String]
[rtsOpts] :: DynFlags -> Maybe String
[rtsOptsEnabled] :: DynFlags -> RtsOptsEnabled
[rtsOptsSuggestions] :: DynFlags -> Bool
-- | Path to store the .mix files
[hpcDir] :: DynFlags -> String
[pluginModNames] :: DynFlags -> [ModuleName]
[pluginModNameOpts] :: DynFlags -> [(ModuleName, String)]
-- | the -ffrontend-opt flags given on the command line, in
-- *reverse* order that they're specified on the command line.
[frontendPluginOpts] :: DynFlags -> [String]
[hooks] :: DynFlags -> Hooks
[depMakefile] :: DynFlags -> FilePath
[depIncludePkgDeps] :: DynFlags -> Bool
[depExcludeMods] :: DynFlags -> [ModuleName]
[depSuffixes] :: DynFlags -> [String]
-- | The -package-db flags given on the command line, In *reverse*
-- order that they're specified on the command line. This is intended to
-- be applied with the list of "initial" package databases derived from
-- GHC_PACKAGE_PATH; see getPackageConfRefs.
[packageDBFlags] :: DynFlags -> [PackageDBFlag]
-- | The -ignore-package flags from the command line. In *reverse*
-- order that they're specified on the command line.
[ignorePackageFlags] :: DynFlags -> [IgnorePackageFlag]
-- | The -package and -hide-package flags from the
-- command-line. In *reverse* order that they're specified on the command
-- line.
[packageFlags] :: DynFlags -> [PackageFlag]
-- | The -plugin-package-id flags from command line. In *reverse*
-- order that they're specified on the command line.
[pluginPackageFlags] :: DynFlags -> [PackageFlag]
-- | The -trust and -distrust flags. In *reverse* order
-- that they're specified on the command line.
[trustFlags] :: DynFlags -> [TrustFlag]
-- | Filepath to the package environment file (if overriding default)
[packageEnv] :: DynFlags -> Maybe FilePath
[pkgDatabase] :: DynFlags -> Maybe [(FilePath, [PackageConfig])]
[pkgState] :: DynFlags -> PackageState
[filesToClean] :: DynFlags -> IORef [FilePath]
[dirsToClean] :: DynFlags -> IORef (Map FilePath FilePath)
[filesToNotIntermediateClean] :: DynFlags -> IORef [FilePath]
[nextTempSuffix] :: DynFlags -> IORef Int
[generatedDumps] :: DynFlags -> IORef (Set FilePath)
[dumpFlags] :: DynFlags -> IntSet
[generalFlags] :: DynFlags -> IntSet
[warningFlags] :: DynFlags -> IntSet
[fatalWarningFlags] :: DynFlags -> IntSet
[language] :: DynFlags -> Maybe Language
-- | Safe Haskell mode
[safeHaskell] :: DynFlags -> SafeHaskellMode
[safeInfer] :: DynFlags -> Bool
[safeInferred] :: DynFlags -> Bool
[thOnLoc] :: DynFlags -> SrcSpan
[newDerivOnLoc] :: DynFlags -> SrcSpan
[overlapInstLoc] :: DynFlags -> SrcSpan
[incoherentOnLoc] :: DynFlags -> SrcSpan
[pkgTrustOnLoc] :: DynFlags -> SrcSpan
[warnSafeOnLoc] :: DynFlags -> SrcSpan
[warnUnsafeOnLoc] :: DynFlags -> SrcSpan
[trustworthyOnLoc] :: DynFlags -> SrcSpan
[extensions] :: DynFlags -> [OnOff Extension]
[extensionFlags] :: DynFlags -> IntSet
[ufCreationThreshold] :: DynFlags -> Int
[ufUseThreshold] :: DynFlags -> Int
[ufFunAppDiscount] :: DynFlags -> Int
[ufDictDiscount] :: DynFlags -> Int
[ufKeenessFactor] :: DynFlags -> Float
[ufDearOp] :: DynFlags -> Int
[ufVeryAggressive] :: DynFlags -> Bool
[maxWorkerArgs] :: DynFlags -> Int
[ghciHistSize] :: DynFlags -> Int
-- | MsgDoc output action: use ErrUtils instead of this if you can
[initLogAction] :: DynFlags -> IO (Maybe LogOutput)
[log_action] :: DynFlags -> LogAction
[log_finaliser] :: DynFlags -> LogFinaliser
[flushOut] :: DynFlags -> FlushOut
[flushErr] :: DynFlags -> FlushErr
[haddockOptions] :: DynFlags -> Maybe String
-- | GHCi scripts specified by -ghci-script, in reverse order
[ghciScripts] :: DynFlags -> [String]
[pprUserLength] :: DynFlags -> Int
[pprCols] :: DynFlags -> Int
[useUnicode] :: DynFlags -> Bool
[useColor] :: DynFlags -> OverridingBool
[canUseColor] :: DynFlags -> Bool
[colScheme] :: DynFlags -> Scheme
-- | what kind of {--} to add automatically
[profAuto] :: DynFlags -> ProfAuto
[interactivePrint] :: DynFlags -> Maybe String
[nextWrapperNum] :: DynFlags -> IORef (ModuleEnv Int)
-- | Machine dependent flags (-mblah stuff)
[sseVersion] :: DynFlags -> Maybe SseVersion
[avx] :: DynFlags -> Bool
[avx2] :: DynFlags -> Bool
[avx512cd] :: DynFlags -> Bool
[avx512er] :: DynFlags -> Bool
[avx512f] :: DynFlags -> Bool
[avx512pf] :: DynFlags -> Bool
-- | Run-time linker information (what options we need, etc.)
[rtldInfo] :: DynFlags -> IORef (Maybe LinkerInfo)
-- | Run-time compiler information
[rtccInfo] :: DynFlags -> IORef (Maybe CompilerInfo)
-- | Max size, in bytes, of inline array allocations.
[maxInlineAllocSize] :: DynFlags -> Int
-- | Only inline memcpy if it generates no more than this many pseudo
-- (roughly: Cmm) instructions.
[maxInlineMemcpyInsns] :: DynFlags -> Int
-- | Only inline memset if it generates no more than this many pseudo
-- (roughly: Cmm) instructions.
[maxInlineMemsetInsns] :: DynFlags -> Int
-- | Reverse the order of error messages in GHC/GHCi
[reverseErrors] :: DynFlags -> Bool
-- | Limit the maximum number of errors to show
[maxErrors] :: DynFlags -> Maybe Int
-- | Unique supply configuration for testing build determinism
[initialUnique] :: DynFlags -> Int
[uniqueIncrement] :: DynFlags -> Int
-- | Enumerates the simple on-or-off dynamic flags
data GeneralFlag
-- | Append dump output to files instead of stdout.
Opt_DumpToFile :: GeneralFlag
Opt_D_faststring_stats :: GeneralFlag
Opt_D_dump_minimal_imports :: GeneralFlag
Opt_DoCoreLinting :: GeneralFlag
Opt_DoStgLinting :: GeneralFlag
Opt_DoCmmLinting :: GeneralFlag
Opt_DoAsmLinting :: GeneralFlag
Opt_DoAnnotationLinting :: GeneralFlag
Opt_NoLlvmMangler :: GeneralFlag
Opt_WarnIsError :: GeneralFlag
Opt_ShowWarnGroups :: GeneralFlag
Opt_HideSourcePaths :: GeneralFlag
Opt_PrintExplicitForalls :: GeneralFlag
Opt_PrintExplicitKinds :: GeneralFlag
Opt_PrintExplicitCoercions :: GeneralFlag
Opt_PrintExplicitRuntimeReps :: GeneralFlag
Opt_PrintEqualityRelations :: GeneralFlag
Opt_PrintUnicodeSyntax :: GeneralFlag
Opt_PrintExpandedSynonyms :: GeneralFlag
Opt_PrintPotentialInstances :: GeneralFlag
Opt_PrintTypecheckerElaboration :: GeneralFlag
Opt_CallArity :: GeneralFlag
Opt_Strictness :: GeneralFlag
Opt_LateDmdAnal :: GeneralFlag
Opt_KillAbsence :: GeneralFlag
Opt_KillOneShot :: GeneralFlag
Opt_FullLaziness :: GeneralFlag
Opt_FloatIn :: GeneralFlag
Opt_Specialise :: GeneralFlag
Opt_SpecialiseAggressively :: GeneralFlag
Opt_CrossModuleSpecialise :: GeneralFlag
Opt_StaticArgumentTransformation :: GeneralFlag
Opt_CSE :: GeneralFlag
Opt_StgCSE :: GeneralFlag
Opt_LiberateCase :: GeneralFlag
Opt_SpecConstr :: GeneralFlag
Opt_SpecConstrKeen :: GeneralFlag
Opt_DoLambdaEtaExpansion :: GeneralFlag
Opt_IgnoreAsserts :: GeneralFlag
Opt_DoEtaReduction :: GeneralFlag
Opt_CaseMerge :: GeneralFlag
Opt_CaseFolding :: GeneralFlag
Opt_UnboxStrictFields :: GeneralFlag
Opt_UnboxSmallStrictFields :: GeneralFlag
Opt_DictsCheap :: GeneralFlag
Opt_EnableRewriteRules :: GeneralFlag
Opt_Vectorise :: GeneralFlag
Opt_VectorisationAvoidance :: GeneralFlag
Opt_RegsGraph :: GeneralFlag
Opt_RegsIterative :: GeneralFlag
Opt_PedanticBottoms :: GeneralFlag
Opt_LlvmTBAA :: GeneralFlag
Opt_LlvmPassVectorsInRegisters :: GeneralFlag
Opt_LlvmFillUndefWithGarbage :: GeneralFlag
Opt_IrrefutableTuples :: GeneralFlag
Opt_CmmSink :: GeneralFlag
Opt_CmmElimCommonBlocks :: GeneralFlag
Opt_OmitYields :: GeneralFlag
Opt_FunToThunk :: GeneralFlag
Opt_DictsStrict :: GeneralFlag
Opt_DmdTxDictSel :: GeneralFlag
Opt_Loopification :: GeneralFlag
Opt_CprAnal :: GeneralFlag
Opt_WorkerWrapper :: GeneralFlag
Opt_SolveConstantDicts :: GeneralFlag
Opt_IgnoreInterfacePragmas :: GeneralFlag
Opt_OmitInterfacePragmas :: GeneralFlag
Opt_ExposeAllUnfoldings :: GeneralFlag
Opt_WriteInterface :: GeneralFlag
Opt_AutoSccsOnIndividualCafs :: GeneralFlag
Opt_ProfCountEntries :: GeneralFlag
Opt_Pp :: GeneralFlag
Opt_ForceRecomp :: GeneralFlag
Opt_ExcessPrecision :: GeneralFlag
Opt_EagerBlackHoling :: GeneralFlag
Opt_NoHsMain :: GeneralFlag
Opt_SplitObjs :: GeneralFlag
Opt_SplitSections :: GeneralFlag
Opt_StgStats :: GeneralFlag
Opt_HideAllPackages :: GeneralFlag
Opt_HideAllPluginPackages :: GeneralFlag
Opt_PrintBindResult :: GeneralFlag
Opt_Haddock :: GeneralFlag
Opt_HaddockOptions :: GeneralFlag
Opt_BreakOnException :: GeneralFlag
Opt_BreakOnError :: GeneralFlag
Opt_PrintEvldWithShow :: GeneralFlag
Opt_PrintBindContents :: GeneralFlag
Opt_GenManifest :: GeneralFlag
Opt_EmbedManifest :: GeneralFlag
Opt_SharedImplib :: GeneralFlag
Opt_BuildingCabalPackage :: GeneralFlag
Opt_IgnoreDotGhci :: GeneralFlag
Opt_GhciSandbox :: GeneralFlag
Opt_GhciHistory :: GeneralFlag
Opt_LocalGhciHistory :: GeneralFlag
Opt_HelpfulErrors :: GeneralFlag
Opt_DeferTypeErrors :: GeneralFlag
Opt_DeferTypedHoles :: GeneralFlag
Opt_DeferOutOfScopeVariables :: GeneralFlag
-- |
-- -fPIC
--
Opt_PIC :: GeneralFlag
-- |
-- -fPIE
--
Opt_PIE :: GeneralFlag
-- |
-- -pie
--
Opt_PICExecutable :: GeneralFlag
Opt_SccProfilingOn :: GeneralFlag
Opt_Ticky :: GeneralFlag
Opt_Ticky_Allocd :: GeneralFlag
Opt_Ticky_LNE :: GeneralFlag
Opt_Ticky_Dyn_Thunk :: GeneralFlag
Opt_RPath :: GeneralFlag
Opt_RelativeDynlibPaths :: GeneralFlag
Opt_Hpc :: GeneralFlag
Opt_FlatCache :: GeneralFlag
Opt_ExternalInterpreter :: GeneralFlag
Opt_OptimalApplicativeDo :: GeneralFlag
Opt_VersionMacros :: GeneralFlag
Opt_WholeArchiveHsLibs :: GeneralFlag
Opt_SimplPreInlining :: GeneralFlag
Opt_ErrorSpans :: GeneralFlag
Opt_DiagnosticsShowCaret :: GeneralFlag
Opt_PprCaseAsLet :: GeneralFlag
Opt_PprShowTicks :: GeneralFlag
Opt_ShowHoleConstraints :: GeneralFlag
Opt_ShowLoadedModules :: GeneralFlag
Opt_SuppressCoercions :: GeneralFlag
Opt_SuppressVarKinds :: GeneralFlag
Opt_SuppressModulePrefixes :: GeneralFlag
Opt_SuppressTypeApplications :: GeneralFlag
Opt_SuppressIdInfo :: GeneralFlag
Opt_SuppressUnfoldings :: GeneralFlag
Opt_SuppressTypeSignatures :: GeneralFlag
Opt_SuppressUniques :: GeneralFlag
Opt_SuppressTicks :: GeneralFlag
Opt_AutoLinkPackages :: GeneralFlag
Opt_ImplicitImportQualified :: GeneralFlag
Opt_KeepHiDiffs :: GeneralFlag
Opt_KeepHcFiles :: GeneralFlag
Opt_KeepSFiles :: GeneralFlag
Opt_KeepTmpFiles :: GeneralFlag
Opt_KeepRawTokenStream :: GeneralFlag
Opt_KeepLlvmFiles :: GeneralFlag
Opt_KeepHiFiles :: GeneralFlag
Opt_KeepOFiles :: GeneralFlag
Opt_BuildDynamicToo :: GeneralFlag
Opt_DistrustAllPackages :: GeneralFlag
Opt_PackageTrust :: GeneralFlag
Opt_G_NoStateHack :: GeneralFlag
Opt_G_NoOptCoercion :: GeneralFlag
data Severity
SevOutput :: Severity
SevFatal :: Severity
SevInteractive :: Severity
-- | Log messagse intended for compiler developers No filelinecolumn
-- stuff
SevDump :: Severity
-- | Log messages intended for end users. No filelinecolumn stuff.
SevInfo :: Severity
SevWarning :: Severity
-- | SevWarning and SevError are used for warnings and errors o The message
-- has a filelinecolumn heading, plus "warning:" or "error:",
-- added by mkLocMessags o Output is intended for end users
SevError :: Severity
-- | The target code type of the compilation (if any).
--
-- Whenever you change the target, also make sure to set ghcLink
-- to something sensible.
--
-- HscNothing can be used to avoid generating any output, however,
-- note that:
--
--
-- - If a program uses Template Haskell the typechecker may try to run
-- code from an imported module. This will fail if no code has been
-- generated for this module. You can use needsTemplateHaskell to
-- detect whether this might be the case and choose to either switch to a
-- different target or avoid typechecking such modules. (The latter may
-- be preferable for security reasons.)
--
data HscTarget
-- | Generate C code.
HscC :: HscTarget
-- | Generate assembly using the native code generator.
HscAsm :: HscTarget
-- | Generate assembly using the llvm code generator.
HscLlvm :: HscTarget
-- | Generate bytecode. (Requires LinkInMemory)
HscInterpreted :: HscTarget
-- | Don't generate any code. See notes above.
HscNothing :: HscTarget
-- | Test whether a GeneralFlag is set
gopt :: GeneralFlag -> DynFlags -> Bool
-- | The GhcMode tells us whether we're doing multi-module
-- compilation (controlled via the GHC API) or one-shot
-- (single-module) compilation. This makes a difference primarily to the
-- Finder: in one-shot mode we look for interface files for
-- imported modules, but in multi-module mode we look for source files in
-- order to check whether they need to be recompiled.
data GhcMode
-- | --make, GHCi, etc.
CompManager :: GhcMode
-- |
-- ghc -c Foo.hs
--
OneShot :: GhcMode
-- | ghc -M, see Finder for why we need this
MkDepend :: GhcMode
-- | What to do in the link step, if there is one.
data GhcLink
-- | Don't link at all
NoLink :: GhcLink
-- | Link object code into a binary
LinkBinary :: GhcLink
-- | Use the in-memory dynamic linker (works for both bytecode and object
-- code).
LinkInMemory :: GhcLink
-- | Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
LinkDynLib :: GhcLink
-- | Link objects into a static lib
LinkStaticLib :: GhcLink
-- | The HscTarget value corresponding to the default way to create
-- object files on the current platform.
defaultObjectTarget :: Platform -> HscTarget
parseDynamicFlags :: MonadIO m => DynFlags -> [Located String] -> m (DynFlags, [Located String], [Located String])
-- | Grabs the DynFlags from the Session
getSessionDynFlags :: GhcMonad m => m DynFlags
-- | Updates both the interactive and program DynFlags in a Session. This
-- also reads the package database (unless it has already been read), and
-- prepares the compilers knowledge about packages. It can be called
-- again to load new packages: just add new package flags to
-- (packageFlags dflags).
--
-- Returns a list of new packages that may need to be linked in using the
-- dynamic linker (see linkPackages) as a result of new package
-- flags. If you are not doing linking or doing static linking, you can
-- ignore the list of packages returned.
setSessionDynFlags :: GhcMonad m => DynFlags -> m [InstalledUnitId]
-- | Returns the program DynFlags.
getProgramDynFlags :: GhcMonad m => m DynFlags
-- | Sets the program DynFlags. Note: this invalidates the internal
-- cached module graph, causing more work to be done the next time
-- load is called.
setProgramDynFlags :: GhcMonad m => DynFlags -> m [InstalledUnitId]
-- | Set the action taken when the compiler produces a message. This can
-- also be accomplished using setProgramDynFlags, but using
-- setLogAction avoids invalidating the cached module graph.
setLogAction :: GhcMonad m => LogAction -> LogFinaliser -> m ()
-- | Get the DynFlags used to evaluate interactive expressions.
getInteractiveDynFlags :: GhcMonad m => m DynFlags
-- | Set the DynFlags used to evaluate interactive expressions.
-- Note: this cannot be used for changes to packages. Use
-- setSessionDynFlags, or setProgramDynFlags and then copy
-- the pkgState into the interactive DynFlags.
setInteractiveDynFlags :: GhcMonad m => DynFlags -> m ()
-- | A compilation target.
--
-- A target may be supplied with the actual text of the module. If so,
-- use this instead of the file contents (this is for use in an IDE where
-- the file hasn't been saved by the user yet).
data Target
Target :: TargetId -> Bool -> Maybe (StringBuffer, UTCTime) -> Target
-- | module or filename
[targetId] :: Target -> TargetId
-- | object code allowed?
[targetAllowObjCode] :: Target -> Bool
-- | in-memory text buffer?
[targetContents] :: Target -> Maybe (StringBuffer, UTCTime)
data TargetId
-- | A module name: search for the file
TargetModule :: ModuleName -> TargetId
-- | A filename: preprocess & parse it to find the module name. If
-- specified, the Phase indicates how to compile this file (which phase
-- to start from). Nothing indicates the starting phase should be
-- determined from the suffix of the filename.
TargetFile :: FilePath -> (Maybe Phase) -> TargetId
data Phase
-- | Sets the targets for this session. Each target may be a module name or
-- a filename. The targets correspond to the set of root modules for the
-- program/library. Unloading the current program is achieved by setting
-- the current set of targets to be empty, followed by load.
setTargets :: GhcMonad m => [Target] -> m ()
-- | Returns the current set of targets
getTargets :: GhcMonad m => m [Target]
-- | Add another target.
addTarget :: GhcMonad m => Target -> m ()
-- | Remove a target
removeTarget :: GhcMonad m => TargetId -> m ()
-- | Attempts to guess what Target a string refers to. This function
-- implements the --make/GHCi command-line syntax for filenames:
--
--
-- - if the string looks like a Haskell source filename, then interpret
-- it as such
-- - if adding a .hs or .lhs suffix yields the name of an existing
-- file, then use that
-- - otherwise interpret the string as a module name
--
guessTarget :: GhcMonad m => String -> Maybe Phase -> m Target
-- | Perform a dependency analysis starting from the current targets and
-- update the session with the new module graph.
--
-- Dependency analysis entails parsing the import directives and
-- may therefore require running certain preprocessors.
--
-- Note that each ModSummary in the module graph caches its
-- DynFlags. These DynFlags are determined by the
-- current session DynFlags and the OPTIONS and
-- LANGUAGE pragmas of the parsed module. Thus if you want
-- changes to the DynFlags to take effect you need to call this
-- function again.
depanal :: GhcMonad m => [ModuleName] -> Bool -> m ModuleGraph
-- | Try to load the program. See LoadHowMuch for the different
-- modes.
--
-- This function implements the core of GHC's --make mode. It
-- preprocesses, compiles and loads the specified modules, avoiding
-- re-compilation wherever possible. Depending on the target (see
-- hscTarget) compiling and loading may result in files being
-- created on disk.
--
-- Calls the defaultWarnErrLogger after each compiling each
-- module, whether successful or not.
--
-- Throw a SourceError if errors are encountered before the actual
-- compilation starts (e.g., during dependency analysis). All other
-- errors are reported using the defaultWarnErrLogger.
load :: GhcMonad m => LoadHowMuch -> m SuccessFlag
-- | Describes which modules of the module graph need to be loaded.
data LoadHowMuch
-- | Load all targets and its dependencies.
LoadAllTargets :: LoadHowMuch
-- | Load only the given module and its dependencies.
LoadUpTo :: ModuleName -> LoadHowMuch
-- | Load only the dependencies of the given module, but not the module
-- itself.
LoadDependenciesOf :: ModuleName -> LoadHowMuch
data InteractiveImport
-- | Bring the exports of a particular module (filtered by an import decl)
-- into scope
IIDecl :: (ImportDecl RdrName) -> InteractiveImport
-- | Bring into scope the entire top-level envt of of this module,
-- including the things imported into it.
IIModule :: ModuleName -> InteractiveImport
data SuccessFlag
Succeeded :: SuccessFlag
Failed :: SuccessFlag
succeeded :: SuccessFlag -> Bool
failed :: SuccessFlag -> Bool
defaultWarnErrLogger :: WarnErrLogger
-- | A function called to log warnings and errors.
type WarnErrLogger = forall m. GhcMonad m => Maybe SourceError -> m ()
-- | Inform GHC that the working directory has changed. GHC will flush its
-- cache of module locations, since it may no longer be valid.
--
-- Note: Before changing the working directory make sure all threads
-- running in the same session have stopped. If you change the working
-- directory, you should also unload the current program (set targets to
-- empty, followed by load).
workingDirectoryChanged :: GhcMonad m => m ()
-- | Parse a module.
--
-- Throws a SourceError on parse error.
parseModule :: GhcMonad m => ModSummary -> m ParsedModule
-- | Typecheck and rename a parsed module.
--
-- Throws a SourceError if either fails.
typecheckModule :: GhcMonad m => ParsedModule -> m TypecheckedModule
-- | Desugar a typechecked module.
desugarModule :: GhcMonad m => TypecheckedModule -> m DesugaredModule
-- | Load a module. Input doesn't need to be desugared.
--
-- A module must be loaded before dependent modules can be typechecked.
-- This always includes generating a ModIface and, depending on
-- the hscTarget, may also include code generation.
--
-- This function will always cause recompilation and will always
-- overwrite previous compilation results (potentially files on disk).
loadModule :: (TypecheckedMod mod, GhcMonad m) => mod -> m mod
-- | The result of successful parsing.
data ParsedModule
ParsedModule :: ModSummary -> ParsedSource -> [FilePath] -> ApiAnns -> ParsedModule
[pm_mod_summary] :: ParsedModule -> ModSummary
[pm_parsed_source] :: ParsedModule -> ParsedSource
[pm_extra_src_files] :: ParsedModule -> [FilePath]
[pm_annotations] :: ParsedModule -> ApiAnns
-- | The result of successful typechecking. It also contains the parser
-- result.
data TypecheckedModule
TypecheckedModule :: ParsedModule -> Maybe RenamedSource -> TypecheckedSource -> ModuleInfo -> (TcGblEnv, ModDetails) -> TypecheckedModule
[tm_parsed_module] :: TypecheckedModule -> ParsedModule
[tm_renamed_source] :: TypecheckedModule -> Maybe RenamedSource
[tm_typechecked_source] :: TypecheckedModule -> TypecheckedSource
[tm_checked_module_info] :: TypecheckedModule -> ModuleInfo
[tm_internals_] :: TypecheckedModule -> (TcGblEnv, ModDetails)
-- | The result of successful desugaring (i.e., translation to core). Also
-- contains all the information of a typechecked module.
data DesugaredModule
DesugaredModule :: TypecheckedModule -> ModGuts -> DesugaredModule
[dm_typechecked_module] :: DesugaredModule -> TypecheckedModule
[dm_core_module] :: DesugaredModule -> ModGuts
type TypecheckedSource = LHsBinds Id
type ParsedSource = Located (HsModule RdrName)
type RenamedSource = (HsGroup Name, [LImportDecl Name], Maybe [LIE Name], Maybe LHsDocString)
class ParsedMod m => TypecheckedMod m
renamedSource :: TypecheckedMod m => m -> Maybe RenamedSource
typecheckedSource :: TypecheckedMod m => m -> TypecheckedSource
moduleInfo :: TypecheckedMod m => m -> ModuleInfo
class ParsedMod m
parsedSource :: ParsedMod m => m -> ParsedSource
moduleInfo :: TypecheckedMod m => m -> ModuleInfo
renamedSource :: TypecheckedMod m => m -> Maybe RenamedSource
typecheckedSource :: TypecheckedMod m => m -> TypecheckedSource
parsedSource :: ParsedMod m => m -> ParsedSource
coreModule :: DesugaredMod m => m -> ModGuts
-- | A CoreModule consists of just the fields of a ModGuts that are
-- needed for the compileToCoreModule interface.
data CoreModule
CoreModule :: !Module -> !TypeEnv -> CoreProgram -> SafeHaskellMode -> CoreModule
-- | Module name
[cm_module] :: CoreModule -> !Module
-- | Type environment for types declared in this module
[cm_types] :: CoreModule -> !TypeEnv
-- | Declarations
[cm_binds] :: CoreModule -> CoreProgram
-- | Safe Haskell mode
[cm_safe] :: CoreModule -> SafeHaskellMode
-- | This is the way to get access to the Core bindings corresponding to a
-- module. compileToCore parses, typechecks, and desugars the
-- module, then returns the resulting Core module (consisting of the
-- module name, type declarations, and function declarations) if
-- successful.
compileToCoreModule :: GhcMonad m => FilePath -> m CoreModule
-- | Like compileToCoreModule, but invokes the simplifier, so as to return
-- simplified and tidied Core.
compileToCoreSimplified :: GhcMonad m => FilePath -> m CoreModule
-- | A ModuleGraph contains all the nodes from the home package (only).
-- There will be a node for each source module, plus a node for each
-- hi-boot module.
--
-- The graph is not necessarily stored in topologically-sorted order. Use
-- topSortModuleGraph and flattenSCC to achieve this.
type ModuleGraph = [ModSummary]
-- | A single node in a ModuleGraph. The nodes of the module graph
-- are one of:
--
--
-- - A regular Haskell source module
-- - A hi-boot source module
--
data ModSummary
ModSummary :: Module -> HscSource -> ModLocation -> UTCTime -> Maybe UTCTime -> Maybe UTCTime -> [(Maybe FastString, Located ModuleName)] -> [(Maybe FastString, Located ModuleName)] -> Maybe HsParsedModule -> FilePath -> DynFlags -> Maybe StringBuffer -> ModSummary
-- | Identity of the module
[ms_mod] :: ModSummary -> Module
-- | The module source either plain Haskell or hs-boot
[ms_hsc_src] :: ModSummary -> HscSource
-- | Location of the various files belonging to the module
[ms_location] :: ModSummary -> ModLocation
-- | Timestamp of source file
[ms_hs_date] :: ModSummary -> UTCTime
-- | Timestamp of object, if we have one
[ms_obj_date] :: ModSummary -> Maybe UTCTime
-- | Timestamp of hi file, if we *only* are typechecking (it is
-- Nothing otherwise. See Note [Recompilation checking when
-- typechecking only] and #9243
[ms_iface_date] :: ModSummary -> Maybe UTCTime
-- | Source imports of the module
[ms_srcimps] :: ModSummary -> [(Maybe FastString, Located ModuleName)]
-- | Non-source imports of the module from the module *text*
[ms_textual_imps] :: ModSummary -> [(Maybe FastString, Located ModuleName)]
-- | The parsed, nonrenamed source, if we have it. This is also used to
-- support "inline module syntax" in Backpack files.
[ms_parsed_mod] :: ModSummary -> Maybe HsParsedModule
-- | Filename of preprocessed source file
[ms_hspp_file] :: ModSummary -> FilePath
-- | Cached flags from OPTIONS, INCLUDE and
-- LANGUAGE pragmas in the modules source code
[ms_hspp_opts] :: ModSummary -> DynFlags
-- | The actual preprocessed source, if we have it
[ms_hspp_buf] :: ModSummary -> Maybe StringBuffer
ms_mod_name :: ModSummary -> ModuleName
-- | Module Location
--
-- Where a module lives on the file system: the actual locations of the
-- .hs, .hi and .o files, if we have them
data ModLocation
ModLocation :: Maybe FilePath -> FilePath -> FilePath -> ModLocation
[ml_hs_file] :: ModLocation -> Maybe FilePath
[ml_hi_file] :: ModLocation -> FilePath
[ml_obj_file] :: ModLocation -> FilePath
-- | Return the ModSummary of a module with the given name.
--
-- The module must be part of the module graph (see hsc_mod_graph
-- and ModuleGraph). If this is not the case, this function will
-- throw a GhcApiError.
--
-- This function ignores boot modules and requires that there is only one
-- non-boot module with the given name.
getModSummary :: GhcMonad m => ModuleName -> m ModSummary
-- | Get the module dependency graph.
getModuleGraph :: GhcMonad m => m ModuleGraph
-- | Return True == module is loaded.
isLoaded :: GhcMonad m => ModuleName -> m Bool
-- | Topological sort of the module graph
--
-- Calculate SCCs of the module graph, possibly dropping the hi-boot
-- nodes The resulting list of strongly-connected-components is in
-- topologically sorted order, starting with the module(s) at the bottom
-- of the dependency graph (ie compile them first) and ending with the
-- ones at the top.
--
-- Drop hi-boot nodes (first boolean arg)?
--
--
-- - False: treat the hi-boot summaries as nodes of the graph,
-- so the graph must be acyclic
-- - True: eliminate the hi-boot nodes, and instead pretend
-- the a source-import of Foo is an import of Foo The resulting graph has
-- no hi-boot nodes, but can be cyclic
--
topSortModuleGraph :: Bool -> [ModSummary] -> Maybe ModuleName -> [SCC ModSummary]
-- | Container for information about a Module.
data ModuleInfo
-- | Request information about a loaded Module
getModuleInfo :: GhcMonad m => Module -> m (Maybe ModuleInfo)
-- | The list of top-level entities defined in a module
modInfoTyThings :: ModuleInfo -> [TyThing]
modInfoTopLevelScope :: ModuleInfo -> Maybe [Name]
modInfoExports :: ModuleInfo -> [Name]
modInfoExportsWithSelectors :: ModuleInfo -> [Name]
-- | Returns the instances defined by the specified module. Warning:
-- currently unimplemented for package modules.
modInfoInstances :: ModuleInfo -> [ClsInst]
modInfoIsExportedName :: ModuleInfo -> Name -> Bool
modInfoLookupName :: GhcMonad m => ModuleInfo -> Name -> m (Maybe TyThing)
modInfoIface :: ModuleInfo -> Maybe ModIface
-- | Retrieve module safe haskell mode
modInfoSafe :: ModuleInfo -> SafeHaskellMode
-- | Looks up a global name: that is, any top-level name in any visible
-- module. Unlike lookupName, lookupGlobalName does not use the
-- interactive context, and therefore does not require a preceding
-- setContext.
lookupGlobalName :: GhcMonad m => Name -> m (Maybe TyThing)
findGlobalAnns :: (GhcMonad m, Typeable a) => ([Word8] -> a) -> AnnTarget Name -> m [a]
mkPrintUnqualifiedForModule :: GhcMonad m => ModuleInfo -> m (Maybe PrintUnqualified)
-- | A ModIface plus a ModDetails summarises everything we
-- know about a compiled module. The ModIface is the stuff
-- *before* linking, and can be written out to an interface file. The
-- 'ModDetails is after linking and can be completely recovered from just
-- the ModIface.
--
-- When we read an interface file, we also construct a ModIface
-- from it, except that we explicitly make the mi_decls and a few
-- other fields empty; as when reading we consolidate the declarations
-- etc. into a number of indexed maps and environments in the
-- ExternalPackageState.
data ModIface
ModIface :: !Module -> !(Maybe Module) -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !WhetherHasOrphans -> !WhetherHasFamInst -> !HscSource -> Dependencies -> [Usage] -> ![IfaceExport] -> !Fingerprint -> !Bool -> [(OccName, Fixity)] -> Warnings -> [IfaceAnnotation] -> [(Fingerprint, IfaceDecl)] -> !(Maybe GlobalRdrEnv) -> [IfaceClsInst] -> [IfaceFamInst] -> [IfaceRule] -> !Fingerprint -> !IfaceVectInfo -> (OccName -> Maybe WarningTxt) -> (OccName -> Maybe Fixity) -> (OccName -> Maybe (OccName, Fingerprint)) -> !AnyHpcUsage -> !IfaceTrustInfo -> !Bool -> [IfaceCompleteMatch] -> ModIface
-- | Name of the module we are for
[mi_module] :: ModIface -> !Module
-- | Are we a sig of another mod?
[mi_sig_of] :: ModIface -> !(Maybe Module)
-- | Hash of the whole interface
[mi_iface_hash] :: ModIface -> !Fingerprint
-- | Hash of the ABI only
[mi_mod_hash] :: ModIface -> !Fingerprint
-- | Hash of the important flags used when compiling this module
[mi_flag_hash] :: ModIface -> !Fingerprint
-- | Whether this module has orphans
[mi_orphan] :: ModIface -> !WhetherHasOrphans
-- | Whether this module has family instances. See Note [The type family
-- instance consistency story].
[mi_finsts] :: ModIface -> !WhetherHasFamInst
-- | Boot? Signature?
[mi_hsc_src] :: ModIface -> !HscSource
-- | The dependencies of the module. This is consulted for
-- directly-imported modules, but not for anything else (hence lazy)
[mi_deps] :: ModIface -> Dependencies
-- | Usages; kept sorted so that it's easy to decide whether to write a new
-- iface file (changing usages doesn't affect the hash of this module)
-- NOT STRICT! we read this field lazily from the interface file It is
-- *only* consulted by the recompilation checker
[mi_usages] :: ModIface -> [Usage]
-- | Exports Kept sorted by (mod,occ), to make version comparisons easier
-- Records the modules that are the declaration points for things
-- exported by this module, and the OccNames of those things
[mi_exports] :: ModIface -> ![IfaceExport]
-- | Hash of export list
[mi_exp_hash] :: ModIface -> !Fingerprint
-- | Module required TH splices when it was compiled. This disables
-- recompilation avoidance (see #481).
[mi_used_th] :: ModIface -> !Bool
-- | Fixities NOT STRICT! we read this field lazily from the interface file
[mi_fixities] :: ModIface -> [(OccName, Fixity)]
-- | Warnings NOT STRICT! we read this field lazily from the interface file
[mi_warns] :: ModIface -> Warnings
-- | Annotations NOT STRICT! we read this field lazily from the interface
-- file
[mi_anns] :: ModIface -> [IfaceAnnotation]
-- | Type, class and variable declarations The hash of an Id changes if its
-- fixity or deprecations change (as well as its type of course) Ditto
-- data constructors, class operations, except that the hash of the
-- parent class/tycon changes
[mi_decls] :: ModIface -> [(Fingerprint, IfaceDecl)]
-- | Binds all the things defined at the top level in the original
-- source code for this module. which is NOT the same as mi_exports,
-- nor mi_decls (which may contains declarations for things not actually
-- defined by the user). Used for GHCi and for inspecting the contents of
-- modules via the GHC API only.
--
-- (We need the source file to figure out the top-level environment, if
-- we didn't compile this module from source then this field contains
-- Nothing).
--
-- Strictly speaking this field should live in the HomeModInfo,
-- but that leads to more plumbing.
[mi_globals] :: ModIface -> !(Maybe GlobalRdrEnv)
-- | Sorted class instance
[mi_insts] :: ModIface -> [IfaceClsInst]
-- | Sorted family instances
[mi_fam_insts] :: ModIface -> [IfaceFamInst]
-- | Sorted rules
[mi_rules] :: ModIface -> [IfaceRule]
-- | Hash for orphan rules, class and family instances, and vectorise
-- pragmas combined
[mi_orphan_hash] :: ModIface -> !Fingerprint
-- | Vectorisation information
[mi_vect_info] :: ModIface -> !IfaceVectInfo
-- | Cached lookup for mi_warns
[mi_warn_fn] :: ModIface -> OccName -> Maybe WarningTxt
-- | Cached lookup for mi_fixities
[mi_fix_fn] :: ModIface -> OccName -> Maybe Fixity
-- | Cached lookup for mi_decls. The Nothing in
-- mi_hash_fn means that the thing isn't in decls. It's useful to
-- know that when seeing if we are up to date wrt. the old interface. The
-- OccName is the parent of the name, if it has one.
[mi_hash_fn] :: ModIface -> OccName -> Maybe (OccName, Fingerprint)
-- | True if this program uses Hpc at any point in the program.
[mi_hpc] :: ModIface -> !AnyHpcUsage
-- | Safe Haskell Trust information for this module.
[mi_trust] :: ModIface -> !IfaceTrustInfo
-- | Do we require the package this module resides in be trusted to trust
-- this module? This is used for the situation where a module is Safe (so
-- doesn't require the package be trusted itself) but imports some
-- trustworthy modules from its own package (which does require its own
-- package be trusted). See Note [RnNames . Trust Own Package]
[mi_trust_pkg] :: ModIface -> !Bool
[mi_complete_sigs] :: ModIface -> [IfaceCompleteMatch]
-- | The various Safe Haskell modes
data SafeHaskellMode
Sf_None :: SafeHaskellMode
Sf_Unsafe :: SafeHaskellMode
Sf_Trustworthy :: SafeHaskellMode
Sf_Safe :: SafeHaskellMode
-- | When printing code that contains original names, we need to map the
-- original names back to something the user understands. This is the
-- purpose of the triple of functions that gets passed around when
-- rendering SDoc.
data PrintUnqualified
alwaysQualify :: PrintUnqualified
-- | Run a statement in the current interactive context.
execStmt :: GhcMonad m => String -> ExecOptions -> m ExecResult
data ExecOptions
ExecOptions :: SingleStep -> String -> Int -> (ForeignHValue -> EvalExpr ForeignHValue) -> ExecOptions
-- | stepping mode
[execSingleStep] :: ExecOptions -> SingleStep
-- | filename (for errors)
[execSourceFile] :: ExecOptions -> String
-- | line number (for errors)
[execLineNumber] :: ExecOptions -> Int
[execWrap] :: ExecOptions -> ForeignHValue -> EvalExpr ForeignHValue
-- | default ExecOptions
execOptions :: ExecOptions
data ExecResult
ExecComplete :: Either SomeException [Name] -> Word64 -> ExecResult
[execResult] :: ExecResult -> Either SomeException [Name]
[execAllocation] :: ExecResult -> Word64
ExecBreak :: [Name] -> Maybe BreakInfo -> ExecResult
[breakNames] :: ExecResult -> [Name]
[breakInfo] :: ExecResult -> Maybe BreakInfo
resumeExec :: GhcMonad m => (SrcSpan -> Bool) -> SingleStep -> m ExecResult
runDecls :: GhcMonad m => String -> m [Name]
-- | Run some declarations and return any user-visible names that were
-- brought into scope.
runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name]
parseImportDecl :: GhcMonad m => String -> m (ImportDecl RdrName)
-- | Set the interactive evaluation context.
--
-- (setContext imports) sets the ic_imports field (which in turn
-- determines what is in scope at the prompt) to imports, and
-- constructs the ic_rn_glb_env environment to reflect it.
--
-- We retain in scope all the things defined at the prompt, and kept in
-- ic_tythings. (Indeed, they shadow stuff from ic_imports.)
setContext :: GhcMonad m => [InteractiveImport] -> m ()
-- | Get the interactive evaluation context, consisting of a pair of the
-- set of modules from which we take the full top-level scope, and the
-- set of modules from which we take just the exports respectively.
getContext :: GhcMonad m => m [InteractiveImport]
-- | Set the monad GHCi lifts user statements into.
--
-- Checks that a type (in string form) is an instance of the
-- GHC.GHCi.GHCiSandboxIO type class. Sets it to be the GHCi
-- monad if it is, throws an error otherwise.
setGHCiMonad :: GhcMonad m => String -> m ()
-- | Get the monad GHCi lifts user statements into.
getGHCiMonad :: GhcMonad m => m Name
-- | Return the bindings for the current interactive session.
getBindings :: GhcMonad m => m [TyThing]
-- | Return the instances for the current interactive session.
getInsts :: GhcMonad m => m ([ClsInst], [FamInst])
getPrintUnqual :: GhcMonad m => m PrintUnqualified
-- | Takes a ModuleName and possibly a UnitId, and consults
-- the filesystem and package database to find the corresponding
-- Module, using the algorithm that is used for an import
-- declaration.
findModule :: GhcMonad m => ModuleName -> Maybe FastString -> m Module
-- | Like findModule, but differs slightly when the module refers to
-- a source file, and the file has not been loaded via load. In
-- this case, findModule will throw an error (module not loaded),
-- but lookupModule will check to see whether the module can also
-- be found in a package, and if so, that package Module will be
-- returned. If not, the usual module-not-found error will be thrown.
lookupModule :: GhcMonad m => ModuleName -> Maybe FastString -> m Module
-- | Check that a module is safe to import (according to Safe Haskell).
--
-- We return True to indicate the import is safe and False otherwise
-- although in the False case an error may be thrown first.
isModuleTrusted :: GhcMonad m => Module -> m Bool
-- | Return if a module is trusted and the pkgs it depends on to be
-- trusted.
moduleTrustReqs :: GhcMonad m => Module -> m (Bool, Set InstalledUnitId)
-- | Returns all names in scope in the current interactive context
getNamesInScope :: GhcMonad m => m [Name]
-- | Returns all RdrNames in scope in the current interactive
-- context, excluding any that are internally-generated.
getRdrNamesInScope :: GhcMonad m => m [RdrName]
-- | get the GlobalRdrEnv for a session
getGRE :: GhcMonad m => m GlobalRdrEnv
-- | Returns True if the specified module is interpreted, and
-- hence has its full top-level scope available.
moduleIsInterpreted :: GhcMonad m => Module -> m Bool
-- | Looks up an identifier in the current interactive context (for :info)
-- Filter the instances by the ones whose tycons (or clases resp) are in
-- scope (qualified or otherwise). Otherwise we list a whole lot too
-- many! The exact choice of which ones to show, and which to hide, is a
-- judgement call. (see Trac #1581)
getInfo :: GhcMonad m => Bool -> Name -> m (Maybe (TyThing, Fixity, [ClsInst], [FamInst]))
showModule :: GhcMonad m => ModSummary -> m String
moduleIsBootOrNotObjectLinkable :: GhcMonad m => ModSummary -> m Bool
-- | Retrieve all type and family instances in the environment, indexed by
-- Name. Each name's lists will contain every instance in which
-- that name is mentioned in the instance head.
getNameToInstancesIndex :: GhcMonad m => m (Messages, Maybe (NameEnv ([ClsInst], [FamInst])))
-- | Get the type of an expression Returns the type as described by
-- TcRnExprMode
exprType :: GhcMonad m => TcRnExprMode -> String -> m Type
-- | How should we infer a type? See Note [TcRnExprMode]
data TcRnExprMode
-- | Instantiate the type fully (:type)
TM_Inst :: TcRnExprMode
-- | Do not instantiate the type (:type +v)
TM_NoInst :: TcRnExprMode
-- | Default the type eagerly (:type +d)
TM_Default :: TcRnExprMode
-- | Get the kind of a type
typeKind :: GhcMonad m => Bool -> String -> m (Type, Kind)
-- | Parses a string as an identifier, and returns the list of Names
-- that the identifier can refer to in the current interactive context.
parseName :: GhcMonad m => String -> m [Name]
-- | Returns the TyThing for a Name. The Name may
-- refer to any entity known to GHC, including Names defined using
-- runStmt.
lookupName :: GhcMonad m => Name -> m (Maybe TyThing)
data HValue :: *
-- | Parse an expression, the parsed expression can be further processed
-- and passed to compileParsedExpr.
parseExpr :: GhcMonad m => String -> m (LHsExpr RdrName)
compileParsedExpr :: GhcMonad m => LHsExpr RdrName -> m HValue
-- | Compile an expression, run it and deliver the resulting HValue.
compileExpr :: GhcMonad m => String -> m HValue
-- | Compile an expression, run it and return the result as a Dynamic.
dynCompileExpr :: GhcMonad m => String -> m Dynamic
type ForeignHValue = ForeignRef HValue
-- | Compile an expression, run it and deliver the resulting HValue.
compileExprRemote :: GhcMonad m => String -> m ForeignHValue
-- | Compile an parsed expression (before renaming), run it and deliver the
-- resulting HValue.
compileParsedExprRemote :: GhcMonad m => LHsExpr RdrName -> m ForeignHValue
runTcInteractive :: HscEnv -> TcRn a -> IO (Messages, Maybe a)
-- | Returns True if passed string is a statement.
isStmt :: DynFlags -> String -> Bool
-- | Returns True if passed string has an import declaration.
hasImport :: DynFlags -> String -> Bool
-- | Returns True if passed string is an import declaration.
isImport :: DynFlags -> String -> Bool
-- | Returns True if passed string is a declaration but not
-- a splice.
isDecl :: DynFlags -> String -> Bool
data SingleStep
RunToCompletion :: SingleStep
SingleStep :: SingleStep
RunAndLogSteps :: SingleStep
data Resume
Resume :: String -> ForeignRef (ResumeContext [HValueRef]) -> ([TyThing], GlobalRdrEnv) -> [Id] -> ForeignHValue -> Maybe BreakInfo -> SrcSpan -> String -> RemotePtr CostCentreStack -> [History] -> Int -> Resume
[resumeStmt] :: Resume -> String
[resumeContext] :: Resume -> ForeignRef (ResumeContext [HValueRef])
[resumeBindings] :: Resume -> ([TyThing], GlobalRdrEnv)
[resumeFinalIds] :: Resume -> [Id]
[resumeApStack] :: Resume -> ForeignHValue
[resumeBreakInfo] :: Resume -> Maybe BreakInfo
[resumeSpan] :: Resume -> SrcSpan
[resumeDecl] :: Resume -> String
[resumeCCS] :: Resume -> RemotePtr CostCentreStack
[resumeHistory] :: Resume -> [History]
[resumeHistoryIx] :: Resume -> Int
data History
getHistorySpan :: GhcMonad m => History -> m SrcSpan
getHistoryModule :: History -> Module
abandon :: GhcMonad m => m Bool
abandonAll :: GhcMonad m => m Bool
getResumeContext :: GhcMonad m => m [Resume]
obtainTermFromId :: GhcMonad m => Int -> Bool -> Id -> m Term
obtainTermFromVal :: GhcMonad m => Int -> Bool -> Type -> a -> m Term
reconstructType :: HscEnv -> Int -> Id -> IO (Maybe Type)
modInfoModBreaks :: ModuleInfo -> ModBreaks
-- | All the information about the breakpoints for a module
data ModBreaks
ModBreaks :: ForeignRef BreakArray -> !(Array BreakIndex SrcSpan) -> !(Array BreakIndex [OccName]) -> !(Array BreakIndex [String]) -> !(Array BreakIndex (RemotePtr CostCentre)) -> IntMap CgBreakInfo -> ModBreaks
-- | The array of flags, one per breakpoint, indicating which breakpoints
-- are enabled.
[modBreaks_flags] :: ModBreaks -> ForeignRef BreakArray
-- | An array giving the source span of each breakpoint.
[modBreaks_locs] :: ModBreaks -> !(Array BreakIndex SrcSpan)
-- | An array giving the names of the free variables at each breakpoint.
[modBreaks_vars] :: ModBreaks -> !(Array BreakIndex [OccName])
-- | An array giving the names of the declarations enclosing each
-- breakpoint.
[modBreaks_decls] :: ModBreaks -> !(Array BreakIndex [String])
-- | Array pointing to cost centre for each breakpoint
[modBreaks_ccs] :: ModBreaks -> !(Array BreakIndex (RemotePtr CostCentre))
-- | info about each breakpoint from the bytecode generator
[modBreaks_breakInfo] :: ModBreaks -> IntMap CgBreakInfo
-- | Breakpoint index
type BreakIndex = Int
data BreakInfo
back :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String)
forward :: GhcMonad m => Int -> m ([Name], Int, SrcSpan, String)
-- | A unit identifier identifies a (possibly partially) instantiated
-- library. It is primarily used as part of Module, which in turn
-- is used in Name, which is used to give names to entities when
-- typechecking.
--
-- There are two possible forms for a UnitId. It can be a
-- DefiniteUnitId, in which case we just have a string that
-- uniquely identifies some fully compiled, installed library we have on
-- disk. However, when we are typechecking a library with missing holes,
-- we may need to instantiate a library on the fly (in which case we
-- don't have any on-disk representation.) In that case, you have an
-- IndefiniteUnitId, which explicitly records the instantiation,
-- so that we can substitute over it.
data UnitId
-- | A Module is a pair of a UnitId and a ModuleName.
--
-- Module variables (i.e. H) which can be instantiated to
-- a specific module at some later point in time are represented with
-- moduleUnitId set to holeUnitId (this allows us to avoid
-- having to make moduleUnitId a partial operation.)
data Module
mkModule :: UnitId -> ModuleName -> Module
pprModule :: Module -> SDoc
moduleName :: Module -> ModuleName
moduleUnitId :: Module -> UnitId
-- | A ModuleName is essentially a simple string, e.g. Data.List.
data ModuleName
mkModuleName :: String -> ModuleName
moduleNameString :: ModuleName -> String
-- | A unique, unambiguous name for something, containing information about
-- where that thing originated.
data Name
isExternalName :: Name -> Bool
nameModule :: Name -> Module
-- | print a NamedThing, adding parentheses if the name is an
-- operator.
pprParenSymName :: NamedThing a => a -> SDoc
nameSrcSpan :: Name -> SrcSpan
-- | A class allowing convenient access to the Name of various
-- datatypes
class NamedThing a
getOccName :: NamedThing a => a -> OccName
getName :: NamedThing a => a -> Name
-- | Reader Name
--
-- Do not use the data constructors of RdrName directly: prefer the
-- family of functions that creates them, such as mkRdrUnqual
--
--
-- - Note: A Located RdrName will only have API Annotations if it is a
-- compound one, e.g.
--
--
--
-- `bar`
-- ( ~ )
--
--
--
data RdrName
-- | Unqualified name
--
-- Used for ordinary, unqualified occurrences, e.g. x,
-- y or Foo. Create such a RdrName with
-- mkRdrUnqual
Unqual :: OccName -> RdrName
-- | Qualified name
--
-- A qualified name written by the user in source code. The module
-- isn't necessarily the module where the thing is defined; just the one
-- from which it is imported. Examples are Bar.x, Bar.y
-- or Bar.Foo. Create such a RdrName with
-- mkRdrQual
Qual :: ModuleName -> OccName -> RdrName
-- | Identifier
type Id = Var
idType :: Id -> Kind
-- | isImplicitId tells whether an Ids info is implied by
-- other declarations, so we don't need to put its signature in an
-- interface file, even if it's mentioned in some other interface
-- unfolding.
isImplicitId :: Id -> Bool
isDeadBinder :: Id -> Bool
-- | isExportedIdVar means "don't throw this away"
isExportedId :: Var -> Bool
isLocalId :: Var -> Bool
isGlobalId :: Var -> Bool
isRecordSelector :: Id -> Bool
isPrimOpId :: Id -> Bool
isFCallId :: Id -> Bool
isClassOpId_maybe :: Id -> Maybe Class
isDataConWorkId :: Id -> Bool
-- | Get from either the worker or the wrapper Id to the
-- DataCon. Currently used only in the desugarer.
--
-- INVARIANT: idDataCon (dataConWrapId d) = d: remember,
-- dataConWrapId can return either the wrapper or the worker
idDataCon :: Id -> DataCon
-- | Returns true if an application to n args would diverge
isBottomingId :: Var -> Bool
isDictonaryId :: Id -> Bool
-- | If the Id is that for a record selector, extract the
-- sel_tycon. Panic otherwise.
recordSelectorTyCon :: Id -> RecSelParent
-- | TyCons represent type constructors. Type constructors are introduced
-- by things such as:
--
-- 1) Data declarations: data Foo = ... creates the Foo
-- type constructor of kind *
--
-- 2) Type synonyms: type Foo = ... creates the Foo
-- type constructor
--
-- 3) Newtypes: newtype Foo a = MkFoo ... creates the
-- Foo type constructor of kind * -> *
--
-- 4) Class declarations: class Foo where creates the
-- Foo type constructor of kind *
--
-- This data type also encodes a number of primitive, built in type
-- constructors such as those for function and tuple types.
data TyCon
-- | TyVar binders
tyConTyVars :: TyCon -> [TyVar]
-- | As tyConDataCons_maybe, but returns the empty list of
-- constructors if no constructors could be found
tyConDataCons :: TyCon -> [DataCon]
-- | Arity
tyConArity :: TyCon -> Arity
-- | Is this TyCon that for a class instance?
isClassTyCon :: TyCon -> Bool
-- | Is this a TyCon representing a regular H98 type synonym
-- (type)?
isTypeSynonymTyCon :: TyCon -> Bool
-- | Is this a synonym TyCon that can have may have further
-- instances appear?
isTypeFamilyTyCon :: TyCon -> Bool
-- | Is this TyCon that for a newtype
isNewTyCon :: TyCon -> Bool
-- | Does this TyCon represent something that cannot be defined in
-- Haskell?
isPrimTyCon :: TyCon -> Bool
isFunTyCon :: TyCon -> Bool
-- | Is this a TyCon, synonym or otherwise, that defines a family?
isFamilyTyCon :: TyCon -> Bool
-- | Is this a TyCon, synonym or otherwise, that defines a family
-- with instances?
isOpenFamilyTyCon :: TyCon -> Bool
-- | Is this an open type family TyCon?
isOpenTypeFamilyTyCon :: TyCon -> Bool
-- | If this TyCon is that for a class instance, return the class it
-- is for. Otherwise returns Nothing
tyConClass_maybe :: TyCon -> Maybe Class
-- | Extract the information pertaining to the right hand side of a type
-- synonym (type) declaration.
synTyConRhs_maybe :: TyCon -> Maybe Type
-- | Extract the TyVars bound by a vanilla type synonym and the
-- corresponding (unsubstituted) right hand side.
synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type)
-- | Kind of this TyCon
tyConKind :: TyCon -> Kind
-- | Type or kind Variable
type TyVar = Var
alphaTyVars :: [TyVar]
-- | A data constructor
--
--
data DataCon
-- | The "signature" of the DataCon returns, in order:
--
-- 1) The result of dataConAllTyVars,
--
-- 2) All the ThetaTypes relating to the DataCon (coercion,
-- dictionary, implicit parameter - whatever)
--
-- 3) The type arguments to the constructor
--
-- 4) The original result type of the DataCon
dataConSig :: DataCon -> ([TyVar], ThetaType, [Type], Type)
dataConType :: DataCon -> Type
-- | The type constructor that we are building via this data constructor
dataConTyCon :: DataCon -> TyCon
-- | The labels for the fields of this particular DataCon
dataConFieldLabels :: DataCon -> [FieldLabel]
-- | Should the DataCon be presented infix?
dataConIsInfix :: DataCon -> Bool
-- | Vanilla DataCons are those that are nice boring Haskell 98
-- constructors
isVanillaDataCon :: DataCon -> Bool
-- | The user-declared type of the data constructor in the nice-to-read
-- form:
--
--
-- T :: forall a b. a -> b -> T [a]
--
--
-- rather than:
--
--
-- T :: forall a c. forall b. (c~[a]) => a -> b -> T c
--
--
-- NB: If the constructor is part of a data instance, the result type
-- mentions the family tycon, not the internal one.
dataConUserType :: DataCon -> Type
-- | Strictness/unpack annotations, from user; or, for imported DataCons,
-- from the interface file The list is in one-to-one correspondence with
-- the arity of the DataCon
dataConSrcBangs :: DataCon -> [HsSrcBang]
data StrictnessMark
MarkedStrict :: StrictnessMark
NotMarkedStrict :: StrictnessMark
isMarkedStrict :: StrictnessMark -> Bool
data Class
classMethods :: Class -> [Id]
classSCTheta :: Class -> [PredType]
classTvsFds :: Class -> ([TyVar], [FunDep TyVar])
classATs :: Class -> [TyCon]
pprFundeps :: Outputable a => [FunDep a] -> SDoc
-- | A type-class instance. Note that there is some tricky laziness at work
-- here. See Note [ClsInst laziness and the rough-match fields] for more
-- details.
data ClsInst
instanceDFunId :: ClsInst -> DFunId
pprInstance :: ClsInst -> SDoc
pprInstanceHdr :: ClsInst -> SDoc
-- | Pretty-prints a FamInst (type/data family instance) with its
-- defining location.
pprFamInst :: FamInst -> SDoc
data FamInst
data Type
-- | Take a ForAllTy apart, returning the list of tyvars and the result
-- type. This always succeeds, even if it returns only an empty list.
-- Note that the result type returned may have free variables that were
-- bound by a forall.
splitForAllTys :: Type -> ([TyVar], Type)
-- | Extract the function result type and panic if that is not possible
funResultTy :: Type -> Type
pprParendType :: Type -> SDoc
pprTypeApp :: TyCon -> [Type] -> SDoc
-- | The key type representing kinds in the compiler.
type Kind = Type
-- | A type of the form p of kind Constraint represents a
-- value whose type is the Haskell predicate p, where a
-- predicate is what occurs before the => in a Haskell type.
--
-- We use PredType as documentation to mark those types that we
-- guarantee to have this kind.
--
-- It can be expanded into its representation, but:
--
--
-- - The type checker must treat it as opaque
-- - The rest of the compiler treats it as transparent
--
--
-- Consider these examples:
--
--
-- f :: (Eq a) => a -> Int
-- g :: (?x :: Int -> Int) => a -> Int
-- h :: (r\l) => {r} => {l::Int | r}
--
--
-- Here the Eq a and ?x :: Int -> Int and
-- rl are all called "predicates"
type PredType = Type
-- | A collection of PredTypes
type ThetaType = [PredType]
pprForAll :: [TyVarBinder] -> SDoc
pprThetaArrowTy :: ThetaType -> SDoc
-- | A global typecheckable-thing, essentially anything that has a name.
-- Not to be confused with a TcTyThing, which is also a
-- typecheckable thing but in the *local* context. See TcEnv for
-- how to retrieve a TyThing given a Name.
data TyThing
AnId :: Id -> TyThing
AConLike :: ConLike -> TyThing
ATyCon :: TyCon -> TyThing
ACoAxiom :: (CoAxiom Branched) -> TyThing
data FixityDirection
InfixL :: FixityDirection
InfixR :: FixityDirection
InfixN :: FixityDirection
defaultFixity :: Fixity
maxPrecedence :: Int
negateFixity :: Fixity
compareFixity :: Fixity -> Fixity -> (Bool, Bool)
-- | Captures the fixity of declarations as they are parsed. This is not
-- necessarily the same as the fixity declaration, as the normal fixity
-- may be overridden using parens or backticks.
data LexicalFixity
Prefix :: LexicalFixity
Infix :: LexicalFixity
-- | Source Location
data SrcLoc
RealSrcLoc :: {-# UNPACK #-} !RealSrcLoc -> SrcLoc
UnhelpfulLoc :: FastString -> SrcLoc
-- | Real Source Location
--
-- Represents a single point within a file
data RealSrcLoc
mkSrcLoc :: FastString -> Int -> Int -> SrcLoc
-- | Built-in "bad" SrcLoc values for particular locations
noSrcLoc :: SrcLoc
-- | Gives the filename of the RealSrcLoc
srcLocFile :: RealSrcLoc -> FastString
-- | Raises an error when used on a "bad" SrcLoc
srcLocLine :: RealSrcLoc -> Int
-- | Raises an error when used on a "bad" SrcLoc
srcLocCol :: RealSrcLoc -> Int
-- | Source Span
--
-- A SrcSpan identifies either a specific portion of a text file
-- or a human-readable description of a location.
data SrcSpan
RealSrcSpan :: !RealSrcSpan -> SrcSpan
UnhelpfulSpan :: !FastString -> SrcSpan
-- | A RealSrcSpan delimits a portion of a text file. It could be
-- represented by a pair of (line,column) coordinates, but in fact we
-- optimise slightly by using more compact representations for
-- single-line and zero-length spans, both of which are quite common.
--
-- The end position is defined to be the column after the end of
-- the span. That is, a span of (1,1)-(1,2) is one character long, and a
-- span of (1,1)-(1,1) is zero characters long.
--
-- Real Source Span
data RealSrcSpan
-- | Create a SrcSpan between two points in a file
mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan
-- | Create a SrcSpan corresponding to a single point
srcLocSpan :: SrcLoc -> SrcSpan
-- | Test if a SrcSpan is "good", i.e. has precise location
-- information
isGoodSrcSpan :: SrcSpan -> Bool
-- | Built-in "bad" SrcSpans for common sources of location
-- uncertainty
noSrcSpan :: SrcSpan
-- | Returns the location at the start of the SrcSpan or a "bad"
-- SrcSpan if that is unavailable
srcSpanStart :: SrcSpan -> SrcLoc
-- | Returns the location at the end of the SrcSpan or a "bad"
-- SrcSpan if that is unavailable
srcSpanEnd :: SrcSpan -> SrcLoc
srcSpanFile :: RealSrcSpan -> FastString
srcSpanStartLine :: RealSrcSpan -> Int
srcSpanEndLine :: RealSrcSpan -> Int
srcSpanStartCol :: RealSrcSpan -> Int
srcSpanEndCol :: RealSrcSpan -> Int
-- | We attach SrcSpans to lots of things, so let's have a datatype for it.
data GenLocated l e
L :: l -> e -> GenLocated l e
type Located e = GenLocated SrcSpan e
noLoc :: e -> Located e
mkGeneralLocated :: String -> e -> Located e
getLoc :: GenLocated l e -> l
unLoc :: GenLocated l e -> e
-- | Tests whether the two located things are equal
eqLocated :: Eq a => Located a -> Located a -> Bool
-- | Tests the ordering of the two located things
cmpLocated :: Ord a => Located a -> Located a -> Ordering
combineLocs :: Located a -> Located b -> SrcSpan
-- | Combine locations from two Located things and add them to a
-- third thing
addCLoc :: Located a -> Located b -> c -> Located c
-- | Alternative strategies for ordering SrcSpans
leftmost_smallest :: SrcSpan -> SrcSpan -> Ordering
-- | Alternative strategies for ordering SrcSpans
leftmost_largest :: SrcSpan -> SrcSpan -> Ordering
-- | Alternative strategies for ordering SrcSpans
rightmost :: SrcSpan -> SrcSpan -> Ordering
-- | Determines whether a span encloses a given line and column index
spans :: SrcSpan -> (Int, Int) -> Bool
-- | Determines whether a span is enclosed by another one
isSubspanOf :: SrcSpan -> SrcSpan -> Bool
-- | GHC's own exception type error messages all take the form:
--
--
-- location: error
--
--
--
-- If the location is on the command line, or in GHC itself, then
-- location="ghc". All of the error types below correspond to a
-- location of "ghc", except for ProgramError (where the string is
-- assumed to contain a location already, so we don't print one).
data GhcException
-- | Some other fatal signal (SIGHUP,SIGTERM)
Signal :: Int -> GhcException
-- | Prints the short usage msg after the error
UsageError :: String -> GhcException
-- | A problem with the command line arguments, but don't print usage.
CmdLineError :: String -> GhcException
-- | The impossible happened.
Panic :: String -> GhcException
PprPanic :: String -> SDoc -> GhcException
-- | The user tickled something that's known not to work yet, but we're not
-- counting it as a bug.
Sorry :: String -> GhcException
PprSorry :: String -> SDoc -> GhcException
-- | An installation problem.
InstallationError :: String -> GhcException
-- | An error in the user's code, probably.
ProgramError :: String -> GhcException
PprProgramError :: String -> SDoc -> GhcException
-- | Append a description of the given exception to this string.
--
-- Note that this uses unsafeGlobalDynFlags, which may have some
-- uninitialized fields if invoked before initGhcMonad has been
-- called. If the error message to be printed includes a pretty-printer
-- document which forces one of these fields this call may bottom.
showGhcException :: GhcException -> ShowS
data Token
-- | Return module source as token stream, including comments.
--
-- The module must be in the module graph and its source must be
-- available. Throws a SourceError on parse error.
getTokenStream :: GhcMonad m => Module -> m [Located Token]
-- | Give even more information on the source than getTokenStream
-- This function allows reconstructing the source completely with
-- showRichTokenStream.
getRichTokenStream :: GhcMonad m => Module -> m [(Located Token, String)]
-- | Take a rich token stream such as produced from
-- getRichTokenStream and return source code almost identical to
-- the original code (except for insignificant whitespace.)
showRichTokenStream :: [(Located Token, String)] -> String
-- | Given a source location and a StringBuffer corresponding to this
-- location, return a rich token stream with the source associated to the
-- tokens.
addSourceToTokens :: RealSrcLoc -> StringBuffer -> [Located Token] -> [(Located Token, String)]
-- | A pure interface to the module parser.
parser :: String -> DynFlags -> FilePath -> Either ErrorMessages (WarningMessages, Located (HsModule RdrName))
type ApiAnns = (Map ApiAnnKey [SrcSpan], Map SrcSpan [Located AnnotationComment])
-- | API Annotations exist so that tools can perform source to source
-- conversions of Haskell code. They are used to keep track of the
-- various syntactic keywords that are not captured in the existing AST.
--
-- The annotations, together with original source comments are made
-- available in the pm_annotations field of
-- ParsedModule. Comments are only retained if
-- Opt_KeepRawTokenStream is set in
-- DynFlags before parsing.
--
-- The wiki page describing this feature is
-- https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations
--
-- Note: in general the names of these are taken from the corresponding
-- token, unless otherwise noted See note [Api annotations] above for
-- details of the usage
data AnnKeywordId
AnnAnyclass :: AnnKeywordId
AnnAs :: AnnKeywordId
AnnAt :: AnnKeywordId
-- | !
AnnBang :: AnnKeywordId
-- | '`'
AnnBackquote :: AnnKeywordId
AnnBy :: AnnKeywordId
-- | case or lambda case
AnnCase :: AnnKeywordId
AnnClass :: AnnKeywordId
-- | '#)' or '#-}' etc
AnnClose :: AnnKeywordId
-- | '|)'
AnnCloseB :: AnnKeywordId
-- | '|)', unicode variant
AnnCloseBU :: AnnKeywordId
-- | '}'
AnnCloseC :: AnnKeywordId
-- | '|]'
AnnCloseQ :: AnnKeywordId
-- | '|]', unicode variant
AnnCloseQU :: AnnKeywordId
-- | ')'
AnnCloseP :: AnnKeywordId
-- | ']'
AnnCloseS :: AnnKeywordId
AnnColon :: AnnKeywordId
-- | as a list separator
AnnComma :: AnnKeywordId
-- | in a RdrName for a tuple
AnnCommaTuple :: AnnKeywordId
-- | '=>'
AnnDarrow :: AnnKeywordId
-- | '=>', unicode variant
AnnDarrowU :: AnnKeywordId
AnnData :: AnnKeywordId
-- | '::'
AnnDcolon :: AnnKeywordId
-- | '::', unicode variant
AnnDcolonU :: AnnKeywordId
AnnDefault :: AnnKeywordId
AnnDeriving :: AnnKeywordId
AnnDo :: AnnKeywordId
-- | .
AnnDot :: AnnKeywordId
-- | '..'
AnnDotdot :: AnnKeywordId
AnnElse :: AnnKeywordId
AnnEqual :: AnnKeywordId
AnnExport :: AnnKeywordId
AnnFamily :: AnnKeywordId
AnnForall :: AnnKeywordId
-- | Unicode variant
AnnForallU :: AnnKeywordId
AnnForeign :: AnnKeywordId
-- | for function name in matches where there are multiple equations for
-- the function.
AnnFunId :: AnnKeywordId
AnnGroup :: AnnKeywordId
-- | for CType
AnnHeader :: AnnKeywordId
AnnHiding :: AnnKeywordId
AnnIf :: AnnKeywordId
AnnImport :: AnnKeywordId
AnnIn :: AnnKeywordId
-- | 'infix' or 'infixl' or 'infixr'
AnnInfix :: AnnKeywordId
AnnInstance :: AnnKeywordId
AnnLam :: AnnKeywordId
-- | '<-'
AnnLarrow :: AnnKeywordId
-- | '<-', unicode variant
AnnLarrowU :: AnnKeywordId
AnnLet :: AnnKeywordId
AnnMdo :: AnnKeywordId
-- | -
AnnMinus :: AnnKeywordId
AnnModule :: AnnKeywordId
AnnNewtype :: AnnKeywordId
-- | where a name loses its location in the AST, this carries it
AnnName :: AnnKeywordId
AnnOf :: AnnKeywordId
-- | '(#' or '{-# LANGUAGE' etc
AnnOpen :: AnnKeywordId
-- | '(|'
AnnOpenB :: AnnKeywordId
-- | '(|', unicode variant
AnnOpenBU :: AnnKeywordId
-- | '{'
AnnOpenC :: AnnKeywordId
-- | '[e|' or '[e||'
AnnOpenE :: AnnKeywordId
-- | '[|'
AnnOpenEQ :: AnnKeywordId
-- | '[|', unicode variant
AnnOpenEQU :: AnnKeywordId
-- | '('
AnnOpenP :: AnnKeywordId
-- | '$('
AnnOpenPE :: AnnKeywordId
-- | '$$('
AnnOpenPTE :: AnnKeywordId
-- | '['
AnnOpenS :: AnnKeywordId
AnnPackageName :: AnnKeywordId
AnnPattern :: AnnKeywordId
AnnProc :: AnnKeywordId
AnnQualified :: AnnKeywordId
-- | '->'
AnnRarrow :: AnnKeywordId
-- | '->', unicode variant
AnnRarrowU :: AnnKeywordId
AnnRec :: AnnKeywordId
AnnRole :: AnnKeywordId
AnnSafe :: AnnKeywordId
-- | ';'
AnnSemi :: AnnKeywordId
-- | '''
AnnSimpleQuote :: AnnKeywordId
AnnSignature :: AnnKeywordId
-- | static
AnnStatic :: AnnKeywordId
AnnStock :: AnnKeywordId
AnnThen :: AnnKeywordId
-- | $
AnnThIdSplice :: AnnKeywordId
-- | $$
AnnThIdTySplice :: AnnKeywordId
-- | double '''
AnnThTyQuote :: AnnKeywordId
-- | '~'
AnnTilde :: AnnKeywordId
-- | ~#
AnnTildehsh :: AnnKeywordId
AnnType :: AnnKeywordId
-- | '()' for types
AnnUnit :: AnnKeywordId
AnnUsing :: AnnKeywordId
-- | e.g. INTEGER
AnnVal :: AnnKeywordId
-- | String value, will need quotes when output
AnnValStr :: AnnKeywordId
-- | '|'
AnnVbar :: AnnKeywordId
AnnWhere :: AnnKeywordId
-- | -<
Annlarrowtail :: AnnKeywordId
-- | -<, unicode variant
AnnlarrowtailU :: AnnKeywordId
-- | '->'
Annrarrowtail :: AnnKeywordId
-- | '->', unicode variant
AnnrarrowtailU :: AnnKeywordId
-- | -<<
AnnLarrowtail :: AnnKeywordId
-- | -<<, unicode variant
AnnLarrowtailU :: AnnKeywordId
-- | >>-
AnnRarrowtail :: AnnKeywordId
-- | >>-, unicode variant
AnnRarrowtailU :: AnnKeywordId
AnnEofPos :: AnnKeywordId
data AnnotationComment
-- | something beginning '-- |'
AnnDocCommentNext :: String -> AnnotationComment
-- | something beginning '-- ^'
AnnDocCommentPrev :: String -> AnnotationComment
-- | something beginning '-- $'
AnnDocCommentNamed :: String -> AnnotationComment
-- | a section heading
AnnDocSection :: Int -> String -> AnnotationComment
-- | doc options (prune, ignore-exports, etc)
AnnDocOptions :: String -> AnnotationComment
-- | comment starting by "--"
AnnLineComment :: String -> AnnotationComment
-- | comment in {- -}
AnnBlockComment :: String -> AnnotationComment
-- | Retrieve a list of annotation SrcSpans based on the
-- SrcSpan of the annotated AST element, and the known type of the
-- annotation.
getAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> [SrcSpan]
-- | Retrieve a list of annotation SrcSpans based on the
-- SrcSpan of the annotated AST element, and the known type of the
-- annotation. The list is removed from the annotations.
getAndRemoveAnnotation :: ApiAnns -> SrcSpan -> AnnKeywordId -> ([SrcSpan], ApiAnns)
-- | Retrieve the comments allocated to the current SrcSpan
--
-- Note: A given SrcSpan may appear in multiple AST elements,
-- beware of duplicates
getAnnotationComments :: ApiAnns -> SrcSpan -> [Located AnnotationComment]
-- | Retrieve the comments allocated to the current SrcSpan, and
-- remove them from the annotations
getAndRemoveAnnotationComments :: ApiAnns -> SrcSpan -> ([Located AnnotationComment], ApiAnns)
-- | Convert a normal annotation into its unicode equivalent one
unicodeAnn :: AnnKeywordId -> AnnKeywordId
cyclicModuleErr :: [ModSummary] -> SDoc
instance GHC.DesugaredMod GHC.DesugaredModule
instance GHC.TypecheckedMod GHC.TypecheckedModule
instance GHC.TypecheckedMod GHC.DesugaredModule
instance GHC.ParsedMod GHC.DesugaredModule
instance GHC.ParsedMod GHC.TypecheckedModule
instance Outputable.Outputable GHC.CoreModule
instance GHC.ParsedMod GHC.ParsedModule
module DriverMkDepend
doMkDependHS :: GhcMonad m => [FilePath] -> m ()
module Debugger
-- | The :print & friends commands
pprintClosureCommand :: GhcMonad m => Bool -> Bool -> String -> m ()
showTerm :: GhcMonad m => Term -> m SDoc
pprTypeAndContents :: GhcMonad m => Id -> m SDoc
-- | This is the driver for the 'ghc --backpack' mode, which is a
-- reimplementation of the "package manager" bits of Backpack directly in
-- GHC. The basic method of operation is to compile packages and then
-- directly insert them into GHC's in memory database.
--
-- The compilation products of this mode aren't really suitable for
-- Cabal, because GHC makes up component IDs for the things it builds and
-- doesn't serialize out the database contents. But it's still handy for
-- constructing tests.
module DriverBkp
-- | Entry point to compile a Backpack file.
doBackpack :: [FilePath] -> Ghc ()
instance GHC.Classes.Eq DriverBkp.SessionType
instance DynFlags.HasDynFlags DriverBkp.BkpM
instance GhcMonad.GhcMonad DriverBkp.BkpM