-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | The GHC API, decoupled from GHC versions
--
-- A package equivalent to the ghc package, but which can be
-- loaded on many compiler versions.
@package ghc-lib-parser
@version 0.20220401
-- | Note [Base Dir] ~~~~~~~~~~~~~~~~~ GHC's base directory or top
-- directory containers miscellaneous settings and the package database.
-- The main compiler of course needs this directory to read those
-- settings and read and write packages. ghc-pkg uses it to find the
-- global package database too.
--
-- In the interest of making GHC builds more relocatable, many settings
-- also will expand `${top_dir}` inside strings so GHC doesn't need to
-- know it's on installation location at build time. ghc-pkg also can
-- expand those variables and so needs the top dir location to do that
-- too.
module GHC.BaseDir
-- | Expand occurrences of the $topdir interpolation in a string.
expandTopDir :: FilePath -> String -> String
-- |
-- expandPathVar var value str
--
--
-- replaces occurrences of variable $var with value in
-- str.
expandPathVar :: String -> FilePath -> String -> String
-- | Calculate the location of the base dir
getBaseDir :: IO (Maybe String)
module GHC.Data.SizedSeq
data SizedSeq a
SizedSeq :: {-# UNPACK #-} !Word -> [a] -> SizedSeq a
emptySS :: SizedSeq a
addToSS :: SizedSeq a -> a -> SizedSeq a
addListToSS :: SizedSeq a -> [a] -> SizedSeq a
ssElts :: SizedSeq a -> [a]
sizeSS :: SizedSeq a -> Word
instance GHC.Show.Show a => GHC.Show.Show (GHC.Data.SizedSeq.SizedSeq a)
instance GHC.Generics.Generic (GHC.Data.SizedSeq.SizedSeq a)
instance GHC.Base.Functor GHC.Data.SizedSeq.SizedSeq
instance Data.Foldable.Foldable GHC.Data.SizedSeq.SizedSeq
instance Data.Traversable.Traversable GHC.Data.SizedSeq.SizedSeq
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHC.Data.SizedSeq.SizedSeq a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (GHC.Data.SizedSeq.SizedSeq a)
module GHC.Exts.Heap.ClosureTypes
data ClosureType
INVALID_OBJECT :: ClosureType
CONSTR :: ClosureType
CONSTR_1_0 :: ClosureType
CONSTR_0_1 :: ClosureType
CONSTR_2_0 :: ClosureType
CONSTR_1_1 :: ClosureType
CONSTR_0_2 :: ClosureType
CONSTR_NOCAF :: ClosureType
FUN :: ClosureType
FUN_1_0 :: ClosureType
FUN_0_1 :: ClosureType
FUN_2_0 :: ClosureType
FUN_1_1 :: ClosureType
FUN_0_2 :: ClosureType
FUN_STATIC :: ClosureType
THUNK :: ClosureType
THUNK_1_0 :: ClosureType
THUNK_0_1 :: ClosureType
THUNK_2_0 :: ClosureType
THUNK_1_1 :: ClosureType
THUNK_0_2 :: ClosureType
THUNK_STATIC :: ClosureType
THUNK_SELECTOR :: ClosureType
BCO :: ClosureType
AP :: ClosureType
PAP :: ClosureType
AP_STACK :: ClosureType
IND :: ClosureType
IND_STATIC :: ClosureType
RET_BCO :: ClosureType
RET_SMALL :: ClosureType
RET_BIG :: ClosureType
RET_FUN :: ClosureType
UPDATE_FRAME :: ClosureType
CATCH_FRAME :: ClosureType
UNDERFLOW_FRAME :: ClosureType
STOP_FRAME :: ClosureType
BLOCKING_QUEUE :: ClosureType
BLACKHOLE :: ClosureType
MVAR_CLEAN :: ClosureType
MVAR_DIRTY :: ClosureType
TVAR :: ClosureType
ARR_WORDS :: ClosureType
MUT_ARR_PTRS_CLEAN :: ClosureType
MUT_ARR_PTRS_DIRTY :: ClosureType
MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType
MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType
MUT_VAR_CLEAN :: ClosureType
MUT_VAR_DIRTY :: ClosureType
WEAK :: ClosureType
PRIM :: ClosureType
MUT_PRIM :: ClosureType
TSO :: ClosureType
STACK :: ClosureType
TREC_CHUNK :: ClosureType
ATOMICALLY_FRAME :: ClosureType
CATCH_RETRY_FRAME :: ClosureType
CATCH_STM_FRAME :: ClosureType
WHITEHOLE :: ClosureType
SMALL_MUT_ARR_PTRS_CLEAN :: ClosureType
SMALL_MUT_ARR_PTRS_DIRTY :: ClosureType
SMALL_MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType
SMALL_MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType
COMPACT_NFDATA :: ClosureType
N_CLOSURE_TYPES :: ClosureType
-- | Return the size of the closures header in words
closureTypeHeaderSize :: ClosureType -> Int
instance GHC.Generics.Generic GHC.Exts.Heap.ClosureTypes.ClosureType
instance GHC.Show.Show GHC.Exts.Heap.ClosureTypes.ClosureType
instance GHC.Classes.Ord GHC.Exts.Heap.ClosureTypes.ClosureType
instance GHC.Classes.Eq GHC.Exts.Heap.ClosureTypes.ClosureType
instance GHC.Enum.Enum GHC.Exts.Heap.ClosureTypes.ClosureType
module GHC.Exts.Heap.Constants
wORD_SIZE :: Int
tAG_MASK :: Int
wORD_SIZE_IN_BITS :: Int
module GHC.Exts.Heap.InfoTable.Types
-- | This is a somewhat faithful representation of an info table. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/InfoTables.h
-- for more details on this data structure.
data StgInfoTable
StgInfoTable :: Maybe EntryFunPtr -> HalfWord -> HalfWord -> ClosureType -> HalfWord -> Maybe ItblCodes -> StgInfoTable
[entry] :: StgInfoTable -> Maybe EntryFunPtr
[ptrs] :: StgInfoTable -> HalfWord
[nptrs] :: StgInfoTable -> HalfWord
[tipe] :: StgInfoTable -> ClosureType
[srtlen] :: StgInfoTable -> HalfWord
[code] :: StgInfoTable -> Maybe ItblCodes
type EntryFunPtr = FunPtr (Ptr () -> IO (Ptr ()))
type HalfWord = Word32
type ItblCodes = Either [Word8] [Word32]
instance GHC.Generics.Generic GHC.Exts.Heap.InfoTable.Types.StgInfoTable
instance GHC.Show.Show GHC.Exts.Heap.InfoTable.Types.StgInfoTable
module GHC.Exts.Heap.InfoTable
-- | Size in bytes of a standard InfoTable
itblSize :: Int
-- | Read an InfoTable from the heap into a haskell type. WARNING: This
-- code assumes it is passed a pointer to a "standard" info table. If
-- tables_next_to_code is enabled, it will look 1 byte before the start
-- for the entry field.
peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
module GHC.Exts.Heap.InfoTableProf
itblSize :: Int
-- | Read an InfoTable from the heap into a haskell type. WARNING: This
-- code assumes it is passed a pointer to a "standard" info table. If
-- tables_next_to_code is enabled, it will look 1 byte before the start
-- for the entry field.
peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
module GHC.Exts.Heap.ProfInfo.Types
-- | This is a somewhat faithful representation of StgTSOProfInfo. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/TSO.h
-- for more details on this data structure.
newtype StgTSOProfInfo
StgTSOProfInfo :: Maybe CostCentreStack -> StgTSOProfInfo
[cccs] :: StgTSOProfInfo -> Maybe CostCentreStack
-- | This is a somewhat faithful representation of CostCentreStack. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h
-- for more details on this data structure.
data CostCentreStack
CostCentreStack :: Int -> CostCentre -> Maybe CostCentreStack -> Maybe IndexTable -> Maybe CostCentreStack -> Word -> Word64 -> Word -> Word -> Word64 -> Word64 -> Word -> CostCentreStack
[ccs_ccsID] :: CostCentreStack -> Int
[ccs_cc] :: CostCentreStack -> CostCentre
[ccs_prevStack] :: CostCentreStack -> Maybe CostCentreStack
[ccs_indexTable] :: CostCentreStack -> Maybe IndexTable
[ccs_root] :: CostCentreStack -> Maybe CostCentreStack
[ccs_depth] :: CostCentreStack -> Word
[ccs_scc_count] :: CostCentreStack -> Word64
[ccs_selected] :: CostCentreStack -> Word
[ccs_time_ticks] :: CostCentreStack -> Word
[ccs_mem_alloc] :: CostCentreStack -> Word64
[ccs_inherited_alloc] :: CostCentreStack -> Word64
[ccs_inherited_ticks] :: CostCentreStack -> Word
-- | This is a somewhat faithful representation of CostCentre. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h
-- for more details on this data structure.
data CostCentre
CostCentre :: Int -> String -> String -> Maybe String -> Word64 -> Word -> Bool -> Maybe CostCentre -> CostCentre
[cc_ccID] :: CostCentre -> Int
[cc_label] :: CostCentre -> String
[cc_module] :: CostCentre -> String
[cc_srcloc] :: CostCentre -> Maybe String
[cc_mem_alloc] :: CostCentre -> Word64
[cc_time_ticks] :: CostCentre -> Word
[cc_is_caf] :: CostCentre -> Bool
[cc_link] :: CostCentre -> Maybe CostCentre
-- | This is a somewhat faithful representation of IndexTable. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h
-- for more details on this data structure.
data IndexTable
IndexTable :: CostCentre -> Maybe CostCentreStack -> Maybe IndexTable -> Bool -> IndexTable
[it_cc] :: IndexTable -> CostCentre
[it_ccs] :: IndexTable -> Maybe CostCentreStack
[it_next] :: IndexTable -> Maybe IndexTable
[it_back_edge] :: IndexTable -> Bool
instance GHC.Classes.Ord GHC.Exts.Heap.ProfInfo.Types.CostCentre
instance GHC.Classes.Eq GHC.Exts.Heap.ProfInfo.Types.CostCentre
instance GHC.Generics.Generic GHC.Exts.Heap.ProfInfo.Types.CostCentre
instance GHC.Show.Show GHC.Exts.Heap.ProfInfo.Types.CostCentre
instance GHC.Classes.Ord GHC.Exts.Heap.ProfInfo.Types.CostCentreStack
instance GHC.Classes.Eq GHC.Exts.Heap.ProfInfo.Types.CostCentreStack
instance GHC.Generics.Generic GHC.Exts.Heap.ProfInfo.Types.CostCentreStack
instance GHC.Show.Show GHC.Exts.Heap.ProfInfo.Types.CostCentreStack
instance GHC.Classes.Ord GHC.Exts.Heap.ProfInfo.Types.IndexTable
instance GHC.Classes.Eq GHC.Exts.Heap.ProfInfo.Types.IndexTable
instance GHC.Generics.Generic GHC.Exts.Heap.ProfInfo.Types.IndexTable
instance GHC.Show.Show GHC.Exts.Heap.ProfInfo.Types.IndexTable
instance GHC.Classes.Ord GHC.Exts.Heap.ProfInfo.Types.StgTSOProfInfo
instance GHC.Classes.Eq GHC.Exts.Heap.ProfInfo.Types.StgTSOProfInfo
instance GHC.Generics.Generic GHC.Exts.Heap.ProfInfo.Types.StgTSOProfInfo
instance GHC.Show.Show GHC.Exts.Heap.ProfInfo.Types.StgTSOProfInfo
module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled
peekStgTSOProfInfo :: (Ptr b -> IO (Maybe CostCentreStack)) -> Ptr a -> IO (Maybe StgTSOProfInfo)
peekTopCCS :: Ptr a -> IO (Maybe CostCentreStack)
module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingDisabled
-- | This implementation is used when PROFILING is undefined. It always
-- returns Nothing, because there is no profiling info available.
peekStgTSOProfInfo :: (Ptr a -> IO (Maybe CostCentreStack)) -> Ptr tsoPtr -> IO (Maybe StgTSOProfInfo)
peekTopCCS :: Ptr a -> IO (Maybe CostCentreStack)
module GHC.Exts.Heap.ProfInfo.PeekProfInfo
module GHC.Exts.Heap.Closures
type Closure = GenClosure Box
-- | This is the representation of a Haskell value on the heap. It reflects
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/Closures.h
--
-- The data type is parametrized by b: the type to store
-- references in. Usually this is a Box with the type synonym
-- Closure.
--
-- All Heap objects have the same basic layout. A header containing a
-- pointer to the info table and a payload with various fields. The
-- info field below always refers to the info table pointed to
-- by the header. The remaining fields are the payload.
--
-- See
-- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects
-- for more information.
data GenClosure b
-- | A data constructor
ConstrClosure :: !StgInfoTable -> ![b] -> ![Word] -> !String -> !String -> !String -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer arguments
[ptrArgs] :: GenClosure b -> ![b]
-- | Non-pointer arguments
[dataArgs] :: GenClosure b -> ![Word]
-- | Package name
[pkg] :: GenClosure b -> !String
-- | Module name
[modl] :: GenClosure b -> !String
-- | Constructor name
[name] :: GenClosure b -> !String
-- | A function
FunClosure :: !StgInfoTable -> ![b] -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer arguments
[ptrArgs] :: GenClosure b -> ![b]
-- | Non-pointer arguments
[dataArgs] :: GenClosure b -> ![Word]
-- | A thunk, an expression not obviously in head normal form
ThunkClosure :: !StgInfoTable -> ![b] -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer arguments
[ptrArgs] :: GenClosure b -> ![b]
-- | Non-pointer arguments
[dataArgs] :: GenClosure b -> ![Word]
-- | A thunk which performs a simple selection operation
SelectorClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to the object being selected from
[selectee] :: GenClosure b -> !b
-- | An unsaturated function application
PAPClosure :: !StgInfoTable -> !HalfWord -> !HalfWord -> !b -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Arity of the partial application
[arity] :: GenClosure b -> !HalfWord
-- | Size of the payload in words
[n_args] :: GenClosure b -> !HalfWord
-- | Pointer to a FunClosure
[fun] :: GenClosure b -> !b
-- | Sequence of already applied arguments
[payload] :: GenClosure b -> ![b]
-- | A function application
APClosure :: !StgInfoTable -> !HalfWord -> !HalfWord -> !b -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Arity of the partial application
[arity] :: GenClosure b -> !HalfWord
-- | Size of the payload in words
[n_args] :: GenClosure b -> !HalfWord
-- | Pointer to a FunClosure
[fun] :: GenClosure b -> !b
-- | Sequence of already applied arguments
[payload] :: GenClosure b -> ![b]
-- | A suspended thunk evaluation
APStackClosure :: !StgInfoTable -> !b -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to a FunClosure
[fun] :: GenClosure b -> !b
-- | Sequence of already applied arguments
[payload] :: GenClosure b -> ![b]
-- | A pointer to another closure, introduced when a thunk is updated to
-- point at its value
IndClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Target closure
[indirectee] :: GenClosure b -> !b
-- | A byte-code object (BCO) which can be interpreted by GHC's byte-code
-- interpreter (e.g. as used by GHCi)
BCOClosure :: !StgInfoTable -> !b -> !b -> !b -> !HalfWord -> !HalfWord -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | A pointer to an ArrWords of instructions
[instrs] :: GenClosure b -> !b
-- | A pointer to an ArrWords of literals
[literals] :: GenClosure b -> !b
-- | A pointer to an ArrWords of byte code objects
[bcoptrs] :: GenClosure b -> !b
-- | Arity of the partial application
[arity] :: GenClosure b -> !HalfWord
-- | The size of this BCO in words
[size] :: GenClosure b -> !HalfWord
-- | An StgLargeBitmap describing the pointerhood of its args/free vars
[bitmap] :: GenClosure b -> ![Word]
-- | A thunk under evaluation by another thread
BlackholeClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Target closure
[indirectee] :: GenClosure b -> !b
-- | A ByteArray#
ArrWordsClosure :: !StgInfoTable -> !Word -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Size of array in bytes
[bytes] :: GenClosure b -> !Word
-- | Array payload
[arrWords] :: GenClosure b -> ![Word]
-- | A MutableByteArray#
MutArrClosure :: !StgInfoTable -> !Word -> !Word -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Number of pointers
[mccPtrs] :: GenClosure b -> !Word
-- | ?? Closures.h vs ClosureMacros.h
[mccSize] :: GenClosure b -> !Word
-- | Array payload Card table ignored
[mccPayload] :: GenClosure b -> ![b]
-- | A SmallMutableArray#
SmallMutArrClosure :: !StgInfoTable -> !Word -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Number of pointers
[mccPtrs] :: GenClosure b -> !Word
-- | Array payload Card table ignored
[mccPayload] :: GenClosure b -> ![b]
-- | An MVar#, with a queue of thread state objects blocking on
-- them
MVarClosure :: !StgInfoTable -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to head of queue
[queueHead] :: GenClosure b -> !b
-- | Pointer to tail of queue
[queueTail] :: GenClosure b -> !b
-- | Pointer to closure
[value] :: GenClosure b -> !b
-- | An IOPort#, with a queue of thread state objects blocking on
-- them
IOPortClosure :: !StgInfoTable -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to head of queue
[queueHead] :: GenClosure b -> !b
-- | Pointer to tail of queue
[queueTail] :: GenClosure b -> !b
-- | Pointer to closure
[value] :: GenClosure b -> !b
-- | A MutVar#
MutVarClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to contents
[var] :: GenClosure b -> !b
-- | An STM blocking queue.
BlockingQueueClosure :: !StgInfoTable -> !b -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | ?? Here so it looks like an IND
[link] :: GenClosure b -> !b
-- | The blackhole closure
[blackHole] :: GenClosure b -> !b
-- | The owning thread state object
[owner] :: GenClosure b -> !b
-- | ??
[queue] :: GenClosure b -> !b
WeakClosure :: !StgInfoTable -> !b -> !b -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
[cfinalizers] :: GenClosure b -> !b
[key] :: GenClosure b -> !b
-- | Pointer to closure
[value] :: GenClosure b -> !b
[finalizer] :: GenClosure b -> !b
-- | ?? Here so it looks like an IND
[link] :: GenClosure b -> !b
-- | Representation of StgTSO: A Thread State Object. The values for
-- what_next, why_blocked and flags are defined in
-- Constants.h.
TSOClosure :: !StgInfoTable -> !b -> !b -> !b -> !b -> !b -> !b -> !WhatNext -> !WhyBlocked -> ![TsoFlags] -> !Word64 -> !Word32 -> !Word32 -> !Int64 -> !Word32 -> !Maybe StgTSOProfInfo -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | ?? Here so it looks like an IND
[link] :: GenClosure b -> !b
[global_link] :: GenClosure b -> !b
-- | stackobj from StgTSO
[tsoStack] :: GenClosure b -> !b
[trec] :: GenClosure b -> !b
[blocked_exceptions] :: GenClosure b -> !b
[bq] :: GenClosure b -> !b
[what_next] :: GenClosure b -> !WhatNext
[why_blocked] :: GenClosure b -> !WhyBlocked
[flags] :: GenClosure b -> ![TsoFlags]
[threadId] :: GenClosure b -> !Word64
[saved_errno] :: GenClosure b -> !Word32
-- | non-zero => dirty
[tso_dirty] :: GenClosure b -> !Word32
[alloc_limit] :: GenClosure b -> !Int64
[tot_stack_size] :: GenClosure b -> !Word32
[prof] :: GenClosure b -> !Maybe StgTSOProfInfo
-- | Representation of StgStack: The 'tsoStack ' of a TSOClosure.
StackClosure :: !StgInfoTable -> !Word32 -> !Word8 -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | stack size in *words*
[stack_size] :: GenClosure b -> !Word32
-- | non-zero => dirty
[stack_dirty] :: GenClosure b -> !Word8
-- | Primitive Int
IntClosure :: PrimType -> !Int -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[intVal] :: GenClosure b -> !Int
-- | Primitive Word
WordClosure :: PrimType -> !Word -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[wordVal] :: GenClosure b -> !Word
-- | Primitive Int64
Int64Closure :: PrimType -> !Int64 -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[int64Val] :: GenClosure b -> !Int64
-- | Primitive Word64
Word64Closure :: PrimType -> !Word64 -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[word64Val] :: GenClosure b -> !Word64
-- | Primitive Addr
AddrClosure :: PrimType -> !Int -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[addrVal] :: GenClosure b -> !Int
-- | Primitive Float
FloatClosure :: PrimType -> !Float -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[floatVal] :: GenClosure b -> !Float
-- | Primitive Double
DoubleClosure :: PrimType -> !Double -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[doubleVal] :: GenClosure b -> !Double
-- | Another kind of closure
OtherClosure :: !StgInfoTable -> ![b] -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
[hvalues] :: GenClosure b -> ![b]
[rawWords] :: GenClosure b -> ![Word]
UnsupportedClosure :: !StgInfoTable -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
data PrimType
PInt :: PrimType
PWord :: PrimType
PInt64 :: PrimType
PWord64 :: PrimType
PAddr :: PrimType
PFloat :: PrimType
PDouble :: PrimType
data WhatNext
ThreadRunGHC :: WhatNext
ThreadInterpret :: WhatNext
ThreadKilled :: WhatNext
ThreadComplete :: WhatNext
-- | Please report this as a bug
WhatNextUnknownValue :: Word16 -> WhatNext
data WhyBlocked
NotBlocked :: WhyBlocked
BlockedOnMVar :: WhyBlocked
BlockedOnMVarRead :: WhyBlocked
BlockedOnBlackHole :: WhyBlocked
BlockedOnRead :: WhyBlocked
BlockedOnWrite :: WhyBlocked
BlockedOnDelay :: WhyBlocked
BlockedOnSTM :: WhyBlocked
BlockedOnDoProc :: WhyBlocked
BlockedOnCCall :: WhyBlocked
BlockedOnCCall_Interruptible :: WhyBlocked
BlockedOnMsgThrowTo :: WhyBlocked
ThreadMigrating :: WhyBlocked
-- | Please report this as a bug
WhyBlockedUnknownValue :: Word16 -> WhyBlocked
data TsoFlags
TsoLocked :: TsoFlags
TsoBlockx :: TsoFlags
TsoInterruptible :: TsoFlags
TsoStoppedOnBreakpoint :: TsoFlags
TsoMarked :: TsoFlags
TsoSqueezed :: TsoFlags
TsoAllocLimit :: TsoFlags
-- | Please report this as a bug
TsoFlagsUnknownValue :: Word32 -> TsoFlags
-- | For generic code, this function returns all referenced closures.
allClosures :: GenClosure b -> [b]
-- | Get the size of the top-level closure in words. Includes header and
-- payload. Does not follow pointers.
closureSize :: Box -> Int
-- | An arbitrary Haskell value in a safe Box. The point is that even
-- unevaluated thunks can safely be moved around inside the Box, and when
-- required, e.g. in getBoxedClosureData, the function knows how
-- far it has to evaluate the argument.
data Box
Box :: Any -> Box
-- | Boxes can be compared, but this is not pure, as different heap objects
-- can, after garbage collection, become the same object.
areBoxesEqual :: Box -> Box -> IO Bool
-- | This takes an arbitrary value and puts it into a box. Note that calls
-- like
--
--
-- asBox (head list)
--
--
-- will put the thunk "head list" into the box, not the element at
-- the head of the list. For that, use careful case expressions:
--
--
-- case list of x:_ -> asBox x
--
asBox :: a -> Box
instance GHC.Classes.Ord GHC.Exts.Heap.Closures.PrimType
instance GHC.Generics.Generic GHC.Exts.Heap.Closures.PrimType
instance GHC.Show.Show GHC.Exts.Heap.Closures.PrimType
instance GHC.Classes.Eq GHC.Exts.Heap.Closures.PrimType
instance GHC.Classes.Ord GHC.Exts.Heap.Closures.WhatNext
instance GHC.Generics.Generic GHC.Exts.Heap.Closures.WhatNext
instance GHC.Show.Show GHC.Exts.Heap.Closures.WhatNext
instance GHC.Classes.Eq GHC.Exts.Heap.Closures.WhatNext
instance GHC.Classes.Ord GHC.Exts.Heap.Closures.WhyBlocked
instance GHC.Generics.Generic GHC.Exts.Heap.Closures.WhyBlocked
instance GHC.Show.Show GHC.Exts.Heap.Closures.WhyBlocked
instance GHC.Classes.Eq GHC.Exts.Heap.Closures.WhyBlocked
instance GHC.Classes.Ord GHC.Exts.Heap.Closures.TsoFlags
instance GHC.Generics.Generic GHC.Exts.Heap.Closures.TsoFlags
instance GHC.Show.Show GHC.Exts.Heap.Closures.TsoFlags
instance GHC.Classes.Eq GHC.Exts.Heap.Closures.TsoFlags
instance Data.Traversable.Traversable GHC.Exts.Heap.Closures.GenClosure
instance Data.Foldable.Foldable GHC.Exts.Heap.Closures.GenClosure
instance GHC.Base.Functor GHC.Exts.Heap.Closures.GenClosure
instance GHC.Generics.Generic (GHC.Exts.Heap.Closures.GenClosure b)
instance GHC.Show.Show b => GHC.Show.Show (GHC.Exts.Heap.Closures.GenClosure b)
instance GHC.Show.Show GHC.Exts.Heap.Closures.Box
module GHC.Exts.Heap.FFIClosures_ProfilingEnabled
data TSOFields
TSOFields :: WhatNext -> WhyBlocked -> [TsoFlags] -> Word64 -> Word32 -> Word32 -> Int64 -> Word32 -> Maybe StgTSOProfInfo -> TSOFields
[tso_what_next] :: TSOFields -> WhatNext
[tso_why_blocked] :: TSOFields -> WhyBlocked
[tso_flags] :: TSOFields -> [TsoFlags]
[tso_threadId] :: TSOFields -> Word64
[tso_saved_errno] :: TSOFields -> Word32
[tso_dirty] :: TSOFields -> Word32
[tso_alloc_limit] :: TSOFields -> Int64
[tso_tot_stack_size] :: TSOFields -> Word32
[tso_prof] :: TSOFields -> Maybe StgTSOProfInfo
-- | Get non-pointer fields from StgTSO_ (TSO.h)
peekTSOFields :: (Ptr a -> IO (Maybe CostCentreStack)) -> Ptr tsoPtr -> IO TSOFields
parseWhatNext :: Word16 -> WhatNext
parseWhyBlocked :: Word16 -> WhyBlocked
parseTsoFlags :: Word32 -> [TsoFlags]
isSet :: Word32 -> Word32 -> Bool
unset :: Word32 -> Word32 -> Word32
data StackFields
StackFields :: Word32 -> Word8 -> Addr# -> StackFields
[stack_size] :: StackFields -> Word32
[stack_dirty] :: StackFields -> Word8
[stack_sp] :: StackFields -> Addr#
-- | Get non-closure fields from StgStack_ (TSO.h)
peekStackFields :: Ptr a -> IO StackFields
module GHC.Exts.Heap.FFIClosures_ProfilingDisabled
data TSOFields
TSOFields :: WhatNext -> WhyBlocked -> [TsoFlags] -> Word64 -> Word32 -> Word32 -> Int64 -> Word32 -> Maybe StgTSOProfInfo -> TSOFields
[tso_what_next] :: TSOFields -> WhatNext
[tso_why_blocked] :: TSOFields -> WhyBlocked
[tso_flags] :: TSOFields -> [TsoFlags]
[tso_threadId] :: TSOFields -> Word64
[tso_saved_errno] :: TSOFields -> Word32
[tso_dirty] :: TSOFields -> Word32
[tso_alloc_limit] :: TSOFields -> Int64
[tso_tot_stack_size] :: TSOFields -> Word32
[tso_prof] :: TSOFields -> Maybe StgTSOProfInfo
-- | Get non-pointer fields from StgTSO_ (TSO.h)
peekTSOFields :: (Ptr a -> IO (Maybe CostCentreStack)) -> Ptr tsoPtr -> IO TSOFields
parseWhatNext :: Word16 -> WhatNext
parseWhyBlocked :: Word16 -> WhyBlocked
parseTsoFlags :: Word32 -> [TsoFlags]
isSet :: Word32 -> Word32 -> Bool
unset :: Word32 -> Word32 -> Word32
data StackFields
StackFields :: Word32 -> Word8 -> Addr# -> StackFields
[stack_size] :: StackFields -> Word32
[stack_dirty] :: StackFields -> Word8
[stack_sp] :: StackFields -> Addr#
-- | Get non-closure fields from StgStack_ (TSO.h)
peekStackFields :: Ptr a -> IO StackFields
module GHC.Exts.Heap.FFIClosures
module GHC.Exts.Heap.Utils
dataConNames :: Ptr StgInfoTable -> IO (String, String, String)
-- | With this module, you can investigate the heap representation of
-- Haskell values, i.e. to investigate sharing and lazy evaluation.
module GHC.Exts.Heap
type Closure = GenClosure Box
-- | This is the representation of a Haskell value on the heap. It reflects
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/Closures.h
--
-- The data type is parametrized by b: the type to store
-- references in. Usually this is a Box with the type synonym
-- Closure.
--
-- All Heap objects have the same basic layout. A header containing a
-- pointer to the info table and a payload with various fields. The
-- info field below always refers to the info table pointed to
-- by the header. The remaining fields are the payload.
--
-- See
-- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects
-- for more information.
data GenClosure b
-- | A data constructor
ConstrClosure :: !StgInfoTable -> ![b] -> ![Word] -> !String -> !String -> !String -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer arguments
[ptrArgs] :: GenClosure b -> ![b]
-- | Non-pointer arguments
[dataArgs] :: GenClosure b -> ![Word]
-- | Package name
[pkg] :: GenClosure b -> !String
-- | Module name
[modl] :: GenClosure b -> !String
-- | Constructor name
[name] :: GenClosure b -> !String
-- | A function
FunClosure :: !StgInfoTable -> ![b] -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer arguments
[ptrArgs] :: GenClosure b -> ![b]
-- | Non-pointer arguments
[dataArgs] :: GenClosure b -> ![Word]
-- | A thunk, an expression not obviously in head normal form
ThunkClosure :: !StgInfoTable -> ![b] -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer arguments
[ptrArgs] :: GenClosure b -> ![b]
-- | Non-pointer arguments
[dataArgs] :: GenClosure b -> ![Word]
-- | A thunk which performs a simple selection operation
SelectorClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to the object being selected from
[selectee] :: GenClosure b -> !b
-- | An unsaturated function application
PAPClosure :: !StgInfoTable -> !HalfWord -> !HalfWord -> !b -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Arity of the partial application
[arity] :: GenClosure b -> !HalfWord
-- | Size of the payload in words
[n_args] :: GenClosure b -> !HalfWord
-- | Pointer to a FunClosure
[fun] :: GenClosure b -> !b
-- | Sequence of already applied arguments
[payload] :: GenClosure b -> ![b]
-- | A function application
APClosure :: !StgInfoTable -> !HalfWord -> !HalfWord -> !b -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Arity of the partial application
[arity] :: GenClosure b -> !HalfWord
-- | Size of the payload in words
[n_args] :: GenClosure b -> !HalfWord
-- | Pointer to a FunClosure
[fun] :: GenClosure b -> !b
-- | Sequence of already applied arguments
[payload] :: GenClosure b -> ![b]
-- | A suspended thunk evaluation
APStackClosure :: !StgInfoTable -> !b -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to a FunClosure
[fun] :: GenClosure b -> !b
-- | Sequence of already applied arguments
[payload] :: GenClosure b -> ![b]
-- | A pointer to another closure, introduced when a thunk is updated to
-- point at its value
IndClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Target closure
[indirectee] :: GenClosure b -> !b
-- | A byte-code object (BCO) which can be interpreted by GHC's byte-code
-- interpreter (e.g. as used by GHCi)
BCOClosure :: !StgInfoTable -> !b -> !b -> !b -> !HalfWord -> !HalfWord -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | A pointer to an ArrWords of instructions
[instrs] :: GenClosure b -> !b
-- | A pointer to an ArrWords of literals
[literals] :: GenClosure b -> !b
-- | A pointer to an ArrWords of byte code objects
[bcoptrs] :: GenClosure b -> !b
-- | Arity of the partial application
[arity] :: GenClosure b -> !HalfWord
-- | The size of this BCO in words
[size] :: GenClosure b -> !HalfWord
-- | An StgLargeBitmap describing the pointerhood of its args/free vars
[bitmap] :: GenClosure b -> ![Word]
-- | A thunk under evaluation by another thread
BlackholeClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Target closure
[indirectee] :: GenClosure b -> !b
-- | A ByteArray#
ArrWordsClosure :: !StgInfoTable -> !Word -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Size of array in bytes
[bytes] :: GenClosure b -> !Word
-- | Array payload
[arrWords] :: GenClosure b -> ![Word]
-- | A MutableByteArray#
MutArrClosure :: !StgInfoTable -> !Word -> !Word -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Number of pointers
[mccPtrs] :: GenClosure b -> !Word
-- | ?? Closures.h vs ClosureMacros.h
[mccSize] :: GenClosure b -> !Word
-- | Array payload Card table ignored
[mccPayload] :: GenClosure b -> ![b]
-- | A SmallMutableArray#
SmallMutArrClosure :: !StgInfoTable -> !Word -> ![b] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Number of pointers
[mccPtrs] :: GenClosure b -> !Word
-- | Array payload Card table ignored
[mccPayload] :: GenClosure b -> ![b]
-- | An MVar#, with a queue of thread state objects blocking on
-- them
MVarClosure :: !StgInfoTable -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to head of queue
[queueHead] :: GenClosure b -> !b
-- | Pointer to tail of queue
[queueTail] :: GenClosure b -> !b
-- | Pointer to closure
[value] :: GenClosure b -> !b
-- | An IOPort#, with a queue of thread state objects blocking on
-- them
IOPortClosure :: !StgInfoTable -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to head of queue
[queueHead] :: GenClosure b -> !b
-- | Pointer to tail of queue
[queueTail] :: GenClosure b -> !b
-- | Pointer to closure
[value] :: GenClosure b -> !b
-- | A MutVar#
MutVarClosure :: !StgInfoTable -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | Pointer to contents
[var] :: GenClosure b -> !b
-- | An STM blocking queue.
BlockingQueueClosure :: !StgInfoTable -> !b -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | ?? Here so it looks like an IND
[link] :: GenClosure b -> !b
-- | The blackhole closure
[blackHole] :: GenClosure b -> !b
-- | The owning thread state object
[owner] :: GenClosure b -> !b
-- | ??
[queue] :: GenClosure b -> !b
WeakClosure :: !StgInfoTable -> !b -> !b -> !b -> !b -> !b -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
[cfinalizers] :: GenClosure b -> !b
[key] :: GenClosure b -> !b
-- | Pointer to closure
[value] :: GenClosure b -> !b
[finalizer] :: GenClosure b -> !b
-- | ?? Here so it looks like an IND
[link] :: GenClosure b -> !b
-- | Representation of StgTSO: A Thread State Object. The values for
-- what_next, why_blocked and flags are defined in
-- Constants.h.
TSOClosure :: !StgInfoTable -> !b -> !b -> !b -> !b -> !b -> !b -> !WhatNext -> !WhyBlocked -> ![TsoFlags] -> !Word64 -> !Word32 -> !Word32 -> !Int64 -> !Word32 -> !Maybe StgTSOProfInfo -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | ?? Here so it looks like an IND
[link] :: GenClosure b -> !b
[global_link] :: GenClosure b -> !b
-- | stackobj from StgTSO
[tsoStack] :: GenClosure b -> !b
[trec] :: GenClosure b -> !b
[blocked_exceptions] :: GenClosure b -> !b
[bq] :: GenClosure b -> !b
[what_next] :: GenClosure b -> !WhatNext
[why_blocked] :: GenClosure b -> !WhyBlocked
[flags] :: GenClosure b -> ![TsoFlags]
[threadId] :: GenClosure b -> !Word64
[saved_errno] :: GenClosure b -> !Word32
-- | non-zero => dirty
[tso_dirty] :: GenClosure b -> !Word32
[alloc_limit] :: GenClosure b -> !Int64
[tot_stack_size] :: GenClosure b -> !Word32
[prof] :: GenClosure b -> !Maybe StgTSOProfInfo
-- | Representation of StgStack: The 'tsoStack ' of a TSOClosure.
StackClosure :: !StgInfoTable -> !Word32 -> !Word8 -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
-- | stack size in *words*
[stack_size] :: GenClosure b -> !Word32
-- | non-zero => dirty
[stack_dirty] :: GenClosure b -> !Word8
-- | Primitive Int
IntClosure :: PrimType -> !Int -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[intVal] :: GenClosure b -> !Int
-- | Primitive Word
WordClosure :: PrimType -> !Word -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[wordVal] :: GenClosure b -> !Word
-- | Primitive Int64
Int64Closure :: PrimType -> !Int64 -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[int64Val] :: GenClosure b -> !Int64
-- | Primitive Word64
Word64Closure :: PrimType -> !Word64 -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[word64Val] :: GenClosure b -> !Word64
-- | Primitive Addr
AddrClosure :: PrimType -> !Int -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[addrVal] :: GenClosure b -> !Int
-- | Primitive Float
FloatClosure :: PrimType -> !Float -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[floatVal] :: GenClosure b -> !Float
-- | Primitive Double
DoubleClosure :: PrimType -> !Double -> GenClosure b
[ptipe] :: GenClosure b -> PrimType
[doubleVal] :: GenClosure b -> !Double
-- | Another kind of closure
OtherClosure :: !StgInfoTable -> ![b] -> ![Word] -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
[hvalues] :: GenClosure b -> ![b]
[rawWords] :: GenClosure b -> ![Word]
UnsupportedClosure :: !StgInfoTable -> GenClosure b
[info] :: GenClosure b -> !StgInfoTable
data ClosureType
INVALID_OBJECT :: ClosureType
CONSTR :: ClosureType
CONSTR_1_0 :: ClosureType
CONSTR_0_1 :: ClosureType
CONSTR_2_0 :: ClosureType
CONSTR_1_1 :: ClosureType
CONSTR_0_2 :: ClosureType
CONSTR_NOCAF :: ClosureType
FUN :: ClosureType
FUN_1_0 :: ClosureType
FUN_0_1 :: ClosureType
FUN_2_0 :: ClosureType
FUN_1_1 :: ClosureType
FUN_0_2 :: ClosureType
FUN_STATIC :: ClosureType
THUNK :: ClosureType
THUNK_1_0 :: ClosureType
THUNK_0_1 :: ClosureType
THUNK_2_0 :: ClosureType
THUNK_1_1 :: ClosureType
THUNK_0_2 :: ClosureType
THUNK_STATIC :: ClosureType
THUNK_SELECTOR :: ClosureType
BCO :: ClosureType
AP :: ClosureType
PAP :: ClosureType
AP_STACK :: ClosureType
IND :: ClosureType
IND_STATIC :: ClosureType
RET_BCO :: ClosureType
RET_SMALL :: ClosureType
RET_BIG :: ClosureType
RET_FUN :: ClosureType
UPDATE_FRAME :: ClosureType
CATCH_FRAME :: ClosureType
UNDERFLOW_FRAME :: ClosureType
STOP_FRAME :: ClosureType
BLOCKING_QUEUE :: ClosureType
BLACKHOLE :: ClosureType
MVAR_CLEAN :: ClosureType
MVAR_DIRTY :: ClosureType
TVAR :: ClosureType
ARR_WORDS :: ClosureType
MUT_ARR_PTRS_CLEAN :: ClosureType
MUT_ARR_PTRS_DIRTY :: ClosureType
MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType
MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType
MUT_VAR_CLEAN :: ClosureType
MUT_VAR_DIRTY :: ClosureType
WEAK :: ClosureType
PRIM :: ClosureType
MUT_PRIM :: ClosureType
TSO :: ClosureType
STACK :: ClosureType
TREC_CHUNK :: ClosureType
ATOMICALLY_FRAME :: ClosureType
CATCH_RETRY_FRAME :: ClosureType
CATCH_STM_FRAME :: ClosureType
WHITEHOLE :: ClosureType
SMALL_MUT_ARR_PTRS_CLEAN :: ClosureType
SMALL_MUT_ARR_PTRS_DIRTY :: ClosureType
SMALL_MUT_ARR_PTRS_FROZEN_DIRTY :: ClosureType
SMALL_MUT_ARR_PTRS_FROZEN_CLEAN :: ClosureType
COMPACT_NFDATA :: ClosureType
N_CLOSURE_TYPES :: ClosureType
data PrimType
PInt :: PrimType
PWord :: PrimType
PInt64 :: PrimType
PWord64 :: PrimType
PAddr :: PrimType
PFloat :: PrimType
PDouble :: PrimType
data WhatNext
ThreadRunGHC :: WhatNext
ThreadInterpret :: WhatNext
ThreadKilled :: WhatNext
ThreadComplete :: WhatNext
-- | Please report this as a bug
WhatNextUnknownValue :: Word16 -> WhatNext
data WhyBlocked
NotBlocked :: WhyBlocked
BlockedOnMVar :: WhyBlocked
BlockedOnMVarRead :: WhyBlocked
BlockedOnBlackHole :: WhyBlocked
BlockedOnRead :: WhyBlocked
BlockedOnWrite :: WhyBlocked
BlockedOnDelay :: WhyBlocked
BlockedOnSTM :: WhyBlocked
BlockedOnDoProc :: WhyBlocked
BlockedOnCCall :: WhyBlocked
BlockedOnCCall_Interruptible :: WhyBlocked
BlockedOnMsgThrowTo :: WhyBlocked
ThreadMigrating :: WhyBlocked
-- | Please report this as a bug
WhyBlockedUnknownValue :: Word16 -> WhyBlocked
data TsoFlags
TsoLocked :: TsoFlags
TsoBlockx :: TsoFlags
TsoInterruptible :: TsoFlags
TsoStoppedOnBreakpoint :: TsoFlags
TsoMarked :: TsoFlags
TsoSqueezed :: TsoFlags
TsoAllocLimit :: TsoFlags
-- | Please report this as a bug
TsoFlagsUnknownValue :: Word32 -> TsoFlags
class HasHeapRep (a :: TYPE rep)
-- | Decode a closure to it's heap representation (GenClosure).
getClosureData :: HasHeapRep a => a -> IO Closure
-- | Convert an unpacked heap object, to a `GenClosure b`. The inputs to
-- this function can be generated from a heap object using
-- unpackClosure#.
getClosureDataFromHeapRep :: ByteArray# -> Ptr StgInfoTable -> [b] -> IO (GenClosure b)
getClosureDataFromHeapRepPrim :: IO (String, String, String) -> (Ptr a -> IO (Maybe CostCentreStack)) -> StgInfoTable -> ByteArray# -> [b] -> IO (GenClosure b)
-- | This is a somewhat faithful representation of an info table. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/InfoTables.h
-- for more details on this data structure.
data StgInfoTable
StgInfoTable :: Maybe EntryFunPtr -> HalfWord -> HalfWord -> ClosureType -> HalfWord -> Maybe ItblCodes -> StgInfoTable
[entry] :: StgInfoTable -> Maybe EntryFunPtr
[ptrs] :: StgInfoTable -> HalfWord
[nptrs] :: StgInfoTable -> HalfWord
[tipe] :: StgInfoTable -> ClosureType
[srtlen] :: StgInfoTable -> HalfWord
[code] :: StgInfoTable -> Maybe ItblCodes
type EntryFunPtr = FunPtr (Ptr () -> IO (Ptr ()))
type HalfWord = Word32
type ItblCodes = Either [Word8] [Word32]
-- | Size in bytes of a standard InfoTable
itblSize :: Int
-- | Read an InfoTable from the heap into a haskell type. WARNING: This
-- code assumes it is passed a pointer to a "standard" info table. If
-- tables_next_to_code is enabled, it will look 1 byte before the start
-- for the entry field.
peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
-- | This is a somewhat faithful representation of StgTSOProfInfo. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/TSO.h
-- for more details on this data structure.
newtype StgTSOProfInfo
StgTSOProfInfo :: Maybe CostCentreStack -> StgTSOProfInfo
[cccs] :: StgTSOProfInfo -> Maybe CostCentreStack
-- | This is a somewhat faithful representation of IndexTable. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h
-- for more details on this data structure.
data IndexTable
IndexTable :: CostCentre -> Maybe CostCentreStack -> Maybe IndexTable -> Bool -> IndexTable
[it_cc] :: IndexTable -> CostCentre
[it_ccs] :: IndexTable -> Maybe CostCentreStack
[it_next] :: IndexTable -> Maybe IndexTable
[it_back_edge] :: IndexTable -> Bool
-- | This is a somewhat faithful representation of CostCentre. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h
-- for more details on this data structure.
data CostCentre
CostCentre :: Int -> String -> String -> Maybe String -> Word64 -> Word -> Bool -> Maybe CostCentre -> CostCentre
[cc_ccID] :: CostCentre -> Int
[cc_label] :: CostCentre -> String
[cc_module] :: CostCentre -> String
[cc_srcloc] :: CostCentre -> Maybe String
[cc_mem_alloc] :: CostCentre -> Word64
[cc_time_ticks] :: CostCentre -> Word
[cc_is_caf] :: CostCentre -> Bool
[cc_link] :: CostCentre -> Maybe CostCentre
-- | This is a somewhat faithful representation of CostCentreStack. See
-- https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h
-- for more details on this data structure.
data CostCentreStack
CostCentreStack :: Int -> CostCentre -> Maybe CostCentreStack -> Maybe IndexTable -> Maybe CostCentreStack -> Word -> Word64 -> Word -> Word -> Word64 -> Word64 -> Word -> CostCentreStack
[ccs_ccsID] :: CostCentreStack -> Int
[ccs_cc] :: CostCentreStack -> CostCentre
[ccs_prevStack] :: CostCentreStack -> Maybe CostCentreStack
[ccs_indexTable] :: CostCentreStack -> Maybe IndexTable
[ccs_root] :: CostCentreStack -> Maybe CostCentreStack
[ccs_depth] :: CostCentreStack -> Word
[ccs_scc_count] :: CostCentreStack -> Word64
[ccs_selected] :: CostCentreStack -> Word
[ccs_time_ticks] :: CostCentreStack -> Word
[ccs_mem_alloc] :: CostCentreStack -> Word64
[ccs_inherited_alloc] :: CostCentreStack -> Word64
[ccs_inherited_ticks] :: CostCentreStack -> Word
-- | Like getClosureData, but taking a Box, so it is easier
-- to work with.
getBoxedClosureData :: Box -> IO Closure
-- | For generic code, this function returns all referenced closures.
allClosures :: GenClosure b -> [b]
-- | An arbitrary Haskell value in a safe Box. The point is that even
-- unevaluated thunks can safely be moved around inside the Box, and when
-- required, e.g. in getBoxedClosureData, the function knows how
-- far it has to evaluate the argument.
data Box
Box :: Any -> Box
-- | This takes an arbitrary value and puts it into a box. Note that calls
-- like
--
--
-- asBox (head list)
--
--
-- will put the thunk "head list" into the box, not the element at
-- the head of the list. For that, use careful case expressions:
--
--
-- case list of x:_ -> asBox x
--
asBox :: a -> Box
-- | Boxes can be compared, but this is not pure, as different heap objects
-- can, after garbage collection, become the same object.
areBoxesEqual :: Box -> Box -> IO Bool
instance GHC.Exts.Heap.HasHeapRep a
instance GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Int# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Word# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Int64# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Word64# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Addr# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Float# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
instance (GHC.Prim.Double# GHC.Types.~ a) => GHC.Exts.Heap.HasHeapRep a
module GHC.ForeignSrcLang.Type
-- | Foreign formats supported by GHC via TH
data ForeignSrcLang
-- | C
LangC :: ForeignSrcLang
-- | C++
LangCxx :: ForeignSrcLang
-- | Objective C
LangObjc :: ForeignSrcLang
-- | Objective C++
LangObjcxx :: ForeignSrcLang
-- | Assembly language (.s)
LangAsm :: ForeignSrcLang
-- | Object (.o)
RawObject :: ForeignSrcLang
instance GHC.Generics.Generic GHC.ForeignSrcLang.Type.ForeignSrcLang
instance GHC.Show.Show GHC.ForeignSrcLang.Type.ForeignSrcLang
instance GHC.Classes.Eq GHC.ForeignSrcLang.Type.ForeignSrcLang
-- | See GHC.LanguageExtensions for an explanation on why this is
-- needed
module GHC.ForeignSrcLang
instance Data.Binary.Class.Binary GHC.ForeignSrcLang.Type.ForeignSrcLang
-- | A data type defining the language extensions supported by GHC.
module GHC.LanguageExtensions.Type
-- | The language extensions known to GHC.
--
-- Note that there is an orphan Binary instance for this type
-- supplied by the GHC.LanguageExtensions module provided by
-- ghc-boot. We can't provide here as this would require adding
-- transitive dependencies to the template-haskell package,
-- which must have a minimal dependency set.
data Extension
Cpp :: Extension
OverlappingInstances :: Extension
UndecidableInstances :: Extension
IncoherentInstances :: Extension
UndecidableSuperClasses :: Extension
MonomorphismRestriction :: Extension
MonoLocalBinds :: Extension
RelaxedPolyRec :: Extension
ExtendedDefaultRules :: Extension
ForeignFunctionInterface :: Extension
UnliftedFFITypes :: Extension
InterruptibleFFI :: Extension
CApiFFI :: Extension
GHCForeignImportPrim :: Extension
JavaScriptFFI :: Extension
ParallelArrays :: Extension
Arrows :: Extension
TemplateHaskell :: Extension
TemplateHaskellQuotes :: Extension
QualifiedDo :: Extension
QuasiQuotes :: Extension
ImplicitParams :: Extension
ImplicitPrelude :: Extension
ScopedTypeVariables :: Extension
AllowAmbiguousTypes :: Extension
UnboxedTuples :: Extension
UnboxedSums :: Extension
UnliftedNewtypes :: Extension
UnliftedDatatypes :: Extension
BangPatterns :: Extension
TypeFamilies :: Extension
TypeFamilyDependencies :: Extension
TypeInType :: Extension
OverloadedStrings :: Extension
OverloadedLists :: Extension
NumDecimals :: Extension
DisambiguateRecordFields :: Extension
RecordWildCards :: Extension
NamedFieldPuns :: Extension
ViewPatterns :: Extension
GADTs :: Extension
GADTSyntax :: Extension
NPlusKPatterns :: Extension
DoAndIfThenElse :: Extension
BlockArguments :: Extension
RebindableSyntax :: Extension
ConstraintKinds :: Extension
PolyKinds :: Extension
DataKinds :: Extension
InstanceSigs :: Extension
ApplicativeDo :: Extension
LinearTypes :: Extension
StandaloneDeriving :: Extension
DeriveDataTypeable :: Extension
AutoDeriveTypeable :: Extension
DeriveFunctor :: Extension
DeriveTraversable :: Extension
DeriveFoldable :: Extension
DeriveGeneric :: Extension
DefaultSignatures :: Extension
DeriveAnyClass :: Extension
DeriveLift :: Extension
DerivingStrategies :: Extension
DerivingVia :: Extension
TypeSynonymInstances :: Extension
FlexibleContexts :: Extension
FlexibleInstances :: Extension
ConstrainedClassMethods :: Extension
MultiParamTypeClasses :: Extension
NullaryTypeClasses :: Extension
FunctionalDependencies :: Extension
UnicodeSyntax :: Extension
ExistentialQuantification :: Extension
MagicHash :: Extension
EmptyDataDecls :: Extension
KindSignatures :: Extension
RoleAnnotations :: Extension
ParallelListComp :: Extension
TransformListComp :: Extension
MonadComprehensions :: Extension
GeneralizedNewtypeDeriving :: Extension
RecursiveDo :: Extension
PostfixOperators :: Extension
TupleSections :: Extension
PatternGuards :: Extension
LiberalTypeSynonyms :: Extension
RankNTypes :: Extension
ImpredicativeTypes :: Extension
TypeOperators :: Extension
ExplicitNamespaces :: Extension
PackageImports :: Extension
ExplicitForAll :: Extension
AlternativeLayoutRule :: Extension
AlternativeLayoutRuleTransitional :: Extension
DatatypeContexts :: Extension
NondecreasingIndentation :: Extension
RelaxedLayout :: Extension
TraditionalRecordSyntax :: Extension
LambdaCase :: Extension
MultiWayIf :: Extension
BinaryLiterals :: Extension
NegativeLiterals :: Extension
HexFloatLiterals :: Extension
DuplicateRecordFields :: Extension
OverloadedLabels :: Extension
EmptyCase :: Extension
PatternSynonyms :: Extension
PartialTypeSignatures :: Extension
NamedWildCards :: Extension
StaticPointers :: Extension
TypeApplications :: Extension
Strict :: Extension
StrictData :: Extension
EmptyDataDeriving :: Extension
NumericUnderscores :: Extension
QuantifiedConstraints :: Extension
StarIsType :: Extension
ImportQualifiedPost :: Extension
CUSKs :: Extension
StandaloneKindSignatures :: Extension
LexicalNegation :: Extension
FieldSelectors :: Extension
OverloadedRecordDot :: Extension
OverloadedRecordUpdate :: Extension
instance GHC.Enum.Bounded GHC.LanguageExtensions.Type.Extension
instance GHC.Generics.Generic GHC.LanguageExtensions.Type.Extension
instance GHC.Show.Show GHC.LanguageExtensions.Type.Extension
instance GHC.Enum.Enum GHC.LanguageExtensions.Type.Extension
instance GHC.Classes.Eq GHC.LanguageExtensions.Type.Extension
instance GHC.Classes.Ord GHC.LanguageExtensions.Type.Extension
-- | This module re-exports the Extension type along with an orphan
-- Binary instance for it.
--
-- Note that the ghc-boot package has a large set of
-- dependencies; for this reason the Extension type itself is
-- defined in the GHC.LanguageExtensions.Type module provided by
-- the ghc-boot-th package, which has no dependencies outside of
-- base. For this reason template-haskell depends upon
-- ghc-boot-th, not ghc-boot.
module GHC.LanguageExtensions
instance Data.Binary.Class.Binary GHC.LanguageExtensions.Type.Extension
-- | Functions to evaluate whether or not a string is a valid identifier.
module GHC.Lexeme
startsVarSym :: Char -> Bool
startsVarId :: Char -> Bool
startsConSym :: Char -> Bool
startsConId :: Char -> Bool
startsVarSymASCII :: Char -> Bool
isVarSymChar :: Char -> Bool
-- | Is this character acceptable in a symbol (after the first char)? See
-- alexGetByte in GHC.Parser.Lexer
okSymChar :: Char -> Bool
-- | Platform architecture and OS
--
-- We need it in ghc-boot because ghc-pkg needs it.
module GHC.Platform.ArchOS
-- | Platform architecture and OS.
data ArchOS
ArchOS :: Arch -> OS -> ArchOS
[archOS_arch] :: ArchOS -> Arch
[archOS_OS] :: ArchOS -> OS
-- | Architectures
--
-- 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
ArchS390X :: Arch
ArchARM :: ArmISA -> [ArmISAExt] -> ArmABI -> Arch
ArchAArch64 :: Arch
ArchAlpha :: Arch
ArchMipseb :: Arch
ArchMipsel :: Arch
ArchRISCV64 :: Arch
ArchJavaScript :: Arch
-- | Operating systems.
--
-- Using OSUnknown to generate code should produce a sensible default,
-- but no promises.
data OS
OSUnknown :: OS
OSLinux :: OS
OSDarwin :: OS
OSSolaris2 :: OS
OSMinGW32 :: OS
OSFreeBSD :: OS
OSDragonFly :: OS
OSOpenBSD :: OS
OSNetBSD :: OS
OSKFreeBSD :: OS
OSHaiku :: OS
OSQNXNTO :: OS
OSAIX :: OS
OSHurd :: OS
-- | ARM Instruction Set Architecture
data ArmISA
ARMv5 :: ArmISA
ARMv6 :: ArmISA
ARMv7 :: ArmISA
-- | ARM extensions
data ArmISAExt
VFPv2 :: ArmISAExt
VFPv3 :: ArmISAExt
VFPv3D16 :: ArmISAExt
NEON :: ArmISAExt
IWMMX2 :: ArmISAExt
-- | ARM ABI
data ArmABI
SOFT :: ArmABI
SOFTFP :: ArmABI
HARD :: ArmABI
-- | PowerPC 64-bit ABI
data PPC_64ABI
-- | PowerPC64
ELF_V1 :: PPC_64ABI
-- | PowerPC64 LE
ELF_V2 :: PPC_64ABI
-- | See Note [Platform Syntax].
stringEncodeArch :: Arch -> String
-- | See Note [Platform Syntax].
stringEncodeOS :: OS -> String
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArmISA
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArmISA
instance GHC.Show.Show GHC.Platform.ArchOS.ArmISA
instance GHC.Read.Read GHC.Platform.ArchOS.ArmISA
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArmISAExt
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArmISAExt
instance GHC.Show.Show GHC.Platform.ArchOS.ArmISAExt
instance GHC.Read.Read GHC.Platform.ArchOS.ArmISAExt
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArmABI
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArmABI
instance GHC.Show.Show GHC.Platform.ArchOS.ArmABI
instance GHC.Read.Read GHC.Platform.ArchOS.ArmABI
instance GHC.Classes.Ord GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Classes.Eq GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Show.Show GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Read.Read GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Classes.Ord GHC.Platform.ArchOS.Arch
instance GHC.Classes.Eq GHC.Platform.ArchOS.Arch
instance GHC.Show.Show GHC.Platform.ArchOS.Arch
instance GHC.Read.Read GHC.Platform.ArchOS.Arch
instance GHC.Classes.Ord GHC.Platform.ArchOS.OS
instance GHC.Classes.Eq GHC.Platform.ArchOS.OS
instance GHC.Show.Show GHC.Platform.ArchOS.OS
instance GHC.Read.Read GHC.Platform.ArchOS.OS
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArchOS
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArchOS
instance GHC.Show.Show GHC.Platform.ArchOS.ArchOS
instance GHC.Read.Read GHC.Platform.ArchOS.ArchOS
module GHC.Platform.Constants
data PlatformConstants
PlatformConstants :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> !Integer -> !Integer -> !Integer -> !Bool -> PlatformConstants
[pc_CONTROL_GROUP_CONST_291] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_STD_HDR_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_PROF_HDR_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_BLOCK_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_BLOCKS_PER_MBLOCK] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_TICKY_BIN_COUNT] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR7] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR8] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR9] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR10] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rL1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rSp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rSpLim] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rHp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rHpLim] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rCCCS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rCurrentTSO] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rCurrentNursery] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rHpAlloc] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_stgEagerBlackholeInfo] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_stgGCEnter1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_stgGCFun] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_Capability_r] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_start] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_free] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_blocks] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_flags] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_CostCentreStack] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_CostCentreStack_mem_alloc] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_CostCentreStack_mem_alloc] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_CostCentreStack_scc_count] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_CostCentreStack_scc_count] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgHeader_ccs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgHeader_ldvw] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgSMPThunkHeader] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_allocs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgEntCounter_allocs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_allocd] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgEntCounter_allocd] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_registeredp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_link] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_entry_count] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgUpdateFrame_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgMutArrPtrs_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgMutArrPtrs_ptrs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgMutArrPtrs_size] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgSmallMutArrPtrs_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgSmallMutArrPtrs_ptrs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgArrBytes_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgArrBytes_bytes] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgTSO_alloc_limit] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgTSO_cccs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgTSO_stackobj] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgStack_sp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgStack_stack] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgUpdateFrame_updatee] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgFunInfoExtraFwd_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgFunInfoExtraFwd_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgFunInfoExtraRev] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgFunInfoExtraRev_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgFunInfoExtraRev_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_SPEC_SELECTEE_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_SPEC_AP_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MIN_PAYLOAD_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MIN_INTLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_INTLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MIN_CHARLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_CHARLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MUT_ARR_PTRS_CARD_BITS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Vanilla_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Float_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Double_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Long_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_XMM_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Vanilla_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Float_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Double_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_XMM_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Long_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_RESERVED_C_STACK_BYTES] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_RESERVED_STACK_WORDS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_AP_STACK_SPLIM] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_WORD_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_CINT_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_CLONG_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_CLONG_LONG_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_BITMAP_BITS_SHIFT] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_TAG_BITS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_LDV_SHIFT] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_ILDV_CREATE_MASK] :: PlatformConstants -> !Integer
[pc_ILDV_STATE_CREATE] :: PlatformConstants -> !Integer
[pc_ILDV_STATE_USE] :: PlatformConstants -> !Integer
[pc_USE_INLINE_SRT_FIELD] :: PlatformConstants -> !Bool
parseConstantsHeader :: FilePath -> IO PlatformConstants
instance GHC.Classes.Ord GHC.Platform.Constants.PlatformConstants
instance GHC.Classes.Eq GHC.Platform.Constants.PlatformConstants
instance GHC.Read.Read GHC.Platform.Constants.PlatformConstants
instance GHC.Show.Show GHC.Platform.Constants.PlatformConstants
-- | Custom GHC Prelude
--
-- This module serves as a replacement for the Prelude module and
-- abstracts over differences between the bootstrapping GHC version, and
-- may also provide a common default vocabulary.
module GHC.Prelude
-- | Append two lists, i.e.,
--
--
-- [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
-- [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
--
--
-- If the first list is not finite, the result is the first list.
(++) :: [a] -> [a] -> [a]
infixr 5 ++
-- | The value of seq a b is bottom if a is bottom, and
-- otherwise equal to b. In other words, it evaluates the first
-- argument a to weak head normal form (WHNF). seq is
-- usually introduced to improve performance by avoiding unneeded
-- laziness.
--
-- A note on evaluation order: the expression seq a b does
-- not guarantee that a will be evaluated before
-- b. The only guarantee given by seq is that the both
-- a and b will be evaluated before seq
-- returns a value. In particular, this means that b may be
-- evaluated before a. If you need to guarantee a specific order
-- of evaluation, you must use the function pseq from the
-- "parallel" package.
seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
infixr 0 `seq`
-- | <math>. filter, applied to a predicate and a list,
-- returns the list of those elements that satisfy the predicate; i.e.,
--
--
-- filter p xs = [ x | x <- xs, p x]
--
--
--
-- >>> filter odd [1, 2, 3]
-- [1,3]
--
filter :: (a -> Bool) -> [a] -> [a]
-- | <math>. zip takes two lists and returns a list of
-- corresponding pairs.
--
--
-- zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
--
--
-- If one input list is short, excess elements of the longer list are
-- discarded:
--
--
-- zip [1] ['a', 'b'] = [(1, 'a')]
-- zip [1, 2] ['a'] = [(1, 'a')]
--
--
-- zip is right-lazy:
--
--
-- zip [] _|_ = []
-- zip _|_ [] = _|_
--
--
-- zip is capable of list fusion, but it is restricted to its
-- first list argument and its resulting list.
zip :: [a] -> [b] -> [(a, b)]
-- | The print function outputs a value of any printable type to the
-- standard output device. Printable types are those that are instances
-- of class Show; print converts values to strings for
-- output using the show operation and adds a newline.
--
-- For example, a program to print the first 20 integers and their powers
-- of 2 could be written as:
--
--
-- main = print ([(n, 2^n) | n <- [0..19]])
--
print :: Show a => a -> IO ()
-- | Extract the first component of a pair.
fst :: (a, b) -> a
-- | Extract the second component of a pair.
snd :: (a, b) -> b
-- | otherwise is defined as the value True. It helps to make
-- guards more readable. eg.
--
--
-- f x | x < 0 = ...
-- | otherwise = ...
--
otherwise :: Bool
-- | <math>. map f xs is the list obtained by
-- applying f to each element of xs, i.e.,
--
--
-- map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
-- map f [x1, x2, ...] == [f x1, f x2, ...]
--
--
--
-- >>> map (+1) [1, 2, 3]
--
map :: (a -> b) -> [a] -> [b]
-- | Application operator. This operator is redundant, since ordinary
-- application (f x) means the same as (f $ x).
-- However, $ has low, right-associative binding precedence, so it
-- sometimes allows parentheses to be omitted; for example:
--
--
-- f $ g $ h x = f (g (h x))
--
--
-- It is also useful in higher-order situations, such as map
-- ($ 0) xs, or zipWith ($) fs xs.
--
-- Note that ($) is levity-polymorphic in its result
-- type, so that foo $ True where foo :: Bool ->
-- Int# is well-typed.
($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
infixr 0 $
-- | general coercion from integral types
fromIntegral :: (Integral a, Num b) => a -> b
-- | general coercion to fractional types
realToFrac :: (Real a, Fractional b) => a -> b
-- | The Bounded class is used to name the upper and lower limits of
-- a type. Ord is not a superclass of Bounded since types
-- that are not totally ordered may also have upper and lower bounds.
--
-- The Bounded class may be derived for any enumeration type;
-- minBound is the first constructor listed in the data
-- declaration and maxBound is the last. Bounded may also
-- be derived for single-constructor datatypes whose constituent types
-- are in Bounded.
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
-- | Class Enum defines operations on sequentially ordered types.
--
-- The enumFrom... methods are used in Haskell's translation of
-- arithmetic sequences.
--
-- Instances of Enum may be derived for any enumeration type
-- (types whose constructors have no fields). The nullary constructors
-- are assumed to be numbered left-to-right by fromEnum from
-- 0 through n-1. See Chapter 10 of the Haskell
-- Report for more details.
--
-- For any type that is an instance of class Bounded as well as
-- Enum, the following should hold:
--
--
--
--
-- enumFrom x = enumFromTo x maxBound
-- enumFromThen x y = enumFromThenTo x y bound
-- where
-- bound | fromEnum y >= fromEnum x = maxBound
-- | otherwise = minBound
--
class Enum a
-- | the successor of a value. For numeric types, succ adds 1.
succ :: Enum a => a -> a
-- | the predecessor of a value. For numeric types, pred subtracts
-- 1.
pred :: Enum a => a -> a
-- | Convert from an Int.
toEnum :: Enum a => Int -> a
-- | Convert to an Int. It is implementation-dependent what
-- fromEnum returns when applied to a value that is too large to
-- fit in an Int.
fromEnum :: Enum a => a -> Int
-- | Used in Haskell's translation of [n..] with [n..] =
-- enumFrom n, a possible implementation being enumFrom n = n :
-- enumFrom (succ n). For example:
--
--
-- enumFrom 4 :: [Integer] = [4,5,6,7,...]
-- enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound ::
-- Int]
--
enumFrom :: Enum a => a -> [a]
-- | Used in Haskell's translation of [n,n'..] with [n,n'..] =
-- enumFromThen n n', a possible implementation being
-- enumFromThen n n' = n : n' : worker (f x) (f x n'),
-- worker s v = v : worker s (s v), x = fromEnum n' -
-- fromEnum n and f n y | n > 0 = f (n - 1) (succ y) | n <
-- 0 = f (n + 1) (pred y) | otherwise = y For example:
--
--
-- enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
-- enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound ::
-- Int]
--
enumFromThen :: Enum a => a -> a -> [a]
-- | Used in Haskell's translation of [n..m] with [n..m] =
-- enumFromTo n m, a possible implementation being enumFromTo n
-- m | n <= m = n : enumFromTo (succ n) m | otherwise = []. For
-- example:
--
--
-- enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
-- enumFromTo 42 1 :: [Integer] = []
--
enumFromTo :: Enum a => a -> a -> [a]
-- | Used in Haskell's translation of [n,n'..m] with [n,n'..m]
-- = enumFromThenTo n n' m, a possible implementation being
-- enumFromThenTo n n' m = worker (f x) (c x) n m, x =
-- fromEnum n' - fromEnum n, c x = bool (>=) ((x
-- 0) f n y | n > 0 = f (n - 1) (succ y) | n < 0 = f (n +
-- 1) (pred y) | otherwise = y and worker s c v m | c v m = v :
-- worker s c (s v) m | otherwise = [] For example:
--
--
-- enumFromThenTo 4 2 -6 :: [Integer] =
-- [4,2,0,-2,-4,-6]
-- enumFromThenTo 6 8 2 :: [Int] = []
--
enumFromThenTo :: Enum a => a -> a -> a -> [a]
-- | The Eq class defines equality (==) and inequality
-- (/=). All the basic datatypes exported by the Prelude
-- are instances of Eq, and Eq may be derived for any
-- datatype whose constituents are also instances of Eq.
--
-- The Haskell Report defines no laws for Eq. However, ==
-- is customarily expected to implement an equivalence relationship where
-- two values comparing equal are indistinguishable by "public"
-- functions, with a "public" function being one not allowing to see
-- implementation details. For example, for a type representing
-- non-normalised natural numbers modulo 100, a "public" function doesn't
-- make the difference between 1 and 201. It is expected to have the
-- following properties:
--
--
-- - Reflexivity x == x = True
-- - Symmetry x == y = y == x
-- - Transitivity if x == y && y == z =
-- True, then x == z = True
-- - Substitutivity if x == y = True and
-- f is a "public" function whose return type is an instance of
-- Eq, then f x == f y = True
-- - Negation x /= y = not (x ==
-- y)
--
--
-- Minimal complete definition: either == or /=.
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
infix 4 ==
infix 4 /=
-- | Trigonometric and hyperbolic functions and related functions.
--
-- The Haskell Report defines no laws for Floating. However,
-- (+), (*) and exp are
-- customarily expected to define an exponential field and have the
-- following properties:
--
--
-- - exp (a + b) = exp a * exp b
-- - exp (fromInteger 0) = fromInteger 1
--
class Fractional a => Floating a
pi :: Floating a => a
exp :: Floating a => a -> a
log :: Floating a => a -> a
sqrt :: Floating a => a -> a
(**) :: Floating a => a -> a -> a
logBase :: Floating a => a -> a -> a
sin :: Floating a => a -> a
cos :: Floating a => a -> a
tan :: Floating a => a -> a
asin :: Floating a => a -> a
acos :: Floating a => a -> a
atan :: Floating a => a -> a
sinh :: Floating a => a -> a
cosh :: Floating a => a -> a
tanh :: Floating a => a -> a
asinh :: Floating a => a -> a
acosh :: Floating a => a -> a
atanh :: Floating a => a -> a
infixr 8 **
-- | Fractional numbers, supporting real division.
--
-- The Haskell Report defines no laws for Fractional. However,
-- (+) and (*) are customarily expected
-- to define a division ring and have the following properties:
--
--
-- - recip gives the multiplicative inverse x
-- * recip x = recip x * x = fromInteger 1
--
--
-- Note that it isn't customarily expected that a type instance of
-- Fractional implement a field. However, all instances in
-- base do.
class Num a => Fractional a
-- | Fractional division.
(/) :: Fractional a => a -> a -> a
-- | Reciprocal fraction.
recip :: Fractional a => a -> a
-- | Conversion from a Rational (that is Ratio
-- Integer). A floating literal stands for an application of
-- fromRational to a value of type Rational, so such
-- literals have type (Fractional a) => a.
fromRational :: Fractional a => Rational -> a
infixl 7 /
-- | Integral numbers, supporting integer division.
--
-- The Haskell Report defines no laws for Integral. However,
-- Integral instances are customarily expected to define a
-- Euclidean domain and have the following properties for the
-- div/mod and quot/rem pairs, given suitable
-- Euclidean functions f and g:
--
--
-- - x = y * quot x y + rem x y with rem x y
-- = fromInteger 0 or g (rem x y) < g
-- y
-- - x = y * div x y + mod x y with mod x y
-- = fromInteger 0 or f (mod x y) < f
-- y
--
--
-- An example of a suitable Euclidean function, for Integer's
-- instance, is abs.
class (Real a, Enum a) => Integral a
-- | integer division truncated toward zero
quot :: Integral a => a -> a -> a
-- | integer remainder, satisfying
--
--
-- (x `quot` y)*y + (x `rem` y) == x
--
rem :: Integral a => a -> a -> a
-- | integer division truncated toward negative infinity
div :: Integral a => a -> a -> a
-- | integer modulus, satisfying
--
--
-- (x `div` y)*y + (x `mod` y) == x
--
mod :: Integral a => a -> a -> a
-- | simultaneous quot and rem
quotRem :: Integral a => a -> a -> (a, a)
-- | simultaneous div and mod
divMod :: Integral a => a -> a -> (a, a)
-- | conversion to Integer
toInteger :: Integral a => a -> Integer
infixl 7 `mod`
infixl 7 `div`
infixl 7 `rem`
infixl 7 `quot`
-- | The Monad class defines the basic operations over a
-- monad, a concept from a branch of mathematics known as
-- category theory. From the perspective of a Haskell programmer,
-- however, it is best to think of a monad as an abstract datatype
-- of actions. Haskell's do expressions provide a convenient
-- syntax for writing monadic expressions.
--
-- Instances of Monad should satisfy the following:
--
--
--
-- Furthermore, the Monad and Applicative operations should
-- relate as follows:
--
--
--
-- The above laws imply:
--
--
--
-- and that pure and (<*>) satisfy the applicative
-- functor laws.
--
-- The instances of Monad for lists, Maybe and IO
-- defined in the Prelude satisfy these laws.
class Applicative m => Monad (m :: Type -> Type)
-- | Sequentially compose two actions, passing any value produced by the
-- first as an argument to the second.
--
-- 'as >>= bs' can be understood as the do
-- expression
--
--
-- do a <- as
-- bs a
--
(>>=) :: Monad m => m a -> (a -> m b) -> m b
-- | Sequentially compose two actions, discarding any value produced by the
-- first, like sequencing operators (such as the semicolon) in imperative
-- languages.
--
-- 'as >> bs' can be understood as the do
-- expression
--
--
-- do as
-- bs
--
(>>) :: Monad m => m a -> m b -> m b
-- | Inject a value into the monadic type.
return :: Monad m => a -> m a
infixl 1 >>=
infixl 1 >>
-- | A type f is a Functor if it provides a function fmap
-- which, given any types a and b lets you apply any
-- function from (a -> b) to turn an f a into an
-- f b, preserving the structure of f. Furthermore
-- f needs to adhere to the following:
--
--
--
-- Note, that the second law follows from the free theorem of the type
-- fmap and the first law, so you need only check that the former
-- condition holds.
class Functor (f :: Type -> Type)
-- | Using ApplicativeDo: 'fmap f as' can be
-- understood as the do expression
--
--
-- do a <- as
-- pure (f a)
--
--
-- with an inferred Functor constraint.
fmap :: Functor f => (a -> b) -> f a -> f b
-- | Replace all locations in the input with the same value. The default
-- definition is fmap . const, but this may be
-- overridden with a more efficient version.
--
-- Using ApplicativeDo: 'a <$ bs' can be
-- understood as the do expression
--
--
-- do bs
-- pure a
--
--
-- with an inferred Functor constraint.
(<$) :: Functor f => a -> f b -> f a
infixl 4 <$
-- | Basic numeric class.
--
-- The Haskell Report defines no laws for Num. However,
-- (+) and (*) are customarily expected
-- to define a ring and have the following properties:
--
--
-- - Associativity of (+) (x + y) +
-- z = x + (y + z)
-- - Commutativity of (+) x + y
-- = y + x
-- - fromInteger 0 is the additive
-- identity x + fromInteger 0 = x
-- - negate gives the additive inverse x +
-- negate x = fromInteger 0
-- - Associativity of (*) (x * y) *
-- z = x * (y * z)
-- - fromInteger 1 is the multiplicative
-- identity x * fromInteger 1 = x and
-- fromInteger 1 * x = x
-- - Distributivity of (*) with respect to
-- (+) a * (b + c) = (a * b) + (a *
-- c) and (b + c) * a = (b * a) + (c * a)
--
--
-- Note that it isn't customarily expected that a type instance of
-- both Num and Ord implement an ordered ring. Indeed, in
-- base only Integer and Rational do.
class Num a
(+) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
-- | Unary negation.
negate :: Num a => a -> a
-- | Absolute value.
abs :: Num a => a -> a
-- | Sign of a number. The functions abs and signum should
-- satisfy the law:
--
--
-- abs x * signum x == x
--
--
-- For real numbers, the signum is either -1 (negative),
-- 0 (zero) or 1 (positive).
signum :: Num a => a -> a
-- | Conversion from an Integer. An integer literal represents the
-- application of the function fromInteger to the appropriate
-- value of type Integer, so such literals have type
-- (Num a) => a.
fromInteger :: Num a => Integer -> a
infixl 6 -
infixl 6 +
infixl 7 *
-- | The Ord class is used for totally ordered datatypes.
--
-- Instances of Ord can be derived for any user-defined datatype
-- whose constituent types are in Ord. The declared order of the
-- constructors in the data declaration determines the ordering in
-- derived Ord instances. The Ordering datatype allows a
-- single comparison to determine the precise ordering of two objects.
--
-- The Haskell Report defines no laws for Ord. However,
-- <= is customarily expected to implement a non-strict partial
-- order and have the following properties:
--
--
-- - Transitivity if x <= y && y <=
-- z = True, then x <= z = True
-- - Reflexivity x <= x = True
-- - Antisymmetry if x <= y && y <=
-- x = True, then x == y = True
--
--
-- Note that the following operator interactions are expected to hold:
--
--
-- - x >= y = y <= x
-- - x < y = x <= y && x /= y
-- - x > y = y < x
-- - x < y = compare x y == LT
-- - x > y = compare x y == GT
-- - x == y = compare x y == EQ
-- - min x y == if x <= y then x else y = True
-- - max x y == if x >= y then x else y = True
--
--
-- Note that (7.) and (8.) do not require min and
-- max to return either of their arguments. The result is merely
-- required to equal one of the arguments in terms of (==).
--
-- Minimal complete definition: either compare or <=.
-- Using compare can be more efficient for complex types.
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
infix 4 <
infix 4 <=
infix 4 >
infix 4 >=
-- | Parsing of Strings, producing values.
--
-- Derived instances of Read make the following assumptions, which
-- derived instances of Show obey:
--
--
-- - If the constructor is defined to be an infix operator, then the
-- derived Read instance will parse only infix applications of the
-- constructor (not the prefix form).
-- - Associativity is not used to reduce the occurrence of parentheses,
-- although precedence may be.
-- - If the constructor is defined using record syntax, the derived
-- Read will parse only the record-syntax form, and furthermore,
-- the fields must be given in the same order as the original
-- declaration.
-- - The derived Read instance allows arbitrary Haskell
-- whitespace between tokens of the input string. Extra parentheses are
-- also allowed.
--
--
-- For example, given the declarations
--
--
-- infixr 5 :^:
-- data Tree a = Leaf a | Tree a :^: Tree a
--
--
-- the derived instance of Read in Haskell 2010 is equivalent to
--
--
-- instance (Read a) => Read (Tree a) where
--
-- readsPrec d r = readParen (d > app_prec)
-- (\r -> [(Leaf m,t) |
-- ("Leaf",s) <- lex r,
-- (m,t) <- readsPrec (app_prec+1) s]) r
--
-- ++ readParen (d > up_prec)
-- (\r -> [(u:^:v,w) |
-- (u,s) <- readsPrec (up_prec+1) r,
-- (":^:",t) <- lex s,
-- (v,w) <- readsPrec (up_prec+1) t]) r
--
-- where app_prec = 10
-- up_prec = 5
--
--
-- Note that right-associativity of :^: is unused.
--
-- The derived instance in GHC is equivalent to
--
--
-- instance (Read a) => Read (Tree a) where
--
-- readPrec = parens $ (prec app_prec $ do
-- Ident "Leaf" <- lexP
-- m <- step readPrec
-- return (Leaf m))
--
-- +++ (prec up_prec $ do
-- u <- step readPrec
-- Symbol ":^:" <- lexP
-- v <- step readPrec
-- return (u :^: v))
--
-- where app_prec = 10
-- up_prec = 5
--
-- readListPrec = readListPrecDefault
--
--
-- Why do both readsPrec and readPrec exist, and why does
-- GHC opt to implement readPrec in derived Read instances
-- instead of readsPrec? The reason is that readsPrec is
-- based on the ReadS type, and although ReadS is mentioned
-- in the Haskell 2010 Report, it is not a very efficient parser data
-- structure.
--
-- readPrec, on the other hand, is based on a much more efficient
-- ReadPrec datatype (a.k.a "new-style parsers"), but its
-- definition relies on the use of the RankNTypes language
-- extension. Therefore, readPrec (and its cousin,
-- readListPrec) are marked as GHC-only. Nevertheless, it is
-- recommended to use readPrec instead of readsPrec
-- whenever possible for the efficiency improvements it brings.
--
-- As mentioned above, derived Read instances in GHC will
-- implement readPrec instead of readsPrec. The default
-- implementations of readsPrec (and its cousin, readList)
-- will simply use readPrec under the hood. If you are writing a
-- Read instance by hand, it is recommended to write it like so:
--
--
-- instance Read T where
-- readPrec = ...
-- readListPrec = readListPrecDefault
--
class Read a
-- | attempts to parse a value from the front of the string, returning a
-- list of (parsed value, remaining string) pairs. If there is no
-- successful parse, the returned list is empty.
--
-- Derived instances of Read and Show satisfy the
-- following:
--
--
--
-- That is, readsPrec parses the string produced by
-- showsPrec, and delivers the value that showsPrec started
-- with.
readsPrec :: Read a => Int -> ReadS a
-- | The method readList is provided to allow the programmer to give
-- a specialised way of parsing lists of values. For example, this is
-- used by the predefined Read instance of the Char type,
-- where values of type String should be are expected to use
-- double quotes, rather than square brackets.
readList :: Read a => ReadS [a]
class (Num a, Ord a) => Real a
-- | the rational equivalent of its real argument with full precision
toRational :: Real a => a -> Rational
-- | Efficient, machine-independent access to the components of a
-- floating-point number.
class (RealFrac a, Floating a) => RealFloat a
-- | a constant function, returning the radix of the representation (often
-- 2)
floatRadix :: RealFloat a => a -> Integer
-- | a constant function, returning the number of digits of
-- floatRadix in the significand
floatDigits :: RealFloat a => a -> Int
-- | a constant function, returning the lowest and highest values the
-- exponent may assume
floatRange :: RealFloat a => a -> (Int, Int)
-- | The function decodeFloat applied to a real floating-point
-- number returns the significand expressed as an Integer and an
-- appropriately scaled exponent (an Int). If
-- decodeFloat x yields (m,n), then x
-- is equal in value to m*b^^n, where b is the
-- floating-point radix, and furthermore, either m and
-- n are both zero or else b^(d-1) <= abs m <
-- b^d, where d is the value of floatDigits
-- x. In particular, decodeFloat 0 = (0,0). If the
-- type contains a negative zero, also decodeFloat (-0.0) =
-- (0,0). The result of decodeFloat x is
-- unspecified if either of isNaN x or
-- isInfinite x is True.
decodeFloat :: RealFloat a => a -> (Integer, Int)
-- | encodeFloat performs the inverse of decodeFloat in the
-- sense that for finite x with the exception of -0.0,
-- uncurry encodeFloat (decodeFloat x) = x.
-- encodeFloat m n is one of the two closest
-- representable floating-point numbers to m*b^^n (or
-- ±Infinity if overflow occurs); usually the closer, but if
-- m contains too many bits, the result may be rounded in the
-- wrong direction.
encodeFloat :: RealFloat a => Integer -> Int -> a
-- | exponent corresponds to the second component of
-- decodeFloat. exponent 0 = 0 and for finite
-- nonzero x, exponent x = snd (decodeFloat x)
-- + floatDigits x. If x is a finite floating-point
-- number, it is equal in value to significand x * b ^^
-- exponent x, where b is the floating-point radix.
-- The behaviour is unspecified on infinite or NaN values.
exponent :: RealFloat a => a -> Int
-- | The first component of decodeFloat, scaled to lie in the open
-- interval (-1,1), either 0.0 or of absolute
-- value >= 1/b, where b is the floating-point
-- radix. The behaviour is unspecified on infinite or NaN
-- values.
significand :: RealFloat a => a -> a
-- | multiplies a floating-point number by an integer power of the radix
scaleFloat :: RealFloat a => Int -> a -> a
-- | True if the argument is an IEEE "not-a-number" (NaN) value
isNaN :: RealFloat a => a -> Bool
-- | True if the argument is an IEEE infinity or negative infinity
isInfinite :: RealFloat a => a -> Bool
-- | True if the argument is too small to be represented in
-- normalized format
isDenormalized :: RealFloat a => a -> Bool
-- | True if the argument is an IEEE negative zero
isNegativeZero :: RealFloat a => a -> Bool
-- | True if the argument is an IEEE floating point number
isIEEE :: RealFloat a => a -> Bool
-- | a version of arctangent taking two real floating-point arguments. For
-- real floating x and y, atan2 y x
-- computes the angle (from the positive x-axis) of the vector from the
-- origin to the point (x,y). atan2 y x returns
-- a value in the range [-pi, pi]. It follows the
-- Common Lisp semantics for the origin when signed zeroes are supported.
-- atan2 y 1, with y in a type that is
-- RealFloat, should return the same value as atan
-- y. A default definition of atan2 is provided, but
-- implementors can provide a more accurate implementation.
atan2 :: RealFloat a => a -> a -> a
-- | Extracting components of fractions.
class (Real a, Fractional a) => RealFrac a
-- | The function properFraction takes a real fractional number
-- x and returns a pair (n,f) such that x =
-- n+f, and:
--
--
-- - n is an integral number with the same sign as x;
-- and
-- - f is a fraction with the same type and sign as
-- x, and with absolute value less than 1.
--
--
-- The default definitions of the ceiling, floor,
-- truncate and round functions are in terms of
-- properFraction.
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
-- | truncate x returns the integer nearest x
-- between zero and x
truncate :: (RealFrac a, Integral b) => a -> b
-- | round x returns the nearest integer to x; the
-- even integer if x is equidistant between two integers
round :: (RealFrac a, Integral b) => a -> b
-- | ceiling x returns the least integer not less than
-- x
ceiling :: (RealFrac a, Integral b) => a -> b
-- | floor x returns the greatest integer not greater than
-- x
floor :: (RealFrac a, Integral b) => a -> b
-- | Conversion of values to readable Strings.
--
-- Derived instances of Show have the following properties, which
-- are compatible with derived instances of Read:
--
--
-- - The result of show is a syntactically correct Haskell
-- expression containing only constants, given the fixity declarations in
-- force at the point where the type is declared. It contains only the
-- constructor names defined in the data type, parentheses, and spaces.
-- When labelled constructor fields are used, braces, commas, field
-- names, and equal signs are also used.
-- - If the constructor is defined to be an infix operator, then
-- showsPrec will produce infix applications of the
-- constructor.
-- - the representation will be enclosed in parentheses if the
-- precedence of the top-level constructor in x is less than
-- d (associativity is ignored). Thus, if d is
-- 0 then the result is never surrounded in parentheses; if
-- d is 11 it is always surrounded in parentheses,
-- unless it is an atomic expression.
-- - If the constructor is defined using record syntax, then
-- show will produce the record-syntax form, with the fields given
-- in the same order as the original declaration.
--
--
-- For example, given the declarations
--
--
-- infixr 5 :^:
-- data Tree a = Leaf a | Tree a :^: Tree a
--
--
-- the derived instance of Show is equivalent to
--
--
-- instance (Show a) => Show (Tree a) where
--
-- showsPrec d (Leaf m) = showParen (d > app_prec) $
-- showString "Leaf " . showsPrec (app_prec+1) m
-- where app_prec = 10
--
-- showsPrec d (u :^: v) = showParen (d > up_prec) $
-- showsPrec (up_prec+1) u .
-- showString " :^: " .
-- showsPrec (up_prec+1) v
-- where up_prec = 5
--
--
-- Note that right-associativity of :^: is ignored. For example,
--
--
-- - show (Leaf 1 :^: Leaf 2 :^: Leaf 3) produces the
-- string "Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
--
class Show a
-- | Convert a value to a readable String.
--
-- showsPrec should satisfy the law
--
--
-- showsPrec d x r ++ s == showsPrec d x (r ++ s)
--
--
-- Derived instances of Read and Show satisfy the
-- following:
--
--
--
-- That is, readsPrec parses the string produced by
-- showsPrec, and delivers the value that showsPrec started
-- with.
showsPrec :: Show a => Int -> a -> ShowS
-- | A specialised variant of showsPrec, using precedence context
-- zero, and returning an ordinary String.
show :: Show a => a -> String
-- | The method showList is provided to allow the programmer to give
-- a specialised way of showing lists of values. For example, this is
-- used by the predefined Show instance of the Char type,
-- where values of type String should be shown in double quotes,
-- rather than between square brackets.
showList :: Show a => [a] -> ShowS
-- | When a value is bound in do-notation, the pattern on the left
-- hand side of <- might not match. In this case, this class
-- provides a function to recover.
--
-- A Monad without a MonadFail instance may only be used in
-- conjunction with pattern that always match, such as newtypes, tuples,
-- data types with only a single data constructor, and irrefutable
-- patterns (~pat).
--
-- Instances of MonadFail should satisfy the following law:
-- fail s should be a left zero for >>=,
--
--
-- fail s >>= f = fail s
--
--
-- If your Monad is also MonadPlus, a popular definition is
--
--
-- fail _ = mzero
--
class Monad m => MonadFail (m :: Type -> Type)
fail :: MonadFail m => String -> m a
-- | 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 :: Type -> Type)
-- | 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.
--
-- Using ApplicativeDo: 'fs <*> as' can be
-- understood as the do expression
--
--
-- do f <- fs
-- a <- as
-- pure (f a)
--
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
-- | Sequence actions, discarding the value of the first argument.
--
-- 'as *> bs' can be understood as the do
-- expression
--
--
-- do as
-- bs
--
--
-- This is a tad complicated for our ApplicativeDo extension
-- which will give it a Monad constraint. For an
-- Applicative constraint we write it of the form
--
--
-- do _ <- as
-- b <- bs
-- pure b
--
(*>) :: Applicative f => f a -> f b -> f b
-- | Sequence actions, discarding the value of the second argument.
--
-- Using ApplicativeDo: 'as <* bs' can be
-- understood as the do expression
--
--
-- do a <- as
-- bs
-- pure a
--
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*
infixl 4 *>
infixl 4 <*>
-- | Data structures that can be folded.
--
-- For example, given a data type
--
--
-- data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--
--
-- a suitable instance would be
--
--
-- instance Foldable Tree where
-- foldMap f Empty = mempty
-- foldMap f (Leaf x) = f x
-- foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r
--
--
-- This is suitable even for abstract types, as the monoid is assumed to
-- satisfy the monoid laws. Alternatively, one could define
-- foldr:
--
--
-- instance Foldable Tree where
-- foldr f z Empty = z
-- foldr f z (Leaf x) = f x z
-- foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l
--
--
-- Foldable instances are expected to satisfy the following
-- laws:
--
--
-- foldr f z t = appEndo (foldMap (Endo . f) t ) z
--
--
--
-- foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
--
--
--
-- fold = foldMap id
--
--
--
-- length = getSum . foldMap (Sum . const 1)
--
--
-- sum, product, maximum, and minimum
-- should all be essentially equivalent to foldMap forms, such
-- as
--
--
-- sum = getSum . foldMap Sum
--
--
-- but may be less defined.
--
-- If the type is also a Functor instance, it should satisfy
--
--
-- foldMap f = fold . fmap f
--
--
-- which implies that
--
--
-- foldMap f . fmap g = foldMap (f . g)
--
class Foldable (t :: Type -> Type)
-- | Map each element of the structure to a monoid, and combine the
-- results.
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
-- | Right-associative fold of a structure.
--
-- In the case of lists, foldr, when applied to a binary operator,
-- a starting value (typically the right-identity of the operator), and a
-- list, reduces the list using the binary operator, from right to left:
--
--
-- foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
--
--
-- Note that, since the head of the resulting expression is produced by
-- an application of the operator to the first element of the list,
-- foldr can produce a terminating expression from an infinite
-- list.
--
-- For a general Foldable structure this should be semantically
-- identical to,
--
--
-- foldr f z = foldr f z . toList
--
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
-- | Left-associative fold of a structure.
--
-- In the case of lists, foldl, when applied to a binary operator,
-- a starting value (typically the left-identity of the operator), and a
-- list, reduces the list using the binary operator, from left to right:
--
--
-- foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
--
--
-- Note that to produce the outermost application of the operator the
-- entire input list must be traversed. This means that foldl'
-- will diverge if given an infinite list.
--
-- Also note that if you want an efficient left-fold, you probably want
-- to use foldl' instead of foldl. The reason for this is
-- that latter does not force the "inner" results (e.g. z `f` x1
-- in the above example) before applying them to the operator (e.g. to
-- (`f` x2)). This results in a thunk chain <math>
-- elements long, which then must be evaluated from the outside-in.
--
-- For a general Foldable structure this should be semantically
-- identical to,
--
--
-- foldl f z = foldl f z . toList
--
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
-- | Left-associative fold of a structure but with strict application of
-- the operator.
--
-- This ensures that each step of the fold is forced to weak head normal
-- form before being applied, avoiding the collection of thunks that
-- would otherwise occur. This is often what you want to strictly reduce
-- a finite list to a single, monolithic result (e.g. length).
--
-- For a general Foldable structure this should be semantically
-- identical to,
--
--
-- foldl' f z = foldl' f z . toList
--
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
-- | A variant of foldr that has no base case, and thus may only be
-- applied to non-empty structures.
--
--
-- foldr1 f = foldr1 f . toList
--
foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
-- | A variant of foldl that has no base case, and thus may only be
-- applied to non-empty structures.
--
--
-- foldl1 f = foldl1 f . toList
--
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
-- | Test whether the structure is empty. The default implementation is
-- optimized for structures that are similar to cons-lists, because there
-- is no general way to do better.
null :: Foldable t => t a -> Bool
-- | Returns the size/length of a finite structure as an Int. The
-- default implementation is optimized for structures that are similar to
-- cons-lists, because there is no general way to do better.
length :: Foldable t => t a -> Int
-- | Does the element occur in the structure?
elem :: (Foldable t, Eq a) => a -> t a -> Bool
-- | The largest element of a non-empty structure.
maximum :: (Foldable t, Ord a) => t a -> a
-- | The least element of a non-empty structure.
minimum :: (Foldable t, Ord a) => t a -> a
-- | The sum function computes the sum of the numbers of a
-- structure.
sum :: (Foldable t, Num a) => t a -> a
-- | The product function computes the product of the numbers of a
-- structure.
product :: (Foldable t, Num a) => t a -> a
infix 4 `elem`
-- | Functors representing data structures that can be traversed from left
-- to right.
--
-- A definition of traverse must satisfy the following laws:
--
--
--
-- A definition of sequenceA must satisfy the following laws:
--
--
--
-- where an applicative transformation is a function
--
--
-- t :: (Applicative f, Applicative g) => f a -> g a
--
--
-- preserving the Applicative operations, i.e.
--
--
-- t (pure x) = pure x
-- t (f <*> x) = t f <*> t x
--
--
-- and the identity functor Identity and composition functors
-- Compose are from Data.Functor.Identity and
-- Data.Functor.Compose.
--
-- A result of the naturality law is a purity law for traverse
--
--
-- traverse pure = pure
--
--
-- (The naturality law is implied by parametricity and thus so is the
-- purity law [1, p15].)
--
-- Instances are similar to Functor, e.g. given a data type
--
--
-- data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--
--
-- a suitable instance would be
--
--
-- instance Traversable Tree where
-- traverse f Empty = pure Empty
-- traverse f (Leaf x) = Leaf <$> f x
-- traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--
--
-- This is suitable even for abstract types, as the laws for
-- <*> imply a form of associativity.
--
-- The superclass instances should satisfy the following:
--
--
-- - In the Functor instance, fmap should be equivalent
-- to traversal with the identity applicative functor
-- (fmapDefault).
-- - In the Foldable instance, foldMap should be
-- equivalent to traversal with a constant applicative functor
-- (foldMapDefault).
--
--
-- References: [1] The Essence of the Iterator Pattern, Jeremy Gibbons
-- and Bruno C. d. S. Oliveira
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
-- | Map each element of a structure to an action, evaluate these actions
-- from left to right, and collect the results. For a version that
-- ignores the results see traverse_.
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
-- | Evaluate each action in the structure from left to right, and collect
-- the results. For a version that ignores the results see
-- sequenceA_.
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
-- | 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, Monad m) => (a -> m b) -> t a -> m (t b)
-- | Evaluate each monadic action in the structure from left to right, and
-- collect the results. For a version that ignores the results see
-- sequence_.
sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
-- | The class of semigroups (types with an associative binary operation).
--
-- Instances should satisfy the following:
--
--
-- - Associativity x <> (y <> z) =
-- (x <> y) <> z
--
class Semigroup a
-- | The class of monoids (types with an associative binary operation that
-- has an identity). Instances should satisfy the following:
--
--
--
-- The method names refer to the monoid of lists under concatenation, but
-- there are many other instances.
--
-- Some types can be viewed as a monoid in more than one way, e.g. both
-- addition and multiplication on numbers. In such cases we often define
-- newtypes and make those instances of Monoid, e.g.
-- Sum and Product.
--
-- NOTE: Semigroup is a superclass of Monoid since
-- base-4.11.0.0.
class Semigroup a => Monoid a
-- | Identity of mappend
--
--
-- >>> "Hello world" <> mempty
-- "Hello world"
--
mempty :: Monoid a => a
-- | An associative operation
--
-- NOTE: This method is redundant and has the default
-- implementation mappend = (<>) since
-- base-4.11.0.0. Should it be implemented manually, since
-- mappend is a synonym for (<>), it is expected that
-- the two functions are defined the same way. In a future GHC release
-- mappend will be removed from Monoid.
mappend :: Monoid a => a -> a -> a
-- | Fold a list using the monoid.
--
-- For most types, the default definition for mconcat will be
-- used, but the function is included in the class definition so that an
-- optimized version can be provided for specific types.
--
--
-- >>> mconcat ["Hello", " ", "Haskell", "!"]
-- "Hello Haskell!"
--
mconcat :: Monoid a => [a] -> a
data Bool
False :: Bool
True :: Bool
-- | The character type Char is an enumeration whose values
-- represent Unicode (or equivalently ISO/IEC 10646) code points (i.e.
-- characters, see http://www.unicode.org/ for details). This set
-- extends the ISO 8859-1 (Latin-1) character set (the first 256
-- characters), which is itself an extension of the ASCII character set
-- (the first 128 characters). A character literal in Haskell has type
-- Char.
--
-- To convert a Char to or from the corresponding Int value
-- defined by Unicode, use toEnum and fromEnum from the
-- Enum class respectively (or equivalently ord and
-- chr).
data Char
-- | Double-precision floating point numbers. It is desirable that this
-- type be at least equal in range and precision to the IEEE
-- double-precision type.
data Double
-- | Single-precision floating point numbers. It is desirable that this
-- type be at least equal in range and precision to the IEEE
-- single-precision type.
data Float
-- | A fixed-precision integer type with at least the range [-2^29 ..
-- 2^29-1]. The exact range for a given implementation can be
-- determined by using minBound and maxBound from the
-- Bounded class.
data Int
-- | Arbitrary precision integers. In contrast with fixed-size integral
-- types such as Int, the Integer type represents the
-- entire infinite range of integers.
--
-- For more information about this type's representation, see the
-- comments in its implementation.
data Integer
-- | The Maybe type encapsulates an optional value. A value of type
-- Maybe a either contains a value of type a
-- (represented as Just a), or it is empty (represented
-- as Nothing). Using Maybe is a good way to deal with
-- errors or exceptional cases without resorting to drastic measures such
-- as error.
--
-- The Maybe type is also a monad. It is a simple kind of error
-- monad, where all errors are represented by Nothing. A richer
-- error monad can be built using the Either type.
data Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
data Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering
-- | Arbitrary-precision rational numbers, represented as a ratio of two
-- Integer values. A rational number may be constructed using the
-- % operator.
type Rational = Ratio Integer
-- | A value of type IO a is a computation which, when
-- performed, does some I/O before returning a value of type a.
--
-- There is really only one way to "perform" an I/O action: bind it to
-- Main.main in your program. When your program is run, the I/O
-- will be performed. It isn't possible to perform I/O from an arbitrary
-- function, unless that function is itself in the IO monad and
-- called at some point, directly or indirectly, from Main.main.
--
-- IO is a monad, so IO actions can be combined using
-- either the do-notation or the >> and >>=
-- operations from the Monad class.
data IO a
-- | A Word is an unsigned integral type, with the same size as
-- Int.
data Word
-- | The Either type represents values with two possibilities: a
-- value of type Either a b is either Left
-- a or Right b.
--
-- The Either type is sometimes used to represent a value which is
-- either correct or an error; by convention, the Left constructor
-- is used to hold an error value and the Right constructor is
-- used to hold a correct value (mnemonic: "right" also means "correct").
--
-- Examples
--
-- The type Either String Int is the type
-- of values which can be either a String or an Int. The
-- Left constructor can be used only on Strings, and the
-- Right constructor can be used only on Ints:
--
--
-- >>> let s = Left "foo" :: Either String Int
--
-- >>> s
-- Left "foo"
--
-- >>> let n = Right 3 :: Either String Int
--
-- >>> n
-- Right 3
--
-- >>> :type s
-- s :: Either String Int
--
-- >>> :type n
-- n :: Either String Int
--
--
-- The fmap from our Functor instance will ignore
-- Left values, but will apply the supplied function to values
-- contained in a Right:
--
--
-- >>> let s = Left "foo" :: Either String Int
--
-- >>> let n = Right 3 :: Either String Int
--
-- >>> fmap (*2) s
-- Left "foo"
--
-- >>> fmap (*2) n
-- Right 6
--
--
-- The Monad instance for Either allows us to chain
-- together multiple actions which may fail, and fail overall if any of
-- the individual steps failed. First we'll write a function that can
-- either parse an Int from a Char, or fail.
--
--
-- >>> import Data.Char ( digitToInt, isDigit )
--
-- >>> :{
-- let parseEither :: Char -> Either String Int
-- parseEither c
-- | isDigit c = Right (digitToInt c)
-- | otherwise = Left "parse error"
--
-- >>> :}
--
--
-- The following should work, since both '1' and '2'
-- can be parsed as Ints.
--
--
-- >>> :{
-- let parseMultiple :: Either String Int
-- parseMultiple = do
-- x <- parseEither '1'
-- y <- parseEither '2'
-- return (x + y)
--
-- >>> :}
--
--
--
-- >>> parseMultiple
-- Right 3
--
--
-- But the following should fail overall, since the first operation where
-- we attempt to parse 'm' as an Int will fail:
--
--
-- >>> :{
-- let parseMultiple :: Either String Int
-- parseMultiple = do
-- x <- parseEither 'm'
-- y <- parseEither '2'
-- return (x + y)
--
-- >>> :}
--
--
--
-- >>> parseMultiple
-- Left "parse error"
--
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b
-- | The readIO function is similar to read except that it
-- signals parse failure to the IO monad instead of terminating
-- the program.
readIO :: Read a => String -> IO a
-- | The readLn function combines getLine and readIO.
readLn :: Read a => IO a
-- | The computation appendFile file str function appends
-- the string str, to the file file.
--
-- Note that writeFile and appendFile write a literal
-- string to a file. To write a value of any printable type, as with
-- print, use the show function to convert the value to a
-- string first.
--
--
-- main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])
--
appendFile :: FilePath -> String -> IO ()
-- | The computation writeFile file str function writes the
-- string str, to the file file.
writeFile :: FilePath -> String -> IO ()
-- | The readFile function reads a file and returns the contents of
-- the file as a string. The file is read lazily, on demand, as with
-- getContents.
readFile :: FilePath -> IO String
-- | The interact function takes a function of type
-- String->String as its argument. The entire input from the
-- standard input device is passed to this function as its argument, and
-- the resulting string is output on the standard output device.
interact :: (String -> String) -> IO ()
-- | The getContents operation returns all user input as a single
-- string, which is read lazily as it is needed (same as
-- hGetContents stdin).
getContents :: IO String
-- | Read a line from the standard input device (same as hGetLine
-- stdin).
getLine :: IO String
-- | Read a character from the standard input device (same as
-- hGetChar stdin).
getChar :: IO Char
-- | The same as putStr, but adds a newline character.
putStrLn :: String -> IO ()
-- | Write a string to the standard output device (same as hPutStr
-- stdout).
putStr :: String -> IO ()
-- | Write a character to the standard output device (same as
-- hPutChar stdout).
putChar :: Char -> IO ()
-- | Raise an IOError in the IO monad.
ioError :: IOError -> IO a
-- | File and directory names are values of type String, whose
-- precise meaning is operating system dependent. Files can be opened,
-- yielding a handle which can then be used to operate on the contents of
-- that file.
type FilePath = String
-- | Construct an IOError value with a string describing the error.
-- The fail method of the IO instance of the Monad
-- class raises a userError, thus:
--
--
-- instance Monad IO where
-- ...
-- fail s = ioError (userError s)
--
userError :: String -> IOError
-- | The Haskell 2010 type for exceptions in the IO monad. Any I/O
-- operation may raise an IOError instead of returning a result.
-- For a more general type of exception, including also those that arise
-- in pure code, see Exception.
--
-- In Haskell 2010, this is an opaque type.
type IOError = IOException
-- | notElem is the negation of elem.
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
infix 4 `notElem`
-- | Determines whether all elements of the structure satisfy the
-- predicate.
all :: Foldable t => (a -> Bool) -> t a -> Bool
-- | Determines whether any element of the structure satisfies the
-- predicate.
any :: Foldable t => (a -> Bool) -> t a -> Bool
-- | or returns the disjunction of a container of Bools. For the
-- result to be False, the container must be finite; True,
-- however, results from a True value finitely far from the left
-- end.
or :: Foldable t => t Bool -> Bool
-- | and returns the conjunction of a container of Bools. For the
-- result to be True, the container must be finite; False,
-- however, results from a False value finitely far from the left
-- end.
and :: Foldable t => t Bool -> Bool
-- | Map a function over all the elements of a container and concatenate
-- the resulting lists.
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
-- | The concatenation of all the elements of a container of lists.
concat :: Foldable t => t [a] -> [a]
-- | Evaluate each monadic action in the structure from left to right, and
-- ignore the results. For a version that doesn't ignore the results see
-- sequence.
--
-- As of base 4.8.0.0, sequence_ is just sequenceA_,
-- specialized to Monad.
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
-- | Map each element of a structure to a monadic action, evaluate these
-- actions from left to right, and ignore the results. For a version that
-- doesn't ignore the results see mapM.
--
-- As of base 4.8.0.0, mapM_ is just traverse_, specialized
-- to Monad.
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
-- | unwords is an inverse operation to words. It joins words
-- with separating spaces.
--
--
-- >>> unwords ["Lorem", "ipsum", "dolor"]
-- "Lorem ipsum dolor"
--
unwords :: [String] -> String
-- | words breaks a string up into a list of words, which were
-- delimited by white space.
--
--
-- >>> words "Lorem ipsum\ndolor"
-- ["Lorem","ipsum","dolor"]
--
words :: String -> [String]
-- | unlines is an inverse operation to lines. It joins
-- lines, after appending a terminating newline to each.
--
--
-- >>> unlines ["Hello", "World", "!"]
-- "Hello\nWorld\n!\n"
--
unlines :: [String] -> String
-- | lines breaks a string up into a list of strings at newline
-- characters. The resulting strings do not contain newlines.
--
-- Note that after splitting the string at newline characters, the last
-- part of the string is considered a line even if it doesn't end with a
-- newline. For example,
--
--
-- >>> lines ""
-- []
--
--
--
-- >>> lines "\n"
-- [""]
--
--
--
-- >>> lines "one"
-- ["one"]
--
--
--
-- >>> lines "one\n"
-- ["one"]
--
--
--
-- >>> lines "one\n\n"
-- ["one",""]
--
--
--
-- >>> lines "one\ntwo"
-- ["one","two"]
--
--
--
-- >>> lines "one\ntwo\n"
-- ["one","two"]
--
--
-- Thus lines s contains at least as many elements as
-- newlines in s.
lines :: String -> [String]
-- | The read function reads input from a string, which must be
-- completely consumed by the input process. read fails with an
-- error if the parse is unsuccessful, and it is therefore
-- discouraged from being used in real applications. Use readMaybe
-- or readEither for safe alternatives.
--
--
-- >>> read "123" :: Int
-- 123
--
--
--
-- >>> read "hello" :: Int
-- *** Exception: Prelude.read: no parse
--
read :: Read a => String -> a
-- | equivalent to readsPrec with a precedence of 0.
reads :: Read a => ReadS a
-- | Case analysis for the Either type. If the value is
-- Left a, apply the first function to a; if it
-- is Right b, apply the second function to b.
--
-- Examples
--
-- We create two values of type Either String
-- Int, one using the Left constructor and another
-- using the Right constructor. Then we apply "either" the
-- length function (if we have a String) or the "times-two"
-- function (if we have an Int):
--
--
-- >>> let s = Left "foo" :: Either String Int
--
-- >>> let n = Right 3 :: Either String Int
--
-- >>> either length (*2) s
-- 3
--
-- >>> either length (*2) n
-- 6
--
either :: (a -> c) -> (b -> c) -> Either a b -> c
-- | The lex function reads a single lexeme from the input,
-- discarding initial white space, and returning the characters that
-- constitute the lexeme. If the input string contains only white space,
-- lex returns a single successful `lexeme' consisting of the
-- empty string. (Thus lex "" = [("","")].) If there is
-- no legal lexeme at the beginning of the input string, lex fails
-- (i.e. returns []).
--
-- This lexer is not completely faithful to the Haskell lexical syntax in
-- the following respects:
--
--
-- - Qualified names are not handled properly
-- - Octal and hexadecimal numerics are not recognized as a single
-- token
-- - Comments are not treated properly
--
lex :: ReadS String
-- | readParen True p parses what p parses,
-- but surrounded with parentheses.
--
-- readParen False p parses what p
-- parses, but optionally surrounded with parentheses.
readParen :: Bool -> ReadS a -> ReadS a
-- | A parser for a type a, represented as a function that takes a
-- String and returns a list of possible parses as
-- (a,String) pairs.
--
-- Note that this kind of backtracking parser is very inefficient;
-- reading a large structure may be quite slow (cf ReadP).
type ReadS a = String -> [(a, String)]
-- | lcm x y is the smallest positive integer that both
-- x and y divide.
lcm :: Integral a => a -> a -> a
-- | gcd x y is the non-negative factor of both x
-- and y of which every common factor of x and
-- y is also a factor; for example gcd 4 2 = 2,
-- gcd (-4) 6 = 2, gcd 0 4 = 4.
-- gcd 0 0 = 0. (That is, the common divisor
-- that is "greatest" in the divisibility preordering.)
--
-- Note: Since for signed fixed-width integer types, abs
-- minBound < 0, the result may be negative if one of the
-- arguments is minBound (and necessarily is if the other
-- is 0 or minBound) for such types.
gcd :: Integral a => a -> a -> a
-- | raise a number to an integral power
(^^) :: (Fractional a, Integral b) => a -> b -> a
infixr 8 ^^
-- | raise a number to a non-negative integral power
(^) :: (Num a, Integral b) => a -> b -> a
infixr 8 ^
odd :: Integral a => a -> Bool
even :: Integral a => a -> Bool
-- | utility function that surrounds the inner show function with
-- parentheses when the Bool parameter is True.
showParen :: Bool -> ShowS -> ShowS
-- | utility function converting a String to a show function that
-- simply prepends the string unchanged.
showString :: String -> ShowS
-- | utility function converting a Char to a show function that
-- simply prepends the character unchanged.
showChar :: Char -> ShowS
-- | equivalent to showsPrec with a precedence of 0.
shows :: Show a => a -> ShowS
-- | The shows functions return a function that prepends the
-- output String to an existing String. This allows
-- constant-time concatenation of results using function composition.
type ShowS = String -> String
-- | The unzip3 function takes a list of triples and returns three
-- lists, analogous to unzip.
unzip3 :: [(a, b, c)] -> ([a], [b], [c])
-- | unzip transforms a list of pairs into a list of first
-- components and a list of second components.
unzip :: [(a, b)] -> ([a], [b])
-- | The zipWith3 function takes a function which combines three
-- elements, as well as three lists and returns a list of their
-- point-wise combination, analogous to zipWith. It is capable of
-- list fusion, but it is restricted to its first list argument and its
-- resulting list.
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
-- | <math>. zipWith generalises zip by zipping with
-- the function given as the first argument, instead of a tupling
-- function. For example, zipWith (+) is applied to two
-- lists to produce the list of corresponding sums:
--
--
-- >>> zipWith (+) [1, 2, 3] [4, 5, 6]
-- [5,7,9]
--
--
-- zipWith is right-lazy:
--
--
-- zipWith f [] _|_ = []
--
--
-- zipWith is capable of list fusion, but it is restricted to its
-- first list argument and its resulting list.
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
-- | zip3 takes three lists and returns a list of triples, analogous
-- to zip. It is capable of list fusion, but it is restricted to
-- its first list argument and its resulting list.
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
-- | List index (subscript) operator, starting from 0. It is an instance of
-- the more general genericIndex, which takes an index of any
-- integral type.
(!!) :: [a] -> Int -> a
infixl 9 !!
-- | <math>. lookup key assocs looks up a key in an
-- association list.
--
--
-- >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")]
-- Just "second"
--
lookup :: Eq a => a -> [(a, b)] -> Maybe b
-- | reverse xs returns the elements of xs in
-- reverse order. xs must be finite.
reverse :: [a] -> [a]
-- | break, applied to a predicate p and a list
-- xs, returns a tuple where first element is longest prefix
-- (possibly empty) of xs of elements that do not satisfy
-- p and second element is the remainder of the list:
--
--
-- break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
-- break (< 9) [1,2,3] == ([],[1,2,3])
-- break (> 9) [1,2,3] == ([1,2,3],[])
--
--
-- break p is equivalent to span (not .
-- p).
break :: (a -> Bool) -> [a] -> ([a], [a])
-- | span, applied to a predicate p and a list xs,
-- returns a tuple where first element is longest prefix (possibly empty)
-- of xs of elements that satisfy p and second element
-- is the remainder of the list:
--
--
-- span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
-- span (< 9) [1,2,3] == ([1,2,3],[])
-- span (< 0) [1,2,3] == ([],[1,2,3])
--
--
-- span p xs is equivalent to (takeWhile p xs,
-- dropWhile p xs)
span :: (a -> Bool) -> [a] -> ([a], [a])
-- | splitAt n xs returns a tuple where first element is
-- xs prefix of length n and second element is the
-- remainder of the list:
--
--
-- splitAt 6 "Hello World!" == ("Hello ","World!")
-- splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])
-- splitAt 1 [1,2,3] == ([1],[2,3])
-- splitAt 3 [1,2,3] == ([1,2,3],[])
-- splitAt 4 [1,2,3] == ([1,2,3],[])
-- splitAt 0 [1,2,3] == ([],[1,2,3])
-- splitAt (-1) [1,2,3] == ([],[1,2,3])
--
--
-- It is equivalent to (take n xs, drop n xs) when
-- n is not _|_ (splitAt _|_ xs = _|_).
-- splitAt is an instance of the more general
-- genericSplitAt, in which n may be of any integral
-- type.
splitAt :: Int -> [a] -> ([a], [a])
-- | drop n xs returns the suffix of xs after the
-- first n elements, or [] if n > length
-- xs:
--
--
-- drop 6 "Hello World!" == "World!"
-- drop 3 [1,2,3,4,5] == [4,5]
-- drop 3 [1,2] == []
-- drop 3 [] == []
-- drop (-1) [1,2] == [1,2]
-- drop 0 [1,2] == [1,2]
--
--
-- It is an instance of the more general genericDrop, in which
-- n may be of any integral type.
drop :: Int -> [a] -> [a]
-- | take n, applied to a list xs, returns the
-- prefix of xs of length n, or xs itself if
-- n > length xs:
--
--
-- take 5 "Hello World!" == "Hello"
-- take 3 [1,2,3,4,5] == [1,2,3]
-- take 3 [1,2] == [1,2]
-- take 3 [] == []
-- take (-1) [1,2] == []
-- take 0 [1,2] == []
--
--
-- It is an instance of the more general genericTake, in which
-- n may be of any integral type.
take :: Int -> [a] -> [a]
-- | dropWhile p xs returns the suffix remaining after
-- takeWhile p xs:
--
--
-- dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]
-- dropWhile (< 9) [1,2,3] == []
-- dropWhile (< 0) [1,2,3] == [1,2,3]
--
dropWhile :: (a -> Bool) -> [a] -> [a]
-- | takeWhile, applied to a predicate p and a list
-- xs, returns the longest prefix (possibly empty) of
-- xs of elements that satisfy p:
--
--
-- takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2]
-- takeWhile (< 9) [1,2,3] == [1,2,3]
-- takeWhile (< 0) [1,2,3] == []
--
takeWhile :: (a -> Bool) -> [a] -> [a]
-- | cycle ties a finite list into a circular one, or equivalently,
-- the infinite repetition of the original list. It is the identity on
-- infinite lists.
cycle :: [a] -> [a]
-- | replicate n x is a list of length n with
-- x the value of every element. It is an instance of the more
-- general genericReplicate, in which n may be of any
-- integral type.
replicate :: Int -> a -> [a]
-- | repeat x is an infinite list, with x the
-- value of every element.
repeat :: a -> [a]
-- | iterate f x returns an infinite list of repeated
-- applications of f to x:
--
--
-- iterate f x == [x, f x, f (f x), ...]
--
--
-- Note that iterate is lazy, potentially leading to thunk
-- build-up if the consumer doesn't force each iterate. See
-- iterate' for a strict variant of this function.
iterate :: (a -> a) -> a -> [a]
-- | <math>. scanr1 is a variant of scanr that has no
-- starting value argument.
scanr1 :: (a -> a -> a) -> [a] -> [a]
-- | <math>. scanr is the right-to-left dual of scanl.
-- Note that
--
--
-- head (scanr f z xs) == foldr f z xs.
--
scanr :: (a -> b -> b) -> b -> [a] -> [b]
-- | <math>. scanl1 is a variant of scanl that has no
-- starting value argument:
--
--
-- scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]
--
scanl1 :: (a -> a -> a) -> [a] -> [a]
-- | <math>. scanl is similar to foldl, but returns a
-- list of successive reduced values from the left:
--
--
-- scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
--
--
-- Note that
--
--
-- last (scanl f z xs) == foldl f z xs.
--
scanl :: (b -> a -> b) -> b -> [a] -> [b]
-- | <math>. Return all the elements of a list except the last one.
-- The list must be non-empty.
init :: [a] -> [a]
-- | <math>. Extract the last element of a list, which must be finite
-- and non-empty.
last :: [a] -> a
-- | <math>. Extract the elements after the head of a list, which
-- must be non-empty.
tail :: [a] -> [a]
-- | <math>. Extract the first element of a list, which must be
-- non-empty.
head :: [a] -> a
-- | The maybe function takes a default value, a function, and a
-- Maybe value. If the Maybe value is Nothing, the
-- function returns the default value. Otherwise, it applies the function
-- to the value inside the Just and returns the result.
--
-- Examples
--
-- Basic usage:
--
--
-- >>> maybe False odd (Just 3)
-- True
--
--
--
-- >>> maybe False odd Nothing
-- False
--
--
-- Read an integer from a string using readMaybe. If we succeed,
-- return twice the integer; that is, apply (*2) to it. If
-- instead we fail to parse an integer, return 0 by default:
--
--
-- >>> import Text.Read ( readMaybe )
--
-- >>> maybe 0 (*2) (readMaybe "5")
-- 10
--
-- >>> maybe 0 (*2) (readMaybe "")
-- 0
--
--
-- Apply show to a Maybe Int. If we have Just n,
-- we want to show the underlying Int n. But if we have
-- Nothing, we return the empty string instead of (for example)
-- "Nothing":
--
--
-- >>> maybe "" show (Just 5)
-- "5"
--
-- >>> maybe "" show Nothing
-- ""
--
maybe :: b -> (a -> b) -> Maybe a -> b
-- | 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 <$>
-- | uncurry converts a curried function to a function on pairs.
--
-- Examples
--
--
-- >>> uncurry (+) (1,2)
-- 3
--
--
--
-- >>> uncurry ($) (show, 1)
-- "1"
--
--
--
-- >>> map (uncurry max) [(1,2), (3,4), (6,8)]
-- [2,4,8]
--
uncurry :: (a -> b -> c) -> (a, b) -> c
-- | curry converts an uncurried function to a curried function.
--
-- Examples
--
--
-- >>> curry fst 1 2
-- 1
--
curry :: ((a, b) -> c) -> a -> b -> c
-- | the same as flip (-).
--
-- Because - is treated specially in the Haskell grammar,
-- (- e) is not a section, but an application of
-- prefix negation. However, (subtract
-- exp) is equivalent to the disallowed section.
subtract :: Num a => a -> a -> a
-- | asTypeOf is a type-restricted version of const. It is
-- usually used as an infix operator, and its typing forces its first
-- argument (which is usually overloaded) to have the same type as the
-- second.
asTypeOf :: a -> a -> a
-- | until p f yields the result of applying f
-- until p holds.
until :: (a -> Bool) -> (a -> a) -> a -> a
-- | Strict (call-by-value) application operator. It takes a function and
-- an argument, evaluates the argument to weak head normal form (WHNF),
-- then calls the function with that value.
($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
infixr 0 $!
-- | flip f takes its (first) two arguments in the reverse
-- order of f.
--
--
-- >>> flip (++) "hello" "world"
-- "worldhello"
--
flip :: (a -> b -> c) -> b -> a -> c
-- | Function composition.
(.) :: (b -> c) -> (a -> b) -> a -> c
infixr 9 .
-- | const x is a unary function which evaluates to x for
-- all inputs.
--
--
-- >>> const 42 "hello"
-- 42
--
--
--
-- >>> map (const 42) [0..3]
-- [42,42,42,42]
--
const :: a -> b -> a
-- | Identity function.
--
--
-- id x = x
--
id :: a -> a
-- | Same as >>=, but with the arguments interchanged.
(=<<) :: Monad m => (a -> m b) -> m a -> m b
infixr 1 =<<
-- | A String is a list of characters. String constants in Haskell
-- are values of type String.
--
-- See Data.List for operations on lists.
type String = [Char]
-- | A special case of error. It is expected that compilers will
-- recognize this and insert error messages which are more appropriate to
-- the context in which undefined appears.
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
-- | A variant of error that does not produce a stack trace.
errorWithoutStackTrace :: forall (r :: RuntimeRep) (a :: TYPE r). [Char] -> a
-- | error stops execution and displays an error message.
error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
-- | Boolean "and", lazy in the second argument
(&&) :: Bool -> Bool -> Bool
infixr 3 &&
-- | Boolean "or", lazy in the second argument
(||) :: Bool -> Bool -> Bool
infixr 2 ||
-- | Boolean "not"
not :: Bool -> Bool
-- | Attempt to convert an Integral type a to an
-- Integral type b using the size of the types as
-- measured by Bits methods.
--
-- A simpler version of this function is:
--
--
-- toIntegral :: (Integral a, Integral b) => a -> Maybe b
-- toIntegral x
-- | toInteger x == y = Just (fromInteger y)
-- | otherwise = Nothing
-- where
-- y = toInteger x
--
--
-- This version requires going through Integer, which can be
-- inefficient. However, toIntegralSized is optimized to allow
-- GHC to statically determine the relative type sizes (as measured by
-- bitSizeMaybe and isSigned) and avoid going through
-- Integer for many types. (The implementation uses
-- fromIntegral, which is itself optimized with rules for
-- base types but may go through Integer for some type
-- pairs.)
toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b
-- | Default implementation for popCount.
--
-- This implementation is intentionally naive. Instances are expected to
-- provide an optimized implementation for their size.
popCountDefault :: (Bits a, Num a) => a -> Int
-- | Default implementation for testBit.
--
-- Note that: testBitDefault x i = (x .&. bit i) /= 0
testBitDefault :: (Bits a, Num a) => a -> Int -> Bool
-- | Default implementation for bit.
--
-- Note that: bitDefault i = 1 shiftL i
bitDefault :: (Bits a, Num a) => Int -> a
-- | The Bits class defines bitwise operations over integral types.
--
--
-- - Bits are numbered from 0 with bit 0 being the least significant
-- bit.
--
class Eq a => Bits a
-- | Bitwise "and"
(.&.) :: Bits a => a -> a -> a
-- | Bitwise "or"
(.|.) :: Bits a => a -> a -> a
-- | Bitwise "xor"
xor :: Bits a => a -> a -> a
-- | Reverse all the bits in the argument
complement :: Bits a => a -> a
-- | shift x i shifts x left by i bits if
-- i is positive, or right by -i bits otherwise. Right
-- shifts perform sign extension on signed number types; i.e. they fill
-- the top bits with 1 if the x is negative and with 0
-- otherwise.
--
-- An instance can define either this unified shift or
-- shiftL and shiftR, depending on which is more convenient
-- for the type in question.
shift :: Bits a => a -> Int -> a
-- | rotate x i rotates x left by i bits
-- if i is positive, or right by -i bits otherwise.
--
-- For unbounded types like Integer, rotate is equivalent
-- to shift.
--
-- An instance can define either this unified rotate or
-- rotateL and rotateR, depending on which is more
-- convenient for the type in question.
rotate :: Bits a => a -> Int -> a
-- | zeroBits is the value with all bits unset.
--
-- The following laws ought to hold (for all valid bit indices
-- n):
--
--
--
-- This method uses clearBit (bit 0) 0 as its
-- default implementation (which ought to be equivalent to
-- zeroBits for types which possess a 0th bit).
zeroBits :: Bits a => a
-- | bit i is a value with the ith bit set
-- and all other bits clear.
--
-- Can be implemented using bitDefault if a is also an
-- instance of Num.
--
-- See also zeroBits.
bit :: Bits a => Int -> a
-- | x `setBit` i is the same as x .|. bit i
setBit :: Bits a => a -> Int -> a
-- | x `clearBit` i is the same as x .&. complement (bit
-- i)
clearBit :: Bits a => a -> Int -> a
-- | x `complementBit` i is the same as x `xor` bit i
complementBit :: Bits a => a -> Int -> a
-- | Return True if the nth bit of the argument is 1
--
-- Can be implemented using testBitDefault if a is also
-- an instance of Num.
testBit :: Bits a => a -> Int -> Bool
-- | Return the number of bits in the type of the argument. The actual
-- value of the argument is ignored. Returns Nothing for types that do
-- not have a fixed bitsize, like Integer.
bitSizeMaybe :: Bits a => a -> Maybe Int
-- | Return the number of bits in the type of the argument. The actual
-- value of the argument is ignored. The function bitSize is
-- undefined for types that do not have a fixed bitsize, like
-- Integer.
--
-- Default implementation based upon bitSizeMaybe provided since
-- 4.12.0.0.
bitSize :: Bits a => a -> Int
-- | Return True if the argument is a signed type. The actual value
-- of the argument is ignored
isSigned :: Bits a => a -> Bool
-- | Shift the argument left by the specified number of bits. The result is
-- undefined for negative shift amounts and shift amounts greater or
-- equal to the bitSize.
--
-- Defaults to shiftL unless defined explicitly by an instance.
unsafeShiftL :: Bits a => a -> Int -> a
-- | Shift the first argument right by the specified number of bits, which
-- must be non-negative and smaller than the number of bits in the type.
--
-- Right shifts perform sign extension on signed number types; i.e. they
-- fill the top bits with 1 if the x is negative and with 0
-- otherwise.
--
-- Defaults to shiftR unless defined explicitly by an instance.
unsafeShiftR :: Bits a => a -> Int -> a
-- | Rotate the argument left by the specified number of bits (which must
-- be non-negative).
--
-- An instance can define either this and rotateR or the unified
-- rotate, depending on which is more convenient for the type in
-- question.
rotateL :: Bits a => a -> Int -> a
-- | Rotate the argument right by the specified number of bits (which must
-- be non-negative).
--
-- An instance can define either this and rotateL or the unified
-- rotate, depending on which is more convenient for the type in
-- question.
rotateR :: Bits a => a -> Int -> a
-- | Return the number of set bits in the argument. This number is known as
-- the population count or the Hamming weight.
--
-- Can be implemented using popCountDefault if a is also
-- an instance of Num.
popCount :: Bits a => a -> Int
infixl 8 `rotateR`
infixl 8 `rotateL`
infixl 8 `rotate`
infixl 8 `shift`
infixl 6 `xor`
infixl 7 .&.
infixl 5 .|.
-- | The FiniteBits class denotes types with a finite, fixed number
-- of bits.
class Bits b => FiniteBits b
-- | Return the number of bits in the type of the argument. The actual
-- value of the argument is ignored. Moreover, finiteBitSize is
-- total, in contrast to the deprecated bitSize function it
-- replaces.
--
--
-- finiteBitSize = bitSize
-- bitSizeMaybe = Just . finiteBitSize
--
finiteBitSize :: FiniteBits b => b -> Int
-- | Count number of zero bits preceding the most significant set bit.
--
--
-- countLeadingZeros (zeroBits :: a) = finiteBitSize (zeroBits :: a)
--
--
-- countLeadingZeros can be used to compute log base 2 via
--
--
-- logBase2 x = finiteBitSize x - 1 - countLeadingZeros x
--
--
-- Note: The default implementation for this method is intentionally
-- naive. However, the instances provided for the primitive integral
-- types are implemented using CPU specific machine instructions.
countLeadingZeros :: FiniteBits b => b -> Int
-- | Count number of zero bits following the least significant set bit.
--
--
-- countTrailingZeros (zeroBits :: a) = finiteBitSize (zeroBits :: a)
-- countTrailingZeros . negate = countTrailingZeros
--
--
-- The related find-first-set operation can be expressed in terms
-- of countTrailingZeros as follows
--
--
-- findFirstSet x = 1 + countTrailingZeros x
--
--
-- Note: The default implementation for this method is intentionally
-- naive. However, the instances provided for the primitive integral
-- types are implemented using CPU specific machine instructions.
countTrailingZeros :: FiniteBits b => b -> Int
shiftL :: Bits a => a -> Int -> a
shiftR :: Bits a => a -> Int -> a
module GHC.Data.Strict
data Maybe a
Nothing :: Maybe a
Just :: !a -> Maybe a
fromMaybe :: a -> Maybe a -> a
data Pair a b
And :: !a -> !b -> Pair a b
instance Data.Data.Data a => Data.Data.Data (GHC.Data.Strict.Maybe a)
instance Data.Traversable.Traversable GHC.Data.Strict.Maybe
instance Data.Foldable.Foldable GHC.Data.Strict.Maybe
instance GHC.Base.Functor GHC.Data.Strict.Maybe
instance GHC.Show.Show a => GHC.Show.Show (GHC.Data.Strict.Maybe a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (GHC.Data.Strict.Maybe a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (GHC.Data.Strict.Maybe a)
instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (GHC.Data.Strict.Pair a b)
instance Data.Traversable.Traversable (GHC.Data.Strict.Pair a)
instance Data.Foldable.Foldable (GHC.Data.Strict.Pair a)
instance GHC.Base.Functor (GHC.Data.Strict.Pair a)
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (GHC.Data.Strict.Pair a b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (GHC.Data.Strict.Pair a b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (GHC.Data.Strict.Pair a b)
instance GHC.Base.Semigroup a => GHC.Base.Semigroup (GHC.Data.Strict.Maybe a)
instance GHC.Base.Semigroup a => GHC.Base.Monoid (GHC.Data.Strict.Maybe a)
instance GHC.Base.Applicative GHC.Data.Strict.Maybe
instance GHC.Base.Alternative GHC.Data.Strict.Maybe
-- | Monadic streams
module GHC.Data.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 runStreamInternal in the Monad m, and it
-- delivers either
--
--
-- - the final result: Done b, or
-- - Yield a str where a is the next element in the
-- stream, and str is the rest of the stream
-- - Effect mstr where mstr is some action running in
-- m which generates 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.
--
-- Stream is implemented in the "yoneda" style for efficiency. By
-- representing a stream in this manner fmap and >>=
-- operations are accumulated in the function parameters before being
-- applied once when the stream is destroyed. In the old implementation
-- each usage of mapM and >>= would traverse the
-- entire stream in order to apply the substitution at the leaves.
--
-- The >>= operation for Stream was a hot-spot in the ticky
-- profile for the ManyConstructors test which called the
-- cg function many times in StgToCmm.hs
newtype Stream m a b
Stream :: (forall r' r. (a -> m r') -> (b -> StreamS m r' r) -> StreamS m r' r) -> Stream m a b
[runStreamInternal] :: Stream m a b -> forall r' r. (a -> m r') -> (b -> StreamS m r' r) -> StreamS m r' r
data StreamS m a b
Yield :: a -> StreamS m a b -> StreamS m a b
Done :: b -> StreamS m a b
Effect :: m (StreamS m a b) -> StreamS m a b
runStream :: Applicative m => Stream m r' r -> StreamS m r' r
yield :: Monad m => a -> Stream m a ()
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => IO a -> m a
-- | Turn a Stream into an ordinary list, by demanding all the elements.
collect :: Monad m => Stream m a () -> m [a]
consume :: (Monad m, Monad n) => Stream m a b -> (forall a. m a -> n a) -> (a -> n ()) -> n b
-- | 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
-- | Note this is not very efficient because it traverses the whole stream
-- before rebuilding it, avoid using it if you can. mapAccumL used to
-- implemented but it wasn't used anywhere in the compiler and has
-- similar effiency problems.
mapAccumL_ :: forall m a b c r. Monad m => (c -> a -> m (c, b)) -> c -> Stream m a r -> Stream m b (c, r)
instance GHC.Base.Functor (GHC.Data.Stream.Stream f a)
instance GHC.Base.Applicative (GHC.Data.Stream.Stream m a)
instance GHC.Base.Monad (GHC.Data.Stream.Stream m a)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (GHC.Data.Stream.Stream m b)
instance GHC.Base.Monad m => GHC.Base.Functor (GHC.Data.Stream.StreamS m a)
instance GHC.Base.Monad m => GHC.Base.Applicative (GHC.Data.Stream.StreamS m a)
instance GHC.Base.Monad m => GHC.Base.Monad (GHC.Data.Stream.StreamS m a)
-- | Small-array
module GHC.Data.SmallArray
data SmallMutableArray s a
SmallMutableArray :: SmallMutableArray# s a -> SmallMutableArray s a
data SmallArray a
SmallArray :: SmallArray# a -> SmallArray a
newSmallArray :: Int -> a -> State# s -> (# State# s, SmallMutableArray s a #)
writeSmallArray :: SmallMutableArray s a -> Int -> a -> State# s -> State# s
-- | Copy and freeze a slice of a mutable array.
freezeSmallArray :: SmallMutableArray s a -> Int -> Int -> State# s -> (# State# s, SmallArray a #)
-- | Freeze a mutable array (no copy!)
unsafeFreezeSmallArray :: SmallMutableArray s a -> State# s -> (# State# s, SmallArray a #)
-- | Index a small-array (no bounds checking!)
indexSmallArray :: SmallArray a -> Int -> a
-- | Convert a list into an array.
listToArray :: Int -> (e -> Int) -> (e -> a) -> [e] -> SmallArray a
module GHC.Data.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
module GHC.Data.FastMutInt
data FastMutInt
newFastMutInt :: Int -> IO FastMutInt
readFastMutInt :: FastMutInt -> IO Int
writeFastMutInt :: FastMutInt -> Int -> IO ()
atomicFetchAddFastMut :: FastMutInt -> Int -> IO Int
module GHC.Data.Bool
data OverridingBool
Auto :: OverridingBool
Never :: OverridingBool
Always :: OverridingBool
overrideWith :: Bool -> OverridingBool -> Bool
instance GHC.Enum.Bounded GHC.Data.Bool.OverridingBool
instance GHC.Enum.Enum GHC.Data.Bool.OverridingBool
instance GHC.Classes.Ord GHC.Data.Bool.OverridingBool
instance GHC.Classes.Eq GHC.Data.Bool.OverridingBool
instance GHC.Read.Read GHC.Data.Bool.OverridingBool
instance GHC.Show.Show GHC.Data.Bool.OverridingBool
module GHC.Cmm.Dataflow.Collections
class IsSet set where {
type family ElemOf set;
}
setNull :: IsSet set => set -> Bool
setSize :: IsSet set => set -> Int
setMember :: IsSet set => ElemOf set -> set -> Bool
setEmpty :: IsSet set => set
setSingleton :: IsSet set => ElemOf set -> set
setInsert :: IsSet set => ElemOf set -> set -> set
setDelete :: IsSet set => ElemOf set -> set -> set
setUnion :: IsSet set => set -> set -> set
setDifference :: IsSet set => set -> set -> set
setIntersection :: IsSet set => set -> set -> set
setIsSubsetOf :: IsSet set => set -> set -> Bool
setFilter :: IsSet set => (ElemOf set -> Bool) -> set -> set
setFoldl :: IsSet set => (b -> ElemOf set -> b) -> b -> set -> b
setFoldr :: IsSet set => (ElemOf set -> b -> b) -> b -> set -> b
setElems :: IsSet set => set -> [ElemOf set]
setFromList :: IsSet set => [ElemOf set] -> set
setInsertList :: IsSet set => [ElemOf set] -> set -> set
setDeleteList :: IsSet set => [ElemOf set] -> set -> set
setUnions :: IsSet set => [set] -> set
class IsMap map where {
type family KeyOf map;
}
mapNull :: IsMap map => map a -> Bool
mapSize :: IsMap map => map a -> Int
mapMember :: IsMap map => KeyOf map -> map a -> Bool
mapLookup :: IsMap map => KeyOf map -> map a -> Maybe a
mapFindWithDefault :: IsMap map => a -> KeyOf map -> map a -> a
mapEmpty :: IsMap map => map a
mapSingleton :: IsMap map => KeyOf map -> a -> map a
mapInsert :: IsMap map => KeyOf map -> a -> map a -> map a
mapInsertWith :: IsMap map => (a -> a -> a) -> KeyOf map -> a -> map a -> map a
mapDelete :: IsMap map => KeyOf map -> map a -> map a
mapAlter :: IsMap map => (Maybe a -> Maybe a) -> KeyOf map -> map a -> map a
mapAdjust :: IsMap map => (a -> a) -> KeyOf map -> map a -> map a
mapUnion :: IsMap map => map a -> map a -> map a
mapUnionWithKey :: IsMap map => (KeyOf map -> a -> a -> a) -> map a -> map a -> map a
mapDifference :: IsMap map => map a -> map a -> map a
mapIntersection :: IsMap map => map a -> map a -> map a
mapIsSubmapOf :: (IsMap map, Eq a) => map a -> map a -> Bool
mapMap :: IsMap map => (a -> b) -> map a -> map b
mapMapWithKey :: IsMap map => (KeyOf map -> a -> b) -> map a -> map b
mapFoldl :: IsMap map => (b -> a -> b) -> b -> map a -> b
mapFoldr :: IsMap map => (a -> b -> b) -> b -> map a -> b
mapFoldlWithKey :: IsMap map => (b -> KeyOf map -> a -> b) -> b -> map a -> b
mapFoldMapWithKey :: (IsMap map, Monoid m) => (KeyOf map -> a -> m) -> map a -> m
mapFilter :: IsMap map => (a -> Bool) -> map a -> map a
mapFilterWithKey :: IsMap map => (KeyOf map -> a -> Bool) -> map a -> map a
mapElems :: IsMap map => map a -> [a]
mapKeys :: IsMap map => map a -> [KeyOf map]
mapToList :: IsMap map => map a -> [(KeyOf map, a)]
mapFromList :: IsMap map => [(KeyOf map, a)] -> map a
mapFromListWith :: IsMap map => (a -> a -> a) -> [(KeyOf map, a)] -> map a
mapInsertList :: IsMap map => [(KeyOf map, a)] -> map a -> map a
mapDeleteList :: IsMap map => [KeyOf map] -> map a -> map a
mapUnions :: IsMap map => [map a] -> map a
data UniqueMap v
data UniqueSet
instance GHC.Base.Monoid GHC.Cmm.Dataflow.Collections.UniqueSet
instance GHC.Base.Semigroup GHC.Cmm.Dataflow.Collections.UniqueSet
instance GHC.Show.Show GHC.Cmm.Dataflow.Collections.UniqueSet
instance GHC.Classes.Ord GHC.Cmm.Dataflow.Collections.UniqueSet
instance GHC.Classes.Eq GHC.Cmm.Dataflow.Collections.UniqueSet
instance Data.Traversable.Traversable GHC.Cmm.Dataflow.Collections.UniqueMap
instance Data.Foldable.Foldable GHC.Cmm.Dataflow.Collections.UniqueMap
instance GHC.Base.Functor GHC.Cmm.Dataflow.Collections.UniqueMap
instance GHC.Show.Show v => GHC.Show.Show (GHC.Cmm.Dataflow.Collections.UniqueMap v)
instance GHC.Classes.Ord v => GHC.Classes.Ord (GHC.Cmm.Dataflow.Collections.UniqueMap v)
instance GHC.Classes.Eq v => GHC.Classes.Eq (GHC.Cmm.Dataflow.Collections.UniqueMap v)
instance GHC.Cmm.Dataflow.Collections.IsMap GHC.Cmm.Dataflow.Collections.UniqueMap
instance GHC.Cmm.Dataflow.Collections.IsSet GHC.Cmm.Dataflow.Collections.UniqueSet
module GHC.Cmm.Dataflow.Block
-- | Used at the type level to indicate "open" vs "closed" structure.
data Extensibility
-- | An "open" structure with a unique, unnamed control-flow edge flowing
-- in or out. "Fallthrough" and concatenation are permitted at an open
-- point.
Open :: Extensibility
-- | 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.
Closed :: Extensibility
type O = 'Open
type C = 'Closed
-- | Maybe type indexed by open/closed
data MaybeO ex t
[JustO] :: t -> MaybeO O t
[NothingO] :: MaybeO C t
-- | Either type indexed by closed/open using type families
type family IndexedCO (ex :: Extensibility) (a :: k) (b :: k) :: k
-- | 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
[BlockCO] :: n C O -> Block n O O -> Block n C O
[BlockCC] :: n C O -> Block n O O -> n O C -> Block n C C
[BlockOC] :: Block n O O -> n O C -> Block n O C
[BNil] :: Block n O O
[BMiddle] :: n O O -> Block n O O
[BCat] :: Block n O O -> Block n O O -> Block n O O
[BSnoc] :: Block n O O -> n O O -> Block n O O
[BCons] :: n O O -> Block n O O -> Block n O O
blockAppend :: Block n e O -> Block n O x -> Block n e x
blockCons :: n O O -> Block n O x -> Block n O x
blockFromList :: [n O O] -> Block n O O
blockJoin :: n C O -> Block n O O -> n O C -> Block n C C
blockJoinHead :: n C O -> Block n O x -> Block n C x
blockJoinTail :: Block n e O -> n O C -> Block n e C
blockSnoc :: Block n e O -> n O O -> Block n e O
-- | Split a closed block into its entry node, open middle block, and exit
-- node.
blockSplit :: Block n C C -> (n C O, Block n O O, n O C)
blockSplitHead :: Block n C x -> (n C O, Block n O x)
blockSplitTail :: Block n e C -> (Block n e O, n O C)
blockToList :: Block n O O -> [n O O]
emptyBlock :: Block n O O
firstNode :: Block n C x -> n C O
foldBlockNodesB :: forall n a. (forall e x. n e x -> a -> a) -> forall e x. Block n e x -> IndexedCO x a a -> IndexedCO e a a
foldBlockNodesB3 :: forall n a b c. (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> forall e x. Block n e x -> IndexedCO x a b -> IndexedCO e c b
foldBlockNodesF :: forall n a. (forall e x. n e x -> a -> a) -> forall e x. Block n e x -> IndexedCO e a a -> IndexedCO x a a
isEmptyBlock :: Block n e x -> Bool
lastNode :: Block n x C -> n O C
-- | map a function over the nodes of a Block
mapBlock :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x
-- | A strict mapBlock
mapBlock' :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x
-- | map over a block, with different functions to apply to first nodes,
-- middle nodes and last nodes respectively. The map is strict.
mapBlock3' :: forall n n' e x. (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x
replaceFirstNode :: Block n C x -> n C O -> Block n C x
replaceLastNode :: Block n x C -> n O C -> Block n x C
instance GHC.Base.Functor (GHC.Cmm.Dataflow.Block.MaybeO ex)
module GHC.Serialized
-- | Represents a serialized value of a particular type. Attempts can be
-- made to deserialize it at certain types
data Serialized
Serialized :: TypeRep -> [Word8] -> Serialized
-- | Put a Typeable value that we are able to actually turn into bytes into
-- a Serialized value ready for deserialization later
toSerialized :: forall a. Typeable a => (a -> [Word8]) -> a -> Serialized
-- | If the Serialized value contains something of the given type,
-- then use the specified deserializer to return Just that.
-- Otherwise return Nothing.
fromSerialized :: forall a. Typeable a => ([Word8] -> a) -> Serialized -> Maybe a
-- | Use a Data instance to implement a serialization scheme dual to
-- that of deserializeWithData
serializeWithData :: Data a => a -> [Word8]
-- | Use a Data instance to implement a deserialization scheme dual
-- to that of serializeWithData
deserializeWithData :: Data a => [Word8] -> a
module GHC.SysTools.Terminal
-- | Does the controlling terminal support ANSI color sequences? This
-- memoized to avoid thread-safety issues in ncurses (see #17922).
stderrSupportsAnsiColors :: Bool
-- | Haskell Program Coverage (HPC) support
module GHC.Types.HpcInfo
-- | 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
-- | 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
emptyHpcInfo :: AnyHpcUsage -> HpcInfo
-- | Find out if HPC is used by this module or any of the modules it
-- depends upon
isHpcUsed :: HpcInfo -> AnyHpcUsage
module GHC.Utils.CliOption
-- | 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
instance GHC.Classes.Eq GHC.Utils.CliOption.Option
module GHC.Utils.Constants
debugIsOn :: Bool
ghciSupported :: Bool
isWindowsHost :: Bool
isDarwinHost :: Bool
module GHC.Utils.Encoding
utf8DecodeCharAddr# :: Addr# -> Int# -> (# Char#, Int# #)
utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)
utf8CharStart :: Ptr Word8 -> IO (Ptr Word8)
utf8DecodeChar :: Ptr Word8 -> (Char, Int)
utf8DecodeByteString :: ByteString -> [Char]
utf8UnconsByteString :: ByteString -> Maybe (Char, ByteString)
utf8DecodeShortByteString :: ShortByteString -> [Char]
utf8CompareShortByteString :: ShortByteString -> ShortByteString -> Ordering
utf8DecodeStringLazy :: ForeignPtr Word8 -> Int -> Int -> [Char]
utf8EncodeChar :: (Int# -> Word8# -> State# s -> State# s) -> Char -> ST s Int
utf8EncodeString :: String -> ByteString
utf8EncodeStringPtr :: Ptr Word8 -> String -> IO ()
utf8EncodeShortByteString :: String -> IO ShortByteString
utf8EncodedLength :: String -> Int
countUTF8Chars :: ShortByteString -> IO Int
zEncodeString :: UserString -> EncodedString
zDecodeString :: EncodedString -> UserString
toBase62 :: Word64 -> String
-- | Converts a 64-bit word into a base-62 string
toBase62Padded :: Word64 -> String
-- | An Unicode string for internal GHC use. Meant to replace String in
-- places where being a lazy linked is not very useful and a more memory
-- efficient data structure is desirable.
module GHC.Data.ShortText
-- | A ShortText is a modified UTF-8 encoded string meant for short
-- strings like file paths, module descriptions, etc.
newtype ShortText
ShortText :: ShortByteString -> ShortText
[contents] :: ShortText -> ShortByteString
-- | O(n) Convert a String into a ShortText.
pack :: String -> ShortText
-- | O(n) Convert a ShortText into a String.
unpack :: ShortText -> String
-- | O(n) Returns the length of the ShortText in characters.
codepointLength :: ShortText -> Int
-- | O(1) Returns the length of the ShortText in bytes.
byteLength :: ShortText -> Int
-- | O(1) Test whether the ShortText is the empty string.
null :: ShortText -> Bool
-- | O(n) Split a ShortText representing a file path into its
-- components by separating on the file separator characters for this
-- platform.
splitFilePath :: ShortText -> [ShortText]
-- | O(1) Returns the first UTF-8 codepoint in the ShortText.
-- Depending on the string in question, this may or may not be the actual
-- first character in the string due to Unicode non-printable characters.
head :: ShortText -> Char
-- | O(n) The stripPrefix function takes two
-- ShortTexts and returns Just the remainder of the second
-- iff the first is its prefix, and otherwise Nothing.
stripPrefix :: ShortText -> ShortText -> Maybe ShortText
instance Control.DeepSeq.NFData GHC.Data.ShortText.ShortText
instance GHC.Base.Monoid GHC.Data.ShortText.ShortText
instance GHC.Base.Semigroup GHC.Data.ShortText.ShortText
instance Data.Binary.Class.Binary GHC.Data.ShortText.ShortText
instance GHC.Classes.Ord GHC.Data.ShortText.ShortText
instance GHC.Classes.Eq GHC.Data.ShortText.ShortText
instance GHC.Show.Show GHC.Data.ShortText.ShortText
instance Data.String.IsString GHC.Data.ShortText.ShortText
-- | This module provides the view of GHC's database of registered packages
-- that is shared between GHC the compiler/library, and the ghc-pkg
-- program. It defines the database format that is shared between GHC and
-- ghc-pkg.
--
-- The database format, and this library are constructed so that GHC does
-- not have to depend on the Cabal library. The ghc-pkg program acts as
-- the gateway between the external package format (which is defined by
-- Cabal) and the internal package format which is specialised just for
-- GHC.
--
-- GHC the compiler only needs some of the information which is kept
-- about registered packages, such as module names, various paths etc. On
-- the other hand ghc-pkg has to keep all the information from Cabal
-- packages and be able to regurgitate it for users and other tools.
--
-- The first trick is that we duplicate some of the information in the
-- package database. We essentially keep two versions of the database in
-- one file, one version used only by ghc-pkg which keeps the full
-- information (using the serialised form of the
-- InstalledPackageInfo type defined by the Cabal library); and
-- a second version written by ghc-pkg and read by GHC which has just the
-- subset of information that GHC needs.
--
-- The second trick is that this module only defines in detail the format
-- of the second version -- the bit GHC uses -- and the part managed by
-- ghc-pkg is kept in the file but here we treat it as an opaque blob of
-- data. That way this library avoids depending on Cabal.
module GHC.Unit.Database
-- | Information about an unit (a unit is an installed module library).
--
-- This is a subset of Cabal's InstalledPackageInfo, with just
-- the bits that GHC is interested in.
--
-- Some types are left as parameters to be instantiated differently in
-- ghc-pkg and in ghc itself.
data GenericUnitInfo srcpkgid srcpkgname uid modulename mod
GenericUnitInfo :: uid -> uid -> [(modulename, mod)] -> srcpkgid -> srcpkgname -> Version -> Maybe srcpkgname -> ShortText -> [uid] -> [(uid, ShortText)] -> [FilePathST] -> [ShortText] -> [ShortText] -> [ShortText] -> [FilePathST] -> [FilePathST] -> [ShortText] -> [FilePathST] -> [ShortText] -> [ShortText] -> [ShortText] -> [FilePathST] -> [FilePathST] -> [FilePathST] -> [(modulename, Maybe mod)] -> [modulename] -> Bool -> Bool -> Bool -> GenericUnitInfo srcpkgid srcpkgname uid modulename mod
-- | Unique unit identifier that is used during compilation (e.g. to
-- generate symbols).
[unitId] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> uid
-- | Identifier of an indefinite unit (i.e. with module holes) that this
-- unit is an instance of.
--
-- For non instantiated units, unitInstanceOf=unitId
[unitInstanceOf] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> uid
-- | How this unit instantiates some of its module holes. Map hole module
-- names to actual module
[unitInstantiations] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(modulename, mod)]
-- | Source package identifier.
--
-- Cabal instantiates this with Distribution.Types.PackageId.PackageId
-- type which only contains the source package name and version. Notice
-- that it doesn't contain the Hackage revision, nor any kind of hash.
[unitPackageId] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> srcpkgid
-- | Source package name
[unitPackageName] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> srcpkgname
-- | Source package version
[unitPackageVersion] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Version
-- | Name of the component.
--
-- Cabal supports more than one components (libraries, executables,
-- testsuites) in the same package. Each component has a name except the
-- default one (that can only be a library component) for which we use
-- Nothing.
--
-- GHC only deals with "library" components as they are the only kind of
-- components that can be registered in a database and used by other
-- modules.
[unitComponentName] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Maybe srcpkgname
-- | ABI hash used to avoid mixing up units compiled with different
-- dependencies, compiler, options, etc.
[unitAbiHash] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> ShortText
-- | Identifiers of the units this one depends on
[unitDepends] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [uid]
-- | Like unitDepends, but each dependency is annotated with the ABI
-- hash we expect the dependency to respect.
[unitAbiDepends] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(uid, ShortText)]
-- | Directories containing module interfaces
[unitImportDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Names of the Haskell libraries provided by this unit
[unitLibraries] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Names of the external system libraries that this unit depends on. See
-- also unitExtDepLibsGhc field.
[unitExtDepLibsSys] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Because of slight differences between the GHC dynamic linker (in
-- GHC.Runtime.Linker) and the native system linker, some packages have
-- to link with a different list of libraries when using GHC's. Examples
-- include: libs that are actually gnu ld scripts, and the possibility
-- that the .a libs do not exactly match the .so/.dll equivalents.
--
-- If this field is set, then we use that instead of the
-- unitExtDepLibsSys field.
[unitExtDepLibsGhc] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Directories containing libraries provided by this unit. See also
-- unitLibraryDynDirs.
--
-- It seems to be used to store paths to external library dependencies
-- too.
[unitLibraryDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Directories containing the dynamic libraries provided by this unit.
-- See also unitLibraryDirs.
--
-- It seems to be used to store paths to external dynamic library
-- dependencies too.
[unitLibraryDynDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Names of the external MacOS frameworks that this unit depends on.
[unitExtDepFrameworks] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Directories containing MacOS frameworks that this unit depends on.
[unitExtDepFrameworkDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Linker (e.g. ld) command line options
[unitLinkerOptions] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | C compiler options that needs to be passed to the C compiler when we
-- compile some C code against this unit.
[unitCcOptions] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | C header files that are required by this unit (provided by this unit
-- or external)
[unitIncludes] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Directories containing C header files that this unit depends on.
[unitIncludeDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Paths to Haddock interface files for this unit
[unitHaddockInterfaces] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Paths to Haddock directories containing HTML files
[unitHaddockHTMLs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Modules exposed by the unit.
--
-- A module can be re-exported from another package. In this case, we
-- indicate the module origin in the second parameter.
[unitExposedModules] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(modulename, Maybe mod)]
-- | Hidden modules.
--
-- These are useful for error reporting (e.g. if a hidden module is
-- imported)
[unitHiddenModules] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [modulename]
-- | True if this unit has some module holes that need to be instantiated
-- with real modules to make the unit usable (a.k.a. Backpack).
[unitIsIndefinite] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool
-- | True if the unit is exposed. A unit could be installed in a database
-- by "disabled" by not being exposed.
[unitIsExposed] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool
-- | True if the unit is trusted (cf Safe Haskell)
[unitIsTrusted] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool
-- | ghc-boot's UnitInfo, serialized to the database.
type DbUnitInfo = GenericUnitInfo ByteString ByteString ByteString ByteString DbModule
-- | ghc-boot's Module, serialized to the database.
data DbModule
DbModule :: DbInstUnitId -> ByteString -> DbModule
[dbModuleUnitId] :: DbModule -> DbInstUnitId
[dbModuleName] :: DbModule -> ByteString
DbModuleVar :: ByteString -> DbModule
[dbModuleVarName] :: DbModule -> ByteString
-- | ghc-boot's instantiated unit id, serialized to the database.
data DbInstUnitId
-- | Instantiated unit
DbInstUnitId :: ByteString -> [(ByteString, DbModule)] -> DbInstUnitId
-- | Uninstantiated unit
DbUnitId :: ByteString -> DbInstUnitId
-- | Convert between GenericUnitInfo instances
mapGenericUnitInfo :: (uid1 -> uid2) -> (srcpkg1 -> srcpkg2) -> (srcpkgname1 -> srcpkgname2) -> (modname1 -> modname2) -> (mod1 -> mod2) -> GenericUnitInfo srcpkg1 srcpkgname1 uid1 modname1 mod1 -> GenericUnitInfo srcpkg2 srcpkgname2 uid2 modname2 mod2
-- | Mode to open a package db in.
data DbMode
DbReadOnly :: DbMode
DbReadWrite :: DbMode
-- | DbOpenMode holds a value of type t but only in
-- DbReadWrite mode. So it is like Maybe but with a type
-- argument for the mode to enforce that the mode is used consistently.
data DbOpenMode (mode :: DbMode) t
[DbOpenReadOnly] :: DbOpenMode 'DbReadOnly t
[DbOpenReadWrite] :: t -> DbOpenMode 'DbReadWrite t
isDbOpenReadMode :: DbOpenMode mode t -> Bool
-- | Read the part of the package DB that GHC is interested in.
readPackageDbForGhc :: FilePath -> IO [DbUnitInfo]
-- | Read the part of the package DB that ghc-pkg is interested in
--
-- Note that the Binary instance for ghc-pkg's representation of packages
-- is not defined in this package. This is because ghc-pkg uses Cabal
-- types (and Binary instances for these) which this package does not
-- depend on.
--
-- If we open the package db in read only mode, we get its contents.
-- Otherwise we additionally receive a PackageDbLock that represents a
-- lock on the database, so that we can safely update it later.
readPackageDbForGhcPkg :: Binary pkgs => FilePath -> DbOpenMode mode t -> IO (pkgs, DbOpenMode mode PackageDbLock)
-- | Write the whole of the package DB, both parts.
writePackageDb :: Binary pkgs => FilePath -> [DbUnitInfo] -> pkgs -> IO ()
-- | Represents a lock of a package db.
data PackageDbLock
-- | Acquire an exclusive lock related to package DB under given location.
lockPackageDb :: FilePath -> IO PackageDbLock
-- | Release the lock related to package DB.
unlockPackageDb :: PackageDbLock -> IO ()
mkMungePathUrl :: FilePathST -> FilePathST -> (FilePathST -> FilePathST, FilePathST -> FilePathST)
-- | Perform path/URL variable substitution as per the Cabal ${pkgroot}
-- spec
-- (http:/www.haskell.orgpipermaillibraries2009-May/011772.html)
-- Paths/URLs can be relative to ${pkgroot} or ${pkgrooturl}. The
-- "pkgroot" is the directory containing the package database.
--
-- Also perform a similar substitution for the older GHC-specific
-- "$topdir" variable. The "topdir" is the location of the ghc
-- installation (obtained from the -B option).
mungeUnitInfoPaths :: FilePathST -> FilePathST -> GenericUnitInfo a b c d e -> GenericUnitInfo a b c d e
instance (GHC.Show.Show uid, GHC.Show.Show modulename, GHC.Show.Show mod, GHC.Show.Show srcpkgid, GHC.Show.Show srcpkgname) => GHC.Show.Show (GHC.Unit.Database.GenericUnitInfo srcpkgid srcpkgname uid modulename mod)
instance (GHC.Classes.Eq uid, GHC.Classes.Eq modulename, GHC.Classes.Eq mod, GHC.Classes.Eq srcpkgid, GHC.Classes.Eq srcpkgname) => GHC.Classes.Eq (GHC.Unit.Database.GenericUnitInfo srcpkgid srcpkgname uid modulename mod)
instance GHC.Show.Show GHC.Unit.Database.DbModule
instance GHC.Classes.Eq GHC.Unit.Database.DbModule
instance GHC.Show.Show GHC.Unit.Database.DbInstUnitId
instance GHC.Classes.Eq GHC.Unit.Database.DbInstUnitId
instance GHC.Base.Functor (GHC.Unit.Database.DbOpenMode mode)
instance Data.Foldable.Foldable (GHC.Unit.Database.DbOpenMode mode)
instance Data.Traversable.Traversable (GHC.Unit.Database.DbOpenMode mode)
instance Data.Binary.Class.Binary GHC.Unit.Database.DbUnitInfo
instance Data.Binary.Class.Binary GHC.Unit.Database.DbModule
instance Data.Binary.Class.Binary GHC.Unit.Database.DbInstUnitId
module GHC.Utils.Exception
-- | When invoked inside mask, this function allows a masked
-- asynchronous exception to be raised, if one exists. It is equivalent
-- to performing an interruptible operation (see #interruptible), but
-- does not involve any actual blocking.
--
-- When called outside mask, or inside uninterruptibleMask,
-- this function has no effect.
allowInterrupt :: IO ()
-- | Sometimes you want to catch two different sorts of exception. You
-- could do something like
--
--
-- f = expr `catch` \ (ex :: ArithException) -> handleArith ex
-- `catch` \ (ex :: IOException) -> handleIO ex
--
--
-- However, there are a couple of problems with this approach. The first
-- is that having two exception handlers is inefficient. However, the
-- more serious issue is that the second exception handler will catch
-- exceptions in the first, e.g. in the example above, if
-- handleArith throws an IOException then the second
-- exception handler will catch it.
--
-- Instead, we provide a function catches, which would be used
-- thus:
--
--
-- f = expr `catches` [Handler (\ (ex :: ArithException) -> handleArith ex),
-- Handler (\ (ex :: IOException) -> handleIO ex)]
--
catches :: IO a -> [Handler a] -> IO a
-- | You need this when using catches.
data Handler a
Handler :: (e -> IO a) -> Handler a
-- | Like bracket, but only performs the final action if there was
-- an exception raised by the in-between computation.
bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
-- | A variant of bracket where the return value from the first
-- computation is not required.
bracket_ :: IO a -> IO b -> IO c -> IO c
-- | A specialised variant of bracket with just a computation to run
-- afterward.
finally :: IO a -> IO b -> IO a
-- | When you want to acquire a resource, do some work with it, and then
-- release the resource, it is a good idea to use bracket, because
-- bracket will install the necessary exception handler to release
-- the resource in the event that an exception is raised during the
-- computation. If an exception is raised, then bracket will
-- re-raise the exception (after performing the release).
--
-- A common example is opening a file:
--
--
-- bracket
-- (openFile "filename" ReadMode)
-- (hClose)
-- (\fileHandle -> do { ... })
--
--
-- The arguments to bracket are in this order so that we can
-- partially apply it, e.g.:
--
--
-- withFile name mode = bracket (openFile name mode) hClose
--
bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
-- | Like finally, but only performs the final action if there was
-- an exception raised by the computation.
onException :: IO a -> IO b -> IO a
-- | A variant of try that takes an exception predicate to select
-- which exceptions are caught (c.f. catchJust). If the exception
-- does not match the predicate, it is re-thrown.
tryJust :: Exception e => (e -> Maybe b) -> IO a -> IO (Either b a)
-- | 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)
-- | This function maps one exception into another as proposed in the paper
-- "A semantics for imprecise exceptions".
mapException :: (Exception e1, Exception e2) => (e1 -> e2) -> a -> a
-- | A version of catchJust with the arguments swapped around (see
-- handle).
handleJust :: Exception e => (e -> Maybe b) -> (b -> IO a) -> IO a -> IO a
-- | A version of catch with the arguments swapped around; useful in
-- situations where the code for the handler is shorter. For example:
--
--
-- do handle (\NonTermination -> exitWith (ExitFailure 1)) $
-- ...
--
handle :: Exception e => (e -> IO a) -> IO a -> IO a
-- | The function catchJust is like catch, but it takes an
-- extra argument which is an exception predicate, a function
-- which selects which type of exceptions we're interested in.
--
--
-- catchJust (\e -> if isDoesNotExistErrorType (ioeGetErrorType e) then Just () else Nothing)
-- (readFile f)
-- (\_ -> do hPutStrLn stderr ("No such file: " ++ show f)
-- return "")
--
--
-- Any other exceptions which are not matched by the predicate are
-- re-raised, and may be caught by an enclosing catch,
-- catchJust, etc.
catchJust :: Exception e => (e -> Maybe b) -> IO a -> (b -> IO a) -> IO a
-- | A pattern match failed. The String gives information about
-- the source location of the pattern.
newtype PatternMatchFail
PatternMatchFail :: String -> PatternMatchFail
-- | A record selector was applied to a constructor without the appropriate
-- field. This can only happen with a datatype with multiple
-- constructors, where some fields are in one constructor but not
-- another. The String gives information about the source
-- location of the record selector.
newtype RecSelError
RecSelError :: String -> RecSelError
-- | An uninitialised record field was used. The String gives
-- information about the source location where the record was
-- constructed.
newtype RecConError
RecConError :: String -> RecConError
-- | A record update was performed on a constructor without the appropriate
-- field. This can only happen with a datatype with multiple
-- constructors, where some fields are in one constructor but not
-- another. The String gives information about the source
-- location of the record update.
newtype RecUpdError
RecUpdError :: String -> RecUpdError
-- | A class method without a definition (neither a default definition, nor
-- a definition in the appropriate instance) was called. The
-- String gives information about which method it was.
newtype NoMethodError
NoMethodError :: String -> NoMethodError
-- | An expression that didn't typecheck during compile time was called.
-- This is only possible with -fdefer-type-errors. The String
-- gives details about the failed type check.
newtype TypeError
TypeError :: String -> TypeError
-- | Thrown when the runtime system detects that the computation is
-- guaranteed not to terminate. Note that there is no guarantee that the
-- runtime system will notice whether any given computation is guaranteed
-- to terminate or not.
data NonTermination
NonTermination :: NonTermination
-- | Thrown when the program attempts to call atomically, from the
-- stm package, inside another call to atomically.
data NestedAtomically
NestedAtomically :: NestedAtomically
-- | 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 ()
-- | Raise an IOError in the IO monad.
ioError :: IOError -> IO a
asyncExceptionFromException :: Exception e => SomeException -> Maybe e
asyncExceptionToException :: Exception e => e -> SomeException
-- | The thread is blocked on an MVar, but there are no other
-- references to the MVar so it can't ever continue.
data BlockedIndefinitelyOnMVar
BlockedIndefinitelyOnMVar :: BlockedIndefinitelyOnMVar
-- | The thread is waiting to retry an STM transaction, but there are no
-- other references to any TVars involved, so it can't ever
-- continue.
data BlockedIndefinitelyOnSTM
BlockedIndefinitelyOnSTM :: BlockedIndefinitelyOnSTM
-- | There are no runnable threads, so the program is deadlocked. The
-- Deadlock exception is raised in the main thread only.
data Deadlock
Deadlock :: Deadlock
-- | This thread has exceeded its allocation limit. See
-- setAllocationCounter and enableAllocationLimit.
data AllocationLimitExceeded
AllocationLimitExceeded :: AllocationLimitExceeded
-- | Compaction found an object that cannot be compacted. Functions cannot
-- be compacted, nor can mutable objects or pinned objects. See
-- compact.
newtype CompactionFailed
CompactionFailed :: String -> CompactionFailed
-- | assert was applied to False.
newtype AssertionFailed
AssertionFailed :: String -> AssertionFailed
-- | Superclass for asynchronous exceptions.
data SomeAsyncException
SomeAsyncException :: e -> SomeAsyncException
-- | Asynchronous exceptions.
data AsyncException
-- | The current thread's stack exceeded its limit. Since an exception has
-- been raised, the thread's stack will certainly be below its limit
-- again, but the programmer should take remedial action immediately.
StackOverflow :: AsyncException
-- | The program's heap is reaching its limit, and the program should take
-- action to reduce the amount of live data it has. Notes:
--
--
-- - It is undefined which thread receives this exception. GHC
-- currently throws this to the same thread that receives
-- UserInterrupt, but this may change in the future.
-- - The GHC RTS currently can only recover from heap overflow if it
-- detects that an explicit memory limit (set via RTS flags). has been
-- exceeded. Currently, failure to allocate memory from the operating
-- system results in immediate termination of the program.
--
HeapOverflow :: AsyncException
-- | This exception is raised by another thread calling killThread,
-- or by the system if it needs to terminate the thread for some reason.
ThreadKilled :: AsyncException
-- | This exception is raised by default in the main thread of the program
-- when the user requests to terminate the program via the usual
-- mechanism(s) (e.g. Control-C in the console).
UserInterrupt :: AsyncException
-- | Exceptions generated by array operations
data ArrayException
-- | An attempt was made to index an array outside its declared bounds.
IndexOutOfBounds :: String -> ArrayException
-- | An attempt was made to evaluate an element of an array that had not
-- been initialized.
UndefinedElement :: String -> ArrayException
-- | Evaluate the argument to weak head normal form.
--
-- evaluate is typically used to uncover any exceptions that a
-- lazy value may contain, and possibly handle them.
--
-- evaluate only evaluates to weak head normal form. If
-- deeper evaluation is needed, the force function from
-- Control.DeepSeq may be handy:
--
--
-- evaluate $ force x
--
--
-- There is a subtle difference between evaluate x and
-- return $! x, analogous to the difference
-- between throwIO and throw. If the lazy value x
-- throws an exception, return $! x will fail to
-- return an IO action and will throw an exception instead.
-- evaluate x, on the other hand, always produces an
-- IO action; that action will throw an exception upon
-- execution iff x throws an exception upon
-- evaluation.
--
-- The practical implication of this difference is that due to the
-- imprecise exceptions semantics,
--
--
-- (return $! error "foo") >> error "bar"
--
--
-- may throw either "foo" or "bar", depending on the
-- optimizations performed by the compiler. On the other hand,
--
--
-- evaluate (error "foo") >> error "bar"
--
--
-- is guaranteed to throw "foo".
--
-- The rule of thumb is to use evaluate to force or handle
-- exceptions in lazy values. If, on the other hand, you are forcing a
-- lazy value for efficiency reasons only and do not care about
-- exceptions, you may use return $! x.
evaluate :: a -> IO a
-- | Like mask, but the masked computation is not interruptible (see
-- Control.Exception#interruptible). THIS SHOULD BE USED WITH
-- GREAT CARE, because if a thread executing in
-- uninterruptibleMask blocks for any reason, then the thread (and
-- possibly the program, if this is the main thread) will be unresponsive
-- and unkillable. This function should only be necessary if you need to
-- mask exceptions around an interruptible operation, and you can
-- guarantee that the interruptible operation will only block for a short
-- period of time.
uninterruptibleMask :: ((forall a. () => IO a -> IO a) -> IO b) -> IO b
-- | Like uninterruptibleMask, but does not pass a restore
-- action to the argument.
uninterruptibleMask_ :: IO a -> IO a
-- | Executes an IO computation with asynchronous exceptions masked.
-- That is, any thread which attempts to raise an exception in the
-- current thread with throwTo will be blocked until asynchronous
-- exceptions are unmasked again.
--
-- The argument passed to mask is a function that takes as its
-- argument another function, which can be used to restore the prevailing
-- masking state within the context of the masked computation. For
-- example, a common way to use mask is to protect the acquisition
-- of a resource:
--
--
-- mask $ \restore -> do
-- x <- acquire
-- restore (do_something_with x) `onException` release
-- release
--
--
-- This code guarantees that acquire is paired with
-- release, by masking asynchronous exceptions for the critical
-- parts. (Rather than write this code yourself, it would be better to
-- use bracket which abstracts the general pattern).
--
-- Note that the restore action passed to the argument to
-- mask does not necessarily unmask asynchronous exceptions, it
-- just restores the masking state to that of the enclosing context. Thus
-- if asynchronous exceptions are already masked, mask cannot be
-- used to unmask exceptions again. This is so that if you call a library
-- function with exceptions masked, you can be sure that the library call
-- will not be able to unmask exceptions again. If you are writing
-- library code and need to use asynchronous exceptions, the only way is
-- to create a new thread; see forkIOWithUnmask.
--
-- Asynchronous exceptions may still be received while in the masked
-- state if the masked thread blocks in certain ways; see
-- Control.Exception#interruptible.
--
-- Threads created by forkIO inherit the MaskingState from
-- the parent; that is, to start a thread in the
-- MaskedInterruptible state, use mask_ $ forkIO ....
-- This is particularly useful if you need to establish an exception
-- handler in the forked thread before any asynchronous exceptions are
-- received. To create a new thread in an unmasked state use
-- forkIOWithUnmask.
mask :: ((forall a. () => IO a -> IO a) -> IO b) -> IO b
-- | Like mask, but does not pass a restore action to the
-- argument.
mask_ :: IO a -> IO a
-- | Returns the MaskingState for the current thread.
getMaskingState :: IO MaskingState
-- | Allow asynchronous exceptions to be raised even inside mask,
-- making the operation interruptible (see the discussion of
-- "Interruptible operations" in Exception).
--
-- When called outside mask, or inside uninterruptibleMask,
-- this function has no effect.
interruptible :: IO a -> IO a
-- | A variant of throw that can only be used within the IO
-- monad.
--
-- Although throwIO has a type that is an instance of the type of
-- throw, the two functions are subtly different:
--
--
-- throw e `seq` x ===> throw e
-- throwIO e `seq` x ===> x
--
--
-- The first example will cause the exception e to be raised,
-- whereas the second one won't. In fact, throwIO will only cause
-- an exception to be raised when it is used within the IO monad.
-- The throwIO variant should be used in preference to
-- throw to raise an exception within the IO monad because
-- it guarantees ordering with respect to other IO operations,
-- whereas throw does not.
throwIO :: Exception e => e -> IO a
-- | This is the simplest of the exception-catching functions. It takes a
-- single argument, runs it, and if an exception is raised the "handler"
-- is executed, with the value of the exception passed as an argument.
-- Otherwise, the result is returned as normal. For example:
--
--
-- catch (readFile f)
-- (\e -> do let err = show (e :: IOException)
-- hPutStr stderr ("Warning: Couldn't open " ++ f ++ ": " ++ err)
-- return "")
--
--
-- Note that we have to give a type signature to e, or the
-- program will not typecheck as the type is ambiguous. While it is
-- possible to catch exceptions of any type, see the section "Catching
-- all exceptions" (in Control.Exception) for an explanation of
-- the problems with doing so.
--
-- For catching exceptions in pure (non-IO) expressions, see the
-- function evaluate.
--
-- Note that due to Haskell's unspecified evaluation order, an expression
-- may throw one of several possible exceptions: consider the expression
-- (error "urk") + (1 `div` 0). Does the expression throw
-- ErrorCall "urk", or DivideByZero?
--
-- The answer is "it might throw either"; the choice is
-- non-deterministic. If you are catching any type of exception then you
-- might catch either. If you are calling catch with type IO
-- Int -> (ArithException -> IO Int) -> IO Int then the
-- handler may get run with DivideByZero as an argument, or an
-- ErrorCall "urk" exception may be propogated further up. If
-- you call it again, you might get a the opposite behaviour. This is ok,
-- because catch is an IO computation.
catch :: Exception e => IO a -> (e -> IO a) -> IO a
-- | Describes the behaviour of a thread when an asynchronous exception is
-- received.
data MaskingState
-- | asynchronous exceptions are unmasked (the normal state)
Unmasked :: MaskingState
-- | the state during mask: asynchronous exceptions are masked, but
-- blocking operations may still be interrupted
MaskedInterruptible :: MaskingState
-- | the state during uninterruptibleMask: asynchronous exceptions
-- are masked, and blocking operations may not be interrupted
MaskedUninterruptible :: MaskingState
-- | Exceptions that occur in the IO monad. An
-- IOException records a more specific error type, a descriptive
-- string and maybe the handle that was used when the error was flagged.
data IOException
-- | Throw an exception. Exceptions may be thrown from purely functional
-- code, but may only be caught within the IO monad.
throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a
-- | This is thrown when the user calls error. The first
-- String is the argument given to error, second
-- String is the location.
data ErrorCall
ErrorCallWithLocation :: String -> String -> ErrorCall
pattern ErrorCall :: String -> ErrorCall
-- | 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
-- | Arithmetic exceptions.
data ArithException
Overflow :: ArithException
Underflow :: ArithException
LossOfPrecision :: ArithException
DivideByZero :: ArithException
Denormal :: ArithException
RatioZeroDenominator :: ArithException
-- | The SomeException type is the root of the exception type
-- hierarchy. When an exception of type e is thrown, behind the
-- scenes it is encapsulated in a SomeException.
data SomeException
SomeException :: e -> SomeException
type ExceptionMonad m = (MonadCatch m, MonadThrow m, MonadMask m, MonadIO m)
catchIO :: IO a -> (IOException -> IO a) -> IO a
handleIO :: (IOException -> IO a) -> IO a -> IO a
tryIO :: IO a -> IO (Either IOException a)
module GHC.Utils.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
-- | Do not use global variables!
--
-- Global variables are a hack. Do not use them if you can help it.
module GHC.Utils.GlobalVars
v_unsafeHasPprDebug :: IORef Bool
v_unsafeHasNoDebugOutput :: IORef Bool
v_unsafeHasNoStateHack :: IORef Bool
unsafeHasPprDebug :: Bool
unsafeHasNoDebugOutput :: Bool
unsafeHasNoStateHack :: Bool
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
module GHC.Utils.IO.Unsafe
inlinePerformIO :: IO a -> a
-- | Utilities related to Monad and Applicative classes Mostly for
-- backwards compatibility.
module GHC.Utils.Monad
-- | 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 :: Type -> Type)
-- | 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.
--
-- Using ApplicativeDo: 'fs <*> as' can be
-- understood as the do expression
--
--
-- do f <- fs
-- a <- as
-- pure (f a)
--
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
-- | Lift a binary function to actions.
--
-- Some functors support an implementation of liftA2 that is more
-- efficient than the default one. In particular, if fmap is an
-- expensive operation, it is likely better to use liftA2 than to
-- fmap over the structure and then use <*>.
--
-- This became a typeclass method in 4.10.0.0. Prior to that, it was a
-- function defined in terms of <*> and fmap.
--
-- Using ApplicativeDo: 'liftA2 f as bs' can be
-- understood as the do expression
--
--
-- do a <- as
-- b <- bs
-- pure (f a b)
--
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
-- | Sequence actions, discarding the value of the first argument.
--
-- 'as *> bs' can be understood as the do
-- expression
--
--
-- do as
-- bs
--
--
-- This is a tad complicated for our ApplicativeDo extension
-- which will give it a Monad constraint. For an
-- Applicative constraint we write it of the form
--
--
-- do _ <- as
-- b <- bs
-- pure b
--
(*>) :: Applicative f => f a -> f b -> f b
-- | Sequence actions, discarding the value of the second argument.
--
-- Using ApplicativeDo: 'as <* bs' can be
-- understood as the do expression
--
--
-- do a <- as
-- bs
-- pure a
--
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*>
infixl 4 *>
infixl 4 <*
-- | 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 :: Type -> Type)
-- | 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 :: Type -> Type)
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => IO a -> m a
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 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])
liftFstM :: Monad m => (a -> b) -> m (a, r) -> m (b, r)
liftSndM :: Monad m => (a -> b) -> m (r, a) -> m (r, b)
-- | 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]
-- | Applicative version of mapMaybe
mapMaybeM :: Applicative 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 fold over the elements of a structure, associating to the
-- left, i.e. from left to right.
foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
-- | Monadic version of foldl that discards its result
foldlM_ :: (Monad m, Foldable t) => (a -> b -> m a) -> a -> t b -> m ()
-- | Monadic fold over the elements of a structure, associating to the
-- right, i.e. from right to left.
foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
-- | 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 ()
-- | Like filterM, only it reverses the sense of the test.
filterOutM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
-- | A state monad which is strict in its state.
module GHC.Utils.Monad.State.Strict
-- | A state monad which is strict in the state s, but lazy in the
-- value a.
--
-- See Note [Strict State monad] for the particular notion of strictness
-- and implementation details.
data State s a
pattern State :: (s -> (# a, s #)) -> State s a
state :: (s -> (a, s)) -> State s a
evalState :: State s a -> s -> a
execState :: State s a -> s -> s
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 ()
instance GHC.Base.Functor (GHC.Utils.Monad.State.Strict.State s)
instance GHC.Base.Applicative (GHC.Utils.Monad.State.Strict.State s)
instance GHC.Base.Monad (GHC.Utils.Monad.State.Strict.State s)
module GHC.Utils.Ppr.Colour
-- | A colour/style for use with coloured.
newtype PprColour
PprColour :: String -> PprColour
[renderColour] :: PprColour -> String
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.Semigroup GHC.Utils.Ppr.Colour.PprColour
instance GHC.Base.Monoid GHC.Utils.Ppr.Colour.PprColour
module GHC.Version
cProjectGitCommitId :: String
cProjectVersion :: String
cProjectVersionInt :: String
cProjectPatchLevel :: String
cProjectPatchLevel1 :: String
cProjectPatchLevel2 :: String
module GHC.UniqueSubdir
-- | A filepath like x86_64-linux-7.6.3 with the platform string
-- to use when constructing platform-version-dependent files that need to
-- co-exist.
uniqueSubdir :: ArchOS -> FilePath
module GHC.Settings.Config
cBuildPlatformString :: String
cHostPlatformString :: String
cProjectName :: String
cBooterVersion :: String
cStage :: String
-- | Defines a simple exception type and utilities to throw it. The
-- PlainGhcException type is a subset of the GhcException
-- type. It omits the exception constructors that involve pretty-printing
-- via SDoc.
--
-- There are two reasons for this:
--
--
-- - To avoid import cycles / use of boot files.
-- GHC.Utils.Outputable has many transitive dependencies. To throw
-- exceptions from these modules, the functions here can be used without
-- introducing import cycles.
-- - To reduce the number of modules that need to be compiled to object
-- code when loading GHC into GHCi. See #13101
--
module GHC.Utils.Panic.Plain
-- | This type is very similar to GhcException, but it omits the
-- constructors that involve pretty-printing via SDoc. Due to the
-- implementation of fromException for GhcException, this
-- type can be caught as a GhcException.
--
-- Note that this should only be used for throwing exceptions, not for
-- catching, as GhcException will not be converted to this type
-- when catching.
data PlainGhcException
-- | Some other fatal signal (SIGHUP,SIGTERM)
PlainSignal :: Int -> PlainGhcException
-- | Prints the short usage msg after the error
PlainUsageError :: String -> PlainGhcException
-- | A problem with the command line arguments, but don't print usage.
PlainCmdLineError :: String -> PlainGhcException
-- | The impossible happened.
PlainPanic :: String -> PlainGhcException
-- | The user tickled something that's known not to work yet, but we're not
-- counting it as a bug.
PlainSorry :: String -> PlainGhcException
-- | An installation problem.
PlainInstallationError :: String -> PlainGhcException
-- | An error in the user's code, probably.
PlainProgramError :: String -> PlainGhcException
-- | Append a description of the given exception to this string.
showPlainGhcException :: PlainGhcException -> ShowS
-- | Panics and asserts.
panic :: String -> a
-- | Panics and asserts.
sorry :: String -> a
-- | Panics and asserts.
pgmError :: String -> a
cmdLineError :: String -> a
cmdLineErrorIO :: String -> IO a
-- | Throw a failed assertion exception for a given filename and line
-- number.
assertPanic :: String -> Int -> a
assert :: HasCallStack => Bool -> a -> a
assertM :: (HasCallStack, Monad m) => m Bool -> m ()
massert :: (HasCallStack, Applicative m) => Bool -> m ()
instance GHC.Exception.Type.Exception GHC.Utils.Panic.Plain.PlainGhcException
instance GHC.Show.Show GHC.Utils.Panic.Plain.PlainGhcException
-- | Highly random utility functions
module GHC.Utils.Misc
-- | Apply a function iff some condition is met.
applyWhen :: Bool -> (a -> a) -> a -> a
-- | Apply a function n times to a given value.
nTimes :: Int -> (a -> a) -> a -> a
const2 :: a -> b -> c -> a
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])
-- | This has the effect of making the two lists have equal length by
-- dropping the tail of the longer one.
zipAndUnzip :: [a] -> [b] -> ([a], [b])
-- | 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; when
-- one list runs out, the function stops.
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])
-- | 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])
mapAccumM :: Monad m => (r -> a -> m (r, b)) -> r -> [a] -> m (r, [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])
-- | Get the last two elements in a list. Partial!
last2 :: [a] -> (a, a)
lastMaybe :: [a] -> Maybe a
-- | onJust x m f applies f to the value inside the Just or
-- returns the default.
onJust :: b -> Maybe a -> (a -> b) -> b
-- | 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
countWhile :: (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
-- |
-- (lengthIsNot xs n) = (length xs /= n)
--
lengthIsNot :: [a] -> Int -> Bool
-- |
-- (lengthAtLeast xs n) = (length xs >= n)
--
lengthAtLeast :: [a] -> Int -> Bool
-- |
-- (lengthAtMost xs n) = (length xs <= n)
--
lengthAtMost :: [a] -> Int -> Bool
-- |
-- (lengthLessThan xs n) == (length xs < n)
--
lengthLessThan :: [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
-- | True if length xs == length ys
equalLength :: [a] -> [b] -> Bool
compareLength :: [a] -> [b] -> Ordering
-- | True if length xs <= length ys
leLength :: [a] -> [b] -> Bool
-- | True if length xs < length ys
ltLength :: [a] -> [b] -> Bool
isSingleton :: [a] -> Bool
-- | Utility function to go from a singleton list to it's element.
--
-- Wether or not the argument is a singleton list is only checked in
-- debug builds.
only :: [a] -> a
-- | Extract the single element of a list and panic with the given message
-- if there are more elements or the list was empty. Like
-- expectJust, but for lists.
expectOnly :: HasCallStack => String -> [a] -> a
singleton :: a -> [a]
notNull :: Foldable f => f a -> Bool
-- | Split a list into its last element and the initial part of the list.
-- snocView xs = Just (init xs, last xs) for non-empty lists.
-- snocView xs = Nothing otherwise. Unless both parts of the
-- result are guaranteed to be used prefer separate calls to
-- last + init. If you are guaranteed to use both, this
-- will be more efficient.
snocView :: [a] -> Maybe ([a], a)
-- | 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]
-- | Apply an effectful function to the last list element. Assumes a
-- non-empty list (panics otherwise).
mapLastM :: Functor f => (a -> f a) -> [a] -> f [a]
whenNonEmpty :: Applicative m => [a] -> (NonEmpty a -> m ()) -> m ()
-- | Merge an unsorted list of sorted lists, for example:
--
--
-- mergeListsBy compare [ [2,5,15], [1,10,100] ] = [1,2,5,10,15,100]
--
--
-- <math>
mergeListsBy :: forall a. (a -> a -> Ordering) -> [[a]] -> [a]
isSortedBy :: (a -> a -> Ordering) -> [a] -> Bool
mapMaybe' :: Foldable f => (a -> Maybe b) -> f a -> [b]
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)
secondM :: Monad m => (b -> m c) -> (a, b) -> m (a, 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]
-- | Given two lists xs and ys, return `splitAt (length xs) ys`.
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
-- | 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]
-- | Remove duplicates but keep elements in order. O(n * log n)
ordNub :: Ord a => [a] -> [a]
-- | Remove duplicates but keep elements in order. O(n * log n)
ordNubOn :: Ord b => (a -> b) -> [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
strictMap :: (a -> b) -> [a] -> [b]
strictZipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
strictZipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
looksLikeModuleName :: String -> Bool
looksLikePackageName :: String -> Bool
-- | Determine the $log_2$ of exact powers of 2
exactLog2 :: Integer -> Maybe Integer
readRational :: String -> Rational
-- | Parse a string into a significand and exponent. A trivial example
-- might be: ghci> readSignificandExponentPair "1E2" (1,2) In a more
-- complex case we might return a exponent different than that which the
-- user wrote. This is needed in order to use a Integer significand.
-- ghci> readSignificandExponentPair "-1.11E5" (-111,3)
readSignificandExponentPair :: String -> (Integer, Integer)
readHexRational :: String -> Rational
-- | Parse a string into a significand and exponent according to the
-- "Hexadecimal Floats in Haskell" proposal. A trivial example might be:
-- ghci> readHexSignificandExponentPair "0x1p+1" (1,1) Behaves similar
-- to readSignificandExponentPair but the base is 16 and numbers are
-- given in hexadecimal: ghci> readHexSignificandExponentPair "0xAp-4"
-- (10,-4) ghci> readHexSignificandExponentPair "0x1.2p3" (18,-1)
readHexSignificandExponentPair :: String -> (Integer, Integer)
doesDirNameExist :: FilePath -> IO Bool
getModificationUTCTime :: FilePath -> IO UTCTime
modificationTimeIfExists :: FilePath -> IO (Maybe UTCTime)
fileHashIfExists :: FilePath -> IO (Maybe Fingerprint)
withAtomicRename :: MonadIO m => FilePath -> (FilePath -> m a) -> m 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
-- | Request a CallStack.
--
-- NOTE: The implicit parameter ?callStack :: CallStack is an
-- implementation detail and should not be considered part of the
-- CallStack API, we may decide to change the implementation in
-- the future.
type HasCallStack = ?callStack :: CallStack
-- | A call stack constraint, but only when isDebugOn.
type HasDebugCallStack = (() :: Constraint)
module GHC.Data.Maybe
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 :: Foldable f => f (Maybe a) -> Maybe a
-- | Takes computations returnings Maybes; tries each one in
-- order. The first one to return a Just wins. Returns
-- Nothing if all computations return Nothing.
firstJustsM :: (Monad m, Foldable f) => f (m (Maybe a)) -> m (Maybe a)
whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
expectJust :: HasCallStack => String -> Maybe a -> a
rightToMaybe :: Either a b -> Maybe b
-- | 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 :: Type -> Type) a
MaybeT :: m (Maybe a) -> MaybeT (m :: Type -> Type) a
[runMaybeT] :: MaybeT (m :: Type -> Type) 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 (GHC.Data.Maybe.MaybeErr err)
instance GHC.Base.Applicative (GHC.Data.Maybe.MaybeErr err)
instance GHC.Base.Monad (GHC.Data.Maybe.MaybeErr err)
-- | There are two principal string types used internally by GHC:
--
--
--
--
-- - A compact, hash-consed, representation of character strings.
-- - Generated by fsLit.
-- - You can get a Unique from them.
-- - Equality test is O(1) (it uses the Unique).
-- - Comparison is O(1) or O(n):
-- - O(n) but deterministic with lexical comparison
-- (lexicalCompareFS)
-- - O(1) but non-deterministic with Unique comparison
-- (uniqCompareFS)
-- - Turn into SDoc with ftext.
--
--
--
--
--
-- - Pointer and size of a Latin-1 encoded string.
-- - Practically no operations.
-- - Outputting them is fast.
-- - Generated by mkPtrString.
-- - Length of string literals (mkPtrString "abc") is computed
-- statically
-- - 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 PtrString unless you want the facilities of
-- FastString.
module GHC.Data.FastString
-- | Gives the Modified UTF-8 encoded bytes corresponding to a
-- FastString
bytesFS :: FastString -> ByteString
-- | Gives the Modified UTF-8 encoded bytes corresponding to a
-- FastString
-- | Deprecated: Use bytesFS instead
fastStringToByteString :: FastString -> ByteString
-- | Create a FastString by copying an existing ByteString
mkFastStringByteString :: ByteString -> FastString
fastZStringToByteString :: FastZString -> ByteString
unsafeMkByteString :: String -> ByteString
fastStringToShortByteString :: FastString -> ShortByteString
-- | Create a FastString from an existing ShortByteString
-- without copying.
mkFastStringShortByteString :: ShortByteString -> FastString
data FastZString
hPutFZS :: Handle -> FastZString -> IO ()
zString :: FastZString -> String
lengthFZS :: FastZString -> Int
-- | A FastString is a UTF-8 encoded string together with a unique
-- ID. All FastStrings are stored in a global hashtable to support
-- fast O(1) comparison.
--
-- It is also associated with a lazy reference to the Z-encoding of this
-- string which is used by the compiler internally.
data FastString
FastString :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !ShortByteString -> FastZString -> FastString
[uniq] :: FastString -> {-# UNPACK #-} !Int
[n_chars] :: FastString -> {-# UNPACK #-} !Int
[fs_sbs] :: FastString -> {-# UNPACK #-} !ShortByteString
-- | Lazily computed Z-encoding of this string. See Note [Z-Encoding] in
-- GHC.Utils.Encoding.
--
-- Since FastStrings are globally memoized this is computed at
-- most once for any given string.
[fs_zenc] :: FastString -> FastZString
-- | Non-deterministic FastString
--
-- This is a simple FastString wrapper with an Ord instance using
-- uniqCompareFS (i.e. which compares FastStrings on their
-- Uniques). Hence it is not deterministic from one run to the other.
newtype NonDetFastString
NonDetFastString :: FastString -> NonDetFastString
-- | Lexical FastString
--
-- This is a simple FastString wrapper with an Ord instance using
-- lexicalCompareFS (i.e. which compares FastStrings on their
-- String representation). Hence it is deterministic from one run to the
-- other.
newtype LexicalFastString
LexicalFastString :: FastString -> LexicalFastString
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
mkFastString# :: Addr# -> FastString
-- | Unpacks and decodes the FastString
unpackFS :: FastString -> String
unconsFS :: FastString -> Maybe (Char, FastString)
-- | 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
concatFS :: [FastString] -> FastString
consFS :: Char -> FastString -> FastString
nilFS :: FastString
isUnderscoreFS :: FastString -> Bool
-- | Compare FastString lexically
--
-- If you don't care about the lexical ordering, use uniqCompareFS
-- instead.
lexicalCompareFS :: FastString -> FastString -> Ordering
-- | Compare FastString by their Unique (not lexically).
--
-- Much cheaper than lexicalCompareFS but non-deterministic!
uniqCompareFS :: FastString -> FastString -> Ordering
-- | 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]]]
getFastStringZEncCounter :: IO Int
-- | A PtrString is a pointer to some array of Latin-1 encoded
-- chars.
data PtrString
PtrString :: !Ptr Word8 -> !Int -> PtrString
-- | Wrap an unboxed address into a PtrString.
mkPtrString# :: Addr# -> PtrString
-- | Encode a String into a newly allocated PtrString using
-- Latin-1 encoding. The original string must not contain non-Latin-1
-- characters (above codepoint 0xff).
mkPtrString :: String -> PtrString
-- | Decode a PtrString back into a String using Latin-1
-- encoding. This does not free the memory associated with
-- PtrString.
unpackPtrString :: PtrString -> String
-- | Return the length of a PtrString
lengthPS :: PtrString -> Int
instance Control.DeepSeq.NFData GHC.Data.FastString.FastZString
instance Data.Data.Data GHC.Data.FastString.NonDetFastString
instance GHC.Show.Show GHC.Data.FastString.NonDetFastString
instance GHC.Classes.Eq GHC.Data.FastString.NonDetFastString
instance Data.Data.Data GHC.Data.FastString.LexicalFastString
instance GHC.Show.Show GHC.Data.FastString.LexicalFastString
instance GHC.Classes.Eq GHC.Data.FastString.LexicalFastString
instance GHC.Classes.Ord GHC.Data.FastString.LexicalFastString
instance GHC.Classes.Ord GHC.Data.FastString.NonDetFastString
instance GHC.Classes.Eq GHC.Data.FastString.FastString
instance Data.String.IsString GHC.Data.FastString.FastString
instance GHC.Base.Semigroup GHC.Data.FastString.FastString
instance GHC.Base.Monoid GHC.Data.FastString.FastString
instance GHC.Show.Show GHC.Data.FastString.FastString
instance Data.Data.Data GHC.Data.FastString.FastString
instance Control.DeepSeq.NFData GHC.Data.FastString.FastString
module GHC.Utils.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 GHC.Utils.BufHandle
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 ()
bPutPtrString :: BufHandle -> PtrString -> IO ()
-- | Replicate an 8-bit character
bPutReplicate :: BufHandle -> Int -> Char -> 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.cse.chalmers.se/~rjmh/Papers/pretty.ps
module GHC.Utils.Ppr
-- | 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 #-} !PtrString -> TextDetails
RStr :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Char -> 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 :: PtrString -> 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
-- | Empty text (one line high but no width). (emptyText = text
-- "")
emptyText :: Doc
int :: Int -> Doc
integer :: Integer -> Doc
float :: Float -> Doc
double :: Double -> Doc
rational :: Rational -> Doc
hex :: Integer -> 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 False, 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 :: Bool -> Mode
[asciiSpace] :: Mode -> Bool
-- | 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
-- | Default TextDetails printer
txtPrinter :: TextDetails -> String -> String
printDoc :: Mode -> Int -> Handle -> Doc -> IO ()
printDoc_ :: Mode -> Int -> Handle -> Doc -> IO ()
bufLeftRender :: BufHandle -> Doc -> IO ()
instance GHC.Show.Show GHC.Utils.Ppr.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 GHC.Utils.Outputable
-- | Class designating that some type has an SDoc representation
class Outputable a
ppr :: Outputable a => 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 :: OutputableBndr a => a -> SDoc
pprInfixOcc :: OutputableBndr a => a -> SDoc
bndrIsJoin_maybe :: OutputableBndr a => a -> Maybe Int
-- | Outputable class with an additional environment value
--
-- See Note [The OutputableP class]
class OutputableP env a
pdoc :: OutputableP env a => env -> a -> SDoc
-- | Represents a pretty-printable document.
--
-- To display an SDoc, use printSDoc, printSDocLn,
-- bufLeftRenderSDoc, or renderWithContext. Avoid calling
-- runSDoc directly as it breaks the abstraction layer.
data SDoc
runSDoc :: SDoc -> SDocContext -> Doc
-- | Wrapper for types having a Outputable instance when an OutputableP
-- instance is required.
newtype PDoc a
PDoc :: a -> PDoc a
docToSDoc :: Doc -> 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
interpp'SP' :: (a -> SDoc) -> [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 :: SDocContext -> SDoc -> Bool
-- | Indent SDoc some specified amount
nest :: Int -> SDoc -> SDoc
char :: Char -> SDoc
text :: String -> SDoc
ftext :: FastString -> SDoc
ptext :: PtrString -> SDoc
ztext :: FastZString -> SDoc
int :: Int -> SDoc
intWithCommas :: Integral a => a -> SDoc
integer :: Integer -> SDoc
word :: 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
semi :: SDoc
comma :: SDoc
colon :: SDoc
dcolon :: SDoc
space :: SDoc
equals :: SDoc
dot :: SDoc
vbar :: SDoc
arrow :: SDoc
lollipop :: SDoc
larrow :: SDoc
darrow :: SDoc
arrowt :: SDoc
larrowt :: SDoc
arrowtt :: SDoc
larrowtt :: SDoc
lambda :: SDoc
lparen :: SDoc
rparen :: SDoc
lbrack :: SDoc
rbrack :: SDoc
lbrace :: SDoc
rbrace :: SDoc
underscore :: SDoc
mulArrow :: SDoc -> SDoc
blankLine :: SDoc
forAllLit :: 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
ppWhenOption :: (SDocContext -> Bool) -> SDoc -> SDoc
ppUnlessOption :: (SDocContext -> 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 singular verb suffix appropriate for the length of a
-- list:
--
--
-- singular [] = empty
-- singular["Hello"] = char 's'
-- singular ["Hello", "World"] = empty
--
singular :: [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
-- | Determines the form of possessive appropriate for the length of a
-- list:
--
--
-- itsOrTheir [x] = text "its"
-- itsOrTheir [x,y] = text "their"
-- itsOrTheir [] = text "their" -- probably avoid this
--
itsOrTheir :: [a] -> SDoc
-- | Determines the form of subject appropriate for the length of a list:
--
--
-- thisOrThese [x] = text "This"
-- thisOrThese [x,y] = text "These"
-- thisOrThese [] = text "These" -- probably avoid this
--
thisOrThese :: [a] -> SDoc
-- | "has" or "have" depending on the length of a list.
hasOrHave :: [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 :: SDocContext -> Mode -> Handle -> SDoc -> IO ()
-- | Like printSDoc but appends an extra newline.
printSDocLn :: SDocContext -> Mode -> Handle -> SDoc -> IO ()
-- | An efficient variant of printSDoc specialized for
-- LeftMode that outputs to a BufHandle.
bufLeftRenderSDoc :: SDocContext -> BufHandle -> SDoc -> IO ()
pprCode :: LabelStyle -> SDoc -> SDoc
showSDocOneLine :: SDocContext -> SDoc -> String
showSDocUnsafe :: SDoc -> String
showPprUnsafe :: Outputable a => a -> String
renderWithContext :: SDocContext -> SDoc -> String
pprDebugAndThen :: SDocContext -> (String -> a) -> SDoc -> SDoc -> a
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
primDoubleSuffix :: SDoc
primInt8Suffix :: SDoc
primWord8Suffix :: SDoc
primInt16Suffix :: SDoc
primWord16Suffix :: SDoc
primInt32Suffix :: SDoc
primWord32Suffix :: SDoc
primInt64Suffix :: SDoc
primWord64Suffix :: SDoc
primIntSuffix :: SDoc
primWordSuffix :: SDoc
-- | Special combinator for showing unboxed literals.
pprPrimChar :: Char -> SDoc
pprPrimInt :: Integer -> SDoc
pprPrimWord :: Integer -> SDoc
pprPrimInt8 :: Integer -> SDoc
pprPrimWord8 :: Integer -> SDoc
pprPrimInt16 :: Integer -> SDoc
pprPrimWord16 :: Integer -> SDoc
pprPrimInt32 :: Integer -> SDoc
pprPrimWord32 :: Integer -> SDoc
pprPrimInt64 :: Integer -> SDoc
pprPrimWord64 :: Integer -> SDoc
pprFastFilePath :: FastString -> SDoc
-- | Normalise, escape and render a string representing a path
--
-- e.g. "c:\whatever"
pprFilePathString :: FilePath -> 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 GHC.Core.Ppr
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
PprUser :: PrintUnqualified -> Depth -> Coloured -> PprStyle
PprDump :: PrintUnqualified -> PprStyle
-- | Print code; either C or assembler
PprCode :: !LabelStyle -> PprStyle
-- | Style of label pretty-printing.
--
-- When we produce C sources or headers, we have to take into account
-- that C compilers transform C labels when they convert them into
-- symbols. For example, they can add prefixes (e.g., "_" on Darwin) or
-- suffixes (size for stdcalls on Windows). So we provide two ways to
-- pretty-print CLabels: C style or Asm style.
data LabelStyle
-- | C label style (used by C and LLVM backends)
CStyle :: LabelStyle
-- | Asm label style (used by NCG backend)
AsmStyle :: LabelStyle
-- | 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 a Name's Module and OccName, decide
-- whether and how to qualify it.
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 = Unit -> 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
sdocOption :: (SDocContext -> a) -> (a -> SDoc) -> SDoc
updSDocContext :: (SDocContext -> SDocContext) -> SDoc -> SDoc
data SDocContext
SDC :: !PprStyle -> !Scheme -> !PprColour -> !Bool -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !FastString -> SDoc -> SDocContext
[sdocStyle] :: SDocContext -> !PprStyle
[sdocColScheme] :: SDocContext -> !Scheme
-- | The most recently used colour. This allows nesting colours.
[sdocLastColour] :: SDocContext -> !PprColour
[sdocShouldUseColor] :: SDocContext -> !Bool
[sdocDefaultDepth] :: SDocContext -> !Int
[sdocLineLength] :: SDocContext -> !Int
-- | True if Unicode encoding is supported and not disable by
-- GHC_NO_UNICODE environment variable
[sdocCanUseUnicode] :: SDocContext -> !Bool
[sdocHexWordLiterals] :: SDocContext -> !Bool
[sdocPprDebug] :: SDocContext -> !Bool
[sdocPrintUnicodeSyntax] :: SDocContext -> !Bool
[sdocPrintCaseAsLet] :: SDocContext -> !Bool
[sdocPrintTypecheckerElaboration] :: SDocContext -> !Bool
[sdocPrintAxiomIncomps] :: SDocContext -> !Bool
[sdocPrintExplicitKinds] :: SDocContext -> !Bool
[sdocPrintExplicitCoercions] :: SDocContext -> !Bool
[sdocPrintExplicitRuntimeReps] :: SDocContext -> !Bool
[sdocPrintExplicitForalls] :: SDocContext -> !Bool
[sdocPrintPotentialInstances] :: SDocContext -> !Bool
[sdocPrintEqualityRelations] :: SDocContext -> !Bool
[sdocSuppressTicks] :: SDocContext -> !Bool
[sdocSuppressTypeSignatures] :: SDocContext -> !Bool
[sdocSuppressTypeApplications] :: SDocContext -> !Bool
[sdocSuppressIdInfo] :: SDocContext -> !Bool
[sdocSuppressCoercions] :: SDocContext -> !Bool
[sdocSuppressUnfoldings] :: SDocContext -> !Bool
[sdocSuppressVarKinds] :: SDocContext -> !Bool
[sdocSuppressUniques] :: SDocContext -> !Bool
[sdocSuppressModulePrefixes] :: SDocContext -> !Bool
[sdocSuppressStgExts] :: SDocContext -> !Bool
[sdocErrorSpans] :: SDocContext -> !Bool
[sdocStarIsType] :: SDocContext -> !Bool
[sdocLinearTypes] :: SDocContext -> !Bool
[sdocImpredicativeTypes] :: SDocContext -> !Bool
[sdocPrintTypeAbbreviations] :: SDocContext -> !Bool
-- | Used to map UnitIds to more friendly "package-version:component"
-- strings while pretty-printing.
--
-- Use pprWithUnitState to set it. Users should never have to set
-- it to pretty-print SDocs emitted by GHC, otherwise it's a bug. It's an
-- internal field used to thread the UnitState so that the Outputable
-- instance of UnitId can use it.
--
-- See Note [Pretty-printing UnitId] in GHC.Unit for more details.
--
-- Note that we use FastString instead of UnitId to avoid
-- boring module inter-dependency issues.
[sdocUnitIdForUser] :: SDocContext -> !FastString -> SDoc
sdocWithContext :: (SDocContext -> SDoc) -> SDoc
-- | Default pretty-printing options
defaultSDocContext :: SDocContext
getPprStyle :: (PprStyle -> SDoc) -> SDoc
withPprStyle :: PprStyle -> SDoc -> SDoc
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
dumpStyle :: PprStyle -> Bool
asmStyle :: PprStyle -> Bool
qualName :: PprStyle -> QueryQualifyName
qualModule :: PprStyle -> QueryQualifyModule
qualPackage :: PprStyle -> QueryQualifyPackage
-- | Style for printing error messages
mkErrStyle :: PrintUnqualified -> PprStyle
-- | Default style for error messages, when we don't know PrintUnqualified
-- It's a bit of a hack because it doesn't take into account what's in
-- scope Only used for desugarer warnings, and typechecker errors in
-- interface sigs
defaultErrStyle :: PprStyle
defaultDumpStyle :: PprStyle
mkDumpStyle :: PrintUnqualified -> PprStyle
defaultUserStyle :: PprStyle
mkUserStyle :: PrintUnqualified -> Depth -> PprStyle
cmdlineParserStyle :: PprStyle
data Depth
AllTheWay :: Depth
-- | 0 => stop
PartWay :: Int -> Depth
-- | Use sdocDefaultDepth field as depth
DefaultDepth :: Depth
withUserStyle :: PrintUnqualified -> Depth -> SDoc -> SDoc
withErrStyle :: PrintUnqualified -> SDoc -> SDoc
-- | Says what to do with and without -dppr-debug
ifPprDebug :: SDoc -> SDoc -> SDoc
-- | Says what to do with -dppr-debug; without, return empty
whenPprDebug :: SDoc -> SDoc
-- | Indicate if -dppr-debug mode is enabled
getPprDebug :: (Bool -> SDoc) -> SDoc
instance GHC.Show.Show GHC.Utils.Outputable.LabelStyle
instance GHC.Classes.Ord GHC.Utils.Outputable.LabelStyle
instance GHC.Classes.Eq GHC.Utils.Outputable.LabelStyle
instance GHC.Utils.Outputable.Outputable GHC.Data.FastString.NonDetFastString
instance GHC.Utils.Outputable.Outputable GHC.Data.FastString.LexicalFastString
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.OutputableP env (GHC.Utils.Outputable.PDoc a)
instance GHC.Utils.Outputable.OutputableP env a => GHC.Utils.Outputable.OutputableP env [a]
instance GHC.Utils.Outputable.OutputableP env a => GHC.Utils.Outputable.OutputableP env (GHC.Maybe.Maybe a)
instance (GHC.Utils.Outputable.OutputableP env a, GHC.Utils.Outputable.OutputableP env b) => GHC.Utils.Outputable.OutputableP env (a, b)
instance (GHC.Utils.Outputable.OutputableP env a, GHC.Utils.Outputable.OutputableP env b, GHC.Utils.Outputable.OutputableP env c) => GHC.Utils.Outputable.OutputableP env (a, b, c)
instance (GHC.Utils.Outputable.OutputableP env key, GHC.Utils.Outputable.OutputableP env elt) => GHC.Utils.Outputable.OutputableP env (Data.Map.Internal.Map key elt)
instance GHC.Utils.Outputable.OutputableP env a => GHC.Utils.Outputable.OutputableP env (Data.Graph.SCC a)
instance GHC.Utils.Outputable.OutputableP env GHC.Utils.Outputable.SDoc
instance GHC.Utils.Outputable.OutputableP env a => GHC.Utils.Outputable.OutputableP env (Data.Set.Internal.Set a)
instance GHC.Utils.Outputable.Outputable GHC.Utils.Outputable.QualifyName
instance GHC.Utils.Outputable.Outputable GHC.Utils.Outputable.PprStyle
instance GHC.Utils.Outputable.Outputable GHC.Utils.Outputable.SDoc
instance GHC.Utils.Outputable.Outputable GHC.Types.Char
instance GHC.Utils.Outputable.Outputable GHC.Types.Bool
instance GHC.Utils.Outputable.Outputable GHC.Types.Ordering
instance GHC.Utils.Outputable.Outputable GHC.Int.Int32
instance GHC.Utils.Outputable.Outputable GHC.Int.Int64
instance GHC.Utils.Outputable.Outputable GHC.Types.Int
instance GHC.Utils.Outputable.Outputable GHC.Integer.Type.Integer
instance GHC.Utils.Outputable.Outputable GHC.Word.Word16
instance GHC.Utils.Outputable.Outputable GHC.Word.Word32
instance GHC.Utils.Outputable.Outputable GHC.Word.Word64
instance GHC.Utils.Outputable.Outputable GHC.Types.Word
instance GHC.Utils.Outputable.Outputable GHC.Types.Float
instance GHC.Utils.Outputable.Outputable GHC.Types.Double
instance GHC.Utils.Outputable.Outputable ()
instance GHC.Utils.Outputable.Outputable Data.Time.Clock.Internal.UTCTime.UTCTime
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable [a]
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Base.NonEmpty a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (Data.Set.Internal.Set a)
instance GHC.Utils.Outputable.Outputable Data.IntSet.Internal.IntSet
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b) => GHC.Utils.Outputable.Outputable (a, b)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Maybe.Maybe a)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b) => GHC.Utils.Outputable.Outputable (Data.Either.Either a b)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b, GHC.Utils.Outputable.Outputable c) => GHC.Utils.Outputable.Outputable (a, b, c)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b, GHC.Utils.Outputable.Outputable c, GHC.Utils.Outputable.Outputable d) => GHC.Utils.Outputable.Outputable (a, b, c, d)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b, GHC.Utils.Outputable.Outputable c, GHC.Utils.Outputable.Outputable d, GHC.Utils.Outputable.Outputable e) => GHC.Utils.Outputable.Outputable (a, b, c, d, e)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b, GHC.Utils.Outputable.Outputable c, GHC.Utils.Outputable.Outputable d, GHC.Utils.Outputable.Outputable e, GHC.Utils.Outputable.Outputable f) => GHC.Utils.Outputable.Outputable (a, b, c, d, e, f)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b, GHC.Utils.Outputable.Outputable c, GHC.Utils.Outputable.Outputable d, GHC.Utils.Outputable.Outputable e, GHC.Utils.Outputable.Outputable f, GHC.Utils.Outputable.Outputable g) => GHC.Utils.Outputable.Outputable (a, b, c, d, e, f, g)
instance GHC.Utils.Outputable.Outputable GHC.Data.FastString.FastString
instance (GHC.Utils.Outputable.Outputable key, GHC.Utils.Outputable.Outputable elt) => GHC.Utils.Outputable.Outputable (Data.Map.Internal.Map key elt)
instance GHC.Utils.Outputable.Outputable elt => GHC.Utils.Outputable.Outputable (Data.IntMap.Internal.IntMap elt)
instance GHC.Utils.Outputable.Outputable GHC.Fingerprint.Type.Fingerprint
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (Data.Graph.SCC a)
instance GHC.Utils.Outputable.Outputable GHC.Serialized.Serialized
instance GHC.Utils.Outputable.Outputable GHC.LanguageExtensions.Type.Extension
instance Data.String.IsString GHC.Utils.Outputable.SDoc
-- | Defines basic functions for printing error messages.
--
-- It's hard to put these functions anywhere else without causing some
-- unnecessary loops in the module dependency graph.
module GHC.Utils.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.
showGhcException :: SDocContext -> GhcException -> ShowS
-- | Append a description of the given exception to this string.
--
-- Note that this uses defaultSDocContext, which doesn't use the
-- options set by the user via DynFlags.
showGhcExceptionUnsafe :: GhcException -> ShowS
throwGhcException :: GhcException -> a
throwGhcExceptionIO :: GhcException -> IO a
handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a
-- | Panics and asserts.
pgmError :: String -> a
-- | Panics and asserts.
panic :: String -> a
-- | Throw an exception saying "bug in GHC" with a callstack
pprPanic :: HasCallStack => String -> SDoc -> a
-- | Throw a failed assertion exception for a given filename and line
-- number.
assertPanic :: String -> Int -> a
-- | Panic with an assertion failure, recording the given file and line
-- number. Should typically be accessed with the ASSERT family of macros
assertPprPanic :: HasCallStack => SDoc -> a
assertPpr :: HasCallStack => Bool -> SDoc -> a -> a
assertPprM :: (HasCallStack, Monad m) => m Bool -> SDoc -> m ()
massertPpr :: (HasCallStack, Applicative m) => Bool -> SDoc -> m ()
-- | Panics and asserts.
sorry :: String -> a
-- | Throw an exception saying "bug in GHC"
panicDoc :: String -> SDoc -> a
-- | Throw an exception saying "this isn't finished yet"
sorryDoc :: String -> SDoc -> a
-- | Throw an exception saying "bug in pgm being compiled" (used for
-- unusual program errors)
pgmErrorDoc :: String -> SDoc -> a
cmdLineError :: String -> a
cmdLineErrorIO :: String -> IO a
callStackDoc :: HasCallStack => SDoc
prettyCallStackDoc :: CallStack -> SDoc
-- | 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 => m a -> m a
instance GHC.Exception.Type.Exception GHC.Utils.Panic.GhcException
instance GHC.Show.Show GHC.Utils.Panic.GhcException
-- | Tracing utilities
module GHC.Utils.Trace
-- | If debug output is on, show some SDoc on the screen
pprTrace :: String -> SDoc -> a -> a
pprTraceM :: Applicative f => String -> SDoc -> f ()
pprTraceDebug :: String -> SDoc -> a -> a
-- | pprTraceIt desc x is equivalent to pprTrace desc (ppr x)
-- x
pprTraceIt :: Outputable a => String -> a -> a
-- | pprTraceWith desc f x is equivalent to pprTrace desc (f
-- x) x. This allows you to print details from the returned value as
-- well as from ambient variables.
pprTraceWith :: String -> (a -> 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
-- | pprTraceException desc x action runs action, printing a
-- message if it throws an exception.
pprTraceException :: ExceptionMonad m => String -> SDoc -> m a -> m a
-- | Just warn about an assertion failure, recording the given file and
-- line number.
warnPprTrace :: HasCallStack => Bool -> String -> SDoc -> a -> a
-- | For when we want to show the user a non-fatal WARNING so that they can
-- report a GHC bug, but don't want to panic.
pprTraceUserWarning :: 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.
--
--
-- >>> let x = 123; f = show
--
-- >>> trace ("calling f with x = " ++ show x) (f x)
-- "calling f with x = 123
-- 123"
--
--
-- 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
module GHC.SysTools.BaseDir
-- | Expand occurrences of the $topdir interpolation in a string.
expandTopDir :: FilePath -> String -> String
-- | Expand occurrences of the $tooldir interpolation in a string
-- on Windows, leave the string untouched otherwise.
expandToolDir :: Bool -> Maybe FilePath -> String -> String
-- | Returns a Unix-format path pointing to TopDir.
findTopDir :: Maybe String -> IO String
findToolDir :: Bool -> FilePath -> IO (Maybe FilePath)
tryFindTopDir :: Maybe String -> IO (Maybe String)
module GHC.Parser.CharClass
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
module GHC.CmmToAsm.CFG.Weight
-- | Edge weights to use when generating a CFG from CMM
data Weights
Weights :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Weights
[uncondWeight] :: Weights -> Int
[condBranchWeight] :: Weights -> Int
[switchWeight] :: Weights -> Int
[callWeight] :: Weights -> Int
[likelyCondWeight] :: Weights -> Int
[unlikelyCondWeight] :: Weights -> Int
[infoTablePenalty] :: Weights -> Int
[backEdgeBonus] :: Weights -> Int
-- | Default edge weights
defaultWeights :: Weights
parseWeights :: String -> Weights -> Weights
module GHC.Utils.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
instance GHC.Utils.Json.ToJson GHC.Base.String
instance GHC.Utils.Json.ToJson GHC.Types.Int
-- | Unit identifier pretty-printing
module GHC.Unit.Ppr
-- | Subset of UnitInfo: just enough to pretty-print a unit-id
--
-- Instead of printing the unit-id which may contain a hash, we print:
-- package-version:componentname
data UnitPprInfo
UnitPprInfo :: FastString -> String -> Version -> Maybe String -> UnitPprInfo
-- | Identifier
[unitPprId] :: UnitPprInfo -> FastString
-- | Source package name
[unitPprPackageName] :: UnitPprInfo -> String
-- | Source package version
[unitPprPackageVersion] :: UnitPprInfo -> Version
-- | Component name
[unitPprComponentName] :: UnitPprInfo -> Maybe String
instance GHC.Utils.Outputable.Outputable GHC.Unit.Ppr.UnitPprInfo
module GHC.Types.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)
eqUnique :: Unique -> Unique -> Bool
ltUnique :: Unique -> Unique -> Bool
incrUnique :: Unique -> Unique
stepUnique :: Unique -> Int -> Unique
newTagUnique :: Unique -> Char -> 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
-- GHC.Iface.Binary for details.
isValidKnownKeyUnique :: Unique -> Bool
mkLocalUnique :: Int -> Unique
minLocalUnique :: Unique
maxLocalUnique :: Unique
instance GHC.Types.Unique.Uniquable GHC.Data.FastString.FastString
instance GHC.Types.Unique.Uniquable GHC.Types.Int
instance GHC.Types.Unique.Uniquable GHC.Types.Unique.Unique
instance GHC.Classes.Eq GHC.Types.Unique.Unique
instance GHC.Utils.Outputable.Outputable GHC.Types.Unique.Unique
instance GHC.Show.Show GHC.Types.Unique.Unique
module GHC.Types.Unique.Supply
-- | 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)
uniqFromMask :: Char -> IO Unique
-- | Create a unique supply out of thin air. The "mask" (Char) supplied is
-- purely cosmetic, making it easier to figure out where a Unique was
-- born. See Note [Uniques and masks].
--
-- The payload part of the Uniques allocated from this UniqSupply are
-- guaranteed distinct wrt all other supplies, regardless of their
-- "mask". This is achieved by allocating the payload part from a single
-- source of Uniques, namely genSym, shared across all
-- UniqSupply's.
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]
-- | 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]
-- | 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
initUniqSupply :: Word -> Int -> IO ()
instance GHC.Types.Unique.Supply.MonadUnique GHC.Types.Unique.Supply.UniqSM
instance GHC.Base.Functor GHC.Types.Unique.Supply.UniqSM
instance GHC.Base.Monad GHC.Types.Unique.Supply.UniqSM
instance GHC.Base.Applicative GHC.Types.Unique.Supply.UniqSM
instance Control.Monad.Fail.MonadFail GHC.Types.Unique.Supply.UniqSM
instance Control.Monad.Fix.MonadFix GHC.Types.Unique.Supply.UniqSM
module GHC.Types.Unique.FM
-- | A finite map from uniques of one type to elements in another
-- type.
--
-- The key is just here to keep us honest. It's always safe to use a
-- single type as key. If two types don't overlap in their uniques it's
-- also safe to index the same map at multiple key types. But this is
-- very much discouraged.
data UniqFM key ele
-- | A wrapper around UniqFM with the sole purpose of informing call
-- sites that the provided Foldable and Traversable
-- instances are nondeterministic. If you use this please provide a
-- justification why it doesn't introduce nondeterminism. See Note
-- [Deterministic UniqFM] in GHC.Types.Unique.DFM to learn about
-- determinism.
newtype NonDetUniqFM key ele
NonDetUniqFM :: UniqFM key ele -> NonDetUniqFM key ele
[getNonDet] :: NonDetUniqFM key ele -> UniqFM key ele
emptyUFM :: UniqFM key elt
unitUFM :: Uniquable key => key -> elt -> UniqFM key elt
unitDirectlyUFM :: Unique -> elt -> UniqFM key elt
zipToUFM :: Uniquable key => [key] -> [elt] -> UniqFM key elt
listToUFM :: Uniquable key => [(key, elt)] -> UniqFM key elt
listToUFM_Directly :: [(Unique, elt)] -> UniqFM key elt
listToUFM_C :: Uniquable key => (elt -> elt -> elt) -> [(key, elt)] -> UniqFM key elt
listToIdentityUFM :: Uniquable key => [key] -> UniqFM key key
addToUFM :: Uniquable key => UniqFM key elt -> key -> elt -> UniqFM key elt
addToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM key elt -> key -> elt -> UniqFM key elt
addToUFM_Acc :: Uniquable key => (elt -> elts -> elts) -> (elt -> elts) -> UniqFM key elts -> key -> elt -> UniqFM key elts
addListToUFM :: Uniquable key => UniqFM key elt -> [(key, elt)] -> UniqFM key elt
-- | Add elements to the map, combining existing values with inserted ones
-- using the given function.
addListToUFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqFM key elt -> [(key, elt)] -> UniqFM key elt
addToUFM_Directly :: UniqFM key elt -> Unique -> elt -> UniqFM key elt
addListToUFM_Directly :: UniqFM key elt -> [(Unique, elt)] -> UniqFM key elt
adjustUFM :: Uniquable key => (elt -> elt) -> UniqFM key elt -> key -> UniqFM key elt
alterUFM :: Uniquable key => (Maybe elt -> Maybe elt) -> UniqFM key elt -> key -> UniqFM key elt
adjustUFM_Directly :: (elt -> elt) -> UniqFM key elt -> Unique -> UniqFM key elt
delFromUFM :: Uniquable key => UniqFM key elt -> key -> UniqFM key elt
delFromUFM_Directly :: UniqFM key elt -> Unique -> UniqFM key elt
delListFromUFM :: Uniquable key => UniqFM key elt -> [key] -> UniqFM key elt
delListFromUFM_Directly :: UniqFM key elt -> [Unique] -> UniqFM key elt
plusUFM :: UniqFM key elt -> UniqFM key elt -> UniqFM key elt
plusUFM_C :: (elt -> elt -> elt) -> UniqFM key elt -> UniqFM key elt -> UniqFM key 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.
--
-- IMPORTANT NOTE: This function strictly applies the modification
-- function and forces the result unlike most the other functions in this
-- module.
--
-- 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 :: (elta -> eltb -> eltc) -> UniqFM key elta -> elta -> UniqFM key eltb -> eltb -> UniqFM key eltc
-- | `plusUFM_CD2 f m1 m2` merges the maps using f as the
-- combining function. Unlike plusUFM_CD, a missing value is not
-- defaulted: it is instead passed as Nothing to f.
-- f can never have both its arguments be Nothing.
--
-- IMPORTANT NOTE: This function strictly applies the modification
-- function and forces the result.
--
-- `plusUFM_CD2 f m1 m2` is the same as `plusUFM_CD f (mapUFM Just m1)
-- Nothing (mapUFM Just m2) Nothing`.
plusUFM_CD2 :: (Maybe elta -> Maybe eltb -> eltc) -> UniqFM key elta -> UniqFM key eltb -> UniqFM key eltc
mergeUFM :: (elta -> eltb -> Maybe eltc) -> (UniqFM key elta -> UniqFM key eltc) -> (UniqFM key eltb -> UniqFM key eltc) -> UniqFM key elta -> UniqFM key eltb -> UniqFM key eltc
plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM key elt -> UniqFM key elt -> UniqFM key elt
plusUFMList :: [UniqFM key elt] -> UniqFM key elt
sequenceUFMList :: forall key elt. [UniqFM key elt] -> UniqFM key [elt]
minusUFM :: UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt1
-- | minusUFC_C f map1 map2 returns map1, except that
-- every mapping key |-> value1 in map1 that shares
-- a key with a mapping key |-> value2 in map2 is
-- altered by f: value1 is replaced by f value1
-- value2, where Just means that the new value is used and
-- Nothing means that the mapping is deleted.
minusUFM_C :: (elt1 -> elt2 -> Maybe elt1) -> UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt1
intersectUFM :: UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt1
intersectUFM_C :: (elt1 -> elt2 -> elt3) -> UniqFM key elt1 -> UniqFM key elt2 -> UniqFM key elt3
disjointUFM :: UniqFM key elt1 -> UniqFM key elt2 -> Bool
equalKeysUFM :: UniqFM key a -> UniqFM key b -> Bool
nonDetStrictFoldUFM :: (elt -> a -> a) -> a -> UniqFM key elt -> a
foldUFM :: (elt -> a -> a) -> a -> UniqFM key elt -> a
-- | In essence foldM See Note [Deterministic UniqFM] to learn about
-- nondeterminism. If you use this please provide a justification why it
-- doesn't introduce nondeterminism.
nonDetStrictFoldUFM_DirectlyM :: Monad m => (Unique -> b -> elt -> m b) -> b -> UniqFM key elt -> m b
nonDetStrictFoldUFM_Directly :: (Unique -> elt -> a -> a) -> a -> UniqFM key elt -> a
anyUFM :: (elt -> Bool) -> UniqFM key elt -> Bool
allUFM :: (elt -> Bool) -> UniqFM key elt -> Bool
seqEltsUFM :: (elt -> ()) -> UniqFM key elt -> ()
mapUFM :: (elt1 -> elt2) -> UniqFM key elt1 -> UniqFM key elt2
mapUFM_Directly :: (Unique -> elt1 -> elt2) -> UniqFM key elt1 -> UniqFM key elt2
mapMaybeUFM :: (elt1 -> Maybe elt2) -> UniqFM key elt1 -> UniqFM key elt2
elemUFM :: Uniquable key => key -> UniqFM key elt -> Bool
elemUFM_Directly :: Unique -> UniqFM key elt -> Bool
filterUFM :: (elt -> Bool) -> UniqFM key elt -> UniqFM key elt
filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM key elt -> UniqFM key elt
partitionUFM :: (elt -> Bool) -> UniqFM key elt -> (UniqFM key elt, UniqFM key elt)
sizeUFM :: UniqFM key elt -> Int
isNullUFM :: UniqFM key elt -> Bool
lookupUFM :: Uniquable key => UniqFM key elt -> key -> Maybe elt
lookupUFM_Directly :: UniqFM key elt -> Unique -> Maybe elt
lookupWithDefaultUFM :: Uniquable key => UniqFM key elt -> elt -> key -> elt
lookupWithDefaultUFM_Directly :: UniqFM key elt -> elt -> Unique -> elt
nonDetEltsUFM :: UniqFM key elt -> [elt]
nonDetKeysUFM :: UniqFM key elt -> [Unique]
ufmToSet_Directly :: UniqFM key elt -> IntSet
nonDetUFMToList :: UniqFM key elt -> [(Unique, elt)]
ufmToIntMap :: UniqFM key elt -> IntMap elt
unsafeIntMapToUFM :: IntMap elt -> UniqFM key elt
-- | Cast the key domain of a UniqFM.
--
-- As long as the domains don't overlap in their uniques this is safe.
unsafeCastUFMKey :: UniqFM key1 elt -> UniqFM key2 elt
pprUniqFM :: (a -> SDoc) -> UniqFM key 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 key 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 key 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 key a -> SDoc
instance GHC.Base.Functor (GHC.Types.Unique.FM.UniqFM key)
instance GHC.Classes.Eq ele => GHC.Classes.Eq (GHC.Types.Unique.FM.UniqFM key ele)
instance (Data.Data.Data key, Data.Data.Data ele) => Data.Data.Data (GHC.Types.Unique.FM.UniqFM key ele)
instance GHC.Base.Functor (GHC.Types.Unique.FM.NonDetUniqFM key)
instance Data.Foldable.Foldable (GHC.Types.Unique.FM.NonDetUniqFM key)
instance Data.Traversable.Traversable (GHC.Types.Unique.FM.NonDetUniqFM key)
instance GHC.Base.Semigroup (GHC.Types.Unique.FM.UniqFM key a)
instance GHC.Base.Monoid (GHC.Types.Unique.FM.UniqFM key a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.FM.UniqFM key a)
module GHC.Types.Unique.Map
-- | Maps indexed by Uniquable keys
newtype UniqMap k a
UniqMap :: UniqFM k (k, a) -> UniqMap k a
emptyUniqMap :: UniqMap k a
isNullUniqMap :: UniqMap k a -> Bool
unitUniqMap :: Uniquable k => k -> a -> UniqMap k a
listToUniqMap :: Uniquable k => [(k, a)] -> UniqMap k a
listToUniqMap_C :: Uniquable k => (a -> a -> a) -> [(k, a)] -> UniqMap k a
addToUniqMap :: Uniquable k => UniqMap k a -> k -> a -> UniqMap k a
addListToUniqMap :: Uniquable k => UniqMap k a -> [(k, a)] -> UniqMap k a
addToUniqMap_C :: Uniquable k => (a -> a -> a) -> UniqMap k a -> k -> a -> UniqMap k a
addToUniqMap_Acc :: Uniquable k => (b -> a -> a) -> (b -> a) -> UniqMap k a -> k -> b -> UniqMap k a
alterUniqMap :: Uniquable k => (Maybe a -> Maybe a) -> UniqMap k a -> k -> UniqMap k a
addListToUniqMap_C :: Uniquable k => (a -> a -> a) -> UniqMap k a -> [(k, a)] -> UniqMap k a
adjustUniqMap :: Uniquable k => (a -> a) -> UniqMap k a -> k -> UniqMap k a
delFromUniqMap :: Uniquable k => UniqMap k a -> k -> UniqMap k a
delListFromUniqMap :: Uniquable k => UniqMap k a -> [k] -> UniqMap k a
plusUniqMap :: UniqMap k a -> UniqMap k a -> UniqMap k a
plusUniqMap_C :: (a -> a -> a) -> UniqMap k a -> UniqMap k a -> UniqMap k a
plusMaybeUniqMap_C :: (a -> a -> Maybe a) -> UniqMap k a -> UniqMap k a -> UniqMap k a
plusUniqMapList :: [UniqMap k a] -> UniqMap k a
minusUniqMap :: UniqMap k a -> UniqMap k b -> UniqMap k a
intersectUniqMap :: UniqMap k a -> UniqMap k b -> UniqMap k a
disjointUniqMap :: UniqMap k a -> UniqMap k b -> Bool
mapUniqMap :: (a -> b) -> UniqMap k a -> UniqMap k b
filterUniqMap :: (a -> Bool) -> UniqMap k a -> UniqMap k a
partitionUniqMap :: (a -> Bool) -> UniqMap k a -> (UniqMap k a, UniqMap k a)
sizeUniqMap :: UniqMap k a -> Int
elemUniqMap :: Uniquable k => k -> UniqMap k a -> Bool
lookupUniqMap :: Uniquable k => UniqMap k a -> k -> Maybe a
lookupWithDefaultUniqMap :: Uniquable k => UniqMap k a -> a -> k -> a
anyUniqMap :: (a -> Bool) -> UniqMap k a -> Bool
allUniqMap :: (a -> Bool) -> UniqMap k a -> Bool
nonDetEltsUniqMap :: UniqMap k a -> [(k, a)]
nonDetFoldUniqMap :: ((k, a) -> b -> b) -> b -> UniqMap k a -> b
instance GHC.Base.Functor (GHC.Types.Unique.Map.UniqMap k)
instance (GHC.Classes.Eq k, GHC.Classes.Eq a) => GHC.Classes.Eq (GHC.Types.Unique.Map.UniqMap k a)
instance (Data.Data.Data k, Data.Data.Data a) => Data.Data.Data (GHC.Types.Unique.Map.UniqMap k a)
instance GHC.Base.Semigroup (GHC.Types.Unique.Map.UniqMap k a)
instance GHC.Base.Monoid (GHC.Types.Unique.Map.UniqMap k a)
instance (GHC.Utils.Outputable.Outputable k, GHC.Utils.Outputable.Outputable a) => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.Map.UniqMap k a)
module GHC.Types.Unique.DFM
-- | Type of unique deterministic finite maps
--
-- The key is just here to keep us honest. It's always safe to use a
-- single type as key. If two types don't overlap in their uniques it's
-- also safe to index the same map at multiple key types. But this is
-- very much discouraged.
data UniqDFM key ele
emptyUDFM :: UniqDFM key elt
unitUDFM :: Uniquable key => key -> elt -> UniqDFM key elt
addToUDFM :: Uniquable key => UniqDFM key elt -> key -> elt -> UniqDFM key elt
addToUDFM_C :: Uniquable key => (elt -> elt -> elt) -> UniqDFM key elt -> key -> elt -> UniqDFM key elt
addToUDFM_C_Directly :: (elt -> elt -> elt) -> UniqDFM key elt -> Unique -> elt -> UniqDFM key elt
addToUDFM_Directly :: UniqDFM key elt -> Unique -> elt -> UniqDFM key elt
addListToUDFM :: Uniquable key => UniqDFM key elt -> [(key, elt)] -> UniqDFM key elt
delFromUDFM :: Uniquable key => UniqDFM key elt -> key -> UniqDFM key elt
-- | Delete a list of elements from a UniqDFM
delListFromUDFM :: Uniquable key => UniqDFM key elt -> [key] -> UniqDFM key elt
-- | Apply a function to a particular element
adjustUDFM :: Uniquable key => (elt -> elt) -> UniqDFM key elt -> key -> UniqDFM key elt
-- | Apply a function to a particular element
adjustUDFM_Directly :: (elt -> elt) -> UniqDFM key elt -> Unique -> UniqDFM key 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 key elt -> key -> UniqDFM key elt
-- | Map a function over every value in a UniqDFM
mapUDFM :: (elt1 -> elt2) -> UniqDFM key elt1 -> UniqDFM key elt2
mapMaybeUDFM :: forall elt1 elt2 key. (elt1 -> Maybe elt2) -> UniqDFM key elt1 -> UniqDFM key elt2
plusUDFM :: UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt
plusUDFM_C :: (elt -> elt -> elt) -> UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt
lookupUDFM :: Uniquable key => UniqDFM key elt -> key -> Maybe elt
lookupUDFM_Directly :: UniqDFM key elt -> Unique -> Maybe elt
elemUDFM :: Uniquable key => key -> UniqDFM key 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 key elt -> a
eltsUDFM :: UniqDFM key elt -> [elt]
filterUDFM :: (elt -> Bool) -> UniqDFM key elt -> UniqDFM key elt
filterUDFM_Directly :: (Unique -> elt -> Bool) -> UniqDFM key elt -> UniqDFM key elt
isNullUDFM :: UniqDFM key elt -> Bool
sizeUDFM :: UniqDFM key elt -> Int
intersectUDFM :: UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt
udfmIntersectUFM :: UniqDFM key elt1 -> UniqFM key elt2 -> UniqDFM key elt1
disjointUDFM :: UniqDFM key elt -> UniqDFM key elt -> Bool
disjointUdfmUfm :: UniqDFM key elt -> UniqFM key elt2 -> Bool
equalKeysUDFM :: UniqDFM key a -> UniqDFM key b -> Bool
minusUDFM :: UniqDFM key elt1 -> UniqDFM key elt2 -> UniqDFM key elt1
listToUDFM :: Uniquable key => [(key, elt)] -> UniqDFM key elt
listToUDFM_Directly :: [(Unique, elt)] -> UniqDFM key elt
udfmMinusUFM :: UniqDFM key elt1 -> UniqFM key elt2 -> UniqDFM key elt1
ufmMinusUDFM :: UniqFM key elt1 -> UniqDFM key elt2 -> UniqFM key elt1
-- | Partition UniqDFM into two UniqDFMs according to the predicate
partitionUDFM :: (elt -> Bool) -> UniqDFM key elt -> (UniqDFM key elt, UniqDFM key elt)
udfmRestrictKeys :: UniqDFM key elt -> UniqDFM key elt2 -> UniqDFM key elt
anyUDFM :: (elt -> Bool) -> UniqDFM key elt -> Bool
allUDFM :: (elt -> Bool) -> UniqDFM key elt -> Bool
pprUniqDFM :: (a -> SDoc) -> UniqDFM key a -> SDoc
pprUDFM :: UniqDFM key 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 key elt -> [(Unique, elt)]
-- | This allows for lossy conversion from UniqDFM to UniqFM
udfmToUfm :: UniqDFM key elt -> UniqFM key elt
-- | Performs a nondeterministic strict 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.
nonDetStrictFoldUDFM :: (elt -> a -> a) -> a -> UniqDFM key elt -> a
-- | Cast the key domain of a UniqFM.
--
-- As long as the domains don't overlap in their uniques this is safe.
unsafeCastUDFMKey :: UniqDFM key1 elt -> UniqDFM key2 elt
alwaysUnsafeUfmToUdfm :: UniqFM key elt -> UniqDFM key elt
instance Data.Traversable.Traversable GHC.Types.Unique.DFM.TaggedVal
instance Data.Foldable.Foldable GHC.Types.Unique.DFM.TaggedVal
instance GHC.Base.Functor GHC.Types.Unique.DFM.TaggedVal
instance Data.Data.Data val => Data.Data.Data (GHC.Types.Unique.DFM.TaggedVal val)
instance GHC.Base.Functor (GHC.Types.Unique.DFM.UniqDFM key)
instance (Data.Data.Data key, Data.Data.Data ele) => Data.Data.Data (GHC.Types.Unique.DFM.UniqDFM key ele)
instance Data.Foldable.Foldable (GHC.Types.Unique.DFM.UniqDFM key)
instance Data.Traversable.Traversable (GHC.Types.Unique.DFM.UniqDFM key)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.DFM.UniqDFM key a)
instance GHC.Classes.Eq val => GHC.Classes.Eq (GHC.Types.Unique.DFM.TaggedVal val)
module GHC.Types.Unique.Set
data UniqSet a
getUniqSet :: UniqSet a -> UniqFM a 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 key -> UniqFM key b -> UniqSet key
uniqSetMinusUDFM :: UniqSet key -> UniqDFM key b -> UniqSet key
intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a
disjointUniqSets :: UniqSet a -> UniqSet a -> Bool
restrictUniqSetToUFM :: UniqSet key -> UniqFM key b -> UniqSet key
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
-- | What's the point you might ask? We might have changed an object
-- without it's key changing. In which case this lookup makes sense.
lookupUniqSet :: Uniquable key => UniqSet key -> key -> Maybe key
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
-- [UniqSet invariant].
unsafeUFMToUniqSet :: UniqFM a a -> UniqSet a
nonDetEltsUniqSet :: UniqSet elt -> [elt]
nonDetKeysUniqSet :: UniqSet elt -> [Unique]
nonDetStrictFoldUniqSet :: (elt -> a -> a) -> a -> UniqSet elt -> a
instance GHC.Base.Monoid (GHC.Types.Unique.Set.UniqSet a)
instance GHC.Base.Semigroup (GHC.Types.Unique.Set.UniqSet a)
instance Data.Data.Data a => Data.Data.Data (GHC.Types.Unique.Set.UniqSet a)
instance GHC.Classes.Eq (GHC.Types.Unique.Set.UniqSet a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.Set.UniqSet a)
-- | Like a UniqDFM, but maintains equivalence classes of keys
-- sharing the same entry. See UniqSDFM.
module GHC.Types.Unique.SDFM
-- | A UniqDFM whose domain is sets of Uniques, each
-- of which share a common value of type ele. Every such set
-- ("equivalence class") has a distinct representative Unique.
-- Supports merging the entries of multiple such sets in a union-find
-- like fashion.
--
-- An accurate model is that of [(Set key, Maybe ele)]: A finite
-- mapping from sets of keys to possibly absent entries
-- ele, where the sets don't overlap. Example: m =
-- [({u1,u3}, Just ele1), ({u2}, Just ele2), ({u4,u7}, Nothing)] On
-- this model we support the following main operations:
--
--
-- - lookupUSDFM m u3 == Just ele1,
-- lookupUSDFM m u4 == Nothing, lookupUSDFM m
-- u5 == Nothing.
-- - equateUSDFM m u1 u3 is a no-op, but
-- equateUSDFM m u1 u2 merges {u1,u3} and
-- {u2} to point to Just ele2 and returns the old entry
-- of {u1,u3}, Just ele1.
-- - addToUSDFM m u3 ele4 sets the entry of
-- {u1,u3} to Just ele4.
--
--
-- As well as a few means for traversal/conversion to list.
data UniqSDFM key ele
emptyUSDFM :: UniqSDFM key ele
-- | lookupSUDFM env x looks up an entry for x, looking
-- through all Indirects until it finds a shared Entry.
--
-- Examples in terms of the model (see UniqSDFM): >>>
-- lookupUSDFM [({u1,u3}, Just ele1), ({u2}, Just ele2)] u3 == Just ele1
-- >>> lookupUSDFM [({u1,u3}, Just ele1), ({u2}, Just ele2)] u4
-- == Nothing >>> lookupUSDFM [({u1,u3}, Just ele1), ({u2},
-- Nothing)] u2 == Nothing
lookupUSDFM :: Uniquable key => UniqSDFM key ele -> key -> Maybe ele
-- | equateUSDFM env x y makes x and y point to
-- the same entry, thereby merging x's class with y's.
-- If both x and y are in the domain of the map, then
-- y's entry will be chosen as the new entry and x's
-- old entry will be returned.
--
-- Examples in terms of the model (see UniqSDFM): >>>
-- equateUSDFM [] u1 u2 == (Nothing, [({u1,u2}, Nothing)]) >>>
-- equateUSDFM [({u1,u3}, Just ele1)] u3 u4 == (Nothing, [({u1,u3,u4},
-- Just ele1)]) >>> equateUSDFM [({u1,u3}, Just ele1)] u4 u3 ==
-- (Nothing, [({u1,u3,u4}, Just ele1)]) >>> equateUSDFM
-- [({u1,u3}, Just ele1), ({u2}, Just ele2)] u3 u2 == (Just ele1,
-- [({u2,u1,u3}, Just ele2)])
equateUSDFM :: Uniquable key => UniqSDFM key ele -> key -> key -> (Maybe ele, UniqSDFM key ele)
-- | addToUSDFM env x a sets the entry x is associated
-- with to a, thereby modifying its whole equivalence class.
--
-- Examples in terms of the model (see UniqSDFM): >>>
-- addToUSDFM [] u1 ele1 == [({u1}, Just ele1)] >>> addToUSDFM
-- [({u1,u3}, Just ele1)] u3 ele2 == [({u1,u3}, Just ele2)]
addToUSDFM :: Uniquable key => UniqSDFM key ele -> key -> ele -> UniqSDFM key ele
traverseUSDFM :: forall key a b f. Applicative f => (a -> f b) -> UniqSDFM key a -> f (UniqSDFM key b)
instance (GHC.Utils.Outputable.Outputable key, GHC.Utils.Outputable.Outputable ele) => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.SDFM.UniqSDFM key ele)
instance (GHC.Utils.Outputable.Outputable key, GHC.Utils.Outputable.Outputable ele) => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.SDFM.Shared key ele)
-- | Specialised deterministic sets, for things with Uniques
--
-- Based on UniqDFMs (as you would expect). See Note
-- [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation
-- why we need it.
--
-- Basically, the things need to be in class Uniquable.
module GHC.Types.Unique.DSet
data UniqDSet a
getUniqDSet :: UniqDSet a -> UniqDFM a a
pprUniqDSet :: (a -> SDoc) -> UniqDSet a -> SDoc
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
uniqDSetIntersectUniqSet :: UniqDSet a -> UniqSet a -> UniqDSet a
nonDetStrictFoldUniqDSet :: (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)
mapUniqDSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b
instance Data.Data.Data a => Data.Data.Data (GHC.Types.Unique.DSet.UniqDSet a)
instance GHC.Classes.Eq (GHC.Types.Unique.DSet.UniqDSet a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Types.Unique.DSet.UniqDSet a)
-- | This module contains types that relate to the positions of things in
-- source files, and allow tagging of those things with locations
module GHC.Types.SrcLoc
-- | Real Source Location
--
-- Represents a single point within a file
data RealSrcLoc
-- | Source Location
data SrcLoc
RealSrcLoc :: !RealSrcLoc -> !Maybe BufPos -> 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
advanceBufPos :: BufPos -> BufPos
-- | 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 -> !Maybe BufSpan -> SrcSpan
UnhelpfulSpan :: !UnhelpfulSpanReason -> SrcSpan
data UnhelpfulSpanReason
UnhelpfulNoLocationInfo :: UnhelpfulSpanReason
UnhelpfulWiredIn :: UnhelpfulSpanReason
UnhelpfulInteractive :: UnhelpfulSpanReason
UnhelpfulGenerated :: UnhelpfulSpanReason
UnhelpfulOther :: !FastString -> UnhelpfulSpanReason
-- | 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
generatedSrcSpan :: SrcSpan
isGeneratedSrcSpan :: SrcSpan -> Bool
-- | 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. Returns UnhelpfulSpan if the files
-- differ.
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
pprUnhelpfulSpanReason :: UnhelpfulSpanReason -> SDoc
pprUserSpan :: Bool -> SrcSpan -> SDoc
unhelpfulSpanFS :: UnhelpfulSpanReason -> FastString
srcSpanToRealSrcSpan :: SrcSpan -> Maybe RealSrcSpan
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
-- | True if the span has a width of zero, as returned for "virtual"
-- semicolons in the lexer. For "bad" SrcSpan, it returns False
isZeroWidthSpan :: 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
-- | 0-based offset identifying the raw location in the
-- StringBuffer.
--
-- The lexer increments the BufPos every time a character (UTF-8
-- code point) is read from the input buffer. As UTF-8 is a
-- variable-length encoding and StringBuffer needs a byte offset
-- for indexing, a BufPos cannot be used for indexing.
--
-- The parser guarantees that BufPos are monotonic. See #17632.
-- This means that syntactic constructs that appear later in the
-- StringBuffer are guaranteed to have a higher BufPos.
-- Constrast that with RealSrcLoc, which does *not* make the
-- analogous guarantee about higher line/column numbers.
--
-- This is due to LINE ... #-} pragmas that can arbitrarily modify
-- RealSrcLoc. Notice how setSrcLoc and
-- resetAlrLastLoc in GHC.Parser.Lexer update
-- PsLoc, modifying RealSrcLoc but preserving
-- BufPos.
--
-- Monotonicity makes BufPos useful to determine the order in
-- which syntactic elements appear in the source. Consider this example
-- (haddockA041 in the test suite):
--
-- haddockA041.hs {--} -- | Module header documentation module
-- Comments_and_CPP_include where #include "IncludeMe.hs"
--
-- IncludeMe.hs: -- | Comment on T data T = MkT -- ^ Comment on MkT
--
-- After the C preprocessor runs, the StringBuffer will contain
-- a program that looks like this (unimportant lines at the beginning
-- removed):
--
-- # 1 "haddockA041.hs" {--} -- | Module header documentation module
-- Comments_and_CPP_include where # 1 "IncludeMe.hs" 1 -- | Comment on T
-- data T = MkT -- ^ Comment on MkT # 7 "haddockA041.hs" 2
--
-- The line pragmas inserted by CPP make the error messages more
-- informative. The downside is that we can't use RealSrcLoc to determine
-- the ordering of syntactic elements.
--
-- With RealSrcLoc, we have the following location information recorded
-- in the AST: * The module name is located at haddockA041.hs:3:8-31 *
-- The Haddock comment "Comment on T" is located at IncludeMe:1:1-17 *
-- The data declaration is located at IncludeMe.hs:2:1-32
--
-- Is the Haddock comment located between the module name and the data
-- declaration? This is impossible to tell because the locations are not
-- comparable; they even refer to different files.
--
-- On the other hand, with BufPos, we have the following location
-- information: * The module name is located at 846-870 * The Haddock
-- comment "Comment on T" is located at 898-915 * The data declaration is
-- located at 916-928
--
-- Aside: if you're wondering why the numbers are so high, try running
-- ghc -E haddockA041.hs and see the extra fluff that CPP
-- inserts at the start of the file.
--
-- For error messages, BufPos is not useful at all. On the other
-- hand, this is exactly what we need to determine the order of syntactic
-- elements: 870 < 898, therefore the Haddock comment appears *after*
-- the module name. 915 < 916, therefore the Haddock comment appears
-- *before* the data declaration.
--
-- We use BufPos in in GHC.Parser.PostProcess.Haddock to associate
-- Haddock comments with parts of the AST using location information
-- (#17544).
newtype BufPos
BufPos :: Int -> BufPos
[bufPos] :: BufPos -> Int
getBufPos :: SrcLoc -> Maybe BufPos
-- | StringBuffer Source Span
data BufSpan
BufSpan :: {-# UNPACK #-} !BufPos -> BufSpan
[bufSpanStart, bufSpanEnd] :: BufSpan -> {-# UNPACK #-} !BufPos
getBufSpan :: SrcSpan -> Maybe BufSpan
type Located = GenLocated SrcSpan
type RealLocated = GenLocated RealSrcSpan
-- | 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
unRealSrcSpan :: RealLocated a -> a
getRealSrcSpan :: RealLocated a -> RealSrcSpan
pprLocated :: (Outputable l, Outputable e) => GenLocated l e -> SDoc
-- | Always prints the location, even without -dppr-debug
pprLocatedAlways :: (Outputable l, Outputable e) => GenLocated l e -> SDoc
mapLoc :: (a -> b) -> GenLocated l a -> GenLocated l b
-- | Tests whether the two located things are equal
eqLocated :: Eq a => GenLocated l a -> GenLocated l a -> Bool
-- | Tests the ordering of the two located things
cmpLocated :: Ord a => GenLocated l a -> GenLocated l a -> Ordering
-- | Compare the BufSpan of two located things.
--
-- Precondition: both operands have an associated BufSpan.
cmpBufSpan :: HasDebugCallStack => 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
-- | Strategies for ordering SrcSpans
leftmost_smallest :: SrcSpan -> SrcSpan -> Ordering
-- | Strategies for ordering SrcSpans
leftmost_largest :: SrcSpan -> SrcSpan -> Ordering
-- | Strategies for ordering SrcSpans
rightmost_smallest :: 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
-- | Determines whether a span is enclosed by another one
isRealSubspanOf :: RealSrcSpan -> RealSrcSpan -> Bool
sortLocated :: [Located a] -> [Located a]
sortRealLocated :: [RealLocated a] -> [RealLocated a]
lookupSrcLoc :: SrcLoc -> Map RealSrcLoc a -> Maybe a
lookupSrcSpan :: SrcSpan -> Map RealSrcSpan a -> Maybe a
liftL :: Monad m => (a -> m b) -> GenLocated l a -> m (GenLocated l b)
-- | A location as produced by the parser. Consists of two components:
--
--
-- - The location in the file, adjusted for LINE ... #-} pragmas
-- (RealSrcLoc)
-- - The location in the string buffer (BufPos) with monotonicity
-- guarantees (see #17632)
--
data PsLoc
PsLoc :: !RealSrcLoc -> !BufPos -> PsLoc
[psRealLoc] :: PsLoc -> !RealSrcLoc
[psBufPos] :: PsLoc -> !BufPos
data PsSpan
PsSpan :: !RealSrcSpan -> !BufSpan -> PsSpan
[psRealSpan] :: PsSpan -> !RealSrcSpan
[psBufSpan] :: PsSpan -> !BufSpan
type PsLocated = GenLocated PsSpan
advancePsLoc :: PsLoc -> Char -> PsLoc
mkPsSpan :: PsLoc -> PsLoc -> PsSpan
psSpanStart :: PsSpan -> PsLoc
psSpanEnd :: PsSpan -> PsLoc
mkSrcSpanPs :: PsSpan -> SrcSpan
-- | 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
combineRealSrcSpans :: RealSrcSpan -> RealSrcSpan -> RealSrcSpan
psLocatedToLocated :: PsLocated a -> Located a
-- | Layout information for declarations.
data LayoutInfo
-- | Explicit braces written by the user.
--
--
-- class C a where { foo :: a; bar :: a }
--
ExplicitBraces :: LayoutInfo
-- | Virtual braces inserted by the layout algorithm.
--
--
-- class C a where
-- foo :: a
-- bar :: a
--
VirtualBraces :: !Int -> LayoutInfo
-- | Empty or compiler-generated blocks do not have layout information
-- associated with them.
NoLayoutInfo :: LayoutInfo
-- | Indentation level is 1-indexed, so the leftmost column is 1.
leftmostColumn :: Int
instance GHC.Classes.Ord GHC.Types.SrcLoc.RealSrcLoc
instance GHC.Classes.Eq GHC.Types.SrcLoc.RealSrcLoc
instance Data.Data.Data GHC.Types.SrcLoc.BufPos
instance GHC.Show.Show GHC.Types.SrcLoc.BufPos
instance GHC.Classes.Ord GHC.Types.SrcLoc.BufPos
instance GHC.Classes.Eq GHC.Types.SrcLoc.BufPos
instance GHC.Show.Show GHC.Types.SrcLoc.SrcLoc
instance GHC.Classes.Eq GHC.Types.SrcLoc.SrcLoc
instance GHC.Classes.Eq GHC.Types.SrcLoc.RealSrcSpan
instance Data.Data.Data GHC.Types.SrcLoc.BufSpan
instance GHC.Show.Show GHC.Types.SrcLoc.BufSpan
instance GHC.Classes.Ord GHC.Types.SrcLoc.BufSpan
instance GHC.Classes.Eq GHC.Types.SrcLoc.BufSpan
instance GHC.Show.Show GHC.Types.SrcLoc.UnhelpfulSpanReason
instance GHC.Classes.Eq GHC.Types.SrcLoc.UnhelpfulSpanReason
instance GHC.Show.Show GHC.Types.SrcLoc.SrcSpan
instance GHC.Classes.Eq GHC.Types.SrcLoc.SrcSpan
instance Data.Traversable.Traversable (GHC.Types.SrcLoc.GenLocated l)
instance Data.Foldable.Foldable (GHC.Types.SrcLoc.GenLocated l)
instance GHC.Base.Functor (GHC.Types.SrcLoc.GenLocated l)
instance (Data.Data.Data l, Data.Data.Data e) => Data.Data.Data (GHC.Types.SrcLoc.GenLocated l e)
instance (GHC.Show.Show l, GHC.Show.Show e) => GHC.Show.Show (GHC.Types.SrcLoc.GenLocated l e)
instance (GHC.Classes.Ord l, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Types.SrcLoc.GenLocated l e)
instance (GHC.Classes.Eq l, GHC.Classes.Eq e) => GHC.Classes.Eq (GHC.Types.SrcLoc.GenLocated l e)
instance GHC.Show.Show GHC.Types.SrcLoc.PsLoc
instance GHC.Classes.Ord GHC.Types.SrcLoc.PsLoc
instance GHC.Classes.Eq GHC.Types.SrcLoc.PsLoc
instance Data.Data.Data GHC.Types.SrcLoc.PsSpan
instance GHC.Show.Show GHC.Types.SrcLoc.PsSpan
instance GHC.Classes.Ord GHC.Types.SrcLoc.PsSpan
instance GHC.Classes.Eq GHC.Types.SrcLoc.PsSpan
instance Data.Data.Data GHC.Types.SrcLoc.LayoutInfo
instance GHC.Show.Show GHC.Types.SrcLoc.LayoutInfo
instance GHC.Classes.Ord GHC.Types.SrcLoc.LayoutInfo
instance GHC.Classes.Eq GHC.Types.SrcLoc.LayoutInfo
instance GHC.Utils.Outputable.Outputable e => GHC.Utils.Outputable.Outputable (GHC.Types.SrcLoc.Located e)
instance GHC.Utils.Outputable.Outputable e => GHC.Utils.Outputable.Outputable (GHC.Types.SrcLoc.GenLocated GHC.Types.SrcLoc.RealSrcSpan e)
instance Data.Data.Data GHC.Types.SrcLoc.SrcSpan
instance GHC.Utils.Json.ToJson GHC.Types.SrcLoc.SrcSpan
instance Control.DeepSeq.NFData GHC.Types.SrcLoc.SrcSpan
instance GHC.Utils.Outputable.Outputable GHC.Types.SrcLoc.SrcSpan
instance GHC.Utils.Outputable.Outputable GHC.Types.SrcLoc.UnhelpfulSpanReason
instance GHC.Base.Semigroup GHC.Types.SrcLoc.BufSpan
instance Data.Data.Data GHC.Types.SrcLoc.RealSrcSpan
instance GHC.Utils.Json.ToJson GHC.Types.SrcLoc.RealSrcSpan
instance GHC.Classes.Ord GHC.Types.SrcLoc.RealSrcSpan
instance GHC.Show.Show GHC.Types.SrcLoc.RealSrcSpan
instance GHC.Utils.Outputable.Outputable GHC.Types.SrcLoc.RealSrcSpan
instance GHC.Utils.Outputable.Outputable GHC.Types.SrcLoc.SrcLoc
instance GHC.Utils.Outputable.Outputable GHC.Types.SrcLoc.RealSrcLoc
instance GHC.Show.Show GHC.Types.SrcLoc.RealSrcLoc
module GHC.Tc.Types.Rank
data Rank
ArbitraryRank :: Rank
LimitedRank :: Bool -> Rank -> Rank
MonoTypeRankZero :: Rank
MonoTypeTyConArg :: Rank
MonoTypeSynArg :: Rank
MonoTypeConstraint :: Rank
MustBeMonoType :: Rank
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Rank.Rank
module GHC.Parser.Errors.Basic
-- | The operator symbol in the
-- PsOperatorWhitespaceExtConflictMessage diagnostic.
data OperatorWhitespaceSymbol
OperatorWhitespaceSymbol_PrefixPercent :: OperatorWhitespaceSymbol
OperatorWhitespaceSymbol_PrefixDollar :: OperatorWhitespaceSymbol
OperatorWhitespaceSymbol_PrefixDollarDollar :: OperatorWhitespaceSymbol
pprOperatorWhitespaceSymbol :: OperatorWhitespaceSymbol -> SDoc
-- | The operator occurrence type in the
-- PsOperatorWhitespaceMessage diagnostic.
data OperatorWhitespaceOccurrence
OperatorWhitespaceOccurrence_Prefix :: OperatorWhitespaceOccurrence
OperatorWhitespaceOccurrence_Suffix :: OperatorWhitespaceOccurrence
OperatorWhitespaceOccurrence_TightInfix :: OperatorWhitespaceOccurrence
module GHC.Data.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 GHC.Data.Pair.Pair
instance GHC.Base.Applicative GHC.Data.Pair.Pair
instance Data.Foldable.Foldable GHC.Data.Pair.Pair
instance Data.Traversable.Traversable GHC.Data.Pair.Pair
instance GHC.Base.Semigroup a => GHC.Base.Semigroup (GHC.Data.Pair.Pair a)
instance (GHC.Base.Semigroup a, GHC.Base.Monoid a) => GHC.Base.Monoid (GHC.Data.Pair.Pair a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Data.Pair.Pair a)
-- | Provide trees (of instructions), so that lists of instructions can be
-- appended in linear time.
module GHC.Data.OrdList
data OrdList a
pattern NilOL :: OrdList a
pattern ConsOL :: a -> OrdList a -> OrdList a
pattern SnocOL :: OrdList a -> a -> 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
headOL :: OrdList a -> a
mapOL :: (a -> b) -> OrdList a -> OrdList b
mapOL' :: (a -> b) -> OrdList a -> OrdList b
fromOL :: OrdList a -> [a]
toOL :: [a] -> OrdList a
foldrOL :: (a -> b -> b) -> b -> OrdList a -> b
-- | Strict left fold.
foldlOL :: (b -> a -> b) -> b -> OrdList a -> b
reverseOL :: OrdList a -> OrdList a
fromOLReverse :: OrdList a -> [a]
-- | Compare not only the values but also the structure of two lists
strictlyEqOL :: Eq a => OrdList a -> OrdList a -> Bool
-- | Compare not only the values but also the structure of two lists
strictlyOrdOL :: Ord a => OrdList a -> OrdList a -> Ordering
instance GHC.Base.Functor GHC.Data.OrdList.OrdList
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Data.OrdList.OrdList a)
instance GHC.Base.Semigroup (GHC.Data.OrdList.OrdList a)
instance GHC.Base.Monoid (GHC.Data.OrdList.OrdList a)
instance Data.Foldable.Foldable GHC.Data.OrdList.OrdList
instance Data.Traversable.Traversable GHC.Data.OrdList.OrdList
-- | Set-like operations on lists
--
-- Avoid using them as much as possible
module GHC.Data.List.SetOps
-- | Assumes that the arguments contain no duplicates
unionLists :: (HasDebugCallStack, Outputable a, Eq a) => [a] -> [a] -> [a]
-- | Calculate the set difference of two lists. This is O((m + n) log
-- n), where we subtract a list of n elements from a list of
-- m elements.
--
-- Extremely short cases are handled specially: When m or n
-- is 0, this takes O(1) time. When m is 1, it takes
-- O(n) time.
minusList :: Ord a => [a] -> [a] -> [a]
-- | A finite mapping based on equality and association lists.
type Assoc a b = [(a, b)]
assoc :: Eq a => String -> Assoc a b -> a -> b
-- | Lookup key, fail gracefully using Nothing if not found.
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
-- | Remove the duplicates from a list using the provided comparison
-- function.
--
-- Returns the list without duplicates, and accumulates all the
-- duplicates in the second component of its result.
removeDups :: (a -> a -> Ordering) -> [a] -> ([a], [NonEmpty a])
-- | Remove the duplicates from a list using the provided comparison
-- function.
nubOrdBy :: (a -> a -> Ordering) -> [a] -> [a]
findDupsEq :: (a -> a -> Bool) -> [a] -> [NonEmpty a]
equivClasses :: (a -> a -> Ordering) -> [a] -> [NonEmpty a]
getNth :: Outputable a => [a] -> Int -> a
isIn :: Eq a => String -> a -> [a] -> Bool
isn'tIn :: Eq a => String -> a -> [a] -> Bool
module GHC.Data.Graph.Directed
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
-- | Representation for nodes of the Graph.
--
--
-- - The payload is user data, just carried around in this
-- module
-- - The key is the node identifier. Key has an Ord instance
-- for performance reasons.
-- - The [key] are the dependencies of the node; it's ok to
-- have extra keys in the dependencies that are not the key of any Node
-- in the graph
--
data Node key payload
DigraphNode :: payload -> key -> [key] -> Node key payload
-- | User data
[node_payload] :: Node key payload -> payload
-- | User defined node id
[node_key] :: Node key payload -> key
-- | Dependencies/successors of the node
[node_dependencies] :: Node key payload -> [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]
verticesG :: Graph node -> [node]
edgesG :: Graph node -> [Edge node]
hasVertexG :: Graph node -> node -> Bool
reachableG :: Graph node -> node -> [node]
-- | Given a list of roots return all reachable nodes.
reachablesG :: Graph node -> [node] -> [node]
transposeG :: Graph node -> Graph node
-- | Efficiently construct a map which maps each key to it's set of
-- transitive dependencies.
allReachable :: Ord key => Graph node -> (node -> key) -> Map key (Set key)
outgoingG :: Graph node -> node -> [node]
emptyG :: Graph node -> Bool
-- | 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)]
-- | Edge direction based on DFS Classification
data EdgeType
Forward :: EdgeType
Cross :: EdgeType
-- | Loop back towards the root node. Eg backjumps in loops
Backward :: EdgeType
-- | v -> v
SelfLoop :: EdgeType
-- | Given a start vertex, a way to get successors from a node and a list
-- of (directed) edges classify the types of edges.
classifyEdges :: forall key. Uniquable key => key -> (key -> [key]) -> [(key, key)] -> [((key, key), EdgeType)]
instance GHC.Classes.Ord GHC.Data.Graph.Directed.EdgeType
instance GHC.Classes.Eq GHC.Data.Graph.Directed.EdgeType
instance GHC.Utils.Outputable.Outputable GHC.Data.Graph.Directed.Time
instance GHC.Num.Num GHC.Data.Graph.Directed.Time
instance GHC.Classes.Ord GHC.Data.Graph.Directed.Time
instance GHC.Classes.Eq GHC.Data.Graph.Directed.Time
instance GHC.Utils.Outputable.Outputable GHC.Data.Graph.Directed.EdgeType
instance GHC.Utils.Outputable.Outputable node => GHC.Utils.Outputable.Outputable (GHC.Data.Graph.Directed.Graph node)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b) => GHC.Utils.Outputable.Outputable (GHC.Data.Graph.Directed.Node a b)
instance GHC.Utils.Outputable.Outputable node => GHC.Utils.Outputable.Outputable (GHC.Data.Graph.Directed.Edge node)
module GHC.Data.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
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
nonEmptyToBag :: NonEmpty a -> Bag a
bagToList :: Bag a -> [a]
headMaybe :: Bag a -> Maybe a
mapAccumBagL :: (acc -> x -> (acc, y)) -> acc -> Bag x -> (acc, Bag y)
concatMapBag :: (a -> Bag b) -> Bag a -> Bag b
concatMapBagPair :: (a -> (Bag b, Bag c)) -> Bag a -> (Bag b, Bag c)
mapMaybeBag :: (a -> Maybe b) -> Bag a -> Bag 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 GHC.Base.Functor GHC.Data.Bag.Bag
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Data.Bag.Bag a)
instance Data.Data.Data a => Data.Data.Data (GHC.Data.Bag.Bag a)
instance Data.Foldable.Foldable GHC.Data.Bag.Bag
instance Data.Traversable.Traversable GHC.Data.Bag.Bag
instance GHC.Exts.IsList (GHC.Data.Bag.Bag a)
instance GHC.Base.Semigroup (GHC.Data.Bag.Bag a)
instance GHC.Base.Monoid (GHC.Data.Bag.Bag a)
module GHC.Utils.Binary
data Bin a
-- | Do not rely on instance sizes for general types, we use variable
-- length encoding for many of them.
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
data BinData
BinData :: Int -> BinArray -> BinData
dataHandle :: BinData -> IO BinHandle
handleData :: BinHandle -> IO BinData
openBinMem :: Int -> IO BinHandle
seekBin :: BinHandle -> Bin a -> IO ()
tellBin :: BinHandle -> IO (Bin a)
castBin :: Bin a -> Bin b
-- | Get access to the underlying buffer.
withBinBuffer :: BinHandle -> (ByteString -> IO a) -> IO a
foldGet :: Binary a => Word -> BinHandle -> b -> (Word -> a -> b -> IO b) -> IO b
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
putULEB128 :: forall a. (Integral a, FiniteBits a) => BinHandle -> a -> IO ()
getULEB128 :: forall a. (Integral a, FiniteBits a) => BinHandle -> IO a
putSLEB128 :: forall a. (Integral a, Bits a) => BinHandle -> a -> IO ()
getSLEB128 :: forall a. (Show a, Integral a, FiniteBits a) => BinHandle -> IO a
-- | Encode the argument in it's full length. This is different from many
-- default binary instances which make no guarantee about the actual
-- encoding and might do things use variable length encoding.
newtype FixedLengthEncoding a
FixedLengthEncoding :: a -> FixedLengthEncoding a
[unFixedLength] :: FixedLengthEncoding a -> a
lazyGet :: Binary a => BinHandle -> IO a
lazyPut :: Binary a => BinHandle -> a -> IO ()
-- | Deserialize a value serialized by lazyPutMaybe.
lazyGetMaybe :: Binary a => BinHandle -> IO (Maybe a)
-- | Serialize the constructor strictly but lazily serialize a value inside
-- a Just.
--
-- This way we can check for the presence of a value without
-- deserializing the value itself.
lazyPutMaybe :: Binary a => BinHandle -> Maybe 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
-- GHC.Iface.Binary).
-- - 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 FastString (Int, FastString) -> IO ()
getDictionary :: BinHandle -> IO Dictionary
putFS :: BinHandle -> FastString -> IO ()
instance forall k (a :: k). GHC.Enum.Bounded (GHC.Utils.Binary.Bin a)
instance forall k (a :: k). GHC.Show.Show (GHC.Utils.Binary.Bin a)
instance forall k (a :: k). GHC.Classes.Ord (GHC.Utils.Binary.Bin a)
instance forall k (a :: k). GHC.Classes.Eq (GHC.Utils.Binary.Bin a)
instance GHC.Utils.Binary.Binary GHC.Data.FastString.NonDetFastString
instance GHC.Utils.Binary.Binary GHC.Data.FastString.LexicalFastString
instance GHC.Utils.Binary.Binary GHC.Utils.Binary.BinData
instance GHC.Utils.Binary.Binary (GHC.Utils.Binary.FixedLengthEncoding GHC.Word.Word8)
instance GHC.Utils.Binary.Binary (GHC.Utils.Binary.FixedLengthEncoding GHC.Word.Word16)
instance GHC.Utils.Binary.Binary (GHC.Utils.Binary.FixedLengthEncoding GHC.Word.Word32)
instance GHC.Utils.Binary.Binary (GHC.Utils.Binary.FixedLengthEncoding GHC.Word.Word64)
instance GHC.Utils.Binary.Binary GHC.Word.Word8
instance GHC.Utils.Binary.Binary GHC.Word.Word16
instance GHC.Utils.Binary.Binary GHC.Word.Word32
instance GHC.Utils.Binary.Binary GHC.Word.Word64
instance GHC.Utils.Binary.Binary GHC.Int.Int8
instance GHC.Utils.Binary.Binary GHC.Int.Int16
instance GHC.Utils.Binary.Binary GHC.Int.Int32
instance GHC.Utils.Binary.Binary GHC.Int.Int64
instance GHC.Utils.Binary.Binary ()
instance GHC.Utils.Binary.Binary GHC.Types.Bool
instance GHC.Utils.Binary.Binary GHC.Types.Char
instance GHC.Utils.Binary.Binary GHC.Types.Int
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary [a]
instance (GHC.Utils.Binary.Binary a, GHC.Classes.Ord a) => GHC.Utils.Binary.Binary (Data.Set.Internal.Set a)
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Base.NonEmpty a)
instance (GHC.Ix.Ix a, GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b) => GHC.Utils.Binary.Binary (GHC.Arr.Array a b)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b) => GHC.Utils.Binary.Binary (a, b)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b, GHC.Utils.Binary.Binary c) => GHC.Utils.Binary.Binary (a, b, c)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b, GHC.Utils.Binary.Binary c, GHC.Utils.Binary.Binary d) => GHC.Utils.Binary.Binary (a, b, c, d)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b, GHC.Utils.Binary.Binary c, GHC.Utils.Binary.Binary d, GHC.Utils.Binary.Binary e) => GHC.Utils.Binary.Binary (a, b, c, d, e)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b, GHC.Utils.Binary.Binary c, GHC.Utils.Binary.Binary d, GHC.Utils.Binary.Binary e, GHC.Utils.Binary.Binary f) => GHC.Utils.Binary.Binary (a, b, c, d, e, f)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b, GHC.Utils.Binary.Binary c, GHC.Utils.Binary.Binary d, GHC.Utils.Binary.Binary e, GHC.Utils.Binary.Binary f, GHC.Utils.Binary.Binary g) => GHC.Utils.Binary.Binary (a, b, c, d, e, f, g)
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Maybe.Maybe a)
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Data.Strict.Maybe a)
instance (GHC.Utils.Binary.Binary a, GHC.Utils.Binary.Binary b) => GHC.Utils.Binary.Binary (Data.Either.Either a b)
instance GHC.Utils.Binary.Binary Data.Time.Clock.Internal.UTCTime.UTCTime
instance GHC.Utils.Binary.Binary Data.Time.Calendar.Days.Day
instance GHC.Utils.Binary.Binary Data.Time.Clock.Internal.DiffTime.DiffTime
instance GHC.Utils.Binary.Binary GHC.Integer.Type.Integer
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Real.Ratio a)
instance forall k (a :: k). GHC.Utils.Binary.Binary (GHC.Utils.Binary.Bin a)
instance GHC.Utils.Binary.Binary Data.ByteString.Internal.ByteString
instance GHC.Utils.Binary.Binary GHC.Data.FastString.FastString
instance GHC.Utils.Binary.Binary GHC.Fingerprint.Type.Fingerprint
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Types.SrcLoc.Located a)
instance GHC.Utils.Binary.Binary GHC.Types.SrcLoc.RealSrcSpan
instance GHC.Utils.Binary.Binary GHC.Types.SrcLoc.BufPos
instance GHC.Utils.Binary.Binary GHC.Types.SrcLoc.BufSpan
instance GHC.Utils.Binary.Binary GHC.Types.SrcLoc.UnhelpfulSpanReason
instance GHC.Utils.Binary.Binary GHC.Types.SrcLoc.SrcSpan
instance GHC.Utils.Binary.Binary v => GHC.Utils.Binary.Binary (Data.IntMap.Internal.IntMap v)
instance Control.DeepSeq.NFData GHC.Utils.Binary.BinData
-- | Orphan Binary instances for Data.Typeable stuff
module GHC.Utils.Binary.Typeable
getSomeTypeRep :: BinHandle -> IO SomeTypeRep
instance GHC.Utils.Binary.Binary GHC.Types.TyCon
instance GHC.Utils.Binary.Binary Data.Typeable.Internal.SomeTypeRep
instance forall k (a :: k). Data.Typeable.Internal.Typeable a => GHC.Utils.Binary.Binary (Data.Typeable.Internal.TypeRep a)
instance GHC.Utils.Binary.Binary GHC.Types.VecCount
instance GHC.Utils.Binary.Binary GHC.Types.VecElem
instance GHC.Utils.Binary.Binary GHC.Types.RuntimeRep
instance GHC.Utils.Binary.Binary GHC.Types.KindRep
instance GHC.Utils.Binary.Binary GHC.Types.TypeLitSort
instance GHC.Utils.Binary.Binary GHC.Serialized.Serialized
-- | The ModuleName type
module GHC.Unit.Module.Name
-- | 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
mkModuleName :: String -> ModuleName
mkModuleNameFS :: FastString -> ModuleName
-- | Compares module names lexically, rather than by their Uniques
stableModuleNameCmp :: ModuleName -> ModuleName -> Ordering
parseModuleName :: ReadP ModuleName
instance GHC.Show.Show GHC.Unit.Module.Name.ModuleName
instance GHC.Types.Unique.Uniquable GHC.Unit.Module.Name.ModuleName
instance GHC.Classes.Eq GHC.Unit.Module.Name.ModuleName
instance GHC.Classes.Ord GHC.Unit.Module.Name.ModuleName
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Name.ModuleName
instance GHC.Utils.Binary.Binary GHC.Unit.Module.Name.ModuleName
instance Data.Data.Data GHC.Unit.Module.Name.ModuleName
instance Control.DeepSeq.NFData GHC.Unit.Module.Name.ModuleName
-- | Unit & Module types
--
-- This module is used to resolve the loops between Unit and Module types
-- (Module references a Unit and vice-versa).
module GHC.Unit.Types
-- | A generic module is a pair of a unit identifier and a
-- ModuleName.
data GenModule unit
Module :: !unit -> !ModuleName -> GenModule unit
-- | Unit the module belongs to
[moduleUnit] :: GenModule unit -> !unit
-- | Module name (e.g. A.B.C)
[moduleName] :: GenModule unit -> !ModuleName
-- | A Module is a pair of a Unit and a ModuleName.
type Module = GenModule Unit
-- | A InstalledModule is a Module whose unit is identified
-- with an UnitId.
type InstalledModule = GenModule UnitId
-- | A HomeUnitModule is like an InstalledModule but we
-- expect to find it in one of the home units rather than the package
-- database.
type HomeUnitModule = GenModule UnitId
-- | An InstantiatedModule is a Module whose unit is
-- identified with an InstantiatedUnit.
type InstantiatedModule = GenModule InstantiatedUnit
mkModule :: u -> ModuleName -> GenModule u
moduleUnitId :: Module -> UnitId
pprModule :: Module -> SDoc
pprInstantiatedModule :: InstantiatedModule -> SDoc
-- | 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 :: GenModule (GenUnit u) -> UniqDSet ModuleName
-- | Class for types that are used as unit identifiers (UnitKey, UnitId,
-- Unit)
--
-- We need this class because we create new unit ids for virtual units
-- (see VirtUnit) and they have to to be made from units with different
-- kinds of identifiers.
class IsUnitId u
-- | 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 Unit:
--
-- 1) It can be a RealUnit, in which case we just have a
-- DefUnitId that uniquely identifies some fully compiled,
-- installed library we have on disk.
--
-- 2) It can be an VirtUnit. 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 InstantiatedUnit, which explicitly records
-- the instantiation, so that we can substitute over it.
data GenUnit uid
-- | Installed definite unit (either a fully instantiated unit or a closed
-- unit)
RealUnit :: !Definite uid -> GenUnit uid
-- | Virtual unit instantiated on-the-fly. It may be definite if all the
-- holes are instantiated but we don't have code objects for it.
VirtUnit :: {-# UNPACK #-} !GenInstantiatedUnit uid -> GenUnit uid
-- | Fake hole unit
HoleUnit :: GenUnit uid
type Unit = GenUnit UnitId
-- | A UnitId identifies a built library in a database and is used to
-- generate unique symbols, etc. It's usually of the form:
--
-- pkgname-1.2:libname+hash
--
-- These UnitId 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 as we can cheaply instantiate them
-- on-the-fly, cf VirtUnit). Put another way, an installed unit id is
-- either fully instantiated, or not instantiated at all.
newtype UnitId
UnitId :: FastString -> UnitId
-- | The full hashed unit identifier, including the component id and the
-- hash.
[unitIdFS] :: UnitId -> FastString
-- | A unit key in the database
newtype UnitKey
UnitKey :: FastString -> UnitKey
-- | An instantiated unit.
--
-- It identifies an indefinite library (with holes) that has been
-- instantiated.
--
-- This unit may be indefinite or not (i.e. with remaining holes or not).
-- If it is definite, we don't know if it has already been compiled and
-- installed in a database. Nevertheless, we have a mechanism called
-- "improvement" to try to match a fully instantiated unit with existing
-- compiled and installed units: see Note [VirtUnit to RealUnit
-- improvement].
--
-- An indefinite unit identifier pretty-prints to something like
-- p[H=H,A=aimpl:A>] (p is the UnitId,
-- and the brackets enclose the module substitution).
data GenInstantiatedUnit unit
InstantiatedUnit :: !FastString -> !Unique -> !unit -> !GenInstantiations unit -> UniqDSet ModuleName -> GenInstantiatedUnit unit
-- | A private, uniquely identifying representation of an InstantiatedUnit.
-- This string is completely private to GHC and is just used to get a
-- unique.
[instUnitFS] :: GenInstantiatedUnit unit -> !FastString
-- | Cached unique of unitFS.
[instUnitKey] :: GenInstantiatedUnit unit -> !Unique
-- | The (indefinite) unit being instantiated.
[instUnitInstanceOf] :: GenInstantiatedUnit unit -> !unit
-- | The sorted (by ModuleName) instantiations of this unit.
[instUnitInsts] :: GenInstantiatedUnit unit -> !GenInstantiations unit
-- | A cache of the free module holes of instUnitInsts. This lets us
-- efficiently tell if a InstantiatedUnit has been fully
-- instantiated (empty set of free module holes) and whether or not a
-- substitution can have any effect.
[instUnitHoles] :: GenInstantiatedUnit unit -> UniqDSet ModuleName
type InstantiatedUnit = GenInstantiatedUnit UnitId
-- | A DefUnitId is an UnitId with the invariant that it only
-- refers to a definite library; i.e., one we have generated code for.
type DefUnitId = Definite UnitId
type Instantiations = GenInstantiations UnitId
type GenInstantiations unit = [(ModuleName, GenModule (GenUnit unit))]
-- | Create a new GenInstantiatedUnit given an explicit module
-- substitution.
mkInstantiatedUnit :: IsUnitId u => u -> GenInstantiations u -> GenInstantiatedUnit u
-- | Generate a uniquely identifying hash (internal unit-id) for an
-- instantiated unit.
--
-- This is a one-way function. If the indefinite unit has not been
-- instantiated at all, we return its unit-id.
--
-- This hash is completely internal to GHC and is not used for symbol
-- names or file paths. It is different from the hash Cabal would produce
-- for the same instantiated unit.
mkInstantiatedUnitHash :: IsUnitId u => u -> [(ModuleName, GenModule (GenUnit u))] -> FastString
-- | Smart constructor for instantiated GenUnit
mkVirtUnit :: IsUnitId u => u -> [(ModuleName, GenModule (GenUnit u))] -> GenUnit u
-- | Map over the unit type of a GenUnit
mapGenUnit :: IsUnitId v => (u -> v) -> GenUnit u -> GenUnit v
-- | Map over the unit identifier of unit instantiations.
mapInstantiations :: IsUnitId v => (u -> v) -> GenInstantiations u -> GenInstantiations v
-- | Retrieve the set of free module holes of a Unit.
unitFreeModuleHoles :: GenUnit u -> UniqDSet ModuleName
-- | Create a new simple unit identifier from a FastString.
-- Internally, this is primarily used to specify wired-in unit
-- identifiers.
fsToUnit :: FastString -> Unit
unitFS :: IsUnitId u => u -> FastString
unitString :: IsUnitId u => u -> String
-- | Return the UnitId of the Unit. For on-the-fly instantiated units,
-- return the UnitId of the indefinite unit this unit is an instance of.
toUnitId :: Unit -> UnitId
-- | Return the virtual UnitId of an on-the-fly instantiated unit.
virtualUnitId :: InstantiatedUnit -> UnitId
stringToUnit :: String -> Unit
-- | Compares unit ids lexically, rather than by their Uniques
stableUnitCmp :: Unit -> Unit -> Ordering
-- | A Unit is definite if it has no free holes.
unitIsDefinite :: Unit -> Bool
isHoleUnit :: GenUnit u -> Bool
unitIdString :: UnitId -> String
stringToUnitId :: String -> UnitId
-- | A definite unit (i.e. without any free module hole)
newtype Definite unit
Definite :: unit -> Definite unit
[unDefinite] :: Definite unit -> unit
primUnitId :: UnitId
bignumUnitId :: UnitId
baseUnitId :: UnitId
rtsUnitId :: UnitId
thUnitId :: 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
interactiveUnitId :: UnitId
primUnit :: Unit
bignumUnit :: Unit
baseUnit :: Unit
rtsUnit :: Unit
thUnit :: Unit
mainUnit :: Unit
thisGhcUnit :: Unit
interactiveUnit :: Unit
isInteractiveModule :: Module -> Bool
wiredInUnitIds :: [UnitId]
-- | Indicates whether a module name is referring to a boot interface
-- (hs-boot file) or regular module (hs file). 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 IsBootInterface
NotBoot :: IsBootInterface
IsBoot :: IsBootInterface
-- | This data type just pairs a value mod with an IsBootInterface
-- flag. In practice, mod is usually a Module or
-- ModuleName'.
data GenWithIsBoot mod
GWIB :: mod -> IsBootInterface -> GenWithIsBoot mod
[gwib_mod] :: GenWithIsBoot mod -> mod
[gwib_isBoot] :: GenWithIsBoot mod -> IsBootInterface
type ModuleNameWithIsBoot = GenWithIsBoot ModuleName
type ModuleWithIsBoot = GenWithIsBoot Module
instance GHC.Base.Functor GHC.Unit.Types.GenModule
instance Data.Data.Data unit => Data.Data.Data (GHC.Unit.Types.GenModule unit)
instance GHC.Classes.Ord unit => GHC.Classes.Ord (GHC.Unit.Types.GenModule unit)
instance GHC.Classes.Eq unit => GHC.Classes.Eq (GHC.Unit.Types.GenModule unit)
instance Data.Data.Data GHC.Unit.Types.UnitId
instance GHC.Unit.Types.IsUnitId unit => GHC.Unit.Types.IsUnitId (GHC.Unit.Types.Definite unit)
instance GHC.Types.Unique.Uniquable unit => GHC.Types.Unique.Uniquable (GHC.Unit.Types.Definite unit)
instance GHC.Utils.Binary.Binary unit => GHC.Utils.Binary.Binary (GHC.Unit.Types.Definite unit)
instance GHC.Utils.Outputable.Outputable unit => GHC.Utils.Outputable.Outputable (GHC.Unit.Types.Definite unit)
instance GHC.Classes.Ord unit => GHC.Classes.Ord (GHC.Unit.Types.Definite unit)
instance GHC.Classes.Eq unit => GHC.Classes.Eq (GHC.Unit.Types.Definite unit)
instance GHC.Base.Functor GHC.Unit.Types.Definite
instance Data.Data.Data GHC.Unit.Types.IsBootInterface
instance GHC.Show.Show GHC.Unit.Types.IsBootInterface
instance GHC.Classes.Ord GHC.Unit.Types.IsBootInterface
instance GHC.Classes.Eq GHC.Unit.Types.IsBootInterface
instance Data.Traversable.Traversable GHC.Unit.Types.GenWithIsBoot
instance Data.Foldable.Foldable GHC.Unit.Types.GenWithIsBoot
instance GHC.Base.Functor GHC.Unit.Types.GenWithIsBoot
instance GHC.Show.Show mod => GHC.Show.Show (GHC.Unit.Types.GenWithIsBoot mod)
instance GHC.Classes.Ord mod => GHC.Classes.Ord (GHC.Unit.Types.GenWithIsBoot mod)
instance GHC.Classes.Eq mod => GHC.Classes.Eq (GHC.Unit.Types.GenWithIsBoot mod)
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Unit.Types.GenWithIsBoot a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Unit.Types.GenWithIsBoot a)
instance GHC.Utils.Binary.Binary GHC.Unit.Types.IsBootInterface
instance GHC.Types.Unique.Uniquable GHC.Unit.Types.Module
instance GHC.Utils.Outputable.Outputable GHC.Unit.Types.Module
instance GHC.Classes.Ord GHC.Unit.Types.Unit
instance Data.Data.Data GHC.Unit.Types.Unit
instance Control.DeepSeq.NFData GHC.Unit.Types.Unit
instance GHC.Utils.Outputable.Outputable GHC.Unit.Types.Unit
instance GHC.Show.Show GHC.Unit.Types.Unit
instance GHC.Utils.Binary.Binary GHC.Unit.Types.Unit
instance GHC.Utils.Outputable.Outputable GHC.Unit.Types.InstantiatedModule
instance GHC.Utils.Outputable.Outputable GHC.Unit.Types.InstantiatedUnit
instance GHC.Utils.Binary.Binary GHC.Unit.Types.InstantiatedUnit
instance GHC.Unit.Types.IsUnitId u => GHC.Unit.Types.IsUnitId (GHC.Unit.Types.GenUnit u)
instance GHC.Classes.Eq (GHC.Unit.Types.GenInstantiatedUnit unit)
instance GHC.Classes.Ord (GHC.Unit.Types.GenInstantiatedUnit unit)
instance GHC.Unit.Types.IsUnitId u => GHC.Classes.Eq (GHC.Unit.Types.GenUnit u)
instance GHC.Unit.Types.IsUnitId u => GHC.Types.Unique.Uniquable (GHC.Unit.Types.GenUnit u)
instance GHC.Utils.Outputable.Outputable GHC.Unit.Types.InstalledModule
instance GHC.Unit.Types.IsUnitId GHC.Unit.Types.UnitId
instance GHC.Utils.Binary.Binary GHC.Unit.Types.UnitId
instance GHC.Classes.Eq GHC.Unit.Types.UnitId
instance GHC.Classes.Ord GHC.Unit.Types.UnitId
instance GHC.Types.Unique.Uniquable GHC.Unit.Types.UnitId
instance GHC.Utils.Outputable.Outputable GHC.Unit.Types.UnitId
instance GHC.Unit.Types.IsUnitId GHC.Unit.Types.UnitKey
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Unit.Types.GenModule a)
instance Control.DeepSeq.NFData (GHC.Unit.Types.GenModule a)
-- | Module location
module GHC.Unit.Module.Location
-- | Module Location
--
-- Where a module lives on the file system: the actual locations of the
-- .hs, .hi, .dyn_hi, .o, .dyn_o and .hie files, if we have them.
--
-- For a module in another unit, the ml_hs_file and ml_obj_file
-- components of ModLocation are undefined.
--
-- The locations specified by a ModLocation may or may not correspond to
-- actual files yet: for example, even if the object file doesn't exist,
-- the ModLocation still contains the path to where the object file will
-- reside if/when it is created.
--
-- The paths of anything which can affect recompilation should be placed
-- inside ModLocation.
--
-- When a ModLocation is created none of the filepaths will have -boot
-- suffixes. This is because in --make mode the ModLocation is put in the
-- finder cache which is indexed by ModuleName, when a ModLocation is
-- retrieved from the FinderCache the boot suffixes are appended. The
-- other case is in -c mode, there the ModLocation immediately gets given
-- the boot suffixes in mkOneShotModLocation.
data ModLocation
ModLocation :: Maybe FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> ModLocation
-- | The source file, if we have one. Package modules probably don't have
-- source files.
[ml_hs_file] :: ModLocation -> Maybe FilePath
-- | Where the .hi file is, whether or not it exists yet. Always of form
-- foo.hi, even if there is an hi-boot file (we add the -boot suffix
-- later)
[ml_hi_file] :: ModLocation -> FilePath
-- | Where the .dyn_hi file is, whether or not it exists yet.
[ml_dyn_hi_file] :: ModLocation -> FilePath
-- | Where the .o file is, whether or not it exists yet. (might not exist
-- either because the module hasn't been compiled yet, or because it is
-- part of a unit with a .a file)
[ml_obj_file] :: ModLocation -> FilePath
-- | Where the .dy file is, whether or not it exists yet.
[ml_dyn_obj_file] :: ModLocation -> FilePath
-- | Where the .hie file is, whether or not it exists yet.
[ml_hie_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 :: IsBootInterface -> FilePath -> FilePath
addBootSuffixLocn_maybe :: IsBootInterface -> ModLocation -> ModLocation
-- | Add the -boot suffix to all file paths associated with the
-- module
addBootSuffixLocn :: ModLocation -> ModLocation
-- | Add the -boot suffix to all output file paths associated with
-- the module, not including the input file itself
addBootSuffixLocnOut :: ModLocation -> ModLocation
-- | Remove the -boot suffix to .hs, .hi and .o files
removeBootSuffix :: FilePath -> FilePath
instance GHC.Show.Show GHC.Unit.Module.Location.ModLocation
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Location.ModLocation
-- | Parsers for unit/module identifiers
module GHC.Unit.Parser
parseUnit :: ReadP Unit
parseUnitId :: ReadP UnitId
parseHoleyModule :: ReadP Module
parseModSubst :: ReadP [(ModuleName, Module)]
-- | Module environment
module GHC.Unit.Module.Env
-- | 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
partitionModuleEnv :: (a -> Bool) -> ModuleEnv a -> (ModuleEnv a, 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 ModuleName 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 ModuleName elt
-- | A set of Modules
type ModuleSet = Set NDModule
emptyModuleSet :: ModuleSet
mkModuleSet :: [Module] -> ModuleSet
moduleSetElts :: ModuleSet -> [Module]
extendModuleSet :: ModuleSet -> Module -> ModuleSet
extendModuleSetList :: ModuleSet -> [Module] -> ModuleSet
delModuleSet :: ModuleSet -> Module -> ModuleSet
elemModuleSet :: Module -> ModuleSet -> Bool
intersectModuleSet :: ModuleSet -> ModuleSet -> ModuleSet
minusModuleSet :: ModuleSet -> ModuleSet -> ModuleSet
unionModuleSet :: ModuleSet -> ModuleSet -> ModuleSet
unitModuleSet :: Module -> ModuleSet
isEmptyModuleSet :: ModuleSet -> Bool
unionManyModuleSets :: [ModuleSet] -> ModuleSet
-- | A map keyed off of InstalledModule
data InstalledModuleEnv elt
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
mergeInstalledModuleEnv :: (elta -> eltb -> Maybe eltc) -> (InstalledModuleEnv elta -> InstalledModuleEnv eltc) -> (InstalledModuleEnv eltb -> InstalledModuleEnv eltc) -> InstalledModuleEnv elta -> InstalledModuleEnv eltb -> InstalledModuleEnv eltc
plusInstalledModuleEnv :: (elt -> elt -> elt) -> InstalledModuleEnv elt -> InstalledModuleEnv elt -> InstalledModuleEnv elt
installedModuleEnvElts :: InstalledModuleEnv a -> [(InstalledModule, a)]
instance GHC.Classes.Eq GHC.Unit.Module.Env.NDModule
instance GHC.Utils.Outputable.Outputable elt => GHC.Utils.Outputable.Outputable (GHC.Unit.Module.Env.InstalledModuleEnv elt)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Unit.Module.Env.ModuleEnv a)
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Env.NDModule
instance GHC.Classes.Ord GHC.Unit.Module.Env.NDModule
-- | This data structure holds an updateable environment which is used when
-- compiling module loops.
module GHC.Driver.Env.KnotVars
data KnotVars a
KnotVars :: [Module] -> (Module -> Maybe a) -> KnotVars a
[kv_domain] :: KnotVars a -> [Module]
[kv_lookup] :: KnotVars a -> Module -> Maybe a
NoKnotVars :: KnotVars a
emptyKnotVars :: KnotVars a
knotVarsFromModuleEnv :: ModuleEnv a -> KnotVars a
knotVarElems :: KnotVars a -> [a]
lookupKnotVars :: KnotVars a -> Module -> Maybe a
knotVarsWithout :: Module -> KnotVars a -> KnotVars a
instance GHC.Base.Functor GHC.Driver.Env.KnotVars.KnotVars
instance GHC.Utils.Outputable.Outputable (GHC.Driver.Env.KnotVars.KnotVars a)
module GHC.Unit.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.
getModuleInstantiation :: Module -> (InstalledModule, Maybe InstantiatedModule)
-- | Return the unit-id this unit is an instance of and the module
-- instantiations (if any).
getUnitInstantiations :: Unit -> (UnitId, Maybe InstantiatedUnit)
-- | Remove instantiations of the given instantiated unit
uninstantiateInstantiatedUnit :: InstantiatedUnit -> InstantiatedUnit
-- | Remove instantiations of the given module instantiated unit
uninstantiateInstantiatedModule :: InstantiatedModule -> InstantiatedModule
-- | Create a hole Module
mkHoleModule :: ModuleName -> GenModule (GenUnit u)
-- | Test if a Module is not instantiated
isHoleModule :: GenModule (GenUnit u) -> Bool
-- | 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
-- | Get a string representation of a Module that's unique and
-- stable across recompilations. eg.
-- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal"
moduleStableString :: Module -> String
-- | A Module is definite if it has no free holes.
moduleIsDefinite :: Module -> Bool
class HasModule m
getModule :: HasModule m => m Module
class ContainsModule t
extractModule :: ContainsModule t => t -> Module
-- | Test if a Module corresponds to a given InstalledModule,
-- modulo instantiation.
installedModuleEq :: InstalledModule -> Module -> Bool
-- | A module for the BreakInfo type. Used by both the GHC.Runtime.Eval and
-- GHC.Runtime.Interpreter hierarchy, so put here to have a less deep
-- module dependency tree
module GHC.Types.BreakInfo
data BreakInfo
BreakInfo :: Module -> Int -> BreakInfo
[breakInfo_module] :: BreakInfo -> Module
[breakInfo_number] :: BreakInfo -> Int
-- | The home unit is the unit (i.e. compiled package) that contains the
-- module we are compiling/typechecking.
module GHC.Unit.Home
-- | Information about the home unit (i.e., the until that will contain the
-- modules we are compiling)
--
-- The unit identifier of the instantiating units is left open to allow
-- switching from UnitKey (what is provided by the user) to UnitId
-- (internal unit identifier) with homeUnitMap.
--
-- TODO: this isn't implemented yet. UnitKeys are still converted too
-- early into UnitIds in GHC.Unit.State.readUnitDataBase
data GenHomeUnit u
-- | Definite home unit (i.e. that we can compile).
--
-- Nothing: not an instantiated unit Just (i,insts): made definite by
-- instantiating "i" with "insts"
DefiniteHomeUnit :: UnitId -> Maybe (u, GenInstantiations u) -> GenHomeUnit u
-- | Indefinite home unit (i.e. that we can only typecheck)
--
-- All the holes are instantiated with fake modules from the Hole unit.
-- See Note [Representation of module/name variables] in GHC.Unit
IndefiniteHomeUnit :: UnitId -> GenInstantiations u -> GenHomeUnit u
type HomeUnit = GenHomeUnit UnitId
-- | Return home unit id
homeUnitId :: GenHomeUnit u -> UnitId
-- | Return home unit instantiations
homeUnitInstantiations :: GenHomeUnit u -> GenInstantiations u
-- | Return the unit id of the unit that is instantiated by the home unit.
--
-- E.g. if home unit = q[A=p:B,...] we return q.
--
-- If the home unit is not an instance of another unit, we return its own
-- unit id (it is an instance of itself if you will).
homeUnitInstanceOf :: HomeUnit -> UnitId
-- | Return the unit id of the unit that is instantiated by the home unit.
--
-- E.g. if home unit = q[A=p:B,...] we return (Just q).
--
-- If the home unit is not an instance of another unit, we return
-- Nothing.
homeUnitInstanceOfMaybe :: GenHomeUnit u -> Maybe u
-- | Return the home unit as a normal unit.
--
-- We infer from the home unit itself the kind of unit we create: 1. If
-- the home unit is definite, we must be compiling so we return a real
-- unit. The definite home unit may be the result of a unit
-- instantiation, say `p = q[A=r:X]`. In this case we could have returned
-- a virtual unit `q[A=r:X]` but it's not what the clients of this
-- function expect, especially because p is lost when we do
-- this. The unit id of a virtual unit is made up internally so
-- `unitId(q[A=r:X])` is not equal to p.
--
--
-- - If the home unit is indefinite we can only create a virtual unit
-- from it. It's ok because we must be only typechecking the home unit so
-- we won't produce any code object that rely on the unit id of this
-- virtual unit.
--
homeUnitAsUnit :: HomeUnit -> Unit
-- | Map over the unit identifier for instantiating units
homeUnitMap :: IsUnitId v => (u -> v) -> GenHomeUnit u -> GenHomeUnit v
-- | Test if we are type-checking an indefinite unit
--
-- (if it is not, we should never use on-the-fly renaming)
isHomeUnitIndefinite :: GenHomeUnit u -> Bool
-- | Test if we are compiling a definite unit
--
-- (if it is, we should never use on-the-fly renaming)
isHomeUnitDefinite :: GenHomeUnit u -> Bool
-- | Test if we are compiling by instantiating a definite unit
isHomeUnitInstantiating :: GenHomeUnit u -> Bool
-- | Test if the unit is the home unit
isHomeUnit :: HomeUnit -> Unit -> Bool
-- | Test if the unit-id is the home unit-id
isHomeUnitId :: GenHomeUnit u -> UnitId -> Bool
-- | Test if the home unit is an instance of the given unit-id
isHomeUnitInstanceOf :: HomeUnit -> UnitId -> Bool
-- | Test if the module comes from the home unit
isHomeModule :: HomeUnit -> Module -> Bool
-- | Test if the module comes from the home unit
isHomeInstalledModule :: GenHomeUnit u -> InstalledModule -> Bool
-- | Test if the unit-id is not the home unit-id
notHomeUnitId :: Maybe (GenHomeUnit u) -> UnitId -> Bool
-- | Test if a module doesn't come from the given home unit
notHomeModule :: HomeUnit -> Module -> Bool
-- | Test if a module doesn't come from the given home unit
notHomeModuleMaybe :: Maybe HomeUnit -> Module -> Bool
-- | Test if a module doesn't come from the given home unit
notHomeInstalledModule :: GenHomeUnit u -> InstalledModule -> Bool
-- | Test if a module doesn't come from the given home unit
notHomeInstalledModuleMaybe :: Maybe (GenHomeUnit u) -> InstalledModule -> Bool
-- | Make a module in home unit
mkHomeModule :: HomeUnit -> ModuleName -> Module
-- | Make a module in home unit
mkHomeInstalledModule :: GenHomeUnit u -> ModuleName -> InstalledModule
-- | Return the module that is used to instantiate the given home module.
--
-- If the given module isn't a module hole, return the actual home
-- module.
--
-- E.g., the instantiating module of p:A in p[A=q[]:B]
-- is q[]:B. the instantiating module of r:A in
-- p[A=q[]:B] is r:A. the instantiating module of
-- p:A in p is p:A. the instantiating module
-- of r:A in p is r:A.
homeModuleInstantiation :: Maybe HomeUnit -> Module -> Module
-- | Return the module that is used to instantiate the given home module
-- name. If the ModuleName doesn't refer to a signature, return the
-- actual home module.
--
-- E.g., the instantiating module of A in p[A=q[]:B] is
-- q[]:B. the instantiating module of A in p
-- is p:A.
homeModuleNameInstantiation :: HomeUnit -> ModuleName -> Module
-- | Source text
--
-- Keeping Source Text for source to source conversions
module GHC.Types.SourceText
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
-- | Integral Literal
--
-- Used (instead of Integer) to represent negative zegative zero which is
-- required for NegativeLiterals extension to correctly parse
-- `-0::Double` as negative zero. See also #13211.
data IntegralLit
IL :: SourceText -> Bool -> Integer -> IntegralLit
[il_text] :: IntegralLit -> SourceText
[il_neg] :: IntegralLit -> Bool
[il_value] :: IntegralLit -> Integer
-- | 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. Note
-- [FractionalLit representation] in GHC.HsToCore.Match.Literal The
-- actual value then is: sign * fl_signi * (fl_exp_base^fl_exp) where
-- sign = if fl_neg then (-1) else 1
--
-- For example FL { fl_neg = True, fl_signi = 5.3, fl_exp = 4,
-- fl_exp_base = Base10 } denotes -5300
data FractionalLit
FL :: SourceText -> Bool -> Rational -> Integer -> FractionalExponentBase -> FractionalLit
-- | How the value was written in the source
[fl_text] :: FractionalLit -> SourceText
[fl_neg] :: FractionalLit -> Bool
[fl_signi] :: FractionalLit -> Rational
[fl_exp] :: FractionalLit -> Integer
[fl_exp_base] :: FractionalLit -> FractionalExponentBase
-- | A String Literal in the source, including its original raw format for
-- use by source to source manipulation tools.
data StringLiteral
StringLiteral :: SourceText -> FastString -> Maybe RealSrcSpan -> StringLiteral
[sl_st] :: StringLiteral -> SourceText
[sl_fs] :: StringLiteral -> FastString
[sl_tc] :: StringLiteral -> Maybe RealSrcSpan
negateIntegralLit :: IntegralLit -> IntegralLit
negateFractionalLit :: FractionalLit -> FractionalLit
mkIntegralLit :: Integral a => a -> IntegralLit
mkTHFractionalLit :: Rational -> FractionalLit
rationalFromFractionalLit :: FractionalLit -> Rational
-- | The integer should already be negated if it's negative.
integralFractionalLit :: Bool -> Integer -> FractionalLit
-- | The arguments should already be negated if they are negative.
mkSourceFractionalLit :: String -> Bool -> Integer -> Integer -> FractionalExponentBase -> FractionalLit
data FractionalExponentBase
Base2 :: FractionalExponentBase
Base10 :: FractionalExponentBase
fractionalLitFromRational :: Rational -> FractionalLit
mkFractionalLit :: SourceText -> Bool -> Rational -> Integer -> FractionalExponentBase -> FractionalLit
instance GHC.Classes.Eq GHC.Types.SourceText.SourceText
instance GHC.Show.Show GHC.Types.SourceText.SourceText
instance Data.Data.Data GHC.Types.SourceText.SourceText
instance GHC.Show.Show GHC.Types.SourceText.IntegralLit
instance Data.Data.Data GHC.Types.SourceText.IntegralLit
instance GHC.Show.Show GHC.Types.SourceText.FractionalExponentBase
instance Data.Data.Data GHC.Types.SourceText.FractionalExponentBase
instance GHC.Classes.Ord GHC.Types.SourceText.FractionalExponentBase
instance GHC.Classes.Eq GHC.Types.SourceText.FractionalExponentBase
instance GHC.Show.Show GHC.Types.SourceText.FractionalLit
instance Data.Data.Data GHC.Types.SourceText.FractionalLit
instance Data.Data.Data GHC.Types.SourceText.StringLiteral
instance GHC.Classes.Eq GHC.Types.SourceText.StringLiteral
instance GHC.Utils.Outputable.Outputable GHC.Types.SourceText.StringLiteral
instance GHC.Utils.Binary.Binary GHC.Types.SourceText.StringLiteral
instance GHC.Classes.Eq GHC.Types.SourceText.FractionalLit
instance GHC.Classes.Ord GHC.Types.SourceText.FractionalLit
instance GHC.Utils.Outputable.Outputable GHC.Types.SourceText.FractionalLit
instance GHC.Classes.Eq GHC.Types.SourceText.IntegralLit
instance GHC.Classes.Ord GHC.Types.SourceText.IntegralLit
instance GHC.Utils.Outputable.Outputable GHC.Types.SourceText.IntegralLit
instance GHC.Utils.Outputable.Outputable GHC.Types.SourceText.SourceText
instance GHC.Utils.Binary.Binary GHC.Types.SourceText.SourceText
module GHC.Types.PkgQual
-- | Package-qualifier as it was parsed
data RawPkgQual
-- | No package qualifier
NoRawPkgQual :: RawPkgQual
-- | Raw package qualifier string.
RawPkgQual :: StringLiteral -> RawPkgQual
-- | Package-qualifier after renaming
--
-- Renaming detects if "this" or the unit-id of the home-unit was used as
-- a package qualifier.
data PkgQual
-- | No package qualifier
NoPkgQual :: PkgQual
-- | Import from home-unit
ThisPkg :: UnitId -> PkgQual
-- | Import from another unit
OtherPkg :: UnitId -> PkgQual
instance Data.Data.Data GHC.Types.PkgQual.RawPkgQual
instance GHC.Classes.Eq GHC.Types.PkgQual.PkgQual
instance GHC.Classes.Ord GHC.Types.PkgQual.PkgQual
instance Data.Data.Data GHC.Types.PkgQual.PkgQual
instance GHC.Utils.Outputable.Outputable GHC.Types.PkgQual.PkgQual
instance GHC.Utils.Outputable.Outputable GHC.Types.PkgQual.RawPkgQual
module GHC.Types.SourceFile
data HscSource
-- | .hs file
HsSrcFile :: HscSource
-- | .hs-boot file
HsBootFile :: HscSource
-- | .hsig file
HsigFile :: HscSource
-- | Tests if an HscSource is a boot file, primarily for
-- constructing elements of BuildModule. We conflate signatures
-- and modules because they are bound in the same namespace; only boot
-- interfaces can be disambiguated with `import {--}`.
hscSourceToIsBoot :: HscSource -> IsBootInterface
isHsBootOrSig :: HscSource -> Bool
isHsigFile :: HscSource -> Bool
hscSourceString :: HscSource -> String
instance GHC.Show.Show GHC.Types.SourceFile.HscSource
instance GHC.Classes.Ord GHC.Types.SourceFile.HscSource
instance GHC.Classes.Eq GHC.Types.SourceFile.HscSource
instance GHC.Utils.Binary.Binary GHC.Types.SourceFile.HscSource
-- | This stuff here is related to supporting the Safe Haskell extension,
-- primarily about storing under what trust type a module has been
-- compiled.
module GHC.Types.SafeHaskell
-- | Is an import a safe import?
type IsSafeImport = Bool
-- | The various Safe Haskell modes
data SafeHaskellMode
-- | inferred unsafe
Sf_None :: SafeHaskellMode
-- | declared and checked
Sf_Unsafe :: SafeHaskellMode
-- | declared and checked
Sf_Trustworthy :: SafeHaskellMode
-- | declared and checked
Sf_Safe :: SafeHaskellMode
-- | inferred as safe
Sf_SafeInferred :: SafeHaskellMode
-- | -fno-safe-haskell state
Sf_Ignore :: SafeHaskellMode
-- | 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
instance GHC.Classes.Eq GHC.Types.SafeHaskell.SafeHaskellMode
instance GHC.Utils.Outputable.Outputable GHC.Types.SafeHaskell.IfaceTrustInfo
instance GHC.Utils.Binary.Binary GHC.Types.SafeHaskell.IfaceTrustInfo
instance GHC.Show.Show GHC.Types.SafeHaskell.SafeHaskellMode
instance GHC.Utils.Outputable.Outputable GHC.Types.SafeHaskell.SafeHaskellMode
-- | Fixity
module GHC.Types.Fixity
data Fixity
Fixity :: SourceText -> Int -> FixityDirection -> Fixity
data FixityDirection
InfixL :: FixityDirection
InfixR :: FixityDirection
InfixN :: FixityDirection
-- | 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
maxPrecedence :: Int
minPrecedence :: Int
defaultFixity :: Fixity
negateFixity :: Fixity
funTyFixity :: Fixity
compareFixity :: Fixity -> Fixity -> (Bool, Bool)
instance Data.Data.Data GHC.Types.Fixity.FixityDirection
instance GHC.Classes.Eq GHC.Types.Fixity.FixityDirection
instance Data.Data.Data GHC.Types.Fixity.Fixity
instance GHC.Classes.Eq GHC.Types.Fixity.LexicalFixity
instance Data.Data.Data GHC.Types.Fixity.LexicalFixity
instance GHC.Utils.Outputable.Outputable GHC.Types.Fixity.LexicalFixity
instance GHC.Utils.Outputable.Outputable GHC.Types.Fixity.Fixity
instance GHC.Classes.Eq GHC.Types.Fixity.Fixity
instance GHC.Utils.Binary.Binary GHC.Types.Fixity.Fixity
instance GHC.Utils.Outputable.Outputable GHC.Types.Fixity.FixityDirection
instance GHC.Utils.Binary.Binary GHC.Types.Fixity.FixityDirection
module GHC.Iface.Ext.Fields
newtype ExtensibleFields
ExtensibleFields :: Map FieldName BinData -> ExtensibleFields
[getExtensibleFields] :: ExtensibleFields -> Map FieldName BinData
type FieldName = String
emptyExtensibleFields :: ExtensibleFields
-- | Reading
readField :: Binary a => FieldName -> ExtensibleFields -> IO (Maybe a)
readFieldWith :: FieldName -> (BinHandle -> IO a) -> ExtensibleFields -> IO (Maybe a)
-- | Writing
writeField :: Binary a => FieldName -> a -> ExtensibleFields -> IO ExtensibleFields
writeFieldWith :: FieldName -> (BinHandle -> IO ()) -> ExtensibleFields -> IO ExtensibleFields
deleteField :: FieldName -> ExtensibleFields -> ExtensibleFields
instance GHC.Utils.Binary.Binary GHC.Iface.Ext.Fields.ExtensibleFields
instance Control.DeepSeq.NFData GHC.Iface.Ext.Fields.ExtensibleFields
-- | An exactprintable structure for docstrings
module GHC.Hs.DocString
type LHsDocString = Located HsDocString
-- | Haskell Documentation String
--
-- Rich structure to support exact printing The location around each
-- chunk doesn't include the decorators
data HsDocString
-- | The first chunk is preceded by "-- decorator" and each
-- following chunk is preceded by "--" Example: -- | This is a docstring
-- for foo. It is the line with the decorator '|' and is always
-- included -- This continues that docstring and is the second element in
-- the NonEmpty list foo :: a -> a
MultiLineDocString :: !HsDocStringDecorator -> !NonEmpty LHsDocStringChunk -> HsDocString
-- | The docstring is preceded by "{-decorator" and followed by "-}"
-- The chunk contains balanced pairs of '{-' and '-}'
NestedDocString :: !HsDocStringDecorator -> LHsDocStringChunk -> HsDocString
-- | A docstring generated either internally or via TH Pretty printed with
-- the '-- |' decorator This is because it may contain unbalanced pairs
-- of '{-' and '-}' and not form a valid NestedDocString
GeneratedDocString :: HsDocStringChunk -> HsDocString
data HsDocStringDecorator
-- | '|' is the decorator
HsDocStringNext :: HsDocStringDecorator
-- | ^ is the decorator
HsDocStringPrevious :: HsDocStringDecorator
-- | '$string' is the decorator
HsDocStringNamed :: !String -> HsDocStringDecorator
-- | The decorator is the given number of *s
HsDocStringGroup :: !Int -> HsDocStringDecorator
-- | A continguous chunk of documentation
newtype HsDocStringChunk
HsDocStringChunk :: ByteString -> HsDocStringChunk
type LHsDocStringChunk = Located HsDocStringChunk
isEmptyDocString :: HsDocString -> Bool
unpackHDSC :: HsDocStringChunk -> String
mkHsDocStringChunk :: String -> HsDocStringChunk
-- | Create a HsDocString from a UTF8-encoded ByteString.
mkHsDocStringChunkUtf8ByteString :: ByteString -> HsDocStringChunk
-- | Pretty print with decorators, exactly as the user wrote it
pprHsDocString :: HsDocString -> SDoc
pprHsDocStrings :: [HsDocString] -> SDoc
mkGeneratedHsDocString :: String -> HsDocString
docStringChunks :: HsDocString -> [LHsDocStringChunk]
-- | Just get the docstring, without any decorators
renderHsDocString :: HsDocString -> String
-- | Just get the docstring, without any decorators Seperates docstrings
-- using "nn", which is how haddock likes to render them
renderHsDocStrings :: [HsDocString] -> String
-- | Pretty print with decorators, exactly as the user wrote it
exactPrintHsDocString :: HsDocString -> String
-- | Annotate a pretty printed thing with its doc The docstring comes after
-- if is HsDocStringPrevious Otherwise it comes before. Note - we
-- convert MultiLineDocString HsDocStringPrevious to HsDocStringNext
-- because we can't control if something else will be pretty printed on
-- the same line
pprWithDocString :: HsDocString -> SDoc -> SDoc
instance Data.Data.Data GHC.Hs.DocString.HsDocStringDecorator
instance GHC.Show.Show GHC.Hs.DocString.HsDocStringDecorator
instance GHC.Classes.Ord GHC.Hs.DocString.HsDocStringDecorator
instance GHC.Classes.Eq GHC.Hs.DocString.HsDocStringDecorator
instance GHC.Show.Show GHC.Hs.DocString.HsDocStringChunk
instance Data.Data.Data GHC.Hs.DocString.HsDocStringChunk
instance GHC.Classes.Ord GHC.Hs.DocString.HsDocStringChunk
instance GHC.Classes.Eq GHC.Hs.DocString.HsDocStringChunk
instance GHC.Show.Show GHC.Hs.DocString.HsDocString
instance Data.Data.Data GHC.Hs.DocString.HsDocString
instance GHC.Classes.Eq GHC.Hs.DocString.HsDocString
instance GHC.Utils.Outputable.Outputable GHC.Hs.DocString.HsDocString
instance GHC.Utils.Binary.Binary GHC.Hs.DocString.HsDocString
instance GHC.Utils.Binary.Binary GHC.Hs.DocString.HsDocStringChunk
instance GHC.Utils.Outputable.Outputable GHC.Hs.DocString.HsDocStringChunk
instance GHC.Utils.Outputable.Outputable GHC.Hs.DocString.HsDocStringDecorator
instance GHC.Utils.Binary.Binary GHC.Hs.DocString.HsDocStringDecorator
-- | A tiny wrapper around IntSet for representing sets of
-- Enum things.
module GHC.Data.EnumSet
data EnumSet a
member :: Enum a => a -> EnumSet a -> Bool
insert :: Enum a => a -> EnumSet a -> EnumSet a
delete :: Enum a => a -> EnumSet a -> EnumSet a
toList :: Enum a => EnumSet a -> [a]
fromList :: Enum a => [a] -> EnumSet a
empty :: EnumSet a
difference :: EnumSet a -> EnumSet a -> EnumSet a
instance GHC.Base.Monoid (GHC.Data.EnumSet.EnumSet a)
instance GHC.Base.Semigroup (GHC.Data.EnumSet.EnumSet a)
instance GHC.Utils.Binary.Binary (GHC.Data.EnumSet.EnumSet a)
module GHC.Driver.Flags
-- | Debugging flags
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_by_proc :: 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
-- | Dump the cfg used for block layout.
Opt_D_dump_cfg_weights :: 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_c_backend :: 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_ds_preopt :: DumpFlag
Opt_D_dump_foreign :: DumpFlag
Opt_D_dump_inlinings :: DumpFlag
Opt_D_dump_verbose_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_simpl :: DumpFlag
Opt_D_dump_simpl_iterations :: DumpFlag
Opt_D_dump_spec :: DumpFlag
Opt_D_dump_prep :: DumpFlag
-- | Initial STG (CoreToStg output)
Opt_D_dump_stg_from_core :: DumpFlag
-- | STG after unarise
Opt_D_dump_stg_unarised :: DumpFlag
-- | STG (after stg2stg)
Opt_D_dump_stg_cg :: DumpFlag
-- | Result of tag inference analysis.
Opt_D_dump_stg_tags :: DumpFlag
-- | Final STG (before cmm gen)
Opt_D_dump_stg_final :: DumpFlag
Opt_D_dump_call_arity :: DumpFlag
Opt_D_dump_exitify :: DumpFlag
Opt_D_dump_stranal :: DumpFlag
Opt_D_dump_str_signatures :: DumpFlag
Opt_D_dump_cpranal :: DumpFlag
Opt_D_dump_cpr_signatures :: DumpFlag
Opt_D_dump_tc :: DumpFlag
Opt_D_dump_tc_ast :: DumpFlag
Opt_D_dump_hie :: 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_splices :: DumpFlag
Opt_D_th_dec_file :: DumpFlag
Opt_D_dump_BCOs :: 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_timings :: 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
Opt_D_dump_faststrings :: DumpFlag
Opt_D_faststring_stats :: DumpFlag
-- | Enumerates the simple on-or-off dynamic flags
data GeneralFlag
-- | Append dump output to files instead of stdout.
Opt_DumpToFile :: GeneralFlag
Opt_D_dump_minimal_imports :: GeneralFlag
Opt_DoCoreLinting :: GeneralFlag
Opt_DoLinearCoreLinting :: GeneralFlag
Opt_DoStgLinting :: GeneralFlag
Opt_DoCmmLinting :: GeneralFlag
Opt_DoAsmLinting :: GeneralFlag
Opt_DoAnnotationLinting :: GeneralFlag
Opt_DoBoundsChecking :: GeneralFlag
Opt_NoLlvmMangler :: GeneralFlag
Opt_FastLlvm :: GeneralFlag
Opt_NoTypeableBinds :: GeneralFlag
Opt_DistinctConstructorTables :: GeneralFlag
Opt_InfoTableMap :: 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_PrintAxiomIncomps :: GeneralFlag
Opt_PrintUnicodeSyntax :: GeneralFlag
Opt_PrintExpandedSynonyms :: GeneralFlag
Opt_PrintPotentialInstances :: GeneralFlag
Opt_PrintTypecheckerElaboration :: GeneralFlag
Opt_CallArity :: GeneralFlag
Opt_Exitification :: GeneralFlag
Opt_Strictness :: GeneralFlag
Opt_LateDmdAnal :: GeneralFlag
Opt_KillAbsence :: GeneralFlag
Opt_KillOneShot :: GeneralFlag
Opt_FullLaziness :: GeneralFlag
Opt_FloatIn :: GeneralFlag
Opt_LateSpecialise :: GeneralFlag
Opt_Specialise :: GeneralFlag
Opt_SpecialiseAggressively :: GeneralFlag
Opt_CrossModuleSpecialise :: GeneralFlag
Opt_InlineGenerics :: GeneralFlag
Opt_InlineGenericsAggressively :: GeneralFlag
Opt_StaticArgumentTransformation :: GeneralFlag
Opt_CSE :: GeneralFlag
Opt_StgCSE :: GeneralFlag
Opt_StgLiftLams :: 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_EnableThSpliceWarnings :: GeneralFlag
Opt_RegsGraph :: GeneralFlag
Opt_RegsIterative :: GeneralFlag
Opt_PedanticBottoms :: GeneralFlag
Opt_LlvmTBAA :: GeneralFlag
Opt_LlvmFillUndefWithGarbage :: GeneralFlag
Opt_IrrefutableTuples :: GeneralFlag
Opt_CmmSink :: GeneralFlag
Opt_CmmStaticPred :: GeneralFlag
Opt_CmmElimCommonBlocks :: GeneralFlag
Opt_CmmControlFlow :: GeneralFlag
Opt_AsmShortcutting :: GeneralFlag
Opt_OmitYields :: GeneralFlag
Opt_FunToThunk :: GeneralFlag
Opt_DictsStrict :: GeneralFlag
-- | deprecated, no effect and behaviour is now default. Allowed switching
-- of a special demand transformer for dictionary selectors
Opt_DmdTxDictSel :: GeneralFlag
Opt_Loopification :: GeneralFlag
-- | Use the cfg based block layout algorithm.
Opt_CfgBlocklayout :: GeneralFlag
-- | Layout based on last instruction per block.
Opt_WeightlessBlocklayout :: GeneralFlag
Opt_CprAnal :: GeneralFlag
Opt_WorkerWrapper :: GeneralFlag
-- | Do W/W split for unlifting even if we won't unbox anything.
Opt_WorkerWrapperUnlift :: GeneralFlag
Opt_SolveConstantDicts :: GeneralFlag
Opt_AlignmentSanitisation :: GeneralFlag
Opt_CatchNonexhaustiveCases :: GeneralFlag
Opt_NumConstantFolding :: GeneralFlag
Opt_CoreConstantFolding :: GeneralFlag
Opt_FastPAPCalls :: GeneralFlag
Opt_DoTagInferenceChecks :: GeneralFlag
Opt_SimplPreInlining :: GeneralFlag
Opt_IgnoreInterfacePragmas :: GeneralFlag
Opt_OmitInterfacePragmas :: GeneralFlag
Opt_ExposeAllUnfoldings :: GeneralFlag
Opt_WriteInterface :: GeneralFlag
Opt_WriteHie :: GeneralFlag
Opt_AutoSccsOnIndividualCafs :: GeneralFlag
Opt_ProfCountEntries :: GeneralFlag
Opt_ProfLateCcs :: GeneralFlag
Opt_Pp :: GeneralFlag
Opt_ForceRecomp :: GeneralFlag
Opt_IgnoreOptimChanges :: GeneralFlag
Opt_IgnoreHpcChanges :: GeneralFlag
Opt_ExcessPrecision :: GeneralFlag
Opt_EagerBlackHoling :: GeneralFlag
Opt_NoHsMain :: 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_GhciLeakCheck :: GeneralFlag
Opt_ValidateHie :: GeneralFlag
Opt_LocalGhciHistory :: GeneralFlag
Opt_NoIt :: 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_ExternalDynamicRefs :: GeneralFlag
Opt_Ticky :: GeneralFlag
Opt_Ticky_Allocd :: GeneralFlag
Opt_Ticky_LNE :: GeneralFlag
Opt_Ticky_Dyn_Thunk :: GeneralFlag
Opt_Ticky_Tag :: GeneralFlag
-- | Use regular thunks even when we could use std ap thunks in order to
-- get entry counts
Opt_Ticky_AP :: GeneralFlag
Opt_RPath :: GeneralFlag
Opt_RelativeDynlibPaths :: GeneralFlag
-- |
-- -fcompact-unwind
--
Opt_CompactUnwind :: GeneralFlag
Opt_Hpc :: GeneralFlag
Opt_FamAppCache :: GeneralFlag
Opt_ExternalInterpreter :: GeneralFlag
Opt_OptimalApplicativeDo :: GeneralFlag
Opt_VersionMacros :: GeneralFlag
Opt_WholeArchiveHsLibs :: GeneralFlag
Opt_SingleLibFolder :: GeneralFlag
Opt_ExposeInternalSymbols :: GeneralFlag
Opt_KeepCAFs :: GeneralFlag
Opt_KeepGoing :: GeneralFlag
Opt_ByteCode :: GeneralFlag
Opt_LinkRts :: GeneralFlag
Opt_ErrorSpans :: GeneralFlag
Opt_DeferDiagnostics :: GeneralFlag
Opt_DiagnosticsShowCaret :: GeneralFlag
Opt_PprCaseAsLet :: GeneralFlag
Opt_PprShowTicks :: GeneralFlag
Opt_ShowHoleConstraints :: GeneralFlag
Opt_ShowValidHoleFits :: GeneralFlag
Opt_SortValidHoleFits :: GeneralFlag
Opt_SortBySizeHoleFits :: GeneralFlag
Opt_SortBySubsumHoleFits :: GeneralFlag
Opt_AbstractRefHoleFits :: GeneralFlag
Opt_UnclutterValidHoleFits :: GeneralFlag
Opt_ShowTypeAppOfHoleFits :: GeneralFlag
Opt_ShowTypeAppVarsOfHoleFits :: GeneralFlag
Opt_ShowDocsOfHoleFits :: GeneralFlag
Opt_ShowTypeOfHoleFits :: GeneralFlag
Opt_ShowProvOfHoleFits :: GeneralFlag
Opt_ShowMatchesOfHoleFits :: GeneralFlag
Opt_ShowLoadedModules :: GeneralFlag
Opt_HexWordLiterals :: 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_SuppressStgExts :: GeneralFlag
Opt_SuppressTicks :: GeneralFlag
-- | Suppress timestamps in dumps
Opt_SuppressTimestamps :: GeneralFlag
-- | Suppress per binding Core size stats in dumps
Opt_SuppressCoreSizes :: GeneralFlag
Opt_AutoLinkPackages :: GeneralFlag
Opt_ImplicitImportQualified :: GeneralFlag
Opt_KeepHscppFiles :: 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_PluginTrustworthy :: GeneralFlag
Opt_G_NoStateHack :: GeneralFlag
Opt_G_NoOptCoercion :: GeneralFlag
data Language
Haskell98 :: Language
Haskell2010 :: Language
GHC2021 :: Language
optimisationFlags :: EnumSet 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_WarnUnusedRecordWildcards :: WarningFlag
Opt_WarnRedundantBangPatterns :: WarningFlag
Opt_WarnRedundantRecordWildcards :: WarningFlag
Opt_WarnWarningsDeprecations :: WarningFlag
Opt_WarnDeprecatedFlags :: 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_WarnMissedExtraSharedLib :: 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
Opt_WarnPartialFields :: WarningFlag
Opt_WarnMissingExportList :: WarningFlag
Opt_WarnInaccessibleCode :: WarningFlag
Opt_WarnStarIsType :: WarningFlag
Opt_WarnStarBinder :: WarningFlag
Opt_WarnImplicitKindVars :: WarningFlag
Opt_WarnSpaceAfterBang :: WarningFlag
Opt_WarnMissingDerivingStrategies :: WarningFlag
Opt_WarnPrepositiveQualifiedModule :: WarningFlag
Opt_WarnUnusedPackages :: WarningFlag
Opt_WarnInferredSafeImports :: WarningFlag
Opt_WarnMissingSafeHaskellMode :: WarningFlag
Opt_WarnCompatUnqualifiedImports :: WarningFlag
Opt_WarnDerivingDefaults :: WarningFlag
Opt_WarnInvalidHaddock :: WarningFlag
Opt_WarnOperatorWhitespaceExtConflict :: WarningFlag
Opt_WarnOperatorWhitespace :: WarningFlag
Opt_WarnAmbiguousFields :: WarningFlag
Opt_WarnImplicitLift :: WarningFlag
Opt_WarnMissingKindSignatures :: WarningFlag
Opt_WarnMissingExportedPatternSynonymSignatures :: WarningFlag
Opt_WarnRedundantStrictnessFlags :: WarningFlag
Opt_WarnForallIdentifier :: WarningFlag
Opt_WarnUnicodeBidirectionalFormatCharacters :: WarningFlag
Opt_WarnGADTMonoLocalBinds :: WarningFlag
Opt_WarnTypeEqualityOutOfScope :: WarningFlag
Opt_WarnTypeEqualityRequiresOperators :: WarningFlag
-- | Return the names of a WarningFlag
--
-- One flag may have several names because of US/UK spelling. The first
-- one is the "preferred one" that will be displayed in warning messages.
warnFlagNames :: WarningFlag -> NonEmpty String
-- | 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]]
-- | Find the smallest group in every hierarchy which a warning belongs to,
-- excluding Weverything.
smallestWarningGroups :: WarningFlag -> [String]
-- | Warnings enabled unless specified otherwise
standardWarnings :: [WarningFlag]
-- | Things you get with -W
minusWOpts :: [WarningFlag]
-- | Things you get with -Wall
minusWallOpts :: [WarningFlag]
-- | Things you get with -Weverything, i.e. *all* known warnings flags
minusWeverythingOpts :: [WarningFlag]
-- | Things you get with -Wcompat.
--
-- This is intended to group together warnings that will be enabled by
-- default at some point in the future, so that library authors eager to
-- make their code future compatible to fix issues before they even
-- generate warnings.
minusWcompatOpts :: [WarningFlag]
-- | Things you get with -Wunused-binds
unusedBindsFlags :: [WarningFlag]
instance GHC.Enum.Bounded GHC.Driver.Flags.Language
instance GHC.Show.Show GHC.Driver.Flags.Language
instance GHC.Enum.Enum GHC.Driver.Flags.Language
instance GHC.Classes.Eq GHC.Driver.Flags.Language
instance GHC.Enum.Enum GHC.Driver.Flags.DumpFlag
instance GHC.Show.Show GHC.Driver.Flags.DumpFlag
instance GHC.Classes.Eq GHC.Driver.Flags.DumpFlag
instance GHC.Enum.Enum GHC.Driver.Flags.GeneralFlag
instance GHC.Show.Show GHC.Driver.Flags.GeneralFlag
instance GHC.Classes.Eq GHC.Driver.Flags.GeneralFlag
instance GHC.Enum.Enum GHC.Driver.Flags.WarningFlag
instance GHC.Show.Show GHC.Driver.Flags.WarningFlag
instance GHC.Classes.Ord GHC.Driver.Flags.WarningFlag
instance GHC.Classes.Eq GHC.Driver.Flags.WarningFlag
instance GHC.Utils.Outputable.Outputable GHC.Driver.Flags.Language
instance GHC.Utils.Binary.Binary GHC.Driver.Flags.Language
module GHC.Types.ForeignCall
newtype ForeignCall
CCall :: CCallSpec -> ForeignCall
isSafeForeignCall :: ForeignCall -> Bool
data Safety
-- | Might invoke Haskell GC, or do a call back, or switch threads, etc. So
-- make sure things are tidy before the call. Additionally, in the
-- threaded RTS we arrange for the external call to be executed by a
-- separate OS thread, i.e., _concurrently_ to the execution of other
-- Haskell threads.
PlaySafe :: Safety
-- | Like PlaySafe, but additionally the worker thread running this foreign
-- call may be unceremoniously killed, so it must be scheduled on an
-- unbound thread.
PlayInterruptible :: Safety
-- | None of the above can happen; the call will return without interacting
-- with the runtime system at all. Specifically:
--
--
-- - No GC
-- - No call backs
-- - No blocking
-- - No precise exceptions
--
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 Unit -> 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 GHC.Enum.Enum GHC.Types.ForeignCall.Safety
instance Data.Data.Data GHC.Types.ForeignCall.Safety
instance GHC.Show.Show GHC.Types.ForeignCall.Safety
instance GHC.Classes.Eq GHC.Types.ForeignCall.Safety
instance GHC.Enum.Enum GHC.Types.ForeignCall.CCallConv
instance Data.Data.Data GHC.Types.ForeignCall.CCallConv
instance GHC.Classes.Eq GHC.Types.ForeignCall.CCallConv
instance Data.Data.Data GHC.Types.ForeignCall.CCallTarget
instance GHC.Classes.Eq GHC.Types.ForeignCall.CCallTarget
instance GHC.Classes.Eq GHC.Types.ForeignCall.CCallSpec
instance GHC.Classes.Eq GHC.Types.ForeignCall.ForeignCall
instance Data.Data.Data GHC.Types.ForeignCall.CExportSpec
instance Data.Data.Data GHC.Types.ForeignCall.Header
instance GHC.Classes.Eq GHC.Types.ForeignCall.Header
instance Data.Data.Data GHC.Types.ForeignCall.CType
instance GHC.Classes.Eq GHC.Types.ForeignCall.CType
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.CType
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.CType
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.Header
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.Header
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.CExportSpec
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.CExportSpec
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.ForeignCall
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.ForeignCall
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.CCallSpec
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.CCallSpec
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.CCallTarget
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.CCallConv
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.CCallConv
instance GHC.Utils.Outputable.Outputable GHC.Types.ForeignCall.Safety
instance GHC.Utils.Binary.Binary GHC.Types.ForeignCall.Safety
module GHC.Types.Basic
data LeftOrRight
CLeft :: LeftOrRight
CRight :: LeftOrRight
pickLR :: LeftOrRight -> (a, a) -> a
-- | A *one-index* 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 GHC.Core.Opt.Arity
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
-- | FullArgCount is the number of type or value arguments in an
-- application, or the number of type or value binders in a lambda. Note:
-- it includes both type and value arguments!
type FullArgCount = Int
-- | A power-of-two alignment
data Alignment
mkAlignment :: Int -> Alignment
alignmentOf :: Int -> Alignment
alignmentBytes :: Alignment -> Int
-- | Is a TyCon a promoted data constructor or just a normal type
-- constructor?
data PromotionFlag
NotPromoted :: PromotionFlag
IsPromoted :: PromotionFlag
isPromoted :: PromotionFlag -> Bool
data FunctionOrData
IsFunction :: FunctionOrData
IsData :: FunctionOrData
-- | 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
-- | The semantics allowed for overlapping instances for a particular
-- instance. See Note [Safe Haskell isSafeOverlap] (in
-- GHC.Core.InstEnv) 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
-- 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 GHC.Core.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
-- | Should an argument be passed evaluated *and* tagged.
data CbvMark
MarkedCbv :: CbvMark
NotMarkedCbv :: CbvMark
isMarkedCbv :: CbvMark -> Bool
-- | A general-purpose pretty-printing precedence type.
newtype PprPrec
PprPrec :: Int -> PprPrec
topPrec :: PprPrec
sigPrec :: PprPrec
opPrec :: PprPrec
funPrec :: PprPrec
starPrec :: PprPrec
appPrec :: PprPrec
maybeParen :: PprPrec -> PprPrec -> SDoc -> SDoc
data TupleSort
BoxedTuple :: TupleSort
UnboxedTuple :: TupleSort
ConstraintTuple :: TupleSort
tupleSortBoxity :: TupleSort -> Boxity
boxityTupleSort :: Boxity -> TupleSort
tupleParens :: TupleSort -> SDoc -> SDoc
-- | Are we dealing with an unboxed tuple or an unboxed sum?
--
-- Used when validity checking, see check_ubx_tuple_or_sum.
data UnboxedTupleOrSum
UnboxedTupleType :: UnboxedTupleOrSum
UnboxedSumType :: UnboxedTupleOrSum
unboxedTupleOrSumExtension :: UnboxedTupleOrSum -> Extension
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.
--
-- See also Note [OneShotInfo overview] above.
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 -> {-# UNPACK #-} !BranchCount -> !InterestingCxt -> !TailCallInfo -> OccInfo
[occ_in_lam] :: OccInfo -> !InsideLam
[occ_n_br] :: OccInfo -> {-# UNPACK #-} !BranchCount
[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
isNoOccInfo :: OccInfo -> Bool
strongLoopBreaker :: OccInfo
weakLoopBreaker :: OccInfo
-- | Inside Lambda
data InsideLam
-- | Occurs inside a non-linear lambda Substituting a redex for this
-- occurrence is dangerous because it might duplicate work.
IsInsideLam :: InsideLam
NotInsideLam :: InsideLam
type BranchCount = Int
oneBranch :: BranchCount
-- | Interesting Context
data InterestingCxt
-- | Function: is applied Data value: scrutinised by a case with at least
-- one non-DEFAULT branch
IsInteresting :: InterestingCxt
NotInteresting :: InterestingCxt
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
InitialPhase :: CompilerPhase
Phase :: PhaseNum -> CompilerPhase
FinalPhase :: CompilerPhase
-- | Phase Number
type PhaseNum = Int
beginPhase :: Activation -> CompilerPhase
nextPhase :: CompilerPhase -> CompilerPhase
laterPhase :: CompilerPhase -> CompilerPhase -> CompilerPhase
data Activation
AlwaysActive :: Activation
ActiveBefore :: SourceText -> PhaseNum -> Activation
ActiveAfter :: SourceText -> PhaseNum -> Activation
FinalActive :: Activation
NeverActive :: Activation
isActive :: CompilerPhase -> Activation -> Bool
competesWith :: Activation -> Activation -> Bool
isNeverActive :: Activation -> Bool
isAlwaysActive :: Activation -> Bool
activeInFinalPhase :: Activation -> Bool
activateAfterInitial :: Activation
activateDuringFinal :: Activation
activeAfter :: CompilerPhase -> Activation
-- | Rule Match Information
data RuleMatchInfo
ConLike :: RuleMatchInfo
FunLike :: RuleMatchInfo
isConLike :: RuleMatchInfo -> Bool
isFunLike :: RuleMatchInfo -> Bool
-- | Inline Specification
data InlineSpec
Inline :: SourceText -> InlineSpec
Inlinable :: SourceText -> InlineSpec
NoInline :: SourceText -> InlineSpec
Opaque :: SourceText -> InlineSpec
NoUserInlinePrag :: InlineSpec
noUserInlineSpec :: 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
isNoInlinePragma :: InlinePragma -> Bool
isOpaquePragma :: InlinePragma -> Bool
isAnyInlinePragma :: InlinePragma -> Bool
alwaysInlineConLikePragma :: InlinePragma
inlinePragmaSource :: InlinePragma -> SourceText
-- | Outputs string for pragma name for any of
-- INLINEINLINABLENOINLINE. This differs from the Outputable
-- instance for the InlineSpec type where the pragma name string as well
-- as the accompanying SourceText (if any) is printed.
inlinePragmaName :: InlineSpec -> SDoc
inlineSpecSource :: InlineSpec -> SourceText
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
-- | 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
-- | Subtract an Int from an IntWithInf
subWithInf :: IntWithInf -> 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
-- | 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
data Levity
Lifted :: Levity
Unlifted :: Levity
mightBeLifted :: Maybe Levity -> Bool
mightBeUnlifted :: Maybe Levity -> Bool
-- | Are we dealing with an expression or a pattern?
--
-- Used only for the textual output of certain error messages; see the
-- FRRDataConArg constructor of FRROrigin.
data ExprOrPat
Expression :: ExprOrPat
Pattern :: ExprOrPat
-- | Specify whether to default type variables of kind
-- RuntimeRepLevityMultiplicity.
data NonStandardDefaultingStrategy
-- | Default type variables of the given kinds:
--
--
-- - default RuntimeRep variables to LiftedRep
-- - default Levity variables to Lifted
-- - default Multiplicity variables to Many
--
DefaultNonStandardTyVars :: NonStandardDefaultingStrategy
-- | Try not to default type variables of the kinds
-- RuntimeRepLevityMultiplicity.
--
-- Note that these might get defaulted anyway, if they are kind variables
-- and `-XNoPolyKinds` is enabled.
TryNotToDefaultNonStandardTyVars :: NonStandardDefaultingStrategy
-- | Specify whether to default kind variables, and type variables of kind
-- RuntimeRepLevityMultiplicity.
data DefaultingStrategy
-- | Default kind variables:
--
--
-- - default kind variables of kind Type to
-- Type,
-- - default
-- RuntimeRepLevityMultiplicity kind
-- variables to LiftedRepLiftedMany,
-- respectively.
--
--
-- When this strategy is used, it means that we have determined that the
-- variables we are considering defaulting are all kind variables.
--
-- Usually, we pass this option when -XNoPolyKinds is enabled.
DefaultKindVars :: DefaultingStrategy
-- | Default (or don't default) non-standard variables, of kinds
-- RuntimeRep, Levity and Multiplicity.
NonStandardDefaulting :: NonStandardDefaultingStrategy -> DefaultingStrategy
defaultNonStandardTyVars :: DefaultingStrategy -> Bool
-- | Foreign formats supported by GHC via TH
data ForeignSrcLang
-- | C
LangC :: ForeignSrcLang
-- | C++
LangCxx :: ForeignSrcLang
-- | Objective C
LangObjc :: ForeignSrcLang
-- | Objective C++
LangObjcxx :: ForeignSrcLang
-- | Assembly language (.s)
LangAsm :: ForeignSrcLang
-- | Object (.o)
RawObject :: ForeignSrcLang
instance Data.Data.Data GHC.Types.Basic.LeftOrRight
instance GHC.Classes.Eq GHC.Types.Basic.LeftOrRight
instance GHC.Classes.Ord GHC.Types.Basic.Alignment
instance GHC.Classes.Eq GHC.Types.Basic.Alignment
instance GHC.Classes.Eq GHC.Types.Basic.OneShotInfo
instance Data.Data.Data GHC.Types.Basic.PromotionFlag
instance GHC.Classes.Eq GHC.Types.Basic.PromotionFlag
instance Data.Data.Data GHC.Types.Basic.FunctionOrData
instance GHC.Classes.Ord GHC.Types.Basic.FunctionOrData
instance GHC.Classes.Eq GHC.Types.Basic.FunctionOrData
instance Data.Data.Data GHC.Types.Basic.TopLevelFlag
instance Data.Data.Data GHC.Types.Basic.Boxity
instance GHC.Classes.Eq GHC.Types.Basic.Boxity
instance GHC.Classes.Eq GHC.Types.Basic.CbvMark
instance Data.Data.Data GHC.Types.Basic.RecFlag
instance GHC.Classes.Eq GHC.Types.Basic.RecFlag
instance Data.Data.Data GHC.Types.Basic.Origin
instance GHC.Classes.Eq GHC.Types.Basic.Origin
instance Data.Data.Data GHC.Types.Basic.OverlapMode
instance GHC.Classes.Eq GHC.Types.Basic.OverlapMode
instance Data.Data.Data GHC.Types.Basic.OverlapFlag
instance GHC.Classes.Eq GHC.Types.Basic.OverlapFlag
instance GHC.Show.Show GHC.Types.Basic.PprPrec
instance GHC.Classes.Ord GHC.Types.Basic.PprPrec
instance GHC.Classes.Eq GHC.Types.Basic.PprPrec
instance Data.Data.Data GHC.Types.Basic.TupleSort
instance GHC.Classes.Eq GHC.Types.Basic.TupleSort
instance GHC.Classes.Eq GHC.Types.Basic.UnboxedTupleOrSum
instance GHC.Classes.Eq GHC.Types.Basic.InterestingCxt
instance GHC.Classes.Eq GHC.Types.Basic.InsideLam
instance GHC.Classes.Eq GHC.Types.Basic.TailCallInfo
instance GHC.Classes.Eq GHC.Types.Basic.OccInfo
instance GHC.Classes.Eq GHC.Types.Basic.CompilerPhase
instance Data.Data.Data GHC.Types.Basic.Activation
instance GHC.Classes.Eq GHC.Types.Basic.Activation
instance GHC.Show.Show GHC.Types.Basic.RuleMatchInfo
instance Data.Data.Data GHC.Types.Basic.RuleMatchInfo
instance GHC.Classes.Eq GHC.Types.Basic.RuleMatchInfo
instance GHC.Show.Show GHC.Types.Basic.InlineSpec
instance Data.Data.Data GHC.Types.Basic.InlineSpec
instance GHC.Classes.Eq GHC.Types.Basic.InlineSpec
instance Data.Data.Data GHC.Types.Basic.InlinePragma
instance GHC.Classes.Eq GHC.Types.Basic.InlinePragma
instance GHC.Classes.Eq GHC.Types.Basic.IntWithInf
instance Data.Data.Data GHC.Types.Basic.SpliceExplicitFlag
instance GHC.Classes.Eq GHC.Types.Basic.TypeOrKind
instance GHC.Classes.Eq GHC.Types.Basic.Levity
instance GHC.Classes.Eq GHC.Types.Basic.ExprOrPat
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.DefaultingStrategy
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.NonStandardDefaultingStrategy
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.ExprOrPat
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.Levity
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.TypeOrKind
instance GHC.Classes.Ord GHC.Types.Basic.IntWithInf
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.IntWithInf
instance GHC.Num.Num GHC.Types.Basic.IntWithInf
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.InlinePragma
instance GHC.Utils.Binary.Binary GHC.Types.Basic.InlinePragma
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.InlineSpec
instance GHC.Utils.Binary.Binary GHC.Types.Basic.InlineSpec
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.RuleMatchInfo
instance GHC.Utils.Binary.Binary GHC.Types.Basic.RuleMatchInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.Activation
instance GHC.Utils.Binary.Binary GHC.Types.Basic.Activation
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.CompilerPhase
instance GHC.Base.Semigroup GHC.Types.Basic.SuccessFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.SuccessFlag
instance GHC.Utils.Outputable.Outputable (GHC.Types.Basic.DefMethSpec ty)
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.OccInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.TailCallInfo
instance GHC.Base.Semigroup GHC.Types.Basic.InsideLam
instance GHC.Base.Monoid GHC.Types.Basic.InsideLam
instance GHC.Base.Semigroup GHC.Types.Basic.InterestingCxt
instance GHC.Base.Monoid GHC.Types.Basic.InterestingCxt
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.UnboxedTupleOrSum
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.TupleSort
instance GHC.Utils.Binary.Binary GHC.Types.Basic.TupleSort
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.OverlapFlag
instance GHC.Utils.Binary.Binary GHC.Types.Basic.OverlapFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.OverlapMode
instance GHC.Utils.Binary.Binary GHC.Types.Basic.OverlapMode
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.Origin
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.RecFlag
instance GHC.Utils.Binary.Binary GHC.Types.Basic.RecFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.CbvMark
instance GHC.Utils.Binary.Binary GHC.Types.Basic.CbvMark
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.Boxity
instance GHC.Utils.Binary.Binary GHC.Types.Basic.Boxity
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.TopLevelFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.FunctionOrData
instance GHC.Utils.Binary.Binary GHC.Types.Basic.FunctionOrData
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.PromotionFlag
instance GHC.Utils.Binary.Binary GHC.Types.Basic.PromotionFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.SwapFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.OneShotInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.Alignment
instance GHC.Utils.Outputable.OutputableP env GHC.Types.Basic.Alignment
instance GHC.Utils.Outputable.Outputable GHC.Types.Basic.LeftOrRight
instance GHC.Utils.Binary.Binary GHC.Types.Basic.LeftOrRight
-- | Platform description
module GHC.Platform
-- | Platform description
--
-- This is used to describe platforms so that we can generate code for
-- them.
data Platform
Platform :: !ArchOS -> !PlatformWordSize -> !ByteOrder -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe PlatformConstants -> Platform
-- | Architecture and OS
[platformArchOS] :: Platform -> !ArchOS
-- | Word size
[platformWordSize] :: Platform -> !PlatformWordSize
-- | Byte order (endianness)
[platformByteOrder] :: Platform -> !ByteOrder
[platformUnregisterised] :: Platform -> !Bool
[platformHasGnuNonexecStack] :: Platform -> !Bool
[platformHasIdentDirective] :: Platform -> !Bool
[platformHasSubsectionsViaSymbols] :: Platform -> !Bool
[platformIsCrossCompiling] :: Platform -> !Bool
-- | Symbols need underscore prefix
[platformLeadingUnderscore] :: Platform -> !Bool
-- | Determines whether we will be compiling info tables that reside just
-- before the entry code, or with an indirection to the entry code. See
-- TABLES_NEXT_TO_CODE in rtsincludertsstorageInfoTables.h.
[platformTablesNextToCode] :: Platform -> !Bool
-- | 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.
[platformHasLibm] :: Platform -> !Bool
-- | Constants such as structure offsets, type sizes, etc.
[platform_constants] :: Platform -> !Maybe PlatformConstants
data PlatformWordSize
-- | A 32-bit platform
PW4 :: PlatformWordSize
-- | A 64-bit platform
PW8 :: PlatformWordSize
-- | Platform architecture
platformArch :: Platform -> Arch
-- | Platform OS
platformOS :: Platform -> OS
-- | Platform architecture and OS.
data ArchOS
ArchOS :: Arch -> OS -> ArchOS
[archOS_arch] :: ArchOS -> Arch
[archOS_OS] :: ArchOS -> OS
-- | Architectures
--
-- 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
ArchS390X :: Arch
ArchARM :: ArmISA -> [ArmISAExt] -> ArmABI -> Arch
ArchAArch64 :: Arch
ArchAlpha :: Arch
ArchMipseb :: Arch
ArchMipsel :: Arch
ArchRISCV64 :: Arch
ArchJavaScript :: Arch
-- | Operating systems.
--
-- Using OSUnknown to generate code should produce a sensible default,
-- but no promises.
data OS
OSUnknown :: OS
OSLinux :: OS
OSDarwin :: OS
OSSolaris2 :: OS
OSMinGW32 :: OS
OSFreeBSD :: OS
OSDragonFly :: OS
OSOpenBSD :: OS
OSNetBSD :: OS
OSKFreeBSD :: OS
OSHaiku :: OS
OSQNXNTO :: OS
OSAIX :: OS
OSHurd :: OS
-- | ARM Instruction Set Architecture
data ArmISA
ARMv5 :: ArmISA
ARMv6 :: ArmISA
ARMv7 :: ArmISA
-- | ARM extensions
data ArmISAExt
VFPv2 :: ArmISAExt
VFPv3 :: ArmISAExt
VFPv3D16 :: ArmISAExt
NEON :: ArmISAExt
IWMMX2 :: ArmISAExt
-- | ARM ABI
data ArmABI
SOFT :: ArmABI
SOFTFP :: ArmABI
HARD :: ArmABI
-- | PowerPC 64-bit ABI
data PPC_64ABI
-- | PowerPC64
ELF_V1 :: PPC_64ABI
-- | PowerPC64 LE
ELF_V2 :: PPC_64ABI
-- | Byte ordering.
data ByteOrder
-- | most-significant-byte occurs in lowest address.
BigEndian :: ByteOrder
-- | least-significant-byte occurs in lowest address.
LittleEndian :: ByteOrder
-- | 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
platformWordSizeInBytes :: Platform -> Int
platformWordSizeInBits :: Platform -> Int
-- | Minimum representable Int value for the given platform
platformMinInt :: Platform -> Integer
-- | Maximum representable Int value for the given platform
platformMaxInt :: Platform -> Integer
-- | Maximum representable Word value for the given platform
platformMaxWord :: Platform -> Integer
-- | Test if the given Integer is representable with a platform Int
platformInIntRange :: Platform -> Integer -> Bool
-- | Test if the given Integer is representable with a platform Word
platformInWordRange :: Platform -> Integer -> Bool
-- | For some architectures the C calling convention is that any integer
-- shorter than 64 bits is replaced by its 64 bits representation using
-- sign or zero extension.
platformCConvNeedsExtension :: Platform -> Bool
-- | Platform-specific settings formerly hard-coded in Config.hs.
--
-- These should probably be all be triaged whether they can be computed
-- from other settings or belong in another another place (like
-- Platform above).
data PlatformMisc
PlatformMisc :: String -> Bool -> Bool -> String -> PlatformMisc
[platformMisc_targetPlatformString] :: PlatformMisc -> String
[platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool
[platformMisc_libFFI] :: PlatformMisc -> Bool
[platformMisc_llvmTarget] :: PlatformMisc -> String
-- | x86 SSE instructions
data SseVersion
SSE1 :: SseVersion
SSE2 :: SseVersion
SSE3 :: SseVersion
SSE4 :: SseVersion
SSE42 :: SseVersion
-- | x86 BMI (bit manipulation) instructions
data BmiVersion
BMI1 :: BmiVersion
BMI2 :: BmiVersion
wordAlignment :: Platform -> Alignment
isSseEnabled :: Platform -> Bool
isSse2Enabled :: Platform -> Bool
data PlatformConstants
PlatformConstants :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> !Integer -> !Integer -> !Integer -> !Bool -> PlatformConstants
[pc_CONTROL_GROUP_CONST_291] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_STD_HDR_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_PROF_HDR_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_BLOCK_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_BLOCKS_PER_MBLOCK] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_TICKY_BIN_COUNT] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR7] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR8] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR9] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rR10] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rF6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rD6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rXMM6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rYMM6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM2] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM3] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM4] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM5] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rZMM6] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rL1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rSp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rSpLim] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rHp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rHpLim] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rCCCS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rCurrentTSO] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rCurrentNursery] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgRegTable_rHpAlloc] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_stgEagerBlackholeInfo] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_stgGCEnter1] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_stgGCFun] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_Capability_r] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_start] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_free] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_blocks] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_bdescr_flags] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_CostCentreStack] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_CostCentreStack_mem_alloc] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_CostCentreStack_mem_alloc] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_CostCentreStack_scc_count] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_CostCentreStack_scc_count] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgHeader_ccs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgHeader_ldvw] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgSMPThunkHeader] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_allocs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgEntCounter_allocs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_allocd] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgEntCounter_allocd] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_registeredp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_link] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgEntCounter_entry_count] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgUpdateFrame_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgMutArrPtrs_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgMutArrPtrs_ptrs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgMutArrPtrs_size] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgSmallMutArrPtrs_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgSmallMutArrPtrs_ptrs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgArrBytes_NoHdr] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgArrBytes_bytes] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgTSO_alloc_limit] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgTSO_cccs] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgTSO_stackobj] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgStack_sp] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgStack_stack] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgUpdateFrame_updatee] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgFunInfoExtraFwd_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgFunInfoExtraFwd_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_SIZEOF_StgFunInfoExtraRev] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_OFFSET_StgFunInfoExtraRev_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_REP_StgFunInfoExtraRev_arity] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_SPEC_SELECTEE_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_SPEC_AP_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MIN_PAYLOAD_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MIN_INTLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_INTLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MIN_CHARLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_CHARLIKE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MUT_ARR_PTRS_CARD_BITS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Vanilla_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Float_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Double_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Long_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_XMM_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Vanilla_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Float_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Double_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_XMM_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_MAX_Real_Long_REG] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_RESERVED_C_STACK_BYTES] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_RESERVED_STACK_WORDS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_AP_STACK_SPLIM] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_WORD_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_CINT_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_CLONG_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_CLONG_LONG_SIZE] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_BITMAP_BITS_SHIFT] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_TAG_BITS] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_LDV_SHIFT] :: PlatformConstants -> {-# UNPACK #-} !Int
[pc_ILDV_CREATE_MASK] :: PlatformConstants -> !Integer
[pc_ILDV_STATE_CREATE] :: PlatformConstants -> !Integer
[pc_ILDV_STATE_USE] :: PlatformConstants -> !Integer
[pc_USE_INLINE_SRT_FIELD] :: PlatformConstants -> !Bool
-- | Try to locate "GhclibDerivedConstants.h" file in the given dirs and to
-- parse the PlatformConstants from it.
--
-- See Note [Platform constants]
lookupPlatformConstants :: [FilePath] -> IO (Maybe PlatformConstants)
platformConstants :: Platform -> PlatformConstants
platformSOName :: Platform -> FilePath -> FilePath
platformHsSOName :: Platform -> FilePath -> FilePath
platformSOExt :: Platform -> FilePath
genericPlatform :: Platform
instance GHC.Classes.Ord GHC.Platform.PlatformWordSize
instance GHC.Classes.Eq GHC.Platform.PlatformWordSize
instance GHC.Classes.Ord GHC.Platform.Platform
instance GHC.Classes.Eq GHC.Platform.Platform
instance GHC.Show.Show GHC.Platform.Platform
instance GHC.Read.Read GHC.Platform.Platform
instance GHC.Classes.Ord GHC.Platform.SseVersion
instance GHC.Classes.Eq GHC.Platform.SseVersion
instance GHC.Classes.Ord GHC.Platform.BmiVersion
instance GHC.Classes.Eq GHC.Platform.BmiVersion
instance GHC.Show.Show GHC.Platform.PlatformWordSize
instance GHC.Read.Read GHC.Platform.PlatformWordSize
-- | Run-time settings
module GHC.Settings
data Settings
Settings :: {-# UNPACK #-} !GhcNameVersion -> {-# UNPACK #-} !FileSettings -> Platform -> {-# UNPACK #-} !ToolSettings -> {-# UNPACK #-} !PlatformMisc -> [(String, String)] -> Settings
[sGhcNameVersion] :: Settings -> {-# UNPACK #-} !GhcNameVersion
[sFileSettings] :: Settings -> {-# UNPACK #-} !FileSettings
[sTargetPlatform] :: Settings -> Platform
[sToolSettings] :: Settings -> {-# UNPACK #-} !ToolSettings
[sPlatformMisc] :: Settings -> {-# UNPACK #-} !PlatformMisc
[sRawSettings] :: Settings -> [(String, String)]
-- | Settings for other executables GHC calls.
--
-- Probably should further split down by phase, or split between
-- platform-specific and platform-agnostic.
data ToolSettings
ToolSettings :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> String -> (String, [Option]) -> String -> String -> (String, [Option]) -> (String, [Option]) -> (String, [Option]) -> (String, [Option]) -> String -> String -> String -> String -> String -> String -> String -> (String, [Option]) -> (String, [Option]) -> (String, [Option]) -> String -> [String] -> [String] -> Fingerprint -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> [String] -> ToolSettings
[toolSettings_ldSupportsCompactUnwind] :: ToolSettings -> Bool
[toolSettings_ldSupportsBuildId] :: ToolSettings -> Bool
[toolSettings_ldSupportsFilelist] :: ToolSettings -> Bool
[toolSettings_ldIsGnuLd] :: ToolSettings -> Bool
[toolSettings_ccSupportsNoPie] :: ToolSettings -> Bool
[toolSettings_useInplaceMinGW] :: ToolSettings -> Bool
[toolSettings_pgm_L] :: ToolSettings -> String
[toolSettings_pgm_P] :: ToolSettings -> (String, [Option])
[toolSettings_pgm_F] :: ToolSettings -> String
[toolSettings_pgm_c] :: ToolSettings -> String
[toolSettings_pgm_a] :: ToolSettings -> (String, [Option])
[toolSettings_pgm_l] :: ToolSettings -> (String, [Option])
[toolSettings_pgm_lm] :: ToolSettings -> (String, [Option])
[toolSettings_pgm_dll] :: ToolSettings -> (String, [Option])
[toolSettings_pgm_T] :: ToolSettings -> String
[toolSettings_pgm_windres] :: ToolSettings -> String
[toolSettings_pgm_libtool] :: ToolSettings -> String
[toolSettings_pgm_ar] :: ToolSettings -> String
[toolSettings_pgm_otool] :: ToolSettings -> String
[toolSettings_pgm_install_name_tool] :: ToolSettings -> String
[toolSettings_pgm_ranlib] :: ToolSettings -> String
-- | LLVM: opt llvm optimiser
[toolSettings_pgm_lo] :: ToolSettings -> (String, [Option])
-- | LLVM: llc static compiler
[toolSettings_pgm_lc] :: ToolSettings -> (String, [Option])
-- | LLVM: c compiler
[toolSettings_pgm_lcc] :: ToolSettings -> (String, [Option])
[toolSettings_pgm_i] :: ToolSettings -> String
[toolSettings_opt_L] :: ToolSettings -> [String]
[toolSettings_opt_P] :: ToolSettings -> [String]
-- | cached Fingerprint of sOpt_P See Note [Repeated -optP hashing]
[toolSettings_opt_P_fingerprint] :: ToolSettings -> Fingerprint
[toolSettings_opt_F] :: ToolSettings -> [String]
[toolSettings_opt_c] :: ToolSettings -> [String]
[toolSettings_opt_cxx] :: ToolSettings -> [String]
[toolSettings_opt_a] :: ToolSettings -> [String]
[toolSettings_opt_l] :: ToolSettings -> [String]
[toolSettings_opt_lm] :: ToolSettings -> [String]
[toolSettings_opt_windres] :: ToolSettings -> [String]
-- | LLVM: llvm optimiser
[toolSettings_opt_lo] :: ToolSettings -> [String]
-- | LLVM: llc static compiler
[toolSettings_opt_lc] :: ToolSettings -> [String]
-- | LLVM: c compiler
[toolSettings_opt_lcc] :: ToolSettings -> [String]
-- | iserv options
[toolSettings_opt_i] :: ToolSettings -> [String]
[toolSettings_extraGccViaCFlags] :: ToolSettings -> [String]
-- | Paths to various files and directories used by GHC, including those
-- that provide more settings.
data FileSettings
FileSettings :: FilePath -> FilePath -> Maybe FilePath -> FilePath -> FilePath -> FileSettings
[fileSettings_ghcUsagePath] :: FileSettings -> FilePath
[fileSettings_ghciUsagePath] :: FileSettings -> FilePath
[fileSettings_toolDir] :: FileSettings -> Maybe FilePath
[fileSettings_topDir] :: FileSettings -> FilePath
[fileSettings_globalPackageDatabase] :: FileSettings -> FilePath
-- | Settings for what GHC this is.
data GhcNameVersion
GhcNameVersion :: String -> String -> GhcNameVersion
[ghcNameVersion_programName] :: GhcNameVersion -> String
[ghcNameVersion_projectVersion] :: GhcNameVersion -> String
-- | Platform description
--
-- This is used to describe platforms so that we can generate code for
-- them.
data Platform
Platform :: !ArchOS -> !PlatformWordSize -> !ByteOrder -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe PlatformConstants -> Platform
-- | Architecture and OS
[platformArchOS] :: Platform -> !ArchOS
-- | Word size
[platformWordSize] :: Platform -> !PlatformWordSize
-- | Byte order (endianness)
[platformByteOrder] :: Platform -> !ByteOrder
[platformUnregisterised] :: Platform -> !Bool
[platformHasGnuNonexecStack] :: Platform -> !Bool
[platformHasIdentDirective] :: Platform -> !Bool
[platformHasSubsectionsViaSymbols] :: Platform -> !Bool
[platformIsCrossCompiling] :: Platform -> !Bool
-- | Symbols need underscore prefix
[platformLeadingUnderscore] :: Platform -> !Bool
-- | Determines whether we will be compiling info tables that reside just
-- before the entry code, or with an indirection to the entry code. See
-- TABLES_NEXT_TO_CODE in rtsincludertsstorageInfoTables.h.
[platformTablesNextToCode] :: Platform -> !Bool
-- | 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.
[platformHasLibm] :: Platform -> !Bool
-- | Constants such as structure offsets, type sizes, etc.
[platform_constants] :: Platform -> !Maybe PlatformConstants
-- | Platform-specific settings formerly hard-coded in Config.hs.
--
-- These should probably be all be triaged whether they can be computed
-- from other settings or belong in another another place (like
-- Platform above).
data PlatformMisc
PlatformMisc :: String -> Bool -> Bool -> String -> PlatformMisc
[platformMisc_targetPlatformString] :: PlatformMisc -> String
[platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool
[platformMisc_libFFI] :: PlatformMisc -> Bool
[platformMisc_llvmTarget] :: PlatformMisc -> String
-- | Dynamic library suffix
dynLibSuffix :: GhcNameVersion -> String
sProgramName :: Settings -> String
sProjectVersion :: Settings -> String
sGhcUsagePath :: Settings -> FilePath
sGhciUsagePath :: Settings -> FilePath
sToolDir :: Settings -> Maybe FilePath
sTopDir :: Settings -> FilePath
sGlobalPackageDatabasePath :: Settings -> FilePath
sLdSupportsCompactUnwind :: Settings -> Bool
sLdSupportsBuildId :: Settings -> Bool
sLdSupportsFilelist :: Settings -> Bool
sLdIsGnuLd :: Settings -> Bool
sGccSupportsNoPie :: Settings -> Bool
sUseInplaceMinGW :: Settings -> Bool
sPgm_L :: Settings -> String
sPgm_P :: Settings -> (String, [Option])
sPgm_F :: Settings -> String
sPgm_c :: Settings -> String
sPgm_a :: Settings -> (String, [Option])
sPgm_l :: Settings -> (String, [Option])
sPgm_lm :: Settings -> (String, [Option])
sPgm_dll :: Settings -> (String, [Option])
sPgm_T :: Settings -> String
sPgm_windres :: Settings -> String
sPgm_libtool :: Settings -> String
sPgm_ar :: Settings -> String
sPgm_otool :: Settings -> String
sPgm_install_name_tool :: Settings -> String
sPgm_ranlib :: Settings -> String
sPgm_lo :: Settings -> (String, [Option])
sPgm_lc :: Settings -> (String, [Option])
sPgm_lcc :: Settings -> (String, [Option])
sPgm_i :: Settings -> String
sOpt_L :: Settings -> [String]
sOpt_P :: Settings -> [String]
sOpt_P_fingerprint :: Settings -> Fingerprint
sOpt_F :: Settings -> [String]
sOpt_c :: Settings -> [String]
sOpt_cxx :: Settings -> [String]
sOpt_a :: Settings -> [String]
sOpt_l :: Settings -> [String]
sOpt_lm :: Settings -> [String]
sOpt_windres :: Settings -> [String]
sOpt_lo :: Settings -> [String]
sOpt_lc :: Settings -> [String]
sOpt_lcc :: Settings -> [String]
sOpt_i :: Settings -> [String]
sExtraGccViaCFlags :: Settings -> [String]
sTargetPlatformString :: Settings -> String
sGhcWithInterpreter :: Settings -> Bool
sLibFFI :: Settings -> Bool
-- | Ways
--
-- The central concept of a "way" is that all objects in a given program
-- must be compiled in the same "way". Certain options change parameters
-- of the virtual machine, eg. profiling adds an extra word to the object
-- header, so profiling objects cannot be linked with non-profiling
-- objects.
--
-- After parsing the command-line options, we determine which "way" we
-- are building - this might be a combination way, eg.
-- profiling+threaded.
--
-- There are two kinds of ways: - RTS only: only affect the runtime
-- system (RTS) and don't affect code generation (e.g. threaded, debug) -
-- Full ways: affect code generation and the RTS (e.g. profiling, dynamic
-- linking)
--
-- We then find the "build-tag" associated with this way, and this
-- becomes the suffix used to find .hi files and libraries used in this
-- compilation.
module GHC.Platform.Ways
-- | A way
--
-- Don't change the constructor order as it us used by waysTag to
-- create a unique tag (e.g. thr_debug_p) which is expected by other
-- tools (e.g. Cabal).
data Way
-- | for GHC API clients building custom variants
WayCustom :: String -> Way
-- | (RTS only) Multithreaded runtime system
WayThreaded :: Way
-- | Debugging, enable trace messages and extra checks
WayDebug :: Way
-- | Profiling, enable cost-centre stacks and profiling reports
WayProf :: Way
-- | (RTS only) enable event logging (tracing)
WayTracing :: Way
-- | Dynamic linking
WayDyn :: Way
type Ways = Set Way
-- | Test if a way is enabled
hasWay :: Ways -> Way -> Bool
-- | Test if a way is not enabled
hasNotWay :: Ways -> Way -> Bool
-- | Add a way
addWay :: Way -> Ways -> Ways
-- | Remove a way
removeWay :: Way -> Ways -> Ways
-- | Check if a combination of ways is allowed
allowed_combination :: Ways -> Bool
-- | Turn these flags on when enabling this way
wayGeneralFlags :: Platform -> Way -> [GeneralFlag]
-- | Turn these flags off when enabling this way
wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag]
-- | Pass these options to the C compiler when enabling this way
wayOptc :: Platform -> Way -> [String]
-- | Pass these options to linker when enabling this way
wayOptl :: Platform -> Way -> [String]
-- | Pass these options to the preprocessor when enabling this way
wayOptP :: Platform -> Way -> [String]
wayDesc :: Way -> String
-- | Return true for ways that only impact the RTS, not the generated code
wayRTSOnly :: Way -> Bool
-- | Unique build-tag associated to a way
wayTag :: Way -> String
-- | Unique tag associated to a list of ways
waysTag :: Ways -> String
-- | Unique build-tag associated to a list of ways
--
-- RTS only ways are filtered out because they have no impact on the
-- build.
waysBuildTag :: Ways -> String
-- | Filter ways that have an impact on compilation
fullWays :: Ways -> Ways
-- | Filter RTS-only ways (ways that don't have an impact on compilation)
rtsWays :: Ways -> Ways
-- | Host ways.
hostWays :: Ways
-- | Host "full" ways (i.e. ways that have an impact on the compilation,
-- not RTS only ways).
--
-- These ways must be used when compiling codes targeting the internal
-- interpreter.
hostFullWays :: Ways
-- | Consult the RTS to find whether it has been built with profiling
-- enabled.
hostIsProfiled :: Bool
-- | Consult the RTS to find whether GHC itself has been built with dynamic
-- linking. This can't be statically known at compile-time, because we
-- build both the static and dynamic versions together with -dynamic-too.
hostIsDynamic :: Bool
hostIsThreaded :: Bool
hostIsDebugged :: Bool
hostIsTracing :: Bool
instance GHC.Read.Read GHC.Platform.Ways.Way
instance GHC.Show.Show GHC.Platform.Ways.Way
instance GHC.Classes.Ord GHC.Platform.Ways.Way
instance GHC.Classes.Eq GHC.Platform.Ways.Way
-- | Info about installed units (compiled libraries)
module GHC.Unit.Info
-- | Information about an unit (a unit is an installed module library).
--
-- This is a subset of Cabal's InstalledPackageInfo, with just
-- the bits that GHC is interested in.
--
-- Some types are left as parameters to be instantiated differently in
-- ghc-pkg and in ghc itself.
data GenericUnitInfo srcpkgid srcpkgname uid modulename mod
GenericUnitInfo :: uid -> uid -> [(modulename, mod)] -> srcpkgid -> srcpkgname -> Version -> Maybe srcpkgname -> ShortText -> [uid] -> [(uid, ShortText)] -> [FilePathST] -> [ShortText] -> [ShortText] -> [ShortText] -> [FilePathST] -> [FilePathST] -> [ShortText] -> [FilePathST] -> [ShortText] -> [ShortText] -> [ShortText] -> [FilePathST] -> [FilePathST] -> [FilePathST] -> [(modulename, Maybe mod)] -> [modulename] -> Bool -> Bool -> Bool -> GenericUnitInfo srcpkgid srcpkgname uid modulename mod
-- | Unique unit identifier that is used during compilation (e.g. to
-- generate symbols).
[unitId] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> uid
-- | Identifier of an indefinite unit (i.e. with module holes) that this
-- unit is an instance of.
--
-- For non instantiated units, unitInstanceOf=unitId
[unitInstanceOf] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> uid
-- | How this unit instantiates some of its module holes. Map hole module
-- names to actual module
[unitInstantiations] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(modulename, mod)]
-- | Source package identifier.
--
-- Cabal instantiates this with Distribution.Types.PackageId.PackageId
-- type which only contains the source package name and version. Notice
-- that it doesn't contain the Hackage revision, nor any kind of hash.
[unitPackageId] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> srcpkgid
-- | Source package name
[unitPackageName] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> srcpkgname
-- | Source package version
[unitPackageVersion] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Version
-- | Name of the component.
--
-- Cabal supports more than one components (libraries, executables,
-- testsuites) in the same package. Each component has a name except the
-- default one (that can only be a library component) for which we use
-- Nothing.
--
-- GHC only deals with "library" components as they are the only kind of
-- components that can be registered in a database and used by other
-- modules.
[unitComponentName] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Maybe srcpkgname
-- | ABI hash used to avoid mixing up units compiled with different
-- dependencies, compiler, options, etc.
[unitAbiHash] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> ShortText
-- | Identifiers of the units this one depends on
[unitDepends] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [uid]
-- | Like unitDepends, but each dependency is annotated with the ABI
-- hash we expect the dependency to respect.
[unitAbiDepends] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(uid, ShortText)]
-- | Directories containing module interfaces
[unitImportDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Names of the Haskell libraries provided by this unit
[unitLibraries] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Names of the external system libraries that this unit depends on. See
-- also unitExtDepLibsGhc field.
[unitExtDepLibsSys] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Because of slight differences between the GHC dynamic linker (in
-- GHC.Runtime.Linker) and the native system linker, some packages have
-- to link with a different list of libraries when using GHC's. Examples
-- include: libs that are actually gnu ld scripts, and the possibility
-- that the .a libs do not exactly match the .so/.dll equivalents.
--
-- If this field is set, then we use that instead of the
-- unitExtDepLibsSys field.
[unitExtDepLibsGhc] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Directories containing libraries provided by this unit. See also
-- unitLibraryDynDirs.
--
-- It seems to be used to store paths to external library dependencies
-- too.
[unitLibraryDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Directories containing the dynamic libraries provided by this unit.
-- See also unitLibraryDirs.
--
-- It seems to be used to store paths to external dynamic library
-- dependencies too.
[unitLibraryDynDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Names of the external MacOS frameworks that this unit depends on.
[unitExtDepFrameworks] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Directories containing MacOS frameworks that this unit depends on.
[unitExtDepFrameworkDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Linker (e.g. ld) command line options
[unitLinkerOptions] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | C compiler options that needs to be passed to the C compiler when we
-- compile some C code against this unit.
[unitCcOptions] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | C header files that are required by this unit (provided by this unit
-- or external)
[unitIncludes] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]
-- | Directories containing C header files that this unit depends on.
[unitIncludeDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Paths to Haddock interface files for this unit
[unitHaddockInterfaces] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Paths to Haddock directories containing HTML files
[unitHaddockHTMLs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]
-- | Modules exposed by the unit.
--
-- A module can be re-exported from another package. In this case, we
-- indicate the module origin in the second parameter.
[unitExposedModules] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(modulename, Maybe mod)]
-- | Hidden modules.
--
-- These are useful for error reporting (e.g. if a hidden module is
-- imported)
[unitHiddenModules] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [modulename]
-- | True if this unit has some module holes that need to be instantiated
-- with real modules to make the unit usable (a.k.a. Backpack).
[unitIsIndefinite] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool
-- | True if the unit is exposed. A unit could be installed in a database
-- by "disabled" by not being exposed.
[unitIsExposed] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool
-- | True if the unit is trusted (cf Safe Haskell)
[unitIsTrusted] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool
-- | Information about an installed unit
--
-- We parameterize on the unit identifier: * UnitKey: identifier used in
-- the database (cf UnitKeyInfo) * UnitId: identifier used to
-- generate code (cf UnitInfo)
--
-- These two identifiers are different for wired-in packages. See Note
-- [About units] in GHC.Unit
type GenUnitInfo unit = GenericUnitInfo PackageId PackageName unit ModuleName (GenModule (GenUnit unit))
-- | Information about an installed unit (units are identified by their
-- internal UnitId)
type UnitInfo = GenUnitInfo UnitId
-- | A unit key in the database
newtype UnitKey
UnitKey :: FastString -> UnitKey
-- | Information about an installed unit (units are identified by their
-- database UnitKey)
type UnitKeyInfo = GenUnitInfo UnitKey
-- | Convert a DbUnitInfo (read from a package database) into
-- UnitKeyInfo
mkUnitKeyInfo :: DbUnitInfo -> UnitKeyInfo
-- | Map over the unit parameter
mapUnitInfo :: IsUnitId v => (u -> v) -> GenUnitInfo u -> GenUnitInfo v
-- | Create a UnitPprInfo from a UnitInfo
mkUnitPprInfo :: (u -> FastString) -> GenUnitInfo u -> UnitPprInfo
-- | Make a Unit from a UnitInfo
--
-- If the unit is definite, make a RealUnit from unitId
-- field.
--
-- If the unit is indefinite, make a VirtUnit from
-- unitInstanceOf and unitInstantiations fields. Note that
-- in this case we don't keep track of unitId. It can be retrieved
-- later with "improvement", i.e. matching on
-- `unitInstanceOf/unitInstantiations` fields (see Note [About units] in
-- GHC.Unit).
mkUnit :: UnitInfo -> Unit
newtype PackageId
PackageId :: FastString -> PackageId
newtype PackageName
PackageName :: FastString -> PackageName
[unPackageName] :: PackageName -> FastString
-- | 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]
unitPackageNameString :: GenUnitInfo u -> String
unitPackageIdString :: GenUnitInfo u -> String
pprUnitInfo :: UnitInfo -> SDoc
-- | Find all the include directories in the given units
collectIncludeDirs :: [UnitInfo] -> [FilePath]
-- | Find all the C-compiler options in the given units
collectExtraCcOpts :: [UnitInfo] -> [String]
-- | Find all the library directories in the given units for the given ways
collectLibraryDirs :: Ways -> [UnitInfo] -> [FilePath]
-- | Find all the frameworks in the given units
collectFrameworks :: [UnitInfo] -> [String]
-- | Find all the package framework paths in these and the preload packages
collectFrameworksDirs :: [UnitInfo] -> [String]
unitHsLibs :: GhcNameVersion -> Ways -> UnitInfo -> [String]
instance GHC.Classes.Eq GHC.Unit.Info.PackageId
instance GHC.Classes.Eq GHC.Unit.Info.PackageName
instance GHC.Types.Unique.Uniquable GHC.Unit.Info.PackageName
instance GHC.Utils.Outputable.Outputable GHC.Unit.Info.PackageName
instance GHC.Types.Unique.Uniquable GHC.Unit.Info.PackageId
instance GHC.Utils.Outputable.Outputable GHC.Unit.Info.PackageId
-- | Platform profiles
module GHC.Platform.Profile
-- | A platform profile fully describes the kind of objects that are
-- generated for a platform.
--
-- Platform doesn't fully describe the ABI of an object. Compiler
-- ways (profiling, debug, dynamic) also modify the ABI.
data Profile
Profile :: !Platform -> !Ways -> Profile
-- | Platform
[profilePlatform] :: Profile -> !Platform
-- | Ways
[profileWays] :: Profile -> !Ways
-- | Unique build tag for the profile
profileBuildTag :: Profile -> String
-- | Get platform constants
profileConstants :: Profile -> PlatformConstants
-- | Is profiling enabled
profileIsProfiling :: Profile -> Bool
-- | Word size in bytes
profileWordSizeInBytes :: Profile -> Int
instance GHC.Read.Read GHC.Platform.Profile.Profile
instance GHC.Show.Show GHC.Platform.Profile.Profile
instance GHC.Classes.Ord GHC.Platform.Profile.Profile
instance GHC.Classes.Eq GHC.Platform.Profile.Profile
module GHC.Runtime.Heap.Layout
-- | 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 => Platform -> 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 :: Platform -> ByteOff -> WordOff
-- | Round up the given byte count to the next byte count that's a multiple
-- of the machine's word size.
roundUpToWords :: Platform -> ByteOff -> ByteOff
-- | Round up base to a multiple of size.
roundUpTo :: ByteOff -> ByteOff -> ByteOff
data StgWord
fromStgWord :: StgWord -> Integer
toStgWord :: Platform -> Integer -> StgWord
data StgHalfWord
fromStgHalfWord :: StgHalfWord -> Integer
toStgHalfWord :: Platform -> Integer -> StgHalfWord
-- | Half word size in bytes
halfWordSize :: Platform -> ByteOff
halfWordSizeInBits :: Platform -> Int
-- | A description of the layout of a closure. Corresponds directly to the
-- closure types in includes/rts/storage/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 :: ConTagZ -> ConstrDescription -> ClosureTypeInfo
Fun :: FunArity -> ArgDescr -> ClosureTypeInfo
Thunk :: ClosureTypeInfo
ThunkSelector :: SelectorOffset -> ClosureTypeInfo
BlackHole :: ClosureTypeInfo
IndStatic :: ClosureTypeInfo
-- | An ArgDescr describes the argument pattern of a function
data ArgDescr
ArgSpec :: !Int -> ArgDescr
ArgGen :: Liveness -> ArgDescr
ArgUnknown :: ArgDescr
-- | We represent liveness bitmaps as a Bitmap (whose internal
-- representation really is a bitmap). These are pinned onto case return
-- vectors to indicate the state of the stack for the garbage collector.
--
-- In the compiled program, liveness bitmaps that fit inside a single
-- word (StgWord) are stored as a single word, while larger bitmaps are
-- stored as a pointer to an array of words.
type Liveness = [Bool]
type ConstrDescription = ByteString
mkHeapRep :: Profile -> IsStatic -> WordOff -> WordOff -> ClosureTypeInfo -> SMRep
blackHoleRep :: SMRep
indStaticRep :: SMRep
mkStackRep :: [Bool] -> SMRep
mkRTSRep :: Int -> SMRep -> SMRep
arrPtrsRep :: Platform -> WordOff -> SMRep
smallArrPtrsRep :: WordOff -> SMRep
arrWordsRep :: Platform -> 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 :: Profile -> SMRep -> WordOff
-- | Size of a closure header (StgHeader in
-- includes/rts/storage/Closures.h)
fixedHdrSizeW :: Profile -> WordOff
arrWordsHdrSize :: Profile -> ByteOff
arrWordsHdrSizeW :: Profile -> WordOff
arrPtrsHdrSize :: Profile -> ByteOff
arrPtrsHdrSizeW :: Profile -> WordOff
-- | Size of the profiling part of a closure header (StgProfHeader in
-- includes/rts/storage/Closures.h)
profHdrSize :: Profile -> WordOff
thunkHdrSize :: Profile -> WordOff
nonHdrSize :: Platform -> SMRep -> ByteOff
nonHdrSizeW :: SMRep -> WordOff
smallArrPtrsHdrSize :: Profile -> ByteOff
smallArrPtrsHdrSizeW :: Profile -> WordOff
hdrSize :: Profile -> SMRep -> ByteOff
hdrSizeW :: Profile -> SMRep -> WordOff
fixedHdrSize :: Profile -> 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 :: Platform -> Int -> Int
-- | Convert a number of elements to a number of cards, rounding up
cardRoundUp :: Platform -> Int -> Int
-- | The size of a card table, in bytes
cardTableSizeB :: Platform -> Int -> ByteOff
-- | The size of a card table, in words
cardTableSizeW :: Platform -> Int -> WordOff
instance Data.Bits.Bits GHC.Runtime.Heap.Layout.StgWord
instance GHC.Classes.Eq GHC.Runtime.Heap.Layout.StgWord
instance GHC.Classes.Eq GHC.Runtime.Heap.Layout.StgHalfWord
instance GHC.Classes.Eq GHC.Runtime.Heap.Layout.ArgDescr
instance GHC.Classes.Eq GHC.Runtime.Heap.Layout.ClosureTypeInfo
instance GHC.Classes.Eq GHC.Runtime.Heap.Layout.SMRep
instance GHC.Utils.Outputable.Outputable GHC.Runtime.Heap.Layout.SMRep
instance GHC.Utils.Outputable.Outputable GHC.Runtime.Heap.Layout.ClosureTypeInfo
instance GHC.Utils.Outputable.Outputable GHC.Runtime.Heap.Layout.ArgDescr
instance GHC.Utils.Outputable.Outputable GHC.Runtime.Heap.Layout.StgHalfWord
instance GHC.Utils.Outputable.Outputable GHC.Runtime.Heap.Layout.StgWord
module GHC.Linker.Static.Utils
-- | Compute the output file name of a program.
--
-- StaticLink boolean is used to indicate if the program is actually a
-- static library (e.g., on iOS).
--
-- Use the provided filename (if any), otherwise use "main.exe"
-- (Windows), "a.out (otherwise without StaticLink set), "liba.a". In
-- every case, add the extension if it is missing.
exeFileName :: Platform -> Bool -> Maybe FilePath -> FilePath
module GHC.Driver.Phases
-- | Untyped Phase description
data Phase
Unlit :: HscSource -> Phase
Cpp :: HscSource -> Phase
HsPp :: HscSource -> Phase
Hsc :: HscSource -> Phase
Ccxx :: Phase
Cc :: Phase
Cobjc :: Phase
Cobjcxx :: Phase
HCc :: Phase
As :: Bool -> Phase
LlvmOpt :: Phase
LlvmLlc :: Phase
LlvmMangle :: Phase
CmmCpp :: Phase
Cmm :: Phase
MergeForeign :: Phase
StopLn :: Phase
happensBefore :: Platform -> Phase -> Phase -> Bool
eqPhase :: Phase -> Phase -> Bool
isStopLn :: Phase -> Bool
startPhase :: String -> Phase
phaseInputExt :: Phase -> String
data StopPhase
-- |
-- -E
--
StopPreprocess :: StopPhase
-- |
-- -C
--
StopC :: StopPhase
-- |
-- -S
--
StopAs :: StopPhase
-- |
-- -c
--
NoStop :: StopPhase
stopPhaseToPhase :: StopPhase -> Phase
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
-- | Foreign language of the phase if the phase deals with a foreign code
phaseForeignLanguage :: Phase -> Maybe ForeignSrcLang
instance GHC.Show.Show GHC.Driver.Phases.Phase
instance GHC.Classes.Eq GHC.Driver.Phases.Phase
instance GHC.Utils.Outputable.Outputable GHC.Driver.Phases.Phase
-- | Code generation backends
module GHC.Driver.Backend
-- | Code generation backends.
--
-- GHC supports several code generation backends serving different
-- purposes (producing machine code, producing ByteCode for the
-- interpreter) and supporting different platforms.
data Backend
-- | Native code generator backend.
--
-- Compiles Cmm code into textual assembler, then relies on an external
-- assembler toolchain to produce machine code.
--
-- Only supports a few platforms (X86, PowerPC, SPARC).
--
-- See GHC.CmmToAsm.
NCG :: Backend
-- | LLVM backend.
--
-- Compiles Cmm code into LLVM textual IR, then relies on LLVM toolchain
-- to produce machine code.
--
-- It relies on LLVM support for the calling convention used by the NCG
-- backend to produce code objects ABI compatible with it (see "cc 10" or
-- "ghccc" calling convention in
-- https://llvm.org/docs/LangRef.html#calling-conventions).
--
-- Support a few platforms (X86, AArch64, s390x, ARM).
--
-- See GHC.CmmToLlvm
LLVM :: Backend
-- | Via-C backend.
--
-- Compiles Cmm code into C code, then relies on a C compiler to produce
-- machine code.
--
-- It produces code objects that are *not* ABI compatible with those
-- produced by NCG and LLVM backends.
--
-- Produced code is expected to be less efficient than the one produced
-- by NCG and LLVM backends because STG registers are not pinned into
-- real registers. On the other hand, it supports more target platforms
-- (those having a valid C toolchain).
--
-- See GHC.CmmToC
ViaC :: Backend
-- | ByteCode interpreter.
--
-- Produce ByteCode objects (BCO, see GHC.ByteCode) that can be
-- interpreted. It is used by GHCi.
--
-- Currently some extensions are not supported (foreign primops).
--
-- See GHC.StgToByteCode
Interpreter :: Backend
-- | No code generated.
--
-- Use this to disable code generation. It is particularly useful when
-- GHC is used as a library for other purpose than generating code (e.g.
-- to generate documentation with Haddock) or when the user requested it
-- (via -fno-code) for some reason.
NoBackend :: Backend
-- | Default backend to use for the given platform.
platformDefaultBackend :: Platform -> Backend
-- | Is the platform supported by the Native Code Generator?
platformNcgSupported :: Platform -> Bool
-- | Will this backend produce an object file on the disk?
backendProducesObject :: Backend -> Bool
-- | Does this backend retain *all* top-level bindings for a module, rather
-- than just the exported bindings, in the TypeEnv and compiled code (if
-- any)?
--
-- Interpreter backend does this, so that GHCi can call functions inside
-- a module.
--
-- When no backend is used we also do it, so that Haddock can get access
-- to the GlobalRdrEnv for a module after typechecking it.
backendRetainsAllBindings :: Backend -> Bool
instance GHC.Read.Read GHC.Driver.Backend.Backend
instance GHC.Show.Show GHC.Driver.Backend.Backend
instance GHC.Classes.Ord GHC.Driver.Backend.Backend
instance GHC.Classes.Eq GHC.Driver.Backend.Backend
module GHC.Cmm.Type
data CmmType
b8 :: CmmType
b16 :: CmmType
b32 :: CmmType
b64 :: CmmType
b128 :: CmmType
b256 :: CmmType
b512 :: CmmType
f32 :: CmmType
f64 :: CmmType
bWord :: Platform -> CmmType
bHalfWord :: Platform -> CmmType
gcWord :: Platform -> CmmType
cInt :: Platform -> 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
isBitsType :: CmmType -> Bool
isWordAny :: CmmType -> Bool
isWord32 :: CmmType -> Bool
isWord64 :: CmmType -> Bool
isFloat64 :: CmmType -> Bool
isFloat32 :: CmmType -> Bool
data Width
W8 :: Width
W16 :: Width
W32 :: Width
W64 :: Width
W128 :: Width
W256 :: Width
W512 :: Width
-- | A width in bits.
widthInBits :: Width -> Int
-- | A width in bytes.
--
--
-- widthFromBytes (widthInBytes w) === w
--
widthInBytes :: Width -> Int
-- | log_2 of the width in bytes, useful for generating shifts.
widthInLog :: Width -> Int
-- |
-- - Partial* A width from the number of bytes.
--
widthFromBytes :: Int -> Width
-- | The width of the current platform's word size.
wordWidth :: Platform -> Width
-- | The width of the current platform's half-word size.
halfWordWidth :: Platform -> Width
cIntWidth :: Platform -> Width
-- | A bit-mask for the lower half-word of current platform.
halfWordMask :: Platform -> Integer
-- | Narrow a signed or unsigned value to the given width. The result will
-- reside in [0, +2^width).
--
--
-- >>> narrowU W8 256 == 256
--
-- >>> narrowU W8 255 == 255
--
-- >>> narrowU W8 128 == 128
--
-- >>> narrowU W8 127 == 127
--
-- >>> narrowU W8 0 == 0
--
-- >>> narrowU W8 (-127) == 129
--
-- >>> narrowU W8 (-128) == 128
--
-- >>> narrowU W8 (-129) == 127
--
-- >>> narrowU W8 (-255) == 1
--
-- >>> narrowU W8 (-256) == 0
--
narrowU :: Width -> Integer -> Integer
-- | Narrow a signed value to the given width. The result will reside in
-- [-2^(width-1), +2^(width-1)).
--
--
-- >>> narrowS W8 256 == 0
--
-- >>> narrowS W8 255 == -1
--
-- >>> narrowS W8 128 == -128
--
-- >>> narrowS W8 127 == 127
--
-- >>> narrowS W8 0 == 0
--
-- >>> narrowS W8 (-127) == -127
--
-- >>> narrowS W8 (-128) == -128
--
-- >>> narrowS W8 (-129) == 127
--
-- >>> narrowS W8 (-255) == 1
--
-- >>> narrowS W8 (-256) == 0
--
narrowS :: Width -> Integer -> Integer
rEP_CostCentreStack_mem_alloc :: Platform -> CmmType
rEP_CostCentreStack_scc_count :: Platform -> CmmType
rEP_StgEntCounter_allocs :: Platform -> CmmType
rEP_StgEntCounter_allocd :: Platform -> 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
-- | is -falignment-sanitisation enabled?
type DoAlignSanitisation = Bool
instance GHC.Show.Show GHC.Cmm.Type.Width
instance GHC.Classes.Ord GHC.Cmm.Type.Width
instance GHC.Classes.Eq GHC.Cmm.Type.Width
instance GHC.Show.Show GHC.Cmm.Type.CmmCat
instance GHC.Classes.Eq GHC.Cmm.Type.CmmCat
instance GHC.Show.Show GHC.Cmm.Type.CmmType
instance GHC.Classes.Eq GHC.Cmm.Type.ForeignHint
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Type.CmmType
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Type.CmmCat
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Type.Width
module GHC.Cmm.MachOp
-- | 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.
--
-- Note that there are variety of places in the native code generator
-- where we assume that the code produced for a MachOp does not introduce
-- new blocks.
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_XX_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
MO_AlignmentCheck :: Int -> 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 :: Platform -> 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 :: Platform -> MachOp -> [Width]
maybeInvertComparison :: MachOp -> Maybe MachOp
isFloatComparison :: MachOp -> Bool
mo_wordAdd :: Platform -> MachOp
mo_wordSub :: Platform -> MachOp
mo_wordEq :: Platform -> MachOp
mo_wordNe :: Platform -> MachOp
mo_wordMul :: Platform -> MachOp
mo_wordSQuot :: Platform -> MachOp
mo_wordSRem :: Platform -> MachOp
mo_wordSNeg :: Platform -> MachOp
mo_wordUQuot :: Platform -> MachOp
mo_wordURem :: Platform -> MachOp
mo_wordSGe :: Platform -> MachOp
mo_wordSLe :: Platform -> MachOp
mo_wordSGt :: Platform -> MachOp
mo_wordSLt :: Platform -> MachOp
mo_wordUGe :: Platform -> MachOp
mo_wordULe :: Platform -> MachOp
mo_wordUGt :: Platform -> MachOp
mo_wordULt :: Platform -> MachOp
mo_wordAnd :: Platform -> MachOp
mo_wordOr :: Platform -> MachOp
mo_wordXor :: Platform -> MachOp
mo_wordNot :: Platform -> MachOp
mo_wordShl :: Platform -> MachOp
mo_wordSShr :: Platform -> MachOp
mo_wordUShr :: Platform -> MachOp
mo_u_8To32 :: MachOp
mo_s_8To32 :: MachOp
mo_u_16To32 :: MachOp
mo_s_16To32 :: MachOp
mo_u_8ToWord :: Platform -> MachOp
mo_s_8ToWord :: Platform -> MachOp
mo_u_16ToWord :: Platform -> MachOp
mo_s_16ToWord :: Platform -> MachOp
mo_u_32ToWord :: Platform -> MachOp
mo_s_32ToWord :: Platform -> MachOp
mo_32To8 :: MachOp
mo_32To16 :: MachOp
mo_WordTo8 :: Platform -> MachOp
mo_WordTo16 :: Platform -> MachOp
mo_WordTo32 :: Platform -> MachOp
mo_WordTo64 :: Platform -> 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_Asinh :: CallishMachOp
MO_F64_Acosh :: CallishMachOp
MO_F64_Atanh :: CallishMachOp
MO_F64_Log :: CallishMachOp
MO_F64_Log1P :: CallishMachOp
MO_F64_Exp :: CallishMachOp
MO_F64_ExpM1 :: 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_Asinh :: CallishMachOp
MO_F32_Acosh :: CallishMachOp
MO_F32_Atanh :: CallishMachOp
MO_F32_Log :: CallishMachOp
MO_F32_Log1P :: CallishMachOp
MO_F32_Exp :: CallishMachOp
MO_F32_ExpM1 :: CallishMachOp
MO_F32_Fabs :: CallishMachOp
MO_F32_Sqrt :: CallishMachOp
MO_I64_ToI :: CallishMachOp
MO_I64_FromI :: CallishMachOp
MO_W64_ToW :: CallishMachOp
MO_W64_FromW :: CallishMachOp
MO_x64_Neg :: CallishMachOp
MO_x64_Add :: CallishMachOp
MO_x64_Sub :: CallishMachOp
MO_x64_Mul :: CallishMachOp
MO_I64_Quot :: CallishMachOp
MO_I64_Rem :: CallishMachOp
MO_W64_Quot :: CallishMachOp
MO_W64_Rem :: CallishMachOp
MO_x64_And :: CallishMachOp
MO_x64_Or :: CallishMachOp
MO_x64_Xor :: CallishMachOp
MO_x64_Not :: CallishMachOp
MO_x64_Shl :: CallishMachOp
MO_I64_Shr :: CallishMachOp
MO_W64_Shr :: CallishMachOp
MO_x64_Eq :: CallishMachOp
MO_x64_Ne :: CallishMachOp
MO_I64_Ge :: CallishMachOp
MO_I64_Gt :: CallishMachOp
MO_I64_Le :: CallishMachOp
MO_I64_Lt :: CallishMachOp
MO_W64_Ge :: CallishMachOp
MO_W64_Gt :: CallishMachOp
MO_W64_Le :: CallishMachOp
MO_W64_Lt :: CallishMachOp
MO_UF_Conv :: Width -> CallishMachOp
MO_S_Mul2 :: Width -> CallishMachOp
MO_S_QuotRem :: Width -> CallishMachOp
MO_U_QuotRem :: Width -> CallishMachOp
MO_U_QuotRem2 :: Width -> CallishMachOp
MO_Add2 :: Width -> CallishMachOp
MO_AddWordC :: Width -> CallishMachOp
MO_SubWordC :: Width -> CallishMachOp
MO_AddIntC :: Width -> CallishMachOp
MO_SubIntC :: Width -> CallishMachOp
MO_U_Mul2 :: Width -> CallishMachOp
MO_ReadBarrier :: 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_Memcmp :: Int -> CallishMachOp
MO_PopCnt :: Width -> CallishMachOp
MO_Pdep :: Width -> CallishMachOp
MO_Pext :: Width -> CallishMachOp
MO_Clz :: Width -> CallishMachOp
MO_Ctz :: Width -> CallishMachOp
MO_BSwap :: Width -> CallishMachOp
MO_BRev :: Width -> CallishMachOp
MO_AtomicRMW :: Width -> AtomicMachOp -> CallishMachOp
MO_AtomicRead :: Width -> CallishMachOp
MO_AtomicWrite :: Width -> CallishMachOp
-- | Atomic compare-and-swap. Arguments are [dest, expected, new].
-- Sequentially consistent. Possible future refactoring: should this be
-- anMO_AtomicRMW variant?
MO_Cmpxchg :: Width -> CallishMachOp
-- | Atomic swap. Arguments are [dest, new]
MO_Xchg :: Width -> CallishMachOp
MO_SuspendThread :: CallishMachOp
MO_ResumeThread :: CallishMachOp
-- | Return (results_hints,args_hints)
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 GHC.Cmm.MachOp.MachOp
instance GHC.Classes.Eq GHC.Cmm.MachOp.MachOp
instance GHC.Show.Show GHC.Cmm.MachOp.AtomicMachOp
instance GHC.Classes.Eq GHC.Cmm.MachOp.AtomicMachOp
instance GHC.Show.Show GHC.Cmm.MachOp.CallishMachOp
instance GHC.Classes.Eq GHC.Cmm.MachOp.CallishMachOp
-- | Foreign export stubs
module GHC.Types.ForeignStubs
-- | 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 :: CHeader -> CStub -> ForeignStubs
newtype CHeader
CHeader :: SDoc -> CHeader
[getCHeader] :: CHeader -> SDoc
data CStub
CStub :: SDoc -> [CLabel] -> [CLabel] -> CStub
[getCStub] :: CStub -> SDoc
-- | Initializers to be run at startup See Note [Initializers and
-- finalizers in Cmm] in GHC.Cmm.InitFini.
[getInitializers] :: CStub -> [CLabel]
-- | Finalizers to be run at shutdown
[getFinalizers] :: CStub -> [CLabel]
-- | initializerCStub fn_nm decls body is a CStub
-- containing C initializer function (e.g. an entry of the
-- .init_array section) named fn_nm with the given body
-- and the given set of declarations.
initializerCStub :: Platform -> CLabel -> SDoc -> SDoc -> CStub
-- | finalizerCStub fn_nm decls body is a CStub containing
-- C finalizer function (e.g. an entry of the .fini_array
-- section) named fn_nm with the given body and the given set of
-- declarations.
finalizerCStub :: Platform -> CLabel -> SDoc -> SDoc -> CStub
appendStubC :: ForeignStubs -> CStub -> ForeignStubs
instance GHC.Base.Monoid GHC.Types.ForeignStubs.CHeader
instance GHC.Base.Semigroup GHC.Types.ForeignStubs.CHeader
instance GHC.Base.Monoid GHC.Types.ForeignStubs.CStub
instance GHC.Base.Semigroup GHC.Types.ForeignStubs.CStub
module GHC.Data.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
hPutStringBuffer :: Handle -> StringBuffer -> IO ()
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
-- | Convert a UTF-8 encoded ByteString into a 'StringBuffer. This
-- really relies on the internals of both ByteString and
-- StringBuffer.
--
-- O(n) (but optimized into a memcpy by
-- bytestring under the hood)
stringBufferFromByteString :: ByteString -> 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
-- | Computes a hash of the contents of a StringBuffer.
fingerprintStringBuffer :: StringBuffer -> Fingerprint
-- | 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
-- | Return the previous n characters (or fewer if we are less
-- than n characters into the buffer.
decodePrevNChars :: Int -> StringBuffer -> String
parseUnsignedInteger :: StringBuffer -> Int -> Integer -> (Char -> Int) -> Integer
-- | Returns true if the buffer contains Unicode bi-directional formatting
-- characters.
--
--
-- https://www.unicode.org/reports/tr9/#Bidirectional_Character_Types
--
-- Bidirectional format characters are one of 'x202a' : "U+202A
-- LEFT-TO-RIGHT EMBEDDING (LRE)" 'x202b' : "U+202B RIGHT-TO-LEFT
-- EMBEDDING (RLE)" 'x202c' : "U+202C POP DIRECTIONAL FORMATTING (PDF)"
-- 'x202d' : "U+202D LEFT-TO-RIGHT OVERRIDE (LRO)" 'x202e' : "U+202E
-- RIGHT-TO-LEFT OVERRIDE (RLO)" 'x2066' : "U+2066 LEFT-TO-RIGHT ISOLATE
-- (LRI)" 'x2067' : "U+2067 RIGHT-TO-LEFT ISOLATE (RLI)" 'x2068' :
-- "U+2068 FIRST STRONG ISOLATE (FSI)" 'x2069' : "U+2069 POP DIRECTIONAL
-- ISOLATE (PDI)"
--
-- This list is encoded in bidirectionalFormatChars
containsBidirectionalFormatChar :: StringBuffer -> Bool
bidirectionalFormatChars :: [(Char, String)]
instance GHC.Show.Show GHC.Data.StringBuffer.StringBuffer
module GHC.Data.FastString.Env
-- | A non-deterministic set of FastStrings. See Note [Deterministic
-- UniqFM] in GHC.Types.Unique.DFM 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 FastString 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 FastString a
mkDFsEnv :: [(FastString, a)] -> DFastStringEnv a
emptyDFsEnv :: DFastStringEnv a
dFsEnvElts :: DFastStringEnv a -> [a]
lookupDFsEnv :: DFastStringEnv a -> FastString -> Maybe a
module GHC.Types.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; see Note [FieldLabel].
data FieldLabel
FieldLabel :: FieldLabelString -> DuplicateRecordFields -> FieldSelectors -> Name -> FieldLabel
-- | User-visible label of the field
[flLabel] :: FieldLabel -> FieldLabelString
-- | Was DuplicateRecordFields on in the defining module for this
-- datatype?
[flHasDuplicateRecordFields] :: FieldLabel -> DuplicateRecordFields
-- | Was FieldSelectors enabled in the defining module for this
-- datatype? See Note [NoFieldSelectors] in GHC.Rename.Env
[flHasFieldSelector] :: FieldLabel -> FieldSelectors
-- | Record selector function
[flSelector] :: FieldLabel -> 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].
fieldSelectorOccName :: FieldLabelString -> OccName -> DuplicateRecordFields -> FieldSelectors -> OccName
-- | Undo the name mangling described in Note [FieldLabel] to produce a
-- Name that has the user-visible OccName (but the selector's unique).
-- This should be used only when generating output, when we want to show
-- the label, but may need to qualify it with a module prefix.
fieldLabelPrintableName :: FieldLabel -> Name
-- | Flag to indicate whether the DuplicateRecordFields extension is
-- enabled.
data DuplicateRecordFields
-- | Fields may be duplicated in a single module
DuplicateRecordFields :: DuplicateRecordFields
-- | Fields must be unique within a module (the default)
NoDuplicateRecordFields :: DuplicateRecordFields
-- | Flag to indicate whether the FieldSelectors extension is enabled.
data FieldSelectors
-- | Selector functions are available (the default)
FieldSelectors :: FieldSelectors
-- | Selector functions are not available
NoFieldSelectors :: FieldSelectors
flIsOverloaded :: FieldLabel -> Bool
instance Data.Data.Data GHC.Types.FieldLabel.DuplicateRecordFields
instance GHC.Classes.Eq GHC.Types.FieldLabel.DuplicateRecordFields
instance GHC.Show.Show GHC.Types.FieldLabel.DuplicateRecordFields
instance Data.Data.Data GHC.Types.FieldLabel.FieldSelectors
instance GHC.Classes.Eq GHC.Types.FieldLabel.FieldSelectors
instance GHC.Show.Show GHC.Types.FieldLabel.FieldSelectors
instance GHC.Classes.Eq GHC.Types.FieldLabel.FieldLabel
instance Data.Data.Data GHC.Types.FieldLabel.FieldLabel
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.FieldLabel.FieldLabel
instance GHC.Utils.Outputable.Outputable GHC.Types.FieldLabel.FieldLabel
instance GHC.Utils.Binary.Binary GHC.Types.Name.Name => GHC.Utils.Binary.Binary GHC.Types.FieldLabel.FieldLabel
instance GHC.Utils.Binary.Binary GHC.Types.FieldLabel.FieldSelectors
instance GHC.Utils.Outputable.Outputable GHC.Types.FieldLabel.FieldSelectors
instance GHC.Utils.Binary.Binary GHC.Types.FieldLabel.DuplicateRecordFields
instance GHC.Utils.Outputable.Outputable GHC.Types.FieldLabel.DuplicateRecordFields
module GHC.Types.CostCentre.State
-- | Per-module state for tracking cost centre indices.
--
-- See documentation of cc_flavour for more details.
data CostCentreState
-- | Initialize cost centre state.
newCostCentreState :: CostCentreState
-- | An index into a given cost centre module,name,flavour set
data CostCentreIndex
unCostCentreIndex :: CostCentreIndex -> Int
-- | Get a new index for a given cost centre name.
getCCIndex :: FastString -> CostCentreState -> (CostCentreIndex, CostCentreState)
instance GHC.Utils.Binary.Binary GHC.Types.CostCentre.State.CostCentreIndex
instance Data.Data.Data GHC.Types.CostCentre.State.CostCentreIndex
instance GHC.Classes.Ord GHC.Types.CostCentre.State.CostCentreIndex
instance GHC.Classes.Eq GHC.Types.CostCentre.State.CostCentreIndex
-- | 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 GHC.Builtin.Uniques
-- | 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
mkCTupleSelIdUnique :: ConTagZ -> Arity -> Unique
mkAlphaTyVarUnique :: Int -> Unique
mkPrimOpIdUnique :: Int -> Unique
mkPrimOpWrapperUnique :: Int -> Unique
mkPreludeMiscIdUnique :: Int -> Unique
mkPreludeDataConUnique :: Int -> Unique
mkPreludeTyConUnique :: Int -> Unique
mkPreludeClassUnique :: 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
mkPseudoUniqueE :: Int -> Unique
tyConRepNameUnique :: Unique -> Unique
dataConWorkerUnique :: Unique -> Unique
dataConTyRepNameUnique :: Unique -> Unique
initExitJoinUnique :: Unique
-- | GHC uses several kinds of name internally:
--
--
module GHC.Types.Name.Occurrence
data NameSpace
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
promoteOccName :: 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 predicate 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
-- GHC.Tc.Instance.Typeable.
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 -> OccName
mkDataCOcc :: OccName -> 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
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 unused
-- 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
nonDetOccEnvElts :: 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
minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a
-- | Alters (replaces or removes) those elements of the map that are
-- mentioned in the second map
minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a
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
filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet
-- | Converts an OccSet to an OccEnv (operationally the identity)
occSetToEnv :: OccSet -> OccEnv OccName
type TidyOccEnv = UniqFM FastString Int
emptyTidyOccEnv :: TidyOccEnv
initTidyOccEnv :: [OccName] -> TidyOccEnv
tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv
-- | A non-deterministic set of FastStrings. See Note [Deterministic
-- UniqFM] in GHC.Types.Unique.DFM 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 FastString a
emptyFsEnv :: FastStringEnv a
lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
mkFsEnv :: [(FastString, a)] -> FastStringEnv a
instance GHC.Classes.Ord GHC.Types.Name.Occurrence.NameSpace
instance GHC.Classes.Eq GHC.Types.Name.Occurrence.NameSpace
instance Data.Data.Data a => Data.Data.Data (GHC.Types.Name.Occurrence.OccEnv a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Types.Name.Occurrence.OccEnv a)
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.Name.Occurrence.OccName
instance GHC.Classes.Eq GHC.Types.Name.Occurrence.OccName
instance GHC.Classes.Ord GHC.Types.Name.Occurrence.OccName
instance Data.Data.Data GHC.Types.Name.Occurrence.OccName
instance Control.DeepSeq.NFData GHC.Types.Name.Occurrence.OccName
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Occurrence.OccName
instance GHC.Utils.Outputable.OutputableBndr GHC.Types.Name.Occurrence.OccName
instance GHC.Types.Unique.Uniquable GHC.Types.Name.Occurrence.OccName
instance GHC.Utils.Binary.Binary GHC.Types.Name.Occurrence.OccName
instance GHC.Utils.Binary.Binary GHC.Types.Name.Occurrence.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 GHC.Types.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
nameNameSpace :: Name -> NameSpace
nameModule :: HasDebugCallStack => 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
nameSrcLoc :: Name -> SrcLoc
nameSrcSpan :: Name -> SrcSpan
pprNameDefnLoc :: Name -> SDoc
pprDefinedAt :: Name -> SDoc
-- | Print fully qualified name (with unit-id, module and unique)
pprFullName :: Module -> Name -> SDoc
-- | Print a ticky ticky styled name
--
-- Module argument is the module to use for internal and system names.
-- When printing the name in a ticky profile, the module name is included
-- even for local things. However, ticky uses the format "x (M)" rather
-- than "M.x". Hence, this function provides a separation from normal
-- styling.
pprTickyName :: Module -> 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
-- | Will the Name come from a dynamically linked package?
isDynLinkName :: Platform -> Module -> Name -> Bool
isWiredInName :: Name -> Bool
isWiredIn :: NamedThing thing => thing -> 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
-- GHCi 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 GHC.Runtime.Context
nameIsLocalOrFrom :: Module -> Name -> Bool
-- | Returns True if the name is external or from the interactive
-- package See documentation of nameIsLocalOrFrom function
nameIsExternalOrFrom :: Module -> Name -> Bool
nameIsHomePackage :: Module -> Name -> Bool
nameIsHomePackageImport :: Module -> Name -> Bool
-- | Returns True if the Name comes from some other package: neither this
-- package nor the interactive package.
nameIsFromExternalPackage :: HomeUnit -> 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
-- | Print the string of Name unqualifiedly directly.
pprNameUnqualified :: Name -> 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 GHC.Types.Name.NamedThing GHC.Types.Name.Name
instance GHC.Types.Name.NamedThing e => GHC.Types.Name.NamedThing (GHC.Types.SrcLoc.Located e)
instance Control.DeepSeq.NFData GHC.Types.Name.Name
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.Name.Name
instance GHC.Classes.Eq GHC.Types.Name.Name
instance GHC.Classes.Ord GHC.Types.Name.Name
instance GHC.Types.Unique.Uniquable GHC.Types.Name.Name
instance Data.Data.Data GHC.Types.Name.Name
instance GHC.Utils.Binary.Binary GHC.Types.Name.Name
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Name
instance GHC.Utils.Outputable.OutputableBndr GHC.Types.Name.Name
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.NameSort
instance Control.DeepSeq.NFData GHC.Types.Name.NameSort
-- | GHC uses several kinds of name internally:
--
--
--
-- These Var names may either be global or local, see
-- GHC.Types.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 GHC.Types.Var
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and its 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 that might be a metavariable
type TcTyVar = 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
varMult :: Var -> Mult
varMultMaybe :: Id -> Maybe Mult
setVarName :: Var -> Name -> Var
setVarUnique :: Var -> Unique -> Var
setVarType :: Var -> Type -> Var
-- | Update a Vars type. Does not update the multiplicity
-- stored in an Id, if any. Because of the possibility for abuse,
-- ASSERTs that there is no multiplicity to update.
updateVarType :: (Type -> Type) -> Var -> Var
-- | Update a Vars type monadically. Does not update the
-- multiplicity stored in an Id, if any. Because of the
-- possibility for abuse, ASSERTs that there is no multiplicity to
-- update.
updateVarTypeM :: Monad m => (Type -> m Type) -> Var -> m Var
mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
mkLocalVar :: IdDetails -> Name -> Mult -> 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
setIdMult :: Id -> Mult -> Id
updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id
updateIdTypeAndMult :: (Type -> Type) -> Id -> Id
updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id
-- | Is this a value-level (i.e., computationally relevant)
-- Identifier? Satisfies isId = not . isTyVar.
isId :: Var -> Bool
-- | Is this a type-level (i.e., computationally irrelevant, thus erasable)
-- variable? Satisfies isTyVar = not . isId.
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
-- | Is this a coercion variable? Satisfies isId v ==>
-- isCoVar v == not (isNonCoVarId v).
isCoVar :: Var -> Bool
-- | Is this a term variable (Id) that is not a coercion
-- variable? Satisfies isId v ==> isCoVar v == not
-- (isNonCoVarId v).
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
-- | 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 [VarBndrs, TyCoVarBinders, TyConBinders,
-- and visibility] in GHC.Core.TyCo.Rep
data ArgFlag
Invisible :: Specificity -> ArgFlag
Required :: ArgFlag
pattern Specified :: ArgFlag
pattern Inferred :: ArgFlag
-- | The non-dependent version of ArgFlag. See Note [AnonArgFlag]
-- Appears here partly so that it's together with its friends ArgFlag and
-- ForallVisFlag, but also because it is used in IfaceType, rather early
-- in the compilation chain
data AnonArgFlag
-- | Used for (->): an ordinary non-dependent arrow. The
-- argument is visible in source code.
VisArg :: AnonArgFlag
-- | Used for (=>): a non-dependent predicate arrow. The
-- argument is invisible in source code.
InvisArg :: AnonArgFlag
-- | Whether an Invisible argument may appear in source Haskell.
data Specificity
-- | the argument may not appear in source Haskell, it is only inferred.
InferredSpec :: Specificity
-- | the argument may appear in source Haskell, but isn't required.
SpecifiedSpec :: Specificity
-- | 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
isInferredArgFlag :: 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
data VarBndr var argf
Bndr :: var -> argf -> VarBndr var argf
-- | Variable Binder
--
-- A TyCoVarBinder is the binder of a ForAllTy It's convenient to
-- define this synonym here rather its natural home in
-- GHC.Core.TyCo.Rep, because it's used in
-- GHC.Core.DataCon.hs-boot
--
-- A TyVarBinder is a binder with only TyVar
type TyCoVarBinder = VarBndr TyCoVar ArgFlag
type TyVarBinder = VarBndr TyVar ArgFlag
type InvisTVBinder = VarBndr TyVar Specificity
type ReqTVBinder = VarBndr TyVar ()
binderVar :: VarBndr tv argf -> tv
binderVars :: [VarBndr tv argf] -> [tv]
binderArgFlag :: VarBndr tv argf -> argf
binderType :: VarBndr TyCoVar argf -> Type
-- | Make a named binder
mkTyCoVarBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis
-- | Make many named binders
mkTyCoVarBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis]
-- | Make a named binder var should be a type variable
mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis
-- | Make many named binders Input vars should be type variables
mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis]
isTyVarBinder :: TyCoVarBinder -> Bool
tyVarSpecToBinder :: VarBndr a Specificity -> VarBndr a ArgFlag
tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ArgFlag]
tyVarReqToBinder :: VarBndr a () -> VarBndr a ArgFlag
tyVarReqToBinders :: [VarBndr a ()] -> [VarBndr a ArgFlag]
mapVarBndr :: (var -> var') -> VarBndr var flag -> VarBndr var' flag
mapVarBndrs :: (var -> var') -> [VarBndr var flag] -> [VarBndr var' flag]
lookupVarBndr :: Eq var => var -> [VarBndr var flag] -> Maybe flag
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 GHC.Types.Var.Specificity
instance GHC.Classes.Ord GHC.Types.Var.Specificity
instance GHC.Classes.Eq GHC.Types.Var.Specificity
instance Data.Data.Data GHC.Types.Var.ArgFlag
instance GHC.Classes.Ord GHC.Types.Var.ArgFlag
instance GHC.Classes.Eq GHC.Types.Var.ArgFlag
instance Data.Data.Data GHC.Types.Var.AnonArgFlag
instance GHC.Classes.Ord GHC.Types.Var.AnonArgFlag
instance GHC.Classes.Eq GHC.Types.Var.AnonArgFlag
instance (Data.Data.Data var, Data.Data.Data argf) => Data.Data.Data (GHC.Types.Var.VarBndr var argf)
instance GHC.Utils.Outputable.Outputable tv => GHC.Utils.Outputable.Outputable (GHC.Types.Var.VarBndr tv GHC.Types.Var.ArgFlag)
instance GHC.Utils.Outputable.Outputable tv => GHC.Utils.Outputable.Outputable (GHC.Types.Var.VarBndr tv GHC.Types.Var.Specificity)
instance (GHC.Utils.Binary.Binary tv, GHC.Utils.Binary.Binary vis) => GHC.Utils.Binary.Binary (GHC.Types.Var.VarBndr tv vis)
instance GHC.Types.Name.NamedThing tv => GHC.Types.Name.NamedThing (GHC.Types.Var.VarBndr tv flag)
instance GHC.Utils.Outputable.Outputable GHC.Types.Var.AnonArgFlag
instance GHC.Utils.Binary.Binary GHC.Types.Var.AnonArgFlag
instance GHC.Utils.Outputable.Outputable GHC.Types.Var.ArgFlag
instance GHC.Utils.Binary.Binary GHC.Types.Var.ArgFlag
instance GHC.Utils.Binary.Binary GHC.Types.Var.Specificity
instance GHC.Utils.Outputable.Outputable GHC.Types.Var.Var
instance GHC.Types.Name.NamedThing GHC.Types.Var.Var
instance GHC.Types.Unique.Uniquable GHC.Types.Var.Var
instance GHC.Classes.Eq GHC.Types.Var.Var
instance GHC.Classes.Ord GHC.Types.Var.Var
instance Data.Data.Data GHC.Types.Var.Var
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.Var.Var
module GHC.Types.Var.Set
-- | A non-deterministic Variable Set
--
-- A non-deterministic set of variables. See Note [Deterministic UniqFM]
-- in GHC.Types.Unique.DFM 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
mapVarSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b
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
nonDetStrictFoldVarSet :: (Var -> a -> a) -> a -> VarSet -> a
-- | 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
dVarSetIntersectVarSet :: DVarSet -> VarSet -> 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
nonDetStrictFoldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a
filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet
mapDVarSet :: Uniquable b => (a -> b) -> UniqDSet a -> UniqDSet b
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 forgetting the order of insertion
dVarSetToVarSet :: DVarSet -> VarSet
-- | Utilities for efficiently and deterministically computing free
-- variables.
module GHC.Utils.FV
type FV = InterestingVarFun -> VarSet -> VarAcc -> VarAcc
-- | 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.
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
module GHC.Types.Var.Env
-- | Variable Environment
type VarEnv elt = UniqFM Var elt
-- | Identifier Environment
type IdEnv elt = UniqFM Id elt
-- | Type Variable Environment
type TyVarEnv elt = UniqFM Var elt
-- | Coercion Variable Environment
type CoVarEnv elt = UniqFM CoVar elt
-- | Type or Coercion Variable Environment
type TyCoVarEnv elt = UniqFM TyCoVar 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
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
minusVarEnv :: VarEnv a -> VarEnv b -> VarEnv a
lookupVarEnv :: VarEnv a -> Var -> Maybe a
lookupVarEnv_NF :: VarEnv a -> Var -> a
lookupWithDefaultVarEnv :: VarEnv a -> a -> Var -> a
lookupVarEnv_Directly :: VarEnv a -> Unique -> Maybe 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 key a -> Unique -> UniqFM key a
isEmptyVarEnv :: VarEnv a -> Bool
elemVarEnvByKey :: Unique -> VarEnv a -> Bool
filterVarEnv :: (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 Var elt
-- | Deterministic Identifier Environment Sadly not always indexed by Id,
-- but it is in the common case.
type DIdEnv elt = UniqDFM Var elt
-- | Deterministic Type Variable Environment
type DTyVarEnv elt = UniqDFM TyVar 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
nonDetStrictFoldDVarEnv :: (a -> b -> b) -> b -> DVarEnv a -> b
mapDVarEnv :: (a -> b) -> DVarEnv a -> DVarEnv b
filterDVarEnv :: (a -> Bool) -> DVarEnv a -> DVarEnv a
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.
--
-- Note that this is a superset of the variables that are
-- currently in scope. See Note [The InScopeSet invariant].
--
-- "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. See Note [Local uniques] and Note
-- [The InScopeSet invariant].
uniqAway :: InScopeSet -> Var -> Var
varSetInScope :: VarSet -> InScopeSet -> Bool
-- | unsafeGetFreshUnique in_scope finds a unique that is not
-- in-scope in the given InScopeSet. This must be used very
-- carefully since one can very easily introduce non-unique
-- Uniques this way. See Note [Local uniques].
unsafeGetFreshLocalUnique :: InScopeSet -> Unique
-- | 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
extendRnInScopeSetList :: RnEnv2 -> [Var] -> 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
mkEmptyTidyEnv :: TidyOccEnv -> TidyEnv
delTidyEnvList :: TidyEnv -> [Var] -> TidyEnv
instance GHC.Utils.Outputable.Outputable GHC.Types.Var.Env.InScopeSet
module GHC.Stg.InferTags.TagSig
data TagInfo
TagDunno :: TagInfo
TagTuple :: [TagInfo] -> TagInfo
TagProper :: TagInfo
TagTagged :: TagInfo
newtype TagSig
TagSig :: TagInfo -> TagSig
isTaggedSig :: TagSig -> Bool
instance GHC.Classes.Eq GHC.Stg.InferTags.TagSig.TagInfo
instance GHC.Classes.Eq GHC.Stg.InferTags.TagSig.TagSig
instance GHC.Utils.Outputable.Outputable GHC.Stg.InferTags.TagSig.TagSig
instance GHC.Utils.Outputable.OutputableBndr (GHC.Types.Var.Id, GHC.Stg.InferTags.TagSig.TagSig)
instance GHC.Utils.Binary.Binary GHC.Stg.InferTags.TagSig.TagSig
instance GHC.Utils.Outputable.Outputable GHC.Stg.InferTags.TagSig.TagInfo
instance GHC.Utils.Binary.Binary GHC.Stg.InferTags.TagSig.TagInfo
module GHC.Types.Name.Set
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
intersectsNameSet :: NameSet -> NameSet -> Bool
-- | True if there is a non-empty intersection. s1
-- intersectsNameSet s2 doesn't compute s2 if
-- s1 is empty
disjointNameSet :: 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 = OrdList 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
-- | Ids which have no CAF references. This is a result of
-- analysis of C--. It is always safe to use an empty NonCaffySet.
-- TODO Refer to Note.
newtype NonCaffySet
NonCaffySet :: NameSet -> NonCaffySet
instance GHC.Base.Monoid GHC.Types.Name.Set.NonCaffySet
instance GHC.Base.Semigroup GHC.Types.Name.Set.NonCaffySet
module GHC.Types.Name.Env
-- | Name Environment
type NameEnv a = UniqFM Name a
mkNameEnv :: [(Name, a)] -> NameEnv a
mkNameEnvWith :: (a -> Name) -> [a] -> NameEnv a
emptyNameEnv :: NameEnv a
isEmptyNameEnv :: NameEnv a -> Bool
unitNameEnv :: Name -> a -> NameEnv a
nonDetNameEnvElts :: 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
plusNameEnv_CD :: (a -> a -> a) -> NameEnv a -> a -> NameEnv a -> a -> NameEnv a
plusNameEnv_CD2 :: (Maybe a -> Maybe 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
seqEltsNameEnv :: (elt -> ()) -> NameEnv elt -> ()
-- | Deterministic Name Environment
--
-- See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for
-- explanation why we need DNameEnv.
type DNameEnv a = UniqDFM Name a
emptyDNameEnv :: DNameEnv a
isEmptyDNameEnv :: DNameEnv a -> Bool
lookupDNameEnv :: DNameEnv a -> Name -> Maybe a
delFromDNameEnv :: DNameEnv a -> Name -> DNameEnv a
filterDNameEnv :: (a -> Bool) -> DNameEnv a -> DNameEnv a
mapDNameEnv :: (a -> b) -> DNameEnv a -> DNameEnv b
adjustDNameEnv :: (a -> a) -> DNameEnv a -> Name -> DNameEnv a
alterDNameEnv :: (Maybe a -> Maybe a) -> DNameEnv a -> Name -> DNameEnv a
extendDNameEnv :: DNameEnv a -> Name -> a -> DNameEnv a
eltsDNameEnv :: DNameEnv a -> [a]
extendDNameEnv_C :: (a -> a -> a) -> DNameEnv a -> Name -> a -> DNameEnv a
plusDNameEnv_C :: (elt -> elt -> elt) -> DNameEnv elt -> DNameEnv elt -> DNameEnv elt
foldDNameEnv :: (a -> b -> b) -> b -> DNameEnv a -> b
nonDetStrictFoldDNameEnv :: (a -> b -> b) -> b -> DNameEnv a -> b
depAnal :: forall node. (node -> [Name]) -> (node -> [Name]) -> [node] -> [SCC node]
module GHC.Types.Fixity.Env
-- | 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
emptyFixityEnv :: FixityEnv
lookupFixity :: FixityEnv -> Name -> Fixity
-- | Creates cached lookup for the mi_fix_fn field of
-- ModIface
mkIfaceFixCache :: [(OccName, Fixity)] -> OccName -> Maybe Fixity
emptyIfaceFixCache :: OccName -> Maybe Fixity
instance GHC.Utils.Outputable.Outputable GHC.Types.Fixity.Env.FixItem
module GHC.Types.CostCentre
-- | A Cost Centre is a single {--} annotation.
data CostCentre
NormalCC :: CCFlavour -> CcName -> Module -> SrcSpan -> 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 an associated
-- flavour that indicates how it was generated, and flavours that allow
-- multiple instances of the same name and module have a deterministic
-- 0-based index.
[cc_flavour] :: CostCentre -> CCFlavour
-- | Name of the cost centre itself
[cc_name] :: CostCentre -> CcName
-- | Name of module defining this CC.
[cc_mod] :: CostCentre -> Module
[cc_loc] :: CostCentre -> SrcSpan
AllCafsCC :: Module -> SrcSpan -> CostCentre
-- | Name of module defining this CC.
[cc_mod] :: CostCentre -> Module
[cc_loc] :: CostCentre -> SrcSpan
type CcName = FastString
-- | The flavour of a cost centre.
--
-- Index fields represent 0-based indices giving source-code ordering of
-- centres with the same module, name, and flavour.
data CCFlavour
-- | Auto-generated top-level thunk
CafCC :: CCFlavour
-- | Explicitly annotated expression
ExprCC :: !CostCentreIndex -> CCFlavour
-- | Explicitly annotated declaration
DeclCC :: !CostCentreIndex -> CCFlavour
-- | Generated by HPC for coverage
HpcCC :: !CostCentreIndex -> CCFlavour
-- | 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], [CostCentreStack])
emptyCollectedCCs :: CollectedCCs
collectCC :: CostCentre -> CostCentreStack -> CollectedCCs -> CollectedCCs
currentCCS :: CostCentreStack
dontCareCCS :: CostCentreStack
isCurrentCCS :: CostCentreStack -> Bool
maybeSingletonCCS :: CostCentreStack -> Maybe CostCentre
mkUserCC :: FastString -> Module -> SrcSpan -> CCFlavour -> CostCentre
mkAutoCC :: Id -> Module -> 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
-- | Print a flavour in Core
pprCostCentreCore :: CostCentre -> SDoc
costCentreUserName :: CostCentre -> String
costCentreUserNameFS :: CostCentre -> FastString
costCentreSrcSpan :: CostCentre -> SrcSpan
cmpCostCentre :: CostCentre -> CostCentre -> Ordering
instance Data.Data.Data GHC.Types.CostCentre.CCFlavour
instance GHC.Classes.Ord GHC.Types.CostCentre.CCFlavour
instance GHC.Classes.Eq GHC.Types.CostCentre.CCFlavour
instance Data.Data.Data GHC.Types.CostCentre.CostCentre
instance GHC.Classes.Ord GHC.Types.CostCentre.CostCentreStack
instance GHC.Classes.Eq GHC.Types.CostCentre.CostCentreStack
instance GHC.Utils.Outputable.Outputable GHC.Types.CostCentre.CostCentreStack
instance GHC.Classes.Eq GHC.Types.CostCentre.CostCentre
instance GHC.Classes.Ord GHC.Types.CostCentre.CostCentre
instance GHC.Utils.Outputable.Outputable GHC.Types.CostCentre.CostCentre
instance GHC.Utils.Binary.Binary GHC.Types.CostCentre.CostCentre
instance GHC.Utils.Binary.Binary GHC.Types.CostCentre.CCFlavour
module GHC.Types.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, or a field label without a parent
-- type (see Note [Representing pattern synonym fields in AvailInfo]).
Avail :: GreName -> AvailInfo
-- | A type or class in scope
--
-- 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 -> [GreName] -> AvailInfo
avail :: Name -> AvailInfo
availField :: FieldLabel -> AvailInfo
availTC :: Name -> [Name] -> [FieldLabel] -> AvailInfo
availsToNameSet :: [AvailInfo] -> NameSet
availsToNameSetWithSelectors :: [AvailInfo] -> NameSet
availsToNameEnv :: [AvailInfo] -> NameEnv AvailInfo
-- | Does this AvailInfo export the parent decl? This depends on the
-- invariant that the parent is first if it appears at all.
availExportsDecl :: AvailInfo -> Bool
-- | Just the main name made available, i.e. not the available pieces of
-- type or class brought into scope by the AvailInfo
availName :: AvailInfo -> Name
availGreName :: AvailInfo -> GreName
-- | 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]
-- | Names and fields made available by the availability information.
availGreNames :: AvailInfo -> [GreName]
-- | Names and fields made available by the availability information, other
-- than the main decl itself.
availSubordinateGreNames :: AvailInfo -> [GreName]
-- | 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]
-- | Used where we may have an ordinary name or a record field label. See
-- Note [GreNames] in GHC.Types.Name.Reader.
data GreName
NormalGreName :: Name -> GreName
FieldGreName :: FieldLabel -> GreName
-- | A Name for internal use, but not for output to the user. For
-- fields, the OccName will be the selector. See Note [GreNames]
-- in GHC.Types.Name.Reader.
greNameMangledName :: GreName -> Name
-- | A Name suitable for output to the user. For fields, the
-- OccName will be the field label. See Note [GreNames] in
-- GHC.Types.Name.Reader.
greNamePrintableName :: GreName -> Name
greNameSrcSpan :: GreName -> SrcSpan
greNameFieldLabel :: GreName -> Maybe FieldLabel
partitionGreNames :: [GreName] -> ([Name], [FieldLabel])
stableGreNameCmp :: GreName -> GreName -> Ordering
instance GHC.Classes.Eq GHC.Types.Avail.GreName
instance Data.Data.Data GHC.Types.Avail.GreName
instance Data.Data.Data GHC.Types.Avail.AvailInfo
instance GHC.Classes.Eq GHC.Types.Avail.AvailInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Avail.AvailInfo
instance GHC.Utils.Binary.Binary GHC.Types.Avail.AvailInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Avail.GreName
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.Avail.GreName
instance GHC.Utils.Binary.Binary GHC.Types.Avail.GreName
-- | GHC uses several kinds of name internally:
--
--
module GHC.Types.Name.Reader
-- | 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
promoteRdrName :: 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 See Note [LocalRdrEnv]
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]
minusLocalRdrEnv :: LocalRdrEnv -> OccEnv a -> 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 GHC.Rename.Names 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 (greMangledName
-- gre), but not always in the case of record selectors; see Note
-- [GreNames]
type GlobalRdrEnv = OccEnv [GlobalRdrElt]
emptyGlobalRdrEnv :: GlobalRdrEnv
mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv
plusGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrEnv -> GlobalRdrEnv
lookupGlobalRdrEnv :: GlobalRdrEnv -> OccName -> [GlobalRdrElt]
extendGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrElt -> GlobalRdrEnv
-- | See Note [GreNames]
greOccName :: GlobalRdrElt -> OccName
shadowNames :: GlobalRdrEnv -> OccEnv a -> GlobalRdrEnv
pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc
globalRdrEnvElts :: GlobalRdrEnv -> [GlobalRdrElt]
-- | Look for this RdrName in the global environment. Omits record
-- fields without selector functions (see Note [NoFieldSelectors] in
-- GHC.Rename.Env).
lookupGRE_RdrName :: RdrName -> GlobalRdrEnv -> [GlobalRdrElt]
-- | Look for this RdrName in the global environment. Includes
-- record fields without selector functions (see Note [NoFieldSelectors]
-- in GHC.Rename.Env).
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 precisely this GreName in the environment. This tests
-- whether it is in scope, ignoring anything else that might be in scope
-- with the same OccName.
lookupGRE_GreName :: GlobalRdrEnv -> GreName -> 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 [GreNames] for why this happens.
lookupGRE_FieldLabel :: GlobalRdrEnv -> FieldLabel -> Maybe GlobalRdrElt
-- | Look for precisely this Name in the environment, but with an
-- OccName that might differ from that of the Name. See
-- lookupGRE_FieldLabel and Note [GreNames].
lookupGRE_Name_OccName :: GlobalRdrEnv -> Name -> OccName -> 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 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
-- 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
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]
-- | The module in which the name pointed to by the GRE is defined.
greDefinitionModule :: GlobalRdrElt -> Maybe Module
-- | The SrcSpan of the name pointed to by the GRE.
greDefinitionSrcSpan :: GlobalRdrElt -> SrcSpan
-- | A Name for the GRE for internal use. Careful: the
-- OccName of this Name is not necessarily the same as the
-- greOccName (see Note [GreNames]).
greMangledName :: GlobalRdrElt -> Name
-- | A Name for the GRE suitable for output to the user. Its
-- OccName will be the greOccName (see Note [GreNames]).
grePrintableName :: GlobalRdrElt -> Name
-- | Returns the field label of this GRE, if it has one
greFieldLabel :: GlobalRdrElt -> Maybe FieldLabel
-- | Global Reader Element
--
-- An element of the GlobalRdrEnv
data GlobalRdrElt
GRE :: !GreName -> !Parent -> !Bool -> !Bag ImportSpec -> GlobalRdrElt
-- | See Note [GreNames]
[gre_name] :: GlobalRdrElt -> !GreName
-- | See Note [Parents]
[gre_par] :: GlobalRdrElt -> !Parent
-- | True = the thing was defined locally
[gre_lcl] :: GlobalRdrElt -> !Bool
-- | In scope through these imports
[gre_imp] :: GlobalRdrElt -> !Bag ImportSpec
isLocalGRE :: GlobalRdrElt -> Bool
isRecFldGRE :: GlobalRdrElt -> Bool
-- | Is this a record field defined with DuplicateRecordFields? (See Note
-- [GreNames])
isDuplicateRecFldGRE :: GlobalRdrElt -> Bool
-- | Is this a record field defined with NoFieldSelectors? (See Note
-- [NoFieldSelectors] in GHC.Rename.Env)
isNoFieldSelectorGRE :: GlobalRdrElt -> Bool
-- | Is this a record field defined with FieldSelectors? (See Note
-- [NoFieldSelectors] in GHC.Rename.Env)
isFieldSelectorGRE :: GlobalRdrElt -> Bool
-- | 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
-- | Used where we may have an ordinary name or a record field label. See
-- Note [GreNames] in GHC.Types.Name.Reader.
data GreName
NormalGreName :: Name -> GreName
FieldGreName :: FieldLabel -> GreName
greNameSrcSpan :: GreName -> SrcSpan
-- | See Note [Parents]
data Parent
NoParent :: Parent
ParentIs :: Name -> Parent
[par_is] :: Parent -> Name
greParent_maybe :: GlobalRdrElt -> Maybe Name
-- | 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
-- | Indicate if the given name is the "@" operator
opIsAt :: RdrName -> Bool
instance Data.Data.Data GHC.Types.Name.Reader.RdrName
instance Data.Data.Data GHC.Types.Name.Reader.Parent
instance GHC.Classes.Eq GHC.Types.Name.Reader.Parent
instance Data.Data.Data GHC.Types.Name.Reader.ImpDeclSpec
instance GHC.Classes.Eq GHC.Types.Name.Reader.ImpDeclSpec
instance Data.Data.Data GHC.Types.Name.Reader.ImpItemSpec
instance GHC.Classes.Eq GHC.Types.Name.Reader.ImpItemSpec
instance Data.Data.Data GHC.Types.Name.Reader.ImportSpec
instance GHC.Classes.Eq GHC.Types.Name.Reader.ImportSpec
instance Data.Data.Data GHC.Types.Name.Reader.GlobalRdrElt
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.Name.Reader.GlobalRdrElt
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Reader.GlobalRdrElt
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Reader.ImportSpec
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Reader.Parent
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Reader.LocalRdrEnv
instance GHC.Types.Name.Occurrence.HasOccName GHC.Types.Name.Reader.RdrName
instance GHC.Utils.Outputable.Outputable GHC.Types.Name.Reader.RdrName
instance GHC.Utils.Outputable.OutputableBndr GHC.Types.Name.Reader.RdrName
instance GHC.Classes.Eq GHC.Types.Name.Reader.RdrName
instance GHC.Classes.Ord GHC.Types.Name.Reader.RdrName
module GHC.Unit.Module.Imported
-- | 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
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.
--
-- NB. BangPattern here: otherwise this leaks. (#15111)
[imv_all_exports] :: ImportedModsVal -> !GlobalRdrEnv
-- | whether this is a qualified import
[imv_qualified] :: ImportedModsVal -> Bool
importedByUser :: [ImportedBy] -> [ImportedModsVal]
-- | 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 GHC.Types.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
-- | A collection of annotations
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 -> (ModuleEnv [a], NameEnv [a])
instance GHC.Base.Functor GHC.Types.Annotations.AnnTarget
instance GHC.Utils.Outputable.Outputable GHC.Types.Annotations.Annotation
instance GHC.Utils.Outputable.Outputable name => GHC.Utils.Outputable.Outputable (GHC.Types.Annotations.AnnTarget name)
instance GHC.Utils.Binary.Binary name => GHC.Utils.Binary.Binary (GHC.Types.Annotations.AnnTarget name)
module GHC.Parser.Annotation
-- | Exact print 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 otherwise captured in the AST.
--
-- The wiki page describing this feature is
-- https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations
-- https://gitlab.haskell.org/ghc/ghc/-/wikis/implementing-trees-that-grow/in-tree-api-annotations
--
-- Note: in general the names of these are taken from the corresponding
-- token, unless otherwise noted See Note [exact print 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
-- | '#)'
AnnClosePH :: 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
-- | The ⊸ unicode arrow
AnnLollyU :: 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
-- | '{-# DEPRECATED' etc. Opening of pragmas where the capitalisation of
-- the string can be changed by the user. The actual text used is stored
-- in a SourceText on the relevant pragma item.
AnnOpen :: AnnKeywordId
-- | '(|'
AnnOpenB :: AnnKeywordId
-- | '(|', unicode variant
AnnOpenBU :: AnnKeywordId
-- | '{'
AnnOpenC :: AnnKeywordId
-- | '[e|' or '[e||'
AnnOpenE :: AnnKeywordId
-- | '[|'
AnnOpenEQ :: AnnKeywordId
-- | '[|', unicode variant
AnnOpenEQU :: AnnKeywordId
-- | '('
AnnOpenP :: AnnKeywordId
-- | '['
AnnOpenS :: AnnKeywordId
-- | '(#'
AnnOpenPH :: AnnKeywordId
-- | prefix $ -- TemplateHaskell
AnnDollar :: AnnKeywordId
-- | prefix $$ -- TemplateHaskell
AnnDollarDollar :: AnnKeywordId
AnnPackageName :: AnnKeywordId
AnnPattern :: AnnKeywordId
-- | % -- for HsExplicitMult
AnnPercent :: AnnKeywordId
-- | '%1' -- for HsLinearArrow
AnnPercentOne :: 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
-- | double '''
AnnThTyQuote :: AnnKeywordId
-- | '~'
AnnTilde :: 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
-- | via
AnnVia :: 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
data EpaComment
EpaComment :: EpaCommentTok -> RealSrcSpan -> EpaComment
[ac_tok] :: EpaComment -> EpaCommentTok
-- | The location of the prior token, used in exact printing. The
-- EpaComment appears as an LEpaComment containing its
-- location. The difference between the end of the prior token and the
-- start of this location is used for the spacing when exact printing the
-- comment.
[ac_prior_tok] :: EpaComment -> RealSrcSpan
data EpaCommentTok
-- | a docstring that can be pretty printed using pprHsDocString
EpaDocComment :: HsDocString -> EpaCommentTok
-- | doc options (prune, ignore-exports, etc)
EpaDocOptions :: String -> EpaCommentTok
-- | comment starting by "--"
EpaLineComment :: String -> EpaCommentTok
-- | comment in {- -}
EpaBlockComment :: String -> EpaCommentTok
-- | empty comment, capturing location of EOF
EpaEofComment :: EpaCommentTok
-- | 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 EpAnnotation
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
-- | Captures an annotation, storing the AnnKeywordId and
-- its location. The parser only ever inserts EpaLocation
-- fields with a RealSrcSpan being the original location of the
-- annotation in the source file. The EpaLocation can
-- also store a delta position if the AST has been modified and needs to
-- be pretty printed again. The usual way an AddEpAnn is created
-- is using the mj ("make jump") function, and then it can be
-- inserted into the appropriate annotation.
data AddEpAnn
AddEpAnn :: AnnKeywordId -> EpaLocation -> AddEpAnn
-- | The anchor for an AnnKeywordId. The Parser inserts the
-- EpaSpan variant, giving the exact location of the
-- original item in the parsed source. This can be replaced by the
-- EpaDelta version, to provide a position for the item
-- relative to the end of the previous item in the source. This is useful
-- when editing an AST prior to exact printing the changed one. The list
-- of comments in the EpaDelta variant captures any
-- comments between the prior output and the thing being marked here,
-- since we cannot otherwise sort the relative order.
data EpaLocation
EpaSpan :: !RealSrcSpan -> EpaLocation
EpaDelta :: !DeltaPos -> ![LEpaComment] -> EpaLocation
-- | Used in the parser only, extract the RealSrcSpan from an
-- EpaLocation. The parser will never insert a DeltaPos, so
-- the partial function is safe.
epaLocationRealSrcSpan :: EpaLocation -> RealSrcSpan
epaLocationFromSrcAnn :: SrcAnn ann -> EpaLocation
-- | Tokens embedded in the AST have an EpaLocation, unless they come from
-- generated code (e.g. by TH).
data TokenLocation
NoTokenLoc :: TokenLocation
TokenLoc :: !EpaLocation -> TokenLocation
-- | Spacing between output items when exact printing. It captures the
-- spacing from the current print position on the page to the position
-- required for the thing about to be printed. This is either on the same
-- line in which case is is simply the number of spaces to emit, or it is
-- some number of lines down, with a given column offset. The exact
-- printing algorithm keeps track of the column offset pertaining to the
-- current anchor position, so the deltaColumn is the additional
-- spaces to add in this case. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations for
-- details.
data DeltaPos
SameLine :: !Int -> DeltaPos
[deltaColumn] :: DeltaPos -> !Int
DifferentLine :: !Int -> !Int -> DeltaPos
-- | deltaLine should always be > 0
[deltaLine] :: DeltaPos -> !Int
[deltaColumn] :: DeltaPos -> !Int
-- | Smart constructor for a DeltaPos. It preserves the invariant
-- that for the DifferentLine constructor deltaLine is
-- always > 0.
deltaPos :: Int -> Int -> DeltaPos
getDeltaLine :: DeltaPos -> Int
-- | The exact print annotations (EPAs) are kept in the HsSyn AST for the
-- GhcPs phase. We do not always have EPAs though, only for code that has
-- been parsed as they do not exist for generated code. This type
-- captures that they may be missing.
--
-- A goal of the annotations is that an AST can be edited, including
-- moving subtrees from one place to another, duplicating them, and so
-- on. This means that each fragment must be self-contained. To this end,
-- each annotated fragment keeps track of the anchor position it was
-- originally captured at, being simply the start span of the topmost
-- element of the ast fragment. This gives us a way to later re-calculate
-- all Located items in this layer of the AST, as well as any annotations
-- captured. The comments associated with the AST fragment are also
-- captured here.
--
-- The ann type parameter allows this general structure to be
-- specialised to the specific set of locations of original exact print
-- annotation elements. So for HsLet we have
--
-- type instance XLet GhcPs = EpAnn AnnsLet data AnnsLet = AnnsLet {
-- alLet :: EpaLocation, alIn :: EpaLocation } deriving Data
--
-- The spacing between the items under the scope of a given EpAnn is
-- normally derived from the original Anchor. But if a sub-element
-- is not in its original position, the required spacing can be directly
-- captured in the anchor_op field of the entry Anchor.
-- This allows us to freely move elements around, and stitch together new
-- AST fragments out of old ones, and have them still printed out in a
-- precise way.
data EpAnn ann
EpAnn :: !Anchor -> !ann -> !EpAnnComments -> EpAnn ann
-- | Base location for the start of the syntactic element holding the
-- annotations.
[entry] :: EpAnn ann -> !Anchor
-- | Annotations added by the Parser
[anns] :: EpAnn ann -> !ann
-- | Comments enclosed in the SrcSpan of the element this EpAnn is
-- attached to
[comments] :: EpAnn ann -> !EpAnnComments
-- | No Annotation for generated code, e.g. from TH, deriving, etc.
EpAnnNotUsed :: EpAnn ann
-- | An Anchor records the base location for the start of the
-- syntactic element holding the annotations, and is used as the point of
-- reference for calculating delta positions for contained annotations.
-- It is also normally used as the reference point for the spacing of the
-- element relative to its container. If it is moved, that relationship
-- is tracked in the anchor_op instead.
data Anchor
Anchor :: RealSrcSpan -> AnchorOperation -> Anchor
-- | Base location for the start of the syntactic element holding the
-- annotations.
[anchor] :: Anchor -> RealSrcSpan
[anchor_op] :: Anchor -> AnchorOperation
-- | If tools modify the parsed source, the MovedAnchor variant can
-- directly provide the spacing for this item relative to the previous
-- one when printing. This allows AST fragments with a particular anchor
-- to be freely moved, without worrying about recalculating the
-- appropriate anchor span.
data AnchorOperation
UnchangedAnchor :: AnchorOperation
MovedAnchor :: DeltaPos -> AnchorOperation
spanAsAnchor :: SrcSpan -> Anchor
realSpanAsAnchor :: RealSrcSpan -> Anchor
-- | Short form for EpAnnNotUsed
noAnn :: EpAnn a
-- | When we are parsing we add comments that belong a particular AST
-- element, and print them together with the element, interleaving them
-- into the output stream. But when editing the AST to move fragments
-- around it is useful to be able to first separate the comments into
-- those occuring before the AST element and those following it. The
-- EpaCommentsBalanced constructor is used to do this. The GHC
-- parser will only insert the EpaComments form.
data EpAnnComments
EpaComments :: ![LEpaComment] -> EpAnnComments
[priorComments] :: EpAnnComments -> ![LEpaComment]
EpaCommentsBalanced :: ![LEpaComment] -> ![LEpaComment] -> EpAnnComments
[priorComments] :: EpAnnComments -> ![LEpaComment]
[followingComments] :: EpAnnComments -> ![LEpaComment]
type LEpaComment = GenLocated Anchor EpaComment
emptyComments :: EpAnnComments
getFollowingComments :: EpAnnComments -> [LEpaComment]
setFollowingComments :: EpAnnComments -> [LEpaComment] -> EpAnnComments
setPriorComments :: EpAnnComments -> [LEpaComment] -> EpAnnComments
type EpAnnCO = EpAnn NoEpAnns " Api Annotations for comments only"
type LocatedA = GenLocated SrcSpanAnnA
type LocatedL = GenLocated SrcSpanAnnL
type LocatedC = GenLocated SrcSpanAnnC
type LocatedN = GenLocated SrcSpanAnnN
-- | General representation of a GenLocated type carrying a
-- parameterised annotation type.
type LocatedAn an = GenLocated (SrcAnn an)
type LocatedP = GenLocated SrcSpanAnnP
type SrcSpanAnnA = SrcAnn AnnListItem
type SrcSpanAnnL = SrcAnn AnnList
type SrcSpanAnnP = SrcAnn AnnPragma
type SrcSpanAnnC = SrcAnn AnnContext
type SrcSpanAnnN = SrcAnn NameAnn
-- | The 'SrcSpanAnn'' type wraps a normal SrcSpan, together with an
-- extra annotation type. This is mapped to a specific GenLocated
-- usage in the AST through the XRec and Anno type
-- families.
data SrcSpanAnn' a
SrcSpanAnn :: !a -> !SrcSpan -> SrcSpanAnn' a
[ann] :: SrcSpanAnn' a -> !a
[locA] :: SrcSpanAnn' a -> !SrcSpan
-- | We mostly use 'SrcSpanAnn'' with an 'EpAnn''
type SrcAnn ann = SrcSpanAnn' (EpAnn ann)
-- | Annotation for items appearing in a list. They can have one or more
-- trailing punctuations items, such as commas or semicolons.
data AnnListItem
AnnListItem :: [TrailingAnn] -> AnnListItem
[lann_trailing] :: AnnListItem -> [TrailingAnn]
-- | Annotation for the "container" of a list. This captures surrounding
-- items such as braces if present, and introductory keywords such as
-- 'where'.
data AnnList
AnnList :: Maybe Anchor -> Maybe AddEpAnn -> Maybe AddEpAnn -> [AddEpAnn] -> [TrailingAnn] -> AnnList
-- | start point of a list having layout
[al_anchor] :: AnnList -> Maybe Anchor
[al_open] :: AnnList -> Maybe AddEpAnn
[al_close] :: AnnList -> Maybe AddEpAnn
-- | context, such as 'where' keyword
[al_rest] :: AnnList -> [AddEpAnn]
-- | items appearing after the list, such as '=>' for a context
[al_trailing] :: AnnList -> [TrailingAnn]
-- | exact print annotation for an item having surrounding "brackets", such
-- as tuples or lists
data AnnParen
AnnParen :: ParenType -> EpaLocation -> EpaLocation -> AnnParen
[ap_adornment] :: AnnParen -> ParenType
[ap_open] :: AnnParen -> EpaLocation
[ap_close] :: AnnParen -> EpaLocation
-- | Detail of the "brackets" used in an AnnParen exact print
-- annotation.
data ParenType
-- | '(', ')'
AnnParens :: ParenType
-- | '()'
AnnParensHash :: ParenType
-- | '[', ']'
AnnParensSquare :: ParenType
-- | Maps the ParenType to the related opening and closing
-- AnnKeywordId. Used when actually printing the item.
parenTypeKws :: ParenType -> (AnnKeywordId, AnnKeywordId)
-- | exact print annotation used for capturing the locations of annotations
-- in pragmas.
data AnnPragma
AnnPragma :: AddEpAnn -> AddEpAnn -> [AddEpAnn] -> AnnPragma
[apr_open] :: AnnPragma -> AddEpAnn
[apr_close] :: AnnPragma -> AddEpAnn
[apr_rest] :: AnnPragma -> [AddEpAnn]
-- | Exact print annotation for the Context data type.
data AnnContext
AnnContext :: Maybe (IsUnicodeSyntax, EpaLocation) -> [EpaLocation] -> [EpaLocation] -> AnnContext
-- | location and encoding of the '=>', if present.
[ac_darrow] :: AnnContext -> Maybe (IsUnicodeSyntax, EpaLocation)
-- | zero or more opening parentheses.
[ac_open] :: AnnContext -> [EpaLocation]
-- | zero or more closing parentheses.
[ac_close] :: AnnContext -> [EpaLocation]
-- | exact print annotations for a RdrName. There are many kinds
-- of adornment that can be attached to a given RdrName. This
-- type captures them, as detailed on the individual constructors.
data NameAnn
-- | Used for a name with an adornment, so `foo`, (bar)
NameAnn :: NameAdornment -> EpaLocation -> EpaLocation -> EpaLocation -> [TrailingAnn] -> NameAnn
[nann_adornment] :: NameAnn -> NameAdornment
[nann_open] :: NameAnn -> EpaLocation
[nann_name] :: NameAnn -> EpaLocation
[nann_close] :: NameAnn -> EpaLocation
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | Used for (,,,), or @()#
NameAnnCommas :: NameAdornment -> EpaLocation -> [EpaLocation] -> EpaLocation -> [TrailingAnn] -> NameAnn
[nann_adornment] :: NameAnn -> NameAdornment
[nann_open] :: NameAnn -> EpaLocation
[nann_commas] :: NameAnn -> [EpaLocation]
[nann_close] :: NameAnn -> EpaLocation
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | Used for ()
NameAnnBars :: NameAdornment -> EpaLocation -> [EpaLocation] -> EpaLocation -> [TrailingAnn] -> NameAnn
[nann_adornment] :: NameAnn -> NameAdornment
[nann_open] :: NameAnn -> EpaLocation
[nann_bars] :: NameAnn -> [EpaLocation]
[nann_close] :: NameAnn -> EpaLocation
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | Used for (), (##), []
NameAnnOnly :: NameAdornment -> EpaLocation -> EpaLocation -> [TrailingAnn] -> NameAnn
[nann_adornment] :: NameAnn -> NameAdornment
[nann_open] :: NameAnn -> EpaLocation
[nann_close] :: NameAnn -> EpaLocation
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | Used for ->, as an identifier
NameAnnRArrow :: EpaLocation -> [TrailingAnn] -> NameAnn
[nann_name] :: NameAnn -> EpaLocation
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | Used for an item with a leading '. The annotation for
-- unquoted item is stored in nann_quoted.
NameAnnQuote :: EpaLocation -> SrcSpanAnnN -> [TrailingAnn] -> NameAnn
[nann_quote] :: NameAnn -> EpaLocation
[nann_quoted] :: NameAnn -> SrcSpanAnnN
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | Used when adding a TrailingAnn to an existing LocatedN
-- which has no Api Annotation (via the EpAnnNotUsed constructor.
NameAnnTrailing :: [TrailingAnn] -> NameAnn
[nann_trailing] :: NameAnn -> [TrailingAnn]
-- | A NameAnn can capture the locations of surrounding adornments,
-- such as parens or backquotes. This data type identifies what
-- particular pair are being used.
data NameAdornment
-- | '(' ')'
NameParens :: NameAdornment
-- | '()'
NameParensHash :: NameAdornment
-- | '`'
NameBackquotes :: NameAdornment
-- | '[' ']'
NameSquare :: NameAdornment
data NoEpAnns
NoEpAnns :: NoEpAnns
-- | Captures the sort order of sub elements. This is needed when the
-- sub-elements have been split (as in a HsLocalBind which holds separate
-- binds and sigs) or for infix patterns where the order has been
-- re-arranged. It is captured explicitly so that after the Delta phase a
-- SrcSpan is used purely as an index into the annotations, allowing
-- transformations of the AST including the introduction of new Located
-- items or re-arranging existing ones.
data AnnSortKey
NoAnnSortKey :: AnnSortKey
AnnSortKey :: [RealSrcSpan] -> AnnSortKey
-- | Captures the location of punctuation occuring between items, normally
-- in a list. It is captured as a trailing annotation.
data TrailingAnn
-- | Trailing ';'
AddSemiAnn :: EpaLocation -> TrailingAnn
-- | Trailing ','
AddCommaAnn :: EpaLocation -> TrailingAnn
-- | Trailing '|'
AddVbarAnn :: EpaLocation -> TrailingAnn
-- | Convert a TrailingAnn to an AddEpAnn
trailingAnnToAddEpAnn :: TrailingAnn -> AddEpAnn
-- | Helper function used in the parser to add a TrailingAnn items
-- to an existing annotation.
addTrailingAnnToA :: SrcSpan -> TrailingAnn -> EpAnnComments -> EpAnn AnnListItem -> EpAnn AnnListItem
-- | Helper function used in the parser to add a TrailingAnn items
-- to an existing annotation.
addTrailingAnnToL :: SrcSpan -> TrailingAnn -> EpAnnComments -> EpAnn AnnList -> EpAnn AnnList
-- | Helper function used in the parser to add a comma location to an
-- existing annotation.
addTrailingCommaToN :: SrcSpan -> EpAnn NameAnn -> EpaLocation -> EpAnn NameAnn
-- | Helper function (temporary) during transition of names Discards any
-- annotations
la2na :: SrcSpanAnn' a -> SrcSpanAnnN
-- | Helper function (temporary) during transition of names Discards any
-- annotations
na2la :: SrcSpanAnn' a -> SrcAnn ann
n2l :: LocatedN a -> LocatedA a
-- | Helper function (temporary) during transition of names Discards any
-- annotations
l2n :: LocatedAn a1 a2 -> LocatedN a2
l2l :: SrcSpanAnn' a -> SrcAnn ann
-- | Helper function (temporary) during transition of names Discards any
-- annotations
la2la :: LocatedAn ann1 a2 -> LocatedAn ann2 a2
reLoc :: LocatedAn a e -> Located e
reLocA :: Located e -> LocatedAn ann e
reLocL :: LocatedN e -> LocatedA e
reLocC :: LocatedN e -> LocatedC e
reLocN :: LocatedN a -> Located a
la2r :: SrcSpanAnn' a -> RealSrcSpan
realSrcSpan :: SrcSpan -> RealSrcSpan
extraToAnnList :: AnnList -> [AddEpAnn] -> AnnList
reAnn :: [TrailingAnn] -> EpAnnComments -> Located a -> LocatedA a
reAnnL :: ann -> EpAnnComments -> Located e -> GenLocated (SrcAnn ann) e
reAnnC :: AnnContext -> EpAnnComments -> Located a -> LocatedC a
addAnns :: EpAnn [AddEpAnn] -> [AddEpAnn] -> EpAnnComments -> EpAnn [AddEpAnn]
addAnnsA :: SrcSpanAnnA -> [TrailingAnn] -> EpAnnComments -> SrcSpanAnnA
-- | The annotations need to all come after the anchor. Make sure this is
-- the case.
widenSpan :: SrcSpan -> [AddEpAnn] -> SrcSpan
widenAnchor :: Anchor -> [AddEpAnn] -> Anchor
widenAnchorR :: Anchor -> RealSrcSpan -> Anchor
widenLocatedAn :: SrcSpanAnn' an -> [AddEpAnn] -> SrcSpanAnn' an
getLocAnn :: Located a -> SrcSpanAnnA
epAnnAnns :: EpAnn [AddEpAnn] -> [AddEpAnn]
epAnnAnnsL :: EpAnn a -> [a]
annParen2AddEpAnn :: EpAnn AnnParen -> [AddEpAnn]
epAnnComments :: EpAnn an -> EpAnnComments
sortLocatedA :: [GenLocated (SrcSpanAnn' a) e] -> [GenLocated (SrcSpanAnn' a) e]
mapLocA :: (a -> b) -> GenLocated SrcSpan a -> GenLocated (SrcAnn ann) b
combineLocsA :: Semigroup a => GenLocated (SrcAnn a) e1 -> GenLocated (SrcAnn a) e2 -> SrcAnn a
combineSrcSpansA :: Semigroup a => SrcAnn a -> SrcAnn a -> SrcAnn a
-- | Combine locations from two Located things and add them to a
-- third thing
addCLocA :: GenLocated (SrcSpanAnn' a) e1 -> GenLocated SrcSpan e2 -> e3 -> GenLocated (SrcAnn ann) e3
addCLocAA :: GenLocated (SrcSpanAnn' a1) e1 -> GenLocated (SrcSpanAnn' a2) e2 -> e3 -> GenLocated (SrcAnn ann) e3
noLocA :: a -> LocatedAn an a
getLocA :: GenLocated (SrcSpanAnn' a) e -> SrcSpan
noSrcSpanA :: SrcAnn ann
noAnnSrcSpan :: SrcSpan -> SrcAnn ann
noComments :: EpAnnCO
comment :: RealSrcSpan -> EpAnnComments -> EpAnnCO
-- | Add additional comments to a SrcAnn, used for manipulating the
-- AST prior to exact printing the changed one.
addCommentsToSrcAnn :: Monoid ann => SrcAnn ann -> EpAnnComments -> SrcAnn ann
-- | Replace any existing comments on a SrcAnn, used for
-- manipulating the AST prior to exact printing the changed one.
setCommentsSrcAnn :: Monoid ann => SrcAnn ann -> EpAnnComments -> SrcAnn ann
-- | Add additional comments, used for manipulating the AST prior to exact
-- printing the changed one.
addCommentsToEpAnn :: Monoid a => SrcSpan -> EpAnn a -> EpAnnComments -> EpAnn a
-- | Replace any existing comments, used for manipulating the AST prior to
-- exact printing the changed one.
setCommentsEpAnn :: Monoid a => SrcSpan -> EpAnn a -> EpAnnComments -> EpAnn a
-- | Transfer comments and trailing items from the annotations in the first
-- SrcSpanAnnA argument to those in the second.
transferAnnsA :: SrcSpanAnnA -> SrcSpanAnnA -> (SrcSpanAnnA, SrcSpanAnnA)
-- | Remove the exact print annotations payload, leaving only the anchor
-- and comments.
commentsOnlyA :: Monoid ann => SrcAnn ann -> SrcAnn ann
-- | Remove the comments, leaving the exact print annotations payload
removeCommentsA :: SrcAnn ann -> SrcAnn ann
placeholderRealSpan :: RealSrcSpan
instance GHC.Show.Show GHC.Parser.Annotation.AnnKeywordId
instance Data.Data.Data GHC.Parser.Annotation.AnnKeywordId
instance GHC.Classes.Ord GHC.Parser.Annotation.AnnKeywordId
instance GHC.Classes.Eq GHC.Parser.Annotation.AnnKeywordId
instance GHC.Show.Show GHC.Parser.Annotation.IsUnicodeSyntax
instance Data.Data.Data GHC.Parser.Annotation.IsUnicodeSyntax
instance GHC.Classes.Ord GHC.Parser.Annotation.IsUnicodeSyntax
instance GHC.Classes.Eq GHC.Parser.Annotation.IsUnicodeSyntax
instance GHC.Show.Show GHC.Parser.Annotation.HasE
instance Data.Data.Data GHC.Parser.Annotation.HasE
instance GHC.Classes.Ord GHC.Parser.Annotation.HasE
instance GHC.Classes.Eq GHC.Parser.Annotation.HasE
instance GHC.Show.Show GHC.Parser.Annotation.EpaCommentTok
instance Data.Data.Data GHC.Parser.Annotation.EpaCommentTok
instance GHC.Classes.Eq GHC.Parser.Annotation.EpaCommentTok
instance GHC.Show.Show GHC.Parser.Annotation.EpaComment
instance Data.Data.Data GHC.Parser.Annotation.EpaComment
instance GHC.Classes.Eq GHC.Parser.Annotation.EpaComment
instance Data.Data.Data GHC.Parser.Annotation.DeltaPos
instance GHC.Classes.Ord GHC.Parser.Annotation.DeltaPos
instance GHC.Classes.Eq GHC.Parser.Annotation.DeltaPos
instance GHC.Show.Show GHC.Parser.Annotation.DeltaPos
instance GHC.Show.Show GHC.Parser.Annotation.AnchorOperation
instance GHC.Classes.Eq GHC.Parser.Annotation.AnchorOperation
instance Data.Data.Data GHC.Parser.Annotation.AnchorOperation
instance GHC.Show.Show GHC.Parser.Annotation.Anchor
instance GHC.Classes.Eq GHC.Parser.Annotation.Anchor
instance Data.Data.Data GHC.Parser.Annotation.Anchor
instance GHC.Classes.Eq GHC.Parser.Annotation.EpAnnComments
instance Data.Data.Data GHC.Parser.Annotation.EpAnnComments
instance GHC.Base.Functor GHC.Parser.Annotation.EpAnn
instance GHC.Classes.Eq ann => GHC.Classes.Eq (GHC.Parser.Annotation.EpAnn ann)
instance Data.Data.Data ann => Data.Data.Data (GHC.Parser.Annotation.EpAnn ann)
instance GHC.Classes.Eq GHC.Parser.Annotation.EpaLocation
instance Data.Data.Data GHC.Parser.Annotation.EpaLocation
instance GHC.Classes.Eq GHC.Parser.Annotation.TokenLocation
instance Data.Data.Data GHC.Parser.Annotation.TokenLocation
instance GHC.Classes.Eq GHC.Parser.Annotation.AddEpAnn
instance Data.Data.Data GHC.Parser.Annotation.AddEpAnn
instance GHC.Classes.Eq a => GHC.Classes.Eq (GHC.Parser.Annotation.SrcSpanAnn' a)
instance Data.Data.Data a => Data.Data.Data (GHC.Parser.Annotation.SrcSpanAnn' a)
instance GHC.Classes.Eq GHC.Parser.Annotation.TrailingAnn
instance Data.Data.Data GHC.Parser.Annotation.TrailingAnn
instance GHC.Classes.Eq GHC.Parser.Annotation.AnnListItem
instance Data.Data.Data GHC.Parser.Annotation.AnnListItem
instance GHC.Classes.Eq GHC.Parser.Annotation.AnnList
instance Data.Data.Data GHC.Parser.Annotation.AnnList
instance Data.Data.Data GHC.Parser.Annotation.ParenType
instance GHC.Classes.Ord GHC.Parser.Annotation.ParenType
instance GHC.Classes.Eq GHC.Parser.Annotation.ParenType
instance Data.Data.Data GHC.Parser.Annotation.AnnParen
instance Data.Data.Data GHC.Parser.Annotation.AnnContext
instance Data.Data.Data GHC.Parser.Annotation.NameAdornment
instance GHC.Classes.Ord GHC.Parser.Annotation.NameAdornment
instance GHC.Classes.Eq GHC.Parser.Annotation.NameAdornment
instance GHC.Classes.Eq GHC.Parser.Annotation.NameAnn
instance Data.Data.Data GHC.Parser.Annotation.NameAnn
instance GHC.Classes.Eq GHC.Parser.Annotation.AnnPragma
instance Data.Data.Data GHC.Parser.Annotation.AnnPragma
instance GHC.Classes.Eq GHC.Parser.Annotation.AnnSortKey
instance Data.Data.Data GHC.Parser.Annotation.AnnSortKey
instance GHC.Classes.Ord GHC.Parser.Annotation.NoEpAnns
instance GHC.Classes.Eq GHC.Parser.Annotation.NoEpAnns
instance Data.Data.Data GHC.Parser.Annotation.NoEpAnns
instance GHC.Base.Semigroup GHC.Parser.Annotation.NoEpAnns
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.NoEpAnns
instance GHC.Base.Semigroup GHC.Parser.Annotation.AnnSortKey
instance GHC.Base.Monoid GHC.Parser.Annotation.AnnSortKey
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnnSortKey
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnnPragma
instance GHC.Base.Semigroup GHC.Parser.Annotation.NameAnn
instance GHC.Base.Monoid GHC.Parser.Annotation.NameAnn
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.NameAnn
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.NameAdornment
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnnContext
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Parser.Annotation.LocatedL a)
instance GHC.Base.Semigroup GHC.Parser.Annotation.AnnList
instance GHC.Base.Monoid GHC.Parser.Annotation.AnnList
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnnList
instance GHC.Base.Semigroup GHC.Parser.Annotation.AnnListItem
instance GHC.Base.Monoid GHC.Parser.Annotation.AnnListItem
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnnListItem
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.TrailingAnn
instance GHC.Types.Name.NamedThing (GHC.Types.SrcLoc.Located a) => GHC.Types.Name.NamedThing (GHC.Parser.Annotation.LocatedAn an a)
instance GHC.Base.Semigroup an => GHC.Base.Semigroup (GHC.Parser.Annotation.SrcSpanAnn' an)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Parser.Annotation.SrcSpanAnn' a)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable e) => GHC.Utils.Outputable.Outputable (GHC.Types.SrcLoc.GenLocated (GHC.Parser.Annotation.SrcSpanAnn' a) e)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.OutputableBndr e) => GHC.Utils.Outputable.OutputableBndr (GHC.Types.SrcLoc.GenLocated (GHC.Parser.Annotation.SrcSpanAnn' a) e)
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AddEpAnn
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.EpaLocation
instance GHC.Base.Semigroup a => GHC.Base.Semigroup (GHC.Parser.Annotation.EpAnn a)
instance GHC.Base.Monoid a => GHC.Base.Monoid (GHC.Parser.Annotation.EpAnn a)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Parser.Annotation.EpAnn a)
instance GHC.Base.Semigroup GHC.Parser.Annotation.EpAnnComments
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.EpAnnComments
instance GHC.Classes.Ord GHC.Parser.Annotation.Anchor
instance GHC.Base.Semigroup GHC.Parser.Annotation.Anchor
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.Anchor
instance GHC.Utils.Outputable.Outputable (GHC.Types.SrcLoc.GenLocated GHC.Parser.Annotation.Anchor GHC.Parser.Annotation.EpaComment)
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnchorOperation
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.DeltaPos
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.EpaComment
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.IsUnicodeSyntax
instance GHC.Utils.Outputable.Outputable GHC.Parser.Annotation.AnnKeywordId
-- | 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 GHC.Data.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 = LocatedL (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 GHC.Data.BooleanFormula.BooleanFormula
instance Data.Foldable.Foldable GHC.Data.BooleanFormula.BooleanFormula
instance GHC.Base.Functor GHC.Data.BooleanFormula.BooleanFormula
instance Data.Data.Data a => Data.Data.Data (GHC.Data.BooleanFormula.BooleanFormula a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (GHC.Data.BooleanFormula.BooleanFormula a)
instance GHC.Utils.Outputable.OutputableBndr a => GHC.Utils.Outputable.Outputable (GHC.Data.BooleanFormula.BooleanFormula a)
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Data.BooleanFormula.BooleanFormula a)
-- | Computing fingerprints of values serializeable with GHC's "Binary"
-- module.
module GHC.Iface.Recomp.Binary
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 ()
-- | Module for coercion axioms, used to represent type family instances
-- and newtypes
module GHC.Core.Coercion.Axiom
data BranchFlag
type Branched = 'Branched
type Unbranched = 'Unbranched
type BranchIndex = Int
newtype Branches (br :: BranchFlag)
MkBranches :: Array BranchIndex CoAxBranch -> Branches (br :: BranchFlag)
[unMkBranches] :: Branches (br :: BranchFlag) -> Array BranchIndex CoAxBranch
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] -> [TyVar] -> [CoVar] -> [Role] -> [Type] -> Type -> [CoAxBranch] -> CoAxBranch
[cab_loc] :: CoAxBranch -> SrcSpan
[cab_tvs] :: CoAxBranch -> [TyVar]
[cab_eta_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 GHC.Core.Coercion.Axiom.Role
instance GHC.Classes.Ord GHC.Core.Coercion.Axiom.Role
instance GHC.Classes.Eq GHC.Core.Coercion.Axiom.Role
instance Data.Data.Data GHC.Core.Coercion.Axiom.CoAxBranch
instance Data.Data.Data GHC.Core.Coercion.Axiom.CoAxiomRule
instance GHC.Types.Unique.Uniquable GHC.Core.Coercion.Axiom.CoAxiomRule
instance GHC.Classes.Eq GHC.Core.Coercion.Axiom.CoAxiomRule
instance GHC.Classes.Ord GHC.Core.Coercion.Axiom.CoAxiomRule
instance GHC.Utils.Outputable.Outputable GHC.Core.Coercion.Axiom.CoAxiomRule
instance GHC.Classes.Eq (GHC.Core.Coercion.Axiom.CoAxiom br)
instance GHC.Types.Unique.Uniquable (GHC.Core.Coercion.Axiom.CoAxiom br)
instance GHC.Utils.Outputable.Outputable (GHC.Core.Coercion.Axiom.CoAxiom br)
instance GHC.Types.Name.NamedThing (GHC.Core.Coercion.Axiom.CoAxiom br)
instance Data.Typeable.Internal.Typeable br => Data.Data.Data (GHC.Core.Coercion.Axiom.CoAxiom br)
instance GHC.Utils.Outputable.Outputable GHC.Core.Coercion.Axiom.CoAxBranch
instance GHC.Utils.Outputable.Outputable GHC.Core.Coercion.Axiom.Role
instance GHC.Utils.Binary.Binary GHC.Core.Coercion.Axiom.Role
module GHC.Core.Class
data Class
type ClassOpItem = (Id, DefMethInfo)
data ClassATItem
ATI :: TyCon -> Maybe (Type, ATValidityInfo) -> ClassATItem
-- | Information about an associated type family default implementation.
-- This is used solely for validity checking. See Note [Type-checking
-- default assoc decls] in GHC.Tc.TyCl.
data ATValidityInfo
NoATVI :: ATValidityInfo
ATVI :: SrcSpan -> [Type] -> ATValidityInfo
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
classSCSelIds :: Class -> [Id]
classMinimalDef :: Class -> ClassMinimalDef
classHasFds :: Class -> Bool
isAbstractClass :: Class -> Bool
instance GHC.Classes.Eq GHC.Core.Class.Class
instance GHC.Types.Unique.Uniquable GHC.Core.Class.Class
instance GHC.Types.Name.NamedThing GHC.Core.Class.Class
instance GHC.Utils.Outputable.Outputable GHC.Core.Class.Class
instance Data.Data.Data GHC.Core.Class.Class
-- | An architecture independent description of a register's class.
module GHC.Platform.Reg.Class
-- | The class of a register. Used in the register allocator. We treat all
-- registers in a class as being interchangeable.
data RegClass
RcInteger :: RegClass
RcFloat :: RegClass
RcDouble :: RegClass
instance GHC.Classes.Eq GHC.Platform.Reg.Class.RegClass
instance GHC.Types.Unique.Uniquable GHC.Platform.Reg.Class.RegClass
instance GHC.Utils.Outputable.Outputable GHC.Platform.Reg.Class.RegClass
-- | 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 GHC.Platform.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
regSingle :: RegNo -> Reg
realRegSingle :: RegNo -> RealReg
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
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.
newtype RealReg
RealRegSingle :: 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.Show.Show GHC.Platform.Reg.VirtualReg
instance GHC.Classes.Eq GHC.Platform.Reg.VirtualReg
instance GHC.Classes.Ord GHC.Platform.Reg.RealReg
instance GHC.Show.Show GHC.Platform.Reg.RealReg
instance GHC.Classes.Eq GHC.Platform.Reg.RealReg
instance GHC.Show.Show GHC.Platform.Reg.Reg
instance GHC.Classes.Ord GHC.Platform.Reg.Reg
instance GHC.Classes.Eq GHC.Platform.Reg.Reg
instance GHC.Types.Unique.Uniquable GHC.Platform.Reg.Reg
instance GHC.Utils.Outputable.Outputable GHC.Platform.Reg.Reg
instance GHC.Types.Unique.Uniquable GHC.Platform.Reg.RealReg
instance GHC.Utils.Outputable.Outputable GHC.Platform.Reg.RealReg
instance GHC.Classes.Ord GHC.Platform.Reg.VirtualReg
instance GHC.Types.Unique.Uniquable GHC.Platform.Reg.VirtualReg
instance GHC.Utils.Outputable.Outputable GHC.Platform.Reg.VirtualReg
module GHC.Builtin.Names
-- | 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
allNameStrings :: [String]
itName :: Unique -> SrcSpan -> Name
mkUnboundName :: OccName -> Name
isUnboundName :: Name -> Bool
basicKnownKeyNames :: [Name]
genericTyConNames :: [Name]
pRELUDE :: Module
gHC_PRIM :: Module
gHC_PRIM_PANIC :: Module
gHC_PRIM_EXCEPTION :: Module
gHC_TYPES :: Module
gHC_MAGIC :: Module
gHC_MAGIC_DICT :: Module
gHC_CSTRING :: Module
gHC_CLASSES :: Module
gHC_PRIMOPWRAPPERS :: Module
gHC_BASE :: Module
gHC_ENUM :: Module
gHC_GHCI :: Module
gHC_GHCI_HELPERS :: Module
gHC_SHOW :: Module
gHC_READ :: Module
gHC_NUM :: Module
gHC_MAYBE :: Module
gHC_NUM_INTEGER :: Module
gHC_NUM_NATURAL :: Module
gHC_NUM_BIGNAT :: Module
gHC_LIST :: Module
gHC_TUPLE :: Module
dATA_EITHER :: Module
dATA_LIST :: Module
dATA_STRING :: Module
dATA_FOLDABLE :: Module
dATA_TRAVERSABLE :: Module
gHC_CONC :: Module
gHC_IO :: Module
gHC_IO_Exception :: Module
gHC_ST :: Module
gHC_IX :: 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
gHC_DESUGAR :: Module
rANDOM :: Module
gHC_EXTS :: Module
cONTROL_EXCEPTION_BASE :: Module
gHC_GENERICS :: Module
gHC_TYPEERROR :: Module
gHC_TYPELITS :: Module
gHC_TYPELITS_INTERNAL :: Module
gHC_TYPENATS :: Module
gHC_TYPENATS_INTERNAL :: Module
dATA_COERCE :: Module
dEBUG_TRACE :: Module
uNSAFE_COERCE :: 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
rOOT_MAIN :: Module
mkInteractiveModule :: Int -> Module
pRELUDE_NAME :: ModuleName
mAIN_NAME :: ModuleName
mkPrimModule :: FastString -> Module
mkBignumModule :: FastString -> Module
mkBaseModule :: FastString -> Module
mkBaseModule_ :: ModuleName -> Module
mkThisGhcModule :: FastString -> Module
mkThisGhcModule_ :: ModuleName -> Module
mkMainModule :: FastString -> Module
mkMainModule_ :: ModuleName -> Module
main_RDR_Unqual :: RdrName
eq_RDR :: RdrName
ge_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 :: 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
integerAdd_RDR :: RdrName
integerMul_RDR :: RdrName
ioDataCon_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
fromString_RDR :: RdrName
fromList_RDR :: RdrName
fromListN_RDR :: RdrName
toList_RDR :: RdrName
compose_RDR :: RdrName
and_RDR :: RdrName
not_RDR :: RdrName
dataToTag_RDR :: RdrName
succ_RDR :: RdrName
pred_RDR :: RdrName
minBound_RDR :: RdrName
maxBound_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
readField_RDR :: RdrName
readFieldHash_RDR :: RdrName
readSymField_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
showsPrec_RDR :: RdrName
shows_RDR :: RdrName
showString_RDR :: RdrName
showSpace_RDR :: RdrName
showCommaSpace_RDR :: RdrName
showParen_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
selName_RDR :: RdrName
conName_RDR :: RdrName
conFixity_RDR :: RdrName
conIsRecord_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
null_RDR :: RdrName
all_RDR :: RdrName
traverse_RDR :: RdrName
mempty_RDR :: RdrName
mappend_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
runRWName :: Name
withDictName :: Name
orderingTyConName :: Name
ordLTDataConName :: Name
ordEQDataConName :: Name
ordGTDataConName :: 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
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
cstringLengthName :: Name
eqStringName :: Name
unpackCStringName :: Name
unpackCStringAppendName :: Name
unpackCStringFoldrName :: Name
unpackCStringUtf8Name :: Name
unpackCStringAppendUtf8Name :: Name
unpackCStringFoldrUtf8Name :: Name
inlineIdName :: Name
eqClassName :: Name
eqName :: Name
ordClassName :: Name
geName :: Name
functorClassName :: Name
fmapName :: Name
monadClassName :: Name
thenMName :: Name
bindMName :: Name
returnMName :: Name
monadFailClassName :: Name
failMName :: Name
applicativeClassName :: Name
apAName :: Name
pureAName :: 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
considerAccessibleName :: Name
dollarName :: Name
otherwiseIdName :: Name
foldrName :: Name
buildName :: Name
augmentName :: Name
mapName :: Name
appendName :: Name
assertName :: Name
fromStringName :: Name
numClassName :: Name
fromIntegerName :: Name
minusName :: Name
negateName :: Name
bnbVarQual :: String -> Unique -> Name
bnnVarQual :: String -> Unique -> Name
bniVarQual :: String -> Unique -> Name
bignatFromWordListName :: Name
bignatEqName :: Name
bignatCompareName :: Name
bignatCompareWordName :: Name
naturalToWordName :: Name
naturalPopCountName :: Name
naturalShiftRName :: Name
naturalShiftLName :: Name
naturalAddName :: Name
naturalSubName :: Name
naturalSubThrowName :: Name
naturalSubUnsafeName :: Name
naturalMulName :: Name
naturalQuotRemName :: Name
naturalQuotName :: Name
naturalRemName :: Name
naturalAndName :: Name
naturalAndNotName :: Name
naturalOrName :: Name
naturalXorName :: Name
naturalTestBitName :: Name
naturalBitName :: Name
naturalGcdName :: Name
naturalLcmName :: Name
naturalLog2Name :: Name
naturalLogBaseWordName :: Name
naturalLogBaseName :: Name
naturalPowModName :: Name
naturalSizeInBaseName :: Name
integerFromNaturalName :: Name
integerToNaturalClampName :: Name
integerToNaturalThrowName :: Name
integerToNaturalName :: Name
integerToWordName :: Name
integerToIntName :: Name
integerToWord64Name :: Name
integerToInt64Name :: Name
integerFromWordName :: Name
integerFromWord64Name :: Name
integerFromInt64Name :: Name
integerAddName :: Name
integerMulName :: Name
integerSubName :: Name
integerNegateName :: Name
integerAbsName :: Name
integerPopCountName :: Name
integerQuotName :: Name
integerRemName :: Name
integerDivName :: Name
integerModName :: Name
integerDivModName :: Name
integerQuotRemName :: Name
integerEncodeFloatName :: Name
integerEncodeDoubleName :: Name
integerGcdName :: Name
integerLcmName :: Name
integerAndName :: Name
integerOrName :: Name
integerXorName :: Name
integerComplementName :: Name
integerBitName :: Name
integerTestBitName :: Name
integerShiftLName :: Name
integerShiftRName :: 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
mkRationalBase2Name :: Name
mkRationalBase10Name :: Name
floatingClassName :: Name
realFloatClassName :: Name
integerToFloatName :: Name
integerToDoubleName :: Name
naturalToFloatName :: Name
naturalToDoubleName :: 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
typeLitCharDataConName :: Name
typeableClassName :: Name
typeRepTyConName :: Name
someTypeRepTyConName :: Name
someTypeRepDataConName :: Name
typeRepIdName :: Name
mkTrTypeName :: Name
mkTrConName :: Name
mkTrAppName :: Name
mkTrFunName :: Name
typeNatTypeRepName :: Name
typeSymbolTypeRepName :: Name
typeCharTypeRepName :: Name
trGhcPrimModuleName :: Name
starKindRepName :: Name
starArrStarKindRepName :: Name
starArrStarArrStarKindRepName :: Name
errorMessageTypeErrorFamName :: Name
typeErrorTextDataConName :: Name
typeErrorAppendDataConName :: Name
typeErrorVAppendDataConName :: Name
typeErrorShowTypeDataConName :: Name
unsafeEqualityProofName :: Name
unsafeEqualityTyConName :: Name
unsafeReflDataConName :: Name
unsafeCoercePrimName :: Name
toDynName :: Name
dataClassName :: Name
assertErrorName :: Name
traceName :: 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
getFieldName :: Name
setFieldName :: 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
word8TyConName :: 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
knownCharClassName :: Name
fromLabelClassOpName :: 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
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
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
knownCharClassNameKey :: Unique
ghciIoClassKey :: Unique
semigroupClassKey :: Unique
monoidClassKey :: Unique
ipClassKey :: Unique
hasFieldClassNameKey :: Unique
addrPrimTyConKey :: Unique
arrayPrimTyConKey :: Unique
boolTyConKey :: Unique
byteArrayPrimTyConKey :: Unique
stringTyConKey :: Unique
charPrimTyConKey :: Unique
charTyConKey :: Unique
doublePrimTyConKey :: Unique
doubleTyConKey :: Unique
floatPrimTyConKey :: Unique
floatTyConKey :: Unique
funTyConKey :: Unique
intPrimTyConKey :: Unique
intTyConKey :: Unique
int8PrimTyConKey :: Unique
int8TyConKey :: Unique
int16PrimTyConKey :: 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
mutableByteArrayPrimTyConKey :: Unique
orderingTyConKey :: Unique
mVarPrimTyConKey :: Unique
ioPortPrimTyConKey :: Unique
ratioTyConKey :: Unique
rationalTyConKey :: Unique
realWorldTyConKey :: Unique
stablePtrPrimTyConKey :: Unique
stablePtrTyConKey :: Unique
eqTyConKey :: Unique
heqTyConKey :: Unique
statePrimTyConKey :: Unique
stableNamePrimTyConKey :: Unique
stableNameTyConKey :: Unique
eqPrimTyConKey :: Unique
eqReprPrimTyConKey :: Unique
eqPhantPrimTyConKey :: Unique
mutVarPrimTyConKey :: Unique
ioTyConKey :: Unique
wordPrimTyConKey :: Unique
wordTyConKey :: Unique
word8PrimTyConKey :: Unique
word8TyConKey :: Unique
word16PrimTyConKey :: Unique
word16TyConKey :: Unique
word32PrimTyConKey :: Unique
word32TyConKey :: Unique
word64PrimTyConKey :: Unique
word64TyConKey :: Unique
kindConKey :: Unique
boxityConKey :: Unique
typeConKey :: Unique
threadIdPrimTyConKey :: Unique
bcoPrimTyConKey :: Unique
ptrTyConKey :: Unique
funPtrTyConKey :: Unique
tVarPrimTyConKey :: Unique
compactPrimTyConKey :: Unique
stackSnapshotPrimTyConKey :: Unique
isReflPrimTyConKey :: Unique
eitherTyConKey :: Unique
nonEmptyTyConKey :: Unique
liftedTypeKindTyConKey :: Unique
unliftedTypeKindTyConKey :: Unique
tYPETyConKey :: Unique
constraintKindTyConKey :: Unique
levityTyConKey :: Unique
runtimeRepTyConKey :: Unique
vecCountTyConKey :: Unique
vecElemTyConKey :: Unique
liftedRepTyConKey :: Unique
unliftedRepTyConKey :: Unique
zeroBitRepTyConKey :: Unique
zeroBitTypeTyConKey :: Unique
pluginTyConKey :: Unique
frontendPluginTyConKey :: Unique
trTyConTyConKey :: Unique
trModuleTyConKey :: Unique
trNameTyConKey :: Unique
kindRepTyConKey :: Unique
typeLitSortTyConKey :: 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
repTyConKey :: Unique
rep1TyConKey :: Unique
uRecTyConKey :: Unique
uAddrTyConKey :: Unique
uCharTyConKey :: Unique
uDoubleTyConKey :: Unique
uFloatTyConKey :: Unique
uIntTyConKey :: Unique
uWordTyConKey :: Unique
errorMessageTypeErrorFamKey :: Unique
coercibleTyConKey :: Unique
proxyPrimTyConKey :: Unique
specTyConKey :: Unique
anyTyConKey :: Unique
smallArrayPrimTyConKey :: Unique
smallMutableArrayPrimTyConKey :: Unique
staticPtrTyConKey :: Unique
staticPtrInfoTyConKey :: Unique
callStackTyConKey :: Unique
typeRepTyConKey :: Unique
someTypeRepTyConKey :: Unique
someTypeRepDataConKey :: Unique
typeSymbolAppendFamNameKey :: Unique
unsafeEqualityTyConKey :: Unique
multiplicityTyConKey :: Unique
unrestrictedFunTyConKey :: Unique
multMulTyConKey :: Unique
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
typeSymbolKindConNameKey :: Unique
typeCharKindConNameKey :: Unique
typeNatAddTyFamNameKey :: Unique
typeNatMulTyFamNameKey :: Unique
typeNatExpTyFamNameKey :: Unique
typeNatSubTyFamNameKey :: Unique
typeSymbolCmpTyFamNameKey :: Unique
typeNatCmpTyFamNameKey :: Unique
typeCharCmpTyFamNameKey :: Unique
typeLeqCharTyFamNameKey :: Unique
typeNatDivTyFamNameKey :: Unique
typeNatModTyFamNameKey :: Unique
typeNatLogTyFamNameKey :: Unique
typeConsSymbolTyFamNameKey :: Unique
typeUnconsSymbolTyFamNameKey :: Unique
typeCharToNatTyFamNameKey :: Unique
typeNatToCharTyFamNameKey :: Unique
charDataConKey :: Unique
consDataConKey :: Unique
doubleDataConKey :: Unique
falseDataConKey :: Unique
floatDataConKey :: Unique
intDataConKey :: Unique
nothingDataConKey :: Unique
justDataConKey :: Unique
eqDataConKey :: Unique
nilDataConKey :: Unique
ratioDataConKey :: Unique
word8DataConKey :: Unique
stableNameDataConKey :: Unique
trueDataConKey :: Unique
wordDataConKey :: Unique
ioDataConKey :: Unique
heqDataConKey :: Unique
nonEmptyDataConKey :: Unique
crossDataConKey :: Unique
inlDataConKey :: Unique
inrDataConKey :: Unique
genUnitDataConKey :: Unique
leftDataConKey :: Unique
rightDataConKey :: Unique
ordLTDataConKey :: Unique
ordEQDataConKey :: Unique
ordGTDataConKey :: Unique
coercibleDataConKey :: Unique
staticPtrDataConKey :: Unique
staticPtrInfoDataConKey :: Unique
fingerprintDataConKey :: Unique
srcLocDataConKey :: Unique
trTyConDataConKey :: Unique
trModuleDataConKey :: Unique
trNameSDataConKey :: Unique
trNameDDataConKey :: Unique
trGhcPrimModuleKey :: 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
boxedRepDataConKey :: Unique
boxedRepDataConTyConKey :: Unique
tupleRepDataConTyConKey :: Unique
runtimeRepSimpleDataConKeys :: [Unique]
liftedDataConKey :: Unique
unliftedDataConKey :: Unique
vecCountDataConKeys :: [Unique]
vecElemDataConKeys :: [Unique]
kindRepTyConAppDataConKey :: Unique
kindRepVarDataConKey :: Unique
kindRepAppDataConKey :: Unique
kindRepFunDataConKey :: Unique
kindRepTYPEDataConKey :: Unique
kindRepTypeLitSDataConKey :: Unique
kindRepTypeLitDDataConKey :: Unique
typeLitSymbolDataConKey :: Unique
typeLitNatDataConKey :: Unique
typeLitCharDataConKey :: Unique
unsafeReflDataConKey :: Unique
oneDataConKey :: Unique
manyDataConKey :: Unique
integerISDataConKey :: Unique
integerINDataConKey :: Unique
integerIPDataConKey :: Unique
naturalNSDataConKey :: Unique
naturalNBDataConKey :: Unique
wildCardKey :: Unique
absentErrorIdKey :: Unique
augmentIdKey :: Unique
appendIdKey :: Unique
buildIdKey :: Unique
foldrIdKey :: Unique
recSelErrorIdKey :: Unique
seqIdKey :: Unique
absentSumFieldErrorIdKey :: Unique
eqStringIdKey :: Unique
noMethodBindingErrorIdKey :: Unique
nonExhaustiveGuardsErrorIdKey :: Unique
runtimeErrorIdKey :: Unique
patErrorIdKey :: Unique
realWorldPrimIdKey :: Unique
recConErrorIdKey :: Unique
unpackCStringUtf8IdKey :: Unique
unpackCStringAppendUtf8IdKey :: Unique
unpackCStringFoldrUtf8IdKey :: Unique
unpackCStringIdKey :: Unique
unpackCStringAppendIdKey :: Unique
unpackCStringFoldrIdKey :: Unique
voidPrimIdKey :: Unique
typeErrorIdKey :: Unique
divIntIdKey :: Unique
modIntIdKey :: Unique
cstringLengthIdKey :: Unique
raiseOverflowIdKey :: Unique
raiseUnderflowIdKey :: Unique
raiseDivZeroIdKey :: Unique
concatIdKey :: Unique
filterIdKey :: Unique
zipIdKey :: Unique
bindIOIdKey :: Unique
returnIOIdKey :: Unique
newStablePtrIdKey :: Unique
printIdKey :: Unique
failIOIdKey :: Unique
nullAddrIdKey :: Unique
voidArgIdKey :: Unique
otherwiseIdKey :: Unique
assertIdKey :: Unique
leftSectionKey :: Unique
rightSectionKey :: Unique
rootMainKey :: Unique
runMainKey :: Unique
thenIOIdKey :: Unique
lazyIdKey :: Unique
assertErrorIdKey :: Unique
oneShotKey :: Unique
runRWKey :: Unique
traceKey :: Unique
inlineIdKey :: Unique
mapIdKey :: Unique
groupWithIdKey :: Unique
dollarIdKey :: Unique
coercionTokenIdKey :: Unique
noinlineIdKey :: Unique
considerAccessibleIdKey :: Unique
integerToFloatIdKey :: Unique
integerToDoubleIdKey :: Unique
naturalToFloatIdKey :: Unique
naturalToDoubleIdKey :: Unique
rationalToFloatIdKey :: Unique
rationalToDoubleIdKey :: Unique
withDictKey :: 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
bindMClassOpKey :: Unique
thenMClassOpKey :: Unique
fmapClassOpKey :: Unique
returnMClassOpKey :: Unique
mfixIdKey :: Unique
failMClassOpKey :: Unique
fromLabelClassOpKey :: 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
mkTrTypeKey :: Unique
mkTrConKey :: Unique
mkTrAppKey :: Unique
typeNatTypeRepKey :: Unique
typeSymbolTypeRepKey :: Unique
typeCharTypeRepKey :: Unique
typeRepIdKey :: Unique
mkTrFunKey :: Unique
trTYPEKey :: Unique
trTYPE'PtrRepLiftedKey :: Unique
trRuntimeRepKey :: Unique
tr'PtrRepLiftedKey :: Unique
trLiftedRepKey :: Unique
starKindRepKey :: Unique
starArrStarKindRepKey :: Unique
starArrStarArrStarKindRepKey :: Unique
toDynIdKey :: Unique
bitIntegerIdKey :: Unique
eqSCSelIdKey :: Unique
heqSCSelIdKey :: Unique
coercibleSCSelIdKey :: Unique
sappendClassOpKey :: Unique
memptyClassOpKey :: Unique
mappendClassOpKey :: Unique
mconcatClassOpKey :: Unique
emptyCallStackKey :: Unique
pushCallStackKey :: Unique
fromStaticPtrClassOpKey :: Unique
makeStaticKey :: Unique
unsafeEqualityProofIdKey :: Unique
unsafeCoercePrimIdKey :: Unique
getFieldClassOpKey :: Unique
setFieldClassOpKey :: Unique
integerFromNaturalIdKey :: Unique
integerToNaturalClampIdKey :: Unique
integerToNaturalThrowIdKey :: Unique
integerToNaturalIdKey :: Unique
integerToWordIdKey :: Unique
integerToIntIdKey :: Unique
integerToWord64IdKey :: Unique
integerToInt64IdKey :: Unique
integerAddIdKey :: Unique
integerMulIdKey :: Unique
integerSubIdKey :: Unique
integerNegateIdKey :: Unique
integerAbsIdKey :: Unique
integerPopCountIdKey :: Unique
integerQuotIdKey :: Unique
integerRemIdKey :: Unique
integerDivIdKey :: Unique
integerModIdKey :: Unique
integerDivModIdKey :: Unique
integerQuotRemIdKey :: Unique
integerEncodeFloatIdKey :: Unique
integerEncodeDoubleIdKey :: Unique
integerGcdIdKey :: Unique
integerLcmIdKey :: Unique
integerAndIdKey :: Unique
integerOrIdKey :: Unique
integerXorIdKey :: Unique
integerComplementIdKey :: Unique
integerBitIdKey :: Unique
integerTestBitIdKey :: Unique
integerShiftLIdKey :: Unique
integerShiftRIdKey :: Unique
integerFromWordIdKey :: Unique
integerFromWord64IdKey :: Unique
integerFromInt64IdKey :: Unique
naturalToWordIdKey :: Unique
naturalPopCountIdKey :: Unique
naturalShiftRIdKey :: Unique
naturalShiftLIdKey :: Unique
naturalAddIdKey :: Unique
naturalSubIdKey :: Unique
naturalSubThrowIdKey :: Unique
naturalSubUnsafeIdKey :: Unique
naturalMulIdKey :: Unique
naturalQuotRemIdKey :: Unique
naturalQuotIdKey :: Unique
naturalRemIdKey :: Unique
naturalAndIdKey :: Unique
naturalAndNotIdKey :: Unique
naturalOrIdKey :: Unique
naturalXorIdKey :: Unique
naturalTestBitIdKey :: Unique
naturalBitIdKey :: Unique
naturalGcdIdKey :: Unique
naturalLcmIdKey :: Unique
naturalLog2IdKey :: Unique
naturalLogBaseWordIdKey :: Unique
naturalLogBaseIdKey :: Unique
naturalPowModIdKey :: Unique
naturalSizeInBaseIdKey :: Unique
bignatFromWordListIdKey :: Unique
bignatEqIdKey :: Unique
bignatCompareIdKey :: Unique
bignatCompareWordIdKey :: Unique
mkRationalBase2IdKey :: Unique
mkRationalBase10IdKey :: Unique
numericClassKeys :: [Unique]
fractionalClassKeys :: [Unique]
standardClassKeys :: [Unique]
derivableClassKeys :: [Unique]
interactiveClassNames :: [Name]
interactiveClassKeys :: [Unique]
-- | Should this name be considered in-scope, even though it technically
-- isn't?
--
-- This ensures that we don't filter out information because, e.g.,
-- Data.Kind.Type isn't imported.
--
-- See Note [pretendNameIsInScope].
pretendNameIsInScope :: Name -> Bool
-- | Compile-time settings
module GHC.Settings.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 #5395.
mAX_REDUCTION_DEPTH :: Int
-- | Default maximum constraint-solver iterations Typically there should be
-- very few
mAX_SOLVER_ITERATIONS :: Int
wORD64_SIZE :: Int
fLOAT_SIZE :: Int
dOUBLE_SIZE :: Int
tARGET_MAX_CHAR :: Int
module GHC.Core.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] -> Int -> Bool -> 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 mkTyConTagMap)
[data_cons] :: AlgTyConRhs -> [DataCon]
-- | Cached value: length data_cons
[data_cons_size] :: AlgTyConRhs -> Int
-- | Cached value: is this an enumeration type? See Note [Enumeration
-- types]
[is_enum] :: AlgTyConRhs -> Bool
-- | True if the data type constructor has a known, fixed levity
-- when fully applied to its arguments, False otherwise.
--
-- This can only be False with UnliftedDatatypes, e.g.
--
--
-- data A :: TYPE (BoxedRep l) where { MkA :: Int -> A }
--
--
-- This boolean is cached to make it cheaper to check for levity and
-- representation-polymorphism in tcHasFixedRuntimeRep.
[data_fixed_lev] :: 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
-- | An unboxed sum type.
SumTyCon :: [DataCon] -> Int -> 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 mkTyConTagMap)
[data_cons] :: AlgTyConRhs -> [DataCon]
-- | Cached value: length data_cons
[data_cons_size] :: AlgTyConRhs -> Int
-- | Information about those TyCons derived from a newtype
-- declaration
NewTyCon :: DataCon -> Type -> ([TyVar], Type) -> CoAxiom Unbranched -> Bool -> 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
-- | True if the newtype has a known, fixed representation when
-- fully applied to its arguments, False otherwise. This can only
-- ever be False with UnliftedNewtypes.
--
-- Example:
--
--
-- newtype N (a :: TYPE r) = MkN a
--
--
-- Invariant: nt_fixed_rep nt = tcHasFixedRuntimeRep (nt_rhs nt)
--
-- This boolean is cached to make it cheaper to check if a variable
-- binding is representation-polymorphic in tcHasFixedRuntimeRep.
[nt_fixed_rep] :: AlgTyConRhs -> Bool
-- | 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]
-- | Describes the flavour of an algebraic type constructor. For classes
-- and data families, this flavour includes a reference to the parent
-- TyCon.
data AlgTyConFlav
-- | An ordinary algebraic type constructor. This includes unlifted and
-- representation-polymorphic datatypes and newtypes and unboxed tuples,
-- but NOT unboxed sums; see UnboxedSumTyCon.
VanillaAlgTyCon :: TyConRepName -> AlgTyConFlav
-- | An unboxed sum type constructor. This is distinct from VanillaAlgTyCon
-- because we currently don't allow unboxed sums to be Typeable since
-- there are too many of them. See #13276.
UnboxedSumTyCon :: AlgTyConFlav
-- | Type constructors representing a class dictionary. See Note [ATyCon
-- for classes] in GHC.Core.TyCo.Rep
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. See
-- also Note [Getting from RuntimeRep to PrimRep] in
-- GHC.Types.RepType
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
-- | A constructor of Levity
LiftedInfo :: RuntimeRepInfo
-- | A constructor of Levity
UnliftedInfo :: RuntimeRepInfo
-- | Paints a picture of what a TyCon represents, in broad strokes.
-- This is used towards more informative error messages.
data TyConFlavour
ClassFlavour :: TyConFlavour
TupleFlavour :: Boxity -> TyConFlavour
SumFlavour :: TyConFlavour
DataTypeFlavour :: TyConFlavour
NewtypeFlavour :: TyConFlavour
AbstractTypeFlavour :: TyConFlavour
DataFamilyFlavour :: Maybe TyCon -> TyConFlavour
OpenTypeFamilyFlavour :: Maybe TyCon -> TyConFlavour
ClosedTypeFamilyFlavour :: TyConFlavour
TypeSynonymFlavour :: TyConFlavour
-- | e.g., the (->) TyCon.
BuiltInTypeFlavour :: TyConFlavour
PromotedDataConFlavour :: TyConFlavour
type TyConBinder = VarBndr TyVar TyConBndrVis
data TyConBndrVis
NamedTCB :: ArgFlag -> TyConBndrVis
AnonTCB :: AnonArgFlag -> TyConBndrVis
type TyConTyCoBinder = VarBndr TyCoVar TyConBndrVis
mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder
mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder]
-- | Make a Required TyConBinder. It chooses between NamedTCB and AnonTCB
-- based on whether the tv is mentioned in the dependent set
mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder
mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder
mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder]
tyConBinderArgFlag :: TyConBinder -> ArgFlag
tyConBndrVisArgFlag :: TyConBndrVis -> ArgFlag
isNamedTyConBinder :: TyConBinder -> Bool
isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
isVisibleTcbVis :: 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.
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 recommended to use
-- funTyCon if you want this functionality
mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon
-- | Create an primitive TyCon, such as Int#, Type
-- or RealWorld# Primitive TyCons are marshalable iff not
-- lifted. If you'd like to change this, modify marshalablePrimTyCon.
mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon
mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon
mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon
-- | Create an AlgTyConRhs from the data constructors.
--
-- Use mkLevPolyDataConRhs if the datatype can be
-- levity-polymorphic.
mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
-- | Create an AlgTyConRhs from the data constructors, for a
-- potentially levity-polymorphic datatype (with
-- UnliftedDatatypes).
mkLevPolyDataTyConRhs :: Bool -> [DataCon] -> AlgTyConRhs
-- | Create a type synonym TyCon
mkSynonymTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> Bool -> 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 -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon
-- | Makes a tycon suitable for use during type-checking. It stores a
-- variety of details about the definition of the TyCon, but no
-- right-hand side. It lives only during the type-checking of a
-- mutually-recursive group of tycons; it is then zonked to a proper
-- TyCon in zonkTcTyCon. See also Note [Kind checking recursive type and
-- class declarations] in GHC.Tc.TyCl.
mkTcTyCon :: Name -> [TyConBinder] -> Kind -> [(Name, TcTyVar)] -> Bool -> TyConFlavour -> TyCon
-- | No scoped type variables (to be used with mkTcTyCon).
noTcTyConScopedTyVars :: [(Name, TcTyVar)]
-- | 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
-- | Returns True for the TyCon of the Constraint
-- kind.
isConstraintKindCon :: 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 mustBeSaturated on a regular H98 type synonym,
-- because you should probably have expanded it first But regardless,
-- it's not decomposable
mustBeSaturated :: 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
-- | Is this tycon neither a type family nor a synonym that expands to a
-- type family?
isFamFreeTyCon :: TyCon -> Bool
-- | Is this a forgetful type synonym? If this is a type synonym whose RHS
-- does not mention one (or more) of its bound variables, returns True.
-- Thus, False means that all bound variables appear on the RHS; True may
-- not mean anything, as the test to set this flag is conservative.
isForgetfulSynTyCon :: 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
-- | 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)
-- | tyConInjectivityInfo tc returns Injective
-- is if tc is an injective tycon (where is states
-- for which tyConBinders tc is injective), or
-- NotInjective otherwise.
tyConInjectivityInfo :: TyCon -> Injectivity
isBuiltInSynFamTyCon_maybe :: TyCon -> Maybe BuiltInSynFamily
-- | 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 GHC.Tc.Solver.Canonical
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
-- GHC.Tc.Solver.Canonical
isGenerativeTyCon :: TyCon -> Role -> Bool
-- | Is this an AlgTyConRhs of a TyCon that is generative and
-- injective with respect to representational equality?
isGenInjAlgRhs :: AlgTyConRhs -> Bool
-- | Is this TyCon for an associated type?
isTyConAssoc :: TyCon -> Bool
-- | Get the enclosing class TyCon (if there is one) for the given TyCon.
tyConAssoc_maybe :: TyCon -> Maybe TyCon
-- | Get the enclosing class TyCon (if there is one) for the given
-- TyConFlavour
tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon
-- | 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 tuples 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
setTcTyConKind :: TyCon -> Kind -> TyCon
-- | Does this TyCon have a fixed RuntimeRep when fully applied, as
-- per Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete?
--
-- False is safe. True means we're sure. Does only a quick check, based
-- on the TyCon's category.
--
-- See Note [Representation-polymorphic TyCons]
tcHasFixedRuntimeRep :: TyCon -> Bool
-- | Is this TyCon concrete (i.e. not a synonym/type family)?
--
-- Used for representation polymorphism checks.
isConcreteTyCon :: 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]
tyConVisibleTyVars :: 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.
tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon
-- | Like tyConSingleDataCon_maybe, but panics if Nothing.
tyConSingleDataCon :: TyCon -> DataCon
-- | Returns Just dcs if the given TyCon is a data
-- type, a tuple type or a sum type with data constructors dcs. If the
-- TyCon has more than one constructor, or represents a primitive
-- or function type constructor then Nothing is returned.
--
-- Like tyConDataCons_maybe, but returns Nothing for
-- newtypes.
tyConAlgDataCons_maybe :: TyCon -> Maybe [DataCon]
-- | Like tyConSingleDataCon_maybe, but returns Nothing for
-- newtypes.
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 .... See
-- Note [The stupid context] in GHC.Core.DataCon.
tyConStupidTheta :: TyCon -> [PredType]
-- | Arity
tyConArity :: TyCon -> Arity
-- | A pre-allocated TyConApp tycon []
tyConNullaryTy :: TyCon -> Type
-- | Get the list of roles for the type parameters of a TyCon
tyConRoles :: TyCon -> [Role]
tyConFlavour :: TyCon -> TyConFlavour
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
tyConInvisTVBinders :: [TyConBinder] -> [InvisTVBinder]
-- | Scoped tyvars over the tycon's body The range is always a skolem or
-- TcTyVar, be MonoTcTyCon only: see Note [Scoped tyvars in a TcTyCon]
tcTyConScopedTyVars :: TyCon -> [(Name, TcTyVar)]
-- | Is this TcTyCon already generalized? Used only to make zonking more
-- efficient
tcTyConIsPoly :: TyCon -> Bool
mkTyConTagMap :: TyCon -> NameEnv ConTag
expandSynTyCon_maybe :: TyCon -> [tyco] -> Maybe ([(TyVar, tyco)], Type, [tyco])
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
-- | Is this flavour of TyCon an open type family or a data family?
tcFlavourIsOpen :: TyConFlavour -> Bool
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 GHC.Tc.Instance.Typeable.
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. See also Note [RuntimeRep and
-- PrimRep] in GHC.Types.RepType and Note [VoidRep] in
-- GHC.Types.RepType.
data PrimRep
VoidRep :: PrimRep
LiftedRep :: PrimRep
-- | Unlifted pointer
UnliftedRep :: PrimRep
-- | Signed, 8-bit value
Int8Rep :: PrimRep
-- | Signed, 16-bit value
Int16Rep :: PrimRep
-- | Signed, 32-bit value
Int32Rep :: PrimRep
-- | Signed, 64 bit value
Int64Rep :: PrimRep
-- | Signed, word-sized value
IntRep :: PrimRep
-- | Unsigned, 8 bit value
Word8Rep :: PrimRep
-- | Unsigned, 16 bit value
Word16Rep :: PrimRep
-- | Unsigned, 32 bit value
Word32Rep :: PrimRep
-- | Unsigned, 64 bit value
Word64Rep :: PrimRep
-- | Unsigned, word-sized value
WordRep :: 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
primElemRepToPrimRep :: PrimElemRep -> PrimRep
isVoidRep :: PrimRep -> Bool
isGcPtrRep :: PrimRep -> Bool
-- | The size of a PrimRep in bytes.
--
-- This applies also when used in a constructor, where we allow packing
-- the fields. For instance, in data Foo = Foo Float the two
-- fields will take only 8 bytes, which for 64-bit arch will be equal to
-- 1 word. See also mkVirtHeapOffsetsWithPadding for details of how data
-- fields are laid out.
primRepSizeB :: Platform -> PrimRep -> Int
primElemRepSizeB :: Platform -> PrimElemRep -> Int
-- | Return if Rep stands for floating type, returns Nothing for vector
-- types.
primRepIsFloat :: PrimRep -> Maybe Bool
primRepsCompatible :: Platform -> [PrimRep] -> [PrimRep] -> Bool
primRepCompatible :: Platform -> PrimRep -> PrimRep -> Bool
instance GHC.Classes.Eq GHC.Core.TyCon.Injectivity
instance GHC.Enum.Enum GHC.Core.TyCon.PrimElemRep
instance GHC.Show.Show GHC.Core.TyCon.PrimElemRep
instance GHC.Classes.Ord GHC.Core.TyCon.PrimElemRep
instance GHC.Classes.Eq GHC.Core.TyCon.PrimElemRep
instance Data.Data.Data GHC.Core.TyCon.PrimElemRep
instance GHC.Show.Show GHC.Core.TyCon.PrimRep
instance GHC.Classes.Ord GHC.Core.TyCon.PrimRep
instance GHC.Classes.Eq GHC.Core.TyCon.PrimRep
instance Data.Data.Data GHC.Core.TyCon.PrimRep
instance GHC.Classes.Eq GHC.Core.TyCon.TyConFlavour
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.AlgTyConFlav
instance GHC.Classes.Eq GHC.Core.TyCon.TyCon
instance GHC.Types.Unique.Uniquable GHC.Core.TyCon.TyCon
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.TyCon
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.TyConFlavour
instance GHC.Types.Name.NamedThing GHC.Core.TyCon.TyCon
instance Data.Data.Data GHC.Core.TyCon.TyCon
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.PrimRep
instance GHC.Utils.Binary.Binary GHC.Core.TyCon.PrimRep
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.PrimElemRep
instance GHC.Utils.Binary.Binary GHC.Core.TyCon.PrimElemRep
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.FamTyConFlav
instance GHC.Utils.Binary.Binary GHC.Core.TyCon.Injectivity
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.TyConBndrVis
instance GHC.Utils.Outputable.OutputableBndr tv => GHC.Utils.Outputable.Outputable (GHC.Types.Var.VarBndr tv GHC.Core.TyCon.TyConBndrVis)
instance GHC.Utils.Binary.Binary GHC.Core.TyCon.TyConBndrVis
module GHC.Core.TyCon.Env
-- | TyCon Environment
type TyConEnv a = UniqFM TyCon a
mkTyConEnv :: [(TyCon, a)] -> TyConEnv a
mkTyConEnvWith :: (a -> TyCon) -> [a] -> TyConEnv a
emptyTyConEnv :: TyConEnv a
isEmptyTyConEnv :: TyConEnv a -> Bool
unitTyConEnv :: TyCon -> a -> TyConEnv a
nonDetTyConEnvElts :: TyConEnv a -> [a]
extendTyConEnv_C :: (a -> a -> a) -> TyConEnv a -> TyCon -> a -> TyConEnv a
extendTyConEnv_Acc :: (a -> b -> b) -> (a -> b) -> TyConEnv b -> TyCon -> a -> TyConEnv b
extendTyConEnv :: TyConEnv a -> TyCon -> a -> TyConEnv a
extendTyConEnvList :: TyConEnv a -> [(TyCon, a)] -> TyConEnv a
extendTyConEnvList_C :: (a -> a -> a) -> TyConEnv a -> [(TyCon, a)] -> TyConEnv a
filterTyConEnv :: (elt -> Bool) -> TyConEnv elt -> TyConEnv elt
anyTyConEnv :: (elt -> Bool) -> TyConEnv elt -> Bool
plusTyConEnv :: TyConEnv a -> TyConEnv a -> TyConEnv a
plusTyConEnv_C :: (a -> a -> a) -> TyConEnv a -> TyConEnv a -> TyConEnv a
plusTyConEnv_CD :: (a -> a -> a) -> TyConEnv a -> a -> TyConEnv a -> a -> TyConEnv a
plusTyConEnv_CD2 :: (Maybe a -> Maybe a -> a) -> TyConEnv a -> TyConEnv a -> TyConEnv a
alterTyConEnv :: (Maybe a -> Maybe a) -> TyConEnv a -> TyCon -> TyConEnv a
lookupTyConEnv :: TyConEnv a -> TyCon -> Maybe a
lookupTyConEnv_NF :: TyConEnv a -> TyCon -> a
delFromTyConEnv :: TyConEnv a -> TyCon -> TyConEnv a
delListFromTyConEnv :: TyConEnv a -> [TyCon] -> TyConEnv a
elemTyConEnv :: TyCon -> TyConEnv a -> Bool
mapTyConEnv :: (elt1 -> elt2) -> TyConEnv elt1 -> TyConEnv elt2
disjointTyConEnv :: TyConEnv a -> TyConEnv a -> Bool
-- | Deterministic TyCon Environment
--
-- See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for
-- explanation why we need DTyConEnv.
type DTyConEnv a = UniqDFM TyCon a
emptyDTyConEnv :: DTyConEnv a
isEmptyDTyConEnv :: DTyConEnv a -> Bool
lookupDTyConEnv :: DTyConEnv a -> TyCon -> Maybe a
delFromDTyConEnv :: DTyConEnv a -> TyCon -> DTyConEnv a
filterDTyConEnv :: (a -> Bool) -> DTyConEnv a -> DTyConEnv a
mapDTyConEnv :: (a -> b) -> DTyConEnv a -> DTyConEnv b
mapMaybeDTyConEnv :: (a -> Maybe b) -> DTyConEnv a -> DTyConEnv b
adjustDTyConEnv :: (a -> a) -> DTyConEnv a -> TyCon -> DTyConEnv a
alterDTyConEnv :: (Maybe a -> Maybe a) -> DTyConEnv a -> TyCon -> DTyConEnv a
extendDTyConEnv :: DTyConEnv a -> TyCon -> a -> DTyConEnv a
foldDTyConEnv :: (elt -> a -> a) -> a -> DTyConEnv elt -> a
module GHC.Core.TyCon.RecWalk
data RecTcChecker
-- | Initialise a RecTcChecker with defaultRecTcMaxBound.
initRecTc :: RecTcChecker
-- | The default upper bound (100) for the number of times a
-- RecTcChecker is allowed to encounter each TyCon.
defaultRecTcMaxBound :: Int
-- | Change the upper bound for the number of times a RecTcChecker
-- is allowed to encounter each TyCon.
setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker
checkRecTc :: RecTcChecker -> TyCon -> Maybe RecTcChecker
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCon.RecWalk.RecTcChecker
module GHC.Core.TyCo.Rep
data Type
-- | Vanilla type or kind variable (*never* a coercion variable)
TyVarTy :: Var -> Type
-- | Type application to something other than a TyCon. Parameters:
--
-- 1) Function: must not be a TyConApp or CastTy,
-- must be another AppTy, or TyVarTy See Note [Respecting
-- definitional equality] (EQ1) about the no CastTy requirement
--
-- 2) Argument type
AppTy :: Type -> Type -> Type
-- | Application of a TyCon, including newtypes and synonyms.
-- Invariant: saturated applications of FunTyCon must use
-- FunTy and saturated synonyms must use their own constructors.
-- However, unsaturated FunTyCons do appear as
-- TyConApps. Parameters:
--
-- 1) Type constructor being applied to.
--
-- 2) Type arguments. Might not have enough type arguments here to
-- saturate the constructor. Even type synonyms are not necessarily
-- saturated; for example unsaturated type synonyms can appear as the
-- right hand side of a type synonym.
TyConApp :: TyCon -> [KindOrType] -> Type
-- | A Π type. Note [When we quantify over a coercion variable] INVARIANT:
-- If the binder is a coercion variable, it must be mentioned in the
-- Type. See Note [Unused coercion variable in ForAllTy]
ForAllTy :: {-# UNPACK #-} !TyCoVarBinder -> Type -> Type
-- | FUN m t1 t2 Very common, so an important special case See Note
-- [Function types]
FunTy :: AnonArgFlag -> Mult -> Type -> Type -> Type
[ft_af] :: Type -> AnonArgFlag
[ft_mult] :: Type -> Mult
[ft_arg] :: Type -> Type
[ft_res] :: Type -> Type
-- | Type literals are similar to type constructors.
LitTy :: TyLit -> Type
-- | A kind cast. The coercion is always nominal. INVARIANT: The cast is
-- never reflexive (EQ2) INVARIANT: The Type is not a CastTy (use TransCo
-- instead) (EQ3) INVARIANT: The Type is not a ForAllTy over a tyvar
-- (EQ4) See Note [Respecting definitional equality]
CastTy :: Type -> KindCoercion -> Type
-- | Injection of a Coercion into a type This should only ever be used in
-- the RHS of an AppTy, in the list of a TyConApp, when applying a
-- promoted GADT data constructor
CoercionTy :: Coercion -> Type
data TyLit
NumTyLit :: Integer -> TyLit
StrTyLit :: FastString -> TyLit
CharTyLit :: Char -> TyLit
-- | The key representation of types within the compiler
type KindOrType = Type
-- | The key type representing kinds in the compiler.
type Kind = Type
-- | Type synonym used for types of kind RuntimeRep.
type RuntimeRepType = Type
-- | A type labeled KnotTied might have knot-tied tycons in it. See
-- Note [Type checking recursive type and class declarations] in
-- GHC.Tc.TyCl
type KnotTied ty = ty
-- | A type of the form p of constraint kind 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]
-- | 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 [VarBndrs, TyCoVarBinders, TyConBinders,
-- and visibility] in GHC.Core.TyCo.Rep
data ArgFlag
Invisible :: Specificity -> ArgFlag
Required :: ArgFlag
pattern Specified :: ArgFlag
pattern Inferred :: ArgFlag
-- | The non-dependent version of ArgFlag. See Note [AnonArgFlag]
-- Appears here partly so that it's together with its friends ArgFlag and
-- ForallVisFlag, but also because it is used in IfaceType, rather early
-- in the compilation chain
data AnonArgFlag
-- | Used for (->): an ordinary non-dependent arrow. The
-- argument is visible in source code.
VisArg :: AnonArgFlag
-- | Used for (=>): a non-dependent predicate arrow. The
-- argument is invisible in source code.
InvisArg :: AnonArgFlag
-- | A Coercion is concrete evidence of the equality/convertibility
-- of two types.
data Coercion
Refl :: Type -> Coercion
GRefl :: Role -> Type -> MCoercionN -> Coercion
TyConAppCo :: Role -> TyCon -> [Coercion] -> Coercion
AppCo :: Coercion -> CoercionN -> Coercion
ForAllCo :: TyCoVar -> KindCoercion -> Coercion -> Coercion
FunCo :: Role -> CoercionN -> Coercion -> Coercion -> Coercion
CoVarCo :: CoVar -> Coercion
AxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion
AxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion
UnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
SymCo :: Coercion -> Coercion
TransCo :: Coercion -> Coercion -> Coercion
NthCo :: Role -> Int -> Coercion -> Coercion
LRCo :: LeftOrRight -> CoercionN -> Coercion
InstCo :: Coercion -> CoercionN -> Coercion
KindCo :: Coercion -> Coercion
SubCo :: CoercionN -> Coercion
-- | See Note [Coercion holes] Only present during typechecking
HoleCo :: CoercionHole -> 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
-- | See Note [Phantom coercions]. Only in Phantom roled coercions
PhantomProv :: KindCoercion -> UnivCoProvenance
-- | From the fact that any two coercions are considered equivalent. See
-- Note [ProofIrrelProv]. Can be used in Nominal or Representational
-- coercions
ProofIrrelProv :: KindCoercion -> UnivCoProvenance
-- | From a plugin, which asserts that this coercion is sound. The string
-- is for the use of the plugin.
PluginProv :: String -> UnivCoProvenance
CorePrepProv :: Bool -> UnivCoProvenance
-- | A coercion to be filled in by the type-checker. See Note [Coercion
-- holes]
data CoercionHole
CoercionHole :: CoVar -> IORef (Maybe Coercion) -> CoercionHole
[ch_co_var] :: CoercionHole -> CoVar
[ch_ref] :: CoercionHole -> IORef (Maybe Coercion)
coHoleCoVar :: CoercionHole -> CoVar
setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole
type CoercionN = Coercion
type CoercionR = Coercion
type CoercionP = Coercion
type KindCoercion = CoercionN
-- | A semantically more meaningful type to represent what may or may not
-- be a useful Coercion.
data MCoercion
MRefl :: MCoercion
MCo :: Coercion -> MCoercion
type MCoercionR = MCoercion
type MCoercionN = MCoercion
-- | mkNakedTyConTy creates a nullary TyConApp. In general
-- you should rather use mkTyConTy, which picks the shared nullary
-- TyConApp from inside the TyCon (via tyConNullaryTy. But we have to
-- build the TyConApp tc [] in that TyCon field; that's what
-- mkNakedTyConTy is for.
mkNakedTyConTy :: TyCon -> Type
mkTyVarTy :: TyVar -> Type
mkTyVarTys :: [TyVar] -> [Type]
mkTyCoVarTy :: TyCoVar -> Type
mkTyCoVarTys :: [TyCoVar] -> [Type]
mkFunTy :: AnonArgFlag -> Mult -> Type -> Type -> Type
infixr 3 `mkFunTy`
mkVisFunTy :: Mult -> Type -> Type -> Type
infixr 3 `mkVisFunTy`
mkInvisFunTy :: Mult -> Type -> Type -> Type
infixr 3 `mkInvisFunTy`
-- | Make nested arrow types
mkVisFunTys :: [Scaled Type] -> Type -> Type
-- | Like mkTyCoForAllTy, but does not check the occurrence of the
-- binder See Note [Unused coercion variable in ForAllTy]
mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
-- | Wraps foralls over the type using the provided TyCoVars from
-- left to right
mkForAllTys :: [TyCoVarBinder] -> Type -> Type
-- | Wraps foralls over the type using the provided InvisTVBinders
-- from left to right
mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type
mkPiTy :: TyCoBinder -> Type -> Type
mkPiTys :: [TyCoBinder] -> Type -> Type
mkFunTyMany :: AnonArgFlag -> Type -> Type -> Type
mkScaledFunTy :: AnonArgFlag -> Scaled Type -> Type -> Type
-- | Special, common, case: Arrow type with mult Many
mkVisFunTyMany :: Type -> Type -> Type
infixr 3 `mkVisFunTyMany`
mkVisFunTysMany :: [Type] -> Type -> Type
mkInvisFunTyMany :: Type -> Type -> Type
infixr 3 `mkInvisFunTyMany`
mkInvisFunTysMany :: [Type] -> Type -> Type
nonDetCmpTyLit :: TyLit -> TyLit -> Ordering
cmpTyLit :: TyLit -> TyLit -> Ordering
-- | A TyCoBinder represents an argument to a function. TyCoBinders
-- can be dependent (Named) or nondependent (Anon). They
-- may also be visible or not. See Note [TyCoBinders]
data TyCoBinder
Named :: TyCoVarBinder -> TyCoBinder
Anon :: AnonArgFlag -> Scaled Type -> TyCoBinder
-- | Variable Binder
--
-- A TyCoVarBinder is the binder of a ForAllTy It's convenient to
-- define this synonym here rather its natural home in
-- GHC.Core.TyCo.Rep, because it's used in
-- GHC.Core.DataCon.hs-boot
--
-- A TyVarBinder is a binder with only TyVar
type TyCoVarBinder = VarBndr TyCoVar ArgFlag
-- | TyBinder is like TyCoBinder, but there can only be
-- TyVarBinder in the Named field.
type TyBinder = TyCoBinder
binderVar :: VarBndr tv argf -> tv
binderVars :: [VarBndr tv argf] -> [tv]
binderType :: VarBndr TyCoVar argf -> Type
binderArgFlag :: VarBndr tv argf -> argf
-- | Remove the binder's variable from the set, if the binder has a
-- variable.
delBinderVar :: VarSet -> TyCoVarBinder -> VarSet
-- | Does this ArgFlag classify an argument that is not written in
-- Haskell?
isInvisibleArgFlag :: ArgFlag -> Bool
-- | Does this ArgFlag classify an argument that is written in
-- Haskell?
isVisibleArgFlag :: ArgFlag -> Bool
-- | Does this binder bind an invisible argument?
isInvisibleBinder :: TyCoBinder -> Bool
-- | Does this binder bind a visible argument?
isVisibleBinder :: TyCoBinder -> Bool
-- | If its a named binder, is the binder a tyvar? Returns True for
-- nondependent binder. This check that we're really returning a
-- *Ty*Binder (as opposed to a coercion binder). That way, if/when we
-- allow coercion quantification in more places, we'll know we missed
-- updating some function.
isTyBinder :: TyCoBinder -> Bool
isNamedBinder :: TyCoBinder -> Bool
pickLR :: LeftOrRight -> (a, a) -> a
data TyCoFolder env a
TyCoFolder :: (Type -> Maybe Type) -> (env -> TyVar -> a) -> (env -> CoVar -> a) -> (env -> CoercionHole -> a) -> (env -> TyCoVar -> ArgFlag -> env) -> TyCoFolder env a
[tcf_view] :: TyCoFolder env a -> Type -> Maybe Type
[tcf_tyvar] :: TyCoFolder env a -> env -> TyVar -> a
[tcf_covar] :: TyCoFolder env a -> env -> CoVar -> a
-- | What to do with coercion holes. See Note [Coercion holes] in
-- GHC.Core.TyCo.Rep.
[tcf_hole] :: TyCoFolder env a -> env -> CoercionHole -> a
-- | The returned env is used in the extended scope
[tcf_tycobinder] :: TyCoFolder env a -> env -> TyCoVar -> ArgFlag -> env
foldTyCo :: Monoid a => TyCoFolder env a -> env -> (Type -> a, [Type] -> a, Coercion -> a, [Coercion] -> a)
-- | A view function that looks through nothing.
noView :: Type -> Maybe Type
typeSize :: Type -> Int
coercionSize :: Coercion -> Int
provSize :: UnivCoProvenance -> Int
-- | A shorthand for data with an attached Mult element (the
-- multiplicity).
data Scaled a
Scaled :: !Mult -> a -> Scaled a
scaledMult :: Scaled a -> Mult
scaledThing :: Scaled a -> a
-- | Apply a function to both the Mult and the Type in a 'Scaled Type'
mapScaledType :: (Type -> Type) -> Scaled Type -> Scaled Type
-- | Mult is a type alias for Type.
--
-- Mult must contain Type because multiplicity variables are mere type
-- variables (of kind Multiplicity) in Haskell. So the simplest
-- implementation is to make Mult be Type.
--
-- Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon)
-- - Many: GHC.Types.Many (= manyDataCon) - Multiplication:
-- GHC.Types.MultMul (= multMulTyCon)
--
-- So that Mult feels a bit more structured, we provide pattern synonyms
-- and smart constructors for these.
type Mult = Type
instance Data.Data.Data GHC.Core.TyCo.Rep.TyLit
instance GHC.Classes.Eq GHC.Core.TyCo.Rep.TyLit
instance Data.Data.Data GHC.Core.TyCo.Rep.MCoercion
instance Data.Data.Data GHC.Core.TyCo.Rep.UnivCoProvenance
instance Data.Data.Data GHC.Core.TyCo.Rep.Coercion
instance Data.Data.Data GHC.Core.TyCo.Rep.Type
instance Data.Data.Data a => Data.Data.Data (GHC.Core.TyCo.Rep.Scaled a)
instance Data.Data.Data GHC.Core.TyCo.Rep.TyCoBinder
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.TyCoBinder
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Core.TyCo.Rep.Scaled a)
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.Type
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.Coercion
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.MCoercion
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.UnivCoProvenance
instance Data.Data.Data GHC.Core.TyCo.Rep.CoercionHole
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.CoercionHole
instance GHC.Types.Unique.Uniquable GHC.Core.TyCo.Rep.CoercionHole
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Rep.TyLit
module GHC.Core.TyCo.FVs
shallowTyCoVarsOfType :: Type -> TyCoVarSet
shallowTyCoVarsOfTypes :: [Type] -> TyCoVarSet
tyCoVarsOfType :: Type -> TyCoVarSet
tyCoVarsOfTypes :: [Type] -> TyCoVarSet
-- | tyCoFVsOfType 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 GHC.Utils.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
tyCoFVsBndr :: TyCoVarBinder -> FV -> FV
tyCoFVsVarBndr :: Var -> FV -> FV
tyCoFVsVarBndrs :: [Var] -> FV -> FV
-- | The worker for tyCoFVsOfType and tyCoFVsOfTypeList.
-- 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 GHC.Utils.FV.
--
-- Eta-expanded because that makes it run faster (apparently) See Note
-- [FV eta expansion] in GHC.Utils.FV for explanation.
tyCoFVsOfType :: Type -> FV
-- | tyCoFVsOfType that returns free variables of a type in
-- deterministic order. For explanation of why using VarSet is not
-- deterministic see Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfTypeList :: Type -> [TyCoVar]
tyCoFVsOfTypes :: [Type] -> FV
-- | 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]
deepTcvFolder :: TyCoFolder TyCoVarSet (Endo TyCoVarSet)
-- | Returns free variables of types, including kind variables as a
-- non-deterministic set. For type synonyms it does not expand the
-- synonym.
shallowTyCoVarsOfTyVarEnv :: TyVarEnv Type -> TyCoVarSet
shallowTyCoVarsOfCoVarEnv :: CoVarEnv Coercion -> TyCoVarSet
shallowTyCoVarsOfCo :: Coercion -> TyCoVarSet
shallowTyCoVarsOfCos :: [Coercion] -> TyCoVarSet
tyCoVarsOfCo :: Coercion -> TyCoVarSet
tyCoVarsOfCos :: [Coercion] -> TyCoVarSet
tyCoVarsOfMCo :: MCoercion -> TyCoVarSet
coVarsOfType :: Type -> CoVarSet
coVarsOfTypes :: [Type] -> CoVarSet
coVarsOfCo :: Coercion -> CoVarSet
coVarsOfCos :: [Coercion] -> CoVarSet
-- | Get a deterministic set of the vars free in a coercion
tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet
tyCoFVsOfCo :: Coercion -> FV
tyCoFVsOfCos :: [Coercion] -> FV
tyCoVarsOfCoList :: Coercion -> [TyCoVar]
-- | Given a covar and a coercion, returns True if covar is almost devoid
-- in the coercion. That is, covar can only appear in Refl and GRefl. See
-- last wrinkle in Note [Unused coercion variable in ForAllCo] in
-- GHC.Core.Coercion
almostDevoidCoVarOfCo :: CoVar -> Coercion -> Bool
-- | Returns the free variables of a Type that are in injective
-- positions. Specifically, it finds the free variables while:
--
--
-- - Expanding type synonyms
-- - Ignoring the coercion in (ty |> co)
-- - Ignoring the non-injective fields of a TyConApp
--
--
-- For example, if F is a non-injective type family, then:
--
--
-- injectiveTyVarsOf( Either c (Maybe (a, F b c)) ) = {a,c}
--
--
-- If injectiveVarsOfType ty = itvs, then knowing
-- ty fixes itvs. More formally, if a is in
-- injectiveVarsOfType ty and S1(ty) ~ S2(ty),
-- then S1(a) ~ S2(a), where S1 and S2 are
-- arbitrary substitutions.
--
-- See Note [When does a tycon application need an explicit kind
-- signature?].
injectiveVarsOfType :: Bool -> Type -> FV
-- | Returns the free variables of a Type that are in injective
-- positions. Specifically, it finds the free variables while:
--
--
-- - Expanding type synonyms
-- - Ignoring the coercion in (ty |> co)
-- - Ignoring the non-injective fields of a TyConApp
--
--
-- See Note [When does a tycon application need an explicit kind
-- signature?].
injectiveVarsOfTypes :: Bool -> [Type] -> FV
-- | Returns the set of variables that are used invisibly anywhere within
-- the given type. A variable will be included even if it is used both
-- visibly and invisibly. An invisible use site includes: * In the kind
-- of a variable * In the kind of a bound variable in a forall * In a
-- coercion * In a Specified or Inferred argument to a function See Note
-- [VarBndrs, TyCoVarBinders, TyConBinders, and visibility] in
-- GHC.Core.TyCo.Rep
invisibleVarsOfType :: Type -> FV
-- | Like invisibleVarsOfType, but for many types.
invisibleVarsOfTypes :: [Type] -> FV
anyFreeVarsOfType :: (TyCoVar -> Bool) -> Type -> Bool
anyFreeVarsOfTypes :: (TyCoVar -> Bool) -> [Type] -> Bool
anyFreeVarsOfCo :: (TyCoVar -> Bool) -> Coercion -> Bool
noFreeVarsOfType :: Type -> Bool
noFreeVarsOfTypes :: [Type] -> Bool
noFreeVarsOfCo :: Coercion -> Bool
-- | 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).
--
-- It is also meant to be stable: that is, variables should not be
-- reordered unnecessarily. This is specified in Note [ScopedSort] See
-- also Note [Ordering of implicit variables] in GHC.Rename.HsType
scopedSort :: [TyCoVar] -> [TyCoVar]
-- | 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]
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a deterministic set.
closeOverKindsDSet :: DTyVarSet -> DTyVarSet
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a deterministically ordered list.
closeOverKindsList :: [TyVar] -> [TyVar]
closeOverKinds :: TyCoVarSet -> TyCoVarSet
-- | The monoid of endomorphisms under composition.
--
--
-- >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
--
-- >>> appEndo computation "Haskell"
-- "Hello, Haskell!"
--
newtype Endo a
Endo :: (a -> a) -> Endo a
[appEndo] :: Endo a -> a -> a
runTyCoVars :: Endo TyCoVarSet -> TyCoVarSet
-- | Tidying types and coercions for printing in error messages.
module GHC.Core.TyCo.Tidy
-- | Tidy a Type
--
-- See Note [Strictness in tidyType and friends]
tidyType :: TidyEnv -> Type -> Type
-- | Tidy a list of Types
--
-- See Note [Strictness in tidyType and friends]
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])
tidyVarBndr :: 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.
tidyVarBndrs :: 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
avoidNameClashes :: [TyCoVar] -> TidyEnv -> 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
-- tidyVarBndr
tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
-- | Calls tidyType on a top-level type (i.e. with an empty tidying
-- environment)
tidyTopType :: Type -> Type
-- | Tidy a Coercion
--
-- See Note [Strictness in tidyType and friends]
tidyCo :: TidyEnv -> Coercion -> Coercion
tidyCos :: TidyEnv -> [Coercion] -> [Coercion]
tidyTyCoVarBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis)
tidyTyCoVarBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis])
-- | Substitution into types and coercions.
module GHC.Core.TyCo.Subst
-- | 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
-- | A substitution of Coercions for CoVars
type CvSubstEnv = CoVarEnv Coercion
emptyTvSubstEnv :: TvSubstEnv
emptyCvSubstEnv :: CvSubstEnv
-- | (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
emptyTCvSubst :: TCvSubst
mkEmptyTCvSubst :: InScopeSet -> TCvSubst
isEmptyTCvSubst :: TCvSubst -> Bool
mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst
-- | Make a TCvSubst with specified tyvar subst and empty covar subst
mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst
-- | Make a TCvSubst with specified covar subst and empty tyvar subst
mkCvSubst :: InScopeSet -> CvSubstEnv -> TCvSubst
getTvSubstEnv :: TCvSubst -> TvSubstEnv
getCvSubstEnv :: TCvSubst -> CvSubstEnv
getTCvInScope :: TCvSubst -> InScopeSet
-- | Returns the free variables of the types in the range of a substitution
-- as a non-deterministic set.
getTCvSubstRangeFVs :: TCvSubst -> VarSet
isInScope :: Var -> TCvSubst -> Bool
elemTCvSubst :: Var -> TCvSubst -> Bool
notElemTCvSubst :: Var -> TCvSubst -> Bool
setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst
setCvSubstEnv :: TCvSubst -> CvSubstEnv -> TCvSubst
zapTCvSubst :: TCvSubst -> TCvSubst
extendTCvInScope :: TCvSubst -> Var -> TCvSubst
extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst
extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst
extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> TCvSubst
extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
extendCvSubstWithClone :: TCvSubst -> CoVar -> CoVar -> TCvSubst
extendTvSubst :: TCvSubst -> TyVar -> Type -> TCvSubst
extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst
extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst
extendTvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv
zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No TyVars, please!
zipCvSubst :: HasDebugCallStack => [CoVar] -> [Coercion] -> TCvSubst
zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst
-- | Type substitution, see zipTvSubst
substTyWith :: HasDebugCallStack => [TyVar] -> [Type] -> Type -> Type
-- | Substitute covars within a type
substTyWithCoVars :: [CoVar] -> [Coercion] -> Type -> Type
-- | Type substitution, see zipTvSubst
substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type]
-- | Type substitution, see zipTvSubst
substTysWithCoVars :: [CoVar] -> [Coercion] -> [Type] -> [Type]
-- | Coercion substitution, see zipTvSubst
substCoWith :: HasDebugCallStack => [TyVar] -> [Type] -> Coercion -> Coercion
-- | Substitute within a Type The substitution has to satisfy the
-- invariants described in Note [The substitution invariant].
substTy :: HasDebugCallStack => TCvSubst -> 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
substScaledTy :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled 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]
substScaledTysUnchecked :: TCvSubst -> [Scaled Type] -> [Scaled 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
substScaledTyUnchecked :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled 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
-- | Substitute within several Types The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTys :: HasDebugCallStack => TCvSubst -> [Type] -> [Type]
substScaledTys :: HasDebugCallStack => TCvSubst -> [Scaled Type] -> [Scaled Type]
-- | Substitute within a ThetaType The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTheta :: HasDebugCallStack => TCvSubst -> ThetaType -> ThetaType
lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
-- | Substitute within a Coercion The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substCo :: HasDebugCallStack => TCvSubst -> Coercion -> Coercion
-- | Substitute within several Coercions The substitution has to
-- satisfy the invariants described in Note [The substitution invariant].
substCos :: HasDebugCallStack => TCvSubst -> [Coercion] -> [Coercion]
substCoVar :: TCvSubst -> CoVar -> Coercion
substCoVars :: TCvSubst -> [CoVar] -> [Coercion]
lookupCoVar :: TCvSubst -> Var -> Maybe Coercion
cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar)
cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar])
substVarBndr :: HasDebugCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)
substVarBndrs :: HasDebugCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar])
substTyVarBndr :: HasDebugCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)
substTyVarBndrs :: HasDebugCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar])
substCoVarBndr :: HasDebugCallStack => TCvSubst -> CoVar -> (TCvSubst, CoVar)
substTyVar :: TCvSubst -> TyVar -> Type
substTyVars :: TCvSubst -> [TyVar] -> [Type]
substTyCoVars :: TCvSubst -> [TyCoVar] -> [Type]
substTyCoBndr :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder)
substForAllCoBndr :: TCvSubst -> TyCoVar -> KindCoercion -> (TCvSubst, TyCoVar, Coercion)
substVarBndrUsing :: (TCvSubst -> Type -> Type) -> TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)
substForAllCoBndrUsing :: Bool -> (Coercion -> Coercion) -> TCvSubst -> TyCoVar -> KindCoercion -> (TCvSubst, TyCoVar, KindCoercion)
-- | This checks if the substitution satisfies the invariant from Note [The
-- substitution invariant].
checkValidSubst :: HasDebugCallStack => TCvSubst -> [Type] -> [Coercion] -> a -> a
-- | When calling substTy it should be the case that the in-scope
-- set in the substitution is a superset of the free vars of the range of
-- the substitution. See also Note [The substitution invariant].
isValidTCvSubst :: TCvSubst -> Bool
instance GHC.Utils.Outputable.Outputable GHC.Core.TyCo.Subst.TCvSubst
-- | This module defines TyCons that can't be expressed in Haskell. They
-- are all, therefore, wired-in TyCons. C.f module
-- GHC.Builtin.Types
module GHC.Builtin.Types.Prim
mkPrimTyConName :: FastString -> Unique -> TyCon -> Name
mkTemplateKindVar :: Kind -> TyVar
mkTemplateKindVars :: [Kind] -> [TyVar]
mkTemplateTyVars :: [Kind] -> [TyVar]
mkTemplateTyVarsFrom :: Int -> [Kind] -> [TyVar]
mkTemplateKiTyVars :: [Kind] -> ([Kind] -> [Kind]) -> [TyVar]
mkTemplateKiTyVar :: 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
alphaTyVarSpec :: TyVarBinder
betaTyVarSpec :: TyVarBinder
gammaTyVarSpec :: TyVarBinder
deltaTyVarSpec :: TyVarBinder
alphaTys :: [Type]
alphaTy :: Type
betaTy :: Type
gammaTy :: Type
deltaTy :: Type
alphaTyVarsUnliftedRep :: [TyVar]
alphaTyVarUnliftedRep :: TyVar
alphaTysUnliftedRep :: [Type]
alphaTyUnliftedRep :: Type
runtimeRep1TyVar :: TyVar
runtimeRep2TyVar :: TyVar
runtimeRep3TyVar :: TyVar
runtimeRep1TyVarInf :: TyVarBinder
runtimeRep2TyVarInf :: TyVarBinder
runtimeRep1Ty :: Type
runtimeRep2Ty :: Type
runtimeRep3Ty :: Type
levity1TyVar :: TyVar
levity2TyVar :: TyVar
levity1TyVarInf :: TyVarBinder
levity2TyVarInf :: TyVarBinder
levity1Ty :: Type
levity2Ty :: Type
openAlphaTyVar :: TyVar
openBetaTyVar :: TyVar
openGammaTyVar :: TyVar
openAlphaTyVarSpec :: TyVarBinder
openBetaTyVarSpec :: TyVarBinder
openGammaTyVarSpec :: TyVarBinder
openAlphaTy :: Type
openBetaTy :: Type
openGammaTy :: Type
levPolyAlphaTyVar :: TyVar
levPolyBetaTyVar :: TyVar
levPolyAlphaTyVarSpec :: TyVarBinder
levPolyBetaTyVarSpec :: TyVarBinder
levPolyAlphaTy :: Type
levPolyBetaTy :: Type
multiplicityTyVar1 :: TyVar
multiplicityTyVar2 :: TyVar
tYPETyCon :: TyCon
tYPETyConName :: Name
mkTYPEapp :: Type -> Type
functionWithMultiplicity :: Type -> Type
-- | The FUN type constructor.
--
--
-- FUN :: forall (m :: Multiplicity) ->
-- forall {rep1 :: RuntimeRep} {rep2 :: RuntimeRep}.
-- TYPE rep1 -> TYPE rep2 -> *
--
--
-- The runtime representations quantification is left inferred. This
-- means they cannot be specified with -XTypeApplications.
--
-- This is a deliberate choice to allow future extensions to the function
-- arrow. To allow visible application a type synonym can be defined:
--
--
-- type Arr :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
-- TYPE rep1 -> TYPE rep2 -> Type
-- type Arr = FUN 'Many
--
funTyCon :: TyCon
funTyConName :: Name
-- | Primitive TyCons that are defined in GHC.Prim but not exposed.
-- It's important to keep these separate as we don't want users to be
-- able to write them (see #15209) or see them in GHCi's :browse
-- output (see #12023).
unexposedPrimTyCons :: [TyCon]
-- | Primitive TyCons that are defined in, and exported from,
-- GHC.Prim.
exposedPrimTyCons :: [TyCon]
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
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
smallArrayPrimTyCon :: TyCon
mkSmallArrayPrimTy :: Type -> Type
mutableArrayPrimTyCon :: TyCon
mkMutableArrayPrimTy :: Type -> Type -> Type
mutableByteArrayPrimTyCon :: TyCon
mkMutableByteArrayPrimTy :: Type -> Type
smallMutableArrayPrimTyCon :: TyCon
mkSmallMutableArrayPrimTy :: Type -> Type -> Type
mutVarPrimTyCon :: TyCon
mkMutVarPrimTy :: Type -> Type -> Type
mVarPrimTyCon :: TyCon
mkMVarPrimTy :: Type -> Type -> Type
ioPortPrimTyCon :: TyCon
mkIOPortPrimTy :: 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
stackSnapshotPrimTyCon :: TyCon
stackSnapshotPrimTy :: Type
int8PrimTyCon :: TyCon
int8PrimTy :: Type
int8PrimTyConName :: Name
word8PrimTyCon :: TyCon
word8PrimTy :: Type
word8PrimTyConName :: Name
int16PrimTyCon :: TyCon
int16PrimTy :: Type
int16PrimTyConName :: Name
word16PrimTyCon :: TyCon
word16PrimTy :: Type
word16PrimTyConName :: Name
int32PrimTyCon :: TyCon
int32PrimTy :: Type
int32PrimTyConName :: Name
word32PrimTyCon :: TyCon
word32PrimTy :: Type
word32PrimTyConName :: Name
int64PrimTyCon :: TyCon
int64PrimTy :: Type
int64PrimTyConName :: Name
word64PrimTyCon :: TyCon
word64PrimTy :: Type
word64PrimTyConName :: Name
eqPrimTyCon :: TyCon
eqReprPrimTyCon :: TyCon
eqPhantPrimTyCon :: TyCon
-- | Given a Role, what TyCon is the type of equality predicates at that
-- role?
equalityTyCon :: Role -> TyCon
-- | The TyCon for the 'IsRefl#' constraint.
--
--
-- type IsRefl# :: forall k. k -> k -> TYPE (TupleRep '[])
--
--
-- See Note [IsRefl#] in GHC.Tc.Utils.Concrete.
isReflPrimTyCon :: 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
-- | Main functions for manipulating types and type-related things
module GHC.Core.Type
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 [VarBndrs, TyCoVarBinders, TyConBinders,
-- and visibility] in GHC.Core.TyCo.Rep
data ArgFlag
Invisible :: Specificity -> ArgFlag
Required :: ArgFlag
pattern Specified :: ArgFlag
pattern Inferred :: ArgFlag
-- | The non-dependent version of ArgFlag. See Note [AnonArgFlag]
-- Appears here partly so that it's together with its friends ArgFlag and
-- ForallVisFlag, but also because it is used in IfaceType, rather early
-- in the compilation chain
data AnonArgFlag
-- | Used for (->): an ordinary non-dependent arrow. The
-- argument is visible in source code.
VisArg :: AnonArgFlag
-- | Used for (=>): a non-dependent predicate arrow. The
-- argument is invisible in source code.
InvisArg :: AnonArgFlag
-- | Whether an Invisible argument may appear in source Haskell.
data Specificity
-- | the argument may not appear in source Haskell, it is only inferred.
InferredSpec :: Specificity
-- | the argument may appear in source Haskell, but isn't required.
SpecifiedSpec :: Specificity
-- | The key representation of types within the compiler
type KindOrType = Type
-- | A type of the form p of constraint kind 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 its use sites.
data Var
-- | Type or kind Variable
type TyVar = Var
-- | Is this a type-level (i.e., computationally irrelevant, thus erasable)
-- variable? Satisfies isTyVar = not . isId.
isTyVar :: Var -> Bool
-- | Type or Coercion Variable
type TyCoVar = Id
-- | A TyCoBinder represents an argument to a function. TyCoBinders
-- can be dependent (Named) or nondependent (Anon). They
-- may also be visible or not. See Note [TyCoBinders]
data TyCoBinder
-- | Variable Binder
--
-- A TyCoVarBinder is the binder of a ForAllTy It's convenient to
-- define this synonym here rather its natural home in
-- GHC.Core.TyCo.Rep, because it's used in
-- GHC.Core.DataCon.hs-boot
--
-- A TyVarBinder is a binder with only TyVar
type TyCoVarBinder = VarBndr TyCoVar ArgFlag
type TyVarBinder = VarBndr TyVar ArgFlag
-- | Mult is a type alias for Type.
--
-- Mult must contain Type because multiplicity variables are mere type
-- variables (of kind Multiplicity) in Haskell. So the simplest
-- implementation is to make Mult be Type.
--
-- Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon)
-- - Many: GHC.Types.Many (= manyDataCon) - Multiplication:
-- GHC.Types.MultMul (= multMulTyCon)
--
-- So that Mult feels a bit more structured, we provide pattern synonyms
-- and smart constructors for these.
type Mult = Type
-- | A shorthand for data with an attached Mult element (the
-- multiplicity).
data Scaled a
-- | A type labeled KnotTied might have knot-tied tycons in it. See
-- Note [Type checking recursive type and class declarations] in
-- GHC.Tc.TyCl
type KnotTied ty = ty
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 ~N kind ty
getCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN)
tyVarKind :: TyVar -> Kind
-- | The type or kind of the Var in question
varType :: Var -> 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 :: HasDebugCallStack => 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 :: HasDebugCallStack => 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)
mkFunTy :: AnonArgFlag -> Mult -> Type -> Type -> Type
infixr 3 `mkFunTy`
mkVisFunTy :: Mult -> Type -> Type -> Type
infixr 3 `mkVisFunTy`
mkInvisFunTy :: Mult -> Type -> Type -> Type
infixr 3 `mkInvisFunTy`
-- | Make nested arrow types
mkVisFunTys :: [Scaled Type] -> Type -> Type
-- | Special, common, case: Arrow type with mult Many
mkVisFunTyMany :: Type -> Type -> Type
infixr 3 `mkVisFunTyMany`
mkInvisFunTyMany :: Type -> Type -> Type
infixr 3 `mkInvisFunTyMany`
mkVisFunTysMany :: [Type] -> Type -> Type
mkInvisFunTysMany :: [Type] -> Type -> Type
-- | Attempts to extract the multiplicity, argument and result types from a
-- type, and panics if that is not possible. See also
-- splitFunTy_maybe
splitFunTy :: Type -> (Mult, Type, Type)
-- | Attempts to extract the multiplicity, argument and result types from a
-- type
splitFunTy_maybe :: Type -> Maybe (Mult, Type, Type)
splitFunTys :: Type -> ([Scaled Type], Type)
-- | Extract the function result type and panic if that is not possible
funResultTy :: Type -> Type
-- | Just like piResultTys but for a single argument Try not to
-- iterate piResultTy, because it's inefficient to substitute one
-- variable at a time; instead use 'piResultTys"
--
-- 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
-- | (mkTyConTy tc) returns (TyConApp tc []) but arranges to share that
-- TyConApp among all calls See Note [Sharing nullary TyConApps] in
-- GHC.Core.TyCon
mkTyConTy :: TyCon -> Type
mkTYPEapp :: Type -> 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 :: HasDebugCallStack => 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
-- | 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.
--
-- This does *not* split types headed with (=>), as that's not a TyCon
-- in the type-checker.
--
-- 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])
-- | Like tcSplitTyConApp_maybe, but doesn't look through synonyms.
-- This assumes the synonyms have already been dealt with.
--
-- Moreover, for a FunTy, it only succeeds if the argument types have
-- enough info to extract the runtime-rep arguments that the funTyCon
-- requires. This will usually be true; but may be temporarily false
-- during canonicalization: see Note [Decomposing FunTy] in
-- GHC.Tc.Solver.Canonical and Note [The Purely Kinded Type Invariant
-- (PKTI)] in GHC.Tc.Gen.HsType, Wrinkle around FunTy
tcRepSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
-- | Like mkTyCoForAllTy, but does not check the occurrence of the
-- binder See Note [Unused coercion variable in ForAllTy]
mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
-- | Wraps foralls over the type using the provided TyCoVars from
-- left to right
mkForAllTys :: [TyCoVarBinder] -> Type -> Type
-- | Wraps foralls over the type using the provided InvisTVBinders
-- from left to right
mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and
-- Inferred, a common case
mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type
-- | Like mkForAllTy, but assumes the variable is dependent and
-- Specified, a common case
mkSpecForAllTy :: 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 variable
mkTyCoInvForAllTy :: TyCoVar -> Type -> Type
-- | Like mkTyCoInvForAllTy, but tv should be a tyvar
mkInfForAllTy :: TyVar -> Type -> Type
-- | Like mkTyCoInvForAllTys, but tvs should be a list of tyvar
mkInfForAllTys :: [TyVar] -> Type -> Type
-- | Take a ForAllTy apart, returning the list of tycovars 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.
splitForAllTyCoVars :: Type -> ([TyCoVar], Type)
-- | Like splitForAllTyCoVars, but only splits ForAllTys with
-- Required type variable binders. Furthermore, each returned
-- tyvar is annotated with ().
splitForAllReqTVBinders :: Type -> ([ReqTVBinder], Type)
-- | Like splitForAllTyCoVars, but only splits ForAllTys with
-- Invisible type variable binders. Furthermore, each returned
-- tyvar is annotated with its Specificity.
splitForAllInvisTVBinders :: Type -> ([InvisTVBinder], Type)
-- | Like splitPiTys but split off only named binders and
-- returns TyCoVarBinders rather than TyCoBinders
splitForAllTyCoVarBinders :: Type -> ([TyCoVarBinder], Type)
-- | Attempts to take a forall type apart, but only if it's a proper
-- forall, with a named binder
splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
-- | Take a forall type apart, or panics if that is not possible.
splitForAllTyCoVar :: Type -> (TyCoVar, Type)
-- | Like splitForAllTyCoVar_maybe, but only returns Just if it is a
-- tyvar binder.
splitForAllTyVar_maybe :: Type -> Maybe (TyCoVar, Type)
-- | Like splitForAllTyCoVar_maybe, but only returns Just if it is a
-- covar binder.
splitForAllCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
-- | Attempts to take a forall type apart; works with proper foralls and
-- functions
splitPiTy_maybe :: Type -> Maybe (TyCoBinder, Type)
-- | Takes a forall type apart, or panics
splitPiTy :: Type -> (TyCoBinder, Type)
-- | Split off all TyCoBinders to a type, splitting both proper foralls and
-- functions
splitPiTys :: Type -> ([TyCoBinder], Type)
-- | Extracts a list of run-time arguments from a function type, looking
-- through newtypes to the right of arrows.
--
-- Examples:
--
--
-- newtype Identity a = I a
--
-- getRuntimeArgTys (Int -> Bool -> Double) == [(Int, VisArg), (Bool, VisArg)]
-- getRuntimeArgTys (Identity Int -> Bool -> Double) == [(Identity Int, VisArg), (Bool, VisArg)]
-- getRuntimeArgTys (Int -> Identity (Bool -> Identity Double)) == [(Int, VisArg), (Bool, VisArg)]
-- getRuntimeArgTys (forall a. Show a => Identity a -> a -> Int -> Bool) == [(Show a, InvisArg), (Identity a, VisArg),(a, VisArg),(Int, VisArg)]
--
--
-- Note that, in the last case, the returned types might mention an
-- out-of-scope type variable. This function is used only when we really
-- care about the kinds of the returned types, so this is OK.
--
--
-- - *Warning**: this function can return an infinite list. For
-- example:
--
--
--
-- newtype N a = MkN (a -> N a)
-- getRuntimeArgTys (N a) == repeat (a, VisArg)
--
getRuntimeArgTys :: Type -> [(Type, AnonArgFlag)]
-- | Given a list of type-level vars and the free vars of a result kind,
-- makes TyCoBinders, preferring anonymous binders if the variable is, in
-- fact, not dependent. e.g. mkTyConBindersPreferAnon
-- (k:*),(b:k),(c:k) We want (k:*) Named, (b:k) Anon, (c:k) Anon
--
-- All non-coercion binders are visible.
mkTyConBindersPreferAnon :: [TyVar] -> TyCoVarSet -> [TyConBinder]
mkPiTy :: TyCoBinder -> Type -> Type
mkPiTys :: [TyCoBinder] -> Type -> Type
piResultTy :: HasDebugCallStack => 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 :: HasDebugCallStack => Type -> [Type] -> Type
applyTysX :: [TyVar] -> Type -> [Type] -> Type
-- | Drops all ForAllTys
dropForAlls :: 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
buildSynTyCon :: Name -> [KnotTied TyConBinder] -> Kind -> [Role] -> KnotTied Type -> TyCon
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
mkCharLitTy :: Char -> Type
-- | Is this a char literal? We also look through type synonyms.
isCharLitTy :: Type -> Maybe Char
-- | Is this a type literal (symbol, numeric, or char)?
isLitTy :: Type -> Maybe TyLit
isPredTy :: HasDebugCallStack => Type -> Bool
-- | Extract the RuntimeRep classifier of a type. For instance,
-- getRuntimeRep_maybe Int = Just LiftedRep. Returns
-- Nothing if this is not possible.
getRuntimeRep_maybe :: HasDebugCallStack => Type -> Maybe Type
-- | Given a kind (TYPE rr), extract its RuntimeRep classifier rr. For
-- example, kindRep_maybe * = Just LiftedRep Returns
-- Nothing if the kind is not of form (TYPE rr) Treats * and
-- Constraint as the same
kindRep_maybe :: HasDebugCallStack => Kind -> Maybe Type
-- | Extract the RuntimeRep classifier of a type from its kind. For
-- example, kindRep * = LiftedRep; Panics if this is not
-- possible. Treats * and Constraint as the same
kindRep :: HasDebugCallStack => Kind -> Type
-- | Make a CastTy. The Coercion must be nominal. Checks the
-- Coercion for reflexivity, dropping it if it's reflexive. See Note
-- [Respecting definitional equality] in GHC.Core.TyCo.Rep
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
-- | Like splitPiTys, but returns only *invisible* binders,
-- including constraints. Stops at the first visible binder.
splitInvisPiTys :: Type -> ([TyCoBinder], Type)
-- | Same as splitInvisPiTys, but stop when - you have found
-- n TyCoBinders, - or you run out of invisible binders
splitInvisPiTysN :: Int -> Type -> ([TyCoBinder], Type)
invisibleTyBndrCount :: Type -> Int
-- | Given a TyCon and a list of argument types, filter out any
-- invisible (i.e., Inferred or Specified) arguments.
filterOutInvisibleTypes :: TyCon -> [Type] -> [Type]
-- | Given a TyCon and a list of argument types, filter out any
-- Inferred arguments.
filterOutInferredTypes :: TyCon -> [Type] -> [Type]
-- | Given a TyCon and a list of argument types, partition the
-- arguments into:
--
--
-- - Inferred or Specified (i.e., invisible) arguments
-- and
-- - Required (i.e., visible) arguments
--
partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type])
-- | Given a list of things paired with their visibilities, partition the
-- things into (invisible things, visible things).
partitionInvisibles :: [(a, ArgFlag)] -> ([a], [a])
-- | Given a TyCon and a list of argument types to which the
-- TyCon is applied, determine each argument's visibility
-- (Inferred, Specified, or Required).
--
-- Wrinkle: consider the following scenario:
--
--
-- T :: forall k. k -> k
-- tyConArgFlags 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.
tyConArgFlags :: TyCon -> [Type] -> [ArgFlag]
-- | Given a Type and a list of argument types to which the
-- Type is applied, determine each argument's visibility
-- (Inferred, Specified, or Required).
--
-- Most of the time, the arguments will be Required, but not
-- always. Consider f :: forall a. a -> Type. In f Type
-- Bool, the first argument (Type) is Specified and
-- the second argument (Bool) is Required. It is
-- precisely this sort of higher-rank situation in which
-- appTyArgFlags comes in handy, since f Type Bool would
-- be represented in Core using AppTys. (See also #15792).
appTyArgFlags :: Type -> [Type] -> [ArgFlag]
-- | This describes how a "map" operation over a type/coercion should
-- behave
data TyCoMapper env m
TyCoMapper :: (env -> TyVar -> m Type) -> (env -> CoVar -> m Coercion) -> (env -> CoercionHole -> m Coercion) -> (env -> TyCoVar -> ArgFlag -> m (env, TyCoVar)) -> (TyCon -> m TyCon) -> TyCoMapper env m
[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
-- GHC.Core.TyCo.Rep.
[tcm_hole] :: TyCoMapper env m -> env -> CoercionHole -> m Coercion
-- | The returned env is used in the extended scope
[tcm_tycobinder] :: TyCoMapper env m -> env -> TyCoVar -> ArgFlag -> m (env, TyCoVar)
-- | This is used only for TcTyCons a) To zonk TcTyCons b) To turn TcTyCons
-- into TyCons. See Note [Type checking recursive type and class
-- declarations] in GHC.Tc.TyCl
[tcm_tycon] :: TyCoMapper env m -> TyCon -> m TyCon
mapTyCo :: Monad m => TyCoMapper () m -> (Type -> m Type, [Type] -> m [Type], Coercion -> m Coercion, [Coercion] -> m [Coercion])
mapTyCoX :: Monad m => TyCoMapper env m -> (env -> Type -> m Type, env -> [Type] -> m [Type], env -> Coercion -> m Coercion, env -> [Coercion] -> m [Coercion])
data TyCoFolder env a
TyCoFolder :: (Type -> Maybe Type) -> (env -> TyVar -> a) -> (env -> CoVar -> a) -> (env -> CoercionHole -> a) -> (env -> TyCoVar -> ArgFlag -> env) -> TyCoFolder env a
[tcf_view] :: TyCoFolder env a -> Type -> Maybe Type
[tcf_tyvar] :: TyCoFolder env a -> env -> TyVar -> a
[tcf_covar] :: TyCoFolder env a -> env -> CoVar -> a
-- | What to do with coercion holes. See Note [Coercion holes] in
-- GHC.Core.TyCo.Rep.
[tcf_hole] :: TyCoFolder env a -> env -> CoercionHole -> a
-- | The returned env is used in the extended scope
[tcf_tycobinder] :: TyCoFolder env a -> env -> TyCoVar -> ArgFlag -> env
foldTyCo :: Monoid a => TyCoFolder env a -> env -> (Type -> a, [Type] -> a, Coercion -> a, [Coercion] -> a)
-- | A view function that looks through nothing.
noView :: Type -> Maybe Type
-- | 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
-- | 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
mkTyCoVarBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis
-- | Make many named binders
mkTyCoVarBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis]
-- | Make a named binder var should be a type variable
mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis
-- | Make many named binders Input vars should be type variables
mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis]
tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ArgFlag]
-- | Make an anonymous binder
mkAnonBinder :: AnonArgFlag -> Scaled Type -> TyCoBinder
-- | Does this binder bind a variable that is not erased? Returns
-- True for anonymous binders.
isAnonTyCoBinder :: TyCoBinder -> Bool
binderVar :: VarBndr tv argf -> tv
binderVars :: [VarBndr tv argf] -> [tv]
binderType :: VarBndr TyCoVar argf -> Type
binderArgFlag :: VarBndr tv argf -> argf
tyCoBinderType :: TyCoBinder -> Type
tyCoBinderVar_maybe :: TyCoBinder -> Maybe TyCoVar
tyBinderType :: TyBinder -> Type
-- | Extract a relevant type, if there is one.
binderRelevantType_maybe :: TyCoBinder -> Maybe Type
-- | 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 :: TyCoBinder -> Bool
-- | Does this binder bind an invisible argument?
isInvisibleBinder :: TyCoBinder -> Bool
isNamedBinder :: TyCoBinder -> Bool
tyConBindersTyCoBinders :: [TyConBinder] -> [TyCoBinder]
-- | The FUN type constructor.
--
--
-- FUN :: forall (m :: Multiplicity) ->
-- forall {rep1 :: RuntimeRep} {rep2 :: RuntimeRep}.
-- TYPE rep1 -> TYPE rep2 -> *
--
--
-- The runtime representations quantification is left inferred. This
-- means they cannot be specified with -XTypeApplications.
--
-- This is a deliberate choice to allow future extensions to the function
-- arrow. To allow visible application a type synonym can be defined:
--
--
-- type Arr :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
-- TYPE rep1 -> TYPE rep2 -> Type
-- type Arr = FUN 'Many
--
funTyCon :: TyCon
unrestrictedFunTyCon :: TyCon
isTyVarTy :: Type -> Bool
-- | Is this a function?
isFunTy :: Type -> Bool
isCoercionTy :: Type -> Bool
isCoercionTy_maybe :: Type -> Maybe Coercion
-- | Checks whether this is a proper forall (with a named binder)
isForAllTy :: Type -> Bool
-- | Like isForAllTy, but returns True only if it is a tyvar binder
isForAllTy_ty :: Type -> Bool
-- | Like isForAllTy, but returns True only if it is a covar binder
isForAllTy_co :: Type -> Bool
-- | Is this a function or forall?
isPiTy :: Type -> Bool
isTauTy :: Type -> Bool
isFamFreeTy :: Type -> Bool
-- | Does this type classify a core (unlifted) Coercion? At either role
-- nominal or representational (t1 ~ t2) See Note [Types for coercions,
-- predicates, and evidence] in GHC.Core.TyCo.Rep
isCoVarType :: Type -> Bool
isAtomicTy :: 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 GHC.Core.) 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
-- | Does a TyCon (that is applied to some number of arguments) need
-- to be ascribed with an explicit kind signature to resolve ambiguity if
-- rendered as a source-syntax type? (See Note [When does a tycon
-- application need an explicit kind signature?] for a full
-- explanation of what this function checks for.)
tyConAppNeedsKindSig :: Bool -> TyCon -> Int -> Bool
-- | Tries to compute the Levity of the given type. Returns either a
-- definite Levity, or Nothing if we aren't sure (e.g. the
-- type is representation-polymorphic).
--
-- Panics if the kind does not have the shape TYPE r.
typeLevity_maybe :: HasDebugCallStack => Type -> Maybe Levity
-- | This version considers Constraint to be the same as *. Returns True if
-- the argument is equivalent to Type/Constraint and False otherwise. See
-- Note [Kind Constraint and kind Type]
isLiftedTypeKind :: Kind -> Bool
-- | Returns True if the kind classifies unlifted types (like 'Int#') and
-- False otherwise. Note that this returns False for
-- representation-polymorphic kinds, which may be specialized to a kind
-- that classifies unlifted types.
isUnliftedTypeKind :: Kind -> Bool
-- | Returns True if the kind classifies types which are allocated on the
-- GC'd heap and False otherwise. Note that this returns False for
-- representation-polymorphic kinds, which may be specialized to a kind
-- that classifies AddrRep or even unboxed kinds.
isBoxedTypeKind :: Kind -> Bool
pickyIsLiftedTypeKind :: Kind -> Bool
-- | Check whether a type of kind RuntimeRep is lifted.
--
-- isLiftedRuntimeRep is:
--
--
-- - True of LiftedRep :: RuntimeRep
-- - False of type variables, type family applications, and of other
-- reps such as IntRep :: RuntimeRep.
--
isLiftedRuntimeRep :: Type -> Bool
-- | Check whether a type of kind RuntimeRep is unlifted.
--
--
isUnliftedRuntimeRep :: Type -> Bool
-- | Check whether a type of kind RuntimeRep is lifted, unlifted, or
-- unknown.
--
-- isLiftedRuntimeRep rr returns:
--
--
-- - Just Lifted if rr is LiftedRep ::
-- RuntimeRep
-- - Just Unlifted if rr is definitely unlifted, e.g.
-- IntRep
-- - Nothing if not known (e.g. it's a type variable or a type
-- family application).
--
runtimeRepLevity_maybe :: Type -> Maybe Levity
-- | See isBoxedRuntimeRep_maybe.
isBoxedRuntimeRep :: Type -> Bool
isLiftedLevity :: Type -> Bool
isUnliftedLevity :: Type -> Bool
-- | Is the given type definitely unlifted? See
-- Type#type_classification for what an unlifted type is.
--
-- Panics on representation-polymorphic types; See
-- mightBeUnliftedType for a more approximate predicate that
-- behaves better in the presence of representation polymorphism.
isUnliftedType :: HasDebugCallStack => Type -> Bool
-- | See Type#type_classification for what a boxed type is. Panics
-- on representation-polymorphic types; See mightBeUnliftedType
-- for a more approximate predicate that behaves better in the presence
-- of representation polymorphism.
isBoxedType :: Type -> Bool
isUnboxedTupleType :: Type -> Bool
isUnboxedSumType :: Type -> Bool
-- | Returns:
--
--
-- - False if the type is guaranteed unlifted or
-- - True if it lifted, OR we aren't sure (e.g. in a
-- representation-polymorphic case)
--
mightBeLiftedType :: Type -> Bool
-- | Returns:
--
--
-- - False if the type is guaranteed lifted or
-- - True if it is unlifted, OR we aren't sure (e.g. in a
-- representation-polymorphic case)
--
mightBeUnliftedType :: Type -> Bool
-- | State token type.
isStateType :: 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
-- | 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 representation-polymorphic
-- types.
isStrictType :: HasDebugCallStack => Type -> Bool
-- | Is this the type Levity?
isLevityTy :: Type -> Bool
-- | Is a tyvar of type Levity?
isLevityVar :: TyVar -> 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 Levity of a type. For example, getLevity Int =
-- Lifted, or getLevity (Array# Int) = Unlifted.
--
-- Panics if this is not possible. Does not look through type family
-- applications.
getLevity :: HasDebugCallStack => Type -> Type
-- | Extract the Levity of a type. For example, getLevity_maybe
-- Int = Just Lifted, getLevity (Array# Int) = Just
-- Unlifted, getLevity Float# = Nothing.
--
-- Returns Nothing if this is not possible. Does not look through
-- type family applications.
getLevity_maybe :: HasDebugCallStack => Type -> Maybe Type
-- | Is this the type Multiplicity?
isMultiplicityTy :: Type -> Bool
-- | Is a tyvar of type Multiplicity?
isMultiplicityVar :: TyVar -> Bool
-- | Scale a payload by Many
unrestricted :: a -> Scaled a
-- | Scale a payload by One
linear :: a -> Scaled a
-- | Scale a payload by Many; used for type arguments in core
tymult :: a -> Scaled a
mkScaled :: Mult -> a -> Scaled a
irrelevantMult :: Scaled a -> a
scaledSet :: Scaled a -> b -> Scaled b
pattern One :: Mult
pattern Many :: Mult
isOneDataConTy :: Mult -> Bool
isManyDataConTy :: Mult -> Bool
-- | isLinear t returns True of a if t is a type
-- of (curried) function where at least one argument is linear (or
-- otherwise non-unrestricted). We use this function to check whether it
-- is safe to eta reduce an Id in CorePrep. It is always safe to return
-- True, because True deactivates the optimisation.
isLinearType :: Type -> Bool
-- | The key type representing kinds in the compiler.
type Kind = Type
typeKind :: HasDebugCallStack => Type -> Kind
tcTypeKind :: HasDebugCallStack => Type -> Kind
-- | Returns True if a type has a fixed runtime rep, as per Note [Fixed
-- RuntimeRep] in GHC.Tc.Utils.Concrete.
--
-- This function is equivalent to (isFixedRuntimeRepKind .
-- typeKind), but much faster.
--
-- Precondition: The type has kind (TYPE blah)
typeHasFixedRuntimeRep :: Type -> Bool
-- | Looking past all pi-types, does the end result have a fixed runtime
-- rep, as per Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete?
--
-- Examples:
--
--
-- - False for (forall r (a :: TYPE r). String -> a)
-- - True for (forall r1 r2 (a :: TYPE r1) (b :: TYPE r2). a ->
-- b -> Type)
--
resultHasFixedRuntimeRep :: Type -> Bool
-- | Is this kind equivalent to Type?
--
-- This considers Constraint to be distinct from Type.
-- For a version that treats them as the same type, see
-- isLiftedTypeKind.
tcIsLiftedTypeKind :: Kind -> Bool
tcIsConstraintKind :: Kind -> Bool
tcReturnsConstraintKind :: Kind -> Bool
-- | Is this kind equivalent to TYPE (BoxedRep l) for some l
-- :: Levity?
--
-- This considers Constraint to be distinct from Type.
-- For a version that treats them as the same type, see
-- isLiftedTypeKind.
tcIsBoxedTypeKind :: Kind -> Bool
-- | Is this kind equivalent to TYPE r (for some unknown r)?
--
-- This considers Constraint to be distinct from *.
tcIsRuntimeTypeKind :: Kind -> Bool
liftedTypeKind :: Kind
unliftedTypeKind :: Kind
-- | The worker for tyCoFVsOfType and tyCoFVsOfTypeList.
-- 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 GHC.Utils.FV.
--
-- Eta-expanded because that makes it run faster (apparently) See Note
-- [FV eta expansion] in GHC.Utils.FV for explanation.
tyCoFVsOfType :: Type -> FV
tyCoFVsBndr :: TyCoVarBinder -> FV -> FV
tyCoFVsVarBndr :: Var -> FV -> FV
tyCoFVsVarBndrs :: [Var] -> FV -> FV
tyCoVarsOfType :: Type -> TyCoVarSet
tyCoVarsOfTypes :: [Type] -> TyCoVarSet
-- | tyCoFVsOfType 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 GHC.Utils.FV.
tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
coVarsOfType :: Type -> CoVarSet
coVarsOfTypes :: [Type] -> CoVarSet
anyFreeVarsOfType :: (TyCoVar -> Bool) -> Type -> Bool
anyFreeVarsOfTypes :: (TyCoVar -> Bool) -> [Type] -> Bool
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
occCheckExpand :: [Var] -> Type -> Maybe Type
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a deterministic set.
closeOverKindsDSet :: DTyVarSet -> DTyVarSet
-- | Add the kind variables free in the kinds of the tyvars in the given
-- set. Returns a deterministically ordered list.
closeOverKindsList :: [TyVar] -> [TyVar]
closeOverKinds :: TyCoVarSet -> TyCoVarSet
-- | 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).
--
-- It is also meant to be stable: that is, variables should not be
-- reordered unnecessarily. This is specified in Note [ScopedSort] See
-- also Note [Ordering of implicit variables] in GHC.Rename.HsType
scopedSort :: [TyCoVar] -> [TyCoVar]
-- | 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, PredTypes or type families, 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
-- GHC.Core.TyCo.Rep.
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
-- Constraint (as recognized by Kind.isConstraintKindCon) which
-- is considered a synonym for Type in Core. See Note [Kind
-- Constraint and kind Type] in GHC.Core.Type. 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.
--
-- This function does not look through type family applications.
--
-- 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. Returns Nothing if no
-- unwrapping happens. See also Note [coreView vs tcView]
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 :: HasDebugCallStack => [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
zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [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
extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst
extendTvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst
extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> 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 :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv
zipCoEnv :: HasDebugCallStack => [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 :: HasDebugCallStack => TCvSubst -> Type -> Type
-- | Substitute within several Types The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTys :: HasDebugCallStack => TCvSubst -> [Type] -> [Type]
substScaledTy :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled Type
substScaledTys :: HasDebugCallStack => TCvSubst -> [Scaled Type] -> [Scaled Type]
-- | Type substitution, see zipTvSubst
substTyWith :: HasDebugCallStack => [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 :: HasDebugCallStack => 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]
substScaledTyUnchecked :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled Type
substScaledTysUnchecked :: TCvSubst -> [Scaled Type] -> [Scaled 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
substTyVarBndr :: HasDebugCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)
substTyVarBndrs :: HasDebugCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar])
substTyVar :: TCvSubst -> TyVar -> Type
substTyVars :: TCvSubst -> [TyVar] -> [Type]
substVarBndr :: HasDebugCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)
substVarBndrs :: HasDebugCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar])
substTyCoBndr :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder)
cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar)
cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar])
lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
-- | Tidy a Type
--
-- See Note [Strictness in tidyType and friends]
tidyType :: TidyEnv -> Type -> Type
-- | Tidy a list of Types
--
-- See Note [Strictness in tidyType and friends]
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])
tidyVarBndr :: 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.
tidyVarBndrs :: 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
-- tidyVarBndr
tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
-- | Calls tidyType on a top-level type (i.e. with an empty tidying
-- environment)
tidyTopType :: Type -> Type
tidyTyCoVarBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis)
tidyTyCoVarBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis])
-- | Returns True for the TyCon of the Constraint
-- kind.
isConstraintKindCon :: TyCon -> Bool
-- | Does this classify a type allowed to have values? Responds True to
-- things like *, TYPE Lifted, TYPE IntRep, TYPE v, Constraint.
--
-- True of any sub-kind of OpenTypeKind
classifiesTypeWithValues :: Kind -> Bool
-- | Tests whether the given type is concrete, i.e. it whether it consists
-- only of concrete type constructors, concrete type variables, and
-- applications.
--
-- See Note [Concrete types] in GHC.Tc.Utils.Concrete.
isConcrete :: Type -> Bool
-- | Checks that a kind of the form Type, Constraint or
-- 'TYPE r is concrete. See isConcrete.
--
-- Precondition: The type has kind (TYPE blah).
isFixedRuntimeRepKind :: HasDebugCallStack => Kind -> Bool
instance GHC.Enum.Bounded GHC.Core.Type.TypeOrdering
instance GHC.Enum.Enum GHC.Core.Type.TypeOrdering
instance GHC.Classes.Ord GHC.Core.Type.TypeOrdering
instance GHC.Classes.Eq GHC.Core.Type.TypeOrdering
-- | Core literals
module GHC.Types.Literal
-- | So-called Literals are one of:
--
--
-- - An unboxed numeric literal or floating-point literal 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 in the
-- LitNumber constructor is actually in the (possibly
-- target-dependent) range. The mkLit{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 (LitLabel)
-- - A LitRubbish to be used in place of values that are never
-- used.
-- - A character
-- - A string
-- - The NULL pointer
--
data Literal
-- | Char# - at least 31 bits. Create with mkLitChar
LitChar :: Char -> Literal
-- | Any numeric literal that can be internally represented with an
-- Integer.
LitNumber :: !LitNumType -> !Integer -> 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 mkLitString
LitString :: !ByteString -> Literal
-- | The NULL pointer, the only pointer value that can be
-- represented as a Literal. Create with nullAddrLit
LitNullAddr :: Literal
-- | A nonsense value of the given representation. See Note [Rubbish
-- literals].
--
-- The Type argument, rr, is of kind RuntimeRep. The type of the literal
-- is forall (a:TYPE rr). a
--
-- INVARIANT: the Type has no free variables and so substitution etc can
-- ignore it
LitRubbish :: Type -> Literal
-- | Float#. Create with mkLitFloat
LitFloat :: Rational -> Literal
-- | Double#. Create with mkLitDouble
LitDouble :: 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.
--
-- 3) Flag indicating whether the symbol references a function or a data
LitLabel :: FastString -> Maybe Int -> FunctionOrData -> Literal
-- | Numeric literal type
data LitNumType
-- | Bignat (see Note [BigNum literals])
LitNumBigNat :: LitNumType
-- | Int# - according to target machine
LitNumInt :: LitNumType
-- | Int8# - exactly 8 bits
LitNumInt8 :: LitNumType
-- | Int16# - exactly 16 bits
LitNumInt16 :: LitNumType
-- | Int32# - exactly 32 bits
LitNumInt32 :: LitNumType
-- | Int64# - exactly 64 bits
LitNumInt64 :: LitNumType
-- | Word# - according to target machine
LitNumWord :: LitNumType
-- | Word8# - exactly 8 bits
LitNumWord8 :: LitNumType
-- | Word16# - exactly 16 bits
LitNumWord16 :: LitNumType
-- | Word32# - exactly 32 bits
LitNumWord32 :: LitNumType
-- | Word64# - exactly 64 bits
LitNumWord64 :: LitNumType
-- | Creates a Literal of type Int#
mkLitInt :: Platform -> Integer -> Literal
-- | Creates a Literal of type Int#. If the argument is out
-- of the (target-dependent) range, it is wrapped. See Note [WordInt
-- underflowoverflow]
mkLitIntWrap :: Platform -> Integer -> Literal
-- | Creates a Literal of type Int#, as well as a
-- Boolean flag indicating overflow. That is, if the argument is
-- out of the (target-dependent) range the argument is wrapped and the
-- overflow flag will be set. See Note [WordInt underflowoverflow]
mkLitIntWrapC :: Platform -> Integer -> (Literal, Bool)
-- | Creates a Literal of type Int# without checking its
-- range.
mkLitIntUnchecked :: Integer -> Literal
-- | Creates a Literal of type Word#
mkLitWord :: Platform -> Integer -> Literal
-- | Creates a Literal of type Word#. If the argument is
-- out of the (target-dependent) range, it is wrapped. See Note
-- [WordInt underflowoverflow]
mkLitWordWrap :: Platform -> Integer -> Literal
-- | Creates a Literal of type Word#, as well as a
-- Boolean flag indicating carry. That is, if the argument is out
-- of the (target-dependent) range the argument is wrapped and the carry
-- flag will be set. See Note [WordInt underflowoverflow]
mkLitWordWrapC :: Platform -> Integer -> (Literal, Bool)
-- | Creates a Literal of type Word# without checking its
-- range.
mkLitWordUnchecked :: Integer -> Literal
-- | Creates a Literal of type Int8#
mkLitInt8 :: Integer -> Literal
-- | Creates a Literal of type Int8#. If the argument is
-- out of the range, it is wrapped.
mkLitInt8Wrap :: Integer -> Literal
-- | Creates a Literal of type Int8# without checking its
-- range.
mkLitInt8Unchecked :: Integer -> Literal
-- | Creates a Literal of type Word8#
mkLitWord8 :: Integer -> Literal
-- | Creates a Literal of type Word8#. If the argument is
-- out of the range, it is wrapped.
mkLitWord8Wrap :: Integer -> Literal
-- | Creates a Literal of type Word8# without checking its
-- range.
mkLitWord8Unchecked :: Integer -> Literal
-- | Creates a Literal of type Int16#
mkLitInt16 :: Integer -> Literal
-- | Creates a Literal of type Int16#. If the argument is
-- out of the range, it is wrapped.
mkLitInt16Wrap :: Integer -> Literal
-- | Creates a Literal of type Int16# without checking its
-- range.
mkLitInt16Unchecked :: Integer -> Literal
-- | Creates a Literal of type Word16#
mkLitWord16 :: Integer -> Literal
-- | Creates a Literal of type Word16#. If the argument is
-- out of the range, it is wrapped.
mkLitWord16Wrap :: Integer -> Literal
-- | Creates a Literal of type Word16# without checking its
-- range.
mkLitWord16Unchecked :: Integer -> Literal
-- | Creates a Literal of type Int32#
mkLitInt32 :: Integer -> Literal
-- | Creates a Literal of type Int32#. If the argument is
-- out of the range, it is wrapped.
mkLitInt32Wrap :: Integer -> Literal
-- | Creates a Literal of type Int32# without checking its
-- range.
mkLitInt32Unchecked :: Integer -> Literal
-- | Creates a Literal of type Word32#
mkLitWord32 :: Integer -> Literal
-- | Creates a Literal of type Word32#. If the argument is
-- out of the range, it is wrapped.
mkLitWord32Wrap :: Integer -> Literal
-- | Creates a Literal of type Word32# without checking its
-- range.
mkLitWord32Unchecked :: Integer -> Literal
-- | Creates a Literal of type Int64#
mkLitInt64 :: Integer -> Literal
-- | Creates a Literal of type Int64#. If the argument is
-- out of the range, it is wrapped.
mkLitInt64Wrap :: Integer -> Literal
-- | Creates a Literal of type Int64# without checking its
-- range.
mkLitInt64Unchecked :: Integer -> Literal
-- | Creates a Literal of type Word64#
mkLitWord64 :: Integer -> Literal
-- | Creates a Literal of type Word64#. If the argument is
-- out of the range, it is wrapped.
mkLitWord64Wrap :: Integer -> Literal
-- | Creates a Literal of type Word64# without checking its
-- range.
mkLitWord64Unchecked :: Integer -> Literal
-- | Creates a Literal of type Float#
mkLitFloat :: Rational -> Literal
-- | Creates a Literal of type Double#
mkLitDouble :: Rational -> Literal
-- | Creates a Literal of type Char#
mkLitChar :: 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
mkLitString :: String -> Literal
mkLitBigNat :: Integer -> Literal
-- | Create a numeric Literal of the given type
mkLitNumber :: Platform -> LitNumType -> Integer -> Literal
-- | Make a literal number using wrapping semantics if the value is out of
-- bound.
mkLitNumberWrap :: Platform -> LitNumType -> Integer -> Literal
-- | Find the Haskell Type the literal occupies
literalType :: Literal -> Type
pprLiteral :: (SDoc -> SDoc) -> Literal -> SDoc
-- | Indicate if a numeric literal type supports negative numbers
litNumIsSigned :: LitNumType -> Bool
-- | Get the literal range
litNumRange :: Platform -> LitNumType -> (Maybe Integer, Maybe Integer)
-- | Check that a given number is in the range of a numeric literal
litNumCheckRange :: Platform -> LitNumType -> Integer -> Bool
-- | Wrap a literal number according to its type using wrapping semantics.
litNumWrap :: Platform -> Literal -> Literal
-- | Coerce a literal number into another using wrapping semantics.
litNumCoerce :: LitNumType -> Platform -> Literal -> Literal
-- | Narrow a literal number by converting it into another number type and
-- then converting it back to its original type.
litNumNarrow :: LitNumType -> Platform -> Literal -> Literal
-- | Number of bits
litNumBitSize :: Platform -> LitNumType -> Maybe Word
isMinBound :: Platform -> Literal -> Bool
isMaxBound :: Platform -> Literal -> Bool
-- | True if code space does not go bad if we duplicate this literal
litIsDupable :: Platform -> 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
inCharRange :: Char -> Bool
-- | Tests whether the literal represents a zero of whatever type it is
isZeroLit :: Literal -> Bool
-- | Tests whether the literal represents a one of whatever type it is
isOneLit :: Literal -> Bool
litFitsInChar :: Literal -> Bool
-- | Returns the Integer contained in the Literal, for when
-- that makes sense, i.e. for Char and numbers.
litValue :: Literal -> Integer
-- | Apply a function to the Integer contained in the
-- Literal, for when that makes sense, e.g. for Char and
-- numbers. For fixed-size integral literals, the result will be wrapped
-- in accordance with the semantics of the target type. See Note
-- [WordInt underflowoverflow]
mapLitValue :: Platform -> (Integer -> Integer) -> Literal -> Literal
-- | Returns the Integer contained in the Literal, for when
-- that makes sense, i.e. for Char and numbers.
isLitValue_maybe :: Literal -> Maybe Integer
isLitRubbish :: Literal -> Bool
narrowInt8Lit :: Literal -> Literal
narrowInt16Lit :: Literal -> Literal
narrowInt32Lit :: Literal -> Literal
narrowInt64Lit :: Literal -> Literal
narrowWord8Lit :: Literal -> Literal
narrowWord16Lit :: Literal -> Literal
narrowWord32Lit :: Literal -> Literal
narrowWord64Lit :: Literal -> Literal
-- | Extend or narrow a fixed-width literal (e.g. Int16#) to a
-- target word-sized literal (Int# or Word#). Narrowing can
-- only happen on 32-bit architectures when we convert a 64-bit literal
-- into a 32-bit one.
convertToIntLit :: Platform -> Literal -> Literal
-- | Extend or narrow a fixed-width literal (e.g. Int16#) to a
-- target word-sized literal (Int# or Word#). Narrowing can
-- only happen on 32-bit architectures when we convert a 64-bit literal
-- into a 32-bit one.
convertToWordLit :: Platform -> Literal -> Literal
charToIntLit :: Literal -> Literal
intToCharLit :: Literal -> Literal
floatToIntLit :: Literal -> Literal
intToFloatLit :: Literal -> Literal
doubleToIntLit :: Literal -> Literal
intToDoubleLit :: Literal -> Literal
nullAddrLit :: Literal
floatToDoubleLit :: Literal -> Literal
doubleToFloatLit :: Literal -> Literal
instance GHC.Classes.Ord GHC.Types.Literal.LitNumType
instance GHC.Classes.Eq GHC.Types.Literal.LitNumType
instance GHC.Enum.Enum GHC.Types.Literal.LitNumType
instance Data.Data.Data GHC.Types.Literal.LitNumType
instance Data.Data.Data GHC.Types.Literal.Literal
instance GHC.Utils.Binary.Binary GHC.Types.Literal.Literal
instance GHC.Utils.Outputable.Outputable GHC.Types.Literal.Literal
instance GHC.Classes.Eq GHC.Types.Literal.Literal
instance GHC.Classes.Ord GHC.Types.Literal.Literal
instance GHC.Utils.Binary.Binary GHC.Types.Literal.LitNumType
module GHC.Data.TrieMap
data MaybeMap m a
data ListMap m a
type LiteralMap a = Map Literal a
class TrieMap m where {
type family Key m :: Type;
}
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
filterTM :: TrieMap m => (a -> Bool) -> m a -> m a
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
foldMapTM :: (TrieMap m, Monoid r) => (a -> r) -> m a -> r
isEmptyTM :: TrieMap m => m a -> Bool
(>.>) :: (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 |>>
type XT a = Maybe a -> Maybe a
foldMaybe :: (a -> b -> b) -> Maybe a -> b -> b
filterMaybe :: (a -> Bool) -> Maybe a -> Maybe a
data GenMap m a
lkG :: (Eq (Key m), TrieMap m) => Key m -> GenMap m a -> Maybe a
xtG :: (Eq (Key m), TrieMap m) => Key m -> XT a -> GenMap m a -> GenMap m a
mapG :: TrieMap m => (a -> b) -> GenMap m a -> GenMap m b
fdG :: TrieMap m => (a -> b -> b) -> GenMap m a -> b -> b
xtList :: TrieMap m => (forall b. k -> XT b -> m b -> m b) -> [k] -> XT a -> ListMap m a -> ListMap m a
lkList :: TrieMap m => (forall b. k -> m b -> Maybe b) -> [k] -> ListMap m a -> Maybe a
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable (m a)) => GHC.Utils.Outputable.Outputable (GHC.Data.TrieMap.GenMap m a)
instance (GHC.Classes.Eq (GHC.Data.TrieMap.Key m), GHC.Data.TrieMap.TrieMap m) => GHC.Data.TrieMap.TrieMap (GHC.Data.TrieMap.GenMap m)
instance (GHC.Classes.Eq (GHC.Data.TrieMap.Key m), GHC.Data.TrieMap.TrieMap m) => Data.Foldable.Foldable (GHC.Data.TrieMap.GenMap m)
instance GHC.Data.TrieMap.TrieMap m => GHC.Data.TrieMap.TrieMap (GHC.Data.TrieMap.ListMap m)
instance GHC.Data.TrieMap.TrieMap m => Data.Foldable.Foldable (GHC.Data.TrieMap.ListMap m)
instance (GHC.Data.TrieMap.TrieMap m, GHC.Utils.Outputable.Outputable a) => GHC.Utils.Outputable.Outputable (GHC.Data.TrieMap.ListMap m a)
instance GHC.Data.TrieMap.TrieMap m => GHC.Data.TrieMap.TrieMap (GHC.Data.TrieMap.MaybeMap m)
instance GHC.Data.TrieMap.TrieMap m => Data.Foldable.Foldable (GHC.Data.TrieMap.MaybeMap m)
instance GHC.Data.TrieMap.TrieMap Data.IntMap.Internal.IntMap
instance GHC.Classes.Ord k => GHC.Data.TrieMap.TrieMap (Data.Map.Internal.Map k)
instance GHC.Types.Unique.Uniquable key => GHC.Data.TrieMap.TrieMap (GHC.Types.Unique.DFM.UniqDFM key)
module GHC.Cmm.Dataflow.Label
data Label
data LabelMap v
data LabelSet
type FactBase f = LabelMap f
lookupFact :: Label -> FactBase f -> Maybe f
mkHooplLabel :: Int -> Label
instance GHC.Classes.Ord GHC.Cmm.Dataflow.Label.Label
instance GHC.Classes.Eq GHC.Cmm.Dataflow.Label.Label
instance GHC.Base.Semigroup GHC.Cmm.Dataflow.Label.LabelSet
instance GHC.Base.Monoid GHC.Cmm.Dataflow.Label.LabelSet
instance GHC.Show.Show GHC.Cmm.Dataflow.Label.LabelSet
instance GHC.Classes.Ord GHC.Cmm.Dataflow.Label.LabelSet
instance GHC.Classes.Eq GHC.Cmm.Dataflow.Label.LabelSet
instance Data.Traversable.Traversable GHC.Cmm.Dataflow.Label.LabelMap
instance Data.Foldable.Foldable GHC.Cmm.Dataflow.Label.LabelMap
instance GHC.Base.Functor GHC.Cmm.Dataflow.Label.LabelMap
instance GHC.Show.Show v => GHC.Show.Show (GHC.Cmm.Dataflow.Label.LabelMap v)
instance GHC.Classes.Ord v => GHC.Classes.Ord (GHC.Cmm.Dataflow.Label.LabelMap v)
instance GHC.Classes.Eq v => GHC.Classes.Eq (GHC.Cmm.Dataflow.Label.LabelMap v)
instance GHC.Cmm.Dataflow.Collections.IsMap GHC.Cmm.Dataflow.Label.LabelMap
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Cmm.Dataflow.Label.LabelMap a)
instance GHC.Utils.Outputable.OutputableP env a => GHC.Utils.Outputable.OutputableP env (GHC.Cmm.Dataflow.Label.LabelMap a)
instance GHC.Data.TrieMap.TrieMap GHC.Cmm.Dataflow.Label.LabelMap
instance GHC.Cmm.Dataflow.Collections.IsSet GHC.Cmm.Dataflow.Label.LabelSet
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Dataflow.Label.LabelSet
instance GHC.Show.Show GHC.Cmm.Dataflow.Label.Label
instance GHC.Types.Unique.Uniquable GHC.Cmm.Dataflow.Label.Label
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Dataflow.Label.Label
instance GHC.Utils.Outputable.OutputableP env GHC.Cmm.Dataflow.Label.Label
module GHC.Cmm.Switch
-- | 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 constructor 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 occurring in the SwitchTargets value.
switchTargetsToList :: SwitchTargets -> [Label]
-- | Custom equality helper, needed for GHC.Cmm.CommonBlockElim
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 backend support switch out of the box? Then leave this to the
-- backend!
backendSupportsSwitch :: Backend -> 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.Classes.Eq GHC.Cmm.Switch.SwitchTargets
instance GHC.Show.Show GHC.Cmm.Switch.SwitchTargets
instance GHC.Show.Show GHC.Cmm.Switch.SwitchPlan
module GHC.Cmm.Dataflow.Graph
-- | A (possibly empty) collection of closed/closed blocks
type Body n = LabelMap (Block n C C)
-- | A control-flow graph, which may take any of four shapes (O/O, OC,
-- CO, C/C). A graph open at the entry has a single, distinguished,
-- anonymous entry point; if a graph is closed at the entry, its entry
-- point(s) are supplied by a context.
type Graph = Graph' Block
-- | Graph' is abstracted over the block type, so that we can
-- build graphs of annotated blocks for example (Compiler.Hoopl.Dataflow
-- needs this).
data Graph' block (n :: Extensibility -> Extensibility -> Type) e x
[GNil] :: Graph' block n O O
[GUnit] :: block n O O -> Graph' block n O O
[GMany] :: MaybeO e (block n O C) -> Body' block n -> MaybeO x (block n C O) -> Graph' block n e x
-- | Gives access to the anchor points for nonlocal edges as well as the
-- edges themselves
class NonLocal thing
entryLabel :: NonLocal thing => thing C x -> Label
successors :: NonLocal thing => thing e C -> [Label]
addBlock :: (NonLocal block, HasDebugCallStack) => block C C -> LabelMap (block C C) -> LabelMap (block C C)
bodyList :: Body' block n -> [(Label, block n C C)]
emptyBody :: Body' block n
labelsDefined :: forall block n e x. NonLocal (block n) => Graph' block n e x -> LabelSet
-- | Maps over all nodes in a graph.
mapGraph :: (forall e x. n e x -> n' e x) -> Graph n e x -> Graph n' e x
-- | Function mapGraphBlocks enables a change of representation of
-- blocks, nodes, or both. It lifts a polymorphic block transform into a
-- polymorphic graph transform. When the block representation stabilizes,
-- a similar function should be provided for blocks.
mapGraphBlocks :: forall block n block' n' e x. (forall e x. block n e x -> block' n' e x) -> Graph' block n e x -> Graph' block' n' e x
-- | Returns a list of blocks reachable from the provided Labels in the
-- reverse postorder.
--
-- This is the most important traversal over this data structure. It
-- drops unreachable code and puts blocks in an order that is good for
-- solving forward dataflow problems quickly. The reverse order is good
-- for solving backward dataflow problems quickly. The forward order is
-- also reasonably good for emitting instructions, except that it will
-- not usually exploit Forrest Baskett's trick of eliminating the
-- unconditional branch from a loop. For that you would need a more
-- serious analysis, probably based on dominators, to identify loop
-- headers.
--
-- For forward analyses we want reverse postorder visitation, consider:
-- A -> [B,C] B -> D C -> D Postorder: [D, C, B, A]
-- (or [D, B, C, A]) Reverse postorder: [A, B, C, D] (or [A, C, B, D])
-- This matters for, e.g., forward analysis, because we want to analyze
-- *both* B and C before we analyze D.
revPostorderFrom :: forall block. NonLocal block => LabelMap (block C C) -> Label -> [block C C]
instance GHC.Cmm.Dataflow.Graph.NonLocal n => GHC.Cmm.Dataflow.Graph.NonLocal (GHC.Cmm.Dataflow.Block.Block n)
module GHC.Iface.Type
type IfExtName = Name
type IfLclName = FastString
-- | A kind of universal type, used for types and kinds.
--
-- Any time a Type is pretty-printed, it is first converted to
-- an IfaceType before being printed. See Note [Pretty printing
-- via Iface syntax] in GHC.Types.TyThing.Ppr
data IfaceType
IfaceFreeTyVar :: TyVar -> IfaceType
IfaceTyVar :: IfLclName -> IfaceType
IfaceLitTy :: IfaceTyLit -> IfaceType
IfaceAppTy :: IfaceType -> IfaceAppArgs -> IfaceType
IfaceFunTy :: AnonArgFlag -> IfaceMult -> IfaceType -> IfaceType -> IfaceType
IfaceForAllTy :: IfaceForAllBndr -> IfaceType -> IfaceType
IfaceTyConApp :: IfaceTyCon -> IfaceAppArgs -> IfaceType
IfaceCastTy :: IfaceType -> IfaceCoercion -> IfaceType
IfaceCoercionTy :: IfaceCoercion -> IfaceType
IfaceTupleTy :: TupleSort -> PromotionFlag -> IfaceAppArgs -> IfaceType
type IfacePredType = IfaceType
type IfaceKind = IfaceType
data IfaceCoercion
IfaceReflCo :: IfaceType -> IfaceCoercion
IfaceGReflCo :: Role -> IfaceType -> IfaceMCoercion -> IfaceCoercion
IfaceFunCo :: Role -> IfaceCoercion -> IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceTyConAppCo :: Role -> IfaceTyCon -> [IfaceCoercion] -> IfaceCoercion
IfaceAppCo :: IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceForAllCo :: IfaceBndr -> IfaceCoercion -> IfaceCoercion -> IfaceCoercion
IfaceCoVarCo :: IfLclName -> IfaceCoercion
IfaceAxiomInstCo :: IfExtName -> BranchIndex -> [IfaceCoercion] -> IfaceCoercion
IfaceAxiomRuleCo :: IfLclName -> [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
IfaceKindCo :: IfaceCoercion -> IfaceCoercion
IfaceSubCo :: IfaceCoercion -> IfaceCoercion
IfaceFreeCoVar :: CoVar -> IfaceCoercion
-- | See Note [Holes in IfaceCoercion]
IfaceHoleCo :: CoVar -> IfaceCoercion
data IfaceMCoercion
IfaceMRefl :: IfaceMCoercion
IfaceMCo :: IfaceCoercion -> IfaceMCoercion
data IfaceUnivCoProv
IfacePhantomProv :: IfaceCoercion -> IfaceUnivCoProv
IfaceProofIrrelProv :: IfaceCoercion -> IfaceUnivCoProv
IfacePluginProv :: String -> IfaceUnivCoProv
IfaceCorePrepProv :: Bool -> IfaceUnivCoProv
type IfaceMult = IfaceType
data IfaceTyCon
IfaceTyCon :: IfExtName -> IfaceTyConInfo -> IfaceTyCon
[ifaceTyConName] :: IfaceTyCon -> IfExtName
[ifaceTyConInfo] :: IfaceTyCon -> IfaceTyConInfo
data IfaceTyConInfo
IfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo
[ifaceTyConIsPromoted] :: IfaceTyConInfo -> PromotionFlag
[ifaceTyConSort] :: IfaceTyConInfo -> IfaceTyConSort
mkIfaceTyConInfo :: PromotionFlag -> IfaceTyConSort -> IfaceTyConInfo
-- | The various types of TyCons which have special, built-in syntax.
data IfaceTyConSort
-- | a regular tycon
IfaceNormalTyCon :: IfaceTyConSort
-- | a tuple, 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
-- | an unboxed sum, e.g. ()
IfaceSumTyCon :: !Arity -> IfaceTyConSort
-- | A heterogeneous equality TyCon (i.e. eqPrimTyCon, eqReprPrimTyCon,
-- heqTyCon) that is actually being applied to two types of the same
-- kind. This affects pretty-printing only: see Note [Equality predicates
-- in IfaceType]
IfaceEqualityTyCon :: IfaceTyConSort
data IfaceTyLit
IfaceNumTyLit :: Integer -> IfaceTyLit
IfaceStrTyLit :: FastString -> IfaceTyLit
IfaceCharTyLit :: Char -> IfaceTyLit
-- | Stores the arguments in a type application as a list. See Note
-- [Suppressing invisible arguments].
data IfaceAppArgs
IA_Nil :: IfaceAppArgs
IA_Arg :: IfaceType -> ArgFlag -> IfaceAppArgs -> IfaceAppArgs
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 = (IfaceType, IfLclName, IfaceType)
type IfaceTyConBinder = VarBndr IfaceBndr TyConBndrVis
type IfaceForAllSpecBndr = VarBndr IfaceBndr Specificity
type IfaceForAllBndr = VarBndr IfaceBndr 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 [VarBndrs, TyCoVarBinders, TyConBinders,
-- and visibility] in GHC.Core.TyCo.Rep
data ArgFlag
Invisible :: Specificity -> ArgFlag
Required :: ArgFlag
pattern Specified :: ArgFlag
pattern Inferred :: ArgFlag
-- | The non-dependent version of ArgFlag. See Note [AnonArgFlag]
-- Appears here partly so that it's together with its friends ArgFlag and
-- ForallVisFlag, but also because it is used in IfaceType, rather early
-- in the compilation chain
data AnonArgFlag
-- | Used for (->): an ordinary non-dependent arrow. The
-- argument is visible in source code.
VisArg :: AnonArgFlag
-- | Used for (=>): a non-dependent predicate arrow. The
-- argument is invisible in source code.
InvisArg :: AnonArgFlag
-- | 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
-- | Make an IfaceForAllBndr from an IfaceTvBndr.
mkIfaceForAllTvBndr :: ArgFlag -> IfaceTvBndr -> IfaceForAllBndr
-- | Build the tyConKind from the binders and the result kind. Keep
-- in sync with mkTyConKind in GHC.Core.TyCon.
mkIfaceTyConKind :: [IfaceTyConBinder] -> IfaceKind -> IfaceKind
ifaceForAllSpecToBndrs :: [IfaceForAllSpecBndr] -> [IfaceForAllBndr]
ifaceForAllSpecToBndr :: IfaceForAllSpecBndr -> IfaceForAllBndr
-- | Extract an IfaceBndr from an IfaceForAllBndr.
ifForAllBndrVar :: IfaceForAllBndr -> IfaceBndr
-- | Extract the variable name from an IfaceForAllBndr.
ifForAllBndrName :: IfaceForAllBndr -> IfLclName
ifaceBndrName :: IfaceBndr -> IfLclName
-- | Extract an IfaceBndr from an IfaceTyConBinder.
ifTyConBinderVar :: IfaceTyConBinder -> IfaceBndr
-- | Extract the variable name from an IfaceTyConBinder.
ifTyConBinderName :: IfaceTyConBinder -> IfLclName
-- | Given a kind K, is K of the form (TYPE ('BoxedRep 'LiftedRep))?
isIfaceLiftedTypeKind :: IfaceKind -> Bool
appArgsIfaceTypes :: IfaceAppArgs -> [IfaceType]
appArgsIfaceTypesArgFlags :: IfaceAppArgs -> [(IfaceType, ArgFlag)]
-- | Do we want to suppress kind annotations on binders? See Note
-- [Suppressing binder signatures]
newtype SuppressBndrSig
SuppressBndrSig :: Bool -> SuppressBndrSig
newtype UseBndrParens
UseBndrParens :: Bool -> UseBndrParens
newtype PrintExplicitKinds
PrintExplicitKinds :: Bool -> PrintExplicitKinds
pprIfaceType :: IfaceType -> SDoc
pprParendIfaceType :: IfaceType -> SDoc
pprPrecIfaceType :: PprPrec -> IfaceType -> SDoc
-- | Prints a context or () if empty You give it the context
-- precedence
pprIfaceContext :: PprPrec -> [IfacePredType] -> SDoc
-- | Prints "(C a, D b) =>", including the arrow. Used when we want to
-- print a context in a type, so we use funPrec to decide whether
-- to parenthesise a singleton predicate; e.g. Num a => a -> a
pprIfaceContextArr :: [IfacePredType] -> SDoc
pprIfaceIdBndr :: IfaceIdBndr -> SDoc
pprIfaceLamBndr :: IfaceLamBndr -> SDoc
pprIfaceTvBndr :: IfaceTvBndr -> SuppressBndrSig -> UseBndrParens -> SDoc
pprIfaceTyConBinders :: SuppressBndrSig -> [IfaceTyConBinder] -> SDoc
pprIfaceBndrs :: [IfaceBndr] -> SDoc
pprIfaceAppArgs :: IfaceAppArgs -> SDoc
pprParendIfaceAppArgs :: IfaceAppArgs -> SDoc
pprIfaceForAllPart :: [IfaceForAllBndr] -> [IfacePredType] -> SDoc -> SDoc
-- | Like pprIfaceForAllPart, but always uses an explicit
-- forall.
pprIfaceForAllPartMust :: [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 :: PprPrec -> IfaceTyCon -> IfaceAppArgs -> SDoc
pprUserIfaceForAll :: [IfaceForAllBndr] -> SDoc
pprIfaceCoTcApp :: PprPrec -> IfaceTyCon -> [IfaceCoercion] -> SDoc
pprTyTcApp :: PprPrec -> IfaceTyCon -> IfaceAppArgs -> SDoc
pprIfacePrefixApp :: PprPrec -> SDoc -> [SDoc] -> SDoc
ppr_fun_arrow :: IfaceMult -> SDoc
isIfaceTauType :: IfaceType -> Bool
suppressIfaceInvisibles :: PrintExplicitKinds -> [IfaceTyConBinder] -> [a] -> [a]
stripIfaceInvisVars :: PrintExplicitKinds -> [IfaceTyConBinder] -> [IfaceTyConBinder]
stripInvisArgs :: PrintExplicitKinds -> IfaceAppArgs -> IfaceAppArgs
mkIfaceTySubst :: [(IfLclName, IfaceType)] -> IfaceTySubst
substIfaceTyVar :: IfaceTySubst -> IfLclName -> IfaceType
substIfaceAppArgs :: IfaceTySubst -> IfaceAppArgs -> IfaceAppArgs
inDomIfaceTySubst :: IfaceTySubst -> IfaceTvBndr -> Bool
-- | The type 'Many :: Multiplicity'.
many_ty :: IfaceType
instance GHC.Classes.Eq GHC.Iface.Type.IfaceTyLit
instance GHC.Classes.Eq GHC.Iface.Type.IfaceTyConSort
instance GHC.Classes.Eq GHC.Iface.Type.IfaceTyConInfo
instance GHC.Classes.Eq GHC.Iface.Type.IfaceTyCon
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceBndr
instance GHC.Base.Semigroup GHC.Iface.Type.IfaceAppArgs
instance GHC.Base.Monoid GHC.Iface.Type.IfaceAppArgs
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceBndr
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceType
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceAppArgs
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceCoercion
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceAppArgs
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceType
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceMCoercion
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceCoercion
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceUnivCoProv
instance GHC.Utils.Binary.Binary (GHC.Types.Basic.DefMethSpec GHC.Iface.Type.IfaceType)
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceType
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceCoercion
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceUnivCoProv
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceMCoercion
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceBndr
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceAppArgs
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceTyCon
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceTyCon
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceTyCon
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceTyConInfo
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceTyConInfo
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceTyConInfo
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceTyConSort
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceTyConSort
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceTyConSort
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceTyLit
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceTyLit
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceTyLit
instance GHC.Utils.Outputable.Outputable GHC.Iface.Type.IfaceOneShot
instance GHC.Utils.Binary.Binary GHC.Iface.Type.IfaceOneShot
instance Control.DeepSeq.NFData GHC.Iface.Type.IfaceOneShot
-- | Pretty-printing types and coercions.
module GHC.Core.TyCo.Ppr
-- | A general-purpose pretty-printing precedence type.
newtype PprPrec
PprPrec :: Int -> PprPrec
topPrec :: PprPrec
sigPrec :: PprPrec
opPrec :: PprPrec
funPrec :: PprPrec
appPrec :: PprPrec
maybeParen :: PprPrec -> PprPrec -> SDoc -> SDoc
pprType :: Type -> SDoc
pprParendType :: Type -> SDoc
pprTidiedType :: Type -> SDoc
pprPrecType :: PprPrec -> Type -> SDoc
pprPrecTypeX :: TidyEnv -> PprPrec -> Type -> SDoc
pprTypeApp :: TyCon -> [Type] -> SDoc
pprTCvBndr :: TyCoVarBinder -> SDoc
pprTCvBndrs :: [TyCoVarBinder] -> SDoc
pprSigmaType :: Type -> SDoc
pprTheta :: ThetaType -> SDoc
pprParendTheta :: ThetaType -> SDoc
pprForAll :: [TyCoVarBinder] -> SDoc
-- | Print a user-level forall; see Note [When to print foralls]
-- in GHC.Iface.Type.
pprUserForAll :: [TyCoVarBinder] -> SDoc
pprTyVar :: TyVar -> SDoc
pprTyVars :: [TyVar] -> SDoc
pprThetaArrowTy :: ThetaType -> SDoc
pprClassPred :: Class -> [Type] -> SDoc
pprKind :: Kind -> SDoc
pprParendKind :: Kind -> SDoc
pprTyLit :: TyLit -> SDoc
pprDataCons :: TyCon -> SDoc
-- | Display all kind information (with -fprint-explicit-kinds)
-- when the provided Bool argument is True. See Note
-- [Kind arguments in error messages] in GHC.Tc.Errors.
pprWithExplicitKindsWhen :: Bool -> SDoc -> SDoc
-- | This variant preserves any use of TYPE in a type, effectively locally
-- setting -fprint-explicit-runtime-reps.
pprWithTYPE :: Type -> 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
pprCo :: Coercion -> SDoc
pprParendCo :: Coercion -> SDoc
-- | debugPprType is a simple pretty printer that prints a type without
-- going through IfaceType. It does not format as prettily as the normal
-- route, but it's much more direct, and that can be useful for
-- debugging. E.g. with -dppr-debug it prints the kind on type-variable
-- occurrences which the normal route fundamentally cannot do.
debugPprType :: Type -> SDoc
-- | RoughMap is an approximate finite map data structure keyed on
-- [RoughMatchTc]. This is useful when keying maps on
-- lists of Types (e.g. an instance head).
module GHC.Core.RoughMap
data RoughMatchTc
RM_KnownTc :: Name -> RoughMatchTc
RM_WildCard :: RoughMatchTc
isRoughWildcard :: RoughMatchTc -> Bool
typeToRoughMatchTc :: Type -> RoughMatchTc
data RoughMatchLookupTc
-- | The position only matches the specified KnownTc
RML_KnownTc :: Name -> RoughMatchLookupTc
-- | The position definitely doesn't match any KnownTc
RML_NoKnownTc :: RoughMatchLookupTc
-- | The position can match anything
RML_WildCard :: RoughMatchLookupTc
typeToRoughMatchLookupTc :: Type -> RoughMatchLookupTc
roughMatchTcToLookup :: RoughMatchTc -> RoughMatchLookupTc
-- | Trie of [RoughMatchTc]
--
--
-- - Examples* insert [OtherTc] 1 insert [OtherTc] 2 lookup
-- [OtherTc] == [1,2]
--
data RoughMap a
emptyRM :: RoughMap a
-- | Order of result is deterministic.
lookupRM :: [RoughMatchLookupTc] -> RoughMap a -> [a]
-- | N.B. Returns a Bag for matches, which allows us to avoid
-- rebuilding all of the lists we find in rm_empty, which would
-- otherwise be necessary due to ++ if we returned a list. We use
-- a list for unifiers becuase the tail is computed lazily and we often
-- only care about the first couple of potential unifiers. Constructing a
-- bag forces the tail which performs much too much work.
--
-- See Note [Matching a RoughMap] See Note [Matches vs Unifiers]
lookupRM' :: [RoughMatchLookupTc] -> RoughMap a -> (Bag a, [a])
insertRM :: [RoughMatchTc] -> a -> RoughMap a -> RoughMap a
filterRM :: (a -> Bool) -> RoughMap a -> RoughMap a
-- | Filter all elements that might match a particular key with the given
-- predicate.
filterMatchingRM :: (a -> Bool) -> [RoughMatchTc] -> RoughMap a -> RoughMap a
elemsRM :: RoughMap a -> [a]
sizeRM :: RoughMap a -> Int
foldRM :: (a -> b -> b) -> b -> RoughMap a -> b
unionRM :: RoughMap a -> RoughMap a -> RoughMap a
instance Data.Data.Data GHC.Core.RoughMap.RoughMatchTc
instance Data.Data.Data GHC.Core.RoughMap.RoughMatchLookupTc
instance GHC.Base.Functor GHC.Core.RoughMap.RoughMap
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Core.RoughMap.RoughMap a)
instance GHC.Utils.Outputable.Outputable GHC.Core.RoughMap.RoughMatchLookupTc
instance GHC.Utils.Outputable.Outputable GHC.Core.RoughMap.RoughMatchTc
module GHC.Core.PatSyn
-- | Pattern Synonym
--
-- See Note [Pattern synonym representation] See Note [Pattern synonym
-- signature contexts]
data PatSyn
type PatSynMatcher = (Name, Type, Bool)
type PatSynBuilder = Maybe (Name, Type, Bool)
-- | Build a new pattern synonym
mkPatSyn :: Name -> Bool -> ([InvisTVBinder], ThetaType) -> ([InvisTVBinder], ThetaType) -> [Type] -> Type -> PatSynMatcher -> PatSynBuilder -> [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
patSynResultType :: PatSyn -> Type
-- | Is this a 'vanilla' pattern synonym (no existentials, no provided
-- constraints)?
isVanillaPatSyn :: PatSyn -> Bool
patSynArgs :: PatSyn -> [Type]
patSynMatcher :: PatSyn -> PatSynMatcher
patSynBuilder :: PatSyn -> PatSynBuilder
patSynUnivTyVarBinders :: PatSyn -> [InvisTVBinder]
patSynExTyVars :: PatSyn -> [TyVar]
patSynExTyVarBinders :: PatSyn -> [InvisTVBinder]
patSynSig :: PatSyn -> ([TyVar], ThetaType, [TyVar], ThetaType, [Scaled Type], Type)
patSynSigBndr :: PatSyn -> ([InvisTVBinder], ThetaType, [InvisTVBinder], ThetaType, [Scaled 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
-- | Print the type of a pattern synonym. The foralls are printed
-- explicitly
pprPatSynType :: PatSyn -> SDoc
instance GHC.Classes.Eq GHC.Core.PatSyn.PatSyn
instance GHC.Types.Unique.Uniquable GHC.Core.PatSyn.PatSyn
instance GHC.Types.Name.NamedThing GHC.Core.PatSyn.PatSyn
instance GHC.Utils.Outputable.Outputable GHC.Core.PatSyn.PatSyn
instance GHC.Utils.Outputable.OutputableBndr GHC.Core.PatSyn.PatSyn
instance Data.Data.Data GHC.Core.PatSyn.PatSyn
-- | This module defines the semi-ring of multiplicities, and associated
-- functions. Multiplicities annotate arrow types to indicate the
-- linearity of the arrow (in the sense of linear types).
--
-- Mult is a type synonym for Type, used only when its kind is
-- Multiplicity. To simplify dealing with multiplicities, functions such
-- as mkMultMul perform simplifications such as Many * x = Many on the
-- fly.
module GHC.Core.Multiplicity
-- | Mult is a type alias for Type.
--
-- Mult must contain Type because multiplicity variables are mere type
-- variables (of kind Multiplicity) in Haskell. So the simplest
-- implementation is to make Mult be Type.
--
-- Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon)
-- - Many: GHC.Types.Many (= manyDataCon) - Multiplication:
-- GHC.Types.MultMul (= multMulTyCon)
--
-- So that Mult feels a bit more structured, we provide pattern synonyms
-- and smart constructors for these.
type Mult = Type
pattern One :: Mult
pattern Many :: Mult
isMultMul :: Mult -> Maybe (Mult, Mult)
mkMultAdd :: Mult -> Mult -> Mult
mkMultMul :: Mult -> Mult -> Mult
-- | mkMultSup w1 w2 returns a multiplicity such that
-- mkMultSup w1 w2 >= w1 and mkMultSup w1 w2 >=
-- w2. See Note [Overapproximating multiplicities].
mkMultSup :: Mult -> Mult -> Mult
-- | A shorthand for data with an attached Mult element (the
-- multiplicity).
data Scaled a
Scaled :: !Mult -> a -> Scaled a
scaledMult :: Scaled a -> Mult
scaledThing :: Scaled a -> a
-- | Scale a payload by Many
unrestricted :: a -> Scaled a
-- | Scale a payload by One
linear :: a -> Scaled a
-- | Scale a payload by Many; used for type arguments in core
tymult :: a -> Scaled a
irrelevantMult :: Scaled a -> a
mkScaled :: Mult -> a -> Scaled a
scaledSet :: Scaled a -> b -> Scaled b
scaleScaled :: Mult -> Scaled a -> Scaled a
data IsSubmult
Submult :: IsSubmult
Unknown :: IsSubmult
-- | submult w1 w2 check whether a value of multiplicity
-- w1 is allowed where a value of multiplicity w2 is
-- expected. This is a partial order.
submult :: Mult -> Mult -> IsSubmult
-- | Apply a function to both the Mult and the Type in a 'Scaled Type'
mapScaledType :: (Type -> Type) -> Scaled Type -> Scaled Type
instance GHC.Classes.Eq GHC.Core.Multiplicity.IsSubmult
instance GHC.Show.Show GHC.Core.Multiplicity.IsSubmult
instance GHC.Utils.Outputable.Outputable GHC.Core.Multiplicity.IsSubmult
module GHC.Core.UsageEnv
data Usage
Zero :: Usage
Bottom :: Usage
MUsage :: Mult -> Usage
data UsageEnv
addUE :: UsageEnv -> UsageEnv -> UsageEnv
addUsage :: Usage -> Usage -> Usage
bottomUE :: UsageEnv
deleteUE :: NamedThing n => UsageEnv -> n -> UsageEnv
-- | |lookupUE x env| returns the multiplicity assigned to |x| in |env|, if
-- |x| is not bound in |env|, then returns |Zero| or |Bottom|.
lookupUE :: NamedThing n => UsageEnv -> n -> Usage
scaleUE :: Mult -> UsageEnv -> UsageEnv
scaleUsage :: Mult -> Usage -> Usage
supUE :: UsageEnv -> UsageEnv -> UsageEnv
supUEs :: [UsageEnv] -> UsageEnv
unitUE :: NamedThing n => n -> Mult -> UsageEnv
zeroUE :: UsageEnv
instance GHC.Utils.Outputable.Outputable GHC.Core.UsageEnv.UsageEnv
instance GHC.Utils.Outputable.Outputable GHC.Core.UsageEnv.Usage
-- | 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 GHC.Core.Coercion
-- | A Coercion is concrete evidence of the equality/convertibility
-- of two types.
data Coercion
type CoercionN = Coercion
type CoercionR = Coercion
type CoercionP = Coercion
-- | A semantically more meaningful type to represent what may or may not
-- be a useful Coercion.
data MCoercion
MRefl :: MCoercion
MCo :: Coercion -> MCoercion
type MCoercionN = MCoercion
type MCoercionR = MCoercion
-- | 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
CoercionHole :: CoVar -> IORef (Maybe Coercion) -> CoercionHole
[ch_co_var] :: CoercionHole -> CoVar
[ch_ref] :: CoercionHole -> IORef (Maybe Coercion)
coHoleCoVar :: CoercionHole -> CoVar
setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole
data LeftOrRight
CLeft :: LeftOrRight
CRight :: LeftOrRight
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and its 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
coVarRType :: HasDebugCallStack => CoVar -> Type
coVarLType :: HasDebugCallStack => CoVar -> Type
coVarTypes :: HasDebugCallStack => CoVar -> Pair Type
coVarKind :: CoVar -> Type
coVarKindsTypesRole :: HasDebugCallStack => CoVar -> (Kind, Kind, Type, Type, Role)
coVarRole :: CoVar -> Role
coercionType :: Coercion -> Type
-- | Makes a coercion type from two types: the types whose equality is
-- proven by the relevant Coercion
mkCoercionType :: Role -> Type -> Type -> 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
coercionLKind :: Coercion -> Type
coercionRKind :: Coercion -> Type
-- | Apply coercionKind to multiple Coercions
coercionKinds :: [Coercion] -> Pair [Type]
-- | Retrieve the role from a coercion.
coercionRole :: Coercion -> Role
-- | Get a coercion's kind and role.
coercionKindRole :: Coercion -> (Pair Type, Role)
-- | Make a generalized reflexive coercion
mkGReflCo :: Role -> Type -> MCoercionN -> Coercion
-- | Make a reflexive coercion
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 variable.
mkPiCo :: Role -> Var -> Coercion -> Coercion
mkPiCos :: Role -> [Var] -> Coercion -> Coercion
mkCoCast :: Coercion -> CoercionR -> 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
mkNthCo :: HasDebugCallStack => Role -> Int -> Coercion -> Coercion
-- | Extract the nth field of a FunCo
mkNthCoFunCo :: Int -> CoercionN -> Coercion -> Coercion -> Coercion
-- | If you're about to call mkNthCo r n co, then r
-- should be whatever nthCoRole n co returns.
nthCoRole :: Int -> Coercion -> Role
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 -> CoercionN -> Coercion -> Coercion -> Coercion
mkFunResCo :: Role -> Scaled Type -> Coercion -> Coercion
-- | Make a Coercion from a tycovar, a kind coercion, and a body coercion.
-- The kind of the tycovar should be the left-hand kind of the kind
-- coercion. See Note [Unused coercion variable in ForAllCo]
mkForAllCo :: TyCoVar -> CoercionN -> Coercion -> Coercion
-- | Make nested ForAllCos
mkForAllCos :: [(TyCoVar, CoercionN)] -> Coercion -> Coercion
-- | Make a Coercion quantified over a type/coercion variable; the variable
-- has the same type in both sides of the coercion
mkHomoForAllCos :: [TyCoVar] -> 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 coercion from a coercion hole
mkHoleCo :: CoercionHole -> Coercion
-- | Make a universal coercion between two arbitrary types.
mkUnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
mkSubCo :: HasDebugCallStack => Coercion -> Coercion
mkAxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion
-- | Make a "coercion between coercions".
mkProofIrrelCo :: Role -> CoercionN -> 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
mkAxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion
-- | Given ty :: k1, co :: k1 ~ k2, produces co' ::
-- ty ~r (ty |> co)
mkGReflRightCo :: Role -> Type -> CoercionN -> Coercion
-- | Given ty :: k1, co :: k1 ~ k2, produces co' ::
-- (ty |> co) ~r ty
mkGReflLeftCo :: Role -> Type -> CoercionN -> Coercion
-- | Given ty :: k1, co :: k1 ~ k2, co2:: ty ~r
-- ty', produces @co' :: (ty |> co) ~r ty' It is not only a
-- utility function, but it saves allocation when co is a GRefl coercion.
mkCoherenceLeftCo :: Role -> Type -> CoercionN -> Coercion -> Coercion
-- | Given ty :: k1, co :: k1 ~ k2, co2:: ty' ~r
-- ty, produces @co' :: ty' ~r (ty |> co) It is not only a
-- utility function, but it saves allocation when co is a GRefl coercion.
mkCoherenceRightCo :: Role -> Type -> CoercionN -> Coercion -> Coercion
-- | 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 ~r t2,
-- has type (t1 |> h1) ~r (t2 |> h2). h1 and
-- h2 must be nominal. It calls coercionKindRole, so
-- it's quite inefficient (which I stands for) Use
-- castCoercionKind2 instead if t1, t2, and
-- r are known beforehand.
castCoercionKind :: Coercion -> CoercionN -> CoercionN -> Coercion
-- | castCoercionKind1 g r t1 t2 h = coercionKind g r t1 t2 h
-- h That is, it's a specialised form of castCoercionKind, where the
-- two kind coercions are identical castCoercionKind1 g r t1 t2
-- h, where g :: t1 ~r t2, has type (t1 |> h) ~r (t2
-- |> h). h must be nominal. See Note
-- [castCoercionKind1]
castCoercionKind1 :: Coercion -> Role -> Type -> Type -> CoercionN -> Coercion
-- | Creates a new coercion with both of its types casted by different
-- casts castCoercionKind2 g r t1 t2 h1 h2, where g :: t1 ~r
-- t2, has type (t1 |> h1) ~r (t2 |> h2). h1
-- and h2 must be nominal.
castCoercionKind2 :: Coercion -> Role -> Type -> Type -> CoercionN -> CoercionN -> Coercion
-- | Given a family instance TyCon and its arg Coercions,
-- return the corresponding family Coercion. E.g:
--
--
-- data family T a
-- data instance T (Maybe b) = MkT b
--
--
-- Where the instance TyCon is :RTL, so:
--
--
-- mkFamilyTyConAppCo :RTL (co :: a ~# Int) = T (Maybe a) ~# T (Maybe Int)
--
--
-- cf. mkFamilyTyConApp
mkFamilyTyConAppCo :: TyCon -> [CoercionN] -> CoercionN
mkHeteroCoercionType :: Role -> Kind -> Kind -> Type -> Type -> Type
-- | 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
-- | Creates a primitive 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
-- | 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 : ty ~ 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 [r1, r2, r3] = [nth r1 0 c, nth r2 1 c, nth r3 2 c]
--
decomposeCo :: Arity -> Coercion -> [Role] -> [Coercion]
decomposeFunCo :: HasDebugCallStack => Role -> Coercion -> (CoercionN, Coercion, Coercion)
decomposePiCos :: HasDebugCallStack => CoercionN -> Pair Type -> [Type] -> ([CoercionN], CoercionN)
-- | 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 (TyCoVar, Coercion, Coercion)
-- | Like splitForAllCo_maybe, but only returns Just for tyvar
-- binder
splitForAllCo_ty_maybe :: Coercion -> Maybe (TyVar, Coercion, Coercion)
-- | Like splitForAllCo_maybe, but only returns Just for covar
-- binder
splitForAllCo_co_maybe :: Coercion -> Maybe (CoVar, 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 :: Role -> Coercion -> Maybe Coercion
pickLR :: LeftOrRight -> (a, a) -> a
-- | Tests if this coercion is obviously a generalized reflexive coercion.
-- Guaranteed to work very quickly.
isGReflCo :: Coercion -> Bool
-- | 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)
-- | Returns the type coerced if this coercion is a generalized reflexive
-- coercion. Guaranteed to work very quickly.
isGReflCo_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 :: Var -> Maybe Coercion
-- | Tests if this MCoercion is obviously generalized reflexive Guaranteed
-- to work very quickly.
isGReflMCo :: MCoercion -> Bool
mkGReflLeftMCo :: Role -> Type -> MCoercionN -> Coercion
mkGReflRightMCo :: Role -> Type -> MCoercionN -> Coercion
-- | Like mkCoherenceRightCo, but with an MCoercion
mkCoherenceRightMCo :: Role -> Type -> MCoercionN -> Coercion -> Coercion
coToMCo :: Coercion -> MCoercion
-- | Compose two MCoercions via transitivity
mkTransMCo :: MCoercion -> MCoercion -> MCoercion
mkTransMCoL :: MCoercion -> Coercion -> MCoercion
mkTransMCoR :: Coercion -> MCoercion -> MCoercion
-- | Cast a type by an MCoercion
mkCastTyMCo :: Type -> MCoercion -> Type
-- | Get the reverse of an MCoercion
mkSymMCo :: MCoercion -> MCoercion
mkHomoForAllMCo :: TyCoVar -> MCoercion -> MCoercion
mkFunResMCo :: Scaled Type -> MCoercionR -> MCoercionR
mkPiMCos :: [Var] -> MCoercion -> MCoercion
isReflMCo :: MCoercion -> Bool
checkReflexiveMCo :: MCoercion -> MCoercion
mkCoVar :: Name -> Type -> CoVar
-- | Is this a coercion variable? Satisfies isId v ==>
-- isCoVar v == not (isNonCoVarId v).
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
anyFreeVarsOfCo :: (TyCoVar -> Bool) -> Coercion -> Bool
-- | 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 :: HasDebugCallStack => TCvSubst -> Coercion -> Coercion
-- | Substitute within several Coercions The substitution has to
-- satisfy the invariants described in Note [The substitution invariant].
substCos :: HasDebugCallStack => TCvSubst -> [Coercion] -> [Coercion]
substCoVar :: TCvSubst -> CoVar -> Coercion
substCoVars :: TCvSubst -> [CoVar] -> [Coercion]
-- | Coercion substitution, see zipTvSubst
substCoWith :: HasDebugCallStack => [TyVar] -> [Type] -> Coercion -> Coercion
substCoVarBndr :: HasDebugCallStack => 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 :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion
liftCoSubstTyVar :: LiftingContext -> Role -> TyVar -> Maybe Coercion
liftCoSubstWith :: Role -> [TyCoVar] -> [Coercion] -> Type -> Coercion
liftCoSubstWithEx :: Role -> [TyVar] -> [Coercion] -> [TyCoVar] -> [Type] -> (Type -> Coercion, [Type])
emptyLiftingContext :: InScopeSet -> LiftingContext
-- | Extend a lifting context with a new mapping.
extendLiftingContext :: LiftingContext -> TyCoVar -> Coercion -> LiftingContext
-- | Extend a lifting context with a new mapping, and extend the in-scope
-- set
extendLiftingContextAndInScope :: LiftingContext -> TyCoVar -> Coercion -> LiftingContext
liftCoSubstVarBndrUsing :: (r -> CoercionN) -> (LiftingContext -> Type -> r) -> LiftingContext -> TyCoVar -> (LiftingContext, TyCoVar, r)
-- | 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
substForAllCoBndrUsingLC :: Bool -> (Coercion -> Coercion) -> LiftingContext -> TyCoVar -> Coercion -> (LiftingContext, TyCoVar, 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
pprCoAxiom :: CoAxiom br -> SDoc
pprCoAxBranch :: TyCon -> CoAxBranch -> SDoc
pprCoAxBranchLHS :: TyCon -> CoAxBranch -> SDoc
pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc
tidyCoAxBndrsForUser :: TidyEnv -> [Var] -> (TidyEnv, [Var])
etaExpandCoAxBranch :: CoAxBranch -> ([TyVar], [Type], Type)
-- | Tidy a Coercion
--
-- See Note [Strictness in tidyType and friends]
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 -> CoercionN
-- | Assuming that two types are the same, ignoring coercions, find a
-- nominal coercion between the types. This is useful when optimizing
-- transitivity over coercion applications, where splitting two AppCos
-- might yield different kinds. See Note [EtaAppCo] in
-- GHC.Core.Coercion.Opt.
buildCoercion :: Type -> Type -> CoercionN
multToCo :: Mult -> Coercion
-- | Is there a coercion hole in this type?
hasCoercionHoleTy :: Type -> Bool
-- | Is there a coercion hole in this coercion?
hasCoercionHoleCo :: Coercion -> Bool
hasThisCoercionHoleTy :: Type -> CoercionHole -> Bool
-- | Set the type of a CoercionHole
setCoHoleType :: CoercionHole -> Type -> CoercionHole
instance GHC.Utils.Outputable.Outputable GHC.Core.Coercion.LiftingContext
instance GHC.Utils.Outputable.Outputable ev => GHC.Utils.Outputable.Outputable (GHC.Core.Coercion.NormaliseStepResult ev)
module GHC.Core.Predicate
-- | A predicate in the solver. The solver tries to prove Wanted predicates
-- from Given ones.
data Pred
-- | A typeclass predicate.
ClassPred :: Class -> [Type] -> Pred
-- | A type equality predicate.
EqPred :: EqRel -> Type -> Type -> Pred
-- | An irreducible predicate.
IrredPred :: PredType -> Pred
-- | A quantified predicate.
--
-- See Note [Quantified constraints] in GHC.Tc.Solver.Canonical
ForAllPred :: [TyVar] -> [PredType] -> PredType -> Pred
-- | A special predicate, used internally in GHC.
--
-- See #20000.
SpecialPred :: SpecialPred -> Pred
classifyPredType :: PredType -> Pred
isPredTy :: HasDebugCallStack => Type -> Bool
isEvVarType :: Type -> Bool
-- | 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
isEqPrimPred :: PredType -> Bool
isEqPred :: PredType -> Bool
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
-- | 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
-- | Creates a primitive 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
-- | SpecialPred describes all the special predicates that are
-- currently used in GHC.
--
-- These are different from the special typeclasses (such as
-- KnownNat, Typeable, Coercible, ...), as
-- special predicates can't be expressed as typeclasses, as they hold
-- evidence of a different kind.
data SpecialPred
-- | 'IsRefl#'.
IsReflPrimPred :: Type -> Type -> SpecialPred
mkIsReflPrimPred :: Type -> Type -> PredType
isIsReflPrimPred :: Pred -> Bool
mkClassPred :: Class -> [Type] -> PredType
isDictTy :: Type -> Bool
isClassPred :: PredType -> Bool
isEqPredClass :: Class -> Bool
isCTupleClass :: Class -> Bool
getClassPredTys :: HasDebugCallStack => PredType -> (Class, [Type])
getClassPredTys_maybe :: PredType -> Maybe (Class, [Type])
classMethodTy :: Id -> Type
classMethodInstTy :: Id -> [Type] -> Type
isIPLikePred :: Type -> Bool
hasIPSuperClasses :: Class -> [Type] -> Bool
isIPTyCon :: TyCon -> Bool
isIPClass :: Class -> 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 :: Class -> [Type] -> Maybe FastString
isCallStackPredTy :: Type -> Bool
-- | Decomposes a predicate if it is an implicit parameter. Does not look
-- in superclasses. See also [Local implicit parameters].
isIPPred_maybe :: Type -> Maybe (FastString, Type)
-- | Dictionary Identifier
type DictId = EvId
isEvVar :: Var -> Bool
isDictId :: Id -> Bool
instance GHC.Classes.Ord GHC.Core.Predicate.EqRel
instance GHC.Classes.Eq GHC.Core.Predicate.EqRel
instance GHC.Utils.Outputable.Outputable GHC.Core.Predicate.SpecialPred
instance GHC.Utils.Outputable.Outputable GHC.Core.Predicate.EqRel
module GHC.Core.Reduction
-- | A Reduction is the result of an operation that rewrites a type
-- ty_in. The Reduction includes the rewritten type
-- ty_out and a Coercion co such that co ::
-- ty_in ~ ty_out, where the role of the coercion is determined by
-- the context. That is, the LHS type of the coercion is the original
-- type ty_in, while its RHS type is the rewritten type
-- ty_out.
--
-- A Reduction is always homogeneous, unless it is wrapped inside a
-- HetReduction, which separately stores the kind coercion.
--
-- See Note [The Reduction type].
data Reduction
Reduction :: Coercion -> !Type -> Reduction
[reductionCoercion] :: Reduction -> Coercion
[reductionReducedType] :: Reduction -> !Type
-- | A Reduction in which the Coercion has Nominal
-- role.
type ReductionN = Reduction
-- | A Reduction in which the Coercion has
-- Representational role.
type ReductionR = Reduction
-- | Stores a heterogeneous reduction.
--
-- The stored kind coercion must relate the kinds of the stored
-- reduction. That is, in HetReduction (Reduction co xi) kco, we
-- must have:
--
--
-- co :: ty ~ xi
-- kco :: typeKind ty ~ typeKind xi
--
data HetReduction
HetReduction :: Reduction -> MCoercionN -> HetReduction
-- | A collection of Reductions where the coercions and the types
-- are stored separately.
--
-- Use unzipRedns to obtain Reductions from a list of
-- Reductions.
--
-- This datatype is used in mkAppRedns, mkClassPredRedns
-- and mkTyConAppRedn, which expect separate types and coercions.
--
-- Invariant: the two stored lists are of the same length, and the RHS
-- type of each coercion is the corresponding type.
data Reductions
Reductions :: [Coercion] -> [Type] -> Reductions
-- | Create a Reduction from a pair of a Coercion and a
-- 'Type.
--
-- Pre-condition: the RHS type of the coercion matches the provided type
-- (perhaps up to zonking).
--
-- Use coercionRedn when you only have the coercion.
mkReduction :: Coercion -> Type -> Reduction
-- | Create Reductions from individual lists of coercions and types.
--
-- The lists should be of the same length, and the RHS type of each
-- coercion should match the specified type in the other list.
mkReductions :: [Coercion] -> [Type] -> Reductions
-- | Create a heterogeneous reduction.
--
-- Pre-condition: the provided kind coercion (second argument) relates
-- the kinds of the stored reduction. That is, if the coercion stored in
-- the Reduction is of the form
--
--
-- co :: ty ~ xi
--
--
-- Then the kind coercion supplied must be of the form:
--
--
-- kco :: typeKind ty ~ typeKind xi
--
mkHetReduction :: Reduction -> MCoercionN -> HetReduction
-- | Turn a Coercion into a Reduction by inspecting the RHS
-- type of the coercion.
--
-- Prefer using mkReduction when you already know the RHS type of
-- the coercion, to avoid computing it anew.
coercionRedn :: Coercion -> Reduction
-- | Get the original, unreduced type corresponding to a Reduction.
--
-- This is obtained by computing the LHS kind of the stored coercion,
-- which may be slow.
reductionOriginalType :: Reduction -> Type
-- | Downgrade the role of the coercion stored in the Reduction.
downgradeRedn :: Role -> Role -> Reduction -> Reduction
-- | Downgrade the role of the coercion stored in the Reduction,
-- from Nominal to Representational.
mkSubRedn :: Reduction -> Reduction
-- | Compose a reduction with a coercion on the left.
--
-- Pre-condition: the provided coercion's RHS type must match the LHS
-- type of the coercion that is stored in the reduction.
mkTransRedn :: Coercion -> Reduction -> Reduction
-- | Apply a cast to the result of a Reduction.
--
-- Given a Reduction ty1 ~co1~> (ty2 :: k2) and a kind
-- coercion kco with LHS kind k2, produce a new
-- Reduction ty1 ~co2~> ( ty2 |> kco ) of the given
-- Role (which must match the role of the coercion stored in the
-- Reduction argument).
mkCoherenceRightRedn :: Role -> Reduction -> CoercionN -> Reduction
-- | Apply a cast to the result of a Reduction, using an
-- MCoercionN.
--
-- Given a Reduction ty1 ~co1~> (ty2 :: k2) and a kind
-- coercion mco with LHS kind k2, produce a new
-- Reduction ty1 ~co2~> ( ty2 |> mco ) of the given
-- Role (which must match the role of the coercion stored in the
-- Reduction argument).
mkCoherenceRightMRedn :: Role -> Reduction -> MCoercionN -> Reduction
-- | Apply a cast to a Reduction, casting both the original and the
-- reduced type.
--
-- Given cast_co and Reduction ty ~co~> xi,
-- this function returns the Reduction (ty |> cast_co)
-- ~return_co~> (xi |> cast_co) of the given Role
-- (which must match the role of the coercion stored in the
-- Reduction argument).
--
-- Pre-condition: the Type passed in is the same as the LHS type
-- of the coercion stored in the Reduction.
mkCastRedn1 :: Role -> Type -> CoercionN -> Reduction -> Reduction
-- | Apply casts on both sides of a Reduction (of the given
-- Role).
--
-- Use mkCastRedn1 when you want to cast both the original and
-- reduced types in a Reduction using the same coercion.
--
-- Pre-condition: the Type passed in is the same as the LHS type
-- of the coercion stored in the Reduction.
mkCastRedn2 :: Role -> Type -> CoercionN -> Reduction -> CoercionN -> Reduction
-- | The reflexive reduction.
mkReflRedn :: Role -> Type -> Reduction
-- | Create a Reduction from a kind cast, in which the casted type
-- is the rewritten type.
--
-- Given ty :: k1, mco :: k1 ~ k2, produces the
-- Reduction ty ~res_co~> (ty |> mco) at the given
-- Role.
mkGReflRightRedn :: Role -> Type -> CoercionN -> Reduction
-- | Create a Reduction from a kind cast, in which the casted type
-- is the rewritten type.
--
-- Given ty :: k1, mco :: k1 ~ k2, produces the
-- Reduction ty ~res_co~> (ty |> mco) at the given
-- Role.
mkGReflRightMRedn :: Role -> Type -> MCoercionN -> Reduction
-- | Create a Reduction from a kind cast, in which the casted type
-- is the original (non-rewritten) type.
--
-- Given ty :: k1, mco :: k1 ~ k2, produces the
-- Reduction (ty |> mco) ~res_co~> ty at the given
-- Role.
mkGReflLeftRedn :: Role -> Type -> CoercionN -> Reduction
-- | Create a Reduction from a kind cast, in which the casted type
-- is the original (non-rewritten) type.
--
-- Given ty :: k1, mco :: k1 ~ k2, produces the
-- Reduction (ty |> mco) ~res_co~> ty at the given
-- Role.
mkGReflLeftMRedn :: Role -> Type -> MCoercionN -> Reduction
-- | Apply one Reduction to another.
--
-- Combines mkAppCo and mkAppTy.
mkAppRedn :: Reduction -> Reduction -> Reduction
-- | Combines mkAppCos and mkAppTys.
mkAppRedns :: Reduction -> Reductions -> Reduction
-- | Create a function Reduction.
--
-- Combines mkFunCo and mkFunTy.
mkFunRedn :: Role -> AnonArgFlag -> ReductionN -> Reduction -> Reduction -> Reduction
-- | Create a Reduction associated to a Π type, from a kind
-- Reduction and a body Reduction.
--
-- Combines mkForAllCo and mkForAllTy.
mkForAllRedn :: ArgFlag -> TyVar -> ReductionN -> Reduction -> Reduction
-- | Create a Reduction of a quantified type from a Reduction
-- of the body.
--
-- Combines mkHomoForAllCos and mkForAllTys.
mkHomoForAllRedn :: [TyVarBinder] -> Reduction -> Reduction
-- | TyConAppCo for Reductions: combines
-- mkTyConAppCo and mkTyConApp.
mkTyConAppRedn :: Role -> TyCon -> Reductions -> Reduction
-- | Reduce the arguments of a Class TyCon.
mkClassPredRedn :: Class -> Reductions -> Reduction
-- | Create a Reduction from a coercion between coercions.
--
-- Combines mkProofIrrelCo and mkCoercionTy.
mkProofIrrelRedn :: Role -> CoercionN -> Coercion -> Coercion -> Reduction
-- | Create a reflexive Reduction whose RHS is the given
-- Coercion, with the specified Role.
mkReflCoRedn :: Role -> Coercion -> Reduction
-- | Homogenise a heterogeneous reduction.
--
-- Given HetReduction (Reduction co xi) kco, with
--
--
-- co :: ty ~ xi
-- kco :: typeKind(ty) ~ typeKind(xi)
--
--
-- this returns the homogeneous reduction:
--
--
-- hco :: ty ~ ( xi |> sym kco )
--
homogeniseHetRedn :: Role -> HetReduction -> Reduction
-- | Obtain Reductions from a list of Reductions by
-- unzipping.
unzipRedns :: [Reduction] -> Reductions
-- | Stores Reductions as well as a kind coercion.
--
-- Used when rewriting arguments to a type function f.
--
-- Invariant: when the stored reductions are of the form co_i :: ty_i ~
-- xi_i, the kind coercion is of the form kco :: typeKind (f ty_1 ...
-- ty_n) ~ typeKind (f xi_1 ... xi_n)
--
-- The type function f depends on context.
data ArgsReductions
ArgsReductions :: {-# UNPACK #-} !Reductions -> !MCoercionN -> ArgsReductions
simplifyArgsWorker :: HasDebugCallStack => [TyCoBinder] -> Kind -> TyCoVarSet -> [Role] -> [Reduction] -> ArgsReductions
instance GHC.Utils.Outputable.Outputable GHC.Core.Reduction.Reduction
module GHC.Core.Map.Type
class TrieMap m where {
type family Key m :: Type;
}
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
filterTM :: TrieMap m => (a -> Bool) -> m a -> m a
foldTM :: TrieMap m => (a -> b -> b) -> m a -> b -> b
type XT a = Maybe a -> Maybe a
-- | 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
extendCME :: CmEnv -> Var -> CmEnv
extendCMEs :: CmEnv -> [Var] -> CmEnv
emptyCME :: CmEnv
-- | TypeMapG a is a map from DeBruijn Type to
-- a. The extended key makes it suitable for recursive
-- traversal, since it can track binders, but it is strictly internal to
-- this module. If you are including a TypeMap inside another
-- TrieMap, this is the type you want. Note that this lookup does
-- not do a kind-check. Thus, all keys in this map must have the same
-- kind. Also note that this map respects the distinction between
-- Type and Constraint, despite the fact that they are
-- equivalent type synonyms in Core.
type TypeMapG = GenMap TypeMapX
type CoercionMapG = GenMap CoercionMapX
-- | DeBruijn a represents a modulo alpha-renaming. This
-- is achieved by equipping the value with a CmEnv, which tracks
-- an on-the-fly deBruijn numbering. This allows us to define an
-- Eq instance for DeBruijn a, even if this was not
-- (easily) possible for a. Note: we purposely don't export the
-- constructor. Make a helper function if you find yourself needing it.
data DeBruijn a
D :: CmEnv -> a -> DeBruijn a
-- | Synthesizes a DeBruijn a from an a, by assuming that
-- there are no bound binders (an empty CmEnv). This is usually
-- what you want if there isn't already a CmEnv in scope.
deBruijnize :: a -> DeBruijn a
eqDeBruijnType :: DeBruijn Type -> DeBruijn Type -> Bool
eqDeBruijnVar :: DeBruijn Var -> DeBruijn Var -> Bool
-- | A BndrMap is a TypeMapG which allows us to distinguish
-- between binding forms whose binders have different types. For example,
-- if we are doing a TrieMap lookup on (x :: Int) ->
-- (), we should not pick up an entry in the TrieMap for
-- (x :: Bool) -> (): we can disambiguate this by matching on
-- the type (or kind, if this a binder in a type) of the binder.
--
-- We also need to do the same for multiplicity! Which, since
-- multiplicities are encoded simply as a Type, amounts to have a
-- Trie for a pair of types. Tries of pairs are composition.
data BndrMap a
xtBndr :: forall a. CmEnv -> Var -> XT a -> BndrMap a -> BndrMap a
lkBndr :: CmEnv -> Var -> BndrMap a -> Maybe a
data VarMap a
xtVar :: CmEnv -> Var -> XT a -> VarMap a -> VarMap a
lkVar :: CmEnv -> Var -> VarMap a -> Maybe a
lkDFreeVar :: Var -> DVarEnv a -> Maybe a
xtDFreeVar :: Var -> XT a -> DVarEnv a -> DVarEnv a
xtDNamed :: NamedThing n => n -> XT a -> DNameEnv a -> DNameEnv a
lkDNamed :: NamedThing n => n -> DNameEnv a -> Maybe a
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.CoercionMap
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.CoercionMapX
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.TypeMap
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.LooseTypeMap
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.TypeMapX
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Core.Map.Type.TypeMapG a)
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.BndrMap
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.VarMap
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn GHC.Core.TyCo.Rep.Coercion)
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn GHC.Core.TyCo.Rep.Type)
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn GHC.Types.Var.Var)
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn a) => GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn [a])
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn a) => GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn (GHC.Maybe.Maybe a))
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Type.TyLitMap
module GHC.Core.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.
-- See also Note [tcMatchTy vs tcMatchTyKi]
tcMatchTy :: Type -> Type -> Maybe TCvSubst
-- | Like tcMatchTy, but allows the kinds of the types to differ,
-- and thus matches them as well. See also Note [tcMatchTy vs
-- tcMatchTyKi]
tcMatchTyKi :: Type -> Type -> Maybe TCvSubst
-- | Like tcMatchTy but over a list of types. See also Note
-- [tcMatchTy vs tcMatchTyKi]
tcMatchTys :: [Type] -> [Type] -> Maybe TCvSubst
-- | Like tcMatchTyKi but over a list of types. See also Note
-- [tcMatchTy vs tcMatchTyKi]
tcMatchTyKis :: [Type] -> [Type] -> Maybe TCvSubst
-- | This is similar to tcMatchTy, but extends a substitution See
-- also Note [tcMatchTy vs tcMatchTyKi]
tcMatchTyX :: TCvSubst -> Type -> Type -> Maybe TCvSubst
-- | Like tcMatchTys, but extending a substitution See also Note
-- [tcMatchTy vs tcMatchTyKi]
tcMatchTysX :: TCvSubst -> [Type] -> [Type] -> Maybe TCvSubst
-- | Like tcMatchTyKis, but extending a substitution See also Note
-- [tcMatchTy vs tcMatchTyKi]
tcMatchTyKisX :: TCvSubst -> [Type] -> [Type] -> Maybe TCvSubst
tcMatchTyX_BM :: BindFun -> 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
data RoughMatchTc
RM_KnownTc :: Name -> RoughMatchTc
RM_WildCard :: RoughMatchTc
roughMatchTcs :: [Type] -> [RoughMatchTc]
roughMatchTcsLookup :: [Type] -> [RoughMatchLookupTc]
instanceCantMatch :: [RoughMatchTc] -> [RoughMatchTc] -> 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
isRoughWildcard :: RoughMatchTc -> 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 :: BindFun -> [Type] -> [Type] -> Maybe TCvSubst
-- | Like tcUnifyTys but also unifies the kinds
tcUnifyTyKis :: BindFun -> [Type] -> [Type] -> Maybe TCvSubst
-- | tcUnifyTysFG bind_tv tys1 tys2 attempts 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 :: BindFun -> [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
-- | Some unification functions are parameterised by a BindFun,
-- which says whether or not to allow a certain unification to take
-- place. A BindFun takes the TyVar involved along with the
-- Type it will potentially be bound to.
--
-- It is possible for the variable to actually be a coercion variable
-- (Note [Matching coercion variables]), but only when one-way matching.
-- In this case, the Type will be a CoercionTy.
type BindFun = TyCoVar -> Type -> BindFlag
data BindFlag
-- | A regular type variable
BindMe :: BindFlag
-- | Declare that this type variable is apart from the type
-- provided. That is, the type variable will never be instantiated to
-- that type. See also Note [Binding when looking up instances] in
-- GHC.Core.InstEnv.
Apart :: BindFlag
-- | Allow binding only for any variable in the set. Variables may be bound
-- to any type. Used when doing simple matching; e.g. can we find a
-- substitution
--
--
-- S = [a :-> t1, b :-> t2] such that
-- S( Maybe (a, b->Int ) = Maybe (Bool, Char -> Int)
--
matchBindFun :: TyCoVarSet -> BindFun
-- | Allow the binding of any variable to any type
alwaysBindFun :: BindFun
type UnifyResult = UnifyResultM TCvSubst
-- | See Note [Unification result]
data UnifyResultM a
Unifiable :: a -> UnifyResultM a
MaybeApart :: MaybeApartReason -> a -> UnifyResultM a
SurelyApart :: UnifyResultM a
-- | Why are two types MaybeApart? MARInfinite takes
-- precedence: This is used (only) in Note [Infinitary substitution in
-- lookup] in GHC.Core.InstEnv As of Feb 2022, we never differentiate
-- between MARTypeFamily and MARTypeVsConstraint; it's really only
-- MARInfinite that's interesting here.
data MaybeApartReason
-- | matching e.g. F Int ~? Bool
MARTypeFamily :: MaybeApartReason
-- | matching e.g. a ~? Maybe a
MARInfinite :: MaybeApartReason
-- | matching Type ~? Constraint See Note [coreView vs tcView] in
-- GHC.Core.Type
MARTypeVsConstraint :: MaybeApartReason
-- | liftCoMatch is sort of inverse to liftCoSubst. In
-- particular, if liftCoMatch vars ty co == Just s, then
-- liftCoSubst 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
flattenTys :: InScopeSet -> [Type] -> [Type]
flattenTysX :: InScopeSet -> [Type] -> ([Type], TyVarEnv (TyCon, [Type]))
instance GHC.Base.Functor GHC.Core.Unify.UnifyResultM
instance GHC.Classes.Eq GHC.Core.Unify.BindFlag
instance GHC.Base.Functor GHC.Core.Unify.UM
instance GHC.Base.Applicative GHC.Core.Unify.UM
instance GHC.Base.Monad GHC.Core.Unify.UM
instance Control.Monad.Fail.MonadFail GHC.Core.Unify.UM
instance GHC.Base.Applicative GHC.Core.Unify.UnifyResultM
instance GHC.Base.Monad GHC.Core.Unify.UnifyResultM
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Core.Unify.UnifyResultM a)
instance GHC.Utils.Outputable.Outputable GHC.Core.Unify.MaybeApartReason
instance GHC.Base.Semigroup GHC.Core.Unify.MaybeApartReason
module GHC.Core.FamInstEnv
data FamInst
FamInst :: CoAxiom Unbranched -> FamFlavor -> Name -> [RoughMatchTc] -> [TyVar] -> [CoVar] -> [Type] -> Type -> FamInst
[fi_axiom] :: FamInst -> CoAxiom Unbranched
[fi_flavor] :: FamInst -> FamFlavor
[fi_fam] :: FamInst -> Name
[fi_tcs] :: FamInst -> [RoughMatchTc]
[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 -> [RoughMatchTc] -> CoAxiom Unbranched -> FamInst
type FamInstEnvs = (FamInstEnv, FamInstEnv)
data FamInstEnv
emptyFamInstEnv :: FamInstEnv
-- | Create a FamInstEnv from Name indices. INVARIANTS: * The
-- fs_tvs are distinct in each FamInst of a range value of the map (so we
-- can safely unify them)
emptyFamInstEnvs :: (FamInstEnv, FamInstEnv)
-- | Makes no particular effort to detect conflicts.
unionFamInstEnv :: FamInstEnv -> FamInstEnv -> FamInstEnv
extendFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv
extendFamInstEnvList :: FamInstEnv -> [FamInst] -> FamInstEnv
famInstEnvElts :: FamInstEnv -> [FamInst]
famInstEnvSize :: FamInstEnv -> Int
familyInstances :: (FamInstEnv, FamInstEnv) -> TyCon -> [FamInst]
familyNameInstances :: (FamInstEnv, FamInstEnv) -> Name -> [FamInst]
mkCoAxBranch :: [TyVar] -> [TyVar] -> [CoVar] -> [Type] -> Type -> [Role] -> SrcSpan -> CoAxBranch
mkBranchedCoAxiom :: Name -> TyCon -> [CoAxBranch] -> CoAxiom Branched
mkUnbranchedCoAxiom :: Name -> TyCon -> CoAxBranch -> CoAxiom Unbranched
mkSingleCoAxiom :: Role -> Name -> [TyVar] -> [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 -> [FamInst]
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.
--
-- Always operates homogeneously: the returned type has the same kind as
-- the original type, and the returned coercion is always homogeneous.
topNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe Reduction
normaliseType :: FamInstEnvs -> Role -> Type -> Reduction
normaliseTcApp :: FamInstEnvs -> Role -> TyCon -> [Type] -> Reduction
-- | Try to simplify a type-family application, by *one* step If
-- topReduceTyFamApp_maybe env r F tys = Just (HetReduction (Reduction co
-- rhs) res_co) then co :: F tys ~R# rhs res_co :: typeKind(F tys) ~
-- typeKind(rhs) Type families and data families; always Representational
-- role
topReduceTyFamApp_maybe :: FamInstEnvs -> TyCon -> [Type] -> Maybe HetReduction
reduceTyFamApp_maybe :: FamInstEnvs -> Role -> TyCon -> [Type] -> Maybe Reduction
instance GHC.Base.Functor GHC.Core.FamInstEnv.NormM
instance GHC.Base.Monad GHC.Core.FamInstEnv.NormM
instance GHC.Base.Applicative GHC.Core.FamInstEnv.NormM
instance GHC.Utils.Outputable.Outputable GHC.Core.FamInstEnv.FamInstMatch
instance GHC.Utils.Outputable.Outputable GHC.Core.FamInstEnv.FamInstEnv
instance GHC.Types.Name.NamedThing GHC.Core.FamInstEnv.FamInst
instance GHC.Utils.Outputable.Outputable GHC.Core.FamInstEnv.FamInst
module GHC.Core.DataCon
-- | A data constructor
--
--
data DataCon
-- | Data Constructor Representation See Note [Data constructor workers and
-- wrappers]
data DataConRep
NoDataConRep :: DataConRep
DCR :: Id -> DataConBoxer -> [Scaled Type] -> [StrictnessMark] -> [HsImplBang] -> DataConRep
[dcr_wrap_id] :: DataConRep -> Id
[dcr_boxer] :: DataConRep -> DataConBoxer
[dcr_arg_tys] :: DataConRep -> [Scaled 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, or one with an unlifted type
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
-- | A *one-index* constructor tag
--
-- Type of the tags associated with each constructor possibility or
-- superclass selector
type ConTag = Int
type DataConEnv a = UniqFM DataCon a
-- | An EqSpec is a tyvar/type pair representing an equality made in
-- rejigging a GADT constructor
data EqSpec
-- | Make a non-dependent 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 TyVars mentioned in an EqSpec.
filterEqSpec :: [EqSpec] -> [TyVar] -> [TyVar]
-- | Fields in an algebraic record type; see Note [FieldLabel].
data FieldLabel
FieldLabel :: FieldLabelString -> DuplicateRecordFields -> FieldSelectors -> Name -> FieldLabel
-- | User-visible label of the field
[flLabel] :: FieldLabel -> FieldLabelString
-- | Was DuplicateRecordFields on in the defining module for this
-- datatype?
[flHasDuplicateRecordFields] :: FieldLabel -> DuplicateRecordFields
-- | Was FieldSelectors enabled in the defining module for this
-- datatype? See Note [NoFieldSelectors] in GHC.Rename.Env
[flHasFieldSelector] :: FieldLabel -> FieldSelectors
-- | Record selector function
[flSelector] :: FieldLabel -> 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] -> [TyVar] -> [TyCoVar] -> [InvisTVBinder] -> [EqSpec] -> KnotTied ThetaType -> [KnotTied (Scaled Type)] -> KnotTied Type -> RuntimeRepInfo -> KnotTied TyCon -> ConTag -> ThetaType -> Id -> DataConRep -> DataCon
-- | 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
-- | Instantiate the universal tyvars of a data con, returning (
-- instantiated existentials , instantiated constraints including
-- dependent GADT equalities which are *also* listed in the instantiated
-- existentials , instantiated args)
dataConInstSig :: DataCon -> [Type] -> ([TyCoVar], ThetaType, [Type])
-- | The "full signature" of the DataCon returns, in order:
--
-- 1) The result of dataConUnivTyVars
--
-- 2) The result of dataConExTyCoVars
--
-- 3) The non-dependent GADT equalities. Dependent GADT equalities are
-- implied by coercion variables in return value (2).
--
-- 4) The other constraints of the data constructor type, excluding GADT
-- equalities
--
-- 5) The original argument types to the DataCon (i.e. before any
-- change of the representation of the type) with linearity annotations
--
-- 6) The original result type of the DataCon
dataConFullSig :: DataCon -> ([TyVar], [TyCoVar], [EqSpec], ThetaType, [Scaled 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 -> ByteString
-- | The tag used for ordering DataCons
dataConTag :: DataCon -> ConTag
dataConTagZ :: DataCon -> ConTagZ
-- | 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
--
--
-- The type variables are quantified in the order that the user wrote
-- them. See Note [DataCon user type variable binders].
--
-- NB: If the constructor is part of a data instance, the result type
-- mentions the family tycon, not the internal one.
dataConWrapperType :: DataCon -> Type
dataConNonlinearType :: DataCon -> Type
dataConDisplayType :: Bool -> DataCon -> Type
-- | The universally-quantified type variables of the constructor
dataConUnivTyVars :: DataCon -> [TyVar]
-- | The existentially-quantified type/coercion variables of the
-- constructor including dependent (kind-) GADT equalities
dataConExTyCoVars :: DataCon -> [TyCoVar]
-- | Both the universal and existential type/coercion variables of the
-- constructor
dataConUnivAndExTyCoVars :: DataCon -> [TyCoVar]
-- | The type variables of the constructor, in the order the user wrote
-- them
dataConUserTyVars :: DataCon -> [TyVar]
-- | InvisTVBinders for the type variables of the constructor, in
-- the order the user wrote them
dataConUserTyVarBinders :: DataCon -> [InvisTVBinder]
-- | 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, including dependent
-- GADT equalities.
dataConTheta :: DataCon -> ThetaType
-- | The "stupid theta" of the DataCon, such as data Eq a
-- in:
--
--
-- data Eq a => T a = ...
--
--
-- See Note [The stupid context].
dataConStupidTheta :: DataCon -> ThetaType
-- | Returns constraints in the wrapper type, other than those in the
-- dataConEqSpec
dataConOtherTheta :: 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] -> [Scaled Type]
-- | Returns the argument types of the wrapper, excluding all dictionary
-- arguments and without substituting for any type variables
dataConOrigArgTys :: DataCon -> [Scaled Type]
dataConOrigResTy :: DataCon -> Type
-- | Returns just the instantiated value argument types of a
-- DataCon, (excluding dictionary args)
dataConInstOrigArgTys :: DataCon -> [Type] -> [Scaled Type]
-- | Returns the arg types of the worker, including *all* non-dependent
-- evidence, after any flattening has been done and without substituting
-- for any type variables
dataConRepArgTys :: DataCon -> [Scaled Type]
-- | Given a data constructor dc with n universally
-- quantified type variables a_{1}, a_{2}, ...,
-- a_{n}, and given a list of argument types dc_args of
-- length m where m <= n, then:
--
--
-- dataConInstUnivs dc dc_args
--
--
-- Will return:
--
--
-- [dc_arg_{1}, dc_arg_{2}, ..., dc_arg_{m}, a_{m+1}, ..., a_{n}]
--
--
-- That is, return the list of universal type variables with
-- a_{1}, a_{2}, ..., a_{m} instantiated with
-- dc_arg_{1}, dc_arg_{2}, ..., dc_arg_{m}. It
-- is possible for m to be less than n, in which case
-- the remaining n - m elements will simply be universal type
-- variables (with their kinds possibly instantiated).
--
-- Examples:
--
--
-- - Given the data constructor D :: forall a b. Foo a b and
-- dc_args [Int, Bool], then dataConInstUnivs D
-- dc_args will return [Int, Bool].
-- - Given the data constructor D :: forall a b. Foo a b and
-- dc_args [Int], then @dataConInstUnivs D
-- dc_args will return [Int, b].
-- - Given the data constructor E :: forall k (a :: k). Bar k
-- a and dc_args [Type], then
-- @dataConInstUnivs D dc_args will return [Type, (a ::
-- Type)].
--
--
-- This is primarily used in GHC.Tc.Deriv.* in service of
-- instantiating data constructors' field types. See Note
-- [Instantiating field types in stock deriving] for a notable
-- example of this.
dataConInstUnivs :: DataCon -> [Type] -> [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 data type that is all of:
--
--
-- - Concrete (i.e. constructors visible)
-- - Single-constructor
-- - ... which has no existentials
--
--
-- Whether the type is a data type or a newtype.
splitDataProductType_maybe :: Type -> Maybe (TyCon, [Type], DataCon, [Scaled 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
isBoxedTupleDataCon :: DataCon -> Bool
isUnboxedTupleDataCon :: DataCon -> Bool
isUnboxedSumDataCon :: DataCon -> Bool
-- | Vanilla DataCons are those that are nice boring Haskell 98
-- constructors
isVanillaDataCon :: DataCon -> Bool
-- | Is this the DataCon of a newtype?
isNewDataCon :: DataCon -> Bool
classDataCon :: Class -> DataCon
dataConCannotMatch :: [Type] -> DataCon -> Bool
-- | Were the type variables of the data con written in a different order
-- than the regular order (universal tyvars followed by existential
-- tyvars)?
--
-- This is not a cheap test, so we minimize its use in GHC as much as
-- possible. Currently, its only call site in the GHC codebase is in
-- mkDataConRep in MkId, and so
-- dataConUserTyVarsArePermuted is only called at most once during
-- a data constructor's lifetime.
dataConUserTyVarsArePermuted :: DataCon -> Bool
isBanged :: HsImplBang -> Bool
isMarkedStrict :: StrictnessMark -> Bool
cbvFromStrictMark :: StrictnessMark -> CbvMark
-- | 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
promoteDataCon :: DataCon -> TyCon
instance Data.Data.Data GHC.Core.DataCon.HsImplBang
instance Data.Data.Data GHC.Core.DataCon.SrcStrictness
instance GHC.Classes.Eq GHC.Core.DataCon.SrcStrictness
instance Data.Data.Data GHC.Core.DataCon.SrcUnpackedness
instance GHC.Classes.Eq GHC.Core.DataCon.SrcUnpackedness
instance Data.Data.Data GHC.Core.DataCon.HsSrcBang
instance GHC.Classes.Eq GHC.Core.DataCon.StrictnessMark
instance GHC.Classes.Eq GHC.Core.DataCon.DataCon
instance GHC.Types.Unique.Uniquable GHC.Core.DataCon.DataCon
instance GHC.Types.Name.NamedThing GHC.Core.DataCon.DataCon
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.DataCon
instance GHC.Utils.Outputable.OutputableBndr GHC.Core.DataCon.DataCon
instance Data.Data.Data GHC.Core.DataCon.DataCon
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.EqSpec
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.StrictnessMark
instance GHC.Utils.Binary.Binary GHC.Core.DataCon.StrictnessMark
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.HsSrcBang
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.SrcUnpackedness
instance GHC.Utils.Binary.Binary GHC.Core.DataCon.SrcUnpackedness
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.SrcStrictness
instance GHC.Utils.Binary.Binary GHC.Core.DataCon.SrcStrictness
instance GHC.Utils.Outputable.Outputable GHC.Core.DataCon.HsImplBang
module GHC.Types.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.
isZeroBitTy :: HasDebugCallStack => 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) See also
-- Note [Getting from RuntimeRep to PrimRep]
typePrimRep :: HasDebugCallStack => Type -> [PrimRep]
-- | Like typePrimRep, but assumes that there is precisely one
-- PrimRep output; an empty list of PrimReps becomes a VoidRep.
-- This assumption holds after unarise, see Note [Post-unarisation
-- invariants]. Before unarise it may or may not hold. See also Note
-- [RuntimeRep and PrimRep] and Note [VoidRep]
typePrimRep1 :: HasDebugCallStack => UnaryType -> PrimRep
-- | Like typePrimRep, but returns Nothing instead of
-- panicking, when
--
--
-- - The ty was not of form TYPE rep
-- - rep was not monomorphic
--
typeMonoPrimRep_maybe :: Type -> Maybe [PrimRep]
-- | Take a type of kind RuntimeRep and extract the list of PrimRep
-- that it encodes. See also Note [Getting from RuntimeRep to PrimRep]
-- The [PrimRep] is the final runtime representation after
-- unarisation
runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep]
typePrimRepArgs :: HasDebugCallStack => 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. See also Note [RuntimeRep and
-- PrimRep] in GHC.Types.RepType and Note [VoidRep] in
-- GHC.Types.RepType.
data PrimRep
VoidRep :: PrimRep
LiftedRep :: PrimRep
-- | Unlifted pointer
UnliftedRep :: PrimRep
-- | Signed, 8-bit value
Int8Rep :: PrimRep
-- | Signed, 16-bit value
Int16Rep :: PrimRep
-- | Signed, 32-bit value
Int32Rep :: PrimRep
-- | Signed, 64 bit value
Int64Rep :: PrimRep
-- | Signed, word-sized value
IntRep :: PrimRep
-- | Unsigned, 8 bit value
Word8Rep :: PrimRep
-- | Unsigned, 16 bit value
Word16Rep :: PrimRep
-- | Unsigned, 32 bit value
Word32Rep :: PrimRep
-- | Unsigned, 64 bit value
Word64Rep :: PrimRep
-- | Unsigned, word-sized value
WordRep :: 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.
-- See also Note [RuntimeRep and PrimRep]
primRepToType :: PrimRep -> Type
countFunRepArgs :: Arity -> Type -> RepArity
countConRepArgs :: DataCon -> RepArity
-- | Give the demands on the arguments of a Core constructor application
-- (Con dc args) at runtime. Assumes the constructor is not levity
-- polymorphic. For example unboxed tuples won't work.
dataConRuntimeRepStrictness :: HasDebugCallStack => DataCon -> [StrictnessMark]
-- | Find the runtime representation of a TyCon. Defined here to
-- avoid module loops. Returns a list of the register shapes necessary.
-- See also Note [Getting from RuntimeRep to PrimRep]
tyConPrimRep :: HasDebugCallStack => TyCon -> [PrimRep]
-- | Like tyConPrimRep, but assumed that there is precisely zero or
-- one PrimRep output See also Note [Getting from RuntimeRep to
-- PrimRep] and Note [VoidRep]
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
PtrLiftedSlot :: SlotTy
PtrUnliftedSlot :: SlotTy
WordSlot :: SlotTy
Word64Slot :: SlotTy
FloatSlot :: SlotTy
DoubleSlot :: SlotTy
slotPrimRep :: SlotTy -> PrimRep
primRepSlot :: PrimRep -> SlotTy
instance GHC.Classes.Ord GHC.Types.RepType.SlotTy
instance GHC.Classes.Eq GHC.Types.RepType.SlotTy
instance GHC.Utils.Outputable.Outputable GHC.Types.RepType.SlotTy
-- | A language to express the evaluation context of an expression as a
-- Demand and track how an expression evaluates free variables and
-- arguments in turn as a DmdType.
--
-- Lays out the abstract domain for GHC.Core.Opt.DmdAnal.
module GHC.Types.Demand
data Boxity
Boxed :: Boxity
Unboxed :: Boxity
-- | Describes an interval of evaluation cardinalities. See Note
-- [Evaluation cardinalities] See Note [Bit vector representation for
-- Card]
data Card
-- | Absent, {0}. Pretty-printed as A.
pattern C_00 :: Card
-- | Used at most once, {0,1}. Pretty-printed as M.
pattern C_01 :: Card
-- | Every possible cardinality; the top element, {0,1,n}. Pretty-printed
-- as L.
pattern C_0N :: Card
-- | Bottom, {}. Pretty-printed as A.
pattern C_10 :: Card
-- | Strict and used once, {1}. Pretty-printed as 1.
pattern C_11 :: Card
-- | Strict and used (possibly) many times, {1,n}. Pretty-printed as S.
pattern C_1N :: Card
-- | A subtype of Card for which the upper bound is never 0 (no
-- C_00 or C_10). The only four inhabitants are
-- C_01, C_0N, C_11, C_1N. Membership can be
-- tested with isCardNonAbs. See D and Call for use
-- sites and explanation.
type CardNonAbs = Card
-- | A subtype of Card for which the upper bound is never 1 (no
-- C_01 or C_11). The only four inhabitants are
-- C_00, C_0N, C_10, C_1N. Membership can be
-- tested with isCardNonOnce. See Poly for use sites and
-- explanation.
type CardNonOnce = Card
-- | A demand describes a scaled evaluation context, e.g. how many
-- times and how deep the denoted thing is evaluated.
--
-- The "how many" component is represented by a Cardinality. The
-- "how deep" component is represented by a SubDemand. Examples
-- (using Note [Demand notation]):
--
--
-- - seq puts demand 1A on its first argument: It
-- evaluates the argument strictly (1), but not any deeper
-- (A).
-- - fst puts demand 1P(1L,A) on its argument: It
-- evaluates the argument pair strictly and the first component strictly,
-- but no nested info beyond that (L). Its second argument is
-- not used at all.
-- - $ puts demand 1C1(L) on its first argument: It
-- calls (C) the argument function with one argument, exactly
-- once (1). No info on how the result of that call is evaluated
-- (L).
-- - maybe puts demand MCM(L) on its second argument:
-- It evaluates the argument function at most once ((M)aybe) and calls it
-- once when it is evaluated.
-- - fst p + fst p puts demand SP(SL,A) on
-- p: It's 1P(1L,A) multiplied by two, so we get
-- S (used at least once, possibly multiple times).
--
--
-- This data type is quite similar to Scaled
-- SubDemand, but it's scaled by Card, which is an
-- interval on Multiplicity, the upper bound of which
-- could be used to infer uniqueness types. Also we treat AbsDmd
-- and BotDmd specially, as the concept of a SubDemand
-- doesn't apply when there isn't any evaluation at all. If you don't
-- care, simply use (:*).
data Demand
-- | A bottoming demand, produced by a diverging function (C_10),
-- hence there is no SubDemand that describes how it was
-- evaluated.
BotDmd :: Demand
-- | An absent demand: Evaluated exactly 0 times (C_00), hence there
-- is no SubDemand that describes how it was evaluated.
AbsDmd :: Demand
-- | c :* sd is a demand that says "evaluated c times,
-- and each time it was evaluated, it was at least as deep as
-- sd".
--
-- Matching on this pattern synonym is a complete match. If the matched
-- demand was AbsDmd, it will match as C_00 :* seqSubDmd.
-- If the matched demand was BotDmd, it will match as C_10 :*
-- botSubDmd. The builder of this pattern synonym simply
-- discards the SubDemand if the Card was absent and
-- returns AbsDmd or BotDmd instead. It will assert that
-- the discarded sub-demand was seqSubDmd and botSubDmd,
-- respectively.
--
-- Call sites should consider whether they really want to look at the
-- SubDemand of an absent demand and match on AbsDmd and/or
-- BotDmd otherwise. Really, any other SubDemand would be
-- allowed and might work better, depending on context.
pattern (:*) :: HasDebugCallStack => Card -> SubDemand -> Demand
-- | A sub-demand describes an evaluation context, e.g. how deep the
-- denoted thing is evaluated. See Demand for examples.
--
-- The nested SubDemand d of a Call Cn(d)
-- is relative to a single such call. E.g. The expression f 1
-- 2 + f 3 4 puts call demand SCS(C1(L)) on f:
-- f is called exactly twice (S), each time exactly
-- once (1) with an additional argument.
--
-- The nested Demands dn of a Prod
-- P(d1,d2,...) apply absolutely: If dn is a
-- used once demand (cf. isUsedOnce), then that means that the
-- denoted sub-expression is used once in the entire evaluation context
-- described by the surrounding Demand. E.g., LP(ML)
-- means that the field of the denoted expression is used at most once,
-- although the entire expression might be used many times.
--
-- See Note [Call demands are relative] and Note [Demand notation]. See
-- also Note [Why Boxity in SubDemand and not in Demand?].
data SubDemand
-- | Polymorphic demand, the denoted thing is evaluated arbitrarily deep,
-- with the specified cardinality at every level. The Boxity
-- applies only to the outer evaluation context as well as all inner
-- evaluation context. See Note [Boxity in Poly] for why we want it to
-- carry Boxity. Expands to Call via viewCall and to
-- Prod via viewProd.
--
-- Poly b n is semantically equivalent to Prod b [n :* Poly
-- b n, ...] or Call n (Poly Boxed n)@. viewCall and
-- viewProd do these rewrites.
--
-- In Note [Demand notation]: L === P(L,L,...) and L ===
-- CL(L), B === P(B,B,...) and B === CB(B), !A
-- === !P(A,A,...) and !A === !CA(A), and so on.
--
-- We'll only see Poly with C_10 (B), C_00 (A),
-- C_0N (L) and sometimes C_1N (S) through
-- plusSubDmd, never C_01 (M) or C_11 (1) (grep the
-- source code). Hence CardNonOnce, which is closed under
-- lub and plus.
Poly :: !Boxity -> !CardNonOnce -> SubDemand
-- | Prod b ds describes the evaluation context of a case
-- scrutinisation on an expression of product type, where the product
-- components are evaluated according to ds. The Boxity
-- b says whether or not the box of the product was used.
Prod :: !Boxity -> ![Demand] -> SubDemand
-- | A smart constructor for Prod, applying rewrite rules along the
-- semantic equality Prod b [n :* Poly Boxed n, ...] === Poly b
-- n, simplifying to Poly SubDemands when possible.
-- Examples:
--
--
-- - Rewrites P(L,L) (e.g., arguments Boxed,
-- [L,L]) to L
-- - Rewrites !P(L!L,L!L) (e.g., arguments Unboxed,
-- [L!L,L!L]) to !L
-- - Does not rewrite P(1L), P(L!L), !P(L)
-- or P(L,A)
--
mkProd :: Boxity -> [Demand] -> SubDemand
-- | viewProd n sd interprets sd as a Prod of
-- arity n, expanding Poly demands as necessary.
viewProd :: Arity -> SubDemand -> Maybe (Boxity, [Demand])
absDmd :: Demand
topDmd :: Demand
botDmd :: Demand
seqDmd :: Demand
topSubDmd :: SubDemand
-- | Denotes ∪ on Card.
lubCard :: Card -> Card -> Card
-- | Denotes ∪ on Demand.
lubDmd :: Demand -> Demand -> Demand
-- | Denotes ∪ on SubDemand.
lubSubDmd :: SubDemand -> SubDemand -> SubDemand
-- | Denotes + on lower and upper bounds of Card.
plusCard :: Card -> Card -> Card
-- | Denotes + on Demand.
plusDmd :: Demand -> Demand -> Demand
-- | Denotes + on SubDemand.
plusSubDmd :: SubDemand -> SubDemand -> SubDemand
-- | Denotes * on lower and upper bounds of Card.
multCard :: Card -> Card -> Card
multDmd :: Card -> Demand -> Demand
multSubDmd :: Card -> SubDemand -> SubDemand
-- | True = upper bound is 0.
isAbs :: Card -> Bool
-- | True = upper bound is 1.
isUsedOnce :: Card -> Bool
-- | True = lower bound is 1.
isStrict :: Card -> Bool
isAbsDmd :: Demand -> Bool
-- | Is the value used at most once?
isUsedOnceDmd :: Demand -> Bool
-- | Not absent and used strictly. See Note [Strict demands]
isStrUsedDmd :: Demand -> Bool
-- | Contrast with isStrictUsedDmd. See Note [Strict demands]
isStrictDmd :: Demand -> Bool
-- | Used to suppress pretty-printing of an uninformative demand
isTopDmd :: Demand -> Bool
-- | We try to avoid tracking weak free variable demands in strictness
-- signatures for analysis performance reasons. See Note [Lazy and
-- unleashable free variables] in GHC.Core.Opt.DmdAnal.
isWeakDmd :: Demand -> Bool
-- | True when the signature indicates all arguments are boxed
onlyBoxedArguments :: DmdSig -> Bool
evalDmd :: Demand
-- | First argument of catch#: MCM(L). Evaluates its arg lazily,
-- but then applies it exactly once to one argument.
lazyApply1Dmd :: Demand
-- | Second argument of catch#: MCM(C1(L)). Calls its arg lazily,
-- but then applies it exactly once to an additional argument.
lazyApply2Dmd :: Demand
-- | First argument of 'GHC.Exts.maskAsyncExceptions#': 1C1(L).
-- Called exactly once.
strictOnceApply1Dmd :: Demand
-- | First argument of 'GHC.Exts.atomically#': SCS(L). Called at
-- least once, possibly many times.
strictManyApply1Dmd :: Demand
-- | Intersect with [0,1].
oneifyCard :: Card -> Card
-- | Make a Demand evaluated at-most-once.
oneifyDmd :: Demand -> Demand
-- | Make a Demand evaluated at-least-once (e.g. strict).
strictifyDmd :: Demand -> Demand
-- | If the argument is a used non-newtype dictionary, give it strict
-- demand. Also split the product type & demand and recur in order to
-- similarly strictify the argument's contained used non-newtype
-- superclass dictionaries. We use the demand as our recursive measure to
-- guarantee termination.
strictifyDictDmd :: Type -> Demand -> Demand
-- | Make a Demand lazy, setting all lower bounds (outside
-- Calls) to 0.
lazifyDmd :: Demand -> Demand
-- | Peels one call level from the sub-demand, and also returns how many
-- times we entered the lambda body.
peelCallDmd :: SubDemand -> (Card, SubDemand)
peelManyCalls :: Int -> SubDemand -> Card
-- | Wraps the SubDemand with a one-shot call demand: d
-- -> C1(d).
mkCalledOnceDmd :: SubDemand -> SubDemand
-- | mkCalledOnceDmds n d returns C1(C1...(C1 d)) where
-- there are n C1's.
mkCalledOnceDmds :: Arity -> SubDemand -> SubDemand
mkWorkerDemand :: Int -> Demand
-- | See Note [Computing one-shot info]
argOneShots :: Demand -> [OneShotInfo]
-- | See Note [Computing one-shot info]
argsOneShots :: DmdSig -> Arity -> [[OneShotInfo]]
-- | saturatedByOneShots n CM(CM(...)) = True = There are
-- at least n nested CM(..) calls. See Note [Demand on the worker] in
-- GHC.Core.Opt.WorkWrap
saturatedByOneShots :: Int -> Demand -> Bool
-- | Sets Boxity to Unboxed for the Demand, recursing
-- into Prods.
unboxDeeplyDmd :: Demand -> Demand
type DmdEnv = VarEnv Demand
emptyDmdEnv :: DmdEnv
-- | keepAliveDmdType dt vs makes sure that the Ids in vs
-- have some usage in the returned demand types -- they are not
-- Absent. See Note [Absence analysis for stable unfoldings and RULES] in
-- GHC.Core.Opt.DmdAnal.
keepAliveDmdEnv :: DmdEnv -> IdSet -> DmdEnv
reuseEnv :: DmdEnv -> DmdEnv
-- | Divergence characterises whether something surely diverges.
-- Models a subset lattice of the following exhaustive set of divergence
-- results:
--
--
-- - n nontermination (e.g. loops)
-- - i throws imprecise exception
-- - p throws precise exceTtion
-- - c converges (reduces to WHNF).
--
--
-- The different lattice elements correspond to different subsets,
-- indicated by juxtaposition of indicators (e.g. nc definitely
-- doesn't throw an exception, and may or may not reduce to WHNF).
--
--
-- Dunno (nipc)
-- |
-- ExnOrDiv (nip)
-- |
-- Diverges (ni)
--
--
-- As you can see, we don't distinguish n and i. See Note
-- [Precise exceptions and strictness analysis] for why p is so
-- special compared to i.
data Divergence
-- | Definitely throws an imprecise exception or diverges.
Diverges :: Divergence
-- | Definitely throws a *precise* exception, an imprecise exception or
-- diverges. Never converges, hence isDeadEndDiv! See scenario 1
-- in Note [Precise exceptions and strictness analysis].
ExnOrDiv :: Divergence
-- | Might diverge, throw any kind of exception or converge.
Dunno :: Divergence
topDiv :: Divergence
botDiv :: Divergence
exnDiv :: Divergence
lubDivergence :: Divergence -> Divergence -> Divergence
-- | True if the Divergence indicates that evaluation will not
-- return. See Note [Dead ends].
isDeadEndDiv :: Divergence -> Bool
-- | Characterises how an expression
--
--
-- - Evaluates its free variables (dt_env)
-- - Evaluates its arguments (dt_args)
-- - Diverges on every code path or not (dt_div)
--
--
-- Equality is defined modulo defaultFvDmds in dt_env. See
-- Note [Demand type Equality].
data DmdType
DmdType :: !DmdEnv -> ![Demand] -> !Divergence -> DmdType
-- | Demand on explicitly-mentioned free variables
[dt_env] :: DmdType -> !DmdEnv
-- | Demand on arguments
[dt_args] :: DmdType -> ![Demand]
-- | Whether evaluation diverges. See Note [Demand type Divergence]
[dt_div] :: DmdType -> !Divergence
dmdTypeDepth :: DmdType -> Arity
-- | The demand type of doing nothing (lazy, absent, no Divergence
-- information). Note that it is 'not' the top of the lattice
-- (which would be "may use everything"), so it is (no longer) called
-- topDmdType.
nopDmdType :: DmdType
botDmdType :: DmdType
-- | Compute the least upper bound of two DmdTypes elicited /by the
-- same incoming demand/!
lubDmdType :: DmdType -> DmdType -> DmdType
plusDmdType :: DmdType -> PlusDmdArg -> DmdType
multDmdType :: Card -> DmdType -> DmdType
type PlusDmdArg = (DmdEnv, Divergence)
mkPlusDmdArg :: DmdEnv -> PlusDmdArg
toPlusDmdArg :: DmdType -> PlusDmdArg
peelFV :: DmdType -> Var -> (DmdType, Demand)
findIdDemand :: DmdType -> Var -> Demand
addDemand :: Demand -> DmdType -> DmdType
splitDmdTy :: DmdType -> (Demand, DmdType)
-- | When e is evaluated after executing an IO action that may throw a
-- precise exception, we act as if there is an additional control flow
-- path that is taken if e throws a precise exception. The demand type of
-- this control flow path * is lazy and absent (topDmd) and boxed
-- in all free variables and arguments * has exnDiv
-- Divergence result See Note [Precise exceptions and strictness
-- analysis]
--
-- So we can simply take a variant of nopDmdType,
-- exnDmdType. Why not nopDmdType? Because then the result
-- of e can never be exnDiv! That means failure to drop
-- dead-ends, see #18086.
deferAfterPreciseException :: DmdType -> DmdType
-- | See keepAliveDmdEnv.
keepAliveDmdType :: DmdType -> VarSet -> DmdType
-- | The depth of the wrapped DmdType encodes the arity at which it
-- is safe to unleash. Better construct this through
-- mkDmdSigForArity. See Note [Understanding DmdType and DmdSig]
newtype DmdSig
DmdSig :: DmdType -> DmdSig
-- | Turns a DmdType computed for the particular Arity into a
-- DmdSig unleashable at that arity. See Note [Understanding
-- DmdType and DmdSig].
mkDmdSigForArity :: Arity -> DmdType -> DmdSig
mkClosedDmdSig :: [Demand] -> Divergence -> DmdSig
splitDmdSig :: DmdSig -> ([Demand], Divergence)
dmdSigDmdEnv :: DmdSig -> DmdEnv
hasDemandEnvSig :: DmdSig -> Bool
nopSig :: DmdSig
botSig :: DmdSig
isTopSig :: DmdSig -> Bool
-- | True if the signature diverges or throws an exception in a saturated
-- call. See Note [Dead ends].
isDeadEndSig :: DmdSig -> Bool
-- | Returns true if an application to n args would diverge or throw an
-- exception.
--
-- If a function having botDiv is applied to a less number of
-- arguments than its syntactic arity, we cannot say for sure that it is
-- going to diverge. Hence this function conservatively returns False in
-- that case. See Note [Dead ends].
appIsDeadEnd :: DmdSig -> Int -> Bool
trimBoxityDmdSig :: DmdSig -> DmdSig
-- | Add extra (topDmd) arguments to a strictness signature. In
-- contrast to etaConvertDmdSig, this prepends additional
-- argument demands. This is used by FloatOut.
prependArgsDmdSig :: Int -> DmdSig -> DmdSig
-- | We are expanding (x y. e) to (x y z. e z) or reducing from the latter
-- to the former (when the Simplifier identifies a new join points, for
-- example). In contrast to prependArgsDmdSig, this appends
-- extra arg demands if necessary. This works by looking at the
-- DmdType (which was produced under a call demand for the old
-- arity) and trying to transfer as many facts as we can to the call
-- demand of new arity. An arity increase (resulting in a stronger
-- incoming demand) can retain much of the info, while an arity decrease
-- (a weakening of the incoming demand) must fall back to a conservative
-- default.
etaConvertDmdSig :: Arity -> DmdSig -> DmdSig
-- | A demand transformer is a monotone function from an incoming
-- evaluation context (SubDemand) to a DmdType, describing
-- how the denoted thing (i.e. expression, function) uses its arguments
-- and free variables, and whether it diverges.
--
-- See Note [Understanding DmdType and DmdSig] and Note [What are demand
-- signatures?].
type DmdTransformer = SubDemand -> DmdType
-- | Extrapolate a demand signature (DmdSig) into a
-- DmdTransformer.
--
-- Given a function's DmdSig and a SubDemand for the
-- evaluation context, return how the function evaluates its free
-- variables and arguments.
dmdTransformSig :: DmdSig -> DmdTransformer
-- | A special DmdTransformer for data constructors that feeds
-- product demands into the constructor arguments.
dmdTransformDataConSig :: Arity -> DmdTransformer
-- | A special DmdTransformer for dictionary selectors that feeds
-- the demand on the result into the indicated dictionary component (if
-- saturated). See Note [Demand transformer for a dictionary selector].
dmdTransformDictSelSig :: DmdSig -> DmdTransformer
data TypeShape
TsFun :: TypeShape -> TypeShape
TsProd :: [TypeShape] -> TypeShape
TsUnk :: TypeShape
trimToType :: Demand -> TypeShape -> Demand
-- | Drop all boxity
trimBoxity :: Demand -> Demand
seqDemand :: Demand -> ()
seqDemandList :: [Demand] -> ()
seqDmdType :: DmdType -> ()
seqDmdSig :: DmdSig -> ()
zapUsageDemand :: Demand -> Demand
-- | Remove the demand environment from the signature.
zapDmdEnvSig :: DmdSig -> DmdSig
-- | Remove all `C_01 :*` info (but not CM sub-demands) from the
-- demand
zapUsedOnceDemand :: Demand -> Demand
-- | Remove all `C_01 :*` info (but not CM sub-demands) from the
-- strictness signature
zapUsedOnceSig :: DmdSig -> DmdSig
instance GHC.Classes.Eq GHC.Types.Demand.Card
instance GHC.Classes.Eq GHC.Types.Demand.Demand
instance GHC.Classes.Eq GHC.Types.Demand.Divergence
instance GHC.Classes.Eq GHC.Types.Demand.DmdSig
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.TypeShape
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.DmdSig
instance GHC.Utils.Binary.Binary GHC.Types.Demand.DmdSig
instance GHC.Classes.Eq GHC.Types.Demand.DmdType
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.DmdType
instance GHC.Utils.Binary.Binary GHC.Types.Demand.DmdType
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.Divergence
instance GHC.Utils.Binary.Binary GHC.Types.Demand.Divergence
instance GHC.Classes.Eq GHC.Types.Demand.SubDemand
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.Demand
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.SubDemand
instance GHC.Utils.Binary.Binary GHC.Types.Demand.Demand
instance GHC.Utils.Binary.Binary GHC.Types.Demand.SubDemand
instance GHC.Show.Show GHC.Types.Demand.Card
instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.Card
instance GHC.Utils.Binary.Binary GHC.Types.Demand.Card
-- | Types for the Constructed Product Result lattice.
-- GHC.Core.Opt.CprAnal and GHC.Core.Opt.WorkWrap.Utils are
-- its primary customers via idCprSig.
module GHC.Types.Cpr
data Cpr
pattern ConCpr :: ConTag -> [Cpr] -> Cpr
topCpr :: Cpr
botCpr :: Cpr
flatConCpr :: ConTag -> Cpr
asConCpr :: Cpr -> Maybe (ConTag, [Cpr])
-- | The abstract domain <math> from the original 'CPR for Haskell'
-- paper.
data CprType
CprType :: !Arity -> !Cpr -> CprType
-- | Number of value arguments the denoted expression eats before returning
-- the ct_cpr
[ct_arty] :: CprType -> !Arity
-- | Cpr eventually unleashed when applied to ct_arty
-- arguments
[ct_cpr] :: CprType -> !Cpr
topCprType :: CprType
botCprType :: CprType
flatConCprType :: ConTag -> CprType
lubCprType :: CprType -> CprType -> CprType
applyCprTy :: CprType -> Arity -> CprType
abstractCprTy :: CprType -> CprType
trimCprTy :: CprType -> CprType
-- | The result of unpackConFieldsCpr.
data UnpackConFieldsResult
AllFieldsSame :: !Cpr -> UnpackConFieldsResult
ForeachField :: ![Cpr] -> UnpackConFieldsResult
-- | Unpacks a ConCpr-shaped Cpr and returns the field
-- Cprs wrapped in a ForeachField. Otherwise, it returns
-- AllFieldsSame with the appropriate Cpr to assume for
-- each field.
--
-- The use of UnpackConFieldsResult allows O(1) space for the
-- common, non-ConCpr case.
unpackConFieldsCpr :: DataCon -> Cpr -> UnpackConFieldsResult
-- | The arity of the wrapped CprType is the arity at which it is
-- safe to unleash. See Note [Understanding DmdType and DmdSig] in
-- GHC.Types.Demand
newtype CprSig
CprSig :: CprType -> CprSig
[getCprSig] :: CprSig -> CprType
topCprSig :: CprSig
isTopCprSig :: CprSig -> Bool
-- | Turns a CprType computed for the particular Arity into a
-- CprSig unleashable at that arity. See Note [Understanding
-- DmdType and DmdSig] in GHC.Types.Demand
mkCprSigForArity :: Arity -> CprType -> CprSig
mkCprSig :: Arity -> Cpr -> CprSig
seqCprSig :: CprSig -> ()
instance GHC.Classes.Eq GHC.Types.Cpr.Cpr
instance GHC.Utils.Binary.Binary GHC.Types.Cpr.CprSig
instance GHC.Classes.Eq GHC.Types.Cpr.CprSig
instance GHC.Utils.Outputable.Outputable GHC.Types.Cpr.CprSig
instance GHC.Classes.Eq GHC.Types.Cpr.CprType
instance GHC.Utils.Outputable.Outputable GHC.Types.Cpr.CprType
instance GHC.Utils.Binary.Binary GHC.Types.Cpr.CprType
instance GHC.Utils.Outputable.Outputable GHC.Types.Cpr.Cpr
instance GHC.Utils.Binary.Binary GHC.Types.Cpr.Cpr
module GHC.StgToCmm.Types
-- | Codegen-generated Id infos, to be passed to downstream via interfaces.
--
-- This stuff is for optimization purposes only, they're not compulsory.
--
--
-- - When CafInfo of an imported Id is not known it's safe to treat it
-- as CAFFY.
-- - When LambdaFormInfo of an imported Id is not known it's safe to
-- treat it as `LFUnknown True` (which just says "it could be anything"
-- and we do slow entry).
--
--
-- See also Note [Conveying CAF-info and LFInfo between modules] above.
data CgInfos
CgInfos :: !NonCaffySet -> !ModuleLFInfos -> !CStub -> !NameEnv TagSig -> CgInfos
-- | Exported Non-CAFFY closures in the current module. Everything else is
-- either not exported of CAFFY.
[cgNonCafs] :: CgInfos -> !NonCaffySet
-- | LambdaFormInfos of exported closures in the current module.
[cgLFInfos] :: CgInfos -> !ModuleLFInfos
-- | The C stub which is used for IPE information
[cgIPEStub] :: CgInfos -> !CStub
[cgTagSigs] :: CgInfos -> !NameEnv TagSig
-- | Information about an identifier, from the code generator's point of
-- view. Every identifier is bound to a LambdaFormInfo in the
-- environment, which gives the code generator enough info to be able to
-- tail call or return that identifier.
data LambdaFormInfo
LFReEntrant :: !TopLevelFlag -> !RepArity -> !Bool -> !ArgDescr -> LambdaFormInfo
LFThunk :: !TopLevelFlag -> !Bool -> !Bool -> !StandardFormInfo -> !Bool -> LambdaFormInfo
LFCon :: !DataCon -> LambdaFormInfo
LFUnknown :: !Bool -> LambdaFormInfo
LFUnlifted :: LambdaFormInfo
LFLetNoEscape :: LambdaFormInfo
-- | Maps names in the current module to their LambdaFormInfos
type ModuleLFInfos = NameEnv LambdaFormInfo
-- | StandardFormInfo tells whether this thunk has one of a small number of
-- standard forms
data StandardFormInfo
NonStandardThunk :: StandardFormInfo
SelectorThunk :: !WordOff -> StandardFormInfo
ApThunk :: !RepArity -> StandardFormInfo
type DoSCCProfiling = Bool
type DoExtDynRefs = Bool
instance GHC.Classes.Eq GHC.StgToCmm.Types.StandardFormInfo
instance GHC.Utils.Outputable.Outputable GHC.StgToCmm.Types.LambdaFormInfo
instance GHC.Utils.Outputable.Outputable GHC.StgToCmm.Types.StandardFormInfo
module GHC.Core.ConLike
-- | A constructor-like thing
data ConLike
RealDataCon :: DataCon -> ConLike
PatSynCon :: PatSyn -> ConLike
-- | Is this a 'vanilla' constructor-like thing (no existentials, no
-- provided constraints)?
isVanillaConLike :: ConLike -> Bool
-- | 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] -> [Scaled Type]
-- | TyVarBinders for the type variables of the ConLike. For
-- pattern synonyms, this will always consist of the universally
-- quantified variables followed by the existentially quantified type
-- variables. For data constructors, the situation is slightly more
-- complicated—see Note [DataCon user type variable binders] in
-- GHC.Core.DataCon.
conLikeUserTyVarBinders :: ConLike -> [InvisTVBinder]
-- | Existentially quantified type/coercion variables
conLikeExTyCoVars :: ConLike -> [TyCoVar]
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.
-- See Note [The stupid context] in GHC.Core.DataCon.
conLikeStupidTheta :: ConLike -> ThetaType
-- | 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/coercion 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], [TyCoVar], [EqSpec], ThetaType, ThetaType, [Scaled 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
-- | conLikeHasBuilder returns True except for uni-directional
-- pattern synonyms, which have no builder
conLikeHasBuilder :: ConLike -> Bool
instance GHC.Classes.Eq GHC.Core.ConLike.ConLike
instance GHC.Types.Unique.Uniquable GHC.Core.ConLike.ConLike
instance GHC.Types.Name.NamedThing GHC.Core.ConLike.ConLike
instance GHC.Utils.Outputable.Outputable GHC.Core.ConLike.ConLike
instance GHC.Utils.Outputable.OutputableBndr GHC.Core.ConLike.ConLike
instance Data.Data.Data GHC.Core.ConLike.ConLike
-- | COMPLETE signature
module GHC.Types.CompleteMatch
-- | A list of conlikes which represents a complete pattern match. These
-- arise from COMPLETE signatures. See also Note [Implementation
-- of COMPLETE pragmas].
data CompleteMatch
CompleteMatch :: UniqDSet ConLike -> Maybe TyCon -> CompleteMatch
-- | The set of ConLike values
[cmConLikes] :: CompleteMatch -> UniqDSet ConLike
-- | The optional, concrete result TyCon the set applies to
[cmResultTyCon] :: CompleteMatch -> Maybe TyCon
vanillaCompleteMatch :: UniqDSet ConLike -> CompleteMatch
type CompleteMatches = [CompleteMatch]
completeMatchAppliesAtType :: Type -> CompleteMatch -> Bool
instance GHC.Utils.Outputable.Outputable GHC.Types.CompleteMatch.CompleteMatch
-- | Efficient serialisation for GHCi Instruction arrays
--
-- Author: Ben Gamari
module GHCi.BinaryArray
-- | An efficient serialiser of UArray.
putArray :: Binary i => UArray i a -> Put
-- | An efficient deserialiser of UArray.
getArray :: (Binary i, Ix i, MArray IOUArray a IO) => Get (UArray i a)
-- | Break Arrays
--
-- An array of words, indexed by a breakpoint number (breakpointId in
-- Tickish) containing the ignore count for every breakpopint. There is
-- one of these arrays per module.
--
-- For each word with value n: n > 1 : the corresponding breakpoint is
-- enabled. Next time the bp is hit, GHCi will decrement the ignore count
-- and continue processing. n == 0 : The breakpoint is enabled, GHCi will
-- stop next time it hits this breakpoint. n == -1: This breakpoint is
-- disabled. n < -1 : Not used.
module GHCi.BreakArray
data BreakArray
BA :: MutableByteArray# RealWorld -> BreakArray
newBreakArray :: Int -> IO BreakArray
getBreak :: BreakArray -> Int -> IO (Maybe Int)
setupBreakpoint :: BreakArray -> Int -> Int -> IO Bool
breakOn :: Int
breakOff :: Int
showBreakArray :: BreakArray -> IO ()
module GHCi.FFI
data FFIType
FFIVoid :: FFIType
FFIPointer :: FFIType
FFIFloat :: FFIType
FFIDouble :: FFIType
FFISInt8 :: FFIType
FFISInt16 :: FFIType
FFISInt32 :: FFIType
FFISInt64 :: FFIType
FFIUInt8 :: FFIType
FFIUInt16 :: FFIType
FFIUInt32 :: FFIType
FFIUInt64 :: FFIType
data FFIConv
FFICCall :: FFIConv
FFIStdCall :: FFIConv
data C_ffi_cif
prepForeignCall :: FFIConv -> [FFIType] -> FFIType -> IO (Ptr C_ffi_cif)
freeForeignCallInfo :: Ptr C_ffi_cif -> IO ()
instance Data.Binary.Class.Binary GHCi.FFI.FFIType
instance GHC.Generics.Generic GHCi.FFI.FFIType
instance GHC.Show.Show GHCi.FFI.FFIType
instance Data.Binary.Class.Binary GHCi.FFI.FFIConv
instance GHC.Generics.Generic GHCi.FFI.FFIConv
instance GHC.Show.Show GHCi.FFI.FFIConv
-- | Types for referring to remote objects in Remote GHCi. For more
-- details, see Note [External GHCi pointers] in
-- compilerGHCRuntime/Interpreter.hs
--
-- For details on Remote GHCi, see Note [Remote GHCi] in
-- compilerGHCRuntime/Interpreter.hs.
module GHCi.RemoteTypes
newtype RemotePtr a
RemotePtr :: Word64 -> RemotePtr a
toRemotePtr :: Ptr a -> RemotePtr a
fromRemotePtr :: RemotePtr a -> Ptr a
castRemotePtr :: RemotePtr a -> RemotePtr b
newtype HValue
HValue :: Any -> HValue
-- | A reference to a remote value. These are allocated and freed
-- explicitly.
data RemoteRef a
-- | Make a reference to a local value that we can send remotely. This
-- reference will keep the value that it refers to alive until
-- freeRemoteRef is called.
mkRemoteRef :: a -> IO (RemoteRef a)
-- | Convert an HValueRef to an HValue. Should only be used if the HValue
-- originated in this process.
localRef :: RemoteRef a -> IO a
-- | Release an HValueRef that originated in this process
freeRemoteRef :: RemoteRef a -> IO ()
type HValueRef = RemoteRef HValue
toHValueRef :: RemoteRef a -> RemoteRef HValue
-- | An HValueRef with a finalizer
data ForeignRef a
-- | Create a ForeignRef from a RemoteRef. The finalizer
-- should arrange to call freeHValueRef on the HValueRef.
-- (since this function needs to be called in the process that created
-- the HValueRef, it cannot be called directly from the
-- finalizer).
mkForeignRef :: RemoteRef a -> IO () -> IO (ForeignRef a)
-- | Use a ForeignHValue
withForeignRef :: ForeignRef a -> (RemoteRef a -> IO b) -> IO b
type ForeignHValue = ForeignRef HValue
unsafeForeignRefToRemoteRef :: ForeignRef a -> RemoteRef a
finalizeForeignRef :: ForeignRef a -> IO ()
instance Data.Binary.Class.Binary (GHCi.RemoteTypes.RemoteRef a)
instance GHC.Show.Show (GHCi.RemoteTypes.RemoteRef a)
instance GHC.Show.Show (GHCi.RemoteTypes.RemotePtr a)
instance Data.Binary.Class.Binary (GHCi.RemoteTypes.RemotePtr a)
instance Control.DeepSeq.NFData (GHCi.RemoteTypes.RemotePtr a)
instance Control.DeepSeq.NFData (GHCi.RemoteTypes.ForeignRef a)
instance GHC.Show.Show GHCi.RemoteTypes.HValue
module GHCi.ResolvedBCO
-- | A ResolvedBCO is one in which all the Name references
-- have been resolved to actual addresses or RemoteHValues.
--
-- Note, all arrays are zero-indexed (we assume this when
-- serializing/deserializing)
data ResolvedBCO
ResolvedBCO :: Bool -> {-# UNPACK #-} !Int -> UArray Int Word16 -> UArray Int Word64 -> UArray Int Word64 -> SizedSeq ResolvedBCOPtr -> ResolvedBCO
[resolvedBCOIsLE] :: ResolvedBCO -> Bool
[resolvedBCOArity] :: ResolvedBCO -> {-# UNPACK #-} !Int
[resolvedBCOInstrs] :: ResolvedBCO -> UArray Int Word16
[resolvedBCOBitmap] :: ResolvedBCO -> UArray Int Word64
[resolvedBCOLits] :: ResolvedBCO -> UArray Int Word64
[resolvedBCOPtrs] :: ResolvedBCO -> SizedSeq ResolvedBCOPtr
data ResolvedBCOPtr
-- | reference to the Nth BCO in the current set
ResolvedBCORef :: {-# UNPACK #-} !Int -> ResolvedBCOPtr
-- | reference to a previously created BCO
ResolvedBCOPtr :: {-# UNPACK #-} !RemoteRef HValue -> ResolvedBCOPtr
-- | reference to a static ptr
ResolvedBCOStaticPtr :: {-# UNPACK #-} !RemotePtr () -> ResolvedBCOPtr
-- | a nested BCO
ResolvedBCOPtrBCO :: ResolvedBCO -> ResolvedBCOPtr
-- | Resolves to the MutableArray# inside the BreakArray
ResolvedBCOPtrBreakArray :: {-# UNPACK #-} !RemoteRef BreakArray -> ResolvedBCOPtr
isLittleEndian :: Bool
instance GHC.Show.Show GHCi.ResolvedBCO.ResolvedBCO
instance GHC.Generics.Generic GHCi.ResolvedBCO.ResolvedBCO
instance GHC.Show.Show GHCi.ResolvedBCO.ResolvedBCOPtr
instance GHC.Generics.Generic GHCi.ResolvedBCO.ResolvedBCOPtr
instance Data.Binary.Class.Binary GHCi.ResolvedBCO.ResolvedBCO
instance Data.Binary.Class.Binary GHCi.ResolvedBCO.ResolvedBCOPtr
module Language.Haskell.Syntax.Extension
-- | A placeholder type for TTG extension points that are not currently
-- unused to represent any particular value.
--
-- This should not be confused with DataConCantHappen, which are
-- found in unused extension constructors and therefore should
-- never be inhabited. In contrast, NoExtField is used in
-- extension points (e.g., as the field of some constructor), so
-- it must have an inhabitant to construct AST passes that manipulate
-- fields with that extension point as their type.
data NoExtField
NoExtField :: NoExtField
-- | Used when constructing a term with an unused extension point.
noExtField :: NoExtField
data DataConCantHappen
-- | Eliminate a DataConCantHappen. See Note [Constructor cannot
-- occur].
dataConCantHappen :: DataConCantHappen -> a
-- | GHC's L prefixed variants wrap their vanilla variant in this type
-- family, to add SrcLoc info via Located. Other passes
-- than GhcPass not interested in location information can
-- define this as type instance XRec NoLocated a = a. See Note
-- [XRec and SrcSpans in the AST]
type family XRec p a = r | r -> a
type family Anno a = b
-- | We can strip off the XRec to access the underlying data. See Note
-- [XRec and SrcSpans in the AST]
class UnXRec p
unXRec :: UnXRec p => XRec p a -> a
-- | We can map over the underlying type contained in an XRec
-- while preserving the annotation as is.
class MapXRec p
mapXRec :: (MapXRec p, Anno a ~ Anno b) => (a -> b) -> XRec p a -> XRec p b
-- | The trivial wrapper that carries no additional information See Note
-- [XRec and SrcSpans in the AST]
class WrapXRec p a
wrapXRec :: WrapXRec p a => a -> XRec p a
-- | Maps the "normal" id type for a given pass
type family IdP p
type LIdP p = XRec p (IdP p)
type family XHsValBinds x x'
type family XHsIPBinds x x'
type family XEmptyLocalBinds x x'
type family XXHsLocalBindsLR x x'
type family XValBinds x x'
type family XXValBindsLR x x'
type family XFunBind x x'
type family XPatBind x x'
type family XVarBind x x'
type family XPatSynBind x x'
type family XXHsBindsLR x x'
type family XPSB x x'
type family XXPatSynBind x x'
type family XIPBinds x
type family XXHsIPBinds x
type family XCIPBind x
type family XXIPBind x
type family XTypeSig x
type family XPatSynSig x
type family XClassOpSig x
type family XIdSig x
type family XFixSig x
type family XInlineSig x
type family XSpecSig x
type family XSpecInstSig x
type family XMinimalSig x
type family XSCCFunSig x
type family XCompleteMatchSig x
type family XXSig x
type family XFixitySig x
type family XXFixitySig x
type family XStandaloneKindSig x
type family XXStandaloneKindSig x
type family XTyClD x
type family XInstD x
type family XDerivD x
type family XValD x
type family XSigD x
type family XKindSigD x
type family XDefD x
type family XForD x
type family XWarningD x
type family XAnnD x
type family XRuleD x
type family XSpliceD x
type family XDocD x
type family XRoleAnnotD x
type family XXHsDecl x
type family XCHsGroup x
type family XXHsGroup x
type family XSpliceDecl x
type family XXSpliceDecl x
type family XFamDecl x
type family XSynDecl x
type family XDataDecl x
type family XClassDecl x
type family XXTyClDecl x
type family XCFunDep x
type family XXFunDep x
type family XCTyClGroup x
type family XXTyClGroup x
type family XNoSig x
type family XCKindSig x
type family XTyVarSig x
type family XXFamilyResultSig x
type family XCFamilyDecl x
type family XXFamilyDecl x
type family XCHsDataDefn x
type family XXHsDataDefn x
type family XCHsDerivingClause x
type family XXHsDerivingClause x
type family XDctSingle x
type family XDctMulti x
type family XXDerivClauseTys x
type family XConDeclGADT x
type family XConDeclH98 x
type family XXConDecl x
type family XCFamEqn x r
type family XXFamEqn x r
type family XCTyFamInstDecl x
type family XXTyFamInstDecl x
type family XCClsInstDecl x
type family XXClsInstDecl x
type family XClsInstD x
type family XDataFamInstD x
type family XTyFamInstD x
type family XXInstDecl x
type family XCDerivDecl x
type family XXDerivDecl x
type family XStockStrategy x
type family XAnyClassStrategy x
type family XNewtypeStrategy x
type family XViaStrategy x
type family XCDefaultDecl x
type family XXDefaultDecl x
type family XForeignImport x
type family XForeignExport x
type family XXForeignDecl x
type family XCRuleDecls x
type family XXRuleDecls x
type family XHsRule x
type family XXRuleDecl x
type family XCRuleBndr x
type family XRuleBndrSig x
type family XXRuleBndr x
type family XWarnings x
type family XXWarnDecls x
type family XWarning x
type family XXWarnDecl x
type family XHsAnnotation x
type family XXAnnDecl x
type family XCRoleAnnotDecl x
type family XXRoleAnnotDecl x
type family XCInjectivityAnn x
type family XXInjectivityAnn x
type family XVar x
type family XUnboundVar x
type family XRecSel x
type family XOverLabel x
type family XIPVar x
type family XOverLitE x
type family XLitE x
type family XLam x
type family XLamCase x
type family XApp x
type family XAppTypeE x
type family XOpApp x
type family XNegApp x
type family XPar x
type family XSectionL x
type family XSectionR x
type family XExplicitTuple x
type family XExplicitSum x
type family XCase x
type family XIf x
type family XMultiIf x
type family XLet x
type family XDo x
type family XExplicitList x
type family XRecordCon x
type family XRecordUpd x
type family XGetField x
type family XProjection x
type family XExprWithTySig x
type family XArithSeq x
type family XTypedBracket x
type family XUntypedBracket x
type family XSpliceE x
type family XProc x
type family XStatic x
type family XTick x
type family XBinTick x
type family XPragE x
type family XXExpr x
type family XCDotFieldOcc x
type family XXDotFieldOcc x
type family XSCC x
type family XXPragE x
type family XUnambiguous x
type family XAmbiguous x
type family XXAmbiguousFieldOcc x
type family XPresent x
type family XMissing x
type family XXTupArg x
type family XTypedSplice x
type family XUntypedSplice x
type family XQuasiQuote x
type family XSpliced x
type family XXSplice x
type family XExpBr x
type family XPatBr x
type family XDecBrL x
type family XDecBrG x
type family XTypBr x
type family XVarBr x
type family XXQuote x
type family XCmdTop x
type family XXCmdTop x
type family XMG x b
type family XXMatchGroup x b
type family XCMatch x b
type family XXMatch x b
type family XCGRHSs x b
type family XXGRHSs x b
type family XCGRHS x b
type family XXGRHS x b
type family XLastStmt x x' b
type family XBindStmt x x' b
type family XApplicativeStmt x x' b
type family XBodyStmt x x' b
type family XLetStmt x x' b
type family XParStmt x x' b
type family XTransStmt x x' b
type family XRecStmt x x' b
type family XXStmtLR x x' b
type family XCmdArrApp x
type family XCmdArrForm x
type family XCmdApp x
type family XCmdLam x
type family XCmdPar x
type family XCmdCase x
type family XCmdLamCase x
type family XCmdIf x
type family XCmdLet x
type family XCmdDo x
type family XCmdWrap x
type family XXCmd x
type family XParStmtBlock x x'
type family XXParStmtBlock x x'
type family XApplicativeArgOne x
type family XApplicativeArgMany x
type family XXApplicativeArg x
type family XHsChar x
type family XHsCharPrim x
type family XHsString x
type family XHsStringPrim x
type family XHsInt x
type family XHsIntPrim x
type family XHsWordPrim x
type family XHsInt64Prim x
type family XHsWord64Prim x
type family XHsInteger x
type family XHsRat x
type family XHsFloatPrim x
type family XHsDoublePrim x
type family XXLit x
type family XOverLit x
type family XXOverLit x
type family XWildPat x
type family XVarPat x
type family XLazyPat x
type family XAsPat x
type family XParPat x
type family XBangPat x
type family XListPat x
type family XTuplePat x
type family XSumPat x
type family XConPat x
type family XViewPat x
type family XSplicePat x
type family XLitPat x
type family XNPat x
type family XNPlusKPat x
type family XSigPat x
type family XCoPat x
type family XXPat x
type family XHsFieldBind x
type family XHsQTvs x
type family XXLHsQTyVars x
type family XHsOuterImplicit x
type family XHsOuterExplicit x flag
type family XXHsOuterTyVarBndrs x
type family XHsSig x
type family XXHsSigType x
type family XHsWC x b
type family XXHsWildCardBndrs x b
type family XHsPS x
type family XXHsPatSigType x
type family XForAllTy x
type family XQualTy x
type family XTyVar x
type family XAppTy x
type family XAppKindTy x
type family XFunTy x
type family XListTy x
type family XTupleTy x
type family XSumTy x
type family XOpTy x
type family XParTy x
type family XIParamTy x
type family XStarTy x
type family XKindSig x
type family XSpliceTy x
type family XDocTy x
type family XBangTy x
type family XRecTy x
type family XExplicitListTy x
type family XExplicitTupleTy x
type family XTyLit x
type family XWildCardTy x
type family XXType x
type family XHsForAllVis x
type family XHsForAllInvis x
type family XXHsForAllTelescope x
type family XUserTyVar x
type family XKindedTyVar x
type family XXTyVarBndr x
type family XConDeclField x
type family XXConDeclField x
type family XCFieldOcc x
type family XXFieldOcc x
type family XCImportDecl x
type family XXImportDecl x
type family XIEVar x
type family XIEThingAbs x
type family XIEThingAll x
type family XIEThingWith x
type family XIEModuleContents x
type family XIEGroup x
type family XIEDoc x
type family XIEDocNamed x
type family XXIE x
-- | See Note [NoGhcTc] in GHC.Hs.Extension. It has to be in this module
-- because it is used like an extension point (in the data definitions of
-- types that should be parameter-agnostic.
type family NoGhcTc (p :: Type)
type LHsToken tok p = XRec p (HsToken tok)
data HsToken (tok :: Symbol)
HsTok :: HsToken (tok :: Symbol)
type LHsUniToken tok utok p = XRec p (HsUniToken tok utok)
data HsUniToken (tok :: Symbol) (utok :: Symbol)
HsNormalTok :: HsUniToken (tok :: Symbol) (utok :: Symbol)
HsUnicodeTok :: HsUniToken (tok :: Symbol) (utok :: Symbol)
instance GHC.Classes.Ord Language.Haskell.Syntax.Extension.NoExtField
instance GHC.Classes.Eq Language.Haskell.Syntax.Extension.NoExtField
instance Data.Data.Data Language.Haskell.Syntax.Extension.NoExtField
instance GHC.Classes.Ord Language.Haskell.Syntax.Extension.DataConCantHappen
instance GHC.Classes.Eq Language.Haskell.Syntax.Extension.DataConCantHappen
instance Data.Data.Data Language.Haskell.Syntax.Extension.DataConCantHappen
instance GHC.TypeLits.KnownSymbol tok => Data.Data.Data (Language.Haskell.Syntax.Extension.HsToken tok)
instance (GHC.TypeLits.KnownSymbol tok, GHC.TypeLits.KnownSymbol utok) => Data.Data.Data (Language.Haskell.Syntax.Extension.HsUniToken tok utok)
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Extension.DataConCantHappen
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Extension.NoExtField
module GHC.Types.Tickish
data GenTickish pass
-- | An {--} profiling annotation, either automatically added by
-- the desugarer as a result of -auto-all, or added by the user.
ProfNote :: CostCentre -> !Bool -> !Bool -> GenTickish pass
-- | the cost centre
[profNoteCC] :: GenTickish pass -> CostCentre
-- | bump the entry count?
[profNoteCount] :: GenTickish pass -> !Bool
-- | scopes over the enclosed expression (i.e. not just a tick)
[profNoteScope] :: GenTickish pass -> !Bool
-- | A "tick" used by HPC to track the execution of each subexpression in
-- the original source code.
HpcTick :: Module -> !Int -> GenTickish pass
[tickModule] :: GenTickish pass -> Module
[tickId] :: GenTickish pass -> !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 :: XBreakpoint pass -> !Int -> [XTickishId pass] -> GenTickish pass
[breakpointExt] :: GenTickish pass -> XBreakpoint pass
[breakpointId] :: GenTickish pass -> !Int
-- | the order of this list is important: it matches the order of the lists
-- in the appropriate entry in ModBreaks.
--
-- Careful about substitution! See Note [substTickish] in
-- GHC.Core.Subst.
[breakpointFVs] :: GenTickish pass -> [XTickishId pass]
-- | 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 -> GenTickish pass
-- | Source covered
[sourceSpan] :: GenTickish pass -> RealSrcSpan
-- | Name for source location (uses same names as CCs)
[sourceName] :: GenTickish pass -> String
type CoreTickish = GenTickish 'TickishPassCore
type StgTickish = GenTickish 'TickishPassStg
-- | Tickish in Cmm context (annotations only)
type CmmTickish = GenTickish 'TickishPassCmm
type family XTickishId (pass :: TickishPass)
-- | 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 :: GenTickish pass -> Bool
-- | 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 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 legal, 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
-- | Returns the intended scoping rule for a Tickish
tickishScoped :: GenTickish pass -> TickishScoping
-- | Returns whether the tick scoping rule is at least as permissive as the
-- given scoping rule.
tickishScopesLike :: GenTickish pass -> 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 :: GenTickish pass -> 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 :: GenTickish pass -> Bool
mkNoCount :: GenTickish pass -> GenTickish pass
mkNoScope :: GenTickish pass -> GenTickish pass
-- | 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 :: GenTickish pass -> Bool
isProfTick :: GenTickish pass -> Bool
-- | 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. NB: We
-- generally try to move these as close to the relevant runtime
-- expression as possible. This means they get pushed through tyoe
-- arguments. E.g. we create `(tick f) Bool` instead of `tick (f
-- Bool)`.
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
-- | Placement behaviour we want for the ticks
tickishPlace :: GenTickish pass -> TickishPlacement
-- | Returns whether one tick "contains" the other one, therefore making
-- the second tick redundant.
tickishContains :: Eq (GenTickish pass) => GenTickish pass -> GenTickish pass -> Bool
instance GHC.Classes.Eq GHC.Types.Tickish.TickishScoping
instance GHC.Show.Show GHC.Types.Tickish.TickishPlacement
instance GHC.Classes.Eq GHC.Types.Tickish.TickishPlacement
instance GHC.Classes.Eq (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassCore)
instance GHC.Classes.Ord (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassCore)
instance Data.Data.Data (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassCore)
instance Data.Data.Data (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassStg)
instance GHC.Classes.Eq (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassCmm)
instance GHC.Classes.Ord (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassCmm)
instance Data.Data.Data (GHC.Types.Tickish.GenTickish 'GHC.Types.Tickish.TickishPassCmm)
instance GHC.Utils.Outputable.Outputable GHC.Types.Tickish.TickishPlacement
-- | GHC.Core holds all the main data types for use by for the Glasgow
-- Haskell Compiler midsection
module GHC.Core
-- | 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 See Note [Variable occurrences in Core]
-- - Primitive literals
-- - Applications: note that the argument may be a Type. See
-- Note [Core let/app invariant] See Note [Representation polymorphism
-- invariants]
-- - Lambda abstraction See Note [Representation polymorphism
-- invariants]
-- - Recursive and non recursive lets. Operationally this
-- corresponds to allocating a thunk for the things bound and then
-- executing the sub-expression.
--
--
-- See Note [Core letrec invariant] See Note [Core let/app invariant] See
-- Note [Representation polymorphism invariants] See Note [Core type and
-- coercion invariant]
--
--
-- - 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
--
-- IMPORTANT: see Note [Case expression invariants]
--
--
-- - 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.
-- - Ticks. These are used to represent all the source annotation we
-- support: profiling SCCs, HPC ticks, and GHCi breakpoints.
-- - 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 -> CoercionR -> Expr b
Tick :: CoreTickish -> Expr b -> Expr b
Type :: Type -> Expr b
Coercion :: Coercion -> Expr b
infixl 4 `App`
-- | 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)
data Alt b
Alt :: AltCon -> [b] -> Expr b -> Alt 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
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
type MOutCoercion = MCoercion
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
-- | mkLetNonRec bndr rhs body wraps body in a
-- let binding bndr.
mkLetNonRec :: b -> Expr b -> Expr b -> Expr b
-- | mkLetRec binds body wraps body in a let rec
-- with the given set of binds if binds is non-empty.
mkLetRec :: [(b, Expr 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 :: Platform -> Integer -> Expr b
-- | Create a machine integer literal expression of type Int# from
-- an Integer, wrapping if necessary. If you want an expression
-- of type Int use mkIntExpr
mkIntLitWrap :: Platform -> Integer -> 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 :: Platform -> Integer -> Expr b
-- | Create a machine word literal expression of type Word# from
-- an Integer, wrapping if necessary. If you want an expression
-- of type Word use mkWordExpr
mkWordLitWrap :: Platform -> Integer -> Expr b
mkWord8Lit :: Integer -> 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
-- Note [Core type and coercion invariant], 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
-- Note [Core type and coercion invariant], 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]
-- | Is this a value-level (i.e., computationally relevant)
-- Identifier? Satisfies isId = not . isTyVar.
isId :: Var -> Bool
-- | Compares AltCons within a single list of alternatives DEFAULT
-- comes out smallest, so that sorting by AltCon puts alternatives in the
-- order required: see Note [Case expression invariants]
cmpAltCon :: AltCon -> AltCon -> Ordering
cmpAlt :: Alt a -> Alt a -> Ordering
ltAlt :: Alt a -> Alt a -> 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 function being
-- applied and the arguments to which it is applied
collectArgs :: Expr b -> (Expr b, [Arg b])
-- | Attempt to remove the last N arguments of a function call. Strip off
-- any ticks or coercions encountered along the way and any at the end.
stripNArgs :: Word -> Expr a -> Maybe (Expr a)
-- | Like collectArgs, but also collects looks through floatable
-- ticks if it means that we can find more arguments.
collectArgsTicks :: (CoreTickish -> Bool) -> Expr b -> (Expr b, [Arg b], [CoreTickish])
-- | 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
-- | fmap on the body of a lambda. wrapLamBody f (x -> body) == (x ->
-- f body)
wrapLamBody :: (CoreExpr -> CoreExpr) -> CoreExpr -> CoreExpr
-- | 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 Coercion
-- expression at its top level
isCoArg :: 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
-- | 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 GHC.Core.Unfold
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 GHC.CoreToIface 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
-- | True of a stable unfolding that is (a) always inlined; that is,
-- with an UnfWhen guidance, or (b) a DFunUnfolding which never
-- needs to be inlined
isInlineUnfolding :: Unfolding -> Bool
isBootUnfolding :: Unfolding -> Bool
hasCoreUnfolding :: Unfolding -> Bool
-- | Only returns False if there is no unfolding information available at
-- all
hasSomeUnfolding :: 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 :: CoreTickish -> 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
data AnnAlt bndr annot
AnnAlt :: AltCon -> [bndr] -> AnnExpr bndr annot -> AnnAlt bndr annot
-- | Takes a nested application expression and returns the function being
-- applied and the arguments to which it is applied
collectAnnArgs :: AnnExpr b a -> (AnnExpr b a, [AnnExpr b a])
collectAnnArgsTicks :: (CoreTickish -> Bool) -> AnnExpr b a -> (AnnExpr b a, [AnnExpr b a], [CoreTickish])
deAnnotate :: AnnExpr bndr annot -> Expr bndr
deAnnotate' :: AnnExpr' bndr annot -> Expr bndr
deAnnAlt :: AnnAlt bndr annot -> Alt bndr
deAnnBind :: AnnBind b annot -> Bind b
-- | 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 GHC.Iface.Tidy
-- 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
-- | The InScopeSet in the InScopeEnv is a superset of
-- variables that are currently in scope. See Note [The InScopeSet
-- invariant].
type RuleFun = RuleOpts -> 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
-- | Rule options
data RuleOpts
RuleOpts :: !Platform -> !Bool -> !Bool -> !Bool -> RuleOpts
-- | Target platform
[roPlatform] :: RuleOpts -> !Platform
-- | Enable more advanced numeric constant folding
[roNumConstantFolding] :: RuleOpts -> !Bool
-- | Cut down precision of Rational values to that of Float/Double if
-- disabled
[roExcessRationalPrecision] :: RuleOpts -> !Bool
-- | Enable rules for bignums
[roBignumRules] :: RuleOpts -> !Bool
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
instance Data.Data.Data GHC.Core.AltCon
instance GHC.Classes.Eq GHC.Core.AltCon
instance Data.Data.Data b => Data.Data.Data (GHC.Core.Alt b)
instance Data.Data.Data b => Data.Data.Data (GHC.Core.Expr b)
instance Data.Data.Data b => Data.Data.Data (GHC.Core.Bind b)
instance Data.Data.Data GHC.Core.IsOrphan
instance GHC.Classes.Eq GHC.Core.UnfoldingGuidance
instance GHC.Utils.Outputable.Outputable b => GHC.Utils.Outputable.Outputable (GHC.Core.TaggedBndr b)
instance GHC.Utils.Binary.Binary GHC.Core.IsOrphan
instance GHC.Classes.Ord GHC.Core.AltCon
instance GHC.Utils.Outputable.Outputable GHC.Core.AltCon
module GHC.Types.Id.Info
-- | 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 GHC.Core Can also work as a StrictWorkerId if given
-- CbvMarks. See Note [Strict Worker Ids]
JoinId :: JoinArity -> Maybe [CbvMark] -> IdDetails
-- | An Id for a worker function, which expects some arguments to
-- be passed both evaluated and tagged. See Note [Strict Worker Ids] See
-- Note [Tag Inference]
StrictWorkerId :: [CbvMark] -> 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, Maybe [CbvMark])
-- | 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.
--
-- See also Note [OneShotInfo overview] above.
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
zapUnfolding :: Unfolding -> Unfolding
-- | 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.
--
-- Invariant: the Arity of an Id must never exceed
-- the number of value arguments that appear in the type of the
-- Id. See Note [Arity and function types].
type ArityInfo = Arity
-- | It is always safe to assume that an Id has an arity of 0
unknownArity :: Arity
-- | Id arity, as computed by GHC.Core.Opt.Arity. Specifies
-- how many arguments this Id has to be applied to before it
-- doesn any meaningful work.
arityInfo :: IdInfo -> ArityInfo
setArityInfo :: IdInfo -> ArityInfo -> IdInfo
infixl 1 `setArityInfo`
ppArityInfo :: Int -> SDoc
-- | How this is called. This is the number of arguments to which a binding
-- can be eta-expanded without losing any sharing. n = all calls
-- have at least n arguments
callArityInfo :: IdInfo -> ArityInfo
setCallArityInfo :: IdInfo -> ArityInfo -> IdInfo
-- | A strictness signature. Digests how a function uses its arguments if
-- applied to at least arityInfo arguments.
dmdSigInfo :: IdInfo -> DmdSig
setDmdSigInfo :: IdInfo -> DmdSig -> IdInfo
infixl 1 `setDmdSigInfo`
-- | Information on whether the function will ultimately return a freshly
-- allocated constructor.
cprSigInfo :: IdInfo -> CprSig
setCprSigInfo :: IdInfo -> CprSig -> IdInfo
infixl 1 `setCprSigInfo`
-- | ID demand information
demandInfo :: IdInfo -> Demand
setDemandInfo :: IdInfo -> Demand -> IdInfo
infixl 1 `setDemandInfo`
pprStrictness :: DmdSig -> SDoc
-- | The Ids unfolding
realUnfoldingInfo :: IdInfo -> Unfolding
-- | Essentially returns the realUnfoldingInfo field, but does not
-- expose the unfolding of a strong loop breaker.
--
-- This is the right thing to call if you plan to decide whether an
-- unfolding will inline.
unfoldingInfo :: IdInfo -> Unfolding
setUnfoldingInfo :: IdInfo -> Unfolding -> IdInfo
infixl 1 `setUnfoldingInfo`
-- | True of a non-loop-breaker Id that has a stable
-- unfolding that is (a) always inlined; that is, with an UnfWhen
-- guidance, or (b) a DFunUnfolding which never needs to be inlined
hasInlineUnfolding :: IdInfo -> Bool
-- | 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 attached 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 -> {-# UNPACK #-} !BranchCount -> !InterestingCxt -> !TailCallInfo -> OccInfo
[occ_in_lam] :: OccInfo -> !InsideLam
[occ_n_br] :: OccInfo -> {-# UNPACK #-} !BranchCount
[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
data InsideLam
-- | Occurs inside a non-linear lambda Substituting a redex for this
-- occurrence is dangerous because it might duplicate work.
IsInsideLam :: InsideLam
NotInsideLam :: InsideLam
type BranchCount = Int
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 specializations 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 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`
tagSigInfo :: IdInfo -> Maybe TagSig
-- | 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`
-- | Information about an identifier, from the code generator's point of
-- view. Every identifier is bound to a LambdaFormInfo in the
-- environment, which gives the code generator enough info to be able to
-- tail call or return that identifier.
data LambdaFormInfo
lfInfo :: IdInfo -> Maybe LambdaFormInfo
setLFInfo :: IdInfo -> LambdaFormInfo -> IdInfo
setTagSig :: IdInfo -> TagSig -> IdInfo
tagSig :: IdInfo -> Maybe TagSig
-- | 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 representation-polymorphic
-- type?
levityInfo :: IdInfo -> LevityInfo
-- | Marks an IdInfo describing an Id that is never
-- representation-polymorphic (even when applied). The Type is only there
-- for checking that it's really never representation-polymorphic.
setNeverRepPoly :: HasDebugCallStack => IdInfo -> Type -> IdInfo
infixl 1 `setNeverRepPoly`
setLevityInfoWithType :: IdInfo -> Type -> IdInfo
infixl 1 `setLevityInfoWithType`
isNeverRepPolyIdInfo :: IdInfo -> Bool
instance GHC.Classes.Eq GHC.Types.Id.Info.RecSelParent
instance GHC.Classes.Ord GHC.Types.Id.Info.CafInfo
instance GHC.Classes.Eq GHC.Types.Id.Info.CafInfo
instance GHC.Classes.Eq GHC.Types.Id.Info.LevityInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Id.Info.LevityInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Id.Info.IdDetails
instance GHC.Utils.Outputable.Outputable GHC.Types.Id.Info.TickBoxOp
instance GHC.Utils.Outputable.Outputable GHC.Types.Id.Info.CafInfo
instance GHC.Utils.Outputable.Outputable GHC.Types.Id.Info.RecSelParent
-- | GHC uses several kinds of name internally:
--
--
module GHC.Types.Id
-- | Variable
--
-- Essentially a typed Name, that may also contain some additional
-- information about the Var and its use sites.
data Var
-- | Identifier
type Id = Var
-- | Is this a value-level (i.e., computationally relevant)
-- Identifier? Satisfies isId = not . isTyVar.
isId :: Var -> Bool
type InVar = Var
type InId = Id
type OutVar = Var
type OutId = Id
-- | For an explanation of global vs. local Ids, see
-- GHC.Types.Var.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
-- GHC.Types.Var#globalvslocal
mkLocalId :: HasDebugCallStack => Name -> Mult -> 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 -> Mult -> Type -> Id
mkLocalIdWithInfo :: HasDebugCallStack => Name -> Mult -> 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 -> Mult -> Type -> Id
mkSysLocalM :: MonadUnique m => FastString -> Mult -> Type -> m Id
-- | Like mkSysLocal, but checks to see if we have a covar type
mkSysLocalOrCoVar :: FastString -> Unique -> Mult -> Type -> Id
mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Mult -> Type -> m Id
-- | Create a user local Id. These are local Ids (see
-- GHC.Types.Var#globalvslocal) with a name and location that the
-- user might recognize
mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id
-- | Like mkUserLocal, but checks if we have a coercion type
mkUserLocalOrCoVar :: OccName -> Unique -> Mult -> 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
mkScaledTemplateLocal :: Int -> Scaled Type -> Id
-- | Workers get local names. CoreTidy will externalise these if
-- necessary
mkWorkerId :: Unique -> Id -> Type -> Id
idName :: Id -> Name
idType :: Id -> Kind
idMult :: Id -> Mult
idScaledType :: Id -> Scaled Type
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
recordSelectorTyCon_maybe :: Id -> Maybe 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
setIdMult :: Id -> Mult -> Id
updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id
updateIdTypeAndMult :: (Type -> Type) -> Id -> Id
updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m 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 :: HasDebugCallStack => (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
zapIdDmdSig :: Id -> Id
zapStableUnfolding :: Id -> Id
transferPolyIdInfo :: Id -> [Var] -> Id -> Id
scaleIdBy :: Mult -> Id -> Id
-- | Like scaleIdBy, but skips non-Ids. Useful for scaling a mixed
-- list of ids and tyvars.
scaleVarBy :: Mult -> Var -> Var
-- | 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 :: 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
isDataConWrapId :: Id -> Bool
isDataConWrapId_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 diverges or throws an
-- exception See Note [Dead ends] in GHC.Types.Demand.
isDeadEndId :: 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
type JoinId = Id
isJoinId :: Var -> Bool
-- | Doesn't return strictness marks
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 GHC.Core.Opt.Arity
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
-- | Returns the Ids unfolding, but does not expose the unfolding of
-- a strong loop breaker. See unfoldingInfo.
--
-- If you really want the unfolding of a strong loopbreaker, call
-- realIdUnfolding.
idUnfolding :: Id -> Unfolding
-- | Expose the unfolding if there is one, including for loop breakers
realIdUnfolding :: Id -> Unfolding
idSpecialisation :: Id -> RuleInfo
idCoreRules :: Id -> [CoreRule]
idHasRules :: Id -> Bool
idCafInfo :: Id -> CafInfo
infixl 1 `idCafInfo`
idLFInfo_maybe :: Id -> Maybe LambdaFormInfo
idOneShotInfo :: Id -> OneShotInfo
-- | Like idOneShotInfo, but taking the Horrible State Hack in to
-- account See Note [The state-transformer hack] in
-- GHC.Core.Opt.Arity
idStateHackOneShotInfo :: Id -> OneShotInfo
idOccInfo :: Id -> OccInfo
isNeverRepPolyId :: 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
setIdLFInfo :: Id -> LambdaFormInfo -> Id
setIdDemandInfo :: Id -> Demand -> Id
infixl 1 `setIdDemandInfo`
setIdDmdSig :: Id -> DmdSig -> Id
infixl 1 `setIdDmdSig`
setIdCprSig :: Id -> CprSig -> Id
infixl 1 `setIdCprSig`
-- | If all marks are NotMarkedStrict we just set nothing.
setIdCbvMarks :: Id -> [CbvMark] -> Id
infixl 1 `setIdCbvMarks`
idCbvMarks_maybe :: Id -> Maybe [CbvMark]
idCbvMarkArity :: Id -> Arity
idDemandInfo :: Id -> Demand
-- | Accesses the Id's dmdSigInfo.
idDmdSig :: Id -> DmdSig
idCprSig :: Id -> CprSig
idTagSig_maybe :: Id -> Maybe TagSig
setIdTagSig :: Id -> TagSig -> Id
-- | A global typecheckable-thing, essentially anything that has a name.
module GHC.Types.TyThing
-- | 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
-- GHC.Tc.Utils.Env for how to retrieve a TyThing given a
-- Name.
data TyThing
AnId :: Id -> TyThing
AConLike :: ConLike -> TyThing
ATyCon :: TyCon -> TyThing
ACoAxiom :: CoAxiom Branched -> TyThing
-- | 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
mkATyCon :: TyCon -> TyThing
mkAnId :: Id -> TyThing
pprShortTyThing :: TyThing -> SDoc
pprTyThingCategory :: TyThing -> SDoc
tyThingCategory :: TyThing -> String
-- | 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]
implicitConLikeThings :: ConLike -> [TyThing]
implicitClassThings :: Class -> [TyThing]
implicitTyConThings :: TyCon -> [TyThing]
implicitCoTyCon :: TyCon -> [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
-- | 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
-- | 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 :: HasDebugCallStack => TyThing -> TyCon
-- | Get the CoAxiom from a TyThing if it is a coercion axiom
-- thing. Panics otherwise
tyThingCoAxiom :: HasDebugCallStack => TyThing -> CoAxiom Branched
-- | Get the DataCon from a TyThing if it is a data
-- constructor thing. Panics otherwise
tyThingDataCon :: HasDebugCallStack => TyThing -> DataCon
-- | Get the ConLike from a TyThing if it is a data
-- constructor thing. Panics otherwise
tyThingConLike :: HasDebugCallStack => TyThing -> ConLike
-- | Get the Id from a TyThing if it is a id *or* data
-- constructor thing. Panics otherwise
tyThingId :: HasDebugCallStack => TyThing -> Id
instance GHC.Types.TyThing.MonadThings m => GHC.Types.TyThing.MonadThings (Control.Monad.Trans.Reader.ReaderT s m)
instance GHC.Utils.Outputable.Outputable GHC.Types.TyThing.TyThing
instance GHC.Types.Name.NamedThing GHC.Types.TyThing.TyThing
module GHC.Types.TypeEnv
-- | A map from Names to TyThings, constructed by
-- typechecking local declarations or interface files
type TypeEnv = NameEnv TyThing
emptyTypeEnv :: TypeEnv
lookupTypeEnv :: TypeEnv -> Name -> Maybe TyThing
mkTypeEnv :: [TyThing] -> TypeEnv
typeEnvFromEntities :: [Id] -> [TyCon] -> [PatSyn] -> [FamInst] -> TypeEnv
mkTypeEnvWithImplicits :: [TyThing] -> TypeEnv
extendTypeEnv :: TypeEnv -> TyThing -> TypeEnv
extendTypeEnvList :: TypeEnv -> [TyThing] -> TypeEnv
extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnv
plusTypeEnv :: TypeEnv -> TypeEnv -> TypeEnv
typeEnvElts :: TypeEnv -> [TyThing]
typeEnvTyCons :: TypeEnv -> [TyCon]
typeEnvIds :: TypeEnv -> [Id]
typeEnvPatSyns :: TypeEnv -> [PatSyn]
typeEnvDataCons :: TypeEnv -> [DataCon]
typeEnvCoAxioms :: TypeEnv -> [CoAxiom Branched]
typeEnvClasses :: TypeEnv -> [Class]
-- | This module is about types that can be defined in Haskell, but which
-- must be wired into the compiler nonetheless. C.f module
-- GHC.Builtin.Types.Prim
module GHC.Builtin.Types
mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name
mkWiredInIdName :: Module -> FastString -> Unique -> Id -> Name
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
ordLTDataCon :: DataCon
ordLTDataConId :: Id
ordEQDataCon :: DataCon
ordEQDataConId :: Id
ordGTDataCon :: DataCon
ordGTDataConId :: 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
stringTyCon_RDR :: RdrName
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
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
nonEmptyTyCon :: TyCon
nonEmptyTyConName :: Name
nonEmptyDataCon :: DataCon
nonEmptyDataConName :: Name
maybeTyCon :: TyCon
maybeTyConName :: Name
nothingDataCon :: DataCon
nothingDataConName :: Name
promotedNothingDataCon :: TyCon
justDataCon :: DataCon
justDataConName :: Name
promotedJustDataCon :: TyCon
mkPromotedMaybeTy :: Kind -> Maybe Type -> Type
mkMaybeTy :: Type -> Kind
isPromotedMaybeTy :: Type -> Maybe (Maybe Type)
-- | Make a tuple type. The list of types should not include any
-- RuntimeRep specifications. Boxed 1-tuples are flattened. See Note
-- [One-tuples]
mkTupleTy :: Boxity -> [Type] -> Type
-- | Make a tuple type. The list of types should not include any
-- RuntimeRep specifications. Boxed 1-tuples are *not* flattened. See
-- Note [One-tuples] and Note [Don't flatten tuples from HsSyn] in
-- GHC.Core.Make
mkTupleTy1 :: Boxity -> [Type] -> Type
-- | Build the type of a small tuple that holds the specified type of thing
-- Flattens 1-tuples. See Note [One-tuples].
mkBoxedTupleTy :: [Type] -> Type
mkTupleStr :: Boxity -> Arity -> String
tupleTyCon :: Boxity -> Arity -> TyCon
tupleDataCon :: Boxity -> Arity -> DataCon
tupleTyConName :: TupleSort -> Arity -> Name
tupleDataConName :: Boxity -> Arity -> Name
promotedTupleDataCon :: Boxity -> Arity -> TyCon
unitTyCon :: TyCon
unitDataCon :: DataCon
unitDataConId :: Id
unitTy :: Type
unitTyConKey :: Unique
soloTyCon :: TyCon
pairTyCon :: TyCon
mkPromotedPairTy :: Kind -> Kind -> Type -> Type -> Type
isPromotedPairType :: Type -> Maybe (Type, Type)
unboxedUnitTy :: Type
unboxedUnitTyCon :: TyCon
unboxedUnitDataCon :: DataCon
-- | Specialization of unboxedTupleSumKind for tuples
unboxedTupleKind :: [Type] -> Kind
-- | Specialization of unboxedTupleSumKind for sums
unboxedSumKind :: [Type] -> Kind
-- | Replaces constraint tuple names with corresponding boxed ones.
filterCTuple :: RdrName -> RdrName
cTupleTyCon :: Arity -> TyCon
cTupleTyConName :: Arity -> Name
cTupleTyConNames :: [Name]
isCTupleTyConName :: Name -> Bool
-- | If the given name is that of a constraint tuple, return its arity.
cTupleTyConNameArity_maybe :: Name -> Maybe Arity
cTupleDataCon :: Arity -> DataCon
cTupleDataConName :: Arity -> Name
cTupleDataConNames :: [Name]
cTupleSelId :: ConTag -> Arity -> Id
cTupleSelIdName :: ConTag -> Arity -> Name
anyTyCon :: TyCon
anyTy :: Type
anyTypeOfKind :: Kind -> Type
-- | Make a fake, recovery TyCon from an existing one. Used when
-- recovering from errors in type declarations
makeRecoveryTyCon :: TyCon -> TyCon
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
typeSymbolKindCon :: TyCon
typeSymbolKind :: Kind
isLiftedTypeKindTyConName :: Name -> Bool
typeToTypeKind :: Kind
-- |
-- type LiftedRep = 'BoxedRep 'Lifted
--
liftedRepTyCon :: TyCon
-- |
-- type UnliftedRep = 'BoxedRep 'Unlifted
--
unliftedRepTyCon :: TyCon
constraintKind :: Kind
liftedTypeKind :: Type
unliftedTypeKind :: Type
zeroBitTypeKind :: Type
constraintKindTyCon :: TyCon
liftedTypeKindTyCon :: TyCon
-- |
-- type UnliftedType = TYPE ('BoxedRep 'Unlifted)
--
unliftedTypeKindTyCon :: TyCon
constraintKindTyConName :: Name
liftedTypeKindTyConName :: Name
unliftedTypeKindTyConName :: Name
liftedRepTyConName :: Name
unliftedRepTyConName :: Name
heqTyCon :: TyCon
heqTyConName :: Name
heqClass :: Class
heqDataCon :: DataCon
eqTyCon :: TyCon
eqTyConName :: Name
eqClass :: Class
eqDataCon :: DataCon
eqTyCon_RDR :: RdrName
coercibleTyCon :: TyCon
coercibleTyConName :: Name
coercibleDataCon :: DataCon
coercibleClass :: Class
runtimeRepTyCon :: TyCon
levityTyCon :: TyCon
vecCountTyCon :: TyCon
vecElemTyCon :: TyCon
boxedRepDataConTyCon :: TyCon
runtimeRepTy :: Type
levityTy :: Type
liftedRepTy :: Type
unliftedRepTy :: Type
zeroBitRepTy :: Type
vecRepDataConTyCon :: TyCon
tupleRepDataConTyCon :: TyCon
sumRepDataConTyCon :: TyCon
liftedDataConTyCon :: TyCon
unliftedDataConTyCon :: TyCon
liftedDataConTy :: Type
unliftedDataConTy :: Type
intRepDataConTy :: Type
int8RepDataConTy :: Type
int16RepDataConTy :: Type
int32RepDataConTy :: Type
int64RepDataConTy :: Type
wordRepDataConTy :: Type
word8RepDataConTy :: Type
word16RepDataConTy :: Type
word32RepDataConTy :: 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
multiplicityTyConName :: Name
oneDataConName :: Name
manyDataConName :: Name
multiplicityTy :: Type
multiplicityTyCon :: TyCon
oneDataCon :: DataCon
manyDataCon :: DataCon
oneDataConTy :: Type
manyDataConTy :: Type
oneDataConTyCon :: TyCon
manyDataConTyCon :: TyCon
multMulTyCon :: TyCon
unrestrictedFunTyCon :: TyCon
unrestrictedFunTyConName :: Name
integerTy :: Type
integerTyCon :: TyCon
integerTyConName :: Name
integerISDataCon :: DataCon
integerISDataConName :: Name
integerIPDataCon :: DataCon
integerIPDataConName :: Name
integerINDataCon :: DataCon
integerINDataConName :: Name
naturalTy :: Type
naturalTyCon :: TyCon
naturalTyConName :: Name
naturalNSDataCon :: DataCon
naturalNSDataConName :: Name
naturalNBDataCon :: DataCon
naturalNBDataConName :: Name
-- | The Name Cache
module GHC.Types.Name.Cache
-- | 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 :: {-# UNPACK #-} !Char -> {-# UNPACK #-} !MVar OrigNameCache -> NameCache
[nsUniqChar] :: NameCache -> {-# UNPACK #-} !Char
[nsNames] :: NameCache -> {-# UNPACK #-} !MVar OrigNameCache
initNameCache :: Char -> [Name] -> IO NameCache
takeUniqFromNameCache :: NameCache -> IO Unique
-- | Update the name cache with the given function
updateNameCache' :: NameCache -> (OrigNameCache -> IO (OrigNameCache, c)) -> IO c
-- | Update the name cache with the given function
--
-- Additionally, it ensures that the given Module and OccName are
-- evaluated. If not, chaos can ensue: we read the name-cache then pull
-- on mod (say) which does some stuff that modifies the name cache This
-- did happen, with tycon_mod in GHC.IfaceToCore.tcIfaceAlt (DataAlt..)
updateNameCache :: NameCache -> Module -> OccName -> (OrigNameCache -> IO (OrigNameCache, c)) -> IO c
-- | Per-module cache of original OccNames given Names
type OrigNameCache = ModuleEnv (OccEnv Name)
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
extendOrigNameCache' :: OrigNameCache -> Name -> OrigNameCache
extendOrigNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
module GHC.Builtin.PrimOps
data PrimOp
CharGtOp :: PrimOp
CharGeOp :: PrimOp
CharEqOp :: PrimOp
CharNeOp :: PrimOp
CharLtOp :: PrimOp
CharLeOp :: PrimOp
OrdOp :: PrimOp
Int8ToIntOp :: PrimOp
IntToInt8Op :: PrimOp
Int8NegOp :: PrimOp
Int8AddOp :: PrimOp
Int8SubOp :: PrimOp
Int8MulOp :: PrimOp
Int8QuotOp :: PrimOp
Int8RemOp :: PrimOp
Int8QuotRemOp :: PrimOp
Int8SllOp :: PrimOp
Int8SraOp :: PrimOp
Int8SrlOp :: PrimOp
Int8ToWord8Op :: PrimOp
Int8EqOp :: PrimOp
Int8GeOp :: PrimOp
Int8GtOp :: PrimOp
Int8LeOp :: PrimOp
Int8LtOp :: PrimOp
Int8NeOp :: PrimOp
Word8ToWordOp :: PrimOp
WordToWord8Op :: PrimOp
Word8AddOp :: PrimOp
Word8SubOp :: PrimOp
Word8MulOp :: PrimOp
Word8QuotOp :: PrimOp
Word8RemOp :: PrimOp
Word8QuotRemOp :: PrimOp
Word8AndOp :: PrimOp
Word8OrOp :: PrimOp
Word8XorOp :: PrimOp
Word8NotOp :: PrimOp
Word8SllOp :: PrimOp
Word8SrlOp :: PrimOp
Word8ToInt8Op :: PrimOp
Word8EqOp :: PrimOp
Word8GeOp :: PrimOp
Word8GtOp :: PrimOp
Word8LeOp :: PrimOp
Word8LtOp :: PrimOp
Word8NeOp :: PrimOp
Int16ToIntOp :: PrimOp
IntToInt16Op :: PrimOp
Int16NegOp :: PrimOp
Int16AddOp :: PrimOp
Int16SubOp :: PrimOp
Int16MulOp :: PrimOp
Int16QuotOp :: PrimOp
Int16RemOp :: PrimOp
Int16QuotRemOp :: PrimOp
Int16SllOp :: PrimOp
Int16SraOp :: PrimOp
Int16SrlOp :: PrimOp
Int16ToWord16Op :: PrimOp
Int16EqOp :: PrimOp
Int16GeOp :: PrimOp
Int16GtOp :: PrimOp
Int16LeOp :: PrimOp
Int16LtOp :: PrimOp
Int16NeOp :: PrimOp
Word16ToWordOp :: PrimOp
WordToWord16Op :: PrimOp
Word16AddOp :: PrimOp
Word16SubOp :: PrimOp
Word16MulOp :: PrimOp
Word16QuotOp :: PrimOp
Word16RemOp :: PrimOp
Word16QuotRemOp :: PrimOp
Word16AndOp :: PrimOp
Word16OrOp :: PrimOp
Word16XorOp :: PrimOp
Word16NotOp :: PrimOp
Word16SllOp :: PrimOp
Word16SrlOp :: PrimOp
Word16ToInt16Op :: PrimOp
Word16EqOp :: PrimOp
Word16GeOp :: PrimOp
Word16GtOp :: PrimOp
Word16LeOp :: PrimOp
Word16LtOp :: PrimOp
Word16NeOp :: PrimOp
Int32ToIntOp :: PrimOp
IntToInt32Op :: PrimOp
Int32NegOp :: PrimOp
Int32AddOp :: PrimOp
Int32SubOp :: PrimOp
Int32MulOp :: PrimOp
Int32QuotOp :: PrimOp
Int32RemOp :: PrimOp
Int32QuotRemOp :: PrimOp
Int32SllOp :: PrimOp
Int32SraOp :: PrimOp
Int32SrlOp :: PrimOp
Int32ToWord32Op :: PrimOp
Int32EqOp :: PrimOp
Int32GeOp :: PrimOp
Int32GtOp :: PrimOp
Int32LeOp :: PrimOp
Int32LtOp :: PrimOp
Int32NeOp :: PrimOp
Word32ToWordOp :: PrimOp
WordToWord32Op :: PrimOp
Word32AddOp :: PrimOp
Word32SubOp :: PrimOp
Word32MulOp :: PrimOp
Word32QuotOp :: PrimOp
Word32RemOp :: PrimOp
Word32QuotRemOp :: PrimOp
Word32AndOp :: PrimOp
Word32OrOp :: PrimOp
Word32XorOp :: PrimOp
Word32NotOp :: PrimOp
Word32SllOp :: PrimOp
Word32SrlOp :: PrimOp
Word32ToInt32Op :: PrimOp
Word32EqOp :: PrimOp
Word32GeOp :: PrimOp
Word32GtOp :: PrimOp
Word32LeOp :: PrimOp
Word32LtOp :: PrimOp
Word32NeOp :: PrimOp
Int64ToIntOp :: PrimOp
IntToInt64Op :: PrimOp
Int64NegOp :: PrimOp
Int64AddOp :: PrimOp
Int64SubOp :: PrimOp
Int64MulOp :: PrimOp
Int64QuotOp :: PrimOp
Int64RemOp :: PrimOp
Int64SllOp :: PrimOp
Int64SraOp :: PrimOp
Int64SrlOp :: PrimOp
Int64ToWord64Op :: PrimOp
Int64EqOp :: PrimOp
Int64GeOp :: PrimOp
Int64GtOp :: PrimOp
Int64LeOp :: PrimOp
Int64LtOp :: PrimOp
Int64NeOp :: PrimOp
Word64ToWordOp :: PrimOp
WordToWord64Op :: PrimOp
Word64AddOp :: PrimOp
Word64SubOp :: PrimOp
Word64MulOp :: PrimOp
Word64QuotOp :: PrimOp
Word64RemOp :: PrimOp
Word64AndOp :: PrimOp
Word64OrOp :: PrimOp
Word64XorOp :: PrimOp
Word64NotOp :: PrimOp
Word64SllOp :: PrimOp
Word64SrlOp :: PrimOp
Word64ToInt64Op :: PrimOp
Word64EqOp :: PrimOp
Word64GeOp :: PrimOp
Word64GtOp :: PrimOp
Word64LeOp :: PrimOp
Word64LtOp :: PrimOp
Word64NeOp :: PrimOp
IntAddOp :: PrimOp
IntSubOp :: PrimOp
IntMulOp :: PrimOp
IntMul2Op :: PrimOp
IntMulMayOfloOp :: PrimOp
IntQuotOp :: PrimOp
IntRemOp :: PrimOp
IntQuotRemOp :: PrimOp
IntAndOp :: PrimOp
IntOrOp :: PrimOp
IntXorOp :: PrimOp
IntNotOp :: PrimOp
IntNegOp :: PrimOp
IntAddCOp :: PrimOp
IntSubCOp :: PrimOp
IntGtOp :: PrimOp
IntGeOp :: PrimOp
IntEqOp :: PrimOp
IntNeOp :: PrimOp
IntLtOp :: PrimOp
IntLeOp :: PrimOp
ChrOp :: PrimOp
IntToWordOp :: PrimOp
IntToFloatOp :: PrimOp
IntToDoubleOp :: PrimOp
WordToFloatOp :: PrimOp
WordToDoubleOp :: PrimOp
IntSllOp :: PrimOp
IntSraOp :: PrimOp
IntSrlOp :: PrimOp
WordAddOp :: PrimOp
WordAddCOp :: PrimOp
WordSubCOp :: PrimOp
WordAdd2Op :: PrimOp
WordSubOp :: PrimOp
WordMulOp :: PrimOp
WordMul2Op :: PrimOp
WordQuotOp :: PrimOp
WordRemOp :: PrimOp
WordQuotRemOp :: PrimOp
WordQuotRem2Op :: PrimOp
WordAndOp :: PrimOp
WordOrOp :: PrimOp
WordXorOp :: PrimOp
WordNotOp :: PrimOp
WordSllOp :: PrimOp
WordSrlOp :: PrimOp
WordToIntOp :: PrimOp
WordGtOp :: PrimOp
WordGeOp :: PrimOp
WordEqOp :: PrimOp
WordNeOp :: PrimOp
WordLtOp :: PrimOp
WordLeOp :: PrimOp
PopCnt8Op :: PrimOp
PopCnt16Op :: PrimOp
PopCnt32Op :: PrimOp
PopCnt64Op :: PrimOp
PopCntOp :: PrimOp
Pdep8Op :: PrimOp
Pdep16Op :: PrimOp
Pdep32Op :: PrimOp
Pdep64Op :: PrimOp
PdepOp :: PrimOp
Pext8Op :: PrimOp
Pext16Op :: PrimOp
Pext32Op :: PrimOp
Pext64Op :: PrimOp
PextOp :: 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
BRev8Op :: PrimOp
BRev16Op :: PrimOp
BRev32Op :: PrimOp
BRev64Op :: PrimOp
BRevOp :: 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
DoubleToIntOp :: PrimOp
DoubleToFloatOp :: PrimOp
DoubleExpOp :: PrimOp
DoubleExpM1Op :: PrimOp
DoubleLogOp :: PrimOp
DoubleLog1POp :: PrimOp
DoubleSqrtOp :: PrimOp
DoubleSinOp :: PrimOp
DoubleCosOp :: PrimOp
DoubleTanOp :: PrimOp
DoubleAsinOp :: PrimOp
DoubleAcosOp :: PrimOp
DoubleAtanOp :: PrimOp
DoubleSinhOp :: PrimOp
DoubleCoshOp :: PrimOp
DoubleTanhOp :: PrimOp
DoubleAsinhOp :: PrimOp
DoubleAcoshOp :: PrimOp
DoubleAtanhOp :: 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
FloatToIntOp :: PrimOp
FloatExpOp :: PrimOp
FloatExpM1Op :: PrimOp
FloatLogOp :: PrimOp
FloatLog1POp :: PrimOp
FloatSqrtOp :: PrimOp
FloatSinOp :: PrimOp
FloatCosOp :: PrimOp
FloatTanOp :: PrimOp
FloatAsinOp :: PrimOp
FloatAcosOp :: PrimOp
FloatAtanOp :: PrimOp
FloatSinhOp :: PrimOp
FloatCoshOp :: PrimOp
FloatTanhOp :: PrimOp
FloatAsinhOp :: PrimOp
FloatAcoshOp :: PrimOp
FloatAtanhOp :: PrimOp
FloatPowerOp :: PrimOp
FloatToDoubleOp :: PrimOp
FloatDecode_IntOp :: PrimOp
NewArrayOp :: 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
ShrinkSmallMutableArrayOp_Char :: PrimOp
ReadSmallArrayOp :: PrimOp
WriteSmallArrayOp :: PrimOp
SizeofSmallArrayOp :: PrimOp
SizeofSmallMutableArrayOp :: PrimOp
GetSizeofSmallMutableArrayOp :: 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
MutableByteArrayContents_Char :: 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
IndexByteArrayOp_Word8AsChar :: PrimOp
IndexByteArrayOp_Word8AsWideChar :: PrimOp
IndexByteArrayOp_Word8AsInt :: PrimOp
IndexByteArrayOp_Word8AsWord :: PrimOp
IndexByteArrayOp_Word8AsAddr :: PrimOp
IndexByteArrayOp_Word8AsFloat :: PrimOp
IndexByteArrayOp_Word8AsDouble :: PrimOp
IndexByteArrayOp_Word8AsStablePtr :: PrimOp
IndexByteArrayOp_Word8AsInt16 :: PrimOp
IndexByteArrayOp_Word8AsInt32 :: PrimOp
IndexByteArrayOp_Word8AsInt64 :: PrimOp
IndexByteArrayOp_Word8AsWord16 :: PrimOp
IndexByteArrayOp_Word8AsWord32 :: PrimOp
IndexByteArrayOp_Word8AsWord64 :: 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
ReadByteArrayOp_Word8AsChar :: PrimOp
ReadByteArrayOp_Word8AsWideChar :: PrimOp
ReadByteArrayOp_Word8AsInt :: PrimOp
ReadByteArrayOp_Word8AsWord :: PrimOp
ReadByteArrayOp_Word8AsAddr :: PrimOp
ReadByteArrayOp_Word8AsFloat :: PrimOp
ReadByteArrayOp_Word8AsDouble :: PrimOp
ReadByteArrayOp_Word8AsStablePtr :: PrimOp
ReadByteArrayOp_Word8AsInt16 :: PrimOp
ReadByteArrayOp_Word8AsInt32 :: PrimOp
ReadByteArrayOp_Word8AsInt64 :: PrimOp
ReadByteArrayOp_Word8AsWord16 :: PrimOp
ReadByteArrayOp_Word8AsWord32 :: PrimOp
ReadByteArrayOp_Word8AsWord64 :: 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
WriteByteArrayOp_Word8AsChar :: PrimOp
WriteByteArrayOp_Word8AsWideChar :: PrimOp
WriteByteArrayOp_Word8AsInt :: PrimOp
WriteByteArrayOp_Word8AsWord :: PrimOp
WriteByteArrayOp_Word8AsAddr :: PrimOp
WriteByteArrayOp_Word8AsFloat :: PrimOp
WriteByteArrayOp_Word8AsDouble :: PrimOp
WriteByteArrayOp_Word8AsStablePtr :: PrimOp
WriteByteArrayOp_Word8AsInt16 :: PrimOp
WriteByteArrayOp_Word8AsInt32 :: PrimOp
WriteByteArrayOp_Word8AsInt64 :: PrimOp
WriteByteArrayOp_Word8AsWord16 :: PrimOp
WriteByteArrayOp_Word8AsWord32 :: PrimOp
WriteByteArrayOp_Word8AsWord64 :: PrimOp
CompareByteArraysOp :: PrimOp
CopyByteArrayOp :: PrimOp
CopyMutableByteArrayOp :: PrimOp
CopyByteArrayToAddrOp :: PrimOp
CopyMutableByteArrayToAddrOp :: PrimOp
CopyAddrToByteArrayOp :: PrimOp
SetByteArrayOp :: PrimOp
AtomicReadByteArrayOp_Int :: PrimOp
AtomicWriteByteArrayOp_Int :: PrimOp
CasByteArrayOp_Int :: PrimOp
CasByteArrayOp_Int8 :: PrimOp
CasByteArrayOp_Int16 :: PrimOp
CasByteArrayOp_Int32 :: PrimOp
CasByteArrayOp_Int64 :: PrimOp
FetchAddByteArrayOp_Int :: PrimOp
FetchSubByteArrayOp_Int :: PrimOp
FetchAndByteArrayOp_Int :: PrimOp
FetchNandByteArrayOp_Int :: PrimOp
FetchOrByteArrayOp_Int :: PrimOp
FetchXorByteArrayOp_Int :: PrimOp
AddrAddOp :: PrimOp
AddrSubOp :: PrimOp
AddrRemOp :: PrimOp
AddrToIntOp :: PrimOp
IntToAddrOp :: 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
InterlockedExchange_Addr :: PrimOp
InterlockedExchange_Word :: PrimOp
CasAddrOp_Addr :: PrimOp
CasAddrOp_Word :: PrimOp
CasAddrOp_Word8 :: PrimOp
CasAddrOp_Word16 :: PrimOp
CasAddrOp_Word32 :: PrimOp
CasAddrOp_Word64 :: PrimOp
FetchAddAddrOp_Word :: PrimOp
FetchSubAddrOp_Word :: PrimOp
FetchAndAddrOp_Word :: PrimOp
FetchNandAddrOp_Word :: PrimOp
FetchOrAddrOp_Word :: PrimOp
FetchXorAddrOp_Word :: PrimOp
AtomicReadAddrOp_Word :: PrimOp
AtomicWriteAddrOp_Word :: PrimOp
NewMutVarOp :: PrimOp
ReadMutVarOp :: PrimOp
WriteMutVarOp :: PrimOp
AtomicModifyMutVar2Op :: PrimOp
AtomicModifyMutVar_Op :: 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
NewTVarOp :: PrimOp
ReadTVarOp :: PrimOp
ReadTVarIOOp :: PrimOp
WriteTVarOp :: PrimOp
NewMVarOp :: PrimOp
TakeMVarOp :: PrimOp
TryTakeMVarOp :: PrimOp
PutMVarOp :: PrimOp
TryPutMVarOp :: PrimOp
ReadMVarOp :: PrimOp
TryReadMVarOp :: PrimOp
IsEmptyMVarOp :: PrimOp
NewIOPortOp :: PrimOp
ReadIOPortOp :: PrimOp
WriteIOPortOp :: 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
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
KeepAliveOp :: PrimOp
DataToTagOp :: PrimOp
TagToEnumOp :: PrimOp
AddrToAnyOp :: PrimOp
AnyToAddrOp :: PrimOp
MkApUpd0_Op :: PrimOp
NewBCOOp :: PrimOp
UnpackClosureOp :: PrimOp
ClosureSizeOp :: PrimOp
GetApStackValOp :: PrimOp
GetCCSOfOp :: PrimOp
GetCurrentCCSOp :: PrimOp
ClearCCSOp :: PrimOp
WhereFromOp :: PrimOp
TraceEventOp :: PrimOp
TraceEventBinaryOp :: PrimOp
TraceMarkerOp :: PrimOp
SetThreadAllocationCounter :: 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 -> ([TyVarBinder], [Type], Type, Arity, DmdSig)
primOpResultType :: PrimOp -> Type
primOpTag :: PrimOp -> Int
maxPrimOpTag :: Int
primOpOcc :: PrimOp -> OccName
-- | Returns the Id of the wrapper associated with the given
-- PrimOp. See Note [Primop wrappers].
primOpWrapperId :: PrimOp -> Id
tagToEnumKey :: Unique
primOpOutOfLine :: PrimOp -> Bool
primOpCodeSize :: PrimOp -> Int
primOpOkForSpeculation :: PrimOp -> Bool
primOpOkForSideEffects :: PrimOp -> Bool
primOpIsCheap :: PrimOp -> Bool
primOpFixity :: PrimOp -> Maybe Fixity
primOpDocs :: [(String, String)]
-- | True of dyadic operators that can fail only if the second arg is zero!
--
-- This function probably belongs in an automagically generated file..
-- but it's such a special case I thought I'd leave it here for now.
primOpIsDiv :: PrimOp -> Bool
getPrimOpResultInfo :: PrimOp -> PrimOpResultInfo
isComparisonPrimOp :: PrimOp -> Bool
data PrimOpResultInfo
ReturnsPrim :: PrimRep -> PrimOpResultInfo
ReturnsAlg :: TyCon -> PrimOpResultInfo
data PrimCall
PrimCall :: CLabelString -> Unit -> PrimCall
instance GHC.Utils.Outputable.Outputable GHC.Builtin.PrimOps.PrimCall
instance GHC.Classes.Eq GHC.Builtin.PrimOps.PrimOp
instance GHC.Classes.Ord GHC.Builtin.PrimOps.PrimOp
instance GHC.Utils.Outputable.Outputable GHC.Builtin.PrimOps.PrimOp
module GHC.Iface.Syntax
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) -> [IfaceForAllSpecBndr] -> [IfaceForAllSpecBndr] -> IfaceContext -> IfaceContext -> [IfaceType] -> IfaceType -> [FieldLabel] -> IfaceDecl
[ifName] :: IfaceDecl -> IfaceTopBndr
[ifPatIsInfix] :: IfaceDecl -> Bool
[ifPatMatcher] :: IfaceDecl -> (IfExtName, Bool)
[ifPatBuilder] :: IfaceDecl -> Maybe (IfExtName, Bool)
[ifPatUnivBndrs] :: IfaceDecl -> [IfaceForAllSpecBndr]
[ifPatExBndrs] :: IfaceDecl -> [IfaceForAllSpecBndr]
[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 See Note
-- [Pretty printing via Iface syntax] in GHC.Types.TyThing.Ppr
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 -> [IfaceBndr] -> [IfaceForAllSpecBndr] -> IfaceEqSpec -> IfaceContext -> [(IfaceMult, IfaceType)] -> [FieldLabel] -> [IfaceBang] -> [IfaceSrcBang] -> IfaceConDecl
[ifConName] :: IfaceConDecl -> IfaceTopBndr
[ifConWrapper] :: IfaceConDecl -> Bool
[ifConInfix] :: IfaceConDecl -> Bool
[ifConExTCvs] :: IfaceConDecl -> [IfaceBndr]
[ifConUserTvBinders] :: IfaceConDecl -> [IfaceForAllSpecBndr]
[ifConEqSpec] :: IfaceConDecl -> IfaceEqSpec
[ifConCtxt] :: IfaceConDecl -> IfaceContext
[ifConArgTys] :: IfaceConDecl -> [(IfaceMult, 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
IfaceLitRubbish :: IfaceType -> IfaceExpr
IfaceFCall :: ForeignCall -> IfaceType -> IfaceExpr
IfaceTick :: IfaceTickish -> IfaceExpr -> IfaceExpr
data IfaceAlt
IfaceAlt :: IfaceConAlt -> [IfLclName] -> IfaceExpr -> IfaceAlt
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
type IfaceIdInfo = [IfaceInfoItem]
data IfaceIdDetails
IfVanillaId :: IfaceIdDetails
IfStrictWorkerId :: [CbvMark] -> 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
HsDmdSig :: DmdSig -> IfaceInfoItem
HsCprSig :: CprSig -> IfaceInfoItem
HsInline :: InlinePragma -> IfaceInfoItem
HsUnfold :: Bool -> IfaceUnfolding -> IfaceInfoItem
HsNoCafRefs :: IfaceInfoItem
HsLevity :: IfaceInfoItem
HsLFInfo :: IfaceLFInfo -> IfaceInfoItem
HsTagSig :: TagSig -> 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] -> [IfaceTvBndr] -> [IfaceIdBndr] -> IfaceAppArgs -> [Role] -> IfaceType -> [BranchIndex] -> IfaceAxBranch
[ifaxbTyVars] :: IfaceAxBranch -> [IfaceTvBndr]
[ifaxbEtaTyVars] :: IfaceAxBranch -> [IfaceTvBndr]
[ifaxbCoVars] :: IfaceAxBranch -> [IfaceIdBndr]
[ifaxbLHS] :: IfaceAxBranch -> IfaceAppArgs
[ifaxbRoles] :: IfaceAxBranch -> [Role]
[ifaxbRHS] :: IfaceAxBranch -> IfaceType
[ifaxbIncomps] :: IfaceAxBranch -> [BranchIndex]
data IfaceTyConParent
IfNoParent :: IfaceTyConParent
IfDataInstance :: IfExtName -> IfaceTyCon -> IfaceAppArgs -> IfaceTyConParent
data IfaceCompleteMatch
IfaceCompleteMatch :: [IfExtName] -> Maybe IfaceTyCon -> IfaceCompleteMatch
-- | Iface type for LambdaFormInfo. Fields not relevant for imported Ids
-- are omitted in this type.
data IfaceLFInfo
IfLFReEntrant :: !RepArity -> IfaceLFInfo
IfLFThunk :: !Bool -> !Bool -> IfaceLFInfo
IfLFCon :: !Name -> IfaceLFInfo
IfLFUnknown :: !Bool -> IfaceLFInfo
IfLFUnlifted :: IfaceLFInfo
-- | 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 IfaceExpr
--
-- 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 GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.ShowHowMuch
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceRule
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceRule
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceRule
instance GHC.Types.Name.NamedThing GHC.Iface.Syntax.IfaceDecl
instance GHC.Types.Name.Occurrence.HasOccName GHC.Iface.Syntax.IfaceDecl
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceDecl
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceAT
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceIdDetails
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceDecl
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceAT
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceIdDetails
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceDecl
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceClassBody
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceAT
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceIdDetails
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceExpr
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceInfoItem
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceUnfolding
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceInfoItem
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceUnfolding
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceAlt
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceExpr
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceBinding
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceLetBndr
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceInfoItem
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceUnfolding
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceExpr
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceAlt
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceBinding
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceLetBndr
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceJoinInfo
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceJoinInfo
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceJoinInfo
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceConAlt
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceConAlt
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceConAlt
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceTickish
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceTickish
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceLFInfo
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceLFInfo
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceCompleteMatch
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceCompleteMatch
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceCompleteMatch
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceAnnotation
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceAnnotation
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceAnnotation
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceFamInst
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceFamInst
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceFamInst
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceClsInst
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceClsInst
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceClsInst
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceConDecls
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceConDecls
instance GHC.Types.Name.NamedThing GHC.Iface.Syntax.IfaceConDecl
instance GHC.Types.Name.Occurrence.HasOccName GHC.Iface.Syntax.IfaceConDecl
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceConDecl
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceConDecl
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceSrcBang
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceSrcBang
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceBang
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceBang
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceFamTyConFlav
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceFamTyConFlav
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceAxBranch
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceAxBranch
instance GHC.Types.Name.NamedThing GHC.Iface.Syntax.IfaceClassOp
instance GHC.Types.Name.Occurrence.HasOccName GHC.Iface.Syntax.IfaceClassOp
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceClassOp
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceClassOp
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceClassOp
instance GHC.Utils.Outputable.Outputable GHC.Iface.Syntax.IfaceTyConParent
instance GHC.Utils.Binary.Binary GHC.Iface.Syntax.IfaceTyConParent
instance Control.DeepSeq.NFData GHC.Iface.Syntax.IfaceTyConParent
-- | Functions to computing the statistics reflective of the "size" of a
-- Core expression
module GHC.Core.Stats
coreBindsSize :: [CoreBind] -> Int
-- | A measure of the size of the expressions, strictly greater than 0
-- 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 GHC.Utils.Outputable.Outputable GHC.Core.Stats.CoreStats
-- | 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 GHC.Core.Seq
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] -> ()
module GHC.Core.Ppr
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 => Alt a -> SDoc
pprCoreBindingWithSize :: CoreBind -> SDoc
pprCoreBindingsWithSize :: [CoreBind] -> SDoc
pprCoreBinder :: BindingSite -> Var -> SDoc
pprCoreBinders :: [Var] -> SDoc
pprRule :: CoreRule -> SDoc
pprRules :: [CoreRule] -> SDoc
pprOptCo :: Coercion -> SDoc
instance GHC.Utils.Outputable.OutputableBndr b => GHC.Utils.Outputable.Outputable (GHC.Core.Bind b)
instance GHC.Utils.Outputable.OutputableBndr b => GHC.Utils.Outputable.Outputable (GHC.Core.Expr b)
instance GHC.Utils.Outputable.OutputableBndr b => GHC.Utils.Outputable.Outputable (GHC.Core.Alt b)
instance GHC.Utils.Outputable.OutputableBndr GHC.Types.Var.Var
instance GHC.Utils.Outputable.Outputable b => GHC.Utils.Outputable.OutputableBndr (GHC.Core.TaggedBndr b)
instance GHC.Utils.Outputable.Outputable GHC.Types.Id.Info.IdInfo
instance GHC.Utils.Outputable.Outputable GHC.Core.UnfoldingGuidance
instance GHC.Utils.Outputable.Outputable GHC.Core.UnfoldingSource
instance GHC.Utils.Outputable.Outputable GHC.Core.Unfolding
instance GHC.Utils.Outputable.Outputable GHC.Core.CoreRule
instance GHC.Utils.Outputable.Outputable (GHC.Types.Tickish.XTickishId pass) => GHC.Utils.Outputable.Outputable (GHC.Types.Tickish.GenTickish pass)
module GHC.Stg.Syntax
data StgArg
StgVarArg :: Id -> StgArg
StgLitArg :: Literal -> StgArg
-- | A top-level binding.
data GenStgTopBinding pass
StgTopLifted :: GenStgBinding pass -> GenStgTopBinding pass
StgTopStringLit :: Id -> ByteString -> GenStgTopBinding pass
data GenStgBinding pass
StgNonRec :: BinderP pass -> GenStgRhs pass -> GenStgBinding pass
StgRec :: [(BinderP pass, GenStgRhs pass)] -> GenStgBinding pass
data GenStgExpr pass
StgApp :: Id -> [StgArg] -> GenStgExpr pass
StgLit :: Literal -> GenStgExpr pass
StgConApp :: DataCon -> ConstructorNumber -> [StgArg] -> [Type] -> GenStgExpr pass
StgOpApp :: StgOp -> [StgArg] -> Type -> GenStgExpr pass
StgCase :: GenStgExpr pass -> BinderP pass -> AltType -> [GenStgAlt pass] -> GenStgExpr pass
StgLet :: XLet pass -> GenStgBinding pass -> GenStgExpr pass -> GenStgExpr pass
StgLetNoEscape :: XLetNoEscape pass -> GenStgBinding pass -> GenStgExpr pass -> GenStgExpr pass
StgTick :: StgTickish -> GenStgExpr pass -> GenStgExpr pass
data GenStgRhs pass
StgRhsClosure :: XRhsClosure pass -> CostCentreStack -> !UpdateFlag -> [BinderP pass] -> GenStgExpr pass -> GenStgRhs pass
StgRhsCon :: CostCentreStack -> DataCon -> ConstructorNumber -> [StgTickish] -> [StgArg] -> GenStgRhs pass
data GenStgAlt pass
GenStgAlt :: !AltCon -> ![BinderP pass] -> !GenStgExpr pass -> GenStgAlt pass
[alt_con] :: GenStgAlt pass -> !AltCon
[alt_bndrs] :: GenStgAlt pass -> ![BinderP pass]
[alt_rhs] :: GenStgAlt pass -> !GenStgExpr pass
data AltType
PolyAlt :: AltType
MultiValAlt :: Int -> AltType
AlgAlt :: TyCon -> AltType
PrimAlt :: PrimRep -> AltType
-- | Used as a data type index for the stgSyn AST
data StgPass
Vanilla :: StgPass
-- | Use internally by the lambda lifting pass
LiftLams :: StgPass
-- | Tag inference information on binders. See Note [Tag inference passes]
-- in GHC.Stg.InferTags
InferTaggedBinders :: StgPass
-- | Tag inference information put on relevant StgApp nodes See Note [Tag
-- inference passes] in GHC.Stg.InferTags
InferTagged :: StgPass
CodeGen :: StgPass
type family BinderP (pass :: StgPass)
type family XRhsClosure (pass :: StgPass)
type family XLet (pass :: StgPass)
type family XLetNoEscape (pass :: StgPass)
-- | Like NoExtField, but with an Outputable instance that
-- returns empty.
data NoExtFieldSilent
-- | Used when constructing a term with an unused extension point that
-- should not appear in pretty-printed output at all.
noExtFieldSilent :: NoExtFieldSilent
type OutputablePass pass = (Outputable (XLet pass), Outputable (XLetNoEscape pass), Outputable (XRhsClosure pass), OutputableBndr (BinderP pass))
data UpdateFlag
ReEntrant :: UpdateFlag
Updatable :: UpdateFlag
SingleEntry :: UpdateFlag
isUpdatable :: UpdateFlag -> Bool
-- | When `-fdistinct-constructor-tables` is turned on then each usage of a
-- constructor is given an unique number and an info table is generated
-- for each different constructor.
data ConstructorNumber
NoNumber :: ConstructorNumber
Numbered :: Int -> ConstructorNumber
type StgTopBinding = GenStgTopBinding 'Vanilla
type StgBinding = GenStgBinding 'Vanilla
type StgExpr = GenStgExpr 'Vanilla
type StgRhs = GenStgRhs 'Vanilla
type StgAlt = GenStgAlt 'Vanilla
type CgStgTopBinding = GenStgTopBinding 'CodeGen
type CgStgBinding = GenStgBinding 'CodeGen
type CgStgExpr = GenStgExpr 'CodeGen
type CgStgRhs = GenStgRhs 'CodeGen
type CgStgAlt = GenStgAlt 'CodeGen
type TgStgTopBinding = GenStgTopBinding 'CodeGen
type TgStgBinding = GenStgBinding 'CodeGen
type TgStgExpr = GenStgExpr 'CodeGen
type TgStgRhs = GenStgRhs 'CodeGen
type TgStgAlt = GenStgAlt 'CodeGen
type LlStgTopBinding = GenStgTopBinding 'LiftLams
type LlStgBinding = GenStgBinding 'LiftLams
type LlStgExpr = GenStgExpr 'LiftLams
type LlStgRhs = GenStgRhs 'LiftLams
type LlStgAlt = GenStgAlt 'LiftLams
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 -> Type -> StgOp
stgRhsArity :: StgRhs -> Int
freeVarsOfRhs :: XRhsClosure pass ~ DIdSet => GenStgRhs pass -> DIdSet
-- | Does this constructor application refer to anything in a different
-- *Windows* DLL? If so, we can't allocate it statically
isDllConApp :: Platform -> Bool -> Module -> DataCon -> [StgArg] -> Bool
-- | Type of an StgArg
--
-- Very half baked because we have lost the type arguments.
stgArgType :: StgArg -> Type
-- | Given an alt type and whether the program is unarised, return whether
-- the case binder is in scope.
--
-- Case binders of unboxed tuple or unboxed sum type always dead after
-- the unariser has run. See Note [Post-unarisation invariants].
stgCaseBndrInScope :: AltType -> Bool -> Bool
-- | STG pretty-printing options
data StgPprOpts
StgPprOpts :: !Bool -> StgPprOpts
-- | Enable cost-centres
[stgSccEnabled] :: StgPprOpts -> !Bool
-- | STG pretty-printing options used for panic messages
panicStgPprOpts :: StgPprOpts
-- | STG pretty-printing options used for short messages
shortStgPprOpts :: StgPprOpts
pprStgArg :: StgArg -> SDoc
pprStgExpr :: OutputablePass pass => StgPprOpts -> GenStgExpr pass -> SDoc
pprStgRhs :: OutputablePass pass => StgPprOpts -> GenStgRhs pass -> SDoc
pprStgBinding :: OutputablePass pass => StgPprOpts -> GenStgBinding pass -> SDoc
pprGenStgTopBinding :: OutputablePass pass => StgPprOpts -> GenStgTopBinding pass -> SDoc
pprStgTopBinding :: OutputablePass pass => StgPprOpts -> GenStgTopBinding pass -> SDoc
pprGenStgTopBindings :: OutputablePass pass => StgPprOpts -> [GenStgTopBinding pass] -> SDoc
pprStgTopBindings :: OutputablePass pass => StgPprOpts -> [GenStgTopBinding pass] -> SDoc
instance GHC.Classes.Ord GHC.Stg.Syntax.NoExtFieldSilent
instance GHC.Classes.Eq GHC.Stg.Syntax.NoExtFieldSilent
instance Data.Data.Data GHC.Stg.Syntax.NoExtFieldSilent
instance GHC.Stg.Syntax.OutputablePass pass => GHC.Utils.Outputable.Outputable (GHC.Stg.Syntax.GenStgBinding pass)
instance GHC.Stg.Syntax.OutputablePass pass => GHC.Utils.Outputable.Outputable (GHC.Stg.Syntax.GenStgExpr pass)
instance GHC.Stg.Syntax.OutputablePass pass => GHC.Utils.Outputable.Outputable (GHC.Stg.Syntax.GenStgRhs pass)
instance GHC.Utils.Outputable.Outputable GHC.Stg.Syntax.StgOp
instance GHC.Utils.Outputable.Outputable GHC.Stg.Syntax.UpdateFlag
instance GHC.Utils.Outputable.Outputable GHC.Stg.Syntax.ConstructorNumber
instance GHC.Utils.Outputable.Outputable GHC.Stg.Syntax.AltType
instance GHC.Utils.Outputable.Outputable GHC.Stg.Syntax.NoExtFieldSilent
instance GHC.Utils.Outputable.Outputable GHC.Stg.Syntax.StgArg
module GHC.Cmm.CLabel
-- | CLabel is an abstract type that supports the following
-- operations:
--
--
-- - Pretty printing
-- - In a C file, does it need to be declared before use? (i.e. is it
-- guaranteed to be already in scope in the places we need to refer to
-- it?)
-- - If it needs to be declared, what type (code or data) should it be
-- declared to have?
-- - Is it visible outside this object file or not?
-- - Is it "dynamic" (see details below)
-- - Eq and Ord, so that we can make sets of CLabels (currently only
-- used in outputting C as far as I can tell, to avoid generating more
-- than one declaration for any given label).
-- - Converting an info table label into an entry label.
--
--
-- CLabel usage is a bit messy in GHC as they are used in a number of
-- different contexts:
--
--
-- - By the C-- AST to identify labels
-- - By the unregisterised C code generator ("PprC") for naming
-- functions (hence the name CLabel)
-- - By the native and LLVM code generators to identify labels
--
--
-- For extra fun, each of these uses a slightly different subset of
-- constructors (e.g. AsmTempLabel and AsmTempDerivedLabel
-- are used only in the NCG and LLVM backends).
--
-- In general, we use IdLabel to represent Haskell things early in
-- the pipeline. However, later optimization passes will often represent
-- blocks they create with LocalBlockLabel where there is no
-- obvious Name to hang off the label.
data CLabel
-- | Indicate if GHC.CmmToC has to generate an extern declaration
-- for the label (e.g. "extern StgWordArray(foo)"). The type is fixed to
-- StgWordArray.
--
-- Symbols from the RTS don't need "extern" declarations because they are
-- exposed via "rtsincludeStg.h" with the appropriate type. See
-- needsCDecl.
--
-- The fixed StgWordArray type led to "conflicting types" issues with
-- user provided Cmm files (not in the RTS) that declare data of another
-- type (#15467 and test for #17920). Hence the Cmm parser considers that
-- labels in data sections don't need the "extern" declaration (just add
-- one explicitly if you need it).
--
-- See
-- https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/backends/ppr-c#prototypes
-- for why extern declaration are needed at all.
newtype NeedExternDecl
NeedExternDecl :: Bool -> NeedExternDecl
-- | 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 currently 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
data DynamicLinkerLabelInfo
CodeStub :: DynamicLinkerLabelInfo
SymbolPtr :: DynamicLinkerLabelInfo
GotSymbolPtr :: DynamicLinkerLabelInfo
GotSymbolOffset :: DynamicLinkerLabelInfo
-- | Which module is the info table from, and which number was it.
data ConInfoTableLocation
UsageSite :: Module -> Int -> ConInfoTableLocation
DefinitionSite :: ConInfoTableLocation
getConInfoTableLocation :: IdLabelInfo -> Maybe ConInfoTableLocation
mkClosureLabel :: Name -> CafInfo -> CLabel
mkSRTLabel :: Unique -> CLabel
-- | Decicdes between external and local labels based on the names
-- externality.
mkInfoTableLabel :: Name -> CafInfo -> CLabel
mkEntryLabel :: Name -> CafInfo -> CLabel
mkRednCountsLabel :: Name -> CLabel
mkTagHitLabel :: Name -> Unique -> CLabel
mkConInfoTableLabel :: Name -> ConInfoTableLocation -> CLabel
mkApEntryLabel :: Platform -> Bool -> Int -> CLabel
mkApInfoTableLabel :: Platform -> Bool -> Int -> CLabel
mkClosureTableLabel :: Name -> CafInfo -> CLabel
mkBytesLabel :: Name -> CLabel
mkLocalBlockLabel :: Unique -> CLabel
mkBlockInfoTableLabel :: Name -> CafInfo -> CLabel
mkBitmapLabel :: Unique -> CLabel
mkStringLitLabel :: Unique -> CLabel
mkInitializerStubLabel :: Module -> String -> CLabel
mkInitializerArrayLabel :: Module -> CLabel
mkFinalizerStubLabel :: Module -> String -> CLabel
mkFinalizerArrayLabel :: Module -> CLabel
mkAsmTempLabel :: Uniquable a => a -> CLabel
mkAsmTempDerivedLabel :: CLabel -> FastString -> CLabel
mkAsmTempEndLabel :: CLabel -> CLabel
-- | A label indicating the end of a procedure.
mkAsmTempProcEndLabel :: CLabel -> CLabel
-- | Construct a label for a DWARF Debug Information Entity (DIE)
-- describing another symbol.
mkAsmTempDieLabel :: CLabel -> CLabel
mkDirty_MUT_VAR_Label :: CLabel
mkMUT_VAR_CLEAN_infoLabel :: CLabel
mkNonmovingWriteBarrierEnabledLabel :: CLabel
mkUpdInfoLabel :: CLabel
mkBHUpdInfoLabel :: CLabel
mkIndStaticInfoLabel :: CLabel
mkMainCapabilityLabel :: CLabel
mkMAP_FROZEN_CLEAN_infoLabel :: CLabel
mkMAP_FROZEN_DIRTY_infoLabel :: CLabel
mkMAP_DIRTY_infoLabel :: CLabel
mkSMAP_FROZEN_CLEAN_infoLabel :: CLabel
mkSMAP_FROZEN_DIRTY_infoLabel :: CLabel
mkSMAP_DIRTY_infoLabel :: CLabel
mkBadAlignmentLabel :: CLabel
mkOutOfBoundsAccessLabel :: CLabel
mkArrWords_infoLabel :: CLabel
mkSRTInfoLabel :: Int -> CLabel
mkTopTickyCtrLabel :: CLabel
mkCAFBlackHoleInfoTableLabel :: CLabel
mkRtsPrimOpLabel :: PrimOp -> CLabel
mkRtsSlowFastTickyCtrLabel :: String -> CLabel
mkSelectorInfoLabel :: Platform -> Bool -> Int -> CLabel
mkSelectorEntryLabel :: Platform -> 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 -> NeedExternDecl -> FastString -> CLabel
mkRtsCmmDataLabel :: FastString -> CLabel
mkCmmClosureLabel :: UnitId -> FastString -> CLabel
mkRtsApFastLabel :: FastString -> CLabel
mkPrimCallLabel :: PrimCall -> CLabel
-- | Make a foreign label
mkForeignLabel :: FastString -> Maybe Int -> ForeignLabelSource -> FunctionOrData -> CLabel
mkCCLabel :: CostCentre -> CLabel
mkCCSLabel :: CostCentreStack -> CLabel
mkIPELabel :: InfoProvEnt -> CLabel
-- | Info Table Provenance Entry See Note [Mapping Info Tables to Source
-- Positions]
data InfoProvEnt
InfoProvEnt :: !CLabel -> !Int -> !String -> !Module -> !Maybe (RealSrcSpan, String) -> InfoProvEnt
[infoTablePtr] :: InfoProvEnt -> !CLabel
[infoProvEntClosureType] :: InfoProvEnt -> !Int
[infoTableType] :: InfoProvEnt -> !String
[infoProvModule] :: InfoProvEnt -> !Module
[infoTableProv] :: InfoProvEnt -> !Maybe (RealSrcSpan, String)
mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel
mkPicBaseLabel :: CLabel
mkDeadStripPreventer :: CLabel -> CLabel
mkHpcTicksLabel :: Module -> CLabel
hasCAF :: CLabel -> Bool
needsCDecl :: CLabel -> Bool
-- | If a label is a local block label then return just its BlockId,
-- otherwise Nothing.
maybeLocalBlockLabel :: CLabel -> Maybe BlockId
-- | 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 somewhere, 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
-- | Does a CLabel need dynamic linkage?
--
-- When referring to data in code, we need to know whether that data
-- resides in a DLL or not. [Win32 only.] labelDynamic returns
-- True if the label is located in a DLL, be it a data reference
-- or not.
labelDynamic :: Module -> Platform -> Bool -> CLabel -> Bool
-- | Is a CLabel defined in the current module being compiled?
--
-- Sometimes we can optimise references within a compilation unit in ways
-- that we couldn't for inter-module references. This provides a
-- conservative estimate of whether a CLabel lives in the current
-- module.
isLocalCLabel :: Module -> CLabel -> Bool
mayRedirectTo :: CLabel -> CLabel -> Bool
-- | Whether label is points to some kind of info table
isInfoTableLabel :: CLabel -> Bool
-- | Whether label is points to constructor info table
isConInfoTableLabel :: CLabel -> Bool
isIdLabel :: CLabel -> Bool
isTickyLabel :: CLabel -> Bool
hasHaskellName :: CLabel -> Maybe Name
hasIdLabelInfo :: CLabel -> Maybe IdLabelInfo
-- | 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
-- | Whether label is a .rodata label
isSomeRODataLabel :: CLabel -> Bool
-- | Whether label is a static closure label (can come from haskell or cmm)
isStaticClosureLabel :: CLabel -> Bool
toClosureLbl :: Platform -> CLabel -> CLabel
toSlowEntryLbl :: Platform -> CLabel -> CLabel
toEntryLbl :: Platform -> CLabel -> CLabel
toInfoLbl :: Platform -> CLabel -> CLabel
-- | Style of label pretty-printing.
--
-- When we produce C sources or headers, we have to take into account
-- that C compilers transform C labels when they convert them into
-- symbols. For example, they can add prefixes (e.g., "_" on Darwin) or
-- suffixes (size for stdcalls on Windows). So we provide two ways to
-- pretty-print CLabels: C style or Asm style.
data LabelStyle
-- | C label style (used by C and LLVM backends)
CStyle :: LabelStyle
-- | Asm label style (used by NCG backend)
AsmStyle :: LabelStyle
-- | 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 :: Platform -> CLabel -> SDoc
pprCLabel :: Platform -> LabelStyle -> CLabel -> SDoc
-- | Generate a label for a procedure internal to a module (if
-- Opt_ExposeAllSymbols is enabled). See Note [Internal proc
-- labels].
ppInternalProcLabel :: Module -> CLabel -> Maybe SDoc
dynamicLinkerLabelInfo :: CLabel -> Maybe (DynamicLinkerLabelInfo, 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
instance GHC.Classes.Ord GHC.Cmm.CLabel.ModuleLabelKind
instance GHC.Classes.Eq GHC.Cmm.CLabel.ModuleLabelKind
instance GHC.Classes.Eq GHC.Cmm.CLabel.NeedExternDecl
instance GHC.Classes.Ord GHC.Cmm.CLabel.NeedExternDecl
instance GHC.Classes.Ord GHC.Cmm.CLabel.ForeignLabelSource
instance GHC.Classes.Eq GHC.Cmm.CLabel.ForeignLabelSource
instance GHC.Show.Show GHC.Cmm.CLabel.TickyIdInfo
instance GHC.Classes.Eq GHC.Cmm.CLabel.TickyIdInfo
instance GHC.Classes.Ord GHC.Cmm.CLabel.ConInfoTableLocation
instance GHC.Classes.Eq GHC.Cmm.CLabel.ConInfoTableLocation
instance GHC.Classes.Ord GHC.Cmm.CLabel.IdLabelInfo
instance GHC.Classes.Eq GHC.Cmm.CLabel.IdLabelInfo
instance GHC.Classes.Ord GHC.Cmm.CLabel.RtsLabelInfo
instance GHC.Classes.Eq GHC.Cmm.CLabel.RtsLabelInfo
instance GHC.Classes.Ord GHC.Cmm.CLabel.CmmLabelInfo
instance GHC.Classes.Eq GHC.Cmm.CLabel.CmmLabelInfo
instance GHC.Classes.Ord GHC.Cmm.CLabel.DynamicLinkerLabelInfo
instance GHC.Classes.Eq GHC.Cmm.CLabel.DynamicLinkerLabelInfo
instance GHC.Classes.Eq GHC.Cmm.CLabel.CLabel
instance GHC.Classes.Ord GHC.Cmm.CLabel.InfoProvEnt
instance GHC.Classes.Eq GHC.Cmm.CLabel.InfoProvEnt
instance GHC.Show.Show GHC.Cmm.CLabel.CLabel
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CLabel.CLabel
instance GHC.Classes.Ord GHC.Cmm.CLabel.CLabel
instance GHC.Utils.Outputable.OutputableP GHC.Platform.Platform GHC.Cmm.CLabel.CLabel
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CLabel.IdLabelInfo
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CLabel.ConInfoTableLocation
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CLabel.TickyIdInfo
instance GHC.Classes.Ord GHC.Cmm.CLabel.TickyIdInfo
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CLabel.ForeignLabelSource
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CLabel.ModuleLabelKind
module GHC.Types.IPE
-- | A map storing all the different uses of a specific data constructor
-- and the approximate source position that usage arose from. The
-- Int is an incrementing identifier which distinguishes each
-- usage of a constructor in a module. It is paired with the source
-- position the constructor was used at, if possible and a string which
-- names the source location. This is the same information as is the
-- payload for the SourceNote constructor.
type DCMap = UniqMap DataCon (NonEmpty (Int, Maybe IpeSourceLocation))
-- | A map from a Name to the best approximate source position that
-- name arose from.
type ClosureMap = UniqMap Name (Type, Maybe IpeSourceLocation)
data InfoTableProvMap
InfoTableProvMap :: DCMap -> ClosureMap -> InfoTableToSourceLocationMap -> InfoTableProvMap
[provDC] :: InfoTableProvMap -> DCMap
[provClosure] :: InfoTableProvMap -> ClosureMap
[provInfoTables] :: InfoTableProvMap -> InfoTableToSourceLocationMap
emptyInfoTableProvMap :: InfoTableProvMap
-- | Position and information about an info table. For return frames these
-- are the contents of a SourceNote.
type IpeSourceLocation = (RealSrcSpan, String)
module GHC.Cmm.BlockId
type BlockId = Label
mkBlockId :: Unique -> BlockId
newBlockId :: MonadUnique m => m BlockId
blockLbl :: BlockId -> CLabel
infoTblLbl :: BlockId -> CLabel
module GHC.Cmm.Expr
data CmmExpr
CmmLit :: !CmmLit -> CmmExpr
CmmLoad :: !CmmExpr -> !CmmType -> !AlignmentSpec -> CmmExpr
CmmReg :: !CmmReg -> CmmExpr
CmmMachOp :: MachOp -> [CmmExpr] -> CmmExpr
CmmStackSlot :: Area -> {-# UNPACK #-} !Int -> CmmExpr
CmmRegOff :: !CmmReg -> !Int -> CmmExpr
cmmExprType :: Platform -> CmmExpr -> CmmType
cmmExprWidth :: Platform -> CmmExpr -> Width
-- | Returns an alignment in bytes of a CmmExpr when it's a statically
-- known integer constant, otherwise returns an alignment of 1 byte. The
-- caller is responsible for using with a sensible CmmExpr argument.
cmmExprAlignment :: CmmExpr -> Alignment
maybeInvertCmmExpr :: CmmExpr -> Maybe CmmExpr
data CmmReg
CmmLocal :: {-# UNPACK #-} !LocalReg -> CmmReg
CmmGlobal :: GlobalReg -> CmmReg
cmmRegType :: Platform -> CmmReg -> CmmType
cmmRegWidth :: Platform -> CmmReg -> Width
data CmmLit
CmmInt :: !Integer -> !Width -> CmmLit
CmmFloat :: Rational -> !Width -> CmmLit
CmmVec :: [CmmLit] -> CmmLit
CmmLabel :: CLabel -> CmmLit
CmmLabelOff :: CLabel -> !Int -> CmmLit
CmmLabelDiffOff :: CLabel -> CLabel -> !Int -> !Width -> CmmLit
CmmBlock :: {-# UNPACK #-} !BlockId -> CmmLit
CmmHighStackMark :: CmmLit
cmmLitType :: Platform -> CmmLit -> CmmType
data AlignmentSpec
NaturallyAligned :: AlignmentSpec
Unaligned :: AlignmentSpec
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 :: Platform -> GlobalReg -> CmmType
spReg :: CmmReg
hpReg :: CmmReg
spLimReg :: CmmReg
hpLimReg :: CmmReg
nodeReg :: CmmReg
currentTSOReg :: CmmReg
currentNurseryReg :: CmmReg
hpAllocReg :: CmmReg
cccsReg :: CmmReg
node :: GlobalReg
baseReg :: CmmReg
data VGcPtr
VGcPtr :: VGcPtr
VNonGcPtr :: VGcPtr
class Ord r => DefinerOfRegs r a
class Ord r => UserOfRegs r a
foldRegsDefd :: DefinerOfRegs r a => Platform -> (b -> r -> b) -> b -> a -> b
foldRegsUsed :: UserOfRegs r a => Platform -> (b -> r -> b) -> b -> a -> b
foldLocalRegsDefd :: DefinerOfRegs LocalReg a => Platform -> (b -> LocalReg -> b) -> b -> a -> b
foldLocalRegsUsed :: UserOfRegs LocalReg a => Platform -> (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.Show.Show GHC.Cmm.Expr.AlignmentSpec
instance GHC.Classes.Ord GHC.Cmm.Expr.AlignmentSpec
instance GHC.Classes.Eq GHC.Cmm.Expr.AlignmentSpec
instance GHC.Show.Show GHC.Cmm.Expr.Area
instance GHC.Classes.Ord GHC.Cmm.Expr.Area
instance GHC.Classes.Eq GHC.Cmm.Expr.Area
instance GHC.Show.Show GHC.Cmm.Expr.CmmLit
instance GHC.Classes.Eq GHC.Cmm.Expr.CmmLit
instance GHC.Show.Show GHC.Cmm.Expr.LocalReg
instance GHC.Show.Show GHC.Cmm.Expr.VGcPtr
instance GHC.Classes.Eq GHC.Cmm.Expr.VGcPtr
instance GHC.Show.Show GHC.Cmm.Expr.GlobalReg
instance GHC.Show.Show GHC.Cmm.Expr.CmmReg
instance GHC.Classes.Ord GHC.Cmm.Expr.CmmReg
instance GHC.Classes.Eq GHC.Cmm.Expr.CmmReg
instance GHC.Show.Show GHC.Cmm.Expr.CmmExpr
instance GHC.Classes.Eq GHC.Cmm.Expr.CmmExpr
instance (GHC.Classes.Ord r, GHC.Cmm.Expr.UserOfRegs r GHC.Cmm.Expr.CmmReg) => GHC.Cmm.Expr.UserOfRegs r GHC.Cmm.Expr.CmmExpr
instance GHC.Cmm.Expr.UserOfRegs GHC.Cmm.Expr.LocalReg GHC.Cmm.Expr.CmmReg
instance GHC.Cmm.Expr.DefinerOfRegs GHC.Cmm.Expr.LocalReg GHC.Cmm.Expr.CmmReg
instance GHC.Cmm.Expr.UserOfRegs GHC.Cmm.Expr.GlobalReg GHC.Cmm.Expr.CmmReg
instance GHC.Cmm.Expr.DefinerOfRegs GHC.Cmm.Expr.GlobalReg GHC.Cmm.Expr.CmmReg
instance GHC.Classes.Eq GHC.Cmm.Expr.GlobalReg
instance GHC.Classes.Ord GHC.Cmm.Expr.GlobalReg
instance GHC.Classes.Ord r => GHC.Cmm.Expr.DefinerOfRegs r r
instance GHC.Cmm.Expr.DefinerOfRegs r a => GHC.Cmm.Expr.DefinerOfRegs r [a]
instance GHC.Classes.Ord r => GHC.Cmm.Expr.UserOfRegs r r
instance GHC.Cmm.Expr.UserOfRegs r a => GHC.Cmm.Expr.UserOfRegs r [a]
instance GHC.Classes.Eq GHC.Cmm.Expr.LocalReg
instance GHC.Classes.Ord GHC.Cmm.Expr.LocalReg
instance GHC.Types.Unique.Uniquable GHC.Cmm.Expr.LocalReg
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Expr.CmmLit
module GHC.Platform.X86_64
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
freeRegBase :: RegNo -> Bool
module GHC.Platform.X86
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
freeRegBase :: RegNo -> Bool
module GHC.Platform.S390X
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module GHC.Platform.RISCV64
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module GHC.Platform.PPC
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module GHC.Platform.NoRegs
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module GHC.Platform.ARM
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module GHC.Platform.AArch64
callerSaves :: GlobalReg -> Bool
activeStgRegs :: [GlobalReg]
haveRegBase :: Bool
globalRegMaybe :: GlobalReg -> Maybe RealReg
freeReg :: RegNo -> Bool
module GHC.Platform.Regs
-- | 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 possibly mapped to real registers.
activeStgRegs :: Platform -> [GlobalReg]
haveRegBase :: Platform -> Bool
globalRegMaybe :: Platform -> GlobalReg -> Maybe RealReg
freeReg :: Platform -> RegNo -> Bool
-- | Bytecode assembler types
module GHC.ByteCode.Types
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
newtype RegBitmap
RegBitmap :: Word32 -> RegBitmap
[unRegBitmap] :: RegBitmap -> Word32
data TupleInfo
TupleInfo :: !WordOff -> !GlobalRegSet -> !WordOff -> TupleInfo
[tupleSize] :: TupleInfo -> !WordOff
[tupleRegs] :: TupleInfo -> !GlobalRegSet
[tupleNativeStackSize] :: TupleInfo -> !WordOff
voidTupleInfo :: TupleInfo
newtype ByteOff
ByteOff :: Int -> ByteOff
newtype WordOff
WordOff :: Int -> WordOff
data UnlinkedBCO
UnlinkedBCO :: !Name -> {-# UNPACK #-} !Int -> !UArray Int Word16 -> !UArray Int Word64 -> !SizedSeq BCONPtr -> !SizedSeq BCOPtr -> UnlinkedBCO
[unlinkedBCOName] :: UnlinkedBCO -> !Name
[unlinkedBCOArity] :: UnlinkedBCO -> {-# UNPACK #-} !Int
[unlinkedBCOInstrs] :: UnlinkedBCO -> !UArray Int Word16
[unlinkedBCOBitmap] :: UnlinkedBCO -> !UArray Int Word64
[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 :: [Maybe (Id, Word16)] -> Type -> CgBreakInfo
[cgb_vars] :: CgBreakInfo -> [Maybe (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. See Note [Field modBreaks_decls]
[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 GHC.ByteCode.Types.FFIInfo
instance GHC.Show.Show GHC.ByteCode.Types.FFIInfo
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.ByteOff
instance GHC.Real.Real GHC.ByteCode.Types.ByteOff
instance GHC.Classes.Ord GHC.ByteCode.Types.ByteOff
instance GHC.Num.Num GHC.ByteCode.Types.ByteOff
instance GHC.Real.Integral GHC.ByteCode.Types.ByteOff
instance GHC.Show.Show GHC.ByteCode.Types.ByteOff
instance GHC.Classes.Eq GHC.ByteCode.Types.ByteOff
instance GHC.Enum.Enum GHC.ByteCode.Types.ByteOff
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.WordOff
instance GHC.Real.Real GHC.ByteCode.Types.WordOff
instance GHC.Classes.Ord GHC.ByteCode.Types.WordOff
instance GHC.Num.Num GHC.ByteCode.Types.WordOff
instance GHC.Real.Integral GHC.ByteCode.Types.WordOff
instance GHC.Show.Show GHC.ByteCode.Types.WordOff
instance GHC.Classes.Eq GHC.ByteCode.Types.WordOff
instance GHC.Enum.Enum GHC.ByteCode.Types.WordOff
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.RegBitmap
instance Data.Bits.FiniteBits GHC.ByteCode.Types.RegBitmap
instance Data.Bits.Bits GHC.ByteCode.Types.RegBitmap
instance GHC.Real.Real GHC.ByteCode.Types.RegBitmap
instance GHC.Classes.Ord GHC.ByteCode.Types.RegBitmap
instance GHC.Num.Num GHC.ByteCode.Types.RegBitmap
instance GHC.Real.Integral GHC.ByteCode.Types.RegBitmap
instance GHC.Show.Show GHC.ByteCode.Types.RegBitmap
instance GHC.Classes.Eq GHC.ByteCode.Types.RegBitmap
instance GHC.Enum.Enum GHC.ByteCode.Types.RegBitmap
instance GHC.Show.Show GHC.ByteCode.Types.TupleInfo
instance Control.DeepSeq.NFData GHC.ByteCode.Types.ItblPtr
instance GHC.Show.Show GHC.ByteCode.Types.ItblPtr
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.CompiledByteCode
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.CgBreakInfo
instance Control.DeepSeq.NFData GHC.ByteCode.Types.UnlinkedBCO
instance Control.DeepSeq.NFData GHC.ByteCode.Types.BCOPtr
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.UnlinkedBCO
instance Control.DeepSeq.NFData GHC.ByteCode.Types.BCONPtr
instance GHC.Utils.Outputable.Outputable GHC.ByteCode.Types.TupleInfo
module GHC.Core.Map.Expr
-- | 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
eqDeBruijnExpr :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool
eqCoreExpr :: CoreExpr -> CoreExpr -> Bool
class TrieMap m where {
type family Key m :: Type;
}
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
filterTM :: TrieMap m => (a -> Bool) -> m a -> m a
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 GHC.Data.TrieMap.TrieMap GHC.Core.Map.Expr.CoreMap
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Core.Map.Expr.CoreMap a)
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Expr.CoreMapX
instance GHC.Data.TrieMap.TrieMap GHC.Core.Map.Expr.AltMap
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn GHC.Core.CoreExpr)
instance GHC.Classes.Eq (GHC.Core.Map.Type.DeBruijn GHC.Core.CoreAlt)
-- | A module concerned with finding the free variables of an expression.
module GHC.Core.FVs
-- | 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 several
-- expressions returning a non-deterministic set.
exprsFreeVars :: [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 or type variables in several
-- expressions returning a deterministically ordered list.
exprsFreeVarsList :: [CoreExpr] -> [Var]
-- | Find all locally-defined free Ids in an expression
exprFreeIds :: CoreExpr -> IdSet
exprsFreeIds :: [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 several expressions returning a
-- deterministic set.
exprsFreeIdsDSet :: [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
-- deterministically ordered list.
exprsFreeIdsList :: [CoreExpr] -> [Id]
-- | 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
bndrRuleAndUnfoldingIds :: Id -> IdSet
idFVs :: Id -> FV
idRuleVars :: Id -> VarSet
stableUnfoldingVars :: Unfolding -> Maybe 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 both the left right hand sides 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
-- | Make a RuleInfo containing a number of CoreRules,
-- suitable for putting into an IdInfo
mkRuleInfo :: [CoreRule] -> RuleInfo
-- | 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 deterministically ordered list
ruleLhsFreeIdsList :: CoreRule -> [Var]
-- | Those variables free in the right hand side of a rule returned as a
-- non-deterministic set
ruleRhsFreeVars :: CoreRule -> VarSet
-- | Those locally-defined free Ids in the right hand side of
-- several rules returned as a non-deterministic set
rulesRhsFreeIds :: [CoreRule] -> 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
type FVAnn = DVarSet
-- | Every node in an expression annotated with its (non-global) free
-- variables, both Ids and TyVars, and type. NB: see Note [The FVAnn
-- invariant]
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 reported in a FVAnn
freeVarsOfAnn :: FVAnn -> DIdSet
-- | Commonly useful utilities for manipulating the Core language
module GHC.Core.Utils
-- | Wrap the given expression in the coercion safely, dropping identity
-- coercions and coalescing nested coercions
mkCast :: CoreExpr -> CoercionR -> CoreExpr
mkCastMCo :: CoreExpr -> MCoercionR -> CoreExpr
mkPiMCo :: Var -> MCoercionR -> MCoercionR
-- | Wraps the given expression in the source annotation, dropping the
-- annotation if possible.
mkTick :: CoreTickish -> CoreExpr -> CoreExpr
mkTicks :: [CoreTickish] -> CoreExpr -> CoreExpr
mkTickNoHNF :: CoreTickish -> CoreExpr -> CoreExpr
tickHNFArgs :: CoreTickish -> 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 GHC.Core#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
mkDefaultCase :: CoreExpr -> Id -> CoreExpr -> CoreExpr
mkSingleAltCase :: CoreExpr -> Id -> AltCon -> [Var] -> CoreExpr -> CoreExpr
-- | Extract the default case alternative
findDefault :: [Alt b] -> ([Alt b], Maybe (Expr b))
addDefault :: [Alt b] -> Maybe (Expr b) -> [Alt b]
-- | Find the case alternative corresponding to a particular constructor:
-- panics if no such constructor exists
findAlt :: AltCon -> [Alt b] -> Maybe (Alt b)
isDefaultAlt :: Alt b -> Bool
-- | Merge alternatives preserving order; alternatives in the first
-- argument shadow ones in the second
mergeAlts :: [Alt a] -> [Alt a] -> [Alt a]
-- | 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] -> [Alt b] -> ([AltCon], [Alt b])
combineIdenticalAlts :: [AltCon] -> [CoreAlt] -> (Bool, [AltCon], [CoreAlt])
-- | Refine the default alternative to a DataAlt, if there is a
-- unique way to do so. See Note [Refine DEFAULT case alternatives]
refineDefaultAlt :: [Unique] -> Mult -> TyCon -> [Type] -> [AltCon] -> [CoreAlt] -> (Bool, [CoreAlt])
scaleAltsBy :: Mult -> [CoreAlt] -> [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 :: HasDebugCallStack => 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
-- | 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
mkFunctionType :: Mult -> Type -> Type -> Type
exprIsDupable :: Platform -> CoreExpr -> Bool
exprIsTrivial :: CoreExpr -> Bool
getIdFromTrivialExpr :: HasDebugCallStack => CoreExpr -> Id
exprIsDeadEnd :: CoreExpr -> Bool
getIdFromTrivialExpr_maybe :: CoreExpr -> Maybe Id
exprIsCheap :: CoreExpr -> Bool
exprIsExpandable :: CoreExpr -> Bool
exprIsCheapX :: 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 GHC.Core#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
-- GHC.Builtin.PrimOps and Note [Transformations affected by
-- can_fail and has_side_effects]
--
-- 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
-- GHC.Builtin.PrimOps and Note [Transformations affected by
-- can_fail and has_side_effects]
--
-- 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
-- | Similar to exprIsHNF but includes CONLIKE functions as well as
-- data constructors. Conlike arguments are considered interesting by the
-- inliner.
exprIsConLike :: CoreExpr -> Bool
isCheapApp :: CheapAppFun
isExpandableApp :: CheapAppFun
isSaturatedConApp :: CoreExpr -> Bool
-- | Check if the expression is zero or more Ticks wrapped around a literal
-- string.
exprIsTickedString :: CoreExpr -> Bool
-- | Extract a literal string from an expression that is zero or more Ticks
-- wrapped around a literal string. Returns Nothing if the expression has
-- a different shape. Used to "look through" Ticks in places that need to
-- handle literal strings.
exprIsTickedString_maybe :: CoreExpr -> Maybe ByteString
-- | Can we bind this CoreExpr at the top level?
exprIsTopLevelBindable :: CoreExpr -> Type -> Bool
altsAreExhaustive :: [Alt b] -> 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.
cheapEqExpr :: Expr b -> Expr b -> Bool
-- | Cheap expression equality test, can ignore ticks by type.
cheapEqExpr' :: (CoreTickish -> Bool) -> Expr b -> Expr b -> Bool
-- | Deprecated: Use eqCoreExpr, eqExpr will be removed in
-- GHC 9.6
eqExpr :: InScopeSet -> CoreExpr -> CoreExpr -> Bool
-- | 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.
--
-- Only used in GHC.Core.Lint.lintAnnots
diffBinds :: Bool -> RnEnv2 -> [(Var, CoreExpr)] -> [(Var, CoreExpr)] -> ([SDoc], RnEnv2)
tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr
-- | Can we eta-reduce the given function to the specified arity? See Note
-- [Eta reduction conditions].
canEtaReduceToArity :: Id -> JoinArity -> Arity -> Bool
-- | 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 :: HasDebugCallStack => SDoc -> 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] -> Mult -> DataCon -> [Type] -> ([TyCoVar], [Id])
dataConRepFSInstPat :: [FastString] -> [Unique] -> Mult -> DataCon -> [Type] -> ([TyCoVar], [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
-- | If normSplitTyConApp_maybe _ ty = Just (tc, tys, co) then
-- ty |> co = tc tys. It's splitTyConApp_maybe, but
-- looks through coercions via topNormaliseType_maybe. Hence the
-- "norm" prefix.
normSplitTyConApp_maybe :: FamInstEnvs -> Type -> Maybe (TyCon, [Type], Coercion)
-- | Strip ticks satisfying a predicate from top of an expression
stripTicksTop :: (CoreTickish -> Bool) -> Expr b -> ([CoreTickish], Expr b)
-- | Strip ticks satisfying a predicate from top of an expression,
-- returning the remaining expression
stripTicksTopE :: (CoreTickish -> Bool) -> Expr b -> Expr b
-- | Strip ticks satisfying a predicate from top of an expression,
-- returning the ticks
stripTicksTopT :: (CoreTickish -> Bool) -> Expr b -> [CoreTickish]
-- | Completely strip ticks satisfying a predicate from an expression. Note
-- this is O(n) in the size of the expression!
stripTicksE :: (CoreTickish -> Bool) -> Expr b -> Expr b
stripTicksT :: (CoreTickish -> Bool) -> Expr b -> [CoreTickish]
-- | 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
-- | For a binding we: * Look at the args * Mark any with Unf=OtherCon[] as
-- call-by-value, unless it's an unlifted type already. * Potentially
-- combine it with existing call-by-value marks (from ww) * Update the id
-- See Note [Attaching CBV Marks to ids].
computeCbvInfo :: HasCallStack => Id -> CoreExpr -> Id
isUnsafeEqualityProof :: CoreExpr -> Bool
dumpIdInfoOfProgram :: Bool -> (IdInfo -> SDoc) -> CoreProgram -> SDoc
module GHC.Core.Tidy
tidyExpr :: TidyEnv -> CoreExpr -> CoreExpr
tidyRules :: TidyEnv -> [CoreRule] -> [CoreRule]
tidyUnfolding :: TidyEnv -> Unfolding -> Unfolding -> Unfolding
tidyCbvInfoTop :: HasDebugCallStack => NameSet -> Id -> CoreExpr -> Id
module GHC.Core.Subst
-- | A substitution environment, containing Id, TyVar, and
-- CoVar substitutions.
--
-- Some invariants apply to how you use the substitution:
--
--
-- - Note [The substitution invariant] in
-- GHC.Core.TyCo.Subst
-- - Note [Substitutions apply only once] in
-- GHC.Core.TyCo.Subst
--
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.
--
-- Note that this is a superset of the variables that are
-- currently in scope. See Note [The InScopeSet invariant].
--
-- "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 RuleInfo given the
-- new function Id
substRuleInfo :: Subst -> Id -> RuleInfo -> RuleInfo
substRulesForImportedIds :: Subst -> [CoreRule] -> [CoreRule]
-- | See substTy.
substTy :: Subst -> Type -> Type
-- | See substCo
substCo :: HasCallStack => Subst -> Coercion -> Coercion
-- | substExpr applies a substitution to an entire CoreExpr.
-- Remember, you may only apply the substitution once: See Note
-- [Substitutions apply only once] in GHC.Core.TyCo.Subst
--
-- Do *not* attempt to short-cut in the case of an empty substitution!
-- See Note [Extending the Subst]
substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr
substExprSC :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr
-- | Apply a substitution to an entire CoreBind, additionally
-- returning an updated Subst that should be used by subsequent
-- substitutions.
substBind :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind)
-- | Apply a substitution to an entire CoreBind, additionally
-- returning an updated Subst that should be used by subsequent
-- substitutions.
substBindSC :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind)
-- | Substitutes for the Ids within an unfolding NB: substUnfolding
-- discards any unfolding without without a Stable source. This is
-- usually what we want, but it may be a bit unexpected
substUnfolding :: Subst -> Unfolding -> Unfolding
-- | Substitutes for the Ids within an unfolding NB: substUnfolding
-- discards any unfolding without without a Stable source. This is
-- usually what we want, but it may be a bit unexpected
substUnfoldingSC :: Subst -> Unfolding -> Unfolding
-- | Find the substitution for an Id in the Subst
lookupIdSubst :: HasDebugCallStack => Subst -> Id -> CoreExpr
substIdType :: Subst -> Id -> Id
substIdOcc :: Subst -> Id -> Id
substTickish :: Subst -> CoreTickish -> CoreTickish
substDVarSet :: HasDebugCallStack => 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 GHC.Core.TyCo.Subst Note [The
-- substitution 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 TyCoSubst Note [The
-- substitution invariant] holds 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: 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 GHC.Core.TyCo.Subst Note
-- [The substitution invariant] holds 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 satisfies
-- GHC.Core.TyCo.Subst Note [The substitution invariant] 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 -> CoVar -> (Subst, CoVar)
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 GHC.Utils.Outputable.Outputable GHC.Core.Subst.Subst
-- | PrimOp's Ids
module GHC.Builtin.PrimOps.Ids
-- | Get primop id.
--
-- Retrieve it from primOpIds cache.
primOpId :: PrimOp -> Id
-- | All the primop ids, as a list
allThePrimOpIds :: [Id]
module GHC.Cmm.Node
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 -> !AlignmentSpec -> 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 = GenTickish 'TickishPassCmm
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
mapCollectSuccessors :: forall a. (Label -> (Label, a)) -> CmmNode O C -> (CmmNode O C, [a])
-- | 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 simplify automatically if one tick scope is a sub-scope
-- of the other already.
combineTickScopes :: CmmTickScope -> CmmTickScope -> CmmTickScope
instance GHC.Classes.Eq GHC.Cmm.Node.Convention
instance GHC.Classes.Eq GHC.Cmm.Node.CmmReturnInfo
instance GHC.Classes.Eq GHC.Cmm.Node.ForeignConvention
instance GHC.Classes.Eq GHC.Cmm.Node.ForeignTarget
instance GHC.Classes.Eq (GHC.Cmm.Node.CmmNode e x)
instance GHC.Cmm.Dataflow.Graph.NonLocal GHC.Cmm.Node.CmmNode
instance GHC.Cmm.Expr.UserOfRegs GHC.Cmm.Expr.LocalReg (GHC.Cmm.Node.CmmNode e x)
instance GHC.Cmm.Expr.UserOfRegs GHC.Cmm.Expr.GlobalReg (GHC.Cmm.Node.CmmNode e x)
instance GHC.Cmm.Expr.DefinerOfRegs GHC.Cmm.Expr.LocalReg (GHC.Cmm.Node.CmmNode e x)
instance GHC.Cmm.Expr.DefinerOfRegs GHC.Cmm.Expr.GlobalReg (GHC.Cmm.Node.CmmNode e x)
instance GHC.Classes.Eq GHC.Cmm.Node.CmmTickScope
instance GHC.Classes.Ord GHC.Cmm.Node.CmmTickScope
instance GHC.Utils.Outputable.Outputable GHC.Cmm.Node.CmmTickScope
instance (GHC.Classes.Ord r, GHC.Cmm.Expr.UserOfRegs r GHC.Cmm.Expr.CmmReg) => GHC.Cmm.Expr.UserOfRegs r GHC.Cmm.Node.ForeignTarget
module GHC.Cmm
type CmmProgram = [CmmGroup]
-- | Cmm group before SRT generation
type CmmGroup = GenCmmGroup CmmStatics CmmTopInfo CmmGraph
-- | Cmm group with SRTs
type CmmGroupSRTs = GenCmmGroup RawCmmStatics CmmTopInfo CmmGraph
-- | Raw cmm group (TODO (osa): not sure what that means)
type RawCmmGroup = GenCmmGroup RawCmmStatics (LabelMap RawCmmStatics) CmmGraph
type GenCmmGroup d h g = [GenCmmDecl d h g]
type CmmDecl = GenCmmDecl CmmStatics CmmTopInfo CmmGraph
type CmmDeclSRTs = GenCmmDecl RawCmmStatics 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 RawCmmStatics (LabelMap RawCmmStatics) CmmGraph
data Section
Section :: SectionType -> CLabel -> Section
data SectionType
Text :: SectionType
Data :: SectionType
ReadOnlyData :: SectionType
RelocatableReadOnlyData :: SectionType
UninitialisedData :: SectionType
ReadOnlyData16 :: SectionType
InitArray :: SectionType
FiniArray :: SectionType
CString :: SectionType
OtherSection :: String -> SectionType
data GenCmmStatics (rawOnly :: Bool)
[CmmStatics] :: CLabel -> CmmInfoTable -> CostCentreStack -> [CmmLit] -> GenCmmStatics 'False
-- | Static data, after SRTs are generated
[CmmStaticsRaw] :: CLabel -> [CmmStatic] -> GenCmmStatics a
type CmmStatics = GenCmmStatics 'False
type RawCmmStatics = GenCmmStatics 'True
data CmmStatic
-- | a literal value, size given by cmmLitRep of the literal.
CmmStaticLit :: CmmLit -> CmmStatic
-- | uninitialised data, N bytes long
CmmUninitialised :: Int -> CmmStatic
-- | string of 8-bit values only, not zero terminated.
CmmString :: ByteString -> CmmStatic
-- | an embedded binary file
CmmFileEmbed :: FilePath -> CmmStatic
data SectionProtection
ReadWriteSection :: SectionProtection
ReadOnlySection :: SectionProtection
WriteProtectedSection :: SectionProtection
-- | Should a data in this section be considered constant at runtime
sectionProtection :: Section -> SectionProtection
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
-- | CmmTopInfo is attached to each CmmDecl (see defn of CmmGroup), and
-- contains the extra info (beyond the executable code) that belongs to
-- that CmmDecl.
data CmmTopInfo
TopInfo :: LabelMap CmmInfoTable -> CmmStackInfo -> CmmTopInfo
[info_tbls] :: CmmTopInfo -> LabelMap CmmInfoTable
[stack_info] :: CmmTopInfo -> CmmStackInfo
data CmmStackInfo
StackInfo :: ByteOff -> Bool -> CmmStackInfo
[arg_space] :: CmmStackInfo -> ByteOff
[do_layout] :: CmmStackInfo -> Bool
-- | Info table as a haskell data type
data CmmInfoTable
CmmInfoTable :: CLabel -> SMRep -> ProfilingInfo -> Maybe CLabel -> Maybe (Id, CostCentreStack) -> CmmInfoTable
[cit_lbl] :: CmmInfoTable -> CLabel
[cit_rep] :: CmmInfoTable -> SMRep
[cit_prof] :: CmmInfoTable -> ProfilingInfo
[cit_srt] :: CmmInfoTable -> Maybe CLabel
[cit_clo] :: CmmInfoTable -> Maybe (Id, CostCentreStack)
topInfoTable :: GenCmmDecl a CmmTopInfo (GenCmmGraph n) -> Maybe CmmInfoTable
data ClosureTypeInfo
Constr :: ConTagZ -> ConstrDescription -> ClosureTypeInfo
Fun :: FunArity -> ArgDescr -> ClosureTypeInfo
Thunk :: ClosureTypeInfo
ThunkSelector :: SelectorOffset -> ClosureTypeInfo
BlackHole :: ClosureTypeInfo
IndStatic :: ClosureTypeInfo
data ProfilingInfo
NoProfilingInfo :: ProfilingInfo
ProfilingInfo :: ByteString -> ByteString -> ProfilingInfo
type ConstrDescription = ByteString
instance GHC.Classes.Eq GHC.Cmm.ProfilingInfo
instance GHC.Classes.Eq GHC.Cmm.CmmInfoTable
instance GHC.Show.Show GHC.Cmm.SectionType
instance GHC.Classes.Eq GHC.Cmm.SectionProtection
instance GHC.Base.Functor (GHC.Cmm.GenCmmDecl d h)
instance GHC.Base.Functor GHC.Cmm.GenBasicBlock
instance GHC.Base.Functor GHC.Cmm.ListGraph
instance GHC.Utils.Outputable.Outputable instr => GHC.Utils.Outputable.Outputable (GHC.Cmm.ListGraph instr)
instance GHC.Utils.Outputable.OutputableP env instr => GHC.Utils.Outputable.OutputableP env (GHC.Cmm.ListGraph instr)
instance GHC.Utils.Outputable.Outputable instr => GHC.Utils.Outputable.Outputable (GHC.Cmm.GenBasicBlock instr)
instance GHC.Utils.Outputable.OutputableP env instr => GHC.Utils.Outputable.OutputableP env (GHC.Cmm.GenBasicBlock instr)
instance GHC.Utils.Outputable.Outputable GHC.Cmm.CmmStatic
module GHC.Hs.Extension
type IsSrcSpanAnn p a = (Anno (IdGhcP p) ~ SrcSpanAnn' (EpAnn a), IsPass p)
-- | Used as a data type index for the hsSyn AST; also serves as a
-- singleton type for Pass
data GhcPass (c :: Pass)
[GhcPs] :: GhcPass 'Parsed
[GhcRn] :: GhcPass 'Renamed
[GhcTc] :: GhcPass 'Typechecked
data Pass
Parsed :: Pass
Renamed :: Pass
Typechecked :: Pass
type GhcPs = GhcPass 'Parsed
type GhcRn = GhcPass 'Renamed
type GhcTc = GhcPass 'Typechecked
-- | Allows us to check what phase we're in at GHC's runtime. For example,
-- this class allows us to write > f :: forall p. IsPass p =>
-- HsExpr (GhcPass p) -> blah > f e = case ghcPass @p of > GhcPs
-- -> ... in this RHS we have HsExpr GhcPs... > GhcRn -> ... in
-- this RHS we have HsExpr GhcRn... > GhcTc -> ... in this RHS we
-- have HsExpr GhcTc... which is very useful, for example, when
-- pretty-printing. See Note [IsPass].
class (NoGhcTcPass (NoGhcTcPass p) ~ NoGhcTcPass p, IsPass (NoGhcTcPass p)) => IsPass p
ghcPass :: IsPass p => GhcPass p
-- | Maps the "normal" id type for a given GHC pass
type family IdGhcP pass
type family NoGhcTcPass (p :: Pass) :: Pass
-- | Constraint type to bundle up the requirement for OutputableBndr
-- on both the id and the NoGhcTc of it. See Note
-- [NoGhcTc].
type OutputableBndrId pass = (OutputableBndr (IdGhcP pass), OutputableBndr (IdGhcP (NoGhcTcPass pass)), Outputable (GenLocated (Anno (IdGhcP pass)) (IdGhcP pass)), Outputable (GenLocated (Anno (IdGhcP (NoGhcTcPass pass))) (IdGhcP (NoGhcTcPass pass))), IsPass pass)
pprIfPs :: forall p. IsPass p => (p ~ 'Parsed => SDoc) -> SDoc
pprIfRn :: forall p. IsPass p => (p ~ 'Renamed => SDoc) -> SDoc
pprIfTc :: forall p. IsPass p => (p ~ 'Typechecked => SDoc) -> SDoc
noHsTok :: GenLocated TokenLocation (HsToken tok)
noHsUniTok :: GenLocated TokenLocation (HsUniToken tok utok)
instance Data.Data.Data GHC.Hs.Extension.Pass
instance GHC.Hs.Extension.IsPass 'GHC.Hs.Extension.Parsed
instance GHC.Hs.Extension.IsPass 'GHC.Hs.Extension.Renamed
instance GHC.Hs.Extension.IsPass 'GHC.Hs.Extension.Typechecked
instance Language.Haskell.Syntax.Extension.UnXRec (GHC.Hs.Extension.GhcPass p)
instance Language.Haskell.Syntax.Extension.MapXRec (GHC.Hs.Extension.GhcPass p)
instance Data.Typeable.Internal.Typeable p => Data.Data.Data (GHC.Hs.Extension.GhcPass p)
module GHC.Types.Hint
-- | A type for hints emitted by GHC. A hint suggests a possible way
-- to deal with a particular warning or error.
data GhcHint
-- | An "unknown" hint. This type constructor allows arbitrary -- hints to
-- be embedded. The typical use case would be GHC plugins -- willing to
-- emit hints alongside their custom diagnostics.
UnknownHint :: a -> GhcHint
-- | Suggests adding a particular language extension. GHC will do its best
-- trying to guess when the user is using the syntax of a particular
-- language extension without having the relevant extension enabled.
--
-- Example: If the user uses the keyword "mdo" (and we are in a monadic
-- block), but the relevant extension is not enabled, GHC will emit a
-- 'SuggestExtension RecursiveDo'.
--
-- Test case(s): parsershould_failT12429,
-- parsershould_failT8501c, parsershould_failT18251e, ...
-- (and many more)
SuggestExtension :: !LanguageExtensionHint -> GhcHint
-- | Suggests that a monadic code block is probably missing a "do" keyword.
--
-- Example: main = putStrLn "hello" putStrLn "world"
--
-- Test case(s): parsershould_failT8501a,
-- parsershould_failreadFail007,
-- parsershould_failInfixAppPatErr, parsershould_failT984
SuggestMissingDo :: GhcHint
-- | Suggests that a "let" expression is needed in a "do" block.
--
-- Test cases: None (that explicitly test this particular hint is
-- emitted).
SuggestLetInDo :: GhcHint
-- | Suggests to add an ".hsig" signature file to the Cabal manifest.
--
-- Triggered by: DriverUnexpectedSignature, if Cabal is being
-- used.
--
-- Example: See comment of DriverUnexpectedSignature.
--
-- Test case(s): driver/T12955
SuggestAddSignatureCabalFile :: !ModuleName -> GhcHint
-- | Suggests to explicitly list the instantiations for the signatures in
-- the GHC invocation command.
--
-- Triggered by: DriverUnexpectedSignature, if Cabal is not
-- being used.
--
-- Example: See comment of DriverUnexpectedSignature.
--
-- Test case(s): driver/T12955
SuggestSignatureInstantiations :: !ModuleName -> [InstantiationSuggestion] -> GhcHint
-- | Suggests to use spaces instead of tabs.
--
-- Triggered by: PsWarnTab.
--
-- Examples: None Test Case(s): None
SuggestUseSpaces :: GhcHint
-- | Suggests adding a whitespace after the given symbol.
--
-- Examples: None Test Case(s): parsershould_compileT18834a.hs
SuggestUseWhitespaceAfter :: !OperatorWhitespaceSymbol -> GhcHint
-- | Suggests adding a whitespace around the given operator symbol, as it
-- might be repurposed as special syntax by a future language extension.
-- The second parameter is how such operator occurred, if in a prefix,
-- suffix or tight infix position.
--
-- Triggered by: PsWarnOperatorWhitespace.
--
-- Example: h a b = a+b -- not OK, no spaces around +.
--
-- Test Case(s): parsershould_compileT18834b.hs
SuggestUseWhitespaceAround :: !String -> !OperatorWhitespaceOccurrence -> GhcHint
-- | Suggests wrapping an expression in parentheses
--
-- Examples: None Test Case(s): None
SuggestParentheses :: GhcHint
-- | Suggests to increase the -fmax-pmcheck-models limit for the pattern
-- match checker.
--
-- Triggered by: DsMaxPmCheckModelsReached
--
-- Test case(s): pmcheckshould_compileTooManyDeltas
-- pmcheckshould_compileTooManyDeltas
-- pmcheckshould_compileT11822
SuggestIncreaseMaxPmCheckModels :: GhcHint
-- | Suggests adding a type signature, typically to resolve ambiguity or
-- help GHC inferring types.
SuggestAddTypeSignatures :: AvailableBindings -> GhcHint
-- | Suggests to explicitly discard the result of a monadic action by
-- binding the result to the '_' wilcard.
--
-- Example: main = do _ <- getCurrentTime
SuggestBindToWildcard :: !LHsExpr GhcTc -> GhcHint
SuggestAddInlineOrNoInlinePragma :: !Var -> !Activation -> GhcHint
SuggestAddPhaseToCompetingRule :: !RuleName -> GhcHint
-- | Suggests adding an identifier to the export list of a signature.
SuggestAddToHSigExportList :: !Name -> !Maybe Module -> GhcHint
-- | Suggests increasing the limit for the number of iterations in the
-- simplifier.
SuggestIncreaseSimplifierIterations :: GhcHint
-- | Suggests to explicitly import Type from the Kind
-- module, because using "*" to mean Type relies on the StarIsType
-- extension, which will become deprecated in the future.
--
-- Triggered by: PsWarnStarIsType Example: None Test case(s):
-- wcompat-warnings/WCompatWarningsOn.hs
SuggestUseTypeFromDataKind :: Maybe RdrName -> GhcHint
-- | Suggests placing the qualified keyword after the
-- module name.
--
-- Triggered by: PsWarnImportPreQualified Example: None Test
-- case(s): module/mod184.hs
SuggestQualifiedAfterModuleName :: GhcHint
-- | Suggests using TemplateHaskell quotation syntax.
--
-- Triggered by: PsErrEmptyDoubleQuotes only if TemplateHaskell is
-- enabled. Example: None Test case(s):
-- parsershould_failT13450TH.hs
SuggestThQuotationSyntax :: GhcHint
-- | Suggests alternative roles in case we found an illegal one.
--
-- Triggered by: PsErrIllegalRoleName Example: None Test case(s):
-- rolesshould_failRoles7.hs
SuggestRoles :: [Role] -> GhcHint
-- | Suggests qualifying the * operator in modules where StarIsType
-- is enabled.
--
-- Triggered by: PsWarnStarBinder Test case(s):
-- warningsshould_compileStarBinder.hs
SuggestQualifyStarOperator :: GhcHint
-- | Suggests that a type signature should have form variable ::
-- type in order to be accepted by GHC.
--
-- Triggered by: PsErrInvalidTypeSignature Test case(s):
-- parsershould_failT3811
SuggestTypeSignatureForm :: GhcHint
-- | Suggests to move an orphan instance or to newtype-wrap it.
--
-- Triggered by: TcRnOrphanInstance Test cases(s):
-- warningsshould_compileT9178 typecheckshould_compileT4912
SuggestFixOrphanInstance :: GhcHint
-- | Suggests to use a standalone deriving declaration when GHC can't
-- derive a typeclass instance in a trivial way.
--
-- Triggered by: DerivBadErrConstructor Test cases(s):
-- typecheckshould_failtcfail086
SuggestAddStandaloneDerivation :: GhcHint
-- | Suggests the user to fill in the wildcard constraint to disambiguate
-- which constraint that is.
--
-- Example: deriving instance _ => Eq (Foo f a)
--
-- Triggered by: DerivBadErrConstructor Test cases(s):
-- partial-sigsshould_failT13324_fail2
SuggestFillInWildcardConstraint :: GhcHint
-- | Suggests to use an identifier other than forall Triggered by:
-- TcRnForallIdentifier
SuggestRenameForall :: GhcHint
-- | Suggests to use the appropriate Template Haskell tick: a single tick
-- for a term-level NameSpace, or a double tick for a type-level
-- NameSpace.
--
-- Triggered by: TcRnIncorrectNameSpace.
SuggestAppropriateTHTick :: NameSpace -> GhcHint
-- | Suggests enabling -ddump-splices to help debug an issue when a
-- Name is not in scope or is used in multiple different
-- namespaces (e.g. both as a data constructor and a type constructor).
--
-- Concomitant with NoExactName or SameName errors, see
-- e.g. "GHC.Rename.Env.lookupExactOcc_either". Test cases: T5971, T7241,
-- T13937.
SuggestDumpSlices :: GhcHint
-- | Suggests adding a tick to refer to a data constructor at the type
-- level.
--
-- Test case: T9778.
SuggestAddTick :: Name -> GhcHint
-- | Something is split off from its corresponding declaration. For
-- example, a datatype is given a role declaration in a different module.
--
-- Test cases: T495, T8485, T2713, T5533.
SuggestMoveToDeclarationSite :: SDoc -> RdrName -> GhcHint
-- | Suggest a similar name that the user might have meant, e.g. suggest
-- traverse when the user has written travrese.
--
-- Test case: mod73.
SuggestSimilarNames :: RdrName -> NonEmpty SimilarName -> GhcHint
-- | Remind the user that the field selector has been suppressed because of
-- -XNoFieldSelectors.
--
-- Test cases: NFSSuppressed, records-nofieldselectors.
RemindFieldSelectorSuppressed :: RdrName -> [Name] -> GhcHint
[suppressed_selector] :: GhcHint -> RdrName
[suppressed_parents] :: GhcHint -> [Name]
-- | Suggest importing from a module, removing a hiding clause, or
-- explain to the user that we couldn't find a module with the given
-- ModuleName.
--
-- Test cases: mod28, mod36, mod87, mod114, ...
ImportSuggestion :: ImportSuggestion -> GhcHint
-- | Suggest importing a data constructor to bring it into scope Triggered
-- by: TcRnTypeCannotBeMarshaled
--
-- Test cases: ccfail004
SuggestImportingDataCon :: GhcHint
-- | The bindings we have available in scope when suggesting an explicit
-- type signature.
data AvailableBindings
NamedBindings :: NonEmpty Name -> AvailableBindings
-- | An unknown binding (i.e. too complicated to turn into a Name)
UnnamedBinding :: AvailableBindings
-- | An InstantiationSuggestion for a '.hsig' file. This is
-- generated by GHC in case of a DriverUnexpectedSignature and
-- suggests a way to instantiate a particular signature, where the first
-- argument is the signature name and the second is the module where the
-- signature was defined. Example:
--
-- src/MyStr.hsig:2:11: error: Unexpected signature: ‘MyStr’ (Try passing
-- -instantiated-with="MyStr=MyStr" replacing MyStr as
-- necessary.)
data InstantiationSuggestion
InstantiationSuggestion :: !ModuleName -> !Module -> InstantiationSuggestion
data LanguageExtensionHint
-- | Suggest to enable the input extension. This is the hint that GHC emits
-- if this is not a "known" fix, i.e. this is GHC giving its best guess
-- on what extension might be necessary to make a certain program
-- compile. For example, GHC might suggests to enable
-- BlockArguments when the user simply formatted incorrectly the
-- input program, so GHC here is trying to be as helpful as possible. If
-- the input SDoc is not empty, it will contain some extra
-- information about the why the extension is required, but it's totally
-- irrelevant/redundant for IDEs and other tools.
SuggestSingleExtension :: !SDoc -> !Extension -> LanguageExtensionHint
-- | Suggest to enable the input extensions. The list is to be intended as
-- disjuctive i.e. the user is suggested to enable any of
-- the extensions listed. If the input SDoc is not empty, it will
-- contain some extra information about the why the extensions are
-- required, but it's totally irrelevant/redundant for IDEs and other
-- tools.
SuggestAnyExtension :: !SDoc -> [Extension] -> LanguageExtensionHint
-- | Suggest to enable the input extensions. The list is to be intended as
-- conjunctive i.e. the user is suggested to enable all the
-- extensions listed. If the input SDoc is not empty, it will
-- contain some extra information about the why the extensions are
-- required, but it's totally irrelevant/redundant for IDEs and other
-- tools.
SuggestExtensions :: !SDoc -> [Extension] -> LanguageExtensionHint
-- | Suggest to enable the input extension in order to fix a certain
-- problem. This is the suggestion that GHC emits when is more-or-less
-- clear "what's going on". For example, if both DeriveAnyClass
-- and GeneralizedNewtypeDeriving are turned on, the right thing
-- to do is to enabled DerivingStrategies, so in contrast to
-- SuggestSingleExtension GHC will be a bit more "imperative"
-- (i.e. "Use X Y Z in order to ... "). If the input SDoc is not
-- empty, it will contain some extra information about the why the
-- extensions are required, but it's totally irrelevant/redundant for
-- IDEs and other tools.
SuggestExtensionInOrderTo :: !SDoc -> !Extension -> LanguageExtensionHint
-- | Suggest how to fix an import.
data ImportSuggestion
-- | Some module exports what we want, but we aren't explicitly importing
-- it.
CouldImportFrom :: NonEmpty (Module, ImportedModsVal) -> OccName -> ImportSuggestion
-- | Some module exports what we want, but we are explicitly hiding it.
CouldUnhideFrom :: NonEmpty (Module, ImportedModsVal) -> OccName -> ImportSuggestion
-- | Explain how something is in scope.
data HowInScope
-- | It was locally bound at this particular source location.
LocallyBoundAt :: SrcSpan -> HowInScope
-- | It was imported by this particular import declaration.
ImportedBy :: ImpDeclSpec -> HowInScope
data SimilarName
SimilarName :: Name -> SimilarName
SimilarRdrName :: RdrName -> HowInScope -> SimilarName
-- | Whether * is a synonym for Type.
data StarIsType
StarIsNotType :: StarIsType
StarIsType :: StarIsType
-- | Suggests a single extension without extra user info.
suggestExtension :: Extension -> GhcHint
-- | Like suggestExtension but allows supplying extra info for the
-- user.
suggestExtensionWithInfo :: SDoc -> Extension -> GhcHint
-- | Suggests to enable every extension in the list.
suggestExtensions :: [Extension] -> GhcHint
-- | Like suggestExtensions but allows supplying extra info for the
-- user.
suggestExtensionsWithInfo :: SDoc -> [Extension] -> GhcHint
-- | Suggests to enable any extension in the list.
suggestAnyExtension :: [Extension] -> GhcHint
-- | Like suggestAnyExtension but allows supplying extra info for
-- the user.
suggestAnyExtensionWithInfo :: SDoc -> [Extension] -> GhcHint
useExtensionInOrderTo :: SDoc -> Extension -> GhcHint
-- | Display info about the treatment of * under NoStarIsType.
--
-- With StarIsType, three properties of * hold:
--
-- (a) it is not an infix operator (b) it is always in scope (c) it is a
-- synonym for Data.Kind.Type
--
-- However, the user might not know that they are working on a module
-- with NoStarIsType and write code that still assumes (a), (b), and (c),
-- which actually do not hold in that module.
--
-- Violation of (a) shows up in the parser. For instance, in the
-- following examples, we have * not applied to enough arguments:
--
-- data A :: * data F :: * -> *
--
-- Violation of (b) or (c) show up in the renamer and the typechecker
-- respectively. For instance:
--
-- type K = Either * Bool
--
-- This will parse differently depending on whether StarIsType is
-- enabled, but it will parse nonetheless. With NoStarIsType it is parsed
-- as a type operator, thus we have ((*) Either Bool). Now there are two
-- cases to consider:
--
--
-- - There is no definition of (*) in scope. In this case the renamer
-- will fail to look it up. This is a violation of assumption (b).
-- - There is a definition of the (*) type operator in scope (for
-- example coming from GHC.TypeNats). In this case the user will get a
-- kind mismatch error. This is a violation of assumption (c).
--
--
-- The user might unknowingly be working on a module with NoStarIsType or
-- use * as Type out of habit. So it is important to give a
-- hint whenever an assumption about * is violated. Unfortunately,
-- it is somewhat difficult to deal with (c), so we limit ourselves to
-- (a) and (b).
--
-- noStarIsTypeHints returns appropriate hints to the user
-- depending on the extensions enabled in the module and the name that
-- triggered the error. That is, if we have NoStarIsType and the error is
-- related to * or its Unicode variant, we will suggest using
-- Type; otherwise we won't suggest anything.
noStarIsTypeHints :: StarIsType -> RdrName -> [GhcHint]
module GHC.Types.Error
-- | A collection of messages emitted by GHC during error reporting. A
-- diagnostic message is typically a warning or an error. See Note
-- [Messages].
--
-- INVARIANT: All the messages in this collection must be
-- relevant, i.e. their Severity should not be
-- SevIgnore. The smart constructor mkMessages will filter
-- out any message which Severity is SevIgnore.
data Messages e
mkMessages :: Bag (MsgEnvelope e) -> Messages e
getMessages :: Messages e -> Bag (MsgEnvelope e)
emptyMessages :: Messages e
isEmptyMessages :: Messages e -> Bool
singleMessage :: MsgEnvelope e -> Messages e
-- | Adds a Message to the input collection of messages. See Note
-- [Discarding Messages].
addMessage :: MsgEnvelope e -> Messages e -> Messages e
-- | Joins two collections of messages together. See Note [Discarding
-- Messages].
unionMessages :: Messages e -> Messages e -> Messages e
-- | Joins many Messagess together
unionManyMessages :: Foldable f => f (Messages e) -> Messages e
-- | An envelope for GHC's facts about a running program, parameterised
-- over the domain-specific (i.e. parsing, typecheck-renaming,
-- etc) diagnostics.
--
-- To say things differently, GHC emits diagnostics about the
-- running program, each of which is wrapped into a MsgEnvelope
-- that carries specific information like where the error happened, etc.
-- Finally, multiple MsgEnvelopes are aggregated into
-- Messages that are returned to the user.
data MsgEnvelope e
MsgEnvelope :: SrcSpan -> PrintUnqualified -> e -> Severity -> MsgEnvelope e
-- | The SrcSpan is used for sorting errors into line-number order
[errMsgSpan] :: MsgEnvelope e -> SrcSpan
[errMsgContext] :: MsgEnvelope e -> PrintUnqualified
[errMsgDiagnostic] :: MsgEnvelope e -> e
[errMsgSeverity] :: MsgEnvelope e -> Severity
-- | The class for a diagnostic message. The main purpose is to classify a
-- message within GHC, to distinguish it from a debug/dump message vs a
-- proper diagnostic, for which we include a DiagnosticReason.
data MessageClass
MCOutput :: MessageClass
MCFatal :: MessageClass
MCInteractive :: MessageClass
-- | Log message intended for compiler developers No file/line/column stuff
MCDump :: MessageClass
-- | Log messages intended for end users. No file/line/column stuff.
MCInfo :: MessageClass
-- | Diagnostics from the compiler. This constructor is very powerful as it
-- allows the construction of a MessageClass with a completely
-- arbitrary permutation of Severity and DiagnosticReason.
-- As such, users are encouraged to use the mkMCDiagnostic smart
-- constructor instead. Use this constructor directly only if you need to
-- construct and manipulate diagnostic messages directly, for example
-- inside Error. In all the other circumstances, especially
-- when emitting compiler diagnostics, use the smart constructor.
MCDiagnostic :: Severity -> DiagnosticReason -> MessageClass
-- | Used to describe warnings and errors o The message has a
-- file/line/column heading, plus "warning:" or "error:", added by
-- mkLocMessage o With SevIgnore the message is suppressed o
-- Output is intended for end users
data Severity
-- | Ignore this message, for example in case of suppression of warnings
-- users don't want to see. See Note [Suppressing Messages]
SevIgnore :: Severity
SevWarning :: Severity
SevError :: Severity
-- | A class identifying a diagnostic. Dictionary.com defines a diagnostic
-- as:
--
-- "a message output by a computer diagnosing an error in a computer
-- program, computer system, or component device".
--
-- A Diagnostic carries the actual description of the
-- message (which, in GHC's case, it can be an error or a warning) and
-- the reason why such message was generated in the first place.
-- See also Note [Rendering Messages].
class Diagnostic a
diagnosticMessage :: Diagnostic a => a -> DecoratedSDoc
diagnosticReason :: Diagnostic a => a -> DiagnosticReason
diagnosticHints :: Diagnostic a => a -> [GhcHint]
-- | A generic Diagnostic message, without any further
-- classification or provenance: By looking at a DiagnosticMessage
-- we don't know neither where it was generated nor how to
-- intepret its payload (as it's just a structured document). All we can
-- do is to print it out and look at its DiagnosticReason.
data DiagnosticMessage
DiagnosticMessage :: !DecoratedSDoc -> !DiagnosticReason -> [GhcHint] -> DiagnosticMessage
[diagMessage] :: DiagnosticMessage -> !DecoratedSDoc
[diagReason] :: DiagnosticMessage -> !DiagnosticReason
[diagHints] :: DiagnosticMessage -> [GhcHint]
-- | The reason why a Diagnostic was emitted in the first
-- place. Diagnostic messages are born within GHC with a very precise
-- reason, which can be completely statically-computed (i.e. this is an
-- error or a warning no matter what), or influenced by the specific
-- state of the DynFlags at the moment of the creation of a new
-- Diagnostic. For example, a parsing error is always going
-- to be an error, whereas a 'WarningWithoutFlag Opt_WarnUnusedImports'
-- might turn into an error due to '-Werror' or
-- '-Werror=warn-unused-imports'. Interpreting a DiagnosticReason
-- together with its associated Severity gives us the full
-- picture.
data DiagnosticReason
-- | Born as a warning.
WarningWithoutFlag :: DiagnosticReason
-- | Warning was enabled with the flag.
WarningWithFlag :: !WarningFlag -> DiagnosticReason
-- | Born as an error.
ErrorWithoutFlag :: DiagnosticReason
-- | A generic Hint message, to be used with
-- DiagnosticMessage.
data DiagnosticHint
DiagnosticHint :: !SDoc -> DiagnosticHint
mkPlainDiagnostic :: DiagnosticReason -> [GhcHint] -> SDoc -> DiagnosticMessage
-- | Create an error DiagnosticMessage holding just a single
-- SDoc
mkPlainError :: [GhcHint] -> SDoc -> DiagnosticMessage
-- | Create a DiagnosticMessage from a list of bulleted SDocs and a
-- DiagnosticReason
mkDecoratedDiagnostic :: DiagnosticReason -> [GhcHint] -> [SDoc] -> DiagnosticMessage
-- | Create an error DiagnosticMessage from a list of bulleted SDocs
mkDecoratedError :: [GhcHint] -> [SDoc] -> DiagnosticMessage
-- | A type for hints emitted by GHC. A hint suggests a possible way
-- to deal with a particular warning or error.
data GhcHint
-- | An "unknown" hint. This type constructor allows arbitrary -- hints to
-- be embedded. The typical use case would be GHC plugins -- willing to
-- emit hints alongside their custom diagnostics.
UnknownHint :: a -> GhcHint
-- | Suggests adding a particular language extension. GHC will do its best
-- trying to guess when the user is using the syntax of a particular
-- language extension without having the relevant extension enabled.
--
-- Example: If the user uses the keyword "mdo" (and we are in a monadic
-- block), but the relevant extension is not enabled, GHC will emit a
-- 'SuggestExtension RecursiveDo'.
--
-- Test case(s): parsershould_failT12429,
-- parsershould_failT8501c, parsershould_failT18251e, ...
-- (and many more)
SuggestExtension :: !LanguageExtensionHint -> GhcHint
-- | Suggests that a monadic code block is probably missing a "do" keyword.
--
-- Example: main = putStrLn "hello" putStrLn "world"
--
-- Test case(s): parsershould_failT8501a,
-- parsershould_failreadFail007,
-- parsershould_failInfixAppPatErr, parsershould_failT984
SuggestMissingDo :: GhcHint
-- | Suggests that a "let" expression is needed in a "do" block.
--
-- Test cases: None (that explicitly test this particular hint is
-- emitted).
SuggestLetInDo :: GhcHint
-- | Suggests to add an ".hsig" signature file to the Cabal manifest.
--
-- Triggered by: DriverUnexpectedSignature, if Cabal is being
-- used.
--
-- Example: See comment of DriverUnexpectedSignature.
--
-- Test case(s): driver/T12955
SuggestAddSignatureCabalFile :: !ModuleName -> GhcHint
-- | Suggests to explicitly list the instantiations for the signatures in
-- the GHC invocation command.
--
-- Triggered by: DriverUnexpectedSignature, if Cabal is not
-- being used.
--
-- Example: See comment of DriverUnexpectedSignature.
--
-- Test case(s): driver/T12955
SuggestSignatureInstantiations :: !ModuleName -> [InstantiationSuggestion] -> GhcHint
-- | Suggests to use spaces instead of tabs.
--
-- Triggered by: PsWarnTab.
--
-- Examples: None Test Case(s): None
SuggestUseSpaces :: GhcHint
-- | Suggests adding a whitespace after the given symbol.
--
-- Examples: None Test Case(s): parsershould_compileT18834a.hs
SuggestUseWhitespaceAfter :: !OperatorWhitespaceSymbol -> GhcHint
-- | Suggests adding a whitespace around the given operator symbol, as it
-- might be repurposed as special syntax by a future language extension.
-- The second parameter is how such operator occurred, if in a prefix,
-- suffix or tight infix position.
--
-- Triggered by: PsWarnOperatorWhitespace.
--
-- Example: h a b = a+b -- not OK, no spaces around +.
--
-- Test Case(s): parsershould_compileT18834b.hs
SuggestUseWhitespaceAround :: !String -> !OperatorWhitespaceOccurrence -> GhcHint
-- | Suggests wrapping an expression in parentheses
--
-- Examples: None Test Case(s): None
SuggestParentheses :: GhcHint
-- | Suggests to increase the -fmax-pmcheck-models limit for the pattern
-- match checker.
--
-- Triggered by: DsMaxPmCheckModelsReached
--
-- Test case(s): pmcheckshould_compileTooManyDeltas
-- pmcheckshould_compileTooManyDeltas
-- pmcheckshould_compileT11822
SuggestIncreaseMaxPmCheckModels :: GhcHint
-- | Suggests adding a type signature, typically to resolve ambiguity or
-- help GHC inferring types.
SuggestAddTypeSignatures :: AvailableBindings -> GhcHint
-- | Suggests to explicitly discard the result of a monadic action by
-- binding the result to the '_' wilcard.
--
-- Example: main = do _ <- getCurrentTime
SuggestBindToWildcard :: !LHsExpr GhcTc -> GhcHint
SuggestAddInlineOrNoInlinePragma :: !Var -> !Activation -> GhcHint
SuggestAddPhaseToCompetingRule :: !RuleName -> GhcHint
-- | Suggests adding an identifier to the export list of a signature.
SuggestAddToHSigExportList :: !Name -> !Maybe Module -> GhcHint
-- | Suggests increasing the limit for the number of iterations in the
-- simplifier.
SuggestIncreaseSimplifierIterations :: GhcHint
-- | Suggests to explicitly import Type from the Kind
-- module, because using "*" to mean Type relies on the StarIsType
-- extension, which will become deprecated in the future.
--
-- Triggered by: PsWarnStarIsType Example: None Test case(s):
-- wcompat-warnings/WCompatWarningsOn.hs
SuggestUseTypeFromDataKind :: Maybe RdrName -> GhcHint
-- | Suggests placing the qualified keyword after the
-- module name.
--
-- Triggered by: PsWarnImportPreQualified Example: None Test
-- case(s): module/mod184.hs
SuggestQualifiedAfterModuleName :: GhcHint
-- | Suggests using TemplateHaskell quotation syntax.
--
-- Triggered by: PsErrEmptyDoubleQuotes only if TemplateHaskell is
-- enabled. Example: None Test case(s):
-- parsershould_failT13450TH.hs
SuggestThQuotationSyntax :: GhcHint
-- | Suggests alternative roles in case we found an illegal one.
--
-- Triggered by: PsErrIllegalRoleName Example: None Test case(s):
-- rolesshould_failRoles7.hs
SuggestRoles :: [Role] -> GhcHint
-- | Suggests qualifying the * operator in modules where StarIsType
-- is enabled.
--
-- Triggered by: PsWarnStarBinder Test case(s):
-- warningsshould_compileStarBinder.hs
SuggestQualifyStarOperator :: GhcHint
-- | Suggests that a type signature should have form variable ::
-- type in order to be accepted by GHC.
--
-- Triggered by: PsErrInvalidTypeSignature Test case(s):
-- parsershould_failT3811
SuggestTypeSignatureForm :: GhcHint
-- | Suggests to move an orphan instance or to newtype-wrap it.
--
-- Triggered by: TcRnOrphanInstance Test cases(s):
-- warningsshould_compileT9178 typecheckshould_compileT4912
SuggestFixOrphanInstance :: GhcHint
-- | Suggests to use a standalone deriving declaration when GHC can't
-- derive a typeclass instance in a trivial way.
--
-- Triggered by: DerivBadErrConstructor Test cases(s):
-- typecheckshould_failtcfail086
SuggestAddStandaloneDerivation :: GhcHint
-- | Suggests the user to fill in the wildcard constraint to disambiguate
-- which constraint that is.
--
-- Example: deriving instance _ => Eq (Foo f a)
--
-- Triggered by: DerivBadErrConstructor Test cases(s):
-- partial-sigsshould_failT13324_fail2
SuggestFillInWildcardConstraint :: GhcHint
-- | Suggests to use an identifier other than forall Triggered by:
-- TcRnForallIdentifier
SuggestRenameForall :: GhcHint
-- | Suggests to use the appropriate Template Haskell tick: a single tick
-- for a term-level NameSpace, or a double tick for a type-level
-- NameSpace.
--
-- Triggered by: TcRnIncorrectNameSpace.
SuggestAppropriateTHTick :: NameSpace -> GhcHint
-- | Suggests enabling -ddump-splices to help debug an issue when a
-- Name is not in scope or is used in multiple different
-- namespaces (e.g. both as a data constructor and a type constructor).
--
-- Concomitant with NoExactName or SameName errors, see
-- e.g. "GHC.Rename.Env.lookupExactOcc_either". Test cases: T5971, T7241,
-- T13937.
SuggestDumpSlices :: GhcHint
-- | Suggests adding a tick to refer to a data constructor at the type
-- level.
--
-- Test case: T9778.
SuggestAddTick :: Name -> GhcHint
-- | Something is split off from its corresponding declaration. For
-- example, a datatype is given a role declaration in a different module.
--
-- Test cases: T495, T8485, T2713, T5533.
SuggestMoveToDeclarationSite :: SDoc -> RdrName -> GhcHint
-- | Suggest a similar name that the user might have meant, e.g. suggest
-- traverse when the user has written travrese.
--
-- Test case: mod73.
SuggestSimilarNames :: RdrName -> NonEmpty SimilarName -> GhcHint
-- | Remind the user that the field selector has been suppressed because of
-- -XNoFieldSelectors.
--
-- Test cases: NFSSuppressed, records-nofieldselectors.
RemindFieldSelectorSuppressed :: RdrName -> [Name] -> GhcHint
[suppressed_selector] :: GhcHint -> RdrName
[suppressed_parents] :: GhcHint -> [Name]
-- | Suggest importing from a module, removing a hiding clause, or
-- explain to the user that we couldn't find a module with the given
-- ModuleName.
--
-- Test cases: mod28, mod36, mod87, mod114, ...
ImportSuggestion :: ImportSuggestion -> GhcHint
-- | Suggest importing a data constructor to bring it into scope Triggered
-- by: TcRnTypeCannotBeMarshaled
--
-- Test cases: ccfail004
SuggestImportingDataCon :: GhcHint
-- | The bindings we have available in scope when suggesting an explicit
-- type signature.
data AvailableBindings
NamedBindings :: NonEmpty Name -> AvailableBindings
-- | An unknown binding (i.e. too complicated to turn into a Name)
UnnamedBinding :: AvailableBindings
data LanguageExtensionHint
-- | Suggest to enable the input extension. This is the hint that GHC emits
-- if this is not a "known" fix, i.e. this is GHC giving its best guess
-- on what extension might be necessary to make a certain program
-- compile. For example, GHC might suggests to enable
-- BlockArguments when the user simply formatted incorrectly the
-- input program, so GHC here is trying to be as helpful as possible. If
-- the input SDoc is not empty, it will contain some extra
-- information about the why the extension is required, but it's totally
-- irrelevant/redundant for IDEs and other tools.
SuggestSingleExtension :: !SDoc -> !Extension -> LanguageExtensionHint
-- | Suggest to enable the input extensions. The list is to be intended as
-- disjuctive i.e. the user is suggested to enable any of
-- the extensions listed. If the input SDoc is not empty, it will
-- contain some extra information about the why the extensions are
-- required, but it's totally irrelevant/redundant for IDEs and other
-- tools.
SuggestAnyExtension :: !SDoc -> [Extension] -> LanguageExtensionHint
-- | Suggest to enable the input extensions. The list is to be intended as
-- conjunctive i.e. the user is suggested to enable all the
-- extensions listed. If the input SDoc is not empty, it will
-- contain some extra information about the why the extensions are
-- required, but it's totally irrelevant/redundant for IDEs and other
-- tools.
SuggestExtensions :: !SDoc -> [Extension] -> LanguageExtensionHint
-- | Suggest to enable the input extension in order to fix a certain
-- problem. This is the suggestion that GHC emits when is more-or-less
-- clear "what's going on". For example, if both DeriveAnyClass
-- and GeneralizedNewtypeDeriving are turned on, the right thing
-- to do is to enabled DerivingStrategies, so in contrast to
-- SuggestSingleExtension GHC will be a bit more "imperative"
-- (i.e. "Use X Y Z in order to ... "). If the input SDoc is not
-- empty, it will contain some extra information about the why the
-- extensions are required, but it's totally irrelevant/redundant for
-- IDEs and other tools.
SuggestExtensionInOrderTo :: !SDoc -> !Extension -> LanguageExtensionHint
-- | Suggests a single extension without extra user info.
suggestExtension :: Extension -> GhcHint
-- | Like suggestExtension but allows supplying extra info for the
-- user.
suggestExtensionWithInfo :: SDoc -> Extension -> GhcHint
-- | Suggests to enable every extension in the list.
suggestExtensions :: [Extension] -> GhcHint
-- | Like suggestExtensions but allows supplying extra info for the
-- user.
suggestExtensionsWithInfo :: SDoc -> [Extension] -> GhcHint
-- | Suggests to enable any extension in the list.
suggestAnyExtension :: [Extension] -> GhcHint
-- | Like suggestAnyExtension but allows supplying extra info for
-- the user.
suggestAnyExtensionWithInfo :: SDoc -> [Extension] -> GhcHint
useExtensionInOrderTo :: SDoc -> Extension -> GhcHint
-- | Helper function to use when no hints can be provided. Currently this
-- function can be used to construct plain DiagnosticMessage and
-- add hints to them, but once #18516 will be fully executed, the main
-- usage of this function would be in the implementation of the
-- diagnosticHints typeclass method, to report the fact that a
-- particular Diagnostic has no hints.
noHints :: [GhcHint]
-- | Represents a pretty-printable document.
--
-- To display an SDoc, use printSDoc, printSDocLn,
-- bufLeftRenderSDoc, or renderWithContext. Avoid calling
-- runSDoc directly as it breaks the abstraction layer.
data SDoc
-- | A DecoratedSDoc is isomorphic to a '[SDoc]' but it carries the
-- invariant that the input '[SDoc]' needs to be rendered
-- decorated into its final form, where the typical case would be
-- adding bullets between each elements of the list. The type of
-- decoration depends on the formatting function used, but in practice
-- GHC uses the formatBulleted.
data DecoratedSDoc
-- | Creates a new DecoratedSDoc out of a list of SDoc.
mkDecorated :: [SDoc] -> DecoratedSDoc
-- | Creates a new DecoratedSDoc out of a single SDoc
mkSimpleDecorated :: SDoc -> DecoratedSDoc
-- | Joins two DecoratedSDoc together. The resulting
-- DecoratedSDoc will have a number of entries which is the sum of
-- the lengths of the input.
unionDecoratedSDoc :: DecoratedSDoc -> DecoratedSDoc -> DecoratedSDoc
-- | Apply a transformation function to all elements of a
-- DecoratedSDoc.
mapDecoratedSDoc :: (SDoc -> SDoc) -> DecoratedSDoc -> DecoratedSDoc
pprMessageBag :: Bag SDoc -> SDoc
-- | Make an unannotated error message with location info.
mkLocMessage :: MessageClass -> SrcSpan -> SDoc -> SDoc
-- | Make a possibly annotated error message with location info.
mkLocMessageAnn :: Maybe String -> MessageClass -> SrcSpan -> SDoc -> SDoc
getCaretDiagnostic :: MessageClass -> SrcSpan -> IO SDoc
-- | Returns True if this is, intrinsically, a failure. See Note
-- [Intrinsic And Extrinsic Failures].
isIntrinsicErrorMessage :: Diagnostic e => MsgEnvelope e -> Bool
-- | Returns True if the envelope contains a message that will stop
-- compilation: either an intrinsic error or a fatal (-Werror) warning
isExtrinsicErrorMessage :: MsgEnvelope e -> Bool
isWarningMessage :: Diagnostic e => MsgEnvelope e -> Bool
getErrorMessages :: Diagnostic e => Messages e -> Bag (MsgEnvelope e)
getWarningMessages :: Diagnostic e => Messages e -> Bag (MsgEnvelope e)
-- | Partitions the Messages and returns a tuple which first element
-- are the warnings, and the second the errors.
partitionMessages :: Diagnostic e => Messages e -> (Messages e, Messages e)
-- | Are there any hard errors here? -Werror warnings are not
-- detected. If you want to check for -Werror warnings, use
-- errorsOrFatalWarningsFound.
errorsFound :: Diagnostic e => Messages e -> Bool
-- | Are there any errors or -Werror warnings here?
errorsOrFatalWarningsFound :: Messages e -> Bool
instance GHC.Show.Show GHC.Types.Error.DiagnosticReason
instance GHC.Classes.Eq GHC.Types.Error.DiagnosticReason
instance GHC.Show.Show GHC.Types.Error.Severity
instance GHC.Classes.Eq GHC.Types.Error.Severity
instance GHC.Show.Show GHC.Types.Error.MessageClass
instance GHC.Classes.Eq GHC.Types.Error.MessageClass
instance Data.Traversable.Traversable GHC.Types.Error.MsgEnvelope
instance Data.Foldable.Foldable GHC.Types.Error.MsgEnvelope
instance GHC.Base.Functor GHC.Types.Error.MsgEnvelope
instance Data.Traversable.Traversable GHC.Types.Error.Messages
instance Data.Foldable.Foldable GHC.Types.Error.Messages
instance GHC.Base.Functor GHC.Types.Error.Messages
instance GHC.Base.Monoid (GHC.Types.Error.Messages e)
instance GHC.Base.Semigroup (GHC.Types.Error.Messages e)
instance GHC.Types.Error.Diagnostic e => GHC.Utils.Outputable.Outputable (GHC.Types.Error.Messages e)
instance GHC.Show.Show (GHC.Types.Error.MsgEnvelope GHC.Types.Error.DiagnosticMessage)
instance GHC.Utils.Json.ToJson GHC.Types.Error.MessageClass
instance GHC.Utils.Outputable.Outputable GHC.Types.Error.Severity
instance GHC.Utils.Json.ToJson GHC.Types.Error.Severity
instance GHC.Types.Error.Diagnostic GHC.Types.Error.DiagnosticMessage
instance GHC.Utils.Outputable.Outputable GHC.Types.Error.DiagnosticReason
instance GHC.Utils.Outputable.Outputable GHC.Types.Error.DiagnosticHint
-- | Logger
--
-- The Logger is an configurable entity that is used by the compiler to
-- output messages on the console (stdout, stderr) and in dump files.
--
-- The behaviour of default Logger returned by initLogger can be
-- modified with hooks. The compiler itself uses hooks in multithreaded
-- code (--make) and it is also probably used by ghc-api users (IDEs,
-- etc.).
--
-- In addition to hooks, the Logger suppors LogFlags: basically a subset
-- of the command-line flags that control the logger behaviour at a
-- higher level than hooks.
--
--
-- - Hooks are used to define how to generate a
-- infowarningerror/dump messages
-- - LogFlags are used to decide when and how to generate messages
--
module GHC.Utils.Logger
data Logger
class HasLogger m
getLogger :: HasLogger m => m Logger
class ContainsLogger t
extractLogger :: ContainsLogger t => t -> Logger
initLogger :: IO Logger
type LogAction = LogFlags -> MessageClass -> SrcSpan -> SDoc -> IO ()
type DumpAction = LogFlags -> PprStyle -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
type TraceAction a = LogFlags -> String -> SDoc -> a -> a
-- | Format of a dump
--
-- Dump formats are loosely defined: dumps may contain various additional
-- headers and annotations and they may be partial. DumpFormat is
-- mainly a hint (e.g. for syntax highlighters).
data DumpFormat
-- | Haskell
FormatHaskell :: DumpFormat
-- | Core
FormatCore :: DumpFormat
-- | STG
FormatSTG :: DumpFormat
-- | ByteCode
FormatByteCode :: DumpFormat
-- | Cmm
FormatCMM :: DumpFormat
-- | Assembly code
FormatASM :: DumpFormat
-- | C code/header
FormatC :: DumpFormat
-- | LLVM bytecode
FormatLLVM :: DumpFormat
-- | Unstructured dump
FormatText :: DumpFormat
-- | Pop a log hook
popLogHook :: Logger -> Logger
-- | Push a log hook
pushLogHook :: (LogAction -> LogAction) -> Logger -> Logger
-- | Pop a dump hook
popDumpHook :: Logger -> Logger
-- | Push a dump hook
pushDumpHook :: (DumpAction -> DumpAction) -> Logger -> Logger
-- | Pop a trace hook
popTraceHook :: Logger -> Logger
-- | Push a trace hook
pushTraceHook :: (forall a. TraceAction a -> TraceAction a) -> Logger -> Logger
-- | Make the logger thread-safe
makeThreadSafe :: Logger -> IO Logger
-- | Logger flags
data LogFlags
LogFlags :: SDocContext -> SDocContext -> !EnumSet DumpFlag -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe FilePath -> !FilePath -> !Maybe FilePath -> !Bool -> !Int -> LogFlags
[log_default_user_context] :: LogFlags -> SDocContext
[log_default_dump_context] :: LogFlags -> SDocContext
-- | Dump flags
[log_dump_flags] :: LogFlags -> !EnumSet DumpFlag
-- | Show caret in diagnostics
[log_show_caret] :: LogFlags -> !Bool
-- | Show warning flag groups
[log_show_warn_groups] :: LogFlags -> !Bool
-- | Enable timestamps
[log_enable_timestamps] :: LogFlags -> !Bool
-- | Enable dump to file
[log_dump_to_file] :: LogFlags -> !Bool
-- | Dump directory
[log_dump_dir] :: LogFlags -> !Maybe FilePath
-- | Normal dump path ("basename.")
[log_dump_prefix] :: LogFlags -> !FilePath
-- | Overriden dump path
[log_dump_prefix_override] :: LogFlags -> !Maybe FilePath
-- | Enable debug output
[log_enable_debug] :: LogFlags -> !Bool
-- | Verbosity level
[log_verbosity] :: LogFlags -> !Int
-- | Default LogFlags
defaultLogFlags :: LogFlags
-- | Test if a DumpFlag is enabled
log_dopt :: DumpFlag -> LogFlags -> Bool
-- | Enable a DumpFlag
log_set_dopt :: DumpFlag -> LogFlags -> LogFlags
-- | Set LogFlags
setLogFlags :: Logger -> LogFlags -> Logger
-- | Update LogFlags
updateLogFlags :: Logger -> (LogFlags -> LogFlags) -> Logger
-- | Logger flags
logFlags :: Logger -> LogFlags
-- | Test if a DumpFlag is set
logHasDumpFlag :: Logger -> DumpFlag -> Bool
-- | Test if verbosity is >= to the given value
logVerbAtLeast :: Logger -> Int -> Bool
jsonLogAction :: LogAction
-- | Log something
putLogMsg :: Logger -> LogAction
defaultLogAction :: LogAction
-- | Like defaultLogActionHPutStrDoc but appends an extra newline.
defaultLogActionHPrintDoc :: LogFlags -> Bool -> Handle -> SDoc -> IO ()
-- | The boolean arguments let's the pretty printer know if it can optimize
-- indent by writing ascii ' ' characters without going through decoding.
defaultLogActionHPutStrDoc :: LogFlags -> Bool -> Handle -> SDoc -> IO ()
-- | Log something
logMsg :: Logger -> MessageClass -> SrcSpan -> SDoc -> IO ()
-- | Log a dump message (not a dump file)
logDumpMsg :: Logger -> String -> SDoc -> IO ()
-- | Default action for dumpAction hook
defaultDumpAction :: DumpCache -> LogAction -> DumpAction
-- | Dump something
putDumpFile :: Logger -> DumpAction
-- | Dump if the given DumpFlag is set
putDumpFileMaybe :: Logger -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
-- | Dump if the given DumpFlag is set
--
-- Unlike putDumpFileMaybe, has a PrintUnqualified argument
putDumpFileMaybe' :: Logger -> PrintUnqualified -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
-- | Run an action with the handle of a DumpFlag if we are
-- outputting to a file, otherwise Nothing.
withDumpFileHandle :: DumpCache -> LogFlags -> DumpFlag -> (Maybe Handle -> IO ()) -> IO ()
-- | Ensure that a dump file is created even if it stays empty
touchDumpFile :: Logger -> DumpFlag -> IO ()
-- | Dump something
logDumpFile :: Logger -> PprStyle -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
-- | Default action for traceAction hook
defaultTraceAction :: TraceAction a
-- | Trace something
putTraceMsg :: Logger -> TraceAction a
-- | Set the trace flushing function
--
-- The currently set trace flushing function is passed to the updating
-- function
loggerTraceFlushUpdate :: Logger -> (IO () -> IO ()) -> Logger
-- | Calls the trace flushing function
loggerTraceFlush :: Logger -> IO ()
-- | Log a trace message
logTraceMsg :: Logger -> String -> SDoc -> a -> a
instance GHC.Classes.Eq GHC.Utils.Logger.DumpFormat
instance GHC.Show.Show GHC.Utils.Logger.DumpFormat
module GHC.Core.Unfold
-- | 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 GHC.Core.Unfold
data Unfolding
-- | UnfoldingGuidance says when unfolding should take place
data UnfoldingGuidance
-- | Unfolding options
data UnfoldingOpts
UnfoldingOpts :: !Int -> !Int -> !Int -> !Int -> !Bool -> !Int -> !Int -> !Maybe String -> UnfoldingOpts
-- | Threshold above which unfoldings are not *created*
[unfoldingCreationThreshold] :: UnfoldingOpts -> !Int
-- | Threshold above which unfoldings are not *inlined*
[unfoldingUseThreshold] :: UnfoldingOpts -> !Int
-- | Discount for lambdas that are used (applied)
[unfoldingFunAppDiscount] :: UnfoldingOpts -> !Int
-- | Discount for dictionaries
[unfoldingDictDiscount] :: UnfoldingOpts -> !Int
-- | Force inlining in many more cases
[unfoldingVeryAggressive] :: UnfoldingOpts -> !Bool
-- | Don't consider depth up to x
[unfoldingCaseThreshold] :: UnfoldingOpts -> !Int
-- | Penalize depth with 1/x
[unfoldingCaseScaling] :: UnfoldingOpts -> !Int
-- | Only report inlining decisions for names with this prefix
[unfoldingReportPrefix] :: UnfoldingOpts -> !Maybe String
defaultUnfoldingOpts :: UnfoldingOpts
updateCreationThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts
updateUseThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts
updateFunAppDiscount :: Int -> UnfoldingOpts -> UnfoldingOpts
updateDictDiscount :: Int -> UnfoldingOpts -> UnfoldingOpts
updateVeryAggressive :: Bool -> UnfoldingOpts -> UnfoldingOpts
updateCaseScaling :: Int -> UnfoldingOpts -> UnfoldingOpts
updateCaseThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts
updateReportPrefix :: Maybe String -> UnfoldingOpts -> UnfoldingOpts
data ArgSummary
TrivArg :: ArgSummary
NonTrivArg :: ArgSummary
ValueArg :: ArgSummary
couldBeSmallEnoughToInline :: UnfoldingOpts -> Int -> CoreExpr -> Bool
inlineBoringOk :: CoreExpr -> Bool
smallEnoughToInline :: UnfoldingOpts -> Unfolding -> Bool
callSiteInline :: Logger -> UnfoldingOpts -> Int -> Id -> Bool -> Bool -> [ArgSummary] -> CallCtxt -> Maybe CoreExpr
data CallCtxt
BoringCtxt :: CallCtxt
RhsCtxt :: CallCtxt
DiscArgCtxt :: CallCtxt
RuleArgCtxt :: CallCtxt
ValAppCtxt :: CallCtxt
CaseCtxt :: CallCtxt
calcUnfoldingGuidance :: UnfoldingOpts -> Bool -> CoreExpr -> UnfoldingGuidance
instance GHC.Utils.Outputable.Outputable GHC.Core.Unfold.CallCtxt
instance GHC.Utils.Outputable.Outputable GHC.Core.Unfold.ArgSummary
instance GHC.Utils.Outputable.Outputable GHC.Core.Unfold.ExprSize
module GHC.Utils.Error
data Validity' a
-- | Everything is fine
IsValid :: Validity' a
-- | A problem, and some indication of why
NotValid :: a -> Validity' a
-- | Monomorphic version of Validity' specialised for
-- SDocs.
type Validity = Validity' SDoc
andValid :: Validity' a -> Validity' a -> Validity' a
-- | If they aren't all valid, return the first
allValid :: [Validity' a] -> Validity' a
getInvalids :: [Validity' a] -> [a]
orValid :: Validity' a -> Validity' a -> Validity' a
-- | Used to describe warnings and errors o The message has a
-- file/line/column heading, plus "warning:" or "error:", added by
-- mkLocMessage o With SevIgnore the message is suppressed o
-- Output is intended for end users
data Severity
-- | Ignore this message, for example in case of suppression of warnings
-- users don't want to see. See Note [Suppressing Messages]
SevIgnore :: Severity
SevWarning :: Severity
SevError :: Severity
-- | A class identifying a diagnostic. Dictionary.com defines a diagnostic
-- as:
--
-- "a message output by a computer diagnosing an error in a computer
-- program, computer system, or component device".
--
-- A Diagnostic carries the actual description of the
-- message (which, in GHC's case, it can be an error or a warning) and
-- the reason why such message was generated in the first place.
-- See also Note [Rendering Messages].
class Diagnostic a
diagnosticMessage :: Diagnostic a => a -> DecoratedSDoc
diagnosticReason :: Diagnostic a => a -> DiagnosticReason
diagnosticHints :: Diagnostic a => a -> [GhcHint]
-- | An envelope for GHC's facts about a running program, parameterised
-- over the domain-specific (i.e. parsing, typecheck-renaming,
-- etc) diagnostics.
--
-- To say things differently, GHC emits diagnostics about the
-- running program, each of which is wrapped into a MsgEnvelope
-- that carries specific information like where the error happened, etc.
-- Finally, multiple MsgEnvelopes are aggregated into
-- Messages that are returned to the user.
data MsgEnvelope e
MsgEnvelope :: SrcSpan -> PrintUnqualified -> e -> Severity -> MsgEnvelope e
-- | The SrcSpan is used for sorting errors into line-number order
[errMsgSpan] :: MsgEnvelope e -> SrcSpan
[errMsgContext] :: MsgEnvelope e -> PrintUnqualified
[errMsgDiagnostic] :: MsgEnvelope e -> e
[errMsgSeverity] :: MsgEnvelope e -> Severity
-- | The class for a diagnostic message. The main purpose is to classify a
-- message within GHC, to distinguish it from a debug/dump message vs a
-- proper diagnostic, for which we include a DiagnosticReason.
data MessageClass
MCOutput :: MessageClass
MCFatal :: MessageClass
MCInteractive :: MessageClass
-- | Log message intended for compiler developers No file/line/column stuff
MCDump :: MessageClass
-- | Log messages intended for end users. No file/line/column stuff.
MCInfo :: MessageClass
-- | Diagnostics from the compiler. This constructor is very powerful as it
-- allows the construction of a MessageClass with a completely
-- arbitrary permutation of Severity and DiagnosticReason.
-- As such, users are encouraged to use the mkMCDiagnostic smart
-- constructor instead. Use this constructor directly only if you need to
-- construct and manipulate diagnostic messages directly, for example
-- inside Error. In all the other circumstances, especially
-- when emitting compiler diagnostics, use the smart constructor.
MCDiagnostic :: Severity -> DiagnosticReason -> MessageClass
-- | Represents a pretty-printable document.
--
-- To display an SDoc, use printSDoc, printSDocLn,
-- bufLeftRenderSDoc, or renderWithContext. Avoid calling
-- runSDoc directly as it breaks the abstraction layer.
data SDoc
-- | A DecoratedSDoc is isomorphic to a '[SDoc]' but it carries the
-- invariant that the input '[SDoc]' needs to be rendered
-- decorated into its final form, where the typical case would be
-- adding bullets between each elements of the list. The type of
-- decoration depends on the formatting function used, but in practice
-- GHC uses the formatBulleted.
data DecoratedSDoc
-- | A collection of messages emitted by GHC during error reporting. A
-- diagnostic message is typically a warning or an error. See Note
-- [Messages].
--
-- INVARIANT: All the messages in this collection must be
-- relevant, i.e. their Severity should not be
-- SevIgnore. The smart constructor mkMessages will filter
-- out any message which Severity is SevIgnore.
data Messages e
mkMessages :: Bag (MsgEnvelope e) -> Messages e
-- | Joins two collections of messages together. See Note [Discarding
-- Messages].
unionMessages :: Messages e -> Messages e -> Messages e
-- | Are there any hard errors here? -Werror warnings are not
-- detected. If you want to check for -Werror warnings, use
-- errorsOrFatalWarningsFound.
errorsFound :: Diagnostic e => Messages e -> Bool
isEmptyMessages :: Messages e -> Bool
pprMessageBag :: Bag SDoc -> SDoc
pprMsgEnvelopeBagWithLoc :: Diagnostic e => Bag (MsgEnvelope e) -> [SDoc]
pprMessages :: Diagnostic e => Messages e -> SDoc
pprLocMsgEnvelope :: Diagnostic e => MsgEnvelope e -> SDoc
-- | Formats the input list of structured document, where each element of
-- the list gets a bullet.
formatBulleted :: SDocContext -> DecoratedSDoc -> SDoc
data DiagOpts
DiagOpts :: !EnumSet WarningFlag -> !EnumSet WarningFlag -> !Bool -> !Bool -> !Maybe Int -> !SDocContext -> DiagOpts
-- | Enabled warnings
[diag_warning_flags] :: DiagOpts -> !EnumSet WarningFlag
-- | Fatal warnings
[diag_fatal_warning_flags] :: DiagOpts -> !EnumSet WarningFlag
-- | Treat warnings as errors
[diag_warn_is_error] :: DiagOpts -> !Bool
-- | Reverse error reporting order
[diag_reverse_errors] :: DiagOpts -> !Bool
-- | Max reported error count
[diag_max_errors] :: DiagOpts -> !Maybe Int
-- | Error printing context
[diag_ppr_ctx] :: DiagOpts -> !SDocContext
diag_wopt :: WarningFlag -> DiagOpts -> Bool
diag_fatal_wopt :: WarningFlag -> DiagOpts -> Bool
emptyMessages :: Messages e
-- | Creates a new DecoratedSDoc out of a list of SDoc.
mkDecorated :: [SDoc] -> DecoratedSDoc
-- | Make an unannotated error message with location info.
mkLocMessage :: MessageClass -> SrcSpan -> SDoc -> SDoc
-- | Make a possibly annotated error message with location info.
mkLocMessageAnn :: Maybe String -> MessageClass -> SrcSpan -> SDoc -> SDoc
-- | Wrap a Diagnostic in a MsgEnvelope, recording its
-- location. If you know your Diagnostic is an error, consider
-- using mkErrorMsgEnvelope, which does not require looking at the
-- DiagOpts
mkMsgEnvelope :: Diagnostic e => DiagOpts -> SrcSpan -> PrintUnqualified -> e -> MsgEnvelope e
-- | Variant that doesn't care about qualified/unqualified names.
mkPlainMsgEnvelope :: Diagnostic e => DiagOpts -> SrcSpan -> e -> MsgEnvelope e
-- | Variant of mkPlainMsgEnvelope which can be used when we are
-- sure we are constructing a diagnostic with a
-- ErrorWithoutFlag reason.
mkPlainErrorMsgEnvelope :: Diagnostic e => SrcSpan -> e -> MsgEnvelope e
-- | Wrap a Diagnostic in a MsgEnvelope, recording its
-- location. Precondition: the diagnostic is, in fact, an error. That is,
-- diagnosticReason msg == ErrorWithoutFlag.
mkErrorMsgEnvelope :: Diagnostic e => SrcSpan -> PrintUnqualified -> e -> MsgEnvelope e
-- | Make a MessageClass for a given DiagnosticReason,
-- consulting the 'DiagOpts.
mkMCDiagnostic :: DiagOpts -> DiagnosticReason -> MessageClass
-- | Varation of mkMCDiagnostic which can be used when we are
-- sure the input DiagnosticReason is
-- ErrorWithoutFlag.
errorDiagnostic :: MessageClass
-- | Computes the right Severity for the input
-- DiagnosticReason out of the 'DiagOpts. This function has
-- to be called when a diagnostic is constructed, i.e. with a 'DiagOpts
-- "snapshot" taken as close as possible to where a particular diagnostic
-- message is built, otherwise the computed Severity might not be
-- correct, due to the mutable nature of the DynFlags in GHC.
diagReasonSeverity :: DiagOpts -> DiagnosticReason -> Severity
-- | Create an error DiagnosticMessage holding just a single
-- SDoc
mkPlainError :: [GhcHint] -> SDoc -> DiagnosticMessage
mkPlainDiagnostic :: DiagnosticReason -> [GhcHint] -> SDoc -> DiagnosticMessage
-- | Create an error DiagnosticMessage from a list of bulleted SDocs
mkDecoratedError :: [GhcHint] -> [SDoc] -> DiagnosticMessage
-- | Create a DiagnosticMessage from a list of bulleted SDocs and a
-- DiagnosticReason
mkDecoratedDiagnostic :: DiagnosticReason -> [GhcHint] -> [SDoc] -> DiagnosticMessage
-- | Helper function to use when no hints can be provided. Currently this
-- function can be used to construct plain DiagnosticMessage and
-- add hints to them, but once #18516 will be fully executed, the main
-- usage of this function would be in the implementation of the
-- diagnosticHints typeclass method, to report the fact that a
-- particular Diagnostic has no hints.
noHints :: [GhcHint]
getCaretDiagnostic :: MessageClass -> SrcSpan -> IO SDoc
putMsg :: Logger -> SDoc -> IO ()
printInfoForUser :: Logger -> PrintUnqualified -> SDoc -> IO ()
printOutputForUser :: Logger -> PrintUnqualified -> SDoc -> IO ()
logInfo :: Logger -> SDoc -> IO ()
-- | Like logInfo but with SevOutput rather then
-- SevInfo
logOutput :: Logger -> SDoc -> IO ()
errorMsg :: Logger -> SDoc -> IO ()
fatalErrorMsg :: Logger -> SDoc -> IO ()
compilationProgressMsg :: Logger -> SDoc -> IO ()
showPass :: Logger -> 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 PrintTimings 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.
--
-- See Note [withTiming] for more.
withTiming :: MonadIO m => Logger -> SDoc -> (a -> ()) -> m a -> m a
-- | Same as withTiming, but doesn't print timings in the console
-- (when given -vN, N >= 2 or
-- -ddump-timings).
--
-- See Note [withTiming] for more.
withTimingSilent :: MonadIO m => Logger -> SDoc -> (a -> ()) -> m a -> m a
debugTraceMsg :: Logger -> Int -> SDoc -> IO ()
ghcExit :: Logger -> Int -> IO ()
prettyPrintGhcErrors :: ExceptionMonad m => Logger -> m a -> m a
-- | Trace a command (when verbosity level >= 3)
traceCmd :: Logger -> String -> String -> IO a -> IO a
sortMsgBag :: Maybe DiagOpts -> Bag (MsgEnvelope e) -> [MsgEnvelope e]
instance GHC.Base.Functor GHC.Utils.Error.Validity'
instance GHC.Show.Show GHC.Utils.Error.PrintTimings
instance GHC.Classes.Eq GHC.Utils.Error.PrintTimings
-- | Temporary file-system management
module GHC.Utils.TmpFs
-- | Temporary file-system
data TmpFs
-- | Initialise an empty TmpFs
initTmpFs :: IO TmpFs
-- | Initialise an empty TmpFs sharing unique numbers and per-process
-- temporary directories with the given TmpFs
forkTmpFsFrom :: TmpFs -> IO TmpFs
-- | Merge the first TmpFs into the second.
--
-- The first TmpFs is returned emptied.
mergeTmpFsInto :: TmpFs -> TmpFs -> IO ()
-- | A collection of files that must be deleted before ghc exits.
data FilesToClean
FilesToClean :: !Set FilePath -> !Set FilePath -> FilesToClean
-- | Files that will be deleted at the end of runGhc(T)
[ftcGhcSession] :: FilesToClean -> !Set FilePath
-- | Files that will be deleted the next time
-- cleanCurrentModuleTempFiles is called, or otherwise at the end
-- of the session.
[ftcCurrentModule] :: FilesToClean -> !Set FilePath
-- | An empty FilesToClean
emptyFilesToClean :: FilesToClean
-- | Used when a temp file is created. This determines which component Set
-- of FilesToClean will get the temp file
data TempFileLifetime
-- | A file with lifetime TFL_CurrentModule will be cleaned up at the end
-- of upweep_mod
TFL_CurrentModule :: TempFileLifetime
-- | A file with lifetime TFL_GhcSession will be cleaned up at the end of
-- runGhc(T)
TFL_GhcSession :: TempFileLifetime
newtype TempDir
TempDir :: FilePath -> TempDir
cleanTempDirs :: Logger -> TmpFs -> IO ()
-- | Delete all files in tmp_files_to_clean.
cleanTempFiles :: Logger -> TmpFs -> IO ()
-- | Delete all files in tmp_files_to_clean. That have lifetime
-- TFL_CurrentModule. If a file must be cleaned eventually, but must
-- survive a cleanCurrentModuleTempFiles, ensure it has lifetime
-- TFL_GhcSession.
cleanCurrentModuleTempFiles :: Logger -> TmpFs -> IO ()
-- | Ensure that new_files are cleaned on the next call of
-- cleanTempFiles or cleanCurrentModuleTempFiles, depending
-- on lifetime. If any of new_files are already tracked, they will have
-- their lifetime updated.
addFilesToClean :: TmpFs -> TempFileLifetime -> [FilePath] -> IO ()
-- | Update the lifetime of files already being tracked. If any files are
-- not being tracked they will be discarded.
changeTempFilesLifetime :: TmpFs -> TempFileLifetime -> [FilePath] -> IO ()
newTempName :: Logger -> TmpFs -> TempDir -> TempFileLifetime -> Suffix -> IO FilePath
newTempLibName :: Logger -> TmpFs -> TempDir -> TempFileLifetime -> Suffix -> IO (FilePath, FilePath, String)
newTempDir :: Logger -> TmpFs -> TempDir -> IO FilePath
-- | Create and use a temporary directory in the system standard temporary
-- directory.
--
-- Behaves exactly the same as withTempDirectory, except that the
-- parent temporary directory will be that returned by
-- getTemporaryDirectory.
withSystemTempDirectory :: String -> (FilePath -> IO a) -> IO a
-- | Create and use a temporary directory.
--
-- Creates a new temporary directory inside the given directory, making
-- use of the template. The temp directory is deleted after use. For
-- example:
--
--
-- withTempDirectory "src" "sdist." $ \tmpDir -> do ...
--
--
-- The tmpDir will be a new subdirectory of the given directory,
-- e.g. src/sdist.342.
withTempDirectory :: FilePath -> String -> (FilePath -> IO a) -> IO a
instance GHC.Show.Show GHC.Utils.TmpFs.TempFileLifetime
-- | The stg to cmm code generator configuration
module GHC.StgToCmm.Config
data StgToCmmConfig
StgToCmmConfig :: !Profile -> Module -> !TempDir -> !SDocContext -> !Int -> !Maybe Word -> !Int -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> Maybe String -> !Bool -> !Bool -> !Bool -> StgToCmmConfig
-- | Current profile
[stgToCmmProfile] :: StgToCmmConfig -> !Profile
-- | The module being compiled. This field kept lazy for Cmm/Parser.y which
-- preloads it with a panic
[stgToCmmThisModule] :: StgToCmmConfig -> Module
-- | Temp Dir for files used in compilation
[stgToCmmTmpDir] :: StgToCmmConfig -> !TempDir
-- | Context for StgToCmm phase
[stgToCmmContext] :: StgToCmmConfig -> !SDocContext
-- | The verbosity of debug messages
[stgToCmmDebugLevel] :: StgToCmmConfig -> !Int
-- | Threshold at which Binary literals (e.g. strings) are either dumped to
-- a file and a CmmFileEmbed literal is emitted (over threshold), or
-- become a CmmString Literal (under or at threshold). CmmFileEmbed is
-- only supported with the NCG, thus a Just means two things: We have a
-- threshold, and will be using the NCG. Conversely, a Nothing implies we
-- are not using NCG and disables CmmFileEmbed. See Note [Embedding large
-- binary blobs] in GHC.CmmToAsm.Ppr, and cgTopBinding in
-- GHC.StgToCmm.
[stgToCmmBinBlobThresh] :: StgToCmmConfig -> !Maybe Word
-- | Max size, in bytes, of inline array allocations.
[stgToCmmMaxInlAllocSize] :: StgToCmmConfig -> !Int
-- | Ticky profiling enabled (cf -ticky)
[stgToCmmDoTicky] :: StgToCmmConfig -> !Bool
-- | True indicates ticky prof traces allocs of each named thing in
-- addition to allocs _by_ that thing
[stgToCmmTickyAllocd] :: StgToCmmConfig -> !Bool
-- | True indicates ticky uses name-specific counters for join-points
-- (let-no-escape)
[stgToCmmTickyLNE] :: StgToCmmConfig -> !Bool
-- | True indicates ticky uses name-specific counters for dynamic thunks
[stgToCmmTickyDynThunk] :: StgToCmmConfig -> !Bool
-- | True indicates ticky will count number of avoided tag checks by tag
-- inference.
[stgToCmmTickyTag] :: StgToCmmConfig -> !Bool
-- | Loopification enabled (cf -floopification)
[stgToCmmLoopification] :: StgToCmmConfig -> !Bool
-- | Insert alignment check (cf -falignment-sanitisation)
[stgToCmmAlignCheck] :: StgToCmmConfig -> !Bool
-- | perform code generation for code coverage
[stgToCmmOptHpc] :: StgToCmmConfig -> !Bool
[stgToCmmFastPAPCalls] :: StgToCmmConfig -> !Bool
-- | Check if cost-centre profiling is enabled
[stgToCmmSCCProfiling] :: StgToCmmConfig -> !Bool
[stgToCmmEagerBlackHole] :: StgToCmmConfig -> !Bool
-- | true means generate C Stub for IPE map, See note [Mapping Info Tables
-- to Source Positions]
[stgToCmmInfoTableMap] :: StgToCmmConfig -> !Bool
-- | true means omit heap checks when no allocation is performed
[stgToCmmOmitYields] :: StgToCmmConfig -> !Bool
-- | true means don't generate interface programs (implied by -O0)
[stgToCmmOmitIfPragmas] :: StgToCmmConfig -> !Bool
-- | true if -fPIC
[stgToCmmPIC] :: StgToCmmConfig -> !Bool
-- | true if -fPIE
[stgToCmmPIE] :: StgToCmmConfig -> !Bool
-- | true if -fexternal-dynamic-refs, meaning generate code for
-- linking against dynamic libraries
[stgToCmmExtDynRefs] :: StgToCmmConfig -> !Bool
-- | decides whether to check array bounds in StgToCmm.Prim or not
[stgToCmmDoBoundsCheck] :: StgToCmmConfig -> !Bool
-- | Verify tag inference predictions.
[stgToCmmDoTagCheck] :: StgToCmmConfig -> !Bool
-- | Allowed to emit larger than native size arithmetic (only LLVM and C
-- backends)
[stgToCmmAllowBigArith] :: StgToCmmConfig -> !Bool
-- | Allowed to generate QuotRem instructions
[stgToCmmAllowQuotRemInstr] :: StgToCmmConfig -> !Bool
-- | Allowed to generate QuotRem
[stgToCmmAllowQuotRem2] :: StgToCmmConfig -> !Bool
-- | Allowed to generate AddWordC, SubWordC, Add2, etc.
[stgToCmmAllowExtendedAddSubInstrs] :: StgToCmmConfig -> !Bool
-- | Allowed to generate IntMul2 instruction
[stgToCmmAllowIntMul2Instr] :: StgToCmmConfig -> !Bool
-- | Allowed to generate Fabs instructions
[stgToCmmAllowFabsInstrs] :: StgToCmmConfig -> !Bool
-- | Disable use of precomputed standard thunks.
[stgToCmmTickyAP] :: StgToCmmConfig -> !Bool
-- | Error (if any) to raise when vector instructions are used, see
-- StgToCmm.Prim.checkVecCompatibility
[stgToCmmVecInstrsErr] :: StgToCmmConfig -> Maybe String
-- | check for Advanced Vector Extensions
[stgToCmmAvx] :: StgToCmmConfig -> !Bool
-- | check for Advanced Vector Extensions 2
[stgToCmmAvx2] :: StgToCmmConfig -> !Bool
-- | check for Advanced Vector 512-bit Extensions
[stgToCmmAvx512f] :: StgToCmmConfig -> !Bool
stgToCmmPlatform :: StgToCmmConfig -> Platform
-- | The TPipelineClass and MonadUse classes and associated
-- types
module GHC.Driver.Pipeline.Monad
type TPipelineClass (f :: Type -> Type) (m :: Type -> Type) = (Functor m, MonadIO m, Applicative m, Monad m, MonadUse f m)
-- | Lift a f action into an m action.
class MonadUse f m
use :: MonadUse f m => f a -> m a
data PipeEnv
PipeEnv :: StopPhase -> String -> String -> String -> PipelineOutput -> PipeEnv
-- | Stop just after this phase
[stop_phase] :: PipeEnv -> StopPhase
-- | 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 PipelineOutput
-- | Output should be to a temporary file: we're going to run more
-- compilation steps on this output later.
Temporary :: TempFileLifetime -> 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
-- | No output should be created, like in Interpreter or NoBackend.
NoOutputFile :: PipelineOutput
instance GHC.Show.Show GHC.Driver.Pipeline.Monad.PipelineOutput
-- | Command-line parser
--
-- This is an abstract command-line parser used by DynFlags.
--
-- (c) The University of Glasgow 2005
module GHC.Driver.CmdLine
processArgs :: Monad m => [Flag m] -> [Located String] -> m ([Located String], [Err], [Warn])
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
WordSuffix :: (Word -> EwM m ()) -> OptKind m
FloatSuffix :: (Float -> EwM m ()) -> OptKind m
PassFlag :: (String -> EwM m ()) -> OptKind m
AnySuffix :: (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
-- | A command-line error message
newtype Err
Err :: Located String -> Err
[errMsg] :: Err -> Located String
-- | A command-line warning message and the reason it arose
data Warn
Warn :: DiagnosticReason -> Located String -> Warn
[warnReason] :: Warn -> DiagnosticReason
[warnMsg] :: Warn -> Located String
-- | Used when filtering warnings: if a reason is given it can be filtered
-- out when displaying.
data WarnReason
NoReason :: WarnReason
ReasonDeprecatedFlag :: WarnReason
ReasonUnrecognisedFlag :: WarnReason
data EwM m a
runEwM :: EwM m a -> m (Errs, Warns, a)
addErr :: Monad m => String -> EwM m ()
addWarn :: Monad m => String -> EwM m ()
addFlagWarn :: Monad m => DiagnosticReason -> String -> EwM m ()
getArg :: Monad m => EwM m String
getCurLoc :: Monad m => EwM m SrcSpan
liftEwM :: Monad m => m a -> EwM m a
instance GHC.Show.Show GHC.Driver.CmdLine.WarnReason
instance GHC.Classes.Eq GHC.Driver.CmdLine.WarnReason
instance GHC.Base.Functor (GHC.Driver.CmdLine.CmdLineP s)
instance GHC.Base.Applicative (GHC.Driver.CmdLine.CmdLineP s)
instance GHC.Base.Monad (GHC.Driver.CmdLine.CmdLineP s)
instance GHC.Base.Monad m => GHC.Base.Functor (GHC.Driver.CmdLine.EwM m)
instance GHC.Base.Monad m => GHC.Base.Applicative (GHC.Driver.CmdLine.EwM m)
instance GHC.Base.Monad m => GHC.Base.Monad (GHC.Driver.CmdLine.EwM m)
instance GHC.Utils.Outputable.Outputable GHC.Driver.CmdLine.WarnReason
instance GHC.Utils.Json.ToJson GHC.Driver.CmdLine.WarnReason
-- | 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 GHC.Driver.Session
-- | Debugging flags
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_by_proc :: 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
-- | Dump the cfg used for block layout.
Opt_D_dump_cfg_weights :: 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_c_backend :: 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_ds_preopt :: DumpFlag
Opt_D_dump_foreign :: DumpFlag
Opt_D_dump_inlinings :: DumpFlag
Opt_D_dump_verbose_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_simpl :: DumpFlag
Opt_D_dump_simpl_iterations :: DumpFlag
Opt_D_dump_spec :: DumpFlag
Opt_D_dump_prep :: DumpFlag
-- | Initial STG (CoreToStg output)
Opt_D_dump_stg_from_core :: DumpFlag
-- | STG after unarise
Opt_D_dump_stg_unarised :: DumpFlag
-- | STG (after stg2stg)
Opt_D_dump_stg_cg :: DumpFlag
-- | Result of tag inference analysis.
Opt_D_dump_stg_tags :: DumpFlag
-- | Final STG (before cmm gen)
Opt_D_dump_stg_final :: DumpFlag
Opt_D_dump_call_arity :: DumpFlag
Opt_D_dump_exitify :: DumpFlag
Opt_D_dump_stranal :: DumpFlag
Opt_D_dump_str_signatures :: DumpFlag
Opt_D_dump_cpranal :: DumpFlag
Opt_D_dump_cpr_signatures :: DumpFlag
Opt_D_dump_tc :: DumpFlag
Opt_D_dump_tc_ast :: DumpFlag
Opt_D_dump_hie :: 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_splices :: DumpFlag
Opt_D_th_dec_file :: DumpFlag
Opt_D_dump_BCOs :: 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_timings :: 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
Opt_D_dump_faststrings :: DumpFlag
Opt_D_faststring_stats :: DumpFlag
-- | Enumerates the simple on-or-off dynamic flags
data GeneralFlag
-- | Append dump output to files instead of stdout.
Opt_DumpToFile :: GeneralFlag
Opt_D_dump_minimal_imports :: GeneralFlag
Opt_DoCoreLinting :: GeneralFlag
Opt_DoLinearCoreLinting :: GeneralFlag
Opt_DoStgLinting :: GeneralFlag
Opt_DoCmmLinting :: GeneralFlag
Opt_DoAsmLinting :: GeneralFlag
Opt_DoAnnotationLinting :: GeneralFlag
Opt_DoBoundsChecking :: GeneralFlag
Opt_NoLlvmMangler :: GeneralFlag
Opt_FastLlvm :: GeneralFlag
Opt_NoTypeableBinds :: GeneralFlag
Opt_DistinctConstructorTables :: GeneralFlag
Opt_InfoTableMap :: 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_PrintAxiomIncomps :: GeneralFlag
Opt_PrintUnicodeSyntax :: GeneralFlag
Opt_PrintExpandedSynonyms :: GeneralFlag
Opt_PrintPotentialInstances :: GeneralFlag
Opt_PrintTypecheckerElaboration :: GeneralFlag
Opt_CallArity :: GeneralFlag
Opt_Exitification :: GeneralFlag
Opt_Strictness :: GeneralFlag
Opt_LateDmdAnal :: GeneralFlag
Opt_KillAbsence :: GeneralFlag
Opt_KillOneShot :: GeneralFlag
Opt_FullLaziness :: GeneralFlag
Opt_FloatIn :: GeneralFlag
Opt_LateSpecialise :: GeneralFlag
Opt_Specialise :: GeneralFlag
Opt_SpecialiseAggressively :: GeneralFlag
Opt_CrossModuleSpecialise :: GeneralFlag
Opt_InlineGenerics :: GeneralFlag
Opt_InlineGenericsAggressively :: GeneralFlag
Opt_StaticArgumentTransformation :: GeneralFlag
Opt_CSE :: GeneralFlag
Opt_StgCSE :: GeneralFlag
Opt_StgLiftLams :: 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_EnableThSpliceWarnings :: GeneralFlag
Opt_RegsGraph :: GeneralFlag
Opt_RegsIterative :: GeneralFlag
Opt_PedanticBottoms :: GeneralFlag
Opt_LlvmTBAA :: GeneralFlag
Opt_LlvmFillUndefWithGarbage :: GeneralFlag
Opt_IrrefutableTuples :: GeneralFlag
Opt_CmmSink :: GeneralFlag
Opt_CmmStaticPred :: GeneralFlag
Opt_CmmElimCommonBlocks :: GeneralFlag
Opt_CmmControlFlow :: GeneralFlag
Opt_AsmShortcutting :: GeneralFlag
Opt_OmitYields :: GeneralFlag
Opt_FunToThunk :: GeneralFlag
Opt_DictsStrict :: GeneralFlag
-- | deprecated, no effect and behaviour is now default. Allowed switching
-- of a special demand transformer for dictionary selectors
Opt_DmdTxDictSel :: GeneralFlag
Opt_Loopification :: GeneralFlag
-- | Use the cfg based block layout algorithm.
Opt_CfgBlocklayout :: GeneralFlag
-- | Layout based on last instruction per block.
Opt_WeightlessBlocklayout :: GeneralFlag
Opt_CprAnal :: GeneralFlag
Opt_WorkerWrapper :: GeneralFlag
-- | Do W/W split for unlifting even if we won't unbox anything.
Opt_WorkerWrapperUnlift :: GeneralFlag
Opt_SolveConstantDicts :: GeneralFlag
Opt_AlignmentSanitisation :: GeneralFlag
Opt_CatchNonexhaustiveCases :: GeneralFlag
Opt_NumConstantFolding :: GeneralFlag
Opt_CoreConstantFolding :: GeneralFlag
Opt_FastPAPCalls :: GeneralFlag
Opt_DoTagInferenceChecks :: GeneralFlag
Opt_SimplPreInlining :: GeneralFlag
Opt_IgnoreInterfacePragmas :: GeneralFlag
Opt_OmitInterfacePragmas :: GeneralFlag
Opt_ExposeAllUnfoldings :: GeneralFlag
Opt_WriteInterface :: GeneralFlag
Opt_WriteHie :: GeneralFlag
Opt_AutoSccsOnIndividualCafs :: GeneralFlag
Opt_ProfCountEntries :: GeneralFlag
Opt_ProfLateCcs :: GeneralFlag
Opt_Pp :: GeneralFlag
Opt_ForceRecomp :: GeneralFlag
Opt_IgnoreOptimChanges :: GeneralFlag
Opt_IgnoreHpcChanges :: GeneralFlag
Opt_ExcessPrecision :: GeneralFlag
Opt_EagerBlackHoling :: GeneralFlag
Opt_NoHsMain :: 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_GhciLeakCheck :: GeneralFlag
Opt_ValidateHie :: GeneralFlag
Opt_LocalGhciHistory :: GeneralFlag
Opt_NoIt :: 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_ExternalDynamicRefs :: GeneralFlag
Opt_Ticky :: GeneralFlag
Opt_Ticky_Allocd :: GeneralFlag
Opt_Ticky_LNE :: GeneralFlag
Opt_Ticky_Dyn_Thunk :: GeneralFlag
Opt_Ticky_Tag :: GeneralFlag
-- | Use regular thunks even when we could use std ap thunks in order to
-- get entry counts
Opt_Ticky_AP :: GeneralFlag
Opt_RPath :: GeneralFlag
Opt_RelativeDynlibPaths :: GeneralFlag
-- |
-- -fcompact-unwind
--
Opt_CompactUnwind :: GeneralFlag
Opt_Hpc :: GeneralFlag
Opt_FamAppCache :: GeneralFlag
Opt_ExternalInterpreter :: GeneralFlag
Opt_OptimalApplicativeDo :: GeneralFlag
Opt_VersionMacros :: GeneralFlag
Opt_WholeArchiveHsLibs :: GeneralFlag
Opt_SingleLibFolder :: GeneralFlag
Opt_ExposeInternalSymbols :: GeneralFlag
Opt_KeepCAFs :: GeneralFlag
Opt_KeepGoing :: GeneralFlag
Opt_ByteCode :: GeneralFlag
Opt_LinkRts :: GeneralFlag
Opt_ErrorSpans :: GeneralFlag
Opt_DeferDiagnostics :: GeneralFlag
Opt_DiagnosticsShowCaret :: GeneralFlag
Opt_PprCaseAsLet :: GeneralFlag
Opt_PprShowTicks :: GeneralFlag
Opt_ShowHoleConstraints :: GeneralFlag
Opt_ShowValidHoleFits :: GeneralFlag
Opt_SortValidHoleFits :: GeneralFlag
Opt_SortBySizeHoleFits :: GeneralFlag
Opt_SortBySubsumHoleFits :: GeneralFlag
Opt_AbstractRefHoleFits :: GeneralFlag
Opt_UnclutterValidHoleFits :: GeneralFlag
Opt_ShowTypeAppOfHoleFits :: GeneralFlag
Opt_ShowTypeAppVarsOfHoleFits :: GeneralFlag
Opt_ShowDocsOfHoleFits :: GeneralFlag
Opt_ShowTypeOfHoleFits :: GeneralFlag
Opt_ShowProvOfHoleFits :: GeneralFlag
Opt_ShowMatchesOfHoleFits :: GeneralFlag
Opt_ShowLoadedModules :: GeneralFlag
Opt_HexWordLiterals :: 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_SuppressStgExts :: GeneralFlag
Opt_SuppressTicks :: GeneralFlag
-- | Suppress timestamps in dumps
Opt_SuppressTimestamps :: GeneralFlag
-- | Suppress per binding Core size stats in dumps
Opt_SuppressCoreSizes :: GeneralFlag
Opt_AutoLinkPackages :: GeneralFlag
Opt_ImplicitImportQualified :: GeneralFlag
Opt_KeepHscppFiles :: 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_PluginTrustworthy :: 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_WarnUnusedRecordWildcards :: WarningFlag
Opt_WarnRedundantBangPatterns :: WarningFlag
Opt_WarnRedundantRecordWildcards :: WarningFlag
Opt_WarnWarningsDeprecations :: WarningFlag
Opt_WarnDeprecatedFlags :: 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_WarnMissedExtraSharedLib :: 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
Opt_WarnPartialFields :: WarningFlag
Opt_WarnMissingExportList :: WarningFlag
Opt_WarnInaccessibleCode :: WarningFlag
Opt_WarnStarIsType :: WarningFlag
Opt_WarnStarBinder :: WarningFlag
Opt_WarnImplicitKindVars :: WarningFlag
Opt_WarnSpaceAfterBang :: WarningFlag
Opt_WarnMissingDerivingStrategies :: WarningFlag
Opt_WarnPrepositiveQualifiedModule :: WarningFlag
Opt_WarnUnusedPackages :: WarningFlag
Opt_WarnInferredSafeImports :: WarningFlag
Opt_WarnMissingSafeHaskellMode :: WarningFlag
Opt_WarnCompatUnqualifiedImports :: WarningFlag
Opt_WarnDerivingDefaults :: WarningFlag
Opt_WarnInvalidHaddock :: WarningFlag
Opt_WarnOperatorWhitespaceExtConflict :: WarningFlag
Opt_WarnOperatorWhitespace :: WarningFlag
Opt_WarnAmbiguousFields :: WarningFlag
Opt_WarnImplicitLift :: WarningFlag
Opt_WarnMissingKindSignatures :: WarningFlag
Opt_WarnMissingExportedPatternSynonymSignatures :: WarningFlag
Opt_WarnRedundantStrictnessFlags :: WarningFlag
Opt_WarnForallIdentifier :: WarningFlag
Opt_WarnUnicodeBidirectionalFormatCharacters :: WarningFlag
Opt_WarnGADTMonoLocalBinds :: WarningFlag
Opt_WarnTypeEqualityOutOfScope :: WarningFlag
Opt_WarnTypeEqualityRequiresOperators :: WarningFlag
-- | The reason why a Diagnostic was emitted in the first
-- place. Diagnostic messages are born within GHC with a very precise
-- reason, which can be completely statically-computed (i.e. this is an
-- error or a warning no matter what), or influenced by the specific
-- state of the DynFlags at the moment of the creation of a new
-- Diagnostic. For example, a parsing error is always going
-- to be an error, whereas a 'WarningWithoutFlag Opt_WarnUnusedImports'
-- might turn into an error due to '-Werror' or
-- '-Werror=warn-unused-imports'. Interpreting a DiagnosticReason
-- together with its associated Severity gives us the full
-- picture.
data DiagnosticReason
-- | Born as a warning.
WarningWithoutFlag :: DiagnosticReason
-- | Warning was enabled with the flag.
WarningWithFlag :: !WarningFlag -> DiagnosticReason
-- | Born as an error.
ErrorWithoutFlag :: DiagnosticReason
data Language
Haskell98 :: Language
Haskell2010 :: Language
GHC2021 :: Language
type FatalMessager = String -> IO ()
newtype FlushOut
FlushOut :: IO () -> FlushOut
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]
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
--
-- Note that dynamicNow (i.e., dynamic objects built with
-- `-dynamic-too`) always implicitly enables Opt_PIC,
-- Opt_ExternalDynamicRefs, and disables Opt_SplitSections.
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
-- | Mark a WarningFlag as fatal (do not set the flag)
wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags
-- | Mark a WarningFlag as not fatal
wopt_unset_fatal :: DynFlags -> WarningFlag -> DynFlags
-- | 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
-- | Set or unset a Extension, unless it has been explicitly set or
-- unset before.
xopt_set_unlessExplSpec :: Extension -> (DynFlags -> Extension -> DynFlags) -> DynFlags -> DynFlags
xopt_DuplicateRecordFields :: DynFlags -> DuplicateRecordFields
xopt_FieldSelectors :: DynFlags -> FieldSelectors
lang_set :: DynFlags -> Maybe Language -> DynFlags
data DynamicTooState
-- | Don't try to build dynamic objects too
DT_Dont :: DynamicTooState
-- | Will still try to generate dynamic objects
DT_OK :: DynamicTooState
-- | Currently generating dynamic objects (in the backend)
DT_Dyn :: DynamicTooState
dynamicTooState :: DynFlags -> DynamicTooState
setDynamicNow :: DynFlags -> DynFlags
-- | Indicate if cost-centre profiling is enabled
sccProfilingEnabled :: DynFlags -> Bool
-- | Indicate whether we need to generate source notes
needSourceNotes :: DynFlags -> 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 -> !Backend -> {-# UNPACK #-} !GhcNameVersion -> {-# UNPACK #-} !FileSettings -> Platform -> {-# UNPACK #-} !ToolSettings -> {-# UNPACK #-} !PlatformMisc -> [(String, String)] -> TempDir -> LlvmConfig -> Int -> Int -> Int -> Int -> Int -> Maybe String -> [Int] -> Maybe Int -> Bool -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Int -> Int -> Int -> !Int -> Maybe Int -> Maybe Int -> Int -> Maybe Word -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Bool -> Maybe Int -> Int -> [FilePath] -> ModuleName -> Maybe String -> IntWithInf -> IntWithInf -> UnitId -> Maybe UnitId -> [(ModuleName, Module)] -> Maybe FilePath -> Maybe String -> Set ModuleName -> Set ModuleName -> Ways -> Maybe (String, Int) -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> String -> String -> String -> String -> String -> String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> DynLibLoader -> !Bool -> FilePath -> Maybe FilePath -> [Option] -> IncludeSpecs -> [String] -> [String] -> [String] -> Maybe String -> RtsOptsEnabled -> Bool -> String -> [ModuleName] -> [(ModuleName, String)] -> [String] -> FilePath -> Bool -> Bool -> [ModuleName] -> [String] -> [PackageDBFlag] -> [IgnorePackageFlag] -> [PackageFlag] -> [PackageFlag] -> [TrustFlag] -> Maybe FilePath -> EnumSet DumpFlag -> EnumSet GeneralFlag -> EnumSet WarningFlag -> EnumSet WarningFlag -> Maybe Language -> SafeHaskellMode -> Bool -> Bool -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> SrcSpan -> [OnOff Extension] -> EnumSet Extension -> !UnfoldingOpts -> Int -> Int -> FlushOut -> Maybe FilePath -> Maybe String -> [String] -> Int -> Int -> Bool -> OverridingBool -> Bool -> Scheme -> ProfAuto -> [CallerCcFilter] -> Maybe String -> Maybe SseVersion -> Maybe BmiVersion -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> IORef (Maybe LinkerInfo) -> IORef (Maybe CompilerInfo) -> IORef (Maybe CompilerInfo) -> Int -> Int -> Int -> Bool -> Maybe Int -> Word -> Int -> Weights -> DynFlags
[ghcMode] :: DynFlags -> GhcMode
[ghcLink] :: DynFlags -> GhcLink
-- | The backend to use (if any).
--
-- Whenever you change the backend, also make sure to set ghcLink
-- to something sensible.
--
-- NoBackend can be used to avoid generating any output, however,
-- note that:
--
--
-- - If a program uses Template Haskell the typechecker may need to run
-- code from an imported module. To facilitate this, code generation is
-- enabled for modules imported by modules that use template haskell,
-- using the default backend for the platform. See Note [-fno-code
-- mode].
--
[backend] :: DynFlags -> !Backend
[ghcNameVersion] :: DynFlags -> {-# UNPACK #-} !GhcNameVersion
[fileSettings] :: DynFlags -> {-# UNPACK #-} !FileSettings
[targetPlatform] :: DynFlags -> Platform
[toolSettings] :: DynFlags -> {-# UNPACK #-} !ToolSettings
[platformMisc] :: DynFlags -> {-# UNPACK #-} !PlatformMisc
[rawSettings] :: DynFlags -> [(String, String)]
[tmpDir] :: DynFlags -> TempDir
-- | N.B. It's important that this field is lazy since we load the LLVM
-- configuration lazily. See Note [LLVM configuration] in
-- GHC.SysTools.
[llvmConfig] :: DynFlags -> LlvmConfig
-- | LLVM optimisation level
[llvmOptLevel] :: DynFlags -> Int
-- | Verbosity level: see Note [Verbosity levels]
[verbosity] :: DynFlags -> Int
-- | How much debug information to produce
[debugLevel] :: DynFlags -> Int
-- | Number of simplifier phases
[simplPhases] :: DynFlags -> Int
-- | Max simplifier iterations
[maxSimplIterations] :: 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 hole fits to show in typed hole error messages
[maxValidHoleFits] :: DynFlags -> Maybe Int
-- | Maximum number of refinement hole fits to show in typed hole error
-- messages
[maxRefHoleFits] :: DynFlags -> Maybe Int
-- | Maximum level of refinement for refinement hole fits in typed hole
-- error messages
[refLevelHoleFits] :: DynFlags -> Maybe Int
-- | Maximum number of unmatched patterns to show in non-exhaustiveness
-- warnings
[maxUncoveredPatterns] :: DynFlags -> Int
-- | Soft limit on the number of models the pattern match checker checks a
-- pattern against. A safe guard against exponential blow-up.
[maxPmCheckModels] :: DynFlags -> Int
-- | Multiplier for simplifier ticks
[simplTickFactor] :: DynFlags -> Int
-- | Whether DmdAnal should optimistically put an Unboxed demand on
-- returned products with at most this number of fields
[dmdUnboxWidth] :: 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
-- | Binary literals (e.g. strings) whose size is above this threshold will
-- be dumped in a binary file by the assembler code generator. 0 and
-- Nothing disables this feature. See Config.
[binBlobThreshold] :: DynFlags -> Maybe Word
-- | Threshold for LiberateCase
[liberateCaseThreshold] :: DynFlags -> Maybe Int
-- | Arg count for lambda floating See FloatOutSwitches
[floatLamArgs] :: DynFlags -> Maybe Int
-- | Maximum number of arguments after lambda lifting a recursive function.
[liftLamsRecArgs] :: DynFlags -> Maybe Int
-- | Maximum number of arguments after lambda lifting a non-recursive
-- function.
[liftLamsNonRecArgs] :: DynFlags -> Maybe Int
-- | Lambda lift even when this turns a known call into an unknown call.
[liftLamsKnown] :: DynFlags -> Bool
-- | Align Cmm functions at this boundary or use default.
[cmmProcAlignment] :: DynFlags -> Maybe Int
-- | Simplification history size
[historySize] :: DynFlags -> Int
[importPaths] :: DynFlags -> [FilePath]
[mainModuleNameIs] :: DynFlags -> ModuleName
[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
-- | Target home unit-id
[homeUnitId_] :: DynFlags -> UnitId
-- | Id of the unit to instantiate
[homeUnitInstanceOf_] :: DynFlags -> Maybe UnitId
-- | Module instantiations
[homeUnitInstantiations_] :: DynFlags -> [(ModuleName, Module)]
[workingDirectory] :: DynFlags -> Maybe FilePath
-- | What the package is called, use with multiple home units
[thisPackageName] :: DynFlags -> Maybe String
[hiddenModules] :: DynFlags -> Set ModuleName
[reexportedModules] :: DynFlags -> Set ModuleName
-- | Target way flags from the command line
[targetWays_] :: DynFlags -> Ways
[splitInfo] :: DynFlags -> Maybe (String, Int)
[objectDir] :: DynFlags -> Maybe String
[dylibInstallName] :: DynFlags -> Maybe String
[hiDir] :: DynFlags -> Maybe String
[hieDir] :: DynFlags -> Maybe String
[stubDir] :: DynFlags -> Maybe String
[dumpDir] :: DynFlags -> Maybe String
[objectSuf_] :: DynFlags -> String
[hcSuf] :: DynFlags -> String
[hiSuf_] :: DynFlags -> String
[hieSuf] :: DynFlags -> String
[dynObjectSuf_] :: DynFlags -> String
[dynHiSuf_] :: DynFlags -> String
[outputFile_] :: DynFlags -> Maybe String
[dynOutputFile_] :: DynFlags -> Maybe String
[outputHi] :: DynFlags -> Maybe String
[dynOutputHi] :: DynFlags -> Maybe String
[dynLibLoader] :: DynFlags -> DynLibLoader
-- | Indicate if we are now generating dynamic output because of
-- -dynamic-too. This predicate is used to query the appropriate fields
-- (outputFile/dynOutputFile, ways, etc.)
[dynamicNow] :: DynFlags -> !Bool
-- | This defaults to 'non-module'. It can be set by setDumpPrefix
-- or 'ghc.GHCi.UI.runStmt' based on where its output is going.
[dumpPrefix] :: DynFlags -> FilePath
-- | Override the dumpPrefix set by setDumpPrefix or
-- 'ghc.GHCi.UI.runStmt'. Set by -ddump-file-prefix
[dumpPrefixForce] :: DynFlags -> Maybe FilePath
[ldInputs] :: DynFlags -> [Option]
[includePaths] :: DynFlags -> IncludeSpecs
[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
-- | the -fplugin flags given on the command line, in *reverse*
-- order that they're specified on the command line.
[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]
[depMakefile] :: DynFlags -> FilePath
[depIncludePkgDeps] :: DynFlags -> Bool
[depIncludeCppDeps] :: 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 getUnitDbRefs.
[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
[dumpFlags] :: DynFlags -> EnumSet DumpFlag
[generalFlags] :: DynFlags -> EnumSet GeneralFlag
[warningFlags] :: DynFlags -> EnumSet WarningFlag
[fatalWarningFlags] :: DynFlags -> EnumSet WarningFlag
[language] :: DynFlags -> Maybe Language
-- | Safe Haskell mode
[safeHaskell] :: DynFlags -> SafeHaskellMode
[safeInfer] :: DynFlags -> Bool
[safeInferred] :: DynFlags -> Bool
[thOnLoc] :: DynFlags -> SrcSpan
[newDerivOnLoc] :: DynFlags -> SrcSpan
[deriveViaOnLoc] :: 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 -> EnumSet Extension
-- | Unfolding control See Note [Discounts and thresholds] in
-- GHC.Core.Unfold
[unfoldingOpts] :: DynFlags -> !UnfoldingOpts
[maxWorkerArgs] :: DynFlags -> Int
[ghciHistSize] :: DynFlags -> Int
[flushOut] :: DynFlags -> FlushOut
[ghcVersionFile] :: DynFlags -> Maybe FilePath
[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
[callerCcFilters] :: DynFlags -> [CallerCcFilter]
[interactivePrint] :: DynFlags -> Maybe String
-- | Machine dependent flags (-m<blah> stuff)
[sseVersion] :: DynFlags -> Maybe SseVersion
[bmiVersion] :: DynFlags -> Maybe BmiVersion
[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 C compiler information
[rtccInfo] :: DynFlags -> IORef (Maybe CompilerInfo)
-- | Run-time assembler information
[rtasmInfo] :: 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 -> Word
[uniqueIncrement] :: DynFlags -> Int
-- | Temporary: CFG Edge weights for fast iterations
[cfgWeights] :: DynFlags -> Weights
outputFile :: DynFlags -> Maybe String
objectSuf :: DynFlags -> String
ways :: DynFlags -> Ways
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
RtsOptsIgnore :: RtsOptsEnabled
RtsOptsIgnoreAll :: RtsOptsEnabled
RtsOptsSafeOnly :: RtsOptsEnabled
RtsOptsAll :: RtsOptsEnabled
-- | 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
-- GHC.Unit.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 GHC.Unit.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
-- | Link objects into a merged "GHCi object"
LinkMergedObj :: 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 Unit
UnitIdArg :: Unit -> 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 :: PkgDbRef -> PackageDBFlag
NoUserPackageDB :: PackageDBFlag
NoGlobalPackageDB :: PackageDBFlag
ClearPackageDBs :: PackageDBFlag
data PkgDbRef
GlobalPkgDb :: PkgDbRef
UserPkgDb :: PkgDbRef
PkgDbPath :: FilePath -> PkgDbRef
-- | 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]
-- | 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])
-- | Are we building with -fPIE or -fPIC enabled?
positionIndependent :: DynFlags -> Bool
optimisationFlags :: EnumSet GeneralFlag
setFlagsFromEnvFile :: FilePath -> String -> DynP ()
-- | Pretty-print the difference between 2 DynFlags.
--
-- For now only their general flags but it could be extended. Useful
-- mostly for debugging.
pprDynFlagsDiff :: DynFlags -> DynFlags -> SDoc
-- | Find the FlagSpec for a WarningFlag.
flagSpecOf :: WarningFlag -> Maybe (FlagSpec WarningFlag)
-- | Get target profile
targetProfile :: DynFlags -> Profile
-- | Is Safe Haskell on in some way (including inference mode)
safeHaskellOn :: DynFlags -> Bool
safeHaskellModeEnabled :: 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 LlvmTarget
LlvmTarget :: String -> String -> [String] -> LlvmTarget
[lDataLayout] :: LlvmTarget -> String
[lCPU] :: LlvmTarget -> String
[lAttributes] :: LlvmTarget -> [String]
-- | See Note [LLVM configuration] in GHC.SysTools.
data LlvmConfig
LlvmConfig :: [(String, LlvmTarget)] -> [(Int, String)] -> LlvmConfig
[llvmTargets] :: LlvmConfig -> [(String, LlvmTarget)]
[llvmPasses] :: LlvmConfig -> [(Int, String)]
data Settings
Settings :: {-# UNPACK #-} !GhcNameVersion -> {-# UNPACK #-} !FileSettings -> Platform -> {-# UNPACK #-} !ToolSettings -> {-# UNPACK #-} !PlatformMisc -> [(String, String)] -> Settings
[sGhcNameVersion] :: Settings -> {-# UNPACK #-} !GhcNameVersion
[sFileSettings] :: Settings -> {-# UNPACK #-} !FileSettings
[sTargetPlatform] :: Settings -> Platform
[sToolSettings] :: Settings -> {-# UNPACK #-} !ToolSettings
[sPlatformMisc] :: Settings -> {-# UNPACK #-} !PlatformMisc
[sRawSettings] :: Settings -> [(String, String)]
sProgramName :: Settings -> String
sProjectVersion :: Settings -> String
sGhcUsagePath :: Settings -> FilePath
sGhciUsagePath :: Settings -> FilePath
sToolDir :: Settings -> Maybe FilePath
sTopDir :: Settings -> FilePath
sGlobalPackageDatabasePath :: 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
sPgm_a :: Settings -> (String, [Option])
sPgm_l :: Settings -> (String, [Option])
sPgm_lm :: Settings -> (String, [Option])
sPgm_dll :: Settings -> (String, [Option])
sPgm_T :: Settings -> String
sPgm_windres :: Settings -> String
sPgm_libtool :: Settings -> String
sPgm_ar :: Settings -> String
sPgm_ranlib :: Settings -> String
sPgm_lo :: Settings -> (String, [Option])
sPgm_lc :: Settings -> (String, [Option])
sPgm_lcc :: Settings -> (String, [Option])
sPgm_i :: Settings -> String
sOpt_L :: Settings -> [String]
sOpt_P :: Settings -> [String]
sOpt_P_fingerprint :: Settings -> Fingerprint
sOpt_F :: Settings -> [String]
sOpt_c :: Settings -> [String]
sOpt_cxx :: Settings -> [String]
sOpt_a :: Settings -> [String]
sOpt_l :: Settings -> [String]
sOpt_lm :: Settings -> [String]
sOpt_windres :: Settings -> [String]
sOpt_lo :: Settings -> [String]
sOpt_lc :: Settings -> [String]
sOpt_lcc :: Settings -> [String]
sOpt_i :: Settings -> [String]
sExtraGccViaCFlags :: Settings -> [String]
sTargetPlatformString :: Settings -> String
sGhcWithInterpreter :: Settings -> Bool
sLibFFI :: Settings -> Bool
-- | Settings for what GHC this is.
data GhcNameVersion
GhcNameVersion :: String -> String -> GhcNameVersion
[ghcNameVersion_programName] :: GhcNameVersion -> String
[ghcNameVersion_projectVersion] :: GhcNameVersion -> String
-- | Paths to various files and directories used by GHC, including those
-- that provide more settings.
data FileSettings
FileSettings :: FilePath -> FilePath -> Maybe FilePath -> FilePath -> FilePath -> FileSettings
[fileSettings_ghcUsagePath] :: FileSettings -> FilePath
[fileSettings_ghciUsagePath] :: FileSettings -> FilePath
[fileSettings_toolDir] :: FileSettings -> Maybe FilePath
[fileSettings_topDir] :: FileSettings -> FilePath
[fileSettings_globalPackageDatabase] :: FileSettings -> FilePath
-- | Platform-specific settings formerly hard-coded in Config.hs.
--
-- These should probably be all be triaged whether they can be computed
-- from other settings or belong in another another place (like
-- Platform above).
data PlatformMisc
PlatformMisc :: String -> Bool -> Bool -> String -> PlatformMisc
[platformMisc_targetPlatformString] :: PlatformMisc -> String
[platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool
[platformMisc_libFFI] :: PlatformMisc -> Bool
[platformMisc_llvmTarget] :: PlatformMisc -> String
-- | "unbuild" a Settings from a DynFlags. This shouldn't be
-- needed in the vast majority of code. But GHCi questionably uses this
-- to produce a default DynFlags from which to compute a flags
-- diff for printing.
settings :: DynFlags -> Settings
programName :: DynFlags -> String
projectVersion :: DynFlags -> String
ghcUsagePath :: DynFlags -> FilePath
ghciUsagePath :: DynFlags -> FilePath
topDir :: DynFlags -> FilePath
-- | The directory for this version of ghc in the user's app directory The
-- appdir used to be in ~/.ghc but to respect the XDG specification we
-- want to move it under $XDG_DATA_HOME/ However, old tooling (like
-- cabal) might still write package environments to the old directory, so
-- we prefer that if a subdirectory of ~/.ghc with the correct target and
-- GHC version suffix exists.
--
-- i.e. if ~.ghc$UNIQUE_SUBDIR exists we use that otherwise we use
-- $XDG_DATA_HOME/$UNIQUE_SUBDIR
--
-- UNIQUE_SUBDIR is typically a combination of the target platform and
-- GHC version
versionedAppDir :: String -> ArchOS -> MaybeT IO FilePath
versionedFilePath :: ArchOS -> FilePath
extraGccViaCFlags :: DynFlags -> [String]
globalPackageDatabasePath :: DynFlags -> FilePath
pgm_L :: DynFlags -> String
pgm_P :: DynFlags -> (String, [Option])
pgm_F :: DynFlags -> String
pgm_c :: DynFlags -> String
pgm_a :: DynFlags -> (String, [Option])
pgm_l :: DynFlags -> (String, [Option])
pgm_lm :: DynFlags -> (String, [Option])
pgm_dll :: DynFlags -> (String, [Option])
pgm_T :: DynFlags -> String
pgm_windres :: DynFlags -> String
pgm_libtool :: DynFlags -> String
pgm_ar :: DynFlags -> String
pgm_otool :: DynFlags -> String
pgm_install_name_tool :: DynFlags -> String
pgm_ranlib :: DynFlags -> String
pgm_lo :: DynFlags -> (String, [Option])
pgm_lc :: DynFlags -> (String, [Option])
pgm_lcc :: DynFlags -> (String, [Option])
pgm_i :: DynFlags -> String
opt_L :: DynFlags -> [String]
opt_P :: DynFlags -> [String]
opt_F :: DynFlags -> [String]
opt_c :: DynFlags -> [String]
opt_cxx :: DynFlags -> [String]
opt_a :: DynFlags -> [String]
opt_l :: DynFlags -> [String]
opt_lm :: DynFlags -> [String]
opt_i :: DynFlags -> [String]
opt_P_signature :: DynFlags -> ([String], Fingerprint)
opt_windres :: DynFlags -> [String]
opt_lo :: DynFlags -> [String]
opt_lc :: DynFlags -> [String]
opt_lcc :: DynFlags -> [String]
updatePlatformConstants :: DynFlags -> Maybe PlatformConstants -> IO DynFlags
addPluginModuleName :: String -> DynFlags -> DynFlags
-- | The normal DynFlags. Note that they are not suitable for use in
-- this form and must be fully initialized by runGhc first.
defaultDynFlags :: Settings -> LlvmConfig -> DynFlags
-- | Used by runGhc to partially initialize a new DynFlags
-- value
initDynFlags :: DynFlags -> IO DynFlags
defaultFatalMessager :: FatalMessager
defaultFlushOut :: FlushOut
setOutputFile :: Maybe String -> DynFlags -> DynFlags
setDynOutputFile :: Maybe String -> DynFlags -> DynFlags
setOutputHi :: Maybe String -> DynFlags -> DynFlags
setDynOutputHi :: Maybe String -> DynFlags -> DynFlags
augmentByWorkingDirectory :: DynFlags -> FilePath -> FilePath
-- | 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
type TurnOnFlag = Bool
turnOn :: TurnOnFlag
turnOff :: TurnOnFlag
impliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedOffGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedXFlags :: [(Extension, TurnOnFlag, Extension)]
-- | Parse dynamic flags from a list of command line arguments. Returns 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], [Warn])
-- | 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], [Warn])
-- | 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], [Warn])
-- | 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 :: ArchOS -> [String]
-- | The language extensions implied by the various language variants. When
-- updating this be sure to update the flag documentation in
-- docsusers_guideexts.
languageExtensions :: Maybe Language -> [Extension]
picCCOpts :: DynFlags -> [String]
picPOpts :: DynFlags -> [String]
pieCCLDOpts :: DynFlags -> [String]
compilerInfo :: DynFlags -> [(String, String)]
wordAlignment :: Platform -> Alignment
setUnsafeGlobalDynFlags :: DynFlags -> IO ()
isSse4_2Enabled :: DynFlags -> Bool
isBmiEnabled :: DynFlags -> Bool
isBmi2Enabled :: 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
LlvmLLD :: [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
-- | Should we use `-XLinker -rpath` when linking or not? See Note
-- [-fno-use-rpaths]
useXLinkerRPath :: DynFlags -> OS -> Bool
-- | Used to differentiate the scope an include needs to apply to. We have
-- to split the include paths to avoid accidentally forcing recursive
-- includes since -I overrides the system search paths. See #14312.
data IncludeSpecs
IncludeSpecs :: [String] -> [String] -> [String] -> IncludeSpecs
[includePathsQuote] :: IncludeSpecs -> [String]
[includePathsGlobal] :: IncludeSpecs -> [String]
-- | See Note [Implicit include paths]
[includePathsQuoteImplicit] :: IncludeSpecs -> [String]
-- | Append to the list of includes a path that shall be included using
-- `-I` when the C compiler is called. These paths override system search
-- paths.
addGlobalInclude :: IncludeSpecs -> [String] -> IncludeSpecs
-- | Append to the list of includes a path that shall be included using
-- `-iquote` when the C compiler is called. These paths only apply when
-- quoted includes are used. e.g. #include "foo.h"
addQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
-- | Concatenate and flatten the list of global and quoted includes
-- returning just a flat list of paths.
flattenIncludes :: IncludeSpecs -> [String]
-- | These includes are not considered while fingerprinting the flags for
-- iface | See Note [Implicit include paths]
addImplicitQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
-- | Initialize the pretty-printing options
initSDocContext :: DynFlags -> PprStyle -> SDocContext
-- | Initialize the pretty-printing options using the default user style
initDefaultSDocContext :: DynFlags -> SDocContext
instance GHC.Show.Show GHC.Driver.Session.IncludeSpecs
instance GHC.Enum.Enum GHC.Driver.Session.ProfAuto
instance GHC.Classes.Eq GHC.Driver.Session.ProfAuto
instance GHC.Classes.Eq GHC.Driver.Session.GhcMode
instance GHC.Show.Show GHC.Driver.Session.GhcLink
instance GHC.Classes.Eq GHC.Driver.Session.GhcLink
instance GHC.Show.Show GHC.Driver.Session.PackageArg
instance GHC.Classes.Eq GHC.Driver.Session.PackageArg
instance GHC.Classes.Eq GHC.Driver.Session.ModRenaming
instance GHC.Classes.Eq GHC.Driver.Session.IgnorePackageFlag
instance GHC.Classes.Eq GHC.Driver.Session.TrustFlag
instance GHC.Classes.Eq GHC.Driver.Session.PackageFlag
instance GHC.Classes.Eq GHC.Driver.Session.DynLibLoader
instance GHC.Show.Show GHC.Driver.Session.RtsOptsEnabled
instance GHC.Classes.Ord GHC.Driver.Session.DynamicTooState
instance GHC.Show.Show GHC.Driver.Session.DynamicTooState
instance GHC.Classes.Eq GHC.Driver.Session.DynamicTooState
instance GHC.Show.Show a => GHC.Show.Show (GHC.Driver.Session.OnOff a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (GHC.Driver.Session.OnOff a)
instance GHC.Classes.Ord GHC.Driver.Session.Deprecation
instance GHC.Classes.Eq GHC.Driver.Session.Deprecation
instance GHC.Classes.Eq GHC.Driver.Session.PkgDbRef
instance GHC.Classes.Eq GHC.Driver.Session.PackageDBFlag
instance GHC.Classes.Eq GHC.Driver.Session.LinkerInfo
instance GHC.Classes.Eq GHC.Driver.Session.CompilerInfo
instance (GHC.Base.Monoid a, GHC.Base.Monad m, GHC.Driver.Session.HasDynFlags m) => GHC.Driver.Session.HasDynFlags (Control.Monad.Trans.Writer.Lazy.WriterT a m)
instance (GHC.Base.Monad m, GHC.Driver.Session.HasDynFlags m) => GHC.Driver.Session.HasDynFlags (Control.Monad.Trans.Reader.ReaderT a m)
instance (GHC.Base.Monad m, GHC.Driver.Session.HasDynFlags m) => GHC.Driver.Session.HasDynFlags (Control.Monad.Trans.Maybe.MaybeT m)
instance (GHC.Base.Monad m, GHC.Driver.Session.HasDynFlags m) => GHC.Driver.Session.HasDynFlags (Control.Monad.Trans.Except.ExceptT e m)
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Driver.Session.OnOff a)
instance GHC.Utils.Outputable.Outputable GHC.Driver.Session.PackageFlag
instance GHC.Utils.Outputable.Outputable GHC.Driver.Session.ModRenaming
instance GHC.Utils.Outputable.Outputable GHC.Driver.Session.PackageArg
instance GHC.Utils.Outputable.Outputable GHC.Driver.Session.GhcMode
-- | Unit manipulation
module GHC.Unit.State
data UnitState
UnitState :: UnitInfoMap -> PreloadUnitClosure -> UniqFM PackageName UnitId -> Map UnitId UnitId -> Map UnitId UnitId -> [UnitId] -> [Unit] -> [UnitId] -> !ModuleNameProvidersMap -> !ModuleNameProvidersMap -> Map ModuleName [InstantiatedModule] -> !Bool -> UnitState
-- | A mapping of Unit to UnitInfo. This list is adjusted so
-- that only valid units are here. UnitInfo reflects what was
-- stored *on disk*, except for the trusted flag, which is
-- adjusted at runtime. (In particular, some units in this map may have
-- the exposed flag be False.)
[unitInfoMap] :: UnitState -> UnitInfoMap
-- | The set of transitively reachable units according to the explicitly
-- provided command line arguments. A fully instantiated VirtUnit may
-- only be replaced by a RealUnit from this set. See Note [VirtUnit to
-- RealUnit improvement]
[preloadClosure] :: UnitState -> PreloadUnitClosure
-- | A mapping of PackageName to UnitId. If several units
-- have the same package name (e.g. different instantiations), then we
-- return one of them... This is used when users refer to packages in
-- Backpack includes. And also to resolve package qualifiers with the
-- PackageImports extension.
[packageNameMap] :: UnitState -> UniqFM PackageName UnitId
-- | A mapping from database unit keys to wired in unit ids.
[wireMap] :: UnitState -> Map UnitId UnitId
-- | A mapping from wired in unit ids to unit keys from the database.
[unwireMap] :: UnitState -> Map UnitId UnitId
-- | The units we're going to link in eagerly. This list should be in
-- reverse dependency order; that is, a unit is always mentioned before
-- the units it depends on.
[preloadUnits] :: UnitState -> [UnitId]
-- | Units which we explicitly depend on (from a command line flag). We'll
-- use this to generate version macros.
[explicitUnits] :: UnitState -> [Unit]
[homeUnitDepends] :: UnitState -> [UnitId]
-- | This is a full map from ModuleName to all modules which may
-- possibly be providing it. These providers may be hidden (but we'll
-- still want to report them in error messages), or it may be an
-- ambiguous import.
[moduleNameProvidersMap] :: UnitState -> !ModuleNameProvidersMap
-- | A map, like moduleNameProvidersMap, but controlling plugin
-- visibility.
[pluginModuleNameProvidersMap] :: UnitState -> !ModuleNameProvidersMap
-- | A map saying, for each requirement, what interfaces must be merged
-- together when we use them. For example, if our dependencies are
-- p[A=<A>] and
-- q[A=<A>,B=r[C=<A>]:B], then the interfaces to
-- merge for A are p[A=<A>]:A,
-- q[A=<A>,B=r[C=<A>]:B]:A and
-- r[C=<A>]:C.
--
-- There's an entry in this map for each hole in our home library.
[requirementContext] :: UnitState -> Map ModuleName [InstantiatedModule]
-- | Indicate if we can instantiate units on-the-fly.
--
-- This should only be true when we are type-checking an indefinite unit.
-- See Note [About units] in GHC.Unit.
[allowVirtualUnits] :: UnitState -> !Bool
type PreloadUnitClosure = UniqSet UnitId
-- | Unit database
data UnitDatabase unit
UnitDatabase :: FilePath -> [GenUnitInfo unit] -> UnitDatabase unit
[unitDatabasePath] :: UnitDatabase unit -> FilePath
[unitDatabaseUnits] :: UnitDatabase unit -> [GenUnitInfo unit]
data UnitErr
CloseUnitErr :: !UnitId -> !Maybe UnitId -> UnitErr
PackageFlagErr :: !PackageFlag -> ![(UnitInfo, UnusableUnitReason)] -> UnitErr
TrustFlagErr :: !TrustFlag -> ![(UnitInfo, UnusableUnitReason)] -> UnitErr
emptyUnitState :: UnitState
-- | Read the unit database files, and sets up various internal tables of
-- unit information, according to the unit-related flags on the
-- command-line (-package, -hide-package etc.)
--
-- initUnits can be called again subsequently after updating the
-- packageFlags field of the DynFlags, and it will update
-- the unitState in DynFlags.
initUnits :: Logger -> DynFlags -> Maybe [UnitDatabase UnitId] -> Set UnitId -> IO ([UnitDatabase UnitId], UnitState, HomeUnit, Maybe PlatformConstants)
readUnitDatabases :: Logger -> UnitConfig -> IO [UnitDatabase UnitId]
readUnitDatabase :: Logger -> UnitConfig -> FilePath -> IO (UnitDatabase UnitId)
getUnitDbRefs :: UnitConfig -> IO [PkgDbRef]
-- | Return the path of a package database from a PkgDbRef. Return
-- Nothing when the user database filepath is expected but the
-- latter doesn't exist.
--
-- NB: This logic is reimplemented in Cabal, so if you change it, make
-- sure you update Cabal. (Or, better yet, dump it in the compiler info
-- so Cabal can use the info.)
resolveUnitDatabase :: UnitConfig -> PkgDbRef -> IO (Maybe FilePath)
-- | Get a list of entries from the unit database. NB: be careful with this
-- function, although all units in this map are "visible", this does not
-- imply that the exposed-modules of the unit are available (they may
-- have been thinned or renamed).
listUnitInfo :: UnitState -> [UnitInfo]
type UnitInfoMap = Map UnitId UnitInfo
-- | Find the unit we know about with the given unit, if any
lookupUnit :: UnitState -> Unit -> Maybe UnitInfo
-- | A more specialized interface, which doesn't require a UnitState
-- (so it can be used while we're initializing DynFlags)
--
-- Parameters: * a boolean specifying whether or not to look for
-- on-the-fly renamed interfaces * a UnitInfoMap * a
-- PreloadUnitClosure
lookupUnit' :: Bool -> UnitInfoMap -> PreloadUnitClosure -> Unit -> Maybe UnitInfo
-- | Looks up the given unit in the unit state, panicing if it is not found
unsafeLookupUnit :: HasDebugCallStack => UnitState -> Unit -> UnitInfo
-- | Find the unit we know about with the given unit id, if any
lookupUnitId :: UnitState -> UnitId -> Maybe UnitInfo
-- | Find the unit we know about with the given unit id, if any
lookupUnitId' :: UnitInfoMap -> UnitId -> Maybe UnitInfo
-- | Looks up the given unit id in the unit state, panicing if it is not
-- found
unsafeLookupUnitId :: HasDebugCallStack => UnitState -> UnitId -> UnitInfo
-- | Find the unit 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) This function is unsafe to use in general
-- because it doesn't respect package visibility.
lookupPackageName :: UnitState -> PackageName -> Maybe UnitId
-- | Find the UnitId which an import qualified by a package import comes
-- from. Compared to lookupPackageName, this function correctly
-- accounts for visibility, renaming and thinning.
resolvePackageImport :: UnitState -> ModuleName -> PackageName -> Maybe UnitId
-- | Given a fully instantiated InstantiatedUnit, improve it into a
-- RealUnit if we can find it in the package database.
improveUnit :: UnitState -> Unit -> Unit
-- | Search for units with a given package ID (e.g. "foo-0.1")
searchPackageId :: UnitState -> PackageId -> [UnitInfo]
listVisibleModuleNames :: UnitState -> [ModuleName]
-- | Takes a ModuleName, and if the module is in any package returns
-- list of modules which take that name.
lookupModuleInAllUnits :: UnitState -> ModuleName -> [(Module, UnitInfo)]
lookupModuleWithSuggestions :: UnitState -> ModuleName -> PkgQual -> LookupResult
-- | The package which the module **appears** to come from, this could be
-- the one which reexports the module from it's original package. This
-- function is currently only used for -Wunused-packages
lookupModulePackage :: UnitState -> ModuleName -> PkgQual -> Maybe [UnitInfo]
lookupPluginModuleWithSuggestions :: UnitState -> ModuleName -> PkgQual -> LookupResult
-- | Return this list of requirement interfaces that need to be merged to
-- form mod_name, or [] if this is not a requirement.
requirementMerges :: UnitState -> ModuleName -> [InstantiatedModule]
-- | The result of performing a lookup
data LookupResult
-- | Found the module uniquely, nothing else to do
LookupFound :: Module -> (UnitInfo, ModuleOrigin) -> 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
-- | No modules found, but there were some unusable ones with an exact name
-- match
LookupUnusable :: [(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
-- | 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 unavailable because the package is unusable.
ModUnusable :: UnusableUnitReason -> ModuleOrigin
-- | Module is public, and could have come from some places.
ModOrigin :: Maybe Bool -> [UnitInfo] -> [UnitInfo] -> 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.
[fromOrigUnit] :: ModuleOrigin -> Maybe Bool
-- | Is the module available from a reexport of an exposed package? There
-- could be multiple.
[fromExposedReexport] :: ModuleOrigin -> [UnitInfo]
-- | Is the module available from a reexport of a hidden package?
[fromHiddenReexport] :: ModuleOrigin -> [UnitInfo]
-- | Did the module export come from a package flag? (ToDo: track more
-- information.
[fromPackageFlag] :: ModuleOrigin -> Bool
-- | The reason why a unit is unusable.
data UnusableUnitReason
-- | We ignored it explicitly using -ignore-package.
IgnoredWithFlag :: UnusableUnitReason
-- | This unit transitively depends on a unit that was never present in any
-- of the provided databases.
BrokenDependencies :: [UnitId] -> UnusableUnitReason
-- | This unit transitively depends on a unit involved in a cycle. Note
-- that the list of UnitId reports the direct dependencies of this
-- unit that (transitively) depended on the cycle, and not the actual
-- cycle itself (which we report separately at high verbosity.)
CyclicDependencies :: [UnitId] -> UnusableUnitReason
-- | This unit transitively depends on a unit which was ignored.
IgnoredDependencies :: [UnitId] -> UnusableUnitReason
-- | This unit transitively depends on a unit which was shadowed by an
-- ABI-incompatible unit.
ShadowedDependencies :: [UnitId] -> UnusableUnitReason
pprReason :: SDoc -> UnusableUnitReason -> SDoc
-- | Takes a list of UnitIds (and their "parent" dependency, used for error
-- messages), and returns the list with dependencies included, in reverse
-- dependency order (a units appears before those it depends on).
closeUnitDeps :: UnitInfoMap -> [(UnitId, Maybe UnitId)] -> MaybeErr UnitErr [UnitId]
-- | Similar to closeUnitDeps but takes a list of already loaded units as
-- an additional argument.
closeUnitDeps' :: UnitInfoMap -> [UnitId] -> [(UnitId, Maybe UnitId)] -> MaybeErr UnitErr [UnitId]
mayThrowUnitErr :: MaybeErr UnitErr a -> IO a
-- | Substitution on module variables, mapping module names to module
-- identifiers.
type ShHoleSubst = ModuleNameEnv Module
-- | Substitutes holes in a Unit, suitable for renaming when an
-- include occurs; see Note [Representation of module/name variables].
--
-- p[A=<A>] maps to p[A=<B>] with
-- A=<B>.
renameHoleUnit :: UnitState -> ShHoleSubst -> Unit -> Unit
-- | Substitutes holes in a Module. NOT suitable for being called
-- directly on a nameModule, see Note [Representation of
-- module/name variables]. p[A=<A>]:B maps to
-- p[A=q():A]:B with A=q():A; similarly,
-- <A> maps to q():A.
renameHoleModule :: UnitState -> ShHoleSubst -> Module -> Module
-- | Like 'renameHoleUnit, but requires only ClosureUnitInfoMap so
-- it can be used by GHC.Unit.State.
renameHoleUnit' :: UnitInfoMap -> PreloadUnitClosure -> ShHoleSubst -> Unit -> Unit
-- | Like renameHoleModule, but requires only
-- ClosureUnitInfoMap so it can be used by
-- GHC.Unit.State.
renameHoleModule' :: UnitInfoMap -> PreloadUnitClosure -> ShHoleSubst -> Module -> Module
-- | Check the database to see if we already have an installed unit that
-- corresponds to the given InstantiatedUnit.
--
-- Return a UnitId which either wraps the InstantiatedUnit
-- unchanged or references a matching installed unit.
--
-- See Note [VirtUnit to RealUnit improvement]
instUnitToUnit :: UnitState -> InstantiatedUnit -> Unit
-- | Injects an InstantiatedModule to Module (see also
-- instUnitToUnit.
instModuleToModule :: UnitState -> InstantiatedModule -> Module
pprFlag :: PackageFlag -> SDoc
-- | Show (very verbose) package info
pprUnits :: UnitState -> SDoc
-- | Show simplified unit info.
--
-- The idea is to only print package id, and any information that might
-- be different from the package databases (exposure, trust)
pprUnitsSimple :: UnitState -> SDoc
-- | Pretty-print a UnitId for the user.
--
-- Cabal packages may contain several components (programs, libraries,
-- etc.). As far as GHC is concerned, installed package components
-- ("units") are identified by an opaque UnitId string provided by Cabal.
-- As the string contains a hash, we don't want to display it to users so
-- GHC queries the database to retrieve some infos about the original
-- source package (name, version, component name).
--
-- Instead we want to display: packagename-version[:componentname]
--
-- Component name is only displayed if it isn't the default library
--
-- To do this we need to query a unit database.
pprUnitIdForUser :: UnitState -> UnitId -> SDoc
pprUnitInfoForUser :: UnitInfo -> SDoc
-- | Show the mapping of modules to where they come from.
pprModuleMap :: ModuleNameProvidersMap -> SDoc
-- | Print unit-ids with UnitInfo found in the given UnitState
pprWithUnitState :: UnitState -> SDoc -> SDoc
-- | Given a wired-in Unit, "unwire" it into the Unit that it
-- was recorded as in the package database.
unwireUnit :: UnitState -> Unit -> Unit
-- | Add package dependencies on the wired-in packages we use
implicitPackageDeps :: DynFlags -> [UnitId]
instance GHC.Utils.Outputable.Outputable GHC.Unit.State.UnitErr
instance GHC.Utils.Outputable.Outputable GHC.Unit.State.ModuleOrigin
instance GHC.Base.Semigroup GHC.Unit.State.ModuleOrigin
instance GHC.Base.Monoid GHC.Unit.State.ModuleOrigin
instance GHC.Utils.Outputable.Outputable GHC.Unit.State.UnusableUnitReason
instance GHC.Utils.Outputable.Outputable u => GHC.Utils.Outputable.Outputable (GHC.Unit.State.UnitDatabase u)
instance GHC.Utils.Outputable.Outputable GHC.Unit.State.UnitVisibility
instance GHC.Base.Semigroup GHC.Unit.State.UnitVisibility
instance GHC.Base.Monoid GHC.Unit.State.UnitVisibility
-- | Dependencies and Usage of a module
module GHC.Unit.Module.Deps
-- | Dependency information about ALL modules and packages below this one
-- in the import hierarchy. This is the serialisable version of
-- ImportAvails.
--
-- Invariant: the dependencies of a module M never includes
-- M.
--
-- Invariant: none of the lists contain duplicates.
--
-- Invariant: lists are ordered canonically (e.g. using stableModuleCmp)
--
-- See Note [Transitive Information in Dependencies]
data Dependencies
-- | Extract information from the rename and typecheck phases to produce a
-- dependencies information for the module being compiled.
--
-- The fourth argument is a list of plugin modules.
mkDependencies :: HomeUnit -> Module -> ImportAvails -> [Module] -> Dependencies
noDependencies :: Dependencies
-- | All home-package modules which are directly imported by this one. This
-- may include modules from other units when using multiple home units
dep_direct_mods :: Dependencies -> Set (UnitId, ModuleNameWithIsBoot)
-- | All packages directly imported by this module I.e. packages to which
-- this module's direct imports belong. Does not include other home units
-- when using multiple home units. Modules from these units will go in
-- dep_direct_mods
dep_direct_pkgs :: Dependencies -> Set UnitId
-- | Transitive closure of hsig files in the home package
dep_sig_mods :: Dependencies -> [ModuleName]
dep_trusted_pkgs :: Dependencies -> Set UnitId
-- | 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]
-- | All units needed for plugins
dep_plugin_pkgs :: Dependencies -> Set UnitId
-- | 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]
-- | All modules which have boot files below this one, and whether we
-- should use the boot file or not. This information is only used to
-- populate the eps_is_boot field. See Note [Structure of dep_boot_mods]
dep_boot_mods :: Dependencies -> Set (UnitId, ModuleNameWithIsBoot)
-- | Update module dependencies containing orphans (used by Backpack)
dep_orphs_update :: Monad m => Dependencies -> ([Module] -> m [Module]) -> m Dependencies
-- | Update module dependencies containing family instances (used by
-- Backpack)
dep_finsts_update :: Monad m => Dependencies -> ([Module] -> m [Module]) -> m Dependencies
-- | Pretty-print unit dependencies
pprDeps :: UnitState -> Dependencies -> SDoc
-- | Records modules for which changes may force recompilation of this
-- module See wiki:
-- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/recompilation-avoidance
--
-- 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 ABI fingerprint (corresponds to mi_mod_hash)
[usg_mod_hash] :: Usage -> Fingerprint
-- | Was this module imported as a safe import
[usg_safe] :: Usage -> IsSafeImport
-- | Module from the current package
UsageHomeModule :: ModuleName -> Fingerprint -> [(OccName, Fingerprint)] -> Maybe Fingerprint -> IsSafeImport -> Usage
-- | Name of the module
[usg_mod_name] :: Usage -> ModuleName
-- | Cached module ABI fingerprint (corresponds to mi_mod_hash)
[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
-- | A file upon which the module depends, e.g. a CPP #include, or using
-- TH's addDependentFile
UsageFile :: FilePath -> Fingerprint -> Maybe String -> 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
-- | An optional string which is used in recompilation messages if file in
-- question has changed.
[usg_file_label] :: Usage -> Maybe String
UsageHomeModuleInterface :: ModuleName -> Fingerprint -> Usage
-- | Name of the module
[usg_mod_name] :: Usage -> ModuleName
-- | The *interface* hash of the module, not the ABI hash. This changes
-- when anything about the interface (and hence the module) has changed.
[usg_iface_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 ABI fingerprint (corresponds to mi_mod_hash)
[usg_mod_hash] :: Usage -> Fingerprint
-- | 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 -> InstalledModuleEnv ModuleNameWithIsBoot -> Set UnitId -> Bool -> Set UnitId -> InstalledModuleEnv ModuleNameWithIsBoot -> [ModuleName] -> [Module] -> [Module] -> ImportAvails
-- | Domain is all directly-imported modules
--
-- See the documentation on ImportedModsVal in
-- GHC.Unit.Module.Imported 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 directly imported by the module being compiled.
[imp_direct_dep_mods] :: ImportAvails -> InstalledModuleEnv ModuleNameWithIsBoot
-- | Packages directly needed by the module being compiled
[imp_dep_direct_pkgs] :: ImportAvails -> Set UnitId
-- | 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 [Trust Own Package]
-- in GHC.Rename.Names
[imp_trust_own_pkg] :: ImportAvails -> Bool
-- | This 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. See Note
-- [Tracking Trust Transitively] in GHC.Rename.Names
[imp_trust_pkgs] :: ImportAvails -> Set UnitId
-- | Domain is all modules which have hs-boot files, and whether we should
-- import the boot version of interface file. Only used in one-shot mode
-- to populate eps_is_boot.
[imp_boot_mods] :: ImportAvails -> InstalledModuleEnv ModuleNameWithIsBoot
-- | Signature modules below this one
[imp_sig_mods] :: ImportAvails -> [ModuleName]
-- | 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]
instance GHC.Classes.Eq GHC.Unit.Module.Deps.Dependencies
instance GHC.Classes.Eq GHC.Unit.Module.Deps.Usage
instance GHC.Utils.Binary.Binary GHC.Unit.Module.Deps.Usage
instance GHC.Utils.Binary.Binary GHC.Unit.Module.Deps.Dependencies
-- | Units are library components from Cabal packages compiled and
-- installed in a database
module GHC.Unit
module GHC.Unit.Finder.Types
data FinderCache
FinderCache :: IORef FinderCacheState -> IORef FileCacheState -> FinderCache
[fcModuleCache] :: FinderCache -> IORef FinderCacheState
[fcFileCache] :: FinderCache -> IORef FileCacheState
-- | 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 FinderCacheState = 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 unit was not found
NoPackage :: Unit -> FindResult
-- | _Error_: both in multiple packages
FoundMultiple :: [(Module, ModuleOrigin)] -> FindResult
-- | Not found
NotFound :: [FilePath] -> Maybe Unit -> [Unit] -> [Unit] -> [(Unit, UnusableUnitReason)] -> [ModuleSuggestion] -> FindResult
-- | Places where I looked
[fr_paths] :: FindResult -> [FilePath]
-- | Just p => module is in this unit's manifest, but couldn't find the
-- .hi file
[fr_pkg] :: FindResult -> Maybe Unit
-- | Module is in these units, but the *module* is hidden
[fr_mods_hidden] :: FindResult -> [Unit]
-- | Module is in these units, but the *unit* is hidden
[fr_pkgs_hidden] :: FindResult -> [Unit]
-- | Module is in these units, but it is unusable
[fr_unusables] :: FindResult -> [(Unit, UnusableUnitReason)]
-- | Possible mis-spelled modules
[fr_suggestions] :: FindResult -> [ModuleSuggestion]
data InstalledFindResult
InstalledFound :: ModLocation -> InstalledModule -> InstalledFindResult
InstalledNoPackage :: UnitId -> InstalledFindResult
InstalledNotFound :: [FilePath] -> Maybe UnitId -> InstalledFindResult
-- | Locations and information the finder cares about.
--
-- Should be taken from DynFlags via initFinderOpts.
data FinderOpts
FinderOpts :: [FilePath] -> Bool -> Bool -> Ways -> Bool -> Maybe FilePath -> Maybe FastString -> Set ModuleName -> Set ModuleName -> Maybe FilePath -> String -> Maybe FilePath -> String -> String -> Maybe FilePath -> String -> String -> Maybe FilePath -> FinderOpts
-- | Where are we allowed to look for Modules and Source files
[finder_importPaths] :: FinderOpts -> [FilePath]
-- | When looking up a home module:
--
--
-- - True: search interface files (e.g. in '-c' mode)
-- - False: search source files (e.g. in '--make' mode)
--
[finder_lookupHomeInterfaces] :: FinderOpts -> Bool
-- | Don't check that an imported interface file actually exists if it can
-- only be at one location. The interface will be reported as
-- InstalledFound even if the file doesn't exist, so this is only
-- useful in specific cases (e.g. to generate dependencies with `ghc -M`)
[finder_bypassHiFileCheck] :: FinderOpts -> Bool
[finder_ways] :: FinderOpts -> Ways
-- | If we encounter unknown modules, should we suggest modules that have a
-- similar name.
[finder_enableSuggestions] :: FinderOpts -> Bool
[finder_workingDirectory] :: FinderOpts -> Maybe FilePath
[finder_thisPackageName] :: FinderOpts -> Maybe FastString
[finder_hiddenModules] :: FinderOpts -> Set ModuleName
[finder_reexportedModules] :: FinderOpts -> Set ModuleName
[finder_hieDir] :: FinderOpts -> Maybe FilePath
[finder_hieSuf] :: FinderOpts -> String
[finder_hiDir] :: FinderOpts -> Maybe FilePath
[finder_hiSuf] :: FinderOpts -> String
[finder_dynHiSuf] :: FinderOpts -> String
[finder_objectDir] :: FinderOpts -> Maybe FilePath
[finder_objectSuf] :: FinderOpts -> String
[finder_dynObjectSuf] :: FinderOpts -> String
[finder_stubDir] :: FinderOpts -> Maybe FilePath
instance GHC.Show.Show GHC.Unit.Finder.Types.FinderOpts
module GHC.Types.Target
-- | 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).
--
-- These fields are strict because Targets are long lived.
data Target
Target :: !TargetId -> !Bool -> !UnitId -> !Maybe (InputFileBuffer, UTCTime) -> Target
-- | module or filename
[targetId] :: Target -> !TargetId
-- | object code allowed?
[targetAllowObjCode] :: Target -> !Bool
-- | id of the unit this target is part of
[targetUnitId] :: Target -> !UnitId
-- | Optional in-memory buffer containing the source code GHC should use
-- for this target instead of reading it from disk.
--
-- Since GHC version 8.10 modules which require preprocessors such as
-- Literate Haskell or CPP to run are also supported.
--
-- If a corresponding source file does not exist on disk this will result
-- in a SourceError exception if targetId = TargetModule
-- _ is used. However together with targetId = TargetFile _
-- GHC will not complain about the file missing.
[targetContents] :: Target -> !Maybe (InputFileBuffer, 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
type InputFileBuffer = StringBuffer
pprTarget :: Target -> SDoc
pprTargetId :: TargetId -> SDoc
instance GHC.Classes.Eq GHC.Types.Target.TargetId
instance GHC.Utils.Outputable.Outputable GHC.Types.Target.Target
instance GHC.Utils.Outputable.Outputable GHC.Types.Target.TargetId
module GHC.Linker.Types
newtype Loader
Loader :: MVar (Maybe LoaderState) -> Loader
[loader_state] :: Loader -> MVar (Maybe LoaderState)
data LoaderState
LoaderState :: ClosureEnv -> !ItblEnv -> !LinkableSet -> !LinkableSet -> !PkgsLoaded -> ![(FilePath, String)] -> LoaderState
-- | Current global mapping from Names to their true values
[closure_env] :: LoaderState -> ClosureEnv
-- | The current global mapping from RdrNames of DataCons to info table
-- addresses. When a new Unlinked is linked into the running image, or an
-- existing module in the image is replaced, the itbl_env must be updated
-- appropriately.
[itbl_env] :: LoaderState -> !ItblEnv
-- | The currently loaded interpreted modules (home package)
[bcos_loaded] :: LoaderState -> !LinkableSet
-- | And the currently-loaded compiled modules (home package)
[objs_loaded] :: LoaderState -> !LinkableSet
-- | The currently-loaded packages; always object code haskell libraries,
-- system libraries, transitive dependencies
[pkgs_loaded] :: LoaderState -> !PkgsLoaded
-- | We need to remember the name of previous temporary DLL/.so libraries
-- so we can link them (see #10322)
[temp_sos] :: LoaderState -> ![(FilePath, String)]
uninitializedLoader :: IO Loader
-- | 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.
[linkableUnlinked] :: Linkable -> [Unlinked]
type LinkableSet = ModuleEnv Linkable
mkLinkableSet :: [Linkable] -> LinkableSet
unionLinkableSet :: LinkableSet -> LinkableSet -> LinkableSet
-- | 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 [Grand plan for static forms] in
-- GHC.Iface.Tidy.StaticPtrTable.
BCOs :: CompiledByteCode -> [SptEntry] -> Unlinked
-- | An entry to be inserted into a module's static pointer table. See Note
-- [Grand plan for static forms] in GHC.Iface.Tidy.StaticPtrTable.
data SptEntry
SptEntry :: Id -> Fingerprint -> SptEntry
isObjectLinkable :: Linkable -> Bool
linkableObjs :: Linkable -> [FilePath]
-- | 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
nameOfObject_maybe :: Unlinked -> Maybe 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
data LibrarySpec
Objects :: [FilePath] -> LibrarySpec
Archive :: FilePath -> LibrarySpec
DLL :: String -> LibrarySpec
DLLPath :: FilePath -> LibrarySpec
Framework :: String -> LibrarySpec
data LoadedPkgInfo
LoadedPkgInfo :: !UnitId -> ![LibrarySpec] -> ![LibrarySpec] -> UniqDSet UnitId -> LoadedPkgInfo
[loaded_pkg_uid] :: LoadedPkgInfo -> !UnitId
[loaded_pkg_hs_objs] :: LoadedPkgInfo -> ![LibrarySpec]
[loaded_pkg_non_hs_objs] :: LoadedPkgInfo -> ![LibrarySpec]
[loaded_pkg_trans_deps] :: LoadedPkgInfo -> UniqDSet UnitId
type PkgsLoaded = UniqDFM UnitId LoadedPkgInfo
instance GHC.Utils.Outputable.Outputable GHC.Linker.Types.LoadedPkgInfo
instance GHC.Utils.Outputable.Outputable GHC.Linker.Types.LibrarySpec
instance GHC.Utils.Outputable.Outputable GHC.Linker.Types.Linkable
instance GHC.Utils.Outputable.Outputable GHC.Linker.Types.Unlinked
instance GHC.Utils.Outputable.Outputable GHC.Linker.Types.SptEntry
-- | Types used in the typechecker
--
-- This module provides the Type interface for front-end parts of the
-- compiler. These parts
--
--
-- - treat "source types" as opaque: newtypes, and predicates are
-- meaningful.
-- - look through usage types
--
module GHC.Tc.Utils.TcType
type TcType = Type
type TcSigmaType = TcType
-- | A TcSigmaTypeFRR is a TcSigmaType which has a fixed
-- RuntimeRep in the sense of Note [Fixed RuntimeRep] in
-- GHC.Tc.Utils.Concrete.
--
-- In particular, this means that:
--
--
--
-- This property is important in functions such as
-- matchExpectedFunTys, where we want to provide argument types
-- which have a known runtime representation. See Note [Return arguments
-- with a fixed RuntimeRep.
type TcSigmaTypeFRR = TcSigmaType
type TcRhoType = TcType
type TcTauType = TcType
type TcPredType = PredType
type TcThetaType = ThetaType
-- | Type variable that might be a metavariable
type TcTyVar = Var
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 TcInvisTVBinder = InvisTVBinder
type TcReqTVBinder = ReqTVBinder
type TcTyCon = TyCon
type MonoTcTyCon = TcTyCon
type PolyTcTyCon = TcTyCon
type TcTyConBinder = TyConBinder
-- | A type labeled KnotTied might have knot-tied tycons in it. See
-- Note [Type checking recursive type and class declarations] in
-- GHC.Tc.TyCl
type KnotTied ty = ty
-- | An expected type to check against during type-checking. See Note
-- [ExpType] in GHC.Tc.Utils.TcMType, where you'll also find
-- manipulators.
data ExpType
Check :: TcType -> ExpType
Infer :: !InferResult -> ExpType
data InferResult
IR :: Unique -> TcLevel -> IORef (Maybe TcType) -> InferResult
[ir_uniq] :: InferResult -> Unique
[ir_lvl] :: InferResult -> TcLevel
[ir_ref] :: InferResult -> IORef (Maybe TcType)
type ExpSigmaType = ExpType
-- | Like TcSigmaTypeFRR, but for an expected type.
type ExpSigmaTypeFRR = 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.
--
-- You'll also get three multiplicities back: one for each function
-- arrow. See also Note [Linear types] in Multiplicity.
--
-- This is defined here to avoid defining it in GHC.Tc.Gen.Expr
-- boot file.
data SyntaxOpType
-- | Any type
SynAny :: SyntaxOpType
-- | A rho type, 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
infixr 0 `SynFun`
-- | 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
deeperThanOrSame :: TcLevel -> TcLevel -> Bool
sameDepthAs :: TcLevel -> TcLevel -> Bool
tcTypeLevel :: TcType -> TcLevel
tcTyVarLevel :: TcTyVar -> TcLevel
maxTcLevel :: TcLevel -> TcLevel -> TcLevel
data TcTyVarDetails
SkolemTv :: SkolemInfo -> TcLevel -> Bool -> 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
vanillaSkolemTvUnk :: HasCallStack => TcTyVarDetails
data MetaDetails
Flexi :: MetaDetails
Indirect :: TcType -> MetaDetails
data MetaInfo
-- | This MetaTv is an ordinary unification variable A TauTv is always
-- filled in with a tau-type, which never contains any ForAlls.
TauTv :: MetaInfo
-- | A variant of TauTv, except that it should not be unified with a type,
-- only with a type variable See Note [TyVarTv] in GHC.Tc.Utils.TcMType
TyVarTv :: MetaInfo
-- | A unification variable used in the GHCi debugger. It is allowed
-- to unify with a polytype, unlike TauTv
RuntimeUnkTv :: MetaInfo
CycleBreakerTv :: MetaInfo
-- | A unification variable that can only be unified with a concrete type,
-- in the sense of Note [Concrete types] in GHC.Tc.Utils.Concrete. See
-- Note [ConcreteTv] in GHC.Tc.Utils.Concrete.
ConcreteTv :: MetaInfo
skolemSkolInfo :: TcTyVar -> SkolemInfo
isImmutableTyVar :: TyVar -> Bool
isSkolemTyVar :: TcTyVar -> Bool
isMetaTyVar :: TcTyVar -> Bool
isMetaTyVarTy :: TcType -> Bool
isTyVarTy :: Type -> Bool
tcIsTcTyVar :: TcTyVar -> Bool
isTyVarTyVar :: Var -> Bool
isOverlappableTyVar :: TcTyVar -> Bool
isTyConableTyVar :: TcTyVar -> Bool
-- | Is this type variable a concrete type variable, i.e. it is a
-- metavariable with ConcreteTv MetaInfo?
--
-- Works with both TyVar and TcTyVar.
isConcreteTyVar :: TcTyVar -> Bool
isAmbiguousTyVar :: TcTyVar -> Bool
isCycleBreakerTyVar :: 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
isPromotableMetaTyVar :: TcTyVar -> Bool
findDupTyVarTvs :: [(Name, TcTyVar)] -> [(Name, Name)]
mkTyVarNamePairs :: [TyVar] -> [(Name, TyVar)]
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 :: [TyCoVar] -> [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 :: [TyCoVarBinder] -> [PredType] -> Type -> Type
mkTcAppTy :: Type -> Type -> Type
mkTcAppTys :: Type -> [Type] -> Type
mkTcCastTy :: 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
tcSplitForAllTyVarBinder_maybe :: Type -> Maybe (TyVarBinder, Type)
-- | Like tcSplitPiTys, but splits off only named binders, returning
-- just the tyvars.
tcSplitForAllTyVars :: Type -> ([TyVar], Type)
-- | Like tcSplitForAllTyVars, but only splits ForAllTys with
-- Invisible type variable binders.
tcSplitForAllInvisTyVars :: Type -> ([TyVar], Type)
-- | Like tcSplitForAllTyVars, but only splits a ForAllTy if
-- argf_pred argf is True, where argf is the
-- visibility of the ForAllTy's binder and argf_pred is
-- a predicate over visibilities provided as an argument to this
-- function.
tcSplitSomeForAllTyVars :: (ArgFlag -> Bool) -> Type -> ([TyVar], Type)
-- | Like tcSplitForAllTyVars, but only splits ForAllTys with
-- Required type variable binders. All split tyvars are annotated
-- with ().
tcSplitForAllReqTVBinders :: Type -> ([TcReqTVBinder], Type)
-- | Like tcSplitForAllTyVars, but only splits ForAllTys with
-- Invisible type variable binders. All split tyvars are annotated
-- with their Specificity.
tcSplitForAllInvisTVBinders :: Type -> ([TcInvisTVBinder], 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)
-- | Splits a type into a TyBinder and a body, if possible. Panics
-- otherwise
tcSplitPiTy_maybe :: Type -> Maybe (TyBinder, Type)
-- | Like tcSplitForAllTyVars, but splits off only named binders.
tcSplitForAllTyVarBinders :: Type -> ([TyVarBinder], Type)
tcSplitPhiTy :: Type -> (ThetaType, Type)
tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type)
tcSplitFunTy_maybe :: Type -> Maybe (Scaled Type, Type)
tcSplitFunTys :: Type -> ([Scaled Type], Type)
tcFunArgTy :: Type -> Scaled 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 ([Scaled 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.
--
-- This does *not* split types headed with (=>), as that's not a TyCon
-- in the type-checker.
--
-- If you only need the TyCon, consider using
-- tcTyConAppTyCon_maybe.
tcSplitTyConApp_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)
-- | Returns the number of arguments in the given type, without looking
-- through synonyms. This is used only for error reporting. We don't look
-- through synonyms because of #11313.
tcRepGetNumAppTys :: Type -> Arity
-- | If the type is a tyvar, possibly under a cast, returns it, along with
-- the coercion. Thus, the co is :: kind tv ~N kind type
tcGetCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN)
tcGetTyVar_maybe :: Type -> Maybe TyVar
tcGetTyVar :: String -> Type -> TyVar
-- | Split a sigma type into its parts. This only splits invisible
-- type variable binders, as these are the only forms of binder that the
-- typechecker will implicitly instantiate.
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)
-- | Type equality on source types. Does not look through
-- newtypes, PredTypes or type families, 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
-- GHC.Core.TyCo.Rep.
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 implements typechecker equality, as described in Note
-- [Typechecker equality vs definitional equality].
tcEqType :: HasDebugCallStack => TcType -> TcType -> Bool
tcEqKind :: HasDebugCallStack => 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 True if the visible part of
-- the types are equal, even if they are really unequal (in the invisible
-- bits)
tcEqTypeVis :: TcType -> TcType -> Bool
-- | Check whether two TyConApps are the same; if the number of arguments
-- are different, just checks the common prefix of arguments.
tcEqTyConApps :: TyCon -> [Type] -> TyCon -> [Type] -> Bool
isSigmaTy :: TcType -> Bool
isRhoTy :: TcType -> Bool
-- | Like isRhoTy, but also says True for Infer types
isRhoExpTy :: ExpType -> Bool
isOverloadedTy :: Type -> Bool
-- | Is the type inhabited by machine floating-point numbers?
--
-- Used to check that we don't use floating-point literal patterns in
-- Core.
--
-- See #9238 and Note [Rules for floating-point comparisons] in
-- GHC.Core.Opt.ConstantFold.
isFloatingPrimTy :: Type -> Bool
isDoubleTy :: Type -> Bool
isFloatTy :: Type -> Bool
isIntTy :: Type -> Bool
isWordTy :: Type -> Bool
-- | Is a type String?
isStringTy :: Type -> Bool
isIntegerTy :: Type -> Bool
isNaturalTy :: Type -> Bool
isBoolTy :: Type -> Bool
isUnitTy :: Type -> Bool
isCharTy :: Type -> Bool
isTauTy :: Type -> Bool
isTauTyCon :: TyCon -> Bool
tcIsTyVarTy :: Type -> Bool
-- | Is this a ForAllTy with a named binder?
tcIsForAllTy :: Type -> Bool
isPredTy :: HasDebugCallStack => Type -> Bool
isTyVarClassPred :: PredType -> Bool
checkValidClsArgs :: Bool -> Class -> [KindOrType] -> Bool
hasTyVarHead :: Type -> Bool
isRigidTy :: TcType -> Bool
deNoteType :: Type -> Type
orphNamesOfType :: Type -> NameSet
orphNamesOfCo :: Coercion -> NameSet
orphNamesOfTypes :: [Type] -> NameSet
orphNamesOfCoCon :: CoAxiom br -> NameSet
getDFunTyKey :: Type -> OccName
evVarPred :: EvVar -> PredType
-- | Returns the (kind, type) variables in a type that are as-yet-unknown:
-- metavariables and RuntimeUnks
ambigTkvsOfTy :: TcType -> ([Var], [Var])
mkMinimalBySCs :: forall a. (a -> PredType) -> [a] -> [a]
transSuperClasses :: PredType -> [PredType]
pickCapturedPreds :: TyVarSet -> TcThetaType -> TcThetaType
immSuperClasses :: Class -> [Type] -> [PredType]
boxEqPred :: EqRel -> Type -> Type -> Maybe (Class, [Type])
isImprovementPred :: PredType -> Bool
-- | Finds outermost type-family applications occurring 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 #11581). E.g. type instance G [Int] = ...(F Int <big
-- type>)... we don't need to take <big type> into account when
-- asking if the calls on the RHS are smaller than the LHS
tcTyFamInsts :: Type -> [(TyCon, [Type])]
-- | Like tcTyFamInsts, except that the output records whether the
-- type family and its arguments occur as an invisible argument in
-- some type application. This information is useful because it helps GHC
-- know when to turn on -fprint-explicit-kinds during error
-- reporting so that users can actually see the type family being
-- mentioned.
--
-- As an example, consider:
--
--
-- class C a
-- data T (a :: k)
-- type family F a :: k
-- instance C (T @(F Int) (F Bool))
--
--
-- There are two occurrences of the type family F in that
-- C instance, so tcTyFamInstsAndVis (C (T @(F Int)
-- (F Bool))) will return:
--
--
-- [ (True, F, [Int])
-- , (False, F, [Bool]) ]
--
--
-- F Int is paired with True since it appears as an
-- invisible argument to C, whereas F Bool is
-- paired with False since it appears an a visible argument
-- to C.
--
-- See also Note [Kind arguments in error messages] in
-- GHC.Tc.Errors.
tcTyFamInstsAndVis :: Type -> [(Bool, TyCon, [Type])]
-- | In an application of a TyCon to some arguments, find the
-- outermost occurrences of type family applications within the
-- arguments. This function will not consider the TyCon itself
-- when checking for type family applications.
--
-- See tcTyFamInstsAndVis for more details on how this works (as
-- this function is called inside of tcTyFamInstsAndVis).
tcTyConAppTyFamInstsAndVis :: TyCon -> [Type] -> [(Bool, TyCon, [Type])]
-- | Check that a type does not contain any type family applications.
isTyFamFree :: Type -> Bool
exactTyCoVarsOfType :: Type -> TyCoVarSet
exactTyCoVarsOfTypes :: [Type] -> TyCoVarSet
anyRewritableTyVar :: EqRel -> (EqRel -> TcTyVar -> Bool) -> TcType -> Bool
anyRewritableTyFamApp :: EqRel -> (EqRel -> TyCon -> [TcType] -> Bool) -> TcType -> Bool
-- | Reason why a type in an FFI signature is invalid
data IllegalForeignTypeReason
TypeCannotBeMarshaled :: !Type -> TypeCannotBeMarshaledReason -> IllegalForeignTypeReason
ForeignDynNotPtr :: !Type -> !Type -> IllegalForeignTypeReason
SafeHaskellMustBeInIO :: IllegalForeignTypeReason
IOResultExpected :: IllegalForeignTypeReason
UnexpectedNestedForall :: IllegalForeignTypeReason
LinearTypesNotAllowed :: IllegalForeignTypeReason
OneArgExpected :: IllegalForeignTypeReason
AtLeastOneArgExpected :: IllegalForeignTypeReason
-- | Reason why a type cannot be marshalled through the FFI.
data TypeCannotBeMarshaledReason
NotADataType :: TypeCannotBeMarshaledReason
NewtypeDataConNotInScope :: !Maybe TyCon -> TypeCannotBeMarshaledReason
UnliftedFFITypesNeeded :: TypeCannotBeMarshaledReason
NotABoxedMarshalableTyCon :: TypeCannotBeMarshaledReason
ForeignLabelNotAPtr :: TypeCannotBeMarshaledReason
NotSimpleUnliftedType :: TypeCannotBeMarshaledReason
isFFIArgumentTy :: DynFlags -> Safety -> Type -> Validity' IllegalForeignTypeReason
isFFIImportResultTy :: DynFlags -> Type -> Validity' IllegalForeignTypeReason
isFFIExportResultTy :: Type -> Validity' IllegalForeignTypeReason
isFFIExternalTy :: Type -> Validity' IllegalForeignTypeReason
isFFIDynTy :: Type -> Type -> Validity' IllegalForeignTypeReason
isFFIPrimArgumentTy :: DynFlags -> Type -> Validity' IllegalForeignTypeReason
isFFIPrimResultTy :: DynFlags -> Type -> Validity' IllegalForeignTypeReason
isFFILabelTy :: Type -> Validity' IllegalForeignTypeReason
isFunPtrTy :: Type -> Bool
tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type)
-- | The key type representing kinds in the compiler.
type Kind = Type
tcTypeKind :: HasDebugCallStack => Type -> Kind
liftedTypeKind :: Type
constraintKind :: Kind
-- | This version considers Constraint to be the same as *. Returns True if
-- the argument is equivalent to Type/Constraint and False otherwise. See
-- Note [Kind Constraint and kind Type]
isLiftedTypeKind :: Kind -> Bool
-- | Returns True if the kind classifies unlifted types (like 'Int#') and
-- False otherwise. Note that this returns False for
-- representation-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 IntRep, TYPE v, Constraint.
--
-- True of any sub-kind of OpenTypeKind
classifiesTypeWithValues :: Kind -> Bool
data Type
-- | A type of the form p of constraint kind 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 TyCoBinder represents an argument to a function. TyCoBinders
-- can be dependent (Named) or nondependent (Anon). They
-- may also be visible or not. See Note [TyCoBinders]
data TyCoBinder
-- | 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 [VarBndrs, TyCoVarBinders, TyConBinders,
-- and visibility] in GHC.Core.TyCo.Rep
data ArgFlag
Invisible :: Specificity -> ArgFlag
Required :: ArgFlag
pattern Specified :: ArgFlag
pattern Inferred :: ArgFlag
-- | The non-dependent version of ArgFlag. See Note [AnonArgFlag]
-- Appears here partly so that it's together with its friends ArgFlag and
-- ForallVisFlag, but also because it is used in IfaceType, rather early
-- in the compilation chain
data AnonArgFlag
-- | Used for (->): an ordinary non-dependent arrow. The
-- argument is visible in source code.
VisArg :: AnonArgFlag
-- | Used for (=>): a non-dependent predicate arrow. The
-- argument is invisible in source code.
InvisArg :: AnonArgFlag
-- | Like mkTyCoForAllTy, but does not check the occurrence of the
-- binder See Note [Unused coercion variable in ForAllTy]
mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
-- | Wraps foralls over the type using the provided TyCoVars from
-- left to right
mkForAllTys :: [TyCoVarBinder] -> Type -> Type
-- | Wraps foralls over the type using the provided InvisTVBinders
-- from left to right
mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type
-- | Like mkForAllTys, but assumes all variables are dependent and
-- Inferred, a common case
mkTyCoInvForAllTys :: [TyCoVar] -> 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 variable
mkTyCoInvForAllTy :: TyCoVar -> Type -> Type
-- | Like mkTyCoInvForAllTy, but tv should be a tyvar
mkInfForAllTy :: TyVar -> Type -> Type
-- | Like mkTyCoInvForAllTys, but tvs should be a list of tyvar
mkInfForAllTys :: [TyVar] -> Type -> Type
mkVisFunTy :: Mult -> Type -> Type -> Type
infixr 3 `mkVisFunTy`
-- | Make nested arrow types
mkVisFunTys :: [Scaled Type] -> Type -> Type
mkInvisFunTy :: Mult -> Type -> Type -> Type
infixr 3 `mkInvisFunTy`
mkInvisFunTyMany :: Type -> Type -> Type
infixr 3 `mkInvisFunTyMany`
-- | Special, common, case: Arrow type with mult Many
mkVisFunTyMany :: Type -> Type -> Type
infixr 3 `mkVisFunTyMany`
mkVisFunTysMany :: [Type] -> Type -> Type
mkInvisFunTysMany :: [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
-- | (mkTyConTy tc) returns (TyConApp tc []) but arranges to share that
-- TyConApp among all calls See Note [Sharing nullary TyConApps] in
-- GHC.Core.TyCon
mkTyConTy :: TyCon -> Type
mkTyVarTy :: TyVar -> Type
mkTyVarTys :: [TyVar] -> [Type]
mkTyCoVarTy :: TyCoVar -> Type
mkTyCoVarTys :: [TyCoVar] -> [Type]
isClassPred :: PredType -> Bool
isEqPrimPred :: PredType -> Bool
isIPLikePred :: Type -> Bool
isEqPred :: PredType -> Bool
isEqPredClass :: Class -> Bool
mkClassPred :: Class -> [Type] -> PredType
tcSplitDFunTy :: Type -> ([TyVar], [Type], Class, [Type])
tcSplitDFunHead :: Type -> (Class, [Type])
tcSplitMethodTy :: Type -> ([TyVar], PredType, Type)
-- | Is a tyvar of type RuntimeRep?
isRuntimeRepVar :: TyVar -> Bool
-- | Checks that a kind of the form Type, Constraint or
-- 'TYPE r is concrete. See isConcrete.
--
-- Precondition: The type has kind (TYPE blah).
isFixedRuntimeRepKind :: HasDebugCallStack => Kind -> Bool
-- | Does this binder bind a visible argument?
isVisibleBinder :: TyCoBinder -> Bool
-- | Does this binder bind an invisible argument?
isInvisibleBinder :: TyCoBinder -> 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
mkEmptyTCvSubst :: InScopeSet -> TCvSubst
-- | Generates the in-scope set for the TCvSubst from the types in
-- the incoming environment. No CoVars, please!
zipTvSubst :: HasDebugCallStack => [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 :: HasDebugCallStack => 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 :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv
zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv
-- | Substitute within a Type The substitution has to satisfy the
-- invariants described in Note [The substitution invariant].
substTy :: HasDebugCallStack => TCvSubst -> Type -> Type
-- | Substitute within several Types The substitution has to satisfy
-- the invariants described in Note [The substitution invariant].
substTys :: HasDebugCallStack => TCvSubst -> [Type] -> [Type]
substScaledTys :: HasDebugCallStack => TCvSubst -> [Scaled Type] -> [Scaled Type]
-- | Type substitution, see zipTvSubst
substTyWith :: HasDebugCallStack => [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]
substScaledTyUnchecked :: HasDebugCallStack => TCvSubst -> Scaled Type -> Scaled 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 :: HasDebugCallStack => TCvSubst -> ThetaType -> ThetaType
-- | Is the given type definitely unlifted? See
-- Type#type_classification for what an unlifted type is.
--
-- Panics on representation-polymorphic types; See
-- mightBeUnliftedType for a more approximate predicate that
-- behaves better in the presence of representation polymorphism.
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. Returns Nothing if no
-- unwrapping happens. See also Note [coreView vs tcView]
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.
--
-- This function does not look through type family applications.
--
-- 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
tyCoVarsOfType :: Type -> TyCoVarSet
tyCoVarsOfTypes :: [Type] -> TyCoVarSet
closeOverKinds :: TyCoVarSet -> TyCoVarSet
-- | The worker for tyCoFVsOfType and tyCoFVsOfTypeList.
-- 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 GHC.Utils.FV.
--
-- Eta-expanded because that makes it run faster (apparently) See Note
-- [FV eta expansion] in GHC.Utils.FV for explanation.
tyCoFVsOfType :: Type -> FV
tyCoFVsOfTypes :: [Type] -> FV
-- | tyCoFVsOfType 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 GHC.Utils.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
-- | tyCoFVsOfType that returns free variables of a type in
-- deterministic order. For explanation of why using VarSet is not
-- deterministic see Note [Deterministic FV] in GHC.Utils.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]
noFreeVarsOfType :: Type -> Bool
pprKind :: Kind -> SDoc
pprParendKind :: Kind -> SDoc
pprSigmaType :: Type -> SDoc
pprType :: Type -> SDoc
pprParendType :: Type -> SDoc
pprTypeApp :: TyCon -> [Type] -> SDoc
pprTheta :: ThetaType -> SDoc
pprParendTheta :: ThetaType -> SDoc
pprThetaArrowTy :: ThetaType -> SDoc
pprClassPred :: Class -> [Type] -> SDoc
pprTCvBndr :: TyCoVarBinder -> SDoc
pprTCvBndrs :: [TyCoVarBinder] -> 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).
--
-- It is also meant to be stable: that is, variables should not be
-- reordered unnecessarily. This is specified in Note [ScopedSort] See
-- also Note [Ordering of implicit variables] in GHC.Rename.HsType
scopedSort :: [TyCoVar] -> [TyCoVar]
-- | For every arg a tycon can take, the returned list says True if the
-- argument is taken visibly, and False otherwise. Ends with an infinite
-- tail of Trues to allow for oversaturation.
tcTyConVisibilities :: TyCon -> [Bool]
-- | If the tycon is applied to the types, is the next argument visible?
isNextTyConArgVisible :: TyCon -> [Type] -> Bool
-- | Should this type be applied to a visible argument?
isNextArgVisible :: TcType -> Bool
instance GHC.Classes.Ord GHC.Tc.Utils.TcType.TcLevel
instance GHC.Classes.Eq GHC.Tc.Utils.TcType.TcLevel
instance GHC.Utils.Outputable.Outputable GHC.Tc.Utils.TcType.ExpType
instance GHC.Utils.Outputable.Outputable GHC.Tc.Utils.TcType.InferResult
instance GHC.Utils.Outputable.Outputable GHC.Tc.Utils.TcType.TcTyVarDetails
instance GHC.Utils.Outputable.Outputable GHC.Tc.Utils.TcType.TcLevel
instance GHC.Utils.Outputable.Outputable GHC.Tc.Utils.TcType.MetaInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Utils.TcType.MetaDetails
module GHC.Tc.Types.Evidence
data HsWrapper
WpHole :: HsWrapper
WpCompose :: HsWrapper -> HsWrapper -> HsWrapper
WpFun :: HsWrapper -> HsWrapper -> Scaled TcType -> HsWrapper
WpCast :: TcCoercionR -> HsWrapper
WpEvLam :: EvVar -> HsWrapper
WpEvApp :: EvTerm -> HsWrapper
WpTyLam :: TyVar -> HsWrapper
WpTyApp :: KindOrType -> HsWrapper
WpLet :: TcEvBinds -> HsWrapper
WpMultCoercion :: Coercion -> HsWrapper
(<.>) :: HsWrapper -> HsWrapper -> HsWrapper
mkWpTyApps :: [Type] -> HsWrapper
mkWpEvApps :: [EvTerm] -> HsWrapper
mkWpEvVarApps :: [EvVar] -> HsWrapper
mkWpTyLams :: [TyVar] -> HsWrapper
mkWpLams :: [Var] -> HsWrapper
mkWpLet :: TcEvBinds -> HsWrapper
-- | Smart constructor to create a WpFun HsWrapper.
--
-- PRECONDITION: the "from" type of the first wrapper must have a fixed
-- RuntimeRep (see Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete).
mkWpFun :: HsWrapper -> HsWrapper -> Scaled TcType -> TcType -> HsWrapper
mkWpCastN :: TcCoercionN -> HsWrapper
mkWpCastR :: TcCoercionR -> HsWrapper
collectHsWrapBinders :: HsWrapper -> ([Var], HsWrapper)
idHsWrapper :: HsWrapper
isIdHsWrapper :: HsWrapper -> Bool
pprHsWrapper :: HsWrapper -> (Bool -> SDoc) -> SDoc
-- | Identifies the lambda-bound dictionaries of an
-- HsWrapper. This is used (only) to allow the pattern-match
-- overlap checker to know what Given dictionaries are in scope.
--
-- We specifically do not collect dictionaries bound in a WpLet.
-- These are either superclasses of lambda-bound ones, or (extremely
-- numerous) results of binding Wanted dictionaries. We definitely don't
-- want all those cluttering up the Given dictionaries for pattern-match
-- overlap checking!
hsWrapDictBinders :: HsWrapper -> Bag DictId
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
CoEvBindsVar :: Unique -> IORef CoVarSet -> EvBindsVar
[ebv_uniq] :: EvBindsVar -> Unique
[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
nonDetStrictFoldEvBindMap :: (EvBind -> a -> a) -> a -> EvBindMap -> a
filterEvBindMap :: (EvBind -> Bool) -> EvBindMap -> EvBindMap
isEmptyEvBindMap :: EvBindMap -> Bool
evBindMapToVarSet :: EvBindMap -> VarSet
varSetMinusEvBindMap :: VarSet -> EvBindMap -> VarSet
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
evBindVar :: EvBind -> EvVar
isCoEvBindsVar :: EvBindsVar -> Bool
data EvTerm
EvExpr :: EvExpr -> EvTerm
EvTypeable :: Type -> EvTypeable -> EvTerm
EvFun :: [TyVar] -> [EvVar] -> TcEvBinds -> EvVar -> EvTerm
[et_tvs] :: EvTerm -> [TyVar]
[et_given] :: EvTerm -> [EvVar]
[et_binds] :: EvTerm -> TcEvBinds
[et_body] :: EvTerm -> EvVar
type EvExpr = CoreExpr
-- | Any sort of evidence Id, including coercions
evId :: EvId -> EvExpr
evCoercion :: TcCoercion -> EvTerm
-- | d |> co
evCast :: EvExpr -> TcCoercion -> EvTerm
evDFunApp :: DFunId -> [Type] -> [EvExpr] -> EvTerm
evDataConApp :: DataCon -> [Type] -> [EvExpr] -> EvTerm
evSelector :: Id -> [Type] -> [EvExpr] -> EvExpr
mkEvCast :: EvExpr -> TcCoercion -> EvTerm
evVarsOfTerm :: EvTerm -> VarSet
mkEvScSelectors :: Class -> [TcType] -> [(TcPredType, EvExpr)]
evTypeable :: Type -> EvTypeable -> EvTerm
findNeededEvVars :: EvBindMap -> VarSet -> VarSet
evTermCoercion :: EvTerm -> TcCoercion
evTermCoercion_maybe :: EvTerm -> Maybe TcCoercion
-- | Evidence for CallStack implicit parameters.
data EvCallStack
EvCsEmpty :: EvCallStack
-- | EvCsPushCall origin loc stk represents a call from
-- origin, occurring at loc, in a calling context
-- stk.
EvCsPushCall :: FastString -> RealSrcSpan -> EvExpr -> 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 % w -> t), given a dictionaries
-- for w, s, and t.
EvTypeableTrFun :: EvTerm -> 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 #10348)
EvTypeableTyLit :: EvTerm -> EvTypeable
-- | Where to store evidence for expression holes See Note [Holes] in
-- GHC.Tc.Types.Constraint
data HoleExprRef
HER :: IORef EvTerm -> TcType -> Unique -> HoleExprRef
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
type TcMCoercion = MCoercion
type TcMCoercionN = MCoercionN
type TcMCoercionR = MCoercionR
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 -> 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
mkTcSymMCo :: TcMCoercion -> TcMCoercion
mkTcTransCo :: TcCoercion -> TcCoercion -> TcCoercion
mkTcNthCo :: Role -> Int -> TcCoercion -> TcCoercion
mkTcLRCo :: LeftOrRight -> TcCoercion -> TcCoercion
mkTcSubCo :: HasDebugCallStack => TcCoercionN -> TcCoercionR
-- | If a SwapFlag is IsSwapped, flip the orientation of a
-- coercion
maybeTcSymCo :: SwapFlag -> TcCoercion -> TcCoercion
-- | If the EqRel is ReprEq, makes a SubCo; otherwise, does nothing. Note
-- that the input coercion should always be nominal.
maybeTcSubCo :: HasDebugCallStack => EqRel -> TcCoercionN -> TcCoercion
tcDowngradeRole :: Role -> Role -> TcCoercion -> TcCoercion
mkTcAxiomRuleCo :: CoAxiomRule -> [TcCoercion] -> TcCoercionR
mkTcGReflRightCo :: Role -> TcType -> TcCoercionN -> TcCoercion
mkTcGReflRightMCo :: Role -> TcType -> TcMCoercionN -> TcCoercion
mkTcGReflLeftCo :: Role -> TcType -> TcCoercionN -> TcCoercion
mkTcGReflLeftMCo :: Role -> TcType -> TcMCoercionN -> TcCoercion
mkTcPhantomCo :: TcCoercionN -> TcType -> TcType -> TcCoercionP
mkTcCoherenceLeftCo :: Role -> TcType -> TcCoercionN -> TcCoercion -> TcCoercion
mkTcCoherenceRightCo :: Role -> TcType -> TcCoercionN -> TcCoercion -> TcCoercion
mkTcKindCo :: TcCoercion -> TcCoercionN
tcCoercionKind :: TcCoercion -> Pair TcType
mkTcCoVarCo :: CoVar -> TcCoercion
mkTcFamilyTyConAppCo :: TyCon -> [TcCoercionN] -> TcCoercionN
isTcReflCo :: TcCoercion -> Bool
-- | This version does a slow check, calculating the related types and
-- seeing if they are equal.
isTcReflexiveCo :: TcCoercion -> Bool
tcCoercionRole :: TcCoercion -> Role
-- | Create a Coercion that unwraps an implicit-parameter dictionary
-- to expose the underlying value. We expect the Type to have the
-- form `IP sym ty`, and return a Coercion `co :: IP sym ty ~ ty`
unwrapIP :: Type -> CoercionR
-- | Create a Coercion that wraps a value in an implicit-parameter
-- dictionary. See unwrapIP.
wrapIP :: Type -> CoercionR
data QuoteWrapper
QuoteWrapper :: EvVar -> Type -> QuoteWrapper
-- | Convert the QuoteWrapper into a normal HsWrapper which can be used to
-- apply its contents.
applyQuoteWrapper :: QuoteWrapper -> HsWrapper
quoteWrapperTyVarTy :: QuoteWrapper -> Type
instance Data.Data.Data GHC.Tc.Types.Evidence.EvTerm
instance Data.Data.Data GHC.Tc.Types.Evidence.EvTypeable
instance Data.Data.Data GHC.Tc.Types.Evidence.HsWrapper
instance Data.Data.Data GHC.Tc.Types.Evidence.EvCallStack
instance Data.Data.Data GHC.Tc.Types.Evidence.QuoteWrapper
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.HoleExprRef
instance Data.Data.Data GHC.Tc.Types.Evidence.HoleExprRef
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.EvCallStack
instance GHC.Base.Semigroup GHC.Tc.Types.Evidence.HsWrapper
instance GHC.Base.Monoid GHC.Tc.Types.Evidence.HsWrapper
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.HsWrapper
instance Data.Data.Data GHC.Tc.Types.Evidence.TcEvBinds
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.EvBindMap
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.TcEvBinds
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.EvBindsVar
instance GHC.Types.Unique.Uniquable GHC.Tc.Types.Evidence.EvBindsVar
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.EvBind
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.EvTerm
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Evidence.EvTypeable
module GHC.Core.InstEnv
-- | Dictionary Function Identifier
type DFunId = Id
type InstMatch = (ClsInst, [DFunInstType])
type ClsInstLookupResult = ([InstMatch], PotentialUnifiers, [InstMatch])
data PotentialUnifiers
NoUnifiers :: PotentialUnifiers
OneOrMoreUnifiers :: [ClsInst] -> PotentialUnifiers
getPotentialUnifiers :: PotentialUnifiers -> [ClsInst]
nullUnifiers :: PotentialUnifiers -> Bool
-- | The semantics allowed for overlapping instances for a particular
-- instance. See Note [Safe Haskell isSafeOverlap] (in
-- GHC.Core.InstEnv) 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
-- 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 GHC.Core.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 -> [RoughMatchTc] -> Name -> [TyVar] -> Class -> [Type] -> DFunId -> OverlapFlag -> IsOrphan -> ClsInst
-- | Class name
[is_cls_nm] :: ClsInst -> Name
-- | Top of type args The class itself is always the first element of this
-- list
[is_tcs] :: ClsInst -> [RoughMatchTc]
-- | 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 -> [RoughMatchTc] -> Name -> DFunId -> OverlapFlag -> IsOrphan -> ClsInst
instanceDFunId :: ClsInst -> DFunId
updateClsInstDFuns :: (DFunId -> DFunId) -> InstEnv -> InstEnv
updateClsInstDFun :: (DFunId -> DFunId) -> ClsInst -> ClsInst
-- | 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
data InstEnv
mkInstEnv :: [ClsInst] -> InstEnv
emptyInstEnv :: InstEnv
-- | Makes no particular effort to detect conflicts.
unionInstEnv :: InstEnv -> InstEnv -> InstEnv
extendInstEnv :: InstEnv -> ClsInst -> InstEnv
filterInstEnv :: (ClsInst -> Bool) -> InstEnv -> InstEnv
deleteFromInstEnv :: InstEnv -> ClsInst -> InstEnv
deleteDFunFromInstEnv :: InstEnv -> DFunId -> InstEnv
anyInstEnv :: (ClsInst -> Bool) -> InstEnv -> Bool
-- | True when when the instance heads are the same e.g. both are Eq
-- [(a,b)] Used for overriding in GHCi Obviously should be insensitive 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 SDoc (ClsInst, [Type])
-- | See Note [Rules for instance lookup] ^ See Note [Safe Haskell
-- Overlapping Instances] in GHC.Tc.Solver ^ See Note [Safe
-- Haskell Overlapping Instances Implementation] in GHC.Tc.Solver
lookupInstEnv :: Bool -> InstEnvs -> Class -> [Type] -> ClsInstLookupResult
instEnvElts :: InstEnv -> [ClsInst]
instEnvClasses :: InstEnv -> UniqDSet Class
mapInstEnv :: (ClsInst -> ClsInst) -> InstEnv -> InstEnv
-- | Checks for an exact match of ClsInst in the instance environment. We
-- use this when we do signature checking in GHC.Tc.Module
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 :: BindFun
classNameInstances :: InstEnvs -> Name -> [ClsInst]
instanceCantMatch :: [RoughMatchTc] -> [RoughMatchTc] -> Bool
roughMatchTcs :: [Type] -> [RoughMatchTc]
isOverlappable :: ClsInst -> Bool
isOverlapping :: ClsInst -> Bool
isIncoherent :: ClsInst -> Bool
instance Data.Data.Data GHC.Core.InstEnv.ClsInst
instance GHC.Utils.Outputable.Outputable GHC.Core.InstEnv.InstMatches
instance GHC.Utils.Outputable.Outputable GHC.Core.InstEnv.PotentialUnifiers
instance GHC.Base.Semigroup GHC.Core.InstEnv.PotentialUnifiers
instance GHC.Base.Monoid GHC.Core.InstEnv.PotentialUnifiers
instance GHC.Utils.Outputable.Outputable GHC.Core.InstEnv.InstEnv
instance GHC.Types.Name.NamedThing GHC.Core.InstEnv.ClsInst
instance GHC.Utils.Outputable.Outputable GHC.Core.InstEnv.ClsInst
module GHC.Unit.Module.ModDetails
-- | 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 -> InstEnv -> ![FamInst] -> ![CoreRule] -> ![Annotation] -> [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 -> InstEnv
[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]
-- | Complete match pragmas for this module
[md_complete_matches] :: ModDetails -> [CompleteMatch]
-- | Constructs an empty ModDetails
emptyModDetails :: ModDetails
module GHC.Core.Coercion.Opt
-- | optCoercion applies a substitution to a coercion, *and* optimises it
-- to reduce its size
optCoercion :: OptCoercionOpts -> 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
-- | Coercion optimisation options
newtype OptCoercionOpts
OptCoercionOpts :: Bool -> OptCoercionOpts
-- | Enable coercion optimisation (reduce its size)
[optCoercionEnabled] :: OptCoercionOpts -> Bool
-- | Printing related functions that depend on session state (DynFlags)
module GHC.Driver.Ppr
-- | Show a SDoc as a String with the default user style
showSDoc :: DynFlags -> SDoc -> String
showSDocUnsafe :: SDoc -> String
-- | Allows caller to specify the PrintUnqualified to use
showSDocForUser :: DynFlags -> UnitState -> PrintUnqualified -> SDoc -> String
showPpr :: Outputable a => DynFlags -> a -> String
showPprUnsafe :: Outputable a => a -> String
printForUser :: DynFlags -> Handle -> PrintUnqualified -> Depth -> SDoc -> IO ()
module GHC.Driver.Config.Logger
-- | Initialize LogFlags from DynFlags
initLogFlags :: DynFlags -> LogFlags
module GHC.Driver.Config.Diagnostic
initDiagOpts :: DynFlags -> DiagOpts
-- | The IO Monad with an environment
--
-- The environment is passed around as a Reader monad but as its in the
-- IO monad, mutable references can be used for updating state.
module GHC.Data.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 ()
updMutVarM :: IORef a -> (a -> IOEnv env 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 Control.Monad.Fix.MonadFix (GHC.Data.IOEnv.IOEnv env)
instance Control.Monad.Catch.MonadMask (GHC.Data.IOEnv.IOEnv env)
instance Control.Monad.Catch.MonadCatch (GHC.Data.IOEnv.IOEnv env)
instance Control.Monad.Catch.MonadThrow (GHC.Data.IOEnv.IOEnv env)
instance GHC.Show.Show GHC.Data.IOEnv.IOEnvFailure
instance GHC.Exception.Type.Exception GHC.Data.IOEnv.IOEnvFailure
instance GHC.Base.Functor (GHC.Data.IOEnv.IOEnv env)
instance Control.Monad.IO.Class.MonadIO (GHC.Data.IOEnv.IOEnv env)
instance GHC.Base.Monad (GHC.Data.IOEnv.IOEnv m)
instance Control.Monad.Fail.MonadFail (GHC.Data.IOEnv.IOEnv m)
instance GHC.Base.Applicative (GHC.Data.IOEnv.IOEnv m)
instance GHC.Driver.Session.ContainsDynFlags env => GHC.Driver.Session.HasDynFlags (GHC.Data.IOEnv.IOEnv env)
instance GHC.Driver.Hooks.ContainsHooks env => GHC.Driver.Hooks.HasHooks (GHC.Data.IOEnv.IOEnv env)
instance GHC.Utils.Logger.ContainsLogger env => GHC.Utils.Logger.HasLogger (GHC.Data.IOEnv.IOEnv env)
instance GHC.Unit.Module.ContainsModule env => GHC.Unit.Module.HasModule (GHC.Data.IOEnv.IOEnv env)
instance GHC.Base.Alternative (GHC.Data.IOEnv.IOEnv env)
instance GHC.Base.MonadPlus (GHC.Data.IOEnv.IOEnv env)
-- | Arity and eta expansion
module GHC.Core.Opt.Arity
-- | 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]
-- | The Arity returned is the number of value args the expression can be
-- applied to without doing much work
exprEtaExpandArity :: DynFlags -> CoreExpr -> ArityType
findRhsArity :: DynFlags -> Id -> CoreExpr -> Arity -> ArityType
-- | 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
etaExpandAT :: InScopeSet -> ArityType -> CoreExpr -> CoreExpr
exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, DmdSig)
-- | The analysis lattice of arity analysis. It is isomorphic to
--
--
-- data ArityType'
-- = AEnd Divergence
-- | ALam OneShotInfo ArityType'
--
--
-- Which is easier to display the Hasse diagram for:
--
--
-- ALam OneShotLam at
-- |
-- AEnd topDiv
-- |
-- ALam NoOneShotInfo at
-- |
-- AEnd exnDiv
-- |
-- AEnd botDiv
--
--
-- where the at fields of ALam are inductively subject
-- to the same order. That is, ALam os at1 < ALam os at2 iff
-- at1 < at2.
--
-- Why the strange Top element? See Note [Combining case branches].
--
-- We rely on this lattice structure for fixed-point iteration in
-- findRhsArity. For the semantics of ArityType, see Note
-- [ArityType].
data ArityType
-- | AT oss div means this value can safely be eta-expanded
-- length oss times, provided use sites respect the
-- OneShotInfos in oss. A OneShotLam annotation
-- can come from two sources: * The user annotated a lambda as one-shot
-- with oneShot * It's from a lambda binder of a type affected by
-- `-fstate-hack`. See idStateHackOneShotInfo. In both cases,
-- OneShotLam should win over NoOneShotInfo, see Note
-- [Combining case branches].
--
-- If div is dead-ending (isDeadEndDiv), then application
-- to length os arguments will surely diverge, similar to the
-- situation with DmdType.
AT :: ![OneShotInfo] -> !Divergence -> ArityType
mkBotArityType :: [OneShotInfo] -> ArityType
mkTopArityType :: [OneShotInfo] -> ArityType
-- | True = eta-expansion will add at least one lambda
expandableArityType :: ArityType -> Bool
-- | The number of value args for the arity type
arityTypeArity :: ArityType -> Arity
-- | Expand a non-bottoming arity type so that it has at least the given
-- arity.
maxWithArity :: ArityType -> Arity -> ArityType
idArityType :: Id -> ArityType
-- | 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
pushCoArg :: CoercionR -> CoreArg -> Maybe (CoreArg, MCoercion)
pushCoArgs :: CoercionR -> [CoreArg] -> Maybe ([CoreArg], MCoercion)
pushCoValArg :: CoercionR -> Maybe (MCoercionR, MCoercionR)
pushCoTyArg :: CoercionR -> Type -> Maybe (Type, MCoercionR)
pushCoercionIntoLambda :: HasDebugCallStack => InScopeSet -> Var -> CoreExpr -> CoercionR -> Maybe (Var, CoreExpr)
pushCoDataCon :: DataCon -> [CoreExpr] -> Coercion -> Maybe (DataCon, [Type], [CoreExpr])
collectBindersPushingCo :: CoreExpr -> ([Var], CoreExpr)
instance GHC.Classes.Eq GHC.Core.Opt.Arity.ArityType
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.Arity.EtaInfo
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.Arity.ArityType
module GHC.Core.Opt.OccurAnal
occurAnalysePgm :: Module -> (Id -> Bool) -> (Activation -> Bool) -> [CoreRule] -> CoreProgram -> CoreProgram
-- | Do occurrence analysis, and discard occurrence info returned
occurAnalyseExpr :: CoreExpr -> CoreExpr
zapLambdaBndrs :: CoreExpr -> FullArgCount -> CoreExpr
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.OccurAnal.Details
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.OccurAnal.UsageDetails
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.OccurAnal.OccEncl
-- | Unfolding creation
module GHC.Core.Unfold.Make
-- | There is no known Unfolding
noUnfolding :: Unfolding
mkUnfolding :: UnfoldingOpts -> UnfoldingSource -> Bool -> Bool -> CoreExpr -> Unfolding
mkCoreUnfolding :: UnfoldingSource -> Bool -> CoreExpr -> UnfoldingGuidance -> Unfolding
mkFinalUnfolding :: UnfoldingOpts -> UnfoldingSource -> DmdSig -> CoreExpr -> Unfolding
mkSimpleUnfolding :: UnfoldingOpts -> CoreExpr -> Unfolding
mkWorkerUnfolding :: SimpleOpts -> (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 :: SimpleOpts -> CoreExpr -> Unfolding
-- | Make an unfolding that will be used once the RHS has been saturated to
-- the given arity.
mkInlineUnfoldingWithArity :: Arity -> SimpleOpts -> CoreExpr -> Unfolding
mkInlinableUnfolding :: SimpleOpts -> CoreExpr -> Unfolding
mkWrapperUnfolding :: SimpleOpts -> CoreExpr -> Arity -> Unfolding
-- | Used for things that absolutely must be unfolded
mkCompulsoryUnfolding :: SimpleOpts -> CoreExpr -> Unfolding
-- | Same as mkCompulsoryUnfolding but no simple optimiser pass is
-- performed on the unfolding.
mkCompulsoryUnfolding' :: CoreExpr -> Unfolding
mkDFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding
specUnfolding :: SimpleOpts -> [Var] -> (CoreExpr -> CoreExpr) -> [CoreArg] -> Unfolding -> Unfolding
-- | Sees if the unfolding is pretty certain to inline. If so, return a
-- *stable* unfolding for it, that will always inline. The CoreExpr is
-- the WW'd and simplified RHS. In contrast, the unfolding template might
-- not have been WW'd yet.
certainlyWillInline :: UnfoldingOpts -> IdInfo -> CoreExpr -> Maybe Unfolding
-- | Types and functions for raw and lexed docstrings.
module GHC.Hs.Doc
-- | A docstring with the (probable) identifiers found in it.
type HsDoc = WithHsDocIdentifiers HsDocString
-- | Annotate a value with the probable identifiers found in it These will
-- be used by haddock to generate links.
--
-- The identifiers are bundled along with their location in the source
-- file. This is useful for tooling to know exactly where they originate.
--
-- This type is currently used in two places - for regular documentation
-- comments, with a set to HsDocString, and for adding
-- identifier information to warnings, where a is
-- StringLiteral
data WithHsDocIdentifiers a pass
WithHsDocIdentifiers :: !a -> ![Located (IdP pass)] -> WithHsDocIdentifiers a pass
[hsDocString] :: WithHsDocIdentifiers a pass -> !a
[hsDocIdentifiers] :: WithHsDocIdentifiers a pass -> ![Located (IdP pass)]
-- | Extract a mapping from the lexed identifiers to the names they may
-- correspond to.
hsDocIds :: WithHsDocIdentifiers a GhcRn -> NameSet
type LHsDoc pass = Located (HsDoc pass)
-- | Print a doc with its identifiers, useful for debugging
pprHsDocDebug :: Outputable (IdP name) => HsDoc name -> SDoc
-- | Pretty print a thing with its doc The docstring will include the
-- comment decorators '-- |', '{-|' etc and will come either before or
-- after depending on how it was written i.e it will come after the thing
-- if it is a '-- ^' or '{-^' and before otherwise.
pprWithDoc :: LHsDoc name -> SDoc -> SDoc
-- | See pprWithHsDoc
pprMaybeWithDoc :: Maybe (LHsDoc name) -> SDoc -> SDoc
-- | Maps of docs that were added via Template Haskell's putDoc.
data ExtractedTHDocs
ExtractedTHDocs :: Maybe (HsDoc GhcRn) -> UniqMap Name (HsDoc GhcRn) -> UniqMap Name (IntMap (HsDoc GhcRn)) -> UniqMap Name (HsDoc GhcRn) -> ExtractedTHDocs
-- | The added module header documentation, if it exists.
[ethd_mod_header] :: ExtractedTHDocs -> Maybe (HsDoc GhcRn)
-- | The documentation added to declarations.
[ethd_decl_docs] :: ExtractedTHDocs -> UniqMap Name (HsDoc GhcRn)
-- | The documentation added to function arguments.
[ethd_arg_docs] :: ExtractedTHDocs -> UniqMap Name (IntMap (HsDoc GhcRn))
-- | The documentation added to class and family instances.
[ethd_inst_docs] :: ExtractedTHDocs -> UniqMap Name (HsDoc GhcRn)
-- | A simplified version of IE.
data DocStructureItem
DsiSectionHeading :: Int -> HsDoc GhcRn -> DocStructureItem
DsiDocChunk :: HsDoc GhcRn -> DocStructureItem
DsiNamedChunkRef :: String -> DocStructureItem
DsiExports :: Avails -> DocStructureItem
DsiModExport :: NonEmpty ModuleName -> Avails -> DocStructureItem
type DocStructure = [DocStructureItem]
data Docs
Docs :: Maybe (HsDoc GhcRn) -> UniqMap Name [HsDoc GhcRn] -> UniqMap Name (IntMap (HsDoc GhcRn)) -> DocStructure -> Map String (HsDoc GhcRn) -> Maybe String -> Maybe Language -> EnumSet Extension -> Docs
-- | Module header.
[docs_mod_hdr] :: Docs -> Maybe (HsDoc GhcRn)
-- | Docs for declarations: functions, data types, instances, methods etc.
-- A list because sometimes subsequent haddock comments can be combined
-- into one
[docs_decls] :: Docs -> UniqMap Name [HsDoc GhcRn]
-- | Docs for arguments. E.g. function arguments, method arguments.
[docs_args] :: Docs -> UniqMap Name (IntMap (HsDoc GhcRn))
[docs_structure] :: Docs -> DocStructure
-- | Map from chunk name to content.
--
-- This map will be empty unless we have an explicit export list from
-- which we can reference the chunks.
[docs_named_chunks] :: Docs -> Map String (HsDoc GhcRn)
-- | Haddock options from OPTIONS_HADDOCK or from
-- -haddock-opts.
[docs_haddock_opts] :: Docs -> Maybe String
-- | The Language used in the module, for example
-- Haskell2010.
[docs_language] :: Docs -> Maybe Language
-- | The full set of language extensions used in the module.
[docs_extensions] :: Docs -> EnumSet Extension
emptyDocs :: Docs
instance (Data.Data.Data pass, Data.Data.Data (Language.Haskell.Syntax.Extension.IdP pass), Data.Data.Data a) => Data.Data.Data (GHC.Hs.Doc.WithHsDocIdentifiers a pass)
instance (GHC.Classes.Eq (Language.Haskell.Syntax.Extension.IdP pass), GHC.Classes.Eq a) => GHC.Classes.Eq (GHC.Hs.Doc.WithHsDocIdentifiers a pass)
instance GHC.Utils.Binary.Binary GHC.Hs.Doc.Docs
instance GHC.Utils.Outputable.Outputable GHC.Hs.Doc.Docs
instance GHC.Utils.Binary.Binary GHC.Hs.Doc.DocStructureItem
instance GHC.Utils.Outputable.Outputable GHC.Hs.Doc.DocStructureItem
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.Hs.Doc.WithHsDocIdentifiers a pass)
instance GHC.Utils.Binary.Binary a => GHC.Utils.Binary.Binary (GHC.Hs.Doc.WithHsDocIdentifiers a GHC.Hs.Extension.GhcRn)
-- | Warnings for a module
module GHC.Unit.Module.Warnings
-- | Warning information for a module
data Warnings pass
-- | Nothing deprecated
NoWarnings :: Warnings pass
-- | Whole module deprecated
WarnAll :: WarningTxt pass -> Warnings pass
-- | Some specific things deprecated
WarnSome :: [(OccName, WarningTxt pass)] -> Warnings pass
-- | Warning Text
--
-- reason/explanation from a WARNING or DEPRECATED pragma
data WarningTxt pass
WarningTxt :: Located SourceText -> [Located (WithHsDocIdentifiers StringLiteral pass)] -> WarningTxt pass
DeprecatedTxt :: Located SourceText -> [Located (WithHsDocIdentifiers StringLiteral pass)] -> WarningTxt pass
pprWarningTxtForMsg :: WarningTxt p -> SDoc
-- | Constructs the cache for the mi_warn_fn field of a
-- ModIface
mkIfaceWarnCache :: Warnings p -> OccName -> Maybe (WarningTxt p)
emptyIfaceWarnCache :: OccName -> Maybe (WarningTxt p)
plusWarns :: Warnings p -> Warnings p -> Warnings p
instance GHC.Classes.Eq (Language.Haskell.Syntax.Extension.IdP pass) => GHC.Classes.Eq (GHC.Unit.Module.Warnings.WarningTxt pass)
instance (Data.Data.Data pass, Data.Data.Data (Language.Haskell.Syntax.Extension.IdP pass)) => Data.Data.Data (GHC.Unit.Module.Warnings.WarningTxt pass)
instance GHC.Classes.Eq (Language.Haskell.Syntax.Extension.IdP pass) => GHC.Classes.Eq (GHC.Unit.Module.Warnings.Warnings pass)
instance GHC.Utils.Binary.Binary (GHC.Unit.Module.Warnings.Warnings GHC.Hs.Extension.GhcRn)
instance GHC.Utils.Outputable.Outputable (GHC.Unit.Module.Warnings.WarningTxt pass)
instance GHC.Utils.Binary.Binary (GHC.Unit.Module.Warnings.WarningTxt GHC.Hs.Extension.GhcRn)
module GHC.Hs.ImpExp
-- | Located Import Declaration
type LImportDecl pass = XRec pass (ImportDecl pass) " When in a list this may have - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi'"
-- | If/how an import is qualified.
data ImportDeclQualifiedStyle
-- | qualified appears in prepositive position.
QualifiedPre :: ImportDeclQualifiedStyle
-- | qualified appears in postpositive position.
QualifiedPost :: ImportDeclQualifiedStyle
-- | Not qualified.
NotQualified :: ImportDeclQualifiedStyle
-- | Given two possible located qualified tokens, compute a style
-- (in a conforming Haskell program only one of the two can be not
-- Nothing). This is called from GHC.Parser.
importDeclQualifiedStyle :: Maybe EpaLocation -> Maybe EpaLocation -> (Maybe EpaLocation, ImportDeclQualifiedStyle)
-- | Convenience function to answer the question if an import decl. is
-- qualified.
isImportDeclQualified :: ImportDeclQualifiedStyle -> Bool
-- | Import Declaration
--
-- A single Haskell import declaration.
data ImportDecl pass
ImportDecl :: XCImportDecl pass -> SourceText -> XRec pass ModuleName -> ImportDeclPkgQual pass -> IsBootInterface -> Bool -> ImportDeclQualifiedStyle -> Bool -> Maybe (XRec pass ModuleName) -> Maybe (Bool, XRec pass [LIE pass]) -> ImportDecl pass
[ideclExt] :: ImportDecl pass -> XCImportDecl pass
[ideclSourceSrc] :: ImportDecl pass -> SourceText
-- | Module name.
[ideclName] :: ImportDecl pass -> XRec pass ModuleName
-- | Package qualifier.
[ideclPkgQual] :: ImportDecl pass -> ImportDeclPkgQual pass
-- | IsBoot = {-# SOURCE #-} import
[ideclSource] :: ImportDecl pass -> IsBootInterface
-- | True => safe import
[ideclSafe] :: ImportDecl pass -> Bool
-- | If/how the import is qualified.
[ideclQualified] :: ImportDecl pass -> ImportDeclQualifiedStyle
-- | True => implicit import (of Prelude)
[ideclImplicit] :: ImportDecl pass -> Bool
-- | as Module
[ideclAs] :: ImportDecl pass -> Maybe (XRec pass ModuleName)
-- | (True => hiding, names)
[ideclHiding] :: ImportDecl pass -> Maybe (Bool, XRec pass [LIE pass])
-- | AnnKeywordIds
--
--
XImportDecl :: !XXImportDecl pass -> ImportDecl pass
type family ImportDeclPkgQual pass
data EpAnnImportDecl
EpAnnImportDecl :: EpaLocation -> Maybe (EpaLocation, EpaLocation) -> Maybe EpaLocation -> Maybe EpaLocation -> Maybe EpaLocation -> Maybe EpaLocation -> EpAnnImportDecl
[importDeclAnnImport] :: EpAnnImportDecl -> EpaLocation
[importDeclAnnPragma] :: EpAnnImportDecl -> Maybe (EpaLocation, EpaLocation)
[importDeclAnnSafe] :: EpAnnImportDecl -> Maybe EpaLocation
[importDeclAnnQualified] :: EpAnnImportDecl -> Maybe EpaLocation
[importDeclAnnPackage] :: EpAnnImportDecl -> Maybe EpaLocation
[importDeclAnnAs] :: EpAnnImportDecl -> Maybe EpaLocation
simpleImportDecl :: ModuleName -> ImportDecl GhcPs
-- | A name in an import or export specification which may have adornments.
-- Used primarily for accurate pretty printing of ParsedSource, and API
-- Annotation placement. The Annotation is the location of the
-- adornment in the original source.
data IEWrappedName name
-- | no extra
IEName :: LocatedN name -> IEWrappedName name
-- | pattern X
IEPattern :: EpaLocation -> LocatedN name -> IEWrappedName name
-- | type (:+:)
IEType :: EpaLocation -> LocatedN name -> IEWrappedName name
-- | Located name with possible adornment - AnnKeywordIds :
-- AnnType, AnnPattern
type LIEWrappedName name = LocatedA (IEWrappedName name)
-- | Located Import or Export
type LIE pass = XRec pass (IE pass) " When in a list this may have - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma'"
-- | Imported or exported entity.
data IE pass
-- | Imported or Exported Variable
IEVar :: XIEVar pass -> LIEWrappedName (IdP pass) -> IE pass
-- | Imported or exported Thing with Absent list
--
-- The thing is a Class/Type (can't tell) - AnnKeywordIds :
-- AnnPattern, AnnType,AnnVal
IEThingAbs :: XIEThingAbs pass -> LIEWrappedName (IdP pass) -> IE pass
-- | Imported or exported Thing with All imported or exported
--
-- The thing is a ClassType and the All refers to
-- methodsconstructors
--
--
IEThingAll :: XIEThingAll pass -> LIEWrappedName (IdP pass) -> IE pass
-- | 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 :: XIEThingWith pass -> LIEWrappedName (IdP pass) -> IEWildcard -> [LIEWrappedName (IdP pass)] -> IE pass
-- | Imported or exported module contents
--
-- (Export Only)
--
--
IEModuleContents :: XIEModuleContents pass -> XRec pass ModuleName -> IE pass
-- | Doc section heading
IEGroup :: XIEGroup pass -> Int -> LHsDoc pass -> IE pass
-- | Some documentation
IEDoc :: XIEDoc pass -> LHsDoc pass -> IE pass
-- | Reference to named doc
IEDocNamed :: XIEDocNamed pass -> String -> IE pass
XIE :: !XXIE pass -> IE pass
-- | Imported or Exported Wildcard
data IEWildcard
NoIEWildcard :: IEWildcard
IEWildcard :: Int -> IEWildcard
ieName :: IE (GhcPass p) -> IdP (GhcPass p)
ieNames :: IE (GhcPass p) -> [IdP (GhcPass p)]
ieWrappedLName :: IEWrappedName name -> LocatedN name
ieWrappedName :: IEWrappedName name -> name
lieWrappedName :: LIEWrappedName name -> name
ieLWrappedName :: LIEWrappedName name -> LocatedN name
replaceWrappedName :: IEWrappedName name1 -> name2 -> IEWrappedName name2
replaceLWrappedName :: LIEWrappedName name1 -> name2 -> LIEWrappedName name2
pprImpExp :: (HasOccName name, OutputableBndr name) => name -> SDoc
instance Data.Data.Data GHC.Hs.ImpExp.ImportDeclQualifiedStyle
instance GHC.Classes.Eq GHC.Hs.ImpExp.ImportDeclQualifiedStyle
instance Data.Data.Data GHC.Hs.ImpExp.EpAnnImportDecl
instance Data.Data.Data name => Data.Data.Data (GHC.Hs.ImpExp.IEWrappedName name)
instance GHC.Classes.Eq name => GHC.Classes.Eq (GHC.Hs.ImpExp.IEWrappedName name)
instance Data.Data.Data GHC.Hs.ImpExp.IEWildcard
instance GHC.Classes.Eq GHC.Hs.ImpExp.IEWildcard
instance (GHC.Hs.Extension.OutputableBndrId p, GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.Anno (GHC.Hs.ImpExp.IE (GHC.Hs.Extension.GhcPass p))), GHC.Utils.Outputable.Outputable (GHC.Hs.ImpExp.ImportDeclPkgQual (GHC.Hs.Extension.GhcPass p))) => GHC.Utils.Outputable.Outputable (GHC.Hs.ImpExp.ImportDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (GHC.Hs.ImpExp.IE (GHC.Hs.Extension.GhcPass p))
instance GHC.Types.Name.Occurrence.HasOccName name => GHC.Types.Name.Occurrence.HasOccName (GHC.Hs.ImpExp.IEWrappedName name)
instance GHC.Utils.Outputable.OutputableBndr name => GHC.Utils.Outputable.OutputableBndr (GHC.Hs.ImpExp.IEWrappedName name)
instance GHC.Utils.Outputable.OutputableBndr name => GHC.Utils.Outputable.Outputable (GHC.Hs.ImpExp.IEWrappedName name)
-- | Source-language literals
module Language.Haskell.Syntax.Lit
-- | Haskell Literal
data HsLit x
-- | Character
HsChar :: XHsChar x -> Char -> HsLit x
-- | Unboxed character
HsCharPrim :: XHsCharPrim x -> Char -> HsLit x
-- | String
HsString :: XHsString x -> FastString -> HsLit x
-- | Packed bytes
HsStringPrim :: XHsStringPrim x -> !ByteString -> HsLit x
-- | Genuinely an Int; arises from GHC.Tc.Deriv.Generate, and from
-- TRANSLATION
HsInt :: XHsInt x -> IntegralLit -> HsLit x
-- | literal Int#
HsIntPrim :: XHsIntPrim x -> Integer -> HsLit x
-- | literal Word#
HsWordPrim :: XHsWordPrim x -> Integer -> HsLit x
-- | literal Int64#
HsInt64Prim :: XHsInt64Prim x -> Integer -> HsLit x
-- | literal Word64#
HsWord64Prim :: XHsWord64Prim x -> Integer -> HsLit x
-- | Genuinely an integer; arises only from TRANSLATION (overloaded
-- literals are done with HsOverLit)
HsInteger :: XHsInteger x -> Integer -> Type -> HsLit x
-- | Genuinely a rational; arises only from TRANSLATION (overloaded
-- literals are done with HsOverLit)
HsRat :: XHsRat x -> FractionalLit -> Type -> HsLit x
-- | Unboxed Float
HsFloatPrim :: XHsFloatPrim x -> FractionalLit -> HsLit x
-- | Unboxed Double
HsDoublePrim :: XHsDoublePrim x -> FractionalLit -> HsLit x
XLit :: !XXLit x -> HsLit x
-- | Haskell Overloaded Literal
data HsOverLit p
OverLit :: XOverLit p -> OverLitVal -> HsOverLit p
[ol_ext] :: HsOverLit p -> XOverLit p
[ol_val] :: HsOverLit p -> OverLitVal
XOverLit :: !XXOverLit p -> HsOverLit p
-- | Overloaded Literal Value
data OverLitVal
-- | Integer-looking literals;
HsIntegral :: !IntegralLit -> OverLitVal
-- | Frac-looking literals
HsFractional :: !FractionalLit -> OverLitVal
-- | String-looking literals
HsIsString :: !SourceText -> !FastString -> OverLitVal
negateOverLitVal :: OverLitVal -> OverLitVal
-- | hsLitNeedsParens p l returns True if a literal
-- l needs to be parenthesized under precedence p.
hsLitNeedsParens :: PprPrec -> HsLit x -> Bool
-- | hsOverLitNeedsParens p ol returns True if an
-- overloaded literal ol needs to be parenthesized under
-- precedence p.
hsOverLitNeedsParens :: PprPrec -> HsOverLit x -> Bool
instance Data.Data.Data Language.Haskell.Syntax.Lit.OverLitVal
instance GHC.Classes.Eq (Language.Haskell.Syntax.Extension.XXOverLit p) => GHC.Classes.Eq (Language.Haskell.Syntax.Lit.HsOverLit p)
instance GHC.Classes.Ord (Language.Haskell.Syntax.Extension.XXOverLit p) => GHC.Classes.Ord (Language.Haskell.Syntax.Lit.HsOverLit p)
instance GHC.Classes.Eq Language.Haskell.Syntax.Lit.OverLitVal
instance GHC.Classes.Ord Language.Haskell.Syntax.Lit.OverLitVal
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Lit.OverLitVal
instance GHC.Classes.Eq (Language.Haskell.Syntax.Lit.HsLit x)
module Language.Haskell.Syntax.Type
-- | Mult is a type alias for Type.
--
-- Mult must contain Type because multiplicity variables are mere type
-- variables (of kind Multiplicity) in Haskell. So the simplest
-- implementation is to make Mult be Type.
--
-- Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon)
-- - Many: GHC.Types.Many (= manyDataCon) - Multiplication:
-- GHC.Types.MultMul (= multMulTyCon)
--
-- So that Mult feels a bit more structured, we provide pattern synonyms
-- and smart constructors for these.
type Mult = Type
-- | This is used in the syntax. In constructor declaration. It must keep
-- the arrow representation.
data HsScaled pass a
HsScaled :: HsArrow pass -> a -> HsScaled pass a
hsMult :: HsScaled pass a -> HsArrow pass
hsScaledThing :: HsScaled pass a -> a
-- | Denotes the type of arrows in the surface language
data HsArrow pass
-- | a -> b or a → b
HsUnrestrictedArrow :: !LHsUniToken "->" "\8594" pass -> HsArrow pass
-- | a %1 -> b or a %1 → b, or a ⊸ b
HsLinearArrow :: !HsLinearArrowTokens pass -> HsArrow pass
-- | a %m -> b or a %m → b (very much including `a %Many -> b`! This
-- is how the programmer wrote it). It is stored as an HsType so
-- as to preserve the syntax as written in the program.
HsExplicitMult :: !LHsToken "%" pass -> !LHsType pass -> !LHsUniToken "->" "\8594" pass -> HsArrow pass
data HsLinearArrowTokens pass
HsPct1 :: !LHsToken "%1" pass -> !LHsUniToken "->" "\8594" pass -> HsLinearArrowTokens pass
HsLolly :: !LHsToken "\8888" pass -> HsLinearArrowTokens pass
-- | Haskell Type
data HsType pass
-- |
HsForAllTy :: XForAllTy pass -> HsForAllTelescope pass -> LHsType pass -> HsType pass
[hst_xforall] :: HsType pass -> XForAllTy pass
[hst_tele] :: HsType pass -> HsForAllTelescope pass
[hst_body] :: HsType pass -> LHsType pass
HsQualTy :: XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass
[hst_xqual] :: HsType pass -> XQualTy pass
[hst_ctxt] :: HsType pass -> LHsContext pass
[hst_body] :: HsType pass -> LHsType pass
-- |
HsTyVar :: XTyVar pass -> PromotionFlag -> LIdP pass -> HsType pass
-- |
HsAppTy :: XAppTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppKindTy :: XAppKindTy pass -> LHsType pass -> LHsKind pass -> HsType pass
-- |
HsFunTy :: XFunTy pass -> HsArrow pass -> LHsType pass -> LHsType pass -> HsType pass
-- |
HsListTy :: XListTy pass -> LHsType pass -> HsType pass
-- |
HsTupleTy :: XTupleTy pass -> HsTupleSort -> [LHsType pass] -> HsType pass
-- |
HsSumTy :: XSumTy pass -> [LHsType pass] -> HsType pass
-- |
HsOpTy :: XOpTy pass -> LHsType pass -> LIdP pass -> LHsType pass -> HsType pass
-- |
HsParTy :: XParTy pass -> LHsType pass -> HsType pass
-- |
-- (?x :: ty)
--
--
--
HsIParamTy :: XIParamTy pass -> XRec pass HsIPName -> LHsType pass -> HsType pass
-- |
HsStarTy :: XStarTy pass -> Bool -> HsType pass
-- |
-- (ty :: kind)
--
--
--
HsKindSig :: XKindSig pass -> LHsType pass -> LHsKind pass -> HsType pass
-- |
HsSpliceTy :: XSpliceTy pass -> HsSplice pass -> HsType pass
-- |
HsDocTy :: XDocTy pass -> LHsType pass -> LHsDoc pass -> HsType pass
-- |
HsBangTy :: XBangTy pass -> HsSrcBang -> LHsType pass -> HsType pass
-- |
HsRecTy :: XRecTy pass -> [LConDeclField pass] -> HsType pass
-- |
HsExplicitListTy :: XExplicitListTy pass -> PromotionFlag -> [LHsType pass] -> HsType pass
-- |
HsExplicitTupleTy :: XExplicitTupleTy pass -> [LHsType pass] -> HsType pass
-- |
HsTyLit :: XTyLit pass -> HsTyLit -> HsType pass
-- |
HsWildCardTy :: XWildCardTy pass -> HsType pass
XHsType :: !XXType pass -> HsType pass
type HsCoreTy = Type
-- | Located Haskell Type
type LHsType pass = XRec pass (HsType pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when in a list"
-- | Haskell Kind
type HsKind pass = HsType pass
-- | Located Haskell Kind
type LHsKind pass = XRec pass (HsKind pass) " 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon'"
-- | The type variable binders in an HsForAllTy. See also Note
-- [Variable Specificity and Forall Visibility] in
-- GHC.Tc.Gen.HsType.
data HsForAllTelescope pass
-- | A visible forall (e.g., forall a -> {...}). These
-- do not have any notion of specificity, so we use () as a
-- placeholder value.
HsForAllVis :: XHsForAllVis pass -> [LHsTyVarBndr () pass] -> HsForAllTelescope pass
[hsf_xvis] :: HsForAllTelescope pass -> XHsForAllVis pass
[hsf_vis_bndrs] :: HsForAllTelescope pass -> [LHsTyVarBndr () pass]
-- | An invisible forall (e.g., forall a {b} c. {...}),
-- where each binder has a Specificity.
HsForAllInvis :: XHsForAllInvis pass -> [LHsTyVarBndr Specificity pass] -> HsForAllTelescope pass
[hsf_xinvis] :: HsForAllTelescope pass -> XHsForAllInvis pass
[hsf_invis_bndrs] :: HsForAllTelescope pass -> [LHsTyVarBndr Specificity pass]
XHsForAllTelescope :: !XXHsForAllTelescope pass -> HsForAllTelescope pass
-- | Haskell Type Variable Binder The flag annotates the binder. It is
-- Specificity in places where explicit specificity is allowed
-- (e.g. x :: forall {a} b. ...) or () in other places.
data HsTyVarBndr flag pass
UserTyVar :: XUserTyVar pass -> flag -> LIdP pass -> HsTyVarBndr flag pass
-- |
KindedTyVar :: XKindedTyVar pass -> flag -> LIdP pass -> LHsKind pass -> HsTyVarBndr flag pass
XTyVarBndr :: !XXTyVarBndr pass -> HsTyVarBndr flag pass
-- | Located Haskell Type Variable Binder
type LHsTyVarBndr flag pass = XRec pass (HsTyVarBndr flag pass)
-- | Located Haskell Quantified Type Variables
data LHsQTyVars pass
HsQTvs :: XHsQTvs pass -> [LHsTyVarBndr () pass] -> LHsQTyVars pass
[hsq_ext] :: LHsQTyVars pass -> XHsQTvs pass
[hsq_explicit] :: LHsQTyVars pass -> [LHsTyVarBndr () pass]
XLHsQTyVars :: !XXLHsQTyVars pass -> LHsQTyVars pass
-- | The outermost type variables in a type that obeys the
-- forall-or-nothing rule. See Note [forall-or-nothing
-- rule].
data HsOuterTyVarBndrs flag pass
-- | Implicit forall, e.g., f :: a -> b -> b
HsOuterImplicit :: XHsOuterImplicit pass -> HsOuterTyVarBndrs flag pass
[hso_ximplicit] :: HsOuterTyVarBndrs flag pass -> XHsOuterImplicit pass
-- | Explicit forall, e.g., f :: forall a b. a -> b -> b
HsOuterExplicit :: XHsOuterExplicit pass flag -> [LHsTyVarBndr flag (NoGhcTc pass)] -> HsOuterTyVarBndrs flag pass
[hso_xexplicit] :: HsOuterTyVarBndrs flag pass -> XHsOuterExplicit pass flag
[hso_bndrs] :: HsOuterTyVarBndrs flag pass -> [LHsTyVarBndr flag (NoGhcTc pass)]
XHsOuterTyVarBndrs :: !XXHsOuterTyVarBndrs pass -> HsOuterTyVarBndrs flag pass
-- | Used for type-family instance equations, e.g.,
--
--
-- type instance forall a. F [a] = Tree a
--
--
-- The notion of specificity is irrelevant in type family equations, so
-- we use () for the HsOuterTyVarBndrs flag.
type HsOuterFamEqnTyVarBndrs = HsOuterTyVarBndrs ()
-- | Used for signatures, e.g.,
--
--
-- f :: forall a {b}. blah
--
--
-- We use Specificity for the HsOuterTyVarBndrs
-- flag to allow distinguishing between specified and inferred
-- type variables.
type HsOuterSigTyVarBndrs = HsOuterTyVarBndrs Specificity
-- | Haskell Wildcard Binders
data HsWildCardBndrs pass thing
HsWC :: XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
[hswc_ext] :: HsWildCardBndrs pass thing -> XHsWC pass thing
[hswc_body] :: HsWildCardBndrs pass thing -> thing
XHsWildCardBndrs :: !XXHsWildCardBndrs pass thing -> HsWildCardBndrs pass thing
-- | Types that can appear in pattern signatures, as well as the signatures
-- for term-level binders in RULES. See Note [Pattern signature
-- binders and scoping].
--
-- This is very similar to HsSigWcType, but with slightly
-- different semantics: see Note [HsType binders]. See also
-- Note [The wildcard story for types].
data HsPatSigType pass
HsPS :: XHsPS pass -> LHsType pass -> HsPatSigType pass
-- | After renamer: HsPSRn
[hsps_ext] :: HsPatSigType pass -> XHsPS pass
-- | Main payload (the type itself)
[hsps_body] :: HsPatSigType pass -> LHsType pass
XHsPatSigType :: !XXHsPatSigType pass -> HsPatSigType pass
-- | The extension field for HsPatSigType, which is only used in the
-- renamer onwards. See Note [Pattern signature binders and
-- scoping].
data HsPSRn
HsPSRn :: [Name] -> [Name] -> HsPSRn
-- | Wildcard names
[hsps_nwcs] :: HsPSRn -> [Name]
-- | Implicitly bound variable names
[hsps_imp_tvs] :: HsPSRn -> [Name]
-- | A type signature that obeys the forall-or-nothing rule. In
-- other words, an LHsType that uses an
-- HsOuterSigTyVarBndrs to represent its outermost type variable
-- quantification. See Note [Representing type signatures].
data HsSigType pass
HsSig :: XHsSig pass -> HsOuterSigTyVarBndrs pass -> LHsType pass -> HsSigType pass
[sig_ext] :: HsSigType pass -> XHsSig pass
[sig_bndrs] :: HsSigType pass -> HsOuterSigTyVarBndrs pass
[sig_body] :: HsSigType pass -> LHsType pass
XHsSigType :: !XXHsSigType pass -> HsSigType pass
-- | Located Haskell Signature Type
type LHsSigType pass = XRec pass (HsSigType pass)
-- | Located Haskell Signature Wildcard Type
type LHsSigWcType pass = HsWildCardBndrs pass (LHsSigType pass)
-- | Located Haskell Wildcard Type
type LHsWcType pass = HsWildCardBndrs pass (LHsType pass)
-- | Haskell Tuple Sort
data HsTupleSort
HsUnboxedTuple :: HsTupleSort
HsBoxedOrConstraintTuple :: HsTupleSort
-- | Haskell Context
type HsContext pass = [LHsType pass]
-- | Located Haskell Context
type LHsContext pass = XRec pass (HsContext pass) " 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnUnit' For details on above see Note [exact print annotations] in GHC.Parser.Annotation"
-- | Haskell Type Literal
data HsTyLit
HsNumTy :: SourceText -> Integer -> HsTyLit
HsStrTy :: SourceText -> FastString -> HsTyLit
HsCharTy :: SourceText -> Char -> 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
data HsArg tm ty
HsValArg :: tm -> HsArg tm ty
HsTypeArg :: SrcSpan -> ty -> HsArg tm ty
HsArgPar :: SrcSpan -> HsArg tm ty
numVisibleArgs :: [HsArg tm ty] -> Arity
-- | pprHsArgsApp id fixity args pretty-prints an
-- application of id to args, using the fixity
-- to tell whether id should be printed prefix or infix.
-- Examples:
--
--
-- pprHsArgsApp T Prefix [HsTypeArg Bool, HsValArg Int] = T @Bool Int
-- pprHsArgsApp T Prefix [HsTypeArg Bool, HsArgPar, HsValArg Int] = (T @Bool) Int
-- pprHsArgsApp (++) Infix [HsValArg Char, HsValArg Double] = Char ++ Double
-- pprHsArgsApp (++) Infix [HsValArg Char, HsValArg Double, HsVarArg Ordering] = (Char ++ Double) Ordering
--
pprHsArgsApp :: (OutputableBndr id, Outputable tm, Outputable ty) => id -> LexicalFixity -> [HsArg tm ty] -> SDoc
type LHsTypeArg p = HsArg (LHsType p) (LHsKind p)
-- | Located Bang Type
type LBangType pass = XRec pass (BangType pass)
-- | Bang Type
--
-- In the parser, strictness and packedness annotations bind more tightly
-- than docstrings. This means that when consuming a BangType (and
-- looking for HsBangTy) we must be ready to peer behind a
-- potential layer of HsDocTy. See #15206 for motivation and
-- getBangType for an example.
type BangType pass = HsType pass
-- | 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, or one with an unlifted type
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
-- | Constructor Declaration Field
data ConDeclField pass
-- |
ConDeclField :: XConDeclField pass -> [LFieldOcc pass] -> LBangType pass -> Maybe (LHsDoc pass) -> ConDeclField pass
[cd_fld_ext] :: ConDeclField pass -> XConDeclField pass
-- | See Note [ConDeclField passs]
[cd_fld_names] :: ConDeclField pass -> [LFieldOcc pass]
[cd_fld_type] :: ConDeclField pass -> LBangType pass
[cd_fld_doc] :: ConDeclField pass -> Maybe (LHsDoc pass)
XConDeclField :: !XXConDeclField pass -> ConDeclField pass
-- | Located Constructor Declaration Field
type LConDeclField pass = XRec pass (ConDeclField pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when in a list"
-- | Describes the arguments to a data constructor. This is a common
-- representation for several constructor-related concepts, including:
--
--
-- - The arguments in a Haskell98-style constructor declaration (see
-- HsConDeclH98Details in GHC.Hs.Decls).
-- - The arguments in constructor patterns in case/function
-- definitions (see HsConPatDetails in GHC.Hs.Pat).
-- - The left-hand side arguments in a pattern synonym binding (see
-- HsPatSynDetails in GHC.Hs.Binds).
--
--
-- One notable exception is the arguments in a GADT constructor, which
-- uses a separate data type entirely (see HsConDeclGADTDetails
-- in GHC.Hs.Decls). This is because GADT constructors cannot be
-- declared with infix syntax, unlike the concepts above (#18844).
data HsConDetails tyarg arg rec
PrefixCon :: [tyarg] -> [arg] -> HsConDetails tyarg arg rec
RecCon :: rec -> HsConDetails tyarg arg rec
InfixCon :: arg -> arg -> HsConDetails tyarg arg rec
-- | An empty list that can be used to indicate that there are no type
-- arguments allowed in cases where HsConDetails is applied to Void.
noTypeArgs :: [Void]
-- | Field Occurrence
--
-- Represents an *occurrence* of a field. This may or may not be a
-- binding occurrence (e.g. this type is used in ConDeclField and
-- RecordPatSynField which bind their fields, but also in
-- HsRecField for record construction and patterns, which do
-- not).
--
-- We store both the RdrName the user originally wrote, and after
-- the renamer we use the extension field to store the selector function.
data FieldOcc pass
FieldOcc :: XCFieldOcc pass -> XRec pass RdrName -> FieldOcc pass
[foExt] :: FieldOcc pass -> XCFieldOcc pass
[foLabel] :: FieldOcc pass -> XRec pass RdrName
XFieldOcc :: !XXFieldOcc pass -> FieldOcc pass
-- | Located Field Occurrence
type LFieldOcc pass = XRec pass (FieldOcc pass)
-- | 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 GHC.Hs.Pat. See Note
-- [Located RdrNames] in GHC.Hs.Expr.
data AmbiguousFieldOcc pass
Unambiguous :: XUnambiguous pass -> LocatedN RdrName -> AmbiguousFieldOcc pass
Ambiguous :: XAmbiguous pass -> LocatedN RdrName -> AmbiguousFieldOcc pass
XAmbiguousFieldOcc :: !XXAmbiguousFieldOcc pass -> AmbiguousFieldOcc pass
-- | Located Ambiguous Field Occurence
type LAmbiguousFieldOcc pass = XRec pass (AmbiguousFieldOcc pass)
mapHsOuterImplicit :: (XHsOuterImplicit pass -> XHsOuterImplicit pass) -> HsOuterTyVarBndrs flag pass -> HsOuterTyVarBndrs flag pass
hsQTvExplicit :: LHsQTyVars pass -> [LHsTyVarBndr () pass]
-- | Does this HsTyVarBndr come with an explicit kind annotation?
isHsKindedTyVar :: HsTyVarBndr flag pass -> Bool
hsPatSigType :: HsPatSigType pass -> LHsType pass
instance Data.Data.Data Language.Haskell.Syntax.Type.HsPSRn
instance Data.Data.Data Language.Haskell.Syntax.Type.HsIPName
instance GHC.Classes.Eq Language.Haskell.Syntax.Type.HsIPName
instance Data.Data.Data Language.Haskell.Syntax.Type.HsTyLit
instance Data.Data.Data Language.Haskell.Syntax.Type.HsTupleSort
instance (Data.Data.Data tyarg, Data.Data.Data arg, Data.Data.Data rec) => Data.Data.Data (Language.Haskell.Syntax.Type.HsConDetails tyarg arg rec)
instance (GHC.Classes.Eq (Language.Haskell.Syntax.Extension.XRec pass GHC.Types.Name.Reader.RdrName), GHC.Classes.Eq (Language.Haskell.Syntax.Extension.XCFieldOcc pass), GHC.Classes.Eq (Language.Haskell.Syntax.Extension.XXFieldOcc pass)) => GHC.Classes.Eq (Language.Haskell.Syntax.Type.FieldOcc pass)
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec pass GHC.Types.Name.Reader.RdrName) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.FieldOcc pass)
instance (Language.Haskell.Syntax.Extension.UnXRec pass, GHC.Utils.Outputable.OutputableBndr (Language.Haskell.Syntax.Extension.XRec pass GHC.Types.Name.Reader.RdrName)) => GHC.Utils.Outputable.OutputableBndr (Language.Haskell.Syntax.Type.FieldOcc pass)
instance (Language.Haskell.Syntax.Extension.UnXRec pass, GHC.Utils.Outputable.OutputableBndr (Language.Haskell.Syntax.Extension.XRec pass GHC.Types.Name.Reader.RdrName)) => GHC.Utils.Outputable.OutputableBndr (GHC.Types.SrcLoc.GenLocated GHC.Types.SrcLoc.SrcSpan (Language.Haskell.Syntax.Type.FieldOcc pass))
instance (GHC.Utils.Outputable.Outputable tm, GHC.Utils.Outputable.Outputable ty) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsArg tm ty)
instance (GHC.Utils.Outputable.Outputable tyarg, GHC.Utils.Outputable.Outputable arg, GHC.Utils.Outputable.Outputable rec) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsConDetails tyarg arg rec)
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Type.HsTyLit
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Type.HsIPName
instance GHC.Utils.Outputable.OutputableBndr Language.Haskell.Syntax.Type.HsIPName
module Language.Haskell.Syntax.Pat
-- | Pattern
--
--
data Pat p
-- | Wildcard Pattern The sole reason for a type on a WildPat is to support
-- hsPatType :: Pat Id -> Type
WildPat :: XWildPat p -> Pat p
-- | Variable Pattern
VarPat :: XVarPat p -> LIdP p -> Pat p
-- | Lazy Pattern ^ - AnnKeywordId : AnnTilde
LazyPat :: XLazyPat p -> LPat p -> Pat p
-- | As pattern ^ - AnnKeywordId : AnnAt
AsPat :: XAsPat p -> LIdP p -> LPat p -> Pat p
ParPat :: XParPat p -> !LHsToken "(" p -> LPat p -> !LHsToken ")" p -> Pat p
-- | Bang pattern ^ - AnnKeywordId : AnnBang
BangPat :: XBangPat p -> LPat p -> Pat p
-- | Syntactic List
--
--
ListPat :: XListPat p -> [LPat p] -> Pat p
-- | Tuple sub-patterns
--
--
TuplePat :: XTuplePat p -> [LPat p] -> Boxity -> Pat p
-- | Anonymous sum pattern
--
--
SumPat :: XSumPat p -> LPat p -> ConTag -> Arity -> Pat p
-- | Constructor Pattern
ConPat :: XConPat p -> XRec p (ConLikeP p) -> HsConPatDetails p -> Pat p
[pat_con_ext] :: Pat p -> XConPat p
[pat_con] :: Pat p -> XRec p (ConLikeP p)
[pat_args] :: Pat p -> HsConPatDetails p
-- | View Pattern
ViewPat :: XViewPat p -> LHsExpr p -> LPat p -> Pat p
-- | Splice Pattern (Includes quasi-quotes)
SplicePat :: XSplicePat p -> HsSplice p -> Pat p
-- | Literal Pattern Used for *non-overloaded* literal patterns: Int, Int,
-- Char, String, etc.
LitPat :: XLitPat p -> HsLit p -> Pat p
-- | Natural Pattern
--
--
NPat :: XNPat p -> XRec p (HsOverLit p) -> Maybe (SyntaxExpr p) -> SyntaxExpr p -> Pat p
-- | n+k pattern
NPlusKPat :: XNPlusKPat p -> LIdP p -> XRec p (HsOverLit p) -> HsOverLit p -> SyntaxExpr p -> SyntaxExpr p -> Pat p
-- | Pattern with a type signature
SigPat :: XSigPat p -> LPat p -> HsPatSigType (NoGhcTc p) -> Pat p
XPat :: !XXPat p -> Pat p
type LPat p = XRec p (Pat p)
type family ConLikeP x
-- | Haskell Constructor Pattern Details
type HsConPatDetails p = HsConDetails (HsPatSigType (NoGhcTc p)) (LPat p) (HsRecFields p (LPat p))
hsConPatArgs :: forall p. UnXRec p => HsConPatDetails p -> [LPat p]
-- | Haskell Record Fields
--
-- HsRecFields is used only for patterns and expressions (not data type
-- declarations)
data HsRecFields p arg
HsRecFields :: [LHsRecField p arg] -> Maybe (Located Int) -> HsRecFields p arg
[rec_flds] :: HsRecFields p arg -> [LHsRecField p arg]
[rec_dotdot] :: HsRecFields p arg -> Maybe (Located Int)
-- | Haskell Field Binding
--
--
--
-- For details on above see Note [exact print annotations] in
-- GHC.Parser.Annotation
data HsFieldBind lhs rhs
HsFieldBind :: XHsFieldBind lhs -> lhs -> rhs -> Bool -> HsFieldBind lhs rhs
[hfbAnn] :: HsFieldBind lhs rhs -> XHsFieldBind lhs
[hfbLHS] :: HsFieldBind lhs rhs -> lhs
-- | Filled in by renamer when punning
[hfbRHS] :: HsFieldBind lhs rhs -> rhs
-- | Note [Punning]
[hfbPun] :: HsFieldBind lhs rhs -> Bool
-- | Located Haskell Record Field
type LHsFieldBind p id arg = XRec p (HsFieldBind id arg)
-- | Haskell Record Field
type HsRecField p arg = HsFieldBind (LFieldOcc p) arg
-- | Located Haskell Record Field
type LHsRecField p arg = XRec p (HsRecField p arg)
-- | Haskell Record Update Field
type HsRecUpdField p = HsFieldBind (LAmbiguousFieldOcc p) (LHsExpr p)
-- | Located Haskell Record Update Field
type LHsRecUpdField p = XRec p (HsRecUpdField p)
hsRecFields :: forall p arg. UnXRec p => HsRecFields p arg -> [XCFieldOcc p]
hsRecFieldSel :: forall p arg. UnXRec p => HsRecField p arg -> XCFieldOcc p
hsRecFieldsArgs :: forall p arg. UnXRec p => HsRecFields p arg -> [arg]
instance Data.Traversable.Traversable (Language.Haskell.Syntax.Pat.HsFieldBind lhs)
instance Data.Foldable.Foldable (Language.Haskell.Syntax.Pat.HsFieldBind lhs)
instance GHC.Base.Functor (Language.Haskell.Syntax.Pat.HsFieldBind lhs)
instance (GHC.Utils.Outputable.Outputable arg, GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec p (Language.Haskell.Syntax.Pat.HsRecField p arg))) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Pat.HsRecFields p arg)
instance (GHC.Utils.Outputable.Outputable p, GHC.Utils.Outputable.OutputableBndr p, GHC.Utils.Outputable.Outputable arg) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Pat.HsFieldBind p arg)
module Language.Haskell.Syntax.Binds
-- | Haskell Local Bindings
type HsLocalBinds id = HsLocalBindsLR id id
-- | Located Haskell local bindings
type LHsLocalBinds id = XRec id (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 :: XHsValBinds idL idR -> HsValBindsLR idL idR -> HsLocalBindsLR idL idR
-- | Haskell Implicit Parameter Bindings
HsIPBinds :: XHsIPBinds idL idR -> HsIPBinds idR -> HsLocalBindsLR idL idR
-- | Empty Local Bindings
EmptyLocalBinds :: XEmptyLocalBinds idL idR -> HsLocalBindsLR idL idR
XHsLocalBindsLR :: !XXHsLocalBindsLR idL idR -> HsLocalBindsLR idL idR
type LHsLocalBindsLR idL idR = XRec idL (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
ValBinds :: XValBinds idL idR -> 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.
XValBindsLR :: !XXValBindsLR idL idR -> 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 = XRec idL (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 [FunBind
-- vs PatBind] for details about the relationship between FunBind and
-- PatBind.
--
-- AnnKeywordIds
--
--
FunBind :: XFunBind idL idR -> LIdP idL -> MatchGroup idR (LHsExpr idR) -> [CoreTickish] -> HsBindLR idL idR
[fun_ext] :: HsBindLR idL idR -> XFunBind idL idR
[fun_id] :: HsBindLR idL idR -> LIdP idL
-- | The payload
[fun_matches] :: HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
-- | Ticks to put on the rhs, if any
[fun_tick] :: HsBindLR idL idR -> [CoreTickish]
-- | Pattern Binding
--
-- The pattern is never a simple variable; That case is done by FunBind.
-- See Note [FunBind vs PatBind] for details about the relationship
-- between FunBind and PatBind.
PatBind :: XPatBind idL idR -> LPat idL -> GRHSs idR (LHsExpr idR) -> ([CoreTickish], [[CoreTickish]]) -> HsBindLR idL idR
[pat_ext] :: HsBindLR idL idR -> XPatBind idL idR
[pat_lhs] :: HsBindLR idL idR -> LPat idL
[pat_rhs] :: HsBindLR idL idR -> GRHSs idR (LHsExpr idR)
-- | Ticks to put on the rhs, if any, and ticks to put on the bound
-- variables.
[pat_ticks] :: HsBindLR idL idR -> ([CoreTickish], [[CoreTickish]])
-- | Variable Binding
--
-- Dictionary binding and suchlike. All VarBinds are introduced by the
-- type checker
VarBind :: XVarBind idL idR -> IdP idL -> LHsExpr idR -> HsBindLR idL idR
[var_ext] :: HsBindLR idL idR -> XVarBind idL idR
[var_id] :: HsBindLR idL idR -> IdP idL
-- | Located only for consistency
[var_rhs] :: HsBindLR idL idR -> LHsExpr idR
-- |
PatSynBind :: XPatSynBind idL idR -> PatSynBind idL idR -> HsBindLR idL idR
XHsBindsLR :: !XXHsBindsLR idL idR -> HsBindLR idL idR
-- |
--
-- Pattern Synonym binding
data PatSynBind idL idR
PSB :: XPSB idL idR -> LIdP idL -> HsPatSynDetails idR -> LPat idR -> HsPatSynDir idR -> PatSynBind idL idR
[psb_ext] :: PatSynBind idL idR -> XPSB idL idR
-- | Name of the pattern synonym
[psb_id] :: PatSynBind idL idR -> LIdP idL
-- | Formal parameter names
[psb_args] :: PatSynBind idL idR -> HsPatSynDetails idR
-- | Right-hand side
[psb_def] :: PatSynBind idL idR -> LPat idR
-- | Directionality
[psb_dir] :: PatSynBind idL idR -> HsPatSynDir idR
XPatSynBind :: !XXPatSynBind idL idR -> PatSynBind idL idR
-- | Haskell Implicit Parameter Bindings
data HsIPBinds id
IPBinds :: XIPBinds id -> [LIPBind id] -> HsIPBinds id
XHsIPBinds :: !XXHsIPBinds id -> HsIPBinds id
-- | Located Implicit Parameter Binding
--
-- May have AnnKeywordId : AnnSemi when in a list
type LIPBind id = XRec id (IPBind id)
-- | Implicit parameter bindings.
--
--
data IPBind id
IPBind :: XCIPBind id -> XRec id HsIPName -> LHsExpr id -> IPBind id
XIPBind :: !XXIPBind id -> IPBind id
-- | Located Signature
type LSig pass = XRec pass (Sig pass)
-- | Signatures and pragmas
data Sig pass
-- | An ordinary type signature
--
--
-- f :: Num a => a -> a
--
--
-- After renaming, this list of Names contains the named wildcards
-- brought into scope by this signature. For a signature _ -> _a
-- -> Bool, the renamer will leave the unnamed wildcard
-- _ untouched, and the named wildcard _a is then
-- 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 :: XTypeSig pass -> [LIdP pass] -> LHsSigWcType pass -> Sig pass
-- | A pattern synonym type signature
--
--
-- pattern Single :: () => (Show a) => a -> [a]
--
--
--
PatSynSig :: XPatSynSig pass -> [LIdP pass] -> LHsSigType pass -> Sig pass
-- | 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 :: XClassOpSig pass -> Bool -> [LIdP pass] -> LHsSigType pass -> Sig pass
-- | 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 :: XIdSig pass -> Id -> Sig pass
-- | An ordinary fixity declaration
--
--
-- infixl 8 ***
--
--
--
FixSig :: XFixSig pass -> FixitySig pass -> Sig pass
-- | An inline pragma
--
--
-- {#- INLINE f #-}
--
--
--
InlineSig :: XInlineSig pass -> LIdP pass -> InlinePragma -> Sig pass
-- | A specialisation pragma
--
--
-- {-# SPECIALISE f :: Int -> Int #-}
--
--
--
SpecSig :: XSpecSig pass -> LIdP pass -> [LHsSigType pass] -> InlinePragma -> Sig pass
-- | A specialisation pragma for instance declarations only
--
--
-- {-# SPECIALISE instance Eq [Int] #-}
--
--
-- (Class tys); should be a specialisation of the current instance
-- declaration
--
--
SpecInstSig :: XSpecInstSig pass -> SourceText -> LHsSigType pass -> Sig pass
-- | A minimal complete definition pragma
--
--
-- {-# MINIMAL a | (b, c | (d | e)) #-}
--
--
--
MinimalSig :: XMinimalSig pass -> SourceText -> LBooleanFormula (LIdP pass) -> Sig pass
-- | A "set cost centre" pragma for declarations
--
--
-- {-# SCC funName #-}
--
--
-- or
--
--
-- {-# SCC funName "cost_centre_name" #-}
--
SCCFunSig :: XSCCFunSig pass -> SourceText -> LIdP pass -> Maybe (XRec pass StringLiteral) -> Sig pass
-- | 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 :: XCompleteMatchSig pass -> SourceText -> XRec pass [LIdP pass] -> Maybe (LIdP pass) -> Sig pass
XSig :: !XXSig pass -> Sig pass
-- | Located Fixity Signature
type LFixitySig pass = XRec pass (FixitySig pass)
-- | Fixity Signature
data FixitySig pass
FixitySig :: XFixitySig pass -> [LIdP pass] -> Fixity -> FixitySig pass
XFixitySig :: !XXFixitySig pass -> FixitySig pass
isFixityLSig :: forall p. UnXRec p => LSig p -> Bool
isTypeLSig :: forall p. UnXRec p => LSig p -> Bool
isSpecLSig :: forall p. UnXRec p => LSig p -> Bool
isSpecInstLSig :: forall p. UnXRec p => LSig p -> Bool
isPragLSig :: forall p. UnXRec p => LSig p -> Bool
isInlineLSig :: forall p. UnXRec p => LSig p -> Bool
isMinimalLSig :: forall p. UnXRec p => LSig p -> Bool
isSCCFunSig :: forall p. UnXRec p => LSig p -> Bool
isCompleteMatchSig :: forall p. UnXRec p => LSig p -> Bool
hsSigDoc :: Sig name -> SDoc
-- | Extracts the name for a SPECIALIZE instance pragma. In
-- hsSigDoc, the src field of SpecInstSig signature
-- contains the SourceText for a SPECIALIZE instance pragma of the form:
-- "SourceText {-# SPECIALIZE"
--
-- Extraction ensures that all variants of the pragma name (with a
-- Z or an S) are output exactly as used in the pragma.
extractSpecPragName :: SourceText -> String
-- | Haskell Pattern Synonym Details
type HsPatSynDetails pass = HsConDetails Void (LIdP pass) [RecordPatSynField pass]
-- | Record Pattern Synonym Field
data RecordPatSynField pass
RecordPatSynField :: FieldOcc pass -> LIdP pass -> RecordPatSynField pass
-- | Field label visible in rest of the file
[recordPatSynField] :: RecordPatSynField pass -> FieldOcc pass
-- | Filled in by renamer, the name used internally by the pattern
[recordPatSynPatVar] :: RecordPatSynField pass -> LIdP pass
-- | Haskell Pattern Synonym Direction
data HsPatSynDir id
Unidirectional :: HsPatSynDir id
ImplicitBidirectional :: HsPatSynDir id
ExplicitBidirectional :: MatchGroup id (LHsExpr id) -> HsPatSynDir id
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec a GHC.Types.Name.Reader.RdrName) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.RecordPatSynField a)
-- | Abstract syntax of global declarations.
--
-- Definitions for: SynDecl and ConDecl,
-- ClassDecl, InstDecl, DefaultDecl and
-- ForeignDecl.
module Language.Haskell.Syntax.Decls
-- | A Haskell Declaration
data HsDecl p
-- | Type or Class Declaration
TyClD :: XTyClD p -> TyClDecl p -> HsDecl p
-- | Instance declaration
InstD :: XInstD p -> InstDecl p -> HsDecl p
-- | Deriving declaration
DerivD :: XDerivD p -> DerivDecl p -> HsDecl p
-- | Value declaration
ValD :: XValD p -> HsBind p -> HsDecl p
-- | Signature declaration
SigD :: XSigD p -> Sig p -> HsDecl p
-- | Standalone kind signature
KindSigD :: XKindSigD p -> StandaloneKindSig p -> HsDecl p
-- | 'default' declaration
DefD :: XDefD p -> DefaultDecl p -> HsDecl p
-- | Foreign declaration
ForD :: XForD p -> ForeignDecl p -> HsDecl p
-- | Warning declaration
WarningD :: XWarningD p -> WarnDecls p -> HsDecl p
-- | Annotation declaration
AnnD :: XAnnD p -> AnnDecl p -> HsDecl p
-- | Rule declaration
RuleD :: XRuleD p -> RuleDecls p -> HsDecl p
-- | Splice declaration (Includes quasi-quotes)
SpliceD :: XSpliceD p -> SpliceDecl p -> HsDecl p
-- | Documentation comment declaration
DocD :: XDocD p -> DocDecl p -> HsDecl p
-- | Role annotation declaration
RoleAnnotD :: XRoleAnnotD p -> RoleAnnotDecl p -> HsDecl p
XHsDecl :: !XXHsDecl p -> HsDecl p
type LHsDecl p = XRec p (HsDecl p) " When in a list this may have - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' "
-- | Haskell Data type Definition
data HsDataDefn pass
-- | Declares a data type or newtype, giving its constructors
-- data/newtype T a = constrs data/newtype instance T [a] =
-- constrs
HsDataDefn :: XCHsDataDefn pass -> NewOrData -> Maybe (LHsContext pass) -> Maybe (XRec pass CType) -> Maybe (LHsKind pass) -> [LConDecl pass] -> HsDeriving pass -> HsDataDefn pass
[dd_ext] :: HsDataDefn pass -> XCHsDataDefn pass
[dd_ND] :: HsDataDefn pass -> NewOrData
-- | Context
[dd_ctxt] :: HsDataDefn pass -> Maybe (LHsContext pass)
[dd_cType] :: HsDataDefn pass -> Maybe (XRec pass 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 pass -> Maybe (LHsKind pass)
-- | 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 pass -> [LConDecl pass]
-- | Optional 'deriving' clause
[dd_derivs] :: HsDataDefn pass -> HsDeriving pass
XHsDataDefn :: !XXHsDataDefn pass -> HsDataDefn pass
-- | Haskell Deriving clause
type HsDeriving pass = [LHsDerivingClause pass] " 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."
type LHsFunDep pass = XRec pass (FunDep pass)
data FunDep pass
FunDep :: XCFunDep pass -> [LIdP pass] -> [LIdP pass] -> FunDep pass
XFunDep :: !XXFunDep pass -> FunDep pass
-- | A single deriving clause of a data declaration.
--
--
data HsDerivingClause pass
HsDerivingClause :: XCHsDerivingClause pass -> Maybe (LDerivStrategy pass) -> LDerivClauseTys pass -> HsDerivingClause pass
[deriv_clause_ext] :: HsDerivingClause pass -> XCHsDerivingClause pass
-- | The user-specified strategy (if any) to use when deriving
-- deriv_clause_tys.
[deriv_clause_strategy] :: HsDerivingClause pass -> Maybe (LDerivStrategy pass)
-- | The types to derive.
[deriv_clause_tys] :: HsDerivingClause pass -> LDerivClauseTys pass
XHsDerivingClause :: !XXHsDerivingClause pass -> HsDerivingClause pass
type LHsDerivingClause pass = XRec pass (HsDerivingClause pass)
-- | The types mentioned in a single deriving clause. This can
-- come in two forms, DctSingle or DctMulti, depending on
-- whether the types are surrounded by enclosing parentheses or not.
-- These parentheses are semantically different than HsParTy. For
-- example, deriving () means "derive zero classes" rather than
-- "derive an instance of the 0-tuple".
--
-- DerivClauseTys use LHsSigType because deriving
-- clauses 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).
data DerivClauseTys pass
-- | A deriving clause with a single type. Moreover, that type can
-- only be a type constructor without any arguments.
--
-- Example: deriving Eq
DctSingle :: XDctSingle pass -> LHsSigType pass -> DerivClauseTys pass
-- | A deriving clause with a comma-separated list of types,
-- surrounded by enclosing parentheses.
--
-- Example: deriving (Eq, C a)
DctMulti :: XDctMulti pass -> [LHsSigType pass] -> DerivClauseTys pass
XDerivClauseTys :: !XXDerivClauseTys pass -> DerivClauseTys pass
type LDerivClauseTys pass = XRec pass (DerivClauseTys pass)
data NewOrData
-- |
-- newtype Blah ...
--
NewType :: NewOrData
-- |
-- data Blah ...
--
DataType :: NewOrData
-- | Convert a NewOrData to a TyConFlavour
newOrDataToFlavour :: NewOrData -> TyConFlavour
data StandaloneKindSig pass
StandaloneKindSig :: XStandaloneKindSig pass -> LIdP pass -> LHsSigType pass -> StandaloneKindSig pass
XStandaloneKindSig :: !XXStandaloneKindSig pass -> StandaloneKindSig pass
-- | Located Standalone Kind Signature
type LStandaloneKindSig pass = XRec pass (StandaloneKindSig pass)
-- | A type or class declaration.
data TyClDecl pass
-- |
-- type/data family T :: *->*
--
--
--
-- - AnnKeywordId : AnnType, AnnData,
-- AnnFamily,AnnDcolon, AnnWhere,AnnOpenP,
-- AnnDcolon,AnnCloseP, AnnEqual,AnnRarrow,
-- AnnVbar
--
FamDecl :: XFamDecl pass -> FamilyDecl pass -> TyClDecl pass
[tcdFExt] :: TyClDecl pass -> XFamDecl pass
[tcdFam] :: TyClDecl pass -> FamilyDecl pass
-- | type declaration
--
--
SynDecl :: XSynDecl pass -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> LHsType pass -> TyClDecl pass
-- | Post renameer, FVs
[tcdSExt] :: TyClDecl pass -> XSynDecl pass
-- | Type constructor
[tcdLName] :: TyClDecl pass -> LIdP pass
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl pass -> LexicalFixity
[tcdRhs] :: TyClDecl pass -> LHsType pass
-- | data declaration
--
--
DataDecl :: XDataDecl pass -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> HsDataDefn pass -> TyClDecl pass
-- | Post renamer, CUSK flag, FVs
[tcdDExt] :: TyClDecl pass -> XDataDecl pass
-- | Type constructor
[tcdLName] :: TyClDecl pass -> LIdP pass
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl pass -> LexicalFixity
[tcdDataDefn] :: TyClDecl pass -> HsDataDefn pass
-- |
ClassDecl :: XClassDecl pass -> Maybe (LHsContext pass) -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> [LHsFunDep pass] -> [LSig pass] -> LHsBinds pass -> [LFamilyDecl pass] -> [LTyFamDefltDecl pass] -> [LDocDecl pass] -> TyClDecl pass
-- | Post renamer, FVs
[tcdCExt] :: TyClDecl pass -> XClassDecl pass
-- | Context...
[tcdCtxt] :: TyClDecl pass -> Maybe (LHsContext pass)
-- | Type constructor
[tcdLName] :: TyClDecl pass -> LIdP pass
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl pass -> LexicalFixity
-- | Functional deps
[tcdFDs] :: TyClDecl pass -> [LHsFunDep pass]
-- | Methods' signatures
[tcdSigs] :: TyClDecl pass -> [LSig pass]
-- | Default methods
[tcdMeths] :: TyClDecl pass -> LHsBinds pass
-- | Associated types;
[tcdATs] :: TyClDecl pass -> [LFamilyDecl pass]
-- | Associated type defaults
[tcdATDefs] :: TyClDecl pass -> [LTyFamDefltDecl pass]
-- | Haddock docs
[tcdDocs] :: TyClDecl pass -> [LDocDecl pass]
XTyClDecl :: !XXTyClDecl pass -> TyClDecl pass
-- | Located Declaration of a Type or Class
type LTyClDecl pass = XRec pass (TyClDecl pass)
data DataDeclRn
DataDeclRn :: Bool -> NameSet -> DataDeclRn
-- | does this have a CUSK? See Note [CUSKs: complete user-supplied kind
-- signatures]
[tcdDataCusk] :: DataDeclRn -> Bool
[tcdFVs] :: DataDeclRn -> NameSet
-- | Type or Class Group
data TyClGroup pass
TyClGroup :: XCTyClGroup pass -> [LTyClDecl pass] -> [LRoleAnnotDecl pass] -> [LStandaloneKindSig pass] -> [LInstDecl pass] -> TyClGroup pass
[group_ext] :: TyClGroup pass -> XCTyClGroup pass
[group_tyclds] :: TyClGroup pass -> [LTyClDecl pass]
[group_roles] :: TyClGroup pass -> [LRoleAnnotDecl pass]
[group_kisigs] :: TyClGroup pass -> [LStandaloneKindSig pass]
[group_instds] :: TyClGroup pass -> [LInstDecl pass]
XTyClGroup :: !XXTyClGroup pass -> TyClGroup pass
tyClGroupTyClDecls :: [TyClGroup pass] -> [LTyClDecl pass]
tyClGroupInstDecls :: [TyClGroup pass] -> [LInstDecl pass]
tyClGroupRoleDecls :: [TyClGroup pass] -> [LRoleAnnotDecl pass]
tyClGroupKindSigs :: [TyClGroup pass] -> [LStandaloneKindSig pass]
-- | type class
isClassDecl :: TyClDecl pass -> Bool
-- | True = argument is a data/newtype
-- declaration.
isDataDecl :: TyClDecl pass -> Bool
-- | type or type instance declaration
isSynDecl :: TyClDecl pass -> Bool
-- | type/data family declaration
isFamilyDecl :: TyClDecl pass -> Bool
-- | type family declaration
isTypeFamilyDecl :: TyClDecl pass -> Bool
-- | data family declaration
isDataFamilyDecl :: TyClDecl pass -> Bool
-- | open type family info
isOpenTypeFamilyInfo :: FamilyInfo pass -> Bool
-- | closed type family info
isClosedTypeFamilyInfo :: FamilyInfo pass -> Bool
countTyClDecls :: [TyClDecl pass] -> (Int, Int, Int, Int, Int)
tyClDeclTyVars :: TyClDecl pass -> LHsQTyVars pass
-- | type Family Declaration
data FamilyDecl pass
FamilyDecl :: XCFamilyDecl pass -> FamilyInfo pass -> TopLevelFlag -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> LFamilyResultSig pass -> Maybe (LInjectivityAnn pass) -> FamilyDecl pass
[fdExt] :: FamilyDecl pass -> XCFamilyDecl pass
[fdInfo] :: FamilyDecl pass -> FamilyInfo pass
[fdTopLevel] :: FamilyDecl pass -> TopLevelFlag
[fdLName] :: FamilyDecl pass -> LIdP pass
[fdTyVars] :: FamilyDecl pass -> LHsQTyVars pass
[fdFixity] :: FamilyDecl pass -> LexicalFixity
[fdResultSig] :: FamilyDecl pass -> LFamilyResultSig pass
[fdInjectivityAnn] :: FamilyDecl pass -> Maybe (LInjectivityAnn pass)
-- |
XFamilyDecl :: !XXFamilyDecl pass -> FamilyDecl pass
-- | Located type Family Declaration
type LFamilyDecl pass = XRec pass (FamilyDecl pass)
-- | Instance Declaration
data InstDecl pass
ClsInstD :: XClsInstD pass -> ClsInstDecl pass -> InstDecl pass
[cid_d_ext] :: InstDecl pass -> XClsInstD pass
[cid_inst] :: InstDecl pass -> ClsInstDecl pass
DataFamInstD :: XDataFamInstD pass -> DataFamInstDecl pass -> InstDecl pass
[dfid_ext] :: InstDecl pass -> XDataFamInstD pass
[dfid_inst] :: InstDecl pass -> DataFamInstDecl pass
TyFamInstD :: XTyFamInstD pass -> TyFamInstDecl pass -> InstDecl pass
[tfid_ext] :: InstDecl pass -> XTyFamInstD pass
[tfid_inst] :: InstDecl pass -> TyFamInstDecl pass
XInstDecl :: !XXInstDecl pass -> InstDecl pass
-- | Located Instance Declaration
type LInstDecl pass = XRec pass (InstDecl pass)
data FamilyInfo pass
DataFamily :: FamilyInfo pass
OpenTypeFamily :: FamilyInfo pass
-- | Nothing if we're in an hs-boot file and the user said "type
-- family Foo x where .."
ClosedTypeFamily :: Maybe [LTyFamInstEqn pass] -> FamilyInfo pass
pprFlavour :: FamilyInfo pass -> SDoc
-- | Type Family Instance Declaration
data TyFamInstDecl pass
-- |
TyFamInstDecl :: XCTyFamInstDecl pass -> TyFamInstEqn pass -> TyFamInstDecl pass
[tfid_xtn] :: TyFamInstDecl pass -> XCTyFamInstDecl pass
[tfid_eqn] :: TyFamInstDecl pass -> TyFamInstEqn pass
XTyFamInstDecl :: !XXTyFamInstDecl pass -> TyFamInstDecl pass
-- | Located Type Family Instance Declaration
type LTyFamInstDecl pass = XRec pass (TyFamInstDecl pass)
-- | Type family default declarations. A convenient synonym for
-- TyFamInstDecl. See Note [Type family instance declarations
-- in HsSyn].
type TyFamDefltDecl = TyFamInstDecl
-- | Located type family default declarations.
type LTyFamDefltDecl pass = XRec pass (TyFamDefltDecl pass)
-- | Data Family Instance Declaration
newtype DataFamInstDecl pass
-- |
DataFamInstDecl :: FamEqn pass (HsDataDefn pass) -> DataFamInstDecl pass
[dfid_eqn] :: DataFamInstDecl pass -> FamEqn pass (HsDataDefn pass)
-- | Located Data Family Instance Declaration
type LDataFamInstDecl pass = XRec pass (DataFamInstDecl pass)
-- | Family Equation
--
-- One equation in a type family instance declaration, data family
-- instance declaration, or type family default. See Note [Type family
-- instance declarations in HsSyn] See Note [Family instance declaration
-- binders]
data FamEqn pass rhs
-- |
FamEqn :: XCFamEqn pass rhs -> LIdP pass -> HsOuterFamEqnTyVarBndrs pass -> HsTyPats pass -> LexicalFixity -> rhs -> FamEqn pass rhs
[feqn_ext] :: FamEqn pass rhs -> XCFamEqn pass rhs
[feqn_tycon] :: FamEqn pass rhs -> LIdP pass
-- | Optional quantified type vars
[feqn_bndrs] :: FamEqn pass rhs -> HsOuterFamEqnTyVarBndrs pass
[feqn_pats] :: FamEqn pass rhs -> HsTyPats pass
-- | Fixity used in the declaration
[feqn_fixity] :: FamEqn pass rhs -> LexicalFixity
[feqn_rhs] :: FamEqn pass rhs -> rhs
XFamEqn :: !XXFamEqn pass rhs -> FamEqn pass rhs
-- | Type Family Instance Equation
type TyFamInstEqn pass = FamEqn pass (LHsType pass)
-- | Located Type Family Instance Equation
type LTyFamInstEqn pass = XRec pass (TyFamInstEqn pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when in a list"
-- | Haskell Type Patterns
type HsTyPats pass = [LHsTypeArg pass]
-- | Located Class Instance Declaration
type LClsInstDecl pass = XRec pass (ClsInstDecl pass)
-- | Class Instance Declaration - AnnKeywordId : AnnInstance,
-- AnnWhere, AnnOpen,AnnClose, For details on above
-- see Note [exact print annotations] in GHC.Parser.Annotation
data ClsInstDecl pass
ClsInstDecl :: XCClsInstDecl pass -> LHsSigType pass -> LHsBinds pass -> [LSig pass] -> [LTyFamInstDecl pass] -> [LDataFamInstDecl pass] -> Maybe (XRec pass OverlapMode) -> ClsInstDecl pass
[cid_ext] :: ClsInstDecl pass -> XCClsInstDecl pass
[cid_poly_ty] :: ClsInstDecl pass -> LHsSigType pass
[cid_binds] :: ClsInstDecl pass -> LHsBinds pass
[cid_sigs] :: ClsInstDecl pass -> [LSig pass]
[cid_tyfam_insts] :: ClsInstDecl pass -> [LTyFamInstDecl pass]
[cid_datafam_insts] :: ClsInstDecl pass -> [LDataFamInstDecl pass]
-- |
[cid_overlap_mode] :: ClsInstDecl pass -> Maybe (XRec pass OverlapMode)
XClsInstDecl :: !XXClsInstDecl pass -> ClsInstDecl pass
-- | Stand-alone 'deriving instance' declaration
data DerivDecl pass
DerivDecl :: XCDerivDecl pass -> LHsSigWcType pass -> Maybe (LDerivStrategy pass) -> Maybe (XRec pass OverlapMode) -> DerivDecl pass
[deriv_ext] :: DerivDecl pass -> XCDerivDecl pass
-- | The instance type to derive.
--
-- It uses an LHsSigWcType because the context is allowed to be a
-- single wildcard:
--
--
-- deriving instance _ => Eq (Foo a)
--
--
-- Which signifies that the context should be inferred.
[deriv_type] :: DerivDecl pass -> LHsSigWcType pass
[deriv_strategy] :: DerivDecl pass -> Maybe (LDerivStrategy pass)
-- |
[deriv_overlap_mode] :: DerivDecl pass -> Maybe (XRec pass OverlapMode)
XDerivDecl :: !XXDerivDecl pass -> DerivDecl pass
-- | Located stand-alone 'deriving instance' declaration
type LDerivDecl pass = XRec pass (DerivDecl pass)
-- | Which technique the user explicitly requested when deriving an
-- instance.
data DerivStrategy pass
-- | 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 :: XStockStrategy pass -> DerivStrategy pass
-- |
-- -XDeriveAnyClass
--
AnyclassStrategy :: XAnyClassStrategy pass -> DerivStrategy pass
-- |
-- -XGeneralizedNewtypeDeriving
--
NewtypeStrategy :: XNewtypeStrategy pass -> DerivStrategy pass
-- |
-- -XDerivingVia
--
ViaStrategy :: XViaStrategy pass -> DerivStrategy pass
-- | A Located DerivStrategy.
type LDerivStrategy pass = XRec pass (DerivStrategy pass)
-- | A short description of a DerivStrategy'.
derivStrategyName :: DerivStrategy a -> SDoc
-- | Located Rule Declarations
type LRuleDecls pass = XRec pass (RuleDecls pass)
-- | Rule Declarations
data RuleDecls pass
HsRules :: XCRuleDecls pass -> SourceText -> [LRuleDecl pass] -> RuleDecls pass
[rds_ext] :: RuleDecls pass -> XCRuleDecls pass
[rds_src] :: RuleDecls pass -> SourceText
[rds_rules] :: RuleDecls pass -> [LRuleDecl pass]
XRuleDecls :: !XXRuleDecls pass -> RuleDecls pass
-- | Rule Declaration
data RuleDecl pass
-- |
HsRule :: XHsRule pass -> XRec pass (SourceText, RuleName) -> Activation -> Maybe [LHsTyVarBndr () (NoGhcTc pass)] -> [LRuleBndr pass] -> XRec pass (HsExpr pass) -> XRec pass (HsExpr pass) -> RuleDecl pass
-- | After renamer, free-vars from the LHS and RHS
[rd_ext] :: RuleDecl pass -> XHsRule pass
-- | Note [Pragma source text] in GHC.Types.Basic
[rd_name] :: RuleDecl pass -> XRec pass (SourceText, RuleName)
[rd_act] :: RuleDecl pass -> Activation
-- | Forall'd type vars
[rd_tyvs] :: RuleDecl pass -> Maybe [LHsTyVarBndr () (NoGhcTc pass)]
-- | Forall'd term vars, before typechecking; after typechecking this
-- includes all forall'd vars
[rd_tmvs] :: RuleDecl pass -> [LRuleBndr pass]
[rd_lhs] :: RuleDecl pass -> XRec pass (HsExpr pass)
[rd_rhs] :: RuleDecl pass -> XRec pass (HsExpr pass)
XRuleDecl :: !XXRuleDecl pass -> RuleDecl pass
-- | Located Rule Declaration
type LRuleDecl pass = XRec pass (RuleDecl pass)
data HsRuleRn
HsRuleRn :: NameSet -> NameSet -> HsRuleRn
-- | Rule Binder
data RuleBndr pass
RuleBndr :: XCRuleBndr pass -> LIdP pass -> RuleBndr pass
RuleBndrSig :: XRuleBndrSig pass -> LIdP pass -> HsPatSigType pass -> RuleBndr pass
-- |
XRuleBndr :: !XXRuleBndr pass -> RuleBndr pass
-- | Located Rule Binder
type LRuleBndr pass = XRec pass (RuleBndr pass)
collectRuleBndrSigTys :: [RuleBndr pass] -> [HsPatSigType pass]
pprFullRuleName :: GenLocated a (SourceText, RuleName) -> SDoc
-- | Default Declaration
data DefaultDecl pass
-- |
DefaultDecl :: XCDefaultDecl pass -> [LHsType pass] -> DefaultDecl pass
XDefaultDecl :: !XXDefaultDecl pass -> DefaultDecl pass
-- | Located Default Declaration
type LDefaultDecl pass = XRec pass (DefaultDecl pass)
data SpliceExplicitFlag
-- | = $(f x y)
ExplicitSplice :: SpliceExplicitFlag
-- | = f x y, i.e. a naked top level expression
ImplicitSplice :: SpliceExplicitFlag
-- | Splice Declaration
data SpliceDecl p
SpliceDecl :: XSpliceDecl p -> XRec p (HsSplice p) -> SpliceExplicitFlag -> SpliceDecl p
XSpliceDecl :: !XXSpliceDecl p -> SpliceDecl p
-- | Located Splice Declaration
type LSpliceDecl pass = XRec pass (SpliceDecl pass)
-- | Foreign Declaration
data ForeignDecl pass
ForeignImport :: XForeignImport pass -> LIdP pass -> LHsSigType pass -> ForeignImport -> ForeignDecl pass
[fd_i_ext] :: ForeignDecl pass -> XForeignImport pass
[fd_name] :: ForeignDecl pass -> LIdP pass
[fd_sig_ty] :: ForeignDecl pass -> LHsSigType pass
[fd_fi] :: ForeignDecl pass -> ForeignImport
-- |
ForeignExport :: XForeignExport pass -> LIdP pass -> LHsSigType pass -> ForeignExport -> ForeignDecl pass
[fd_e_ext] :: ForeignDecl pass -> XForeignExport pass
[fd_name] :: ForeignDecl pass -> LIdP pass
[fd_sig_ty] :: ForeignDecl pass -> LHsSigType pass
[fd_fe] :: ForeignDecl pass -> ForeignExport
XForeignDecl :: !XXForeignDecl pass -> ForeignDecl pass
-- | Located Foreign Declaration
type LForeignDecl pass = XRec pass (ForeignDecl pass)
data ForeignImport
CImport :: Located CCallConv -> Located Safety -> Maybe Header -> CImportSpec -> Located SourceText -> ForeignImport
data ForeignExport
CExport :: Located CExportSpec -> Located SourceText -> ForeignExport
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 pass
ConDeclGADT :: XConDeclGADT pass -> [LIdP pass] -> XRec pass (HsOuterSigTyVarBndrs pass) -> Maybe (LHsContext pass) -> HsConDeclGADTDetails pass -> LHsType pass -> Maybe (LHsDoc pass) -> ConDecl pass
[con_g_ext] :: ConDecl pass -> XConDeclGADT pass
[con_names] :: ConDecl pass -> [LIdP pass]
-- | The outermost type variable binders, be they explicit or implicit. The
-- XRec is used to anchor exact print annotations, AnnForall and
-- AnnDot.
[con_bndrs] :: ConDecl pass -> XRec pass (HsOuterSigTyVarBndrs pass)
-- | User-written context (if any)
[con_mb_cxt] :: ConDecl pass -> Maybe (LHsContext pass)
-- | Arguments; never infix
[con_g_args] :: ConDecl pass -> HsConDeclGADTDetails pass
-- | Result type
[con_res_ty] :: ConDecl pass -> LHsType pass
-- | A possible Haddock comment.
[con_doc] :: ConDecl pass -> Maybe (LHsDoc pass)
ConDeclH98 :: XConDeclH98 pass -> LIdP pass -> Bool -> [LHsTyVarBndr Specificity pass] -> Maybe (LHsContext pass) -> HsConDeclH98Details pass -> Maybe (LHsDoc pass) -> ConDecl pass
[con_ext] :: ConDecl pass -> XConDeclH98 pass
[con_name] :: ConDecl pass -> LIdP pass
-- | True = explicit user-written forall e.g. data T a = forall b.
-- MkT b (b->a) con_ex_tvs = {b} False => con_ex_tvs is empty
[con_forall] :: ConDecl pass -> Bool
-- | Existentials only
[con_ex_tvs] :: ConDecl pass -> [LHsTyVarBndr Specificity pass]
-- | User-written context (if any)
[con_mb_cxt] :: ConDecl pass -> Maybe (LHsContext pass)
-- | Arguments; can be infix
[con_args] :: ConDecl pass -> HsConDeclH98Details pass
-- | A possible Haddock comment.
[con_doc] :: ConDecl pass -> Maybe (LHsDoc pass)
XConDecl :: !XXConDecl pass -> ConDecl pass
-- | Located data Constructor Declaration
type LConDecl pass = XRec pass (ConDecl pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when in a GADT constructor list"
-- | The arguments in a Haskell98-style data constructor.
type HsConDeclH98Details pass = HsConDetails Void (HsScaled pass (LBangType pass)) (XRec pass [LConDeclField pass])
-- | The arguments in a GADT constructor. Unlike Haskell98-style
-- constructors, GADT constructors cannot be declared with infix syntax.
-- As a result, we do not use HsConDetails here, as
-- InfixCon would be an unrepresentable state. (There is a notion
-- of infix GADT constructors for the purposes of derived Show
-- instances—see Note [Infix GADT constructors] in GHC.Tc.TyCl—but that
-- is an orthogonal concern.)
data HsConDeclGADTDetails pass
PrefixConGADT :: [HsScaled pass (LBangType pass)] -> HsConDeclGADTDetails pass
RecConGADT :: XRec pass [LConDeclField pass] -> LHsUniToken "->" "\8594" pass -> HsConDeclGADTDetails pass
-- | Documentation comment Declaration
data DocDecl pass
DocCommentNext :: LHsDoc pass -> DocDecl pass
DocCommentPrev :: LHsDoc pass -> DocDecl pass
DocCommentNamed :: String -> LHsDoc pass -> DocDecl pass
DocGroup :: Int -> LHsDoc pass -> DocDecl pass
-- | Located Documentation comment Declaration
type LDocDecl pass = XRec pass (DocDecl pass)
docDeclDoc :: DocDecl pass -> LHsDoc pass
-- | Warning pragma Declaration
data WarnDecl pass
Warning :: XWarning pass -> [LIdP pass] -> WarningTxt pass -> WarnDecl pass
XWarnDecl :: !XXWarnDecl pass -> WarnDecl pass
-- | Located Warning pragma Declaration
type LWarnDecl pass = XRec pass (WarnDecl pass)
-- | Warning pragma Declarations
data WarnDecls pass
Warnings :: XWarnings pass -> SourceText -> [LWarnDecl pass] -> WarnDecls pass
[wd_ext] :: WarnDecls pass -> XWarnings pass
[wd_src] :: WarnDecls pass -> SourceText
[wd_warnings] :: WarnDecls pass -> [LWarnDecl pass]
XWarnDecls :: !XXWarnDecls pass -> WarnDecls pass
-- | Located Warning Declarations
type LWarnDecls pass = XRec pass (WarnDecls pass)
-- | Annotation Declaration
data AnnDecl pass
-- |
HsAnnotation :: XHsAnnotation pass -> SourceText -> AnnProvenance pass -> XRec pass (HsExpr pass) -> AnnDecl pass
XAnnDecl :: !XXAnnDecl pass -> AnnDecl pass
-- | Located Annotation Declaration
type LAnnDecl pass = XRec pass (AnnDecl pass)
-- | Annotation Provenance
data AnnProvenance pass
ValueAnnProvenance :: LIdP pass -> AnnProvenance pass
TypeAnnProvenance :: LIdP pass -> AnnProvenance pass
ModuleAnnProvenance :: AnnProvenance pass
annProvenanceName_maybe :: forall p. UnXRec p => AnnProvenance p -> Maybe (IdP p)
-- | Role Annotation Declaration
data RoleAnnotDecl pass
-- |
RoleAnnotDecl :: XCRoleAnnotDecl pass -> LIdP pass -> [XRec pass (Maybe Role)] -> RoleAnnotDecl pass
XRoleAnnotDecl :: !XXRoleAnnotDecl pass -> RoleAnnotDecl pass
-- | Located Role Annotation Declaration
type LRoleAnnotDecl pass = XRec pass (RoleAnnotDecl pass)
-- | type Family Result Signature
data FamilyResultSig pass
-- |
NoSig :: XNoSig pass -> FamilyResultSig pass
-- |
KindSig :: XCKindSig pass -> LHsKind pass -> FamilyResultSig pass
-- |
TyVarSig :: XTyVarSig pass -> LHsTyVarBndr () pass -> FamilyResultSig pass
XFamilyResultSig :: !XXFamilyResultSig pass -> FamilyResultSig pass
-- | Located type Family Result Signature
type LFamilyResultSig pass = XRec pass (FamilyResultSig pass)
-- | 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 pass
-- |
InjectivityAnn :: XCInjectivityAnn pass -> LIdP pass -> [LIdP pass] -> InjectivityAnn pass
XInjectivityAnn :: !XXInjectivityAnn pass -> InjectivityAnn pass
-- | Located Injectivity Annotation
type LInjectivityAnn pass = XRec pass (InjectivityAnn pass)
-- | Haskell Group
--
-- A HsDecl is categorised into a HsGroup before being fed
-- to the renamer.
data HsGroup p
HsGroup :: XCHsGroup p -> HsValBinds p -> [LSpliceDecl p] -> [TyClGroup p] -> [LDerivDecl p] -> [LFixitySig p] -> [LDefaultDecl p] -> [LForeignDecl p] -> [LWarnDecls p] -> [LAnnDecl p] -> [LRuleDecls p] -> [LDocDecl p] -> HsGroup p
[hs_ext] :: HsGroup p -> XCHsGroup p
[hs_valds] :: HsGroup p -> HsValBinds p
[hs_splcds] :: HsGroup p -> [LSpliceDecl p]
[hs_tyclds] :: HsGroup p -> [TyClGroup p]
[hs_derivds] :: HsGroup p -> [LDerivDecl p]
[hs_fixds] :: HsGroup p -> [LFixitySig p]
[hs_defds] :: HsGroup p -> [LDefaultDecl p]
[hs_fords] :: HsGroup p -> [LForeignDecl p]
[hs_warnds] :: HsGroup p -> [LWarnDecls p]
[hs_annds] :: HsGroup p -> [LAnnDecl p]
[hs_ruleds] :: HsGroup p -> [LRuleDecls p]
[hs_docs] :: HsGroup p -> [LDocDecl p]
XHsGroup :: !XXHsGroup p -> HsGroup p
hsGroupInstDecls :: HsGroup id -> [LInstDecl id]
instance Data.Data.Data Language.Haskell.Syntax.Decls.DataDeclRn
instance Data.Data.Data Language.Haskell.Syntax.Decls.NewOrData
instance GHC.Classes.Eq Language.Haskell.Syntax.Decls.NewOrData
instance Data.Data.Data Language.Haskell.Syntax.Decls.CImportSpec
instance Data.Data.Data Language.Haskell.Syntax.Decls.ForeignImport
instance Data.Data.Data Language.Haskell.Syntax.Decls.ForeignExport
instance Data.Data.Data Language.Haskell.Syntax.Decls.HsRuleRn
instance (Data.Data.Data pass, Data.Data.Data (Language.Haskell.Syntax.Extension.IdP pass)) => Data.Data.Data (Language.Haskell.Syntax.Decls.DocDecl pass)
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.DocDecl name)
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Decls.ForeignExport
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Decls.ForeignImport
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.FamilyInfo pass)
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Decls.NewOrData
-- | Language extensions known to GHC
module Language.Haskell.TH.LanguageExtensions
-- | The language extensions known to GHC.
--
-- Note that there is an orphan Binary instance for this type
-- supplied by the GHC.LanguageExtensions module provided by
-- ghc-boot. We can't provide here as this would require adding
-- transitive dependencies to the template-haskell package,
-- which must have a minimal dependency set.
data Extension
Cpp :: Extension
OverlappingInstances :: Extension
UndecidableInstances :: Extension
IncoherentInstances :: Extension
UndecidableSuperClasses :: Extension
MonomorphismRestriction :: Extension
MonoLocalBinds :: Extension
RelaxedPolyRec :: Extension
ExtendedDefaultRules :: Extension
ForeignFunctionInterface :: Extension
UnliftedFFITypes :: Extension
InterruptibleFFI :: Extension
CApiFFI :: Extension
GHCForeignImportPrim :: Extension
JavaScriptFFI :: Extension
ParallelArrays :: Extension
Arrows :: Extension
TemplateHaskell :: Extension
TemplateHaskellQuotes :: Extension
QualifiedDo :: Extension
QuasiQuotes :: Extension
ImplicitParams :: Extension
ImplicitPrelude :: Extension
ScopedTypeVariables :: Extension
AllowAmbiguousTypes :: Extension
UnboxedTuples :: Extension
UnboxedSums :: Extension
UnliftedNewtypes :: Extension
UnliftedDatatypes :: Extension
BangPatterns :: Extension
TypeFamilies :: Extension
TypeFamilyDependencies :: Extension
TypeInType :: Extension
OverloadedStrings :: Extension
OverloadedLists :: Extension
NumDecimals :: Extension
DisambiguateRecordFields :: Extension
RecordWildCards :: Extension
NamedFieldPuns :: Extension
ViewPatterns :: Extension
GADTs :: Extension
GADTSyntax :: Extension
NPlusKPatterns :: Extension
DoAndIfThenElse :: Extension
BlockArguments :: Extension
RebindableSyntax :: Extension
ConstraintKinds :: Extension
PolyKinds :: Extension
DataKinds :: Extension
InstanceSigs :: Extension
ApplicativeDo :: Extension
LinearTypes :: Extension
StandaloneDeriving :: Extension
DeriveDataTypeable :: Extension
AutoDeriveTypeable :: Extension
DeriveFunctor :: Extension
DeriveTraversable :: Extension
DeriveFoldable :: Extension
DeriveGeneric :: Extension
DefaultSignatures :: Extension
DeriveAnyClass :: Extension
DeriveLift :: Extension
DerivingStrategies :: Extension
DerivingVia :: Extension
TypeSynonymInstances :: Extension
FlexibleContexts :: Extension
FlexibleInstances :: Extension
ConstrainedClassMethods :: Extension
MultiParamTypeClasses :: Extension
NullaryTypeClasses :: Extension
FunctionalDependencies :: Extension
UnicodeSyntax :: Extension
ExistentialQuantification :: Extension
MagicHash :: Extension
EmptyDataDecls :: Extension
KindSignatures :: Extension
RoleAnnotations :: Extension
ParallelListComp :: Extension
TransformListComp :: Extension
MonadComprehensions :: Extension
GeneralizedNewtypeDeriving :: Extension
RecursiveDo :: Extension
PostfixOperators :: Extension
TupleSections :: Extension
PatternGuards :: Extension
LiberalTypeSynonyms :: Extension
RankNTypes :: Extension
ImpredicativeTypes :: Extension
TypeOperators :: Extension
ExplicitNamespaces :: Extension
PackageImports :: Extension
ExplicitForAll :: Extension
AlternativeLayoutRule :: Extension
AlternativeLayoutRuleTransitional :: Extension
DatatypeContexts :: Extension
NondecreasingIndentation :: Extension
RelaxedLayout :: Extension
TraditionalRecordSyntax :: Extension
LambdaCase :: Extension
MultiWayIf :: Extension
BinaryLiterals :: Extension
NegativeLiterals :: Extension
HexFloatLiterals :: Extension
DuplicateRecordFields :: Extension
OverloadedLabels :: Extension
EmptyCase :: Extension
PatternSynonyms :: Extension
PartialTypeSignatures :: Extension
NamedWildCards :: Extension
StaticPointers :: Extension
TypeApplications :: Extension
Strict :: Extension
StrictData :: Extension
EmptyDataDeriving :: Extension
NumericUnderscores :: Extension
QuantifiedConstraints :: Extension
StarIsType :: Extension
ImportQualifiedPost :: Extension
CUSKs :: Extension
StandaloneKindSignatures :: Extension
LexicalNegation :: Extension
FieldSelectors :: Extension
OverloadedRecordDot :: Extension
OverloadedRecordUpdate :: Extension
module Language.Haskell.TH.Lib.Map
data Map k a
empty :: Map k a
insert :: Ord k => k -> a -> Map k a -> Map k a
lookup :: Ord k => k -> Map k a -> Maybe a
-- | Abstract syntax definitions for Template Haskell.
module Language.Haskell.TH.Syntax
-- | A location at which to attach Haddock documentation. Note that adding
-- documentation to a Name defined oustide of the current module
-- will cause an error.
data DocLoc
-- | At the current module's header.
ModuleDoc :: DocLoc
-- | At a declaration, not necessarily top level.
DeclDoc :: Name -> DocLoc
-- | At a specific argument of a function, indexed by its position.
ArgDoc :: Name -> Int -> DocLoc
-- | At a class or family instance.
InstDoc :: Type -> DocLoc
-- | To avoid duplication between kinds and types, they are defined to be
-- the same. Naturally, you would never have a type be StarT and
-- you would never have a kind be SigT, but many of the other
-- constructors are shared. Note that the kind Bool is denoted
-- with ConT, not PromotedT. Similarly, tuple kinds are
-- made with TupleT, not PromotedTupleT.
type Kind = Type
-- | Annotation target for reifyAnnotations
data AnnLookup
AnnLookupModule :: Module -> AnnLookup
AnnLookupName :: Name -> AnnLookup
-- | Role annotations
data Role
-- |
-- nominal
--
NominalR :: Role
-- |
-- representational
--
RepresentationalR :: Role
-- |
-- phantom
--
PhantomR :: Role
-- |
-- _
--
InferR :: Role
data TyLit
-- |
-- 2
--
NumTyLit :: Integer -> TyLit
-- |
-- "Hello"
--
StrTyLit :: String -> TyLit
-- | 'C', @since 4.16.0.0
CharTyLit :: Char -> TyLit
-- | Injectivity annotation
data InjectivityAnn
InjectivityAnn :: Name -> [Name] -> InjectivityAnn
-- | Type family result signature
data FamilyResultSig
-- | no signature
NoSig :: FamilyResultSig
-- |
-- k
--
KindSig :: Kind -> FamilyResultSig
-- |
-- = r, = (r :: k)
--
TyVarSig :: TyVarBndr () -> FamilyResultSig
data TyVarBndr flag
-- |
-- a
--
PlainTV :: Name -> flag -> TyVarBndr flag
-- |
-- (a :: k)
--
KindedTV :: Name -> flag -> Kind -> TyVarBndr flag
data Specificity
-- |
-- a
--
SpecifiedSpec :: Specificity
-- |
-- {a}
--
InferredSpec :: Specificity
data Type
-- |
-- forall <vars>. <ctxt> => <type>
--
ForallT :: [TyVarBndr Specificity] -> Cxt -> Type -> Type
-- |
-- forall <vars> -> <type>
--
ForallVisT :: [TyVarBndr ()] -> Type -> Type
-- |
-- T a b
--
AppT :: Type -> Type -> Type
-- |
-- T @k t
--
AppKindT :: Type -> Kind -> Type
-- |
-- t :: k
--
SigT :: Type -> Kind -> Type
-- |
-- a
--
VarT :: Name -> Type
-- |
-- T
--
ConT :: Name -> Type
-- |
-- 'T
--
PromotedT :: Name -> Type
-- |
-- T + T
--
InfixT :: Type -> Name -> Type -> Type
-- |
-- T + T
--
--
-- See Language.Haskell.TH.Syntax#infix
UInfixT :: Type -> Name -> Type -> Type
-- |
-- T :+: T
--
PromotedInfixT :: Type -> Name -> Type -> Type
-- |
-- T :+: T
--
--
-- See Language.Haskell.TH.Syntax#infix
PromotedUInfixT :: Type -> Name -> Type -> Type
-- |
-- (T)
--
ParensT :: Type -> Type
-- |
-- (,), (,,), etc.
--
TupleT :: Int -> Type
-- |
-- (#,#), (#,,#), etc.
--
UnboxedTupleT :: Int -> Type
-- |
-- (#|#), (#||#), etc.
--
UnboxedSumT :: SumArity -> Type
-- |
-- ->
--
ArrowT :: Type
-- |
-- %n ->
--
--
-- Generalised arrow type with multiplicity argument
MulArrowT :: Type
-- |
-- ~
--
EqualityT :: Type
-- |
-- []
--
ListT :: Type
-- |
-- '(), '(,), '(,,), etc.
--
PromotedTupleT :: Int -> Type
-- |
-- '[]
--
PromotedNilT :: Type
-- |
-- (':)
--
PromotedConsT :: Type
-- |
-- *
--
StarT :: Type
-- |
-- Constraint
--
ConstraintT :: Type
-- |
-- 0,1,2, etc.
--
LitT :: TyLit -> Type
-- |
-- _
--
WildCardT :: Type
-- |
-- ?x :: t
--
ImplicitParamT :: String -> Type -> Type
-- | A pattern synonym's argument type.
data PatSynArgs
-- |
-- pattern P {x y z} = p
--
PrefixPatSyn :: [Name] -> PatSynArgs
-- |
-- pattern {x P y} = p
--
InfixPatSyn :: Name -> Name -> PatSynArgs
-- |
-- pattern P { {x,y,z} } = p
--
RecordPatSyn :: [Name] -> PatSynArgs
-- | A pattern synonym's directionality.
data PatSynDir
-- |
-- pattern P x {<-} p
--
Unidir :: PatSynDir
-- |
-- pattern P x {=} p
--
ImplBidir :: PatSynDir
-- |
-- pattern P x {<-} p where P x = e
--
ExplBidir :: [Clause] -> PatSynDir
-- | As of template-haskell-2.11.0.0, VarStrictType has
-- been replaced by VarBangType.
type VarStrictType = VarBangType
-- | As of template-haskell-2.11.0.0, StrictType has been
-- replaced by BangType.
type StrictType = BangType
-- | As of template-haskell-2.11.0.0, Strict has been
-- replaced by Bang.
type Strict = Bang
type VarBangType = (Name, Bang, Type)
type BangType = (Bang, Type)
data Bang
-- |
-- C { {-# UNPACK #-} !}a
--
Bang :: SourceUnpackedness -> SourceStrictness -> Bang
-- | A single data constructor.
--
-- The constructors for Con can roughly be divided up into two
-- categories: those for constructors with "vanilla" syntax
-- (NormalC, RecC, and InfixC), and those for
-- constructors with GADT syntax (GadtC and RecGadtC). The
-- ForallC constructor, which quantifies additional type variables
-- and class contexts, can surround either variety of constructor.
-- However, the type variables that it quantifies are different depending
-- on what constructor syntax is used:
--
--
-- - If a ForallC surrounds a constructor with vanilla syntax,
-- then the ForallC will only quantify existential type
-- variables. For example:
--
--
--
-- data Foo a = forall b. MkFoo a b
--
--
--
-- In MkFoo, ForallC will quantify b, but not
-- a.
--
--
-- - If a ForallC surrounds a constructor with GADT syntax, then
-- the ForallC will quantify all type variables used in the
-- constructor. For example:
--
--
--
-- data Bar a b where
-- MkBar :: (a ~ b) => c -> MkBar a b
--
--
--
-- In MkBar, ForallC will quantify a,
-- b, and c.
--
-- Multiplicity annotations for data types are currently not supported in
-- Template Haskell (i.e. all fields represented by Template Haskell will
-- be linear).
data Con
-- |
-- C Int a
--
NormalC :: Name -> [BangType] -> Con
-- |
-- C { v :: Int, w :: a }
--
RecC :: Name -> [VarBangType] -> Con
-- |
-- Int :+ a
--
InfixC :: BangType -> Name -> BangType -> Con
-- |
-- forall a. Eq a => C [a]
--
ForallC :: [TyVarBndr Specificity] -> Cxt -> Con -> Con
-- |
-- C :: a -> b -> T b Int
--
GadtC :: [Name] -> [BangType] -> Type -> Con
-- |
-- C :: { v :: Int } -> T b Int
--
RecGadtC :: [Name] -> [VarBangType] -> Type -> Con
-- | Unlike SourceStrictness and SourceUnpackedness,
-- DecidedStrictness refers to the strictness that the compiler
-- chooses for a data constructor field, which may be different from what
-- is written in source code. See reifyConStrictness for more
-- information.
data DecidedStrictness
DecidedLazy :: DecidedStrictness
DecidedStrict :: DecidedStrictness
DecidedUnpack :: DecidedStrictness
data SourceStrictness
-- |
-- C a
--
NoSourceStrictness :: SourceStrictness
-- |
-- C {~}a
--
SourceLazy :: SourceStrictness
-- |
-- C {!}a
--
SourceStrict :: SourceStrictness
data SourceUnpackedness
-- |
-- C a
--
NoSourceUnpackedness :: SourceUnpackedness
-- |
-- C { {-# NOUNPACK #-} } a
--
SourceNoUnpack :: SourceUnpackedness
-- |
-- C { {-# UNPACK #-} } a
--
SourceUnpack :: SourceUnpackedness
-- | Since the advent of ConstraintKinds, constraints are really
-- just types. Equality constraints use the EqualityT constructor.
-- Constraints may also be tuples of other constraints.
type Pred = Type
type Cxt = [Pred] " @(Eq a, Ord b)@"
data AnnTarget
ModuleAnnotation :: AnnTarget
TypeAnnotation :: Name -> AnnTarget
ValueAnnotation :: Name -> AnnTarget
data RuleBndr
RuleVar :: Name -> RuleBndr
TypedRuleVar :: Name -> Type -> RuleBndr
data Phases
AllPhases :: Phases
FromPhase :: Int -> Phases
BeforePhase :: Int -> Phases
data RuleMatch
ConLike :: RuleMatch
FunLike :: RuleMatch
data Inline
NoInline :: Inline
Inline :: Inline
Inlinable :: Inline
data Pragma
InlineP :: Name -> Inline -> RuleMatch -> Phases -> Pragma
OpaqueP :: Name -> Pragma
SpecialiseP :: Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseInstP :: Type -> Pragma
RuleP :: String -> Maybe [TyVarBndr ()] -> [RuleBndr] -> Exp -> Exp -> Phases -> Pragma
AnnP :: AnnTarget -> Exp -> Pragma
LineP :: Int -> String -> Pragma
-- |
-- { {-# COMPLETE C_1, ..., C_i [ :: T ] #-} }
--
CompleteP :: [Name] -> Maybe Name -> Pragma
data Safety
Unsafe :: Safety
Safe :: Safety
Interruptible :: Safety
data Callconv
CCall :: Callconv
StdCall :: Callconv
CApi :: Callconv
Prim :: Callconv
JavaScript :: Callconv
data Foreign
ImportF :: Callconv -> Safety -> String -> Name -> Type -> Foreign
ExportF :: Callconv -> String -> Name -> Type -> Foreign
data FunDep
FunDep :: [Name] -> [Name] -> FunDep
-- | One equation of a type family instance or closed type family. The
-- arguments are the left-hand-side type and the right-hand-side result.
--
-- For instance, if you had the following type family:
--
--
-- type family Foo (a :: k) :: k where
-- forall k (a :: k). Foo @k a = a
--
--
-- The Foo @k a = a equation would be represented as follows:
--
--
-- TySynEqn (Just [PlainTV k, KindedTV a (VarT k)])
-- (AppT (AppKindT (ConT ''Foo) (VarT k)) (VarT a))
-- (VarT a)
--
data TySynEqn
TySynEqn :: Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
-- | Common elements of OpenTypeFamilyD and
-- ClosedTypeFamilyD. By analogy with "head" for type classes and
-- type class instances as defined in Type classes: an exploration of
-- the design space, the TypeFamilyHead is defined to be the
-- elements of the declaration between type family and
-- where.
data TypeFamilyHead
TypeFamilyHead :: Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> TypeFamilyHead
-- | A pattern synonym's type. Note that a pattern synonym's fully
-- specified type has a peculiar shape coming with two forall quantifiers
-- and two constraint contexts. For example, consider the pattern synonym
--
--
-- pattern P x1 x2 ... xn = <some-pattern>
--
--
-- P's complete type is of the following form
--
--
-- pattern P :: forall universals. required constraints
-- => forall existentials. provided constraints
-- => t1 -> t2 -> ... -> tn -> t
--
--
-- consisting of four parts:
--
--
-- - the (possibly empty lists of) universally quantified type
-- variables and required constraints on them.
-- - the (possibly empty lists of) existentially quantified type
-- variables and the provided constraints on them.
-- - the types t1, t2, .., tn of
-- x1, x2, .., xn, respectively
-- - the type t of <some-pattern>, mentioning
-- only universals.
--
--
-- Pattern synonym types interact with TH when (a) reifying a pattern
-- synonym, (b) pretty printing, or (c) specifying a pattern synonym's
-- type signature explicitly:
--
--
-- - Reification always returns a pattern synonym's fully
-- specified type in abstract syntax.
-- - Pretty printing via pprPatSynType abbreviates a pattern
-- synonym's type unambiguously in concrete syntax: The rule of thumb is
-- to print initial empty universals and the required context as ()
-- =>, if existentials and a provided context follow. If only
-- universals and their required context, but no existentials are
-- specified, only the universals and their required context are printed.
-- If both or none are specified, so both (or none) are printed.
-- - When specifying a pattern synonym's type explicitly with
-- PatSynSigD either one of the universals, the existentials, or
-- their contexts may be left empty.
--
--
-- See the GHC user's guide for more information on pattern synonyms and
-- their types:
-- https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#pattern-synonyms.
type PatSynType = Type
-- | What the user explicitly requests when deriving an instance.
data DerivStrategy
-- | A "standard" derived instance
StockStrategy :: DerivStrategy
-- |
-- -XDeriveAnyClass
--
AnyclassStrategy :: DerivStrategy
-- |
-- -XGeneralizedNewtypeDeriving
--
NewtypeStrategy :: DerivStrategy
-- |
-- -XDerivingVia
--
ViaStrategy :: Type -> DerivStrategy
-- | A single deriving clause at the end of a datatype.
data DerivClause
-- |
-- { deriving stock (Eq, Ord) }
--
DerivClause :: Maybe DerivStrategy -> Cxt -> DerivClause
-- | Varieties of allowed instance overlap.
data Overlap
-- | May be overlapped by more specific instances
Overlappable :: Overlap
-- | May overlap a more general instance
Overlapping :: Overlap
-- | Both Overlapping and Overlappable
Overlaps :: Overlap
-- | Both Overlapping and Overlappable, and pick an arbitrary
-- one if multiple choices are available.
Incoherent :: Overlap
data Dec
-- |
-- { f p1 p2 = b where decs }
--
FunD :: Name -> [Clause] -> Dec
-- |
-- { p = b where decs }
--
ValD :: Pat -> Body -> [Dec] -> Dec
-- |
-- { data Cxt x => T x = A x | B (T x)
-- deriving (Z,W)
-- deriving stock Eq }
--
DataD :: Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> [Con] -> [DerivClause] -> Dec
-- |
-- { newtype Cxt x => T x = A (B x)
-- deriving (Z,W Q)
-- deriving stock Eq }
--
NewtypeD :: Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> Con -> [DerivClause] -> Dec
-- |
-- { type T x = (x,x) }
--
TySynD :: Name -> [TyVarBndr ()] -> Type -> Dec
-- |
-- { class Eq a => Ord a where ds }
--
ClassD :: Cxt -> Name -> [TyVarBndr ()] -> [FunDep] -> [Dec] -> Dec
-- |
-- { instance {-# OVERLAPS #-}
-- Show w => Show [w] where ds }
--
InstanceD :: Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec
-- |
-- { length :: [a] -> Int }
--
SigD :: Name -> Type -> Dec
-- |
-- { type TypeRep :: k -> Type }
--
KiSigD :: Name -> Kind -> Dec
-- |
-- { foreign import ... }
-- { foreign export ... }
--
ForeignD :: Foreign -> Dec
-- |
-- { infix 3 foo }
--
InfixD :: Fixity -> Name -> Dec
-- |
-- { default (Integer, Double) }
--
DefaultD :: [Type] -> Dec
-- |
-- { {-# INLINE [1] foo #-} }
--
PragmaD :: Pragma -> Dec
-- |
-- { data family T a b c :: * }
--
DataFamilyD :: Name -> [TyVarBndr ()] -> Maybe Kind -> Dec
-- |
-- { data instance Cxt x => T [x]
-- = A x | B (T x)
-- deriving (Z,W)
-- deriving stock Eq }
--
DataInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> [Con] -> [DerivClause] -> Dec
-- |
-- { newtype instance Cxt x => T [x]
-- = A (B x)
-- deriving (Z,W)
-- deriving stock Eq }
--
NewtypeInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> Con -> [DerivClause] -> Dec
-- |
-- { type instance ... }
--
TySynInstD :: TySynEqn -> Dec
-- |
-- { type family T a b c = (r :: *) | r -> a b }
--
OpenTypeFamilyD :: TypeFamilyHead -> Dec
-- |
-- { type family F a b = (r :: *) | r -> a where ... }
--
ClosedTypeFamilyD :: TypeFamilyHead -> [TySynEqn] -> Dec
-- |
-- { type role T nominal representational }
--
RoleAnnotD :: Name -> [Role] -> Dec
-- |
-- { deriving stock instance Ord a => Ord (Foo a) }
--
StandaloneDerivD :: Maybe DerivStrategy -> Cxt -> Type -> Dec
-- |
-- { default size :: Data a => a -> Int }
--
DefaultSigD :: Name -> Type -> Dec
-- | { pattern P v1 v2 .. vn <- p } unidirectional or {
-- pattern P v1 v2 .. vn = p } implicit bidirectional or {
-- pattern P v1 v2 .. vn <- p where P v1 v2 .. vn = e } explicit
-- bidirectional
--
-- also, besides prefix pattern synonyms, both infix and record pattern
-- synonyms are supported. See PatSynArgs for details
PatSynD :: Name -> PatSynArgs -> PatSynDir -> Pat -> Dec
-- | A pattern synonym's type signature.
PatSynSigD :: Name -> PatSynType -> Dec
-- |
-- { ?x = expr }
--
--
-- Implicit parameter binding declaration. Can only be used in let and
-- where clauses which consist entirely of implicit bindings.
ImplicitParamBindD :: String -> Exp -> Dec
data Range
FromR :: Exp -> Range
FromThenR :: Exp -> Exp -> Range
FromToR :: Exp -> Exp -> Range
FromThenToR :: Exp -> Exp -> Exp -> Range
data Stmt
-- |
-- p <- e
--
BindS :: Pat -> Exp -> Stmt
-- |
-- { let { x=e1; y=e2 } }
--
LetS :: [Dec] -> Stmt
-- |
-- e
--
NoBindS :: Exp -> Stmt
-- | x <- e1 | s2, s3 | s4 (in CompE)
ParS :: [[Stmt]] -> Stmt
-- |
-- rec { s1; s2 }
--
RecS :: [Stmt] -> Stmt
data Guard
-- |
-- f x { | odd x } = x
--
NormalG :: Exp -> Guard
-- |
-- f x { | Just y <- x, Just z <- y } = z
--
PatG :: [Stmt] -> Guard
data Body
-- |
-- f p { | e1 = e2
-- | e3 = e4 }
-- where ds
--
GuardedB :: [(Guard, Exp)] -> Body
-- |
-- f p { = e } where ds
--
NormalB :: Exp -> Body
type FieldExp = (Name, Exp)
data Exp
-- |
-- { x }
--
VarE :: Name -> Exp
-- |
-- data T1 = C1 t1 t2; p = {C1} e1 e2
--
ConE :: Name -> Exp
-- |
-- { 5 or 'c'}
--
LitE :: Lit -> Exp
-- |
-- { f x }
--
AppE :: Exp -> Exp -> Exp
-- |
-- { f @Int }
--
AppTypeE :: Exp -> Type -> Exp
-- |
-- {x + y} or {(x+)} or {(+ x)} or {(+)}
--
InfixE :: Maybe Exp -> Exp -> Maybe Exp -> Exp
-- |
-- {x + y}
--
--
-- See Language.Haskell.TH.Syntax#infix
UInfixE :: Exp -> Exp -> Exp -> Exp
-- |
-- { (e) }
--
--
-- See Language.Haskell.TH.Syntax#infix
ParensE :: Exp -> Exp
-- |
-- { \ p1 p2 -> e }
--
LamE :: [Pat] -> Exp -> Exp
-- |
-- { \case m1; m2 }
--
LamCaseE :: [Match] -> Exp
-- |
-- { (e1,e2) }
--
--
-- The Maybe is necessary for handling tuple sections.
--
--
-- (1,)
--
--
-- translates to
--
--
-- TupE [Just (LitE (IntegerL 1)),Nothing]
--
TupE :: [Maybe Exp] -> Exp
-- |
-- { (# e1,e2 #) }
--
--
-- The Maybe is necessary for handling tuple sections.
--
--
-- (# 'c', #)
--
--
-- translates to
--
--
-- UnboxedTupE [Just (LitE (CharL 'c')),Nothing]
--
UnboxedTupE :: [Maybe Exp] -> Exp
-- |
-- { (#|e|#) }
--
UnboxedSumE :: Exp -> SumAlt -> SumArity -> Exp
-- |
-- { if e1 then e2 else e3 }
--
CondE :: Exp -> Exp -> Exp -> Exp
-- |
-- { if | g1 -> e1 | g2 -> e2 }
--
MultiIfE :: [(Guard, Exp)] -> Exp
-- |
-- { let { x=e1; y=e2 } in e3 }
--
LetE :: [Dec] -> Exp -> Exp
-- |
-- { case e of m1; m2 }
--
CaseE :: Exp -> [Match] -> Exp
-- | { do { p <- e1; e2 } } or a qualified do if the module
-- name is present
DoE :: Maybe ModName -> [Stmt] -> Exp
-- | { mdo { x <- e1 y; y <- e2 x; } } or a qualified mdo if
-- the module name is present
MDoE :: Maybe ModName -> [Stmt] -> Exp
-- |
-- { [ (x,y) | x <- xs, y <- ys ] }
--
--
-- The result expression of the comprehension is the last of the
-- Stmts, and should be a NoBindS.
--
-- E.g. translation:
--
--
-- [ f x | x <- xs ]
--
--
--
-- CompE [BindS (VarP x) (VarE xs), NoBindS (AppE (VarE f) (VarE x))]
--
CompE :: [Stmt] -> Exp
-- |
-- { [ 1 ,2 .. 10 ] }
--
ArithSeqE :: Range -> Exp
-- |
-- { [1,2,3] }
--
ListE :: [Exp] -> Exp
-- |
-- { e :: t }
--
SigE :: Exp -> Type -> Exp
-- |
-- { T { x = y, z = w } }
--
RecConE :: Name -> [FieldExp] -> Exp
-- |
-- { (f x) { z = w } }
--
RecUpdE :: Exp -> [FieldExp] -> Exp
-- |
-- { static e }
--
StaticE :: Exp -> Exp
-- |
-- { _x }
--
--
-- This is used for holes or unresolved identifiers in AST quotes. Note
-- that it could either have a variable name or constructor name.
UnboundVarE :: Name -> Exp
-- | { #x } ( Overloaded label )
LabelE :: String -> Exp
-- | { ?x } ( Implicit parameter )
ImplicitParamVarE :: String -> Exp
-- | { exp.field } ( Overloaded Record Dot )
GetFieldE :: Exp -> String -> Exp
-- | (.x) or (.x.y) (Record projections)
ProjectionE :: NonEmpty String -> Exp
data Clause
-- |
-- f { p1 p2 = body where decs }
--
Clause :: [Pat] -> Body -> [Dec] -> Clause
data Match
-- |
-- case e of { pat -> body where decs }
--
Match :: Pat -> Body -> [Dec] -> Match
type FieldPat = (Name, Pat)
-- | Pattern in Haskell given in {}
data Pat
-- |
-- { 5 or 'c' }
--
LitP :: Lit -> Pat
-- |
-- { x }
--
VarP :: Name -> Pat
-- |
-- { (p1,p2) }
--
TupP :: [Pat] -> Pat
-- |
-- { (# p1,p2 #) }
--
UnboxedTupP :: [Pat] -> Pat
-- |
-- { (#|p|#) }
--
UnboxedSumP :: Pat -> SumAlt -> SumArity -> Pat
-- |
-- data T1 = C1 t1 t2; {C1 @ty1 p1 p2} = e
--
ConP :: Name -> [Type] -> [Pat] -> Pat
-- |
-- foo ({x :+ y}) = e
--
InfixP :: Pat -> Name -> Pat -> Pat
-- |
-- foo ({x :+ y}) = e
--
--
-- See Language.Haskell.TH.Syntax#infix
UInfixP :: Pat -> Name -> Pat -> Pat
-- |
-- {(p)}
--
--
-- See Language.Haskell.TH.Syntax#infix
ParensP :: Pat -> Pat
-- |
-- { ~p }
--
TildeP :: Pat -> Pat
-- |
-- { !p }
--
BangP :: Pat -> Pat
-- |
-- { x @ p }
--
AsP :: Name -> Pat -> Pat
-- |
-- { _ }
--
WildP :: Pat
-- |
-- f (Pt { pointx = x }) = g x
--
RecP :: Name -> [FieldPat] -> Pat
-- |
-- { [1,2,3] }
--
ListP :: [Pat] -> Pat
-- |
-- { p :: t }
--
SigP :: Pat -> Type -> Pat
-- |
-- { e -> p }
--
ViewP :: Exp -> Pat -> Pat
-- | Raw bytes embedded into the binary.
--
-- Avoid using Bytes constructor directly as it is likely to change in
-- the future. Use helpers such as mkBytes in
-- Language.Haskell.TH.Lib instead.
data Bytes
Bytes :: ForeignPtr Word8 -> Word -> Word -> Bytes
-- | Pointer to the data
[bytesPtr] :: Bytes -> ForeignPtr Word8
-- | Offset from the pointer
[bytesOffset] :: Bytes -> Word
-- | Number of bytes
[bytesSize] :: Bytes -> Word
data Lit
CharL :: Char -> Lit
StringL :: String -> Lit
-- | Used for overloaded and non-overloaded literals. We don't have a good
-- way to represent non-overloaded literals at the moment. Maybe that
-- doesn't matter?
IntegerL :: Integer -> Lit
RationalL :: Rational -> Lit
IntPrimL :: Integer -> Lit
WordPrimL :: Integer -> Lit
FloatPrimL :: Rational -> Lit
DoublePrimL :: Rational -> Lit
-- | A primitive C-style string, type Addr#
StringPrimL :: [Word8] -> Lit
-- | Some raw bytes, type Addr#:
BytesPrimL :: Bytes -> Lit
CharPrimL :: Char -> Lit
data FixityDirection
InfixL :: FixityDirection
InfixR :: FixityDirection
InfixN :: FixityDirection
data Fixity
Fixity :: Int -> FixityDirection -> Fixity
-- | InstanceDec describes a single instance of a class or type
-- function. It is just a Dec, but guaranteed to be one of the
-- following:
--
--
type InstanceDec = Dec
-- | In PrimTyConI, is the type constructor unlifted?
type Unlifted = Bool
-- | In PrimTyConI, arity of the type constructor
type Arity = Int
-- | In UnboxedSumE, UnboxedSumT, and UnboxedSumP, the
-- total number of SumAlts. For example, (#|#) has a
-- SumArity of 2.
type SumArity = Int
-- | In UnboxedSumE and UnboxedSumP, the number associated
-- with a particular data constructor. SumAlts are one-indexed and
-- should never exceed the value of its corresponding SumArity.
-- For example:
--
--
type SumAlt = Int
-- | In ClassOpI and DataConI, name of the parent class or
-- type
type ParentName = Name
-- | Obtained from reifyModule in the Q Monad.
data ModuleInfo
-- | Contains the import list of the module.
ModuleInfo :: [Module] -> ModuleInfo
-- | Obtained from reify in the Q Monad.
data Info
-- | A class, with a list of its visible instances
ClassI :: Dec -> [InstanceDec] -> Info
-- | A class method
ClassOpI :: Name -> Type -> ParentName -> Info
-- | A "plain" type constructor. "Fancier" type constructors are returned
-- using PrimTyConI or FamilyI as appropriate. At present,
-- this reified declaration will never have derived instances attached to
-- it (if you wish to check for an instance, see reifyInstances).
TyConI :: Dec -> Info
-- | A type or data family, with a list of its visible instances. A closed
-- type family is returned with 0 instances.
FamilyI :: Dec -> [InstanceDec] -> Info
-- | A "primitive" type constructor, which can't be expressed with a
-- Dec. Examples: (->), Int#.
PrimTyConI :: Name -> Arity -> Unlifted -> Info
-- | A data constructor
DataConI :: Name -> Type -> ParentName -> Info
-- | A pattern synonym
PatSynI :: Name -> PatSynType -> Info
-- | A "value" variable (as opposed to a type variable, see TyVarI).
--
-- The Maybe Dec field contains Just the declaration
-- which defined the variable - including the RHS of the declaration - or
-- else Nothing, in the case where the RHS is unavailable to the
-- compiler. At present, this value is always Nothing:
-- returning the RHS has not yet been implemented because of lack of
-- interest.
VarI :: Name -> Type -> Maybe Dec -> Info
-- | A type variable.
--
-- The Type field contains the type which underlies the
-- variable. At present, this is always VarT theName, but
-- future changes may permit refinement of this.
TyVarI :: Name -> Type -> Info
type CharPos = (Int, Int) " Line and character position"
data Loc
Loc :: String -> String -> String -> CharPos -> CharPos -> Loc
[loc_filename] :: Loc -> String
[loc_package] :: Loc -> String
[loc_module] :: Loc -> String
[loc_start] :: Loc -> CharPos
[loc_end] :: Loc -> CharPos
data NameIs
Alone :: NameIs
Applied :: NameIs
Infix :: NameIs
-- | Uniq is used by GHC to distinguish names from each other.
type Uniq = Integer
data NameSpace
-- | Variables
VarName :: NameSpace
-- | Data constructors
DataName :: NameSpace
-- | Type constructors and classes; Haskell has them in the same name space
-- for now.
TcClsName :: NameSpace
data NameFlavour
-- | An unqualified name; dynamically bound
NameS :: NameFlavour
-- | A qualified name; dynamically bound
NameQ :: ModName -> NameFlavour
-- | A unique local name
NameU :: !Uniq -> NameFlavour
-- | Local name bound outside of the TH AST
NameL :: !Uniq -> NameFlavour
-- | Global name bound outside of the TH AST: An original name (occurrences
-- only, not binders) Need the namespace too to be sure which thing we
-- are naming
NameG :: NameSpace -> PkgName -> ModName -> NameFlavour
-- | An abstract type representing names in the syntax tree.
--
-- Names can be constructed in several ways, which come with
-- different name-capture guarantees (see
-- Language.Haskell.TH.Syntax#namecapture for an explanation of
-- name capture):
--
--
-- - the built-in syntax 'f and ''T can be used to
-- construct names, The expression 'f gives a Name
-- which refers to the value f currently in scope, and
-- ''T gives a Name which refers to the type T
-- currently in scope. These names can never be captured.
-- - lookupValueName and lookupTypeName are similar to
-- 'f and ''T respectively, but the Names are
-- looked up at the point where the current splice is being run. These
-- names can never be captured.
-- - newName monadically generates a new name, which can never
-- be captured.
-- - mkName generates a capturable name.
--
--
-- Names constructed using newName and mkName may be
-- used in bindings (such as let x = ... or x ->
-- ...), but names constructed using lookupValueName,
-- lookupTypeName, 'f, ''T may not.
data Name
Name :: OccName -> NameFlavour -> Name
newtype OccName
OccName :: String -> OccName
-- | Obtained from reifyModule and thisModule.
data Module
Module :: PkgName -> ModName -> Module
newtype PkgName
PkgName :: String -> PkgName
newtype ModName
ModName :: String -> ModName
-- | A Lift instance can have any of its values turned into a
-- Template Haskell expression. This is needed when a value used within a
-- Template Haskell quotation is bound outside the Oxford brackets
-- ([| ... |] or [|| ... ||]) but not at the top level.
-- As an example:
--
--
-- add1 :: Int -> Q (TExp Int)
-- add1 x = [|| x + 1 ||]
--
--
-- Template Haskell has no way of knowing what value x will take
-- on at splice-time, so it requires the type of x to be an
-- instance of Lift.
--
-- A Lift instance must satisfy $(lift x) ≡ x and
-- $$(liftTyped x) ≡ x for all x, where $(...)
-- and $$(...) are Template Haskell splices. It is additionally
-- expected that lift x ≡ unTypeQ (liftTyped
-- x).
--
-- Lift instances can be derived automatically by use of the
-- -XDeriveLift GHC language extension:
--
--
-- {-# LANGUAGE DeriveLift #-}
-- module Foo where
--
-- import Language.Haskell.TH.Syntax
--
-- data Bar a = Bar1 a (Bar a) | Bar2 String
-- deriving Lift
--
--
-- Representation-polymorphic since template-haskell-2.16.0.0.
class Lift (t :: TYPE r)
-- | Turn a value into a Template Haskell expression, suitable for use in a
-- splice.
lift :: (Lift t, Quote m) => t -> m Exp
-- | Turn a value into a Template Haskell expression, suitable for use in a
-- splice.
lift :: (Lift t, r ~ 'LiftedRep, Quote m) => t -> m Exp
-- | Turn a value into a Template Haskell typed expression, suitable for
-- use in a typed splice.
liftTyped :: (Lift t, Quote m) => t -> Code m t
newtype Code m (a :: TYPE (r :: RuntimeRep))
Code :: m (TExp a) -> Code m (a :: TYPE (r :: RuntimeRep))
-- | Underlying monadic value
[examineCode] :: Code m (a :: TYPE (r :: RuntimeRep)) -> m (TExp a)
-- | Represents an expression which has type a. Built on top of
-- Exp, typed expressions allow for type-safe splicing via:
--
--
-- - typed quotes, written as [|| ... ||] where ...
-- is an expression; if that expression has type a, then the
-- quotation has type Q (TExp a)
-- - typed splices inside of typed quotes, written as $$(...)
-- where ... is an arbitrary expression of type Q
-- (TExp a)
--
--
-- Traditional expression quotes and splices let us construct ill-typed
-- expressions:
--
--
-- >>> fmap ppr $ runQ [| True == $( [| "foo" |] ) |]
-- GHC.Types.True GHC.Classes.== "foo"
--
-- >>> GHC.Types.True GHC.Classes.== "foo"
-- <interactive> error:
-- • Couldn't match expected type ‘Bool’ with actual type ‘[Char]’
-- • In the second argument of ‘(==)’, namely ‘"foo"’
-- In the expression: True == "foo"
-- In an equation for ‘it’: it = True == "foo"
--
--
-- With typed expressions, the type error occurs when constructing
-- the Template Haskell expression:
--
--
-- >>> fmap ppr $ runQ [|| True == $$( [|| "foo" ||] ) ||]
-- <interactive> error:
-- • Couldn't match type ‘[Char]’ with ‘Bool’
-- Expected type: Q (TExp Bool)
-- Actual type: Q (TExp [Char])
-- • In the Template Haskell quotation [|| "foo" ||]
-- In the expression: [|| "foo" ||]
-- In the Template Haskell splice $$([|| "foo" ||])
--
--
-- Representation-polymorphic since template-haskell-2.16.0.0.
newtype TExp (a :: TYPE (r :: RuntimeRep))
TExp :: Exp -> TExp (a :: TYPE (r :: RuntimeRep))
-- | Underlying untyped Template Haskell expression
[unType] :: TExp (a :: TYPE (r :: RuntimeRep)) -> Exp
-- | The Quote class implements the minimal interface which is
-- necessary for desugaring quotations.
--
--
-- - The Monad m superclass is needed to stitch together the
-- different AST fragments.
-- - newName is used when desugaring binding structures such as
-- lambdas to generate fresh names.
--
--
-- Therefore the type of an untyped quotation in GHC is `Quote m => m
-- Exp`
--
-- For many years the type of a quotation was fixed to be `Q Exp` but by
-- more precisely specifying the minimal interface it enables the
-- Exp to be extracted purely from the quotation without
-- interacting with Q.
class Monad m => Quote m
-- | Generate a fresh name, which cannot be captured.
--
-- For example, this:
--
--
-- f = $(do
-- nm1 <- newName "x"
-- let nm2 = mkName "x"
-- return (LamE [VarP nm1] (LamE [VarP nm2] (VarE nm1)))
-- )
--
--
-- will produce the splice
--
--
-- f = \x0 -> \x -> x0
--
--
-- In particular, the occurrence VarE nm1 refers to the binding
-- VarP nm1, and is not captured by the binding VarP
-- nm2.
--
-- Although names generated by newName cannot be
-- captured, they can capture other names. For example, this:
--
--
-- g = $(do
-- nm1 <- newName "x"
-- let nm2 = mkName "x"
-- return (LamE [VarP nm2] (LamE [VarP nm1] (VarE nm2)))
-- )
--
--
-- will produce the splice
--
--
-- g = \x -> \x0 -> x0
--
--
-- since the occurrence VarE nm2 is captured by the innermost
-- binding of x, namely VarP nm1.
newName :: Quote m => String -> m Name
newtype Q a
Q :: (forall m. Quasi m => m a) -> Q a
[unQ] :: Q a -> forall m. Quasi m => m a
class (MonadIO m, MonadFail m) => Quasi m
qNewName :: Quasi m => String -> m Name
qReport :: Quasi m => Bool -> String -> m ()
qRecover :: Quasi m => m a -> m a -> m a
qLookupName :: Quasi m => Bool -> String -> m (Maybe Name)
qReify :: Quasi m => Name -> m Info
qReifyFixity :: Quasi m => Name -> m (Maybe Fixity)
qReifyType :: Quasi m => Name -> m Type
qReifyInstances :: Quasi m => Name -> [Type] -> m [Dec]
qReifyRoles :: Quasi m => Name -> m [Role]
qReifyAnnotations :: (Quasi m, Data a) => AnnLookup -> m [a]
qReifyModule :: Quasi m => Module -> m ModuleInfo
qReifyConStrictness :: Quasi m => Name -> m [DecidedStrictness]
qLocation :: Quasi m => m Loc
qRunIO :: Quasi m => IO a -> m a
qGetPackageRoot :: Quasi m => m FilePath
qAddDependentFile :: Quasi m => FilePath -> m ()
qAddTempFile :: Quasi m => String -> m FilePath
qAddTopDecls :: Quasi m => [Dec] -> m ()
qAddForeignFilePath :: Quasi m => ForeignSrcLang -> String -> m ()
qAddModFinalizer :: Quasi m => Q () -> m ()
qAddCorePlugin :: Quasi m => String -> m ()
qGetQ :: (Quasi m, Typeable a) => m (Maybe a)
qPutQ :: (Quasi m, Typeable a) => a -> m ()
qIsExtEnabled :: Quasi m => Extension -> m Bool
qExtsEnabled :: Quasi m => m [Extension]
qPutDoc :: Quasi m => DocLoc -> String -> m ()
qGetDoc :: Quasi m => DocLoc -> m (Maybe String)
memcmp :: Ptr a -> Ptr b -> CSize -> IO CInt
newNameIO :: String -> IO Name
badIO :: String -> IO a
counter :: IORef Uniq
runQ :: Quasi m => Q a -> m a
-- | Discard the type annotation and produce a plain Template Haskell
-- expression
--
-- Representation-polymorphic since template-haskell-2.16.0.0.
unTypeQ :: forall (r :: RuntimeRep) (a :: TYPE r) m. Quote m => m (TExp a) -> m Exp
-- | Annotate the Template Haskell expression with a type
--
-- This is unsafe because GHC cannot check for you that the expression
-- really does have the type you claim it has.
--
-- Representation-polymorphic since template-haskell-2.16.0.0.
unsafeTExpCoerce :: forall (r :: RuntimeRep) (a :: TYPE r) m. Quote m => m Exp -> m (TExp a)
-- | Unsafely convert an untyped code representation into a typed code
-- representation.
unsafeCodeCoerce :: forall (r :: RuntimeRep) (a :: TYPE r) m. Quote m => m Exp -> Code m a
-- | Lift a monadic action producing code into the typed Code
-- representation
liftCode :: forall (r :: RuntimeRep) (a :: TYPE r) m. m (TExp a) -> Code m a
-- | Extract the untyped representation from the typed representation
unTypeCode :: forall (r :: RuntimeRep) (a :: TYPE r) m. Quote m => Code m a -> m Exp
-- | Modify the ambient monad used during code generation. For example, you
-- can use hoistCode to handle a state effect: handleState ::
-- Code (StateT Int Q) a -> Code Q a handleState = hoistCode (flip
-- runState 0)
hoistCode :: forall m n (r :: RuntimeRep) (a :: TYPE r). Monad m => (forall x. m x -> n x) -> Code m a -> Code n a
-- | Variant of (>>=) which allows effectful computations to be
-- injected into code generation.
bindCode :: forall m a (r :: RuntimeRep) (b :: TYPE r). Monad m => m a -> (a -> Code m b) -> Code m b
-- | Variant of (>>) which allows effectful computations to be
-- injected into code generation.
bindCode_ :: forall m a (r :: RuntimeRep) (b :: TYPE r). Monad m => m a -> Code m b -> Code m b
-- | A useful combinator for embedding monadic actions into Code
-- myCode :: ... => Code m a myCode = joinCode $ do x <-
-- someSideEffect return (makeCodeWith x)
joinCode :: forall m (r :: RuntimeRep) (a :: TYPE r). Monad m => m (Code m a) -> Code m a
-- | Report an error (True) or warning (False), but carry on; use
-- fail to stop.
-- | Deprecated: Use reportError or reportWarning instead
report :: Bool -> String -> Q ()
-- | Report an error to the user, but allow the current splice's
-- computation to carry on. To abort the computation, use fail.
reportError :: String -> Q ()
-- | Report a warning to the user, and carry on.
reportWarning :: String -> Q ()
-- | Recover from errors raised by reportError or fail.
recover :: Q a -> Q a -> Q a
lookupName :: Bool -> String -> Q (Maybe Name)
-- | Look up the given name in the (type namespace of the) current splice's
-- scope. See Language.Haskell.TH.Syntax#namelookup for more
-- details.
lookupTypeName :: String -> Q (Maybe Name)
-- | Look up the given name in the (value namespace of the) current
-- splice's scope. See Language.Haskell.TH.Syntax#namelookup for
-- more details.
lookupValueName :: String -> Q (Maybe Name)
-- | reify looks up information about the Name. It will fail
-- with a compile error if the Name is not visible. A Name
-- is visible if it is imported or defined in a prior top-level
-- declaration group. See the documentation for
-- newDeclarationGroup for more details.
--
-- It is sometimes useful to construct the argument name using
-- lookupTypeName or lookupValueName to ensure that we are
-- reifying from the right namespace. For instance, in this context:
--
--
-- data D = D
--
--
-- which D does reify (mkName "D") return information
-- about? (Answer: D-the-type, but don't rely on it.) To ensure
-- we get information about D-the-value, use
-- lookupValueName:
--
--
-- do
-- Just nm <- lookupValueName "D"
-- reify nm
--
--
-- and to get information about D-the-type, use
-- lookupTypeName.
reify :: Name -> Q Info
-- | reifyFixity nm attempts to find a fixity declaration for
-- nm. For example, if the function foo has the fixity
-- declaration infixr 7 foo, then reifyFixity 'foo
-- would return Just (Fixity 7 InfixR). If
-- the function bar does not have a fixity declaration, then
-- reifyFixity 'bar returns Nothing, so you may assume
-- bar has defaultFixity.
reifyFixity :: Name -> Q (Maybe Fixity)
-- | reifyType nm attempts to find the type or kind of
-- nm. For example, reifyType 'not returns Bool
-- -> Bool, and reifyType ''Bool returns Type.
-- This works even if there's no explicit signature and the type or kind
-- is inferred.
reifyType :: Name -> Q Type
-- | Template Haskell is capable of reifying information about types and
-- terms defined in previous declaration groups. Top-level declaration
-- splices break up declaration groups.
--
-- For an example, consider this code block. We define a datatype
-- X and then try to call reify on the datatype.
--
--
-- module Check where
--
-- data X = X
-- deriving Eq
--
-- $(do
-- info <- reify ''X
-- runIO $ print info
-- )
--
--
-- This code fails to compile, noting that X is not available
-- for reification at the site of reify. We can fix this by
-- creating a new declaration group using an empty top-level splice:
--
--
-- data X = X
-- deriving Eq
--
-- $(pure [])
--
-- $(do
-- info <- reify ''X
-- runIO $ print info
-- )
--
--
-- We provide newDeclarationGroup as a means of documenting this
-- behavior and providing a name for the pattern.
--
-- Since top level splices infer the presence of the $( ... )
-- brackets, we can also write:
--
--
-- data X = X
-- deriving Eq
--
-- newDeclarationGroup
--
-- $(do
-- info <- reify ''X
-- runIO $ print info
-- )
--
newDeclarationGroup :: Q [Dec]
-- | reifyInstances nm tys returns a list of visible instances of
-- nm tys. That is, if nm is the name of a type class,
-- then all instances of this class at the types tys are
-- returned. Alternatively, if nm is the name of a data family
-- or type family, all instances of this family at the types tys
-- are returned.
--
-- Note that this is a "shallow" test; the declarations returned merely
-- have instance heads which unify with nm tys, they need not
-- actually be satisfiable.
--
--
-- - reifyInstances ''Eq [ TupleT 2 `AppT`
-- ConT ''A `AppT` ConT ''B ] contains the
-- instance (Eq a, Eq b) => Eq (a, b) regardless of whether
-- A and B themselves implement Eq
-- - reifyInstances ''Show [ VarT (mkName "a") ]
-- produces every available instance of Eq
--
--
-- There is one edge case: reifyInstances ''Typeable tys
-- currently always produces an empty list (no matter what tys
-- are given).
--
-- An instance is visible if it is imported or defined in a prior
-- top-level declaration group. See the documentation for
-- newDeclarationGroup for more details.
reifyInstances :: Name -> [Type] -> Q [InstanceDec]
-- | reifyRoles nm returns the list of roles associated with the
-- parameters (both visible and invisible) of the tycon nm.
-- Fails if nm cannot be found or is not a tycon. The returned
-- list should never contain InferR.
--
-- An invisible parameter to a tycon is often a kind parameter. For
-- example, if we have
--
--
-- type Proxy :: forall k. k -> Type
-- data Proxy a = MkProxy
--
--
-- and reifyRoles Proxy, we will get [NominalR,
-- PhantomR]. The NominalR is the role of the
-- invisible k parameter. Kind parameters are always nominal.
reifyRoles :: Name -> Q [Role]
-- | reifyAnnotations target returns the list of annotations
-- associated with target. Only the annotations that are
-- appropriately typed is returned. So if you have Int and
-- String annotations for the same target, you have to call this
-- function twice.
reifyAnnotations :: Data a => AnnLookup -> Q [a]
-- | reifyModule mod looks up information about module
-- mod. To look up the current module, call this function with
-- the return value of thisModule.
reifyModule :: Module -> Q ModuleInfo
-- | reifyConStrictness nm looks up the strictness information for
-- the fields of the constructor with the name nm. Note that the
-- strictness information that reifyConStrictness returns may not
-- correspond to what is written in the source code. For example, in the
-- following data declaration:
--
--
-- data Pair a = Pair a a
--
--
-- reifyConStrictness would return [DecidedLazy,
-- DecidedLazy] under most circumstances, but it would return
-- [DecidedStrict, DecidedStrict] if the
-- -XStrictData language extension was enabled.
reifyConStrictness :: Name -> Q [DecidedStrictness]
-- | Is the list of instances returned by reifyInstances nonempty?
--
-- If you're confused by an instance not being visible despite being
-- defined in the same module and above the splice in question, see the
-- docs for newDeclarationGroup for a possible explanation.
isInstance :: Name -> [Type] -> Q Bool
-- | The location at which this computation is spliced.
location :: Q Loc
-- | The runIO function lets you run an I/O computation in the
-- Q monad. Take care: you are guaranteed the ordering of calls to
-- runIO within a single Q computation, but not about the
-- order in which splices are run.
--
-- Note: for various murky reasons, stdout and stderr handles are not
-- necessarily flushed when the compiler finishes running, so you should
-- flush them yourself.
runIO :: IO a -> Q a
-- | Get the package root for the current package which is being compiled.
-- This can be set explicitly with the -package-root flag but is normally
-- just the current working directory.
--
-- The motivation for this flag is to provide a principled means to
-- remove the assumption from splices that they will be executed in the
-- directory where the cabal file resides. Projects such as
-- haskell-language-server can't and don't change directory when
-- compiling files but instead set the -package-root flag appropiately.
getPackageRoot :: Q FilePath
-- | The input is a filepath, which if relative is offset by the package
-- root.
makeRelativeToProject :: FilePath -> Q FilePath
-- | Record external files that runIO is using (dependent upon). The
-- compiler can then recognize that it should re-compile the Haskell file
-- when an external file changes.
--
-- Expects an absolute file path.
--
-- Notes:
--
--
-- - ghc -M does not know about these dependencies - it does not
-- execute TH.
-- - The dependency is based on file content, not a modification
-- time
--
addDependentFile :: FilePath -> Q ()
-- | Obtain a temporary file path with the given suffix. The compiler will
-- delete this file after compilation.
addTempFile :: String -> Q FilePath
-- | Add additional top-level declarations. The added declarations will be
-- type checked along with the current declaration group.
addTopDecls :: [Dec] -> Q ()
-- | Deprecated: Use addForeignSource instead
addForeignFile :: ForeignSrcLang -> String -> Q ()
-- | Emit a foreign file which will be compiled and linked to the object
-- for the current module. Currently only languages that can be compiled
-- with the C compiler are supported, and the flags passed as part of
-- -optc will be also applied to the C compiler invocation that will
-- compile them.
--
-- Note that for non-C languages (for example C++) extern
-- C directives must be used to get symbols that we can
-- access from Haskell.
--
-- To get better errors, it is recommended to use #line pragmas when
-- emitting C files, e.g.
--
--
-- {-# LANGUAGE CPP #-}
-- ...
-- addForeignSource LangC $ unlines
-- [ "#line " ++ show (803 + 1) ++ " " ++ show "libraries/template-haskell/Language/Haskell/TH/Syntax.hs"
-- , ...
-- ]
--
addForeignSource :: ForeignSrcLang -> String -> Q ()
-- | Same as addForeignSource, but expects to receive a path
-- pointing to the foreign file instead of a String of its
-- contents. Consider using this in conjunction with addTempFile.
--
-- This is a good alternative to addForeignSource when you are
-- trying to directly link in an object file.
addForeignFilePath :: ForeignSrcLang -> FilePath -> Q ()
-- | Add a finalizer that will run in the Q monad after the current module
-- has been type checked. This only makes sense when run within a
-- top-level splice.
--
-- The finalizer is given the local type environment at the splice point.
-- Thus reify is able to find the local definitions when executed
-- inside the finalizer.
addModFinalizer :: Q () -> Q ()
-- | Adds a core plugin to the compilation pipeline.
--
-- addCorePlugin m has almost the same effect as passing
-- -fplugin=m to ghc in the command line. The major difference
-- is that the plugin module m must not belong to the current
-- package. When TH executes, it is too late to tell the compiler that we
-- needed to compile first a plugin module in the current package.
addCorePlugin :: String -> Q ()
-- | Get state from the Q monad. Note that the state is local to the
-- Haskell module in which the Template Haskell expression is executed.
getQ :: Typeable a => Q (Maybe a)
-- | Replace the state in the Q monad. Note that the state is local
-- to the Haskell module in which the Template Haskell expression is
-- executed.
putQ :: Typeable a => a -> Q ()
-- | Determine whether the given language extension is enabled in the
-- Q monad.
isExtEnabled :: Extension -> Q Bool
-- | List all enabled language extensions.
extsEnabled :: Q [Extension]
-- | Add Haddock documentation to the specified location. This will
-- overwrite any documentation at the location if it already exists. This
-- will reify the specified name, so it must be in scope when you call
-- it. If you want to add documentation to something that you are
-- currently splicing, you can use addModFinalizer e.g.
--
--
-- do
-- let nm = mkName "x"
-- addModFinalizer $ putDoc (DeclDoc nm) "Hello"
-- [d| $(varP nm) = 42 |]
--
--
-- The helper functions withDecDoc and withDecsDoc will
-- do this for you, as will the funD_doc and other _doc
-- combinators. You most likely want to have the -haddock flag
-- turned on when using this. Adding documentation to anything outside of
-- the current module will cause an error.
putDoc :: DocLoc -> String -> Q ()
-- | Retreives the Haddock documentation at the specified location, if one
-- exists. It can be used to read documentation on things defined outside
-- of the current module, provided that those modules were compiled with
-- the -haddock flag.
getDoc :: DocLoc -> Q (Maybe String)
sequenceQ :: forall m. Monad m => forall a. [m a] -> m [a]
liftString :: Quote m => String -> m Exp
trueName :: Name
falseName :: Name
nothingName :: Name
justName :: Name
leftName :: Name
rightName :: Name
nonemptyName :: Name
oneName :: Name
manyName :: Name
-- | dataToQa is an internal utility function for constructing
-- generic conversion functions from types with Data instances to
-- various quasi-quoting representations. See the source of
-- dataToExpQ and dataToPatQ for two example usages:
-- mkCon, mkLit and appQ are overloadable to
-- account for different syntax for expressions and patterns;
-- antiQ allows you to override type-specific cases, a common
-- usage is just const Nothing, which results in no overloading.
dataToQa :: forall m a k q. (Quote m, Data a) => (Name -> k) -> (Lit -> m q) -> (k -> [m q] -> m q) -> (forall b. Data b => b -> Maybe (m q)) -> a -> m q
-- | dataToExpQ converts a value to a Exp representation of
-- the same value, in the SYB style. It is generalized to take a function
-- override type-specific cases; see liftData for a more commonly
-- used variant.
dataToExpQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Exp)) -> a -> m Exp
-- | liftData is a variant of lift in the Lift type
-- class which works for any type with a Data instance.
liftData :: (Quote m, Data a) => a -> m Exp
-- | dataToPatQ converts a value to a Pat representation of
-- the same value, in the SYB style. It takes a function to handle
-- type-specific cases, alternatively, pass const Nothing to get
-- default behavior.
dataToPatQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Pat)) -> a -> m Pat
mkModName :: String -> ModName
modString :: ModName -> String
mkPkgName :: String -> PkgName
pkgString :: PkgName -> String
mkOccName :: String -> OccName
occString :: OccName -> String
-- | The name without its module prefix.
--
-- Examples
--
--
-- >>> nameBase ''Data.Either.Either
-- "Either"
--
-- >>> nameBase (mkName "foo")
-- "foo"
--
-- >>> nameBase (mkName "Module.foo")
-- "foo"
--
nameBase :: Name -> String
-- | Module prefix of a name, if it exists.
--
-- Examples
--
--
-- >>> nameModule ''Data.Either.Either
-- Just "Data.Either"
--
-- >>> nameModule (mkName "foo")
-- Nothing
--
-- >>> nameModule (mkName "Module.foo")
-- Just "Module"
--
nameModule :: Name -> Maybe String
-- | A name's package, if it exists.
--
-- Examples
--
--
-- >>> namePackage ''Data.Either.Either
-- Just "base"
--
-- >>> namePackage (mkName "foo")
-- Nothing
--
-- >>> namePackage (mkName "Module.foo")
-- Nothing
--
namePackage :: Name -> Maybe String
-- | Returns whether a name represents an occurrence of a top-level
-- variable (VarName), data constructor (DataName), type
-- constructor, or type class (TcClsName). If we can't be sure, it
-- returns Nothing.
--
-- Examples
--
--
-- >>> nameSpace 'Prelude.id
-- Just VarName
--
-- >>> nameSpace (mkName "id")
-- Nothing -- only works for top-level variable names
--
-- >>> nameSpace 'Data.Maybe.Just
-- Just DataName
--
-- >>> nameSpace ''Data.Maybe.Maybe
-- Just TcClsName
--
-- >>> nameSpace ''Data.Ord.Ord
-- Just TcClsName
--
nameSpace :: Name -> Maybe NameSpace
-- | Generate a capturable name. Occurrences of such names will be resolved
-- according to the Haskell scoping rules at the occurrence site.
--
-- For example:
--
--
-- f = [| pi + $(varE (mkName "pi")) |]
-- ...
-- g = let pi = 3 in $f
--
--
-- In this case, g is desugared to
--
--
-- g = Prelude.pi + 3
--
--
-- Note that mkName may be used with qualified names:
--
--
-- mkName "Prelude.pi"
--
--
-- See also dyn for a useful combinator. The above example could
-- be rewritten using dyn as
--
--
-- f = [| pi + $(dyn "pi") |]
--
mkName :: String -> Name
-- | Only used internally
mkNameU :: String -> Uniq -> Name
-- | Only used internally
mkNameL :: String -> Uniq -> Name
-- | Used for 'x etc, but not available to the programmer
mkNameG :: NameSpace -> String -> String -> String -> Name
mkNameS :: String -> Name
mkNameG_v :: String -> String -> String -> Name
mkNameG_tc :: String -> String -> String -> Name
mkNameG_d :: String -> String -> String -> Name
showName :: Name -> String
showName' :: NameIs -> Name -> String
-- | Tuple data constructor
tupleDataName :: Int -> Name
-- | Tuple type constructor
tupleTypeName :: Int -> Name
-- | Unboxed tuple data constructor
unboxedTupleDataName :: Int -> Name
-- | Unboxed tuple type constructor
unboxedTupleTypeName :: Int -> Name
mk_tup_name :: Int -> NameSpace -> Bool -> Name
-- | Unboxed sum data constructor
unboxedSumDataName :: SumAlt -> SumArity -> Name
-- | Unboxed sum type constructor
unboxedSumTypeName :: SumArity -> Name
-- | Highest allowed operator precedence for Fixity constructor
-- (answer: 9)
maxPrecedence :: Int
-- | Default fixity: infixl 9
defaultFixity :: Fixity
eqBytes :: Bytes -> Bytes -> Bool
compareBytes :: Bytes -> Bytes -> Ordering
cmpEq :: Ordering -> Bool
thenCmp :: Ordering -> Ordering -> Ordering
-- | Foreign formats supported by GHC via TH
data ForeignSrcLang
-- | C
LangC :: ForeignSrcLang
-- | C++
LangCxx :: ForeignSrcLang
-- | Objective C
LangObjc :: ForeignSrcLang
-- | Objective C++
LangObjcxx :: ForeignSrcLang
-- | Assembly language (.s)
LangAsm :: ForeignSrcLang
-- | Object (.o)
RawObject :: ForeignSrcLang
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.ModName
instance Data.Data.Data Language.Haskell.TH.Syntax.ModName
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.ModName
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.ModName
instance GHC.Show.Show Language.Haskell.TH.Syntax.ModName
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.PkgName
instance Data.Data.Data Language.Haskell.TH.Syntax.PkgName
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.PkgName
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.PkgName
instance GHC.Show.Show Language.Haskell.TH.Syntax.PkgName
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Module
instance Data.Data.Data Language.Haskell.TH.Syntax.Module
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Module
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Module
instance GHC.Show.Show Language.Haskell.TH.Syntax.Module
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.OccName
instance Data.Data.Data Language.Haskell.TH.Syntax.OccName
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.OccName
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.OccName
instance GHC.Show.Show Language.Haskell.TH.Syntax.OccName
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.NameSpace
instance Data.Data.Data Language.Haskell.TH.Syntax.NameSpace
instance GHC.Show.Show Language.Haskell.TH.Syntax.NameSpace
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.NameSpace
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.NameSpace
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.NameFlavour
instance GHC.Show.Show Language.Haskell.TH.Syntax.NameFlavour
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.NameFlavour
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.NameFlavour
instance Data.Data.Data Language.Haskell.TH.Syntax.NameFlavour
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Name
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Name
instance Data.Data.Data Language.Haskell.TH.Syntax.Name
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Loc
instance Data.Data.Data Language.Haskell.TH.Syntax.Loc
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Loc
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Loc
instance GHC.Show.Show Language.Haskell.TH.Syntax.Loc
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.ModuleInfo
instance Data.Data.Data Language.Haskell.TH.Syntax.ModuleInfo
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.ModuleInfo
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.ModuleInfo
instance GHC.Show.Show Language.Haskell.TH.Syntax.ModuleInfo
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.FixityDirection
instance Data.Data.Data Language.Haskell.TH.Syntax.FixityDirection
instance GHC.Show.Show Language.Haskell.TH.Syntax.FixityDirection
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.FixityDirection
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.FixityDirection
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Fixity
instance Data.Data.Data Language.Haskell.TH.Syntax.Fixity
instance GHC.Show.Show Language.Haskell.TH.Syntax.Fixity
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Fixity
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Fixity
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Bytes
instance Data.Data.Data Language.Haskell.TH.Syntax.Bytes
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Lit
instance Data.Data.Data Language.Haskell.TH.Syntax.Lit
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Lit
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Lit
instance GHC.Show.Show Language.Haskell.TH.Syntax.Lit
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Overlap
instance Data.Data.Data Language.Haskell.TH.Syntax.Overlap
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Overlap
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Overlap
instance GHC.Show.Show Language.Haskell.TH.Syntax.Overlap
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.FunDep
instance Data.Data.Data Language.Haskell.TH.Syntax.FunDep
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.FunDep
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.FunDep
instance GHC.Show.Show Language.Haskell.TH.Syntax.FunDep
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Callconv
instance Data.Data.Data Language.Haskell.TH.Syntax.Callconv
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Callconv
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Callconv
instance GHC.Show.Show Language.Haskell.TH.Syntax.Callconv
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Safety
instance Data.Data.Data Language.Haskell.TH.Syntax.Safety
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Safety
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Safety
instance GHC.Show.Show Language.Haskell.TH.Syntax.Safety
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Inline
instance Data.Data.Data Language.Haskell.TH.Syntax.Inline
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Inline
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Inline
instance GHC.Show.Show Language.Haskell.TH.Syntax.Inline
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.RuleMatch
instance Data.Data.Data Language.Haskell.TH.Syntax.RuleMatch
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.RuleMatch
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.RuleMatch
instance GHC.Show.Show Language.Haskell.TH.Syntax.RuleMatch
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Phases
instance Data.Data.Data Language.Haskell.TH.Syntax.Phases
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Phases
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Phases
instance GHC.Show.Show Language.Haskell.TH.Syntax.Phases
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.AnnTarget
instance Data.Data.Data Language.Haskell.TH.Syntax.AnnTarget
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.AnnTarget
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.AnnTarget
instance GHC.Show.Show Language.Haskell.TH.Syntax.AnnTarget
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.SourceUnpackedness
instance Data.Data.Data Language.Haskell.TH.Syntax.SourceUnpackedness
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.SourceUnpackedness
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.SourceUnpackedness
instance GHC.Show.Show Language.Haskell.TH.Syntax.SourceUnpackedness
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.SourceStrictness
instance Data.Data.Data Language.Haskell.TH.Syntax.SourceStrictness
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.SourceStrictness
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.SourceStrictness
instance GHC.Show.Show Language.Haskell.TH.Syntax.SourceStrictness
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.DecidedStrictness
instance Data.Data.Data Language.Haskell.TH.Syntax.DecidedStrictness
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DecidedStrictness
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DecidedStrictness
instance GHC.Show.Show Language.Haskell.TH.Syntax.DecidedStrictness
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Bang
instance Data.Data.Data Language.Haskell.TH.Syntax.Bang
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Bang
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Bang
instance GHC.Show.Show Language.Haskell.TH.Syntax.Bang
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.PatSynArgs
instance Data.Data.Data Language.Haskell.TH.Syntax.PatSynArgs
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.PatSynArgs
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.PatSynArgs
instance GHC.Show.Show Language.Haskell.TH.Syntax.PatSynArgs
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Specificity
instance Data.Data.Data Language.Haskell.TH.Syntax.Specificity
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Specificity
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Specificity
instance GHC.Show.Show Language.Haskell.TH.Syntax.Specificity
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.InjectivityAnn
instance Data.Data.Data Language.Haskell.TH.Syntax.InjectivityAnn
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.InjectivityAnn
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.InjectivityAnn
instance GHC.Show.Show Language.Haskell.TH.Syntax.InjectivityAnn
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.TyLit
instance Data.Data.Data Language.Haskell.TH.Syntax.TyLit
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.TyLit
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.TyLit
instance GHC.Show.Show Language.Haskell.TH.Syntax.TyLit
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Role
instance Data.Data.Data Language.Haskell.TH.Syntax.Role
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Role
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Role
instance GHC.Show.Show Language.Haskell.TH.Syntax.Role
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.AnnLookup
instance Data.Data.Data Language.Haskell.TH.Syntax.AnnLookup
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.AnnLookup
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.AnnLookup
instance GHC.Show.Show Language.Haskell.TH.Syntax.AnnLookup
instance GHC.Base.Functor Language.Haskell.TH.Syntax.TyVarBndr
instance GHC.Generics.Generic (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance GHC.Classes.Ord flag => GHC.Classes.Ord (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance GHC.Classes.Eq flag => GHC.Classes.Eq (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance GHC.Show.Show flag => GHC.Show.Show (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Type
instance Data.Data.Data Language.Haskell.TH.Syntax.Type
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Type
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Type
instance GHC.Show.Show Language.Haskell.TH.Syntax.Type
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.FamilyResultSig
instance Data.Data.Data Language.Haskell.TH.Syntax.FamilyResultSig
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.FamilyResultSig
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.FamilyResultSig
instance GHC.Show.Show Language.Haskell.TH.Syntax.FamilyResultSig
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.TypeFamilyHead
instance Data.Data.Data Language.Haskell.TH.Syntax.TypeFamilyHead
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.TypeFamilyHead
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.TypeFamilyHead
instance GHC.Show.Show Language.Haskell.TH.Syntax.TypeFamilyHead
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Con
instance Data.Data.Data Language.Haskell.TH.Syntax.Con
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Con
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Con
instance GHC.Show.Show Language.Haskell.TH.Syntax.Con
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.RuleBndr
instance Data.Data.Data Language.Haskell.TH.Syntax.RuleBndr
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.RuleBndr
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.RuleBndr
instance GHC.Show.Show Language.Haskell.TH.Syntax.RuleBndr
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Foreign
instance Data.Data.Data Language.Haskell.TH.Syntax.Foreign
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Foreign
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Foreign
instance GHC.Show.Show Language.Haskell.TH.Syntax.Foreign
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.TySynEqn
instance Data.Data.Data Language.Haskell.TH.Syntax.TySynEqn
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.TySynEqn
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.TySynEqn
instance GHC.Show.Show Language.Haskell.TH.Syntax.TySynEqn
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.DerivStrategy
instance Data.Data.Data Language.Haskell.TH.Syntax.DerivStrategy
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DerivStrategy
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DerivStrategy
instance GHC.Show.Show Language.Haskell.TH.Syntax.DerivStrategy
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.DerivClause
instance Data.Data.Data Language.Haskell.TH.Syntax.DerivClause
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DerivClause
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DerivClause
instance GHC.Show.Show Language.Haskell.TH.Syntax.DerivClause
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Pragma
instance Data.Data.Data Language.Haskell.TH.Syntax.Pragma
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Pragma
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Pragma
instance GHC.Show.Show Language.Haskell.TH.Syntax.Pragma
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Pat
instance Data.Data.Data Language.Haskell.TH.Syntax.Pat
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Pat
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Pat
instance GHC.Show.Show Language.Haskell.TH.Syntax.Pat
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Match
instance Data.Data.Data Language.Haskell.TH.Syntax.Match
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Match
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Match
instance GHC.Show.Show Language.Haskell.TH.Syntax.Match
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Range
instance Data.Data.Data Language.Haskell.TH.Syntax.Range
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Range
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Range
instance GHC.Show.Show Language.Haskell.TH.Syntax.Range
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Exp
instance Data.Data.Data Language.Haskell.TH.Syntax.Exp
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Exp
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Exp
instance GHC.Show.Show Language.Haskell.TH.Syntax.Exp
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Stmt
instance Data.Data.Data Language.Haskell.TH.Syntax.Stmt
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Stmt
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Stmt
instance GHC.Show.Show Language.Haskell.TH.Syntax.Stmt
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Guard
instance Data.Data.Data Language.Haskell.TH.Syntax.Guard
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Guard
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Guard
instance GHC.Show.Show Language.Haskell.TH.Syntax.Guard
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Body
instance Data.Data.Data Language.Haskell.TH.Syntax.Body
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Body
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Body
instance GHC.Show.Show Language.Haskell.TH.Syntax.Body
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Clause
instance Data.Data.Data Language.Haskell.TH.Syntax.Clause
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Clause
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Clause
instance GHC.Show.Show Language.Haskell.TH.Syntax.Clause
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.PatSynDir
instance Data.Data.Data Language.Haskell.TH.Syntax.PatSynDir
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.PatSynDir
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.PatSynDir
instance GHC.Show.Show Language.Haskell.TH.Syntax.PatSynDir
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Dec
instance Data.Data.Data Language.Haskell.TH.Syntax.Dec
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Dec
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Dec
instance GHC.Show.Show Language.Haskell.TH.Syntax.Dec
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.Info
instance Data.Data.Data Language.Haskell.TH.Syntax.Info
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Info
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Info
instance GHC.Show.Show Language.Haskell.TH.Syntax.Info
instance GHC.Generics.Generic Language.Haskell.TH.Syntax.DocLoc
instance Data.Data.Data Language.Haskell.TH.Syntax.DocLoc
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DocLoc
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DocLoc
instance GHC.Show.Show Language.Haskell.TH.Syntax.DocLoc
instance Language.Haskell.TH.Syntax.Quasi GHC.Types.IO
instance GHC.Base.Monad Language.Haskell.TH.Syntax.Q
instance Control.Monad.Fail.MonadFail Language.Haskell.TH.Syntax.Q
instance GHC.Base.Functor Language.Haskell.TH.Syntax.Q
instance GHC.Base.Applicative Language.Haskell.TH.Syntax.Q
instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Language.Haskell.TH.Syntax.Q a)
instance GHC.Base.Monoid a => GHC.Base.Monoid (Language.Haskell.TH.Syntax.Q a)
instance Control.Monad.Fix.MonadFix Language.Haskell.TH.Syntax.Q
instance Language.Haskell.TH.Syntax.Quote Language.Haskell.TH.Syntax.Q
instance Control.Monad.IO.Class.MonadIO Language.Haskell.TH.Syntax.Q
instance Language.Haskell.TH.Syntax.Quasi Language.Haskell.TH.Syntax.Q
instance Language.Haskell.TH.Syntax.Lift GHC.Integer.Type.Integer
instance Language.Haskell.TH.Syntax.Lift GHC.Types.Int
instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Int#
instance Language.Haskell.TH.Syntax.Lift GHC.Int.Int8
instance Language.Haskell.TH.Syntax.Lift GHC.Int.Int16
instance Language.Haskell.TH.Syntax.Lift GHC.Int.Int32
instance Language.Haskell.TH.Syntax.Lift GHC.Int.Int64
instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Word#
instance Language.Haskell.TH.Syntax.Lift GHC.Types.Word
instance Language.Haskell.TH.Syntax.Lift GHC.Word.Word8
instance Language.Haskell.TH.Syntax.Lift GHC.Word.Word16
instance Language.Haskell.TH.Syntax.Lift GHC.Word.Word32
instance Language.Haskell.TH.Syntax.Lift GHC.Word.Word64
instance Language.Haskell.TH.Syntax.Lift GHC.Natural.Natural
instance GHC.Real.Integral a => Language.Haskell.TH.Syntax.Lift (GHC.Real.Ratio a)
instance Language.Haskell.TH.Syntax.Lift GHC.Types.Float
instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Float#
instance Language.Haskell.TH.Syntax.Lift GHC.Types.Double
instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Double#
instance Language.Haskell.TH.Syntax.Lift GHC.Types.Char
instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Char#
instance Language.Haskell.TH.Syntax.Lift GHC.Types.Bool
instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Addr#
instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (GHC.Maybe.Maybe a)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (Data.Either.Either a b)
instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift [a]
instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (GHC.Base.NonEmpty a)
instance Language.Haskell.TH.Syntax.Lift Data.Void.Void
instance Language.Haskell.TH.Syntax.Lift ()
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (a, b)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c) => Language.Haskell.TH.Syntax.Lift (a, b, c)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d) => Language.Haskell.TH.Syntax.Lift (a, b, c, d)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e) => Language.Haskell.TH.Syntax.Lift (a, b, c, d, e)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f) => Language.Haskell.TH.Syntax.Lift (a, b, c, d, e, f)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f, Language.Haskell.TH.Syntax.Lift g) => Language.Haskell.TH.Syntax.Lift (a, b, c, d, e, f, g)
instance Language.Haskell.TH.Syntax.Lift (# #)
instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (# a #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (# a, b #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c) => Language.Haskell.TH.Syntax.Lift (# a, b, c #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d, e #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d, e, f #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f, Language.Haskell.TH.Syntax.Lift g) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d, e, f, g #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (# a | b #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c) => Language.Haskell.TH.Syntax.Lift (# a | b | c #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d | e #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d | e | f #)
instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f, Language.Haskell.TH.Syntax.Lift g) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d | e | f | g #)
instance GHC.Show.Show Language.Haskell.TH.Syntax.Bytes
instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Bytes
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Bytes
instance Language.Haskell.TH.Syntax.Quote GHC.Types.IO
instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Name
instance GHC.Show.Show Language.Haskell.TH.Syntax.Name
-- | Monadic front-end to Text.PrettyPrint
module Language.Haskell.TH.PprLib
type Doc = PprM Doc
data PprM a
-- | An empty document
empty :: Doc
-- | A ';' character
semi :: Doc
-- | A ',' character
comma :: Doc
-- | A : character
colon :: Doc
-- | A "::" string
dcolon :: Doc
-- | A space character
space :: Doc
-- | A '=' character
equals :: Doc
-- | A "->" string
arrow :: Doc
-- | A '(' character
lparen :: Doc
-- | A ')' character
rparen :: Doc
-- | A '[' character
lbrack :: Doc
-- | A ']' character
rbrack :: Doc
-- | A '{' character
lbrace :: Doc
-- | A '}' character
rbrace :: Doc
text :: String -> Doc
char :: Char -> Doc
ptext :: String -> Doc
int :: Int -> Doc
integer :: Integer -> Doc
float :: Float -> Doc
double :: Double -> Doc
rational :: Rational -> Doc
-- | Wrap document in (...)
parens :: Doc -> Doc
-- | Wrap document in [...]
brackets :: Doc -> Doc
-- | Wrap document in {...}
braces :: Doc -> Doc
-- | Wrap document in '...'
quotes :: Doc -> Doc
-- | Wrap document in "..."
doubleQuotes :: Doc -> Doc
-- | Beside
(<>) :: Doc -> Doc -> Doc
infixl 6 <>
-- | Beside, separated by space
(<+>) :: Doc -> Doc -> Doc
infixl 6 <+>
-- | List version of <>
hcat :: [Doc] -> Doc
-- | List version of <+>
hsep :: [Doc] -> Doc
-- | Above; if there is no overlap it "dovetails" the two
($$) :: Doc -> Doc -> Doc
infixl 5 $$
-- | Above, without dovetailing.
($+$) :: 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
-- | Nested
nest :: Int -> Doc -> Doc
-- |
-- hang d1 n d2 = sep [d1, nest n d2]
--
hang :: Doc -> Int -> Doc -> Doc
punctuate :: Doc -> [Doc] -> [Doc]
-- | Returns True if the document is empty
isEmpty :: Doc -> PprM Bool
to_HPJ_Doc :: Doc -> Doc
pprName :: Name -> Doc
pprName' :: NameIs -> Name -> Doc
instance GHC.Show.Show Language.Haskell.TH.PprLib.Doc
instance GHC.Base.Functor Language.Haskell.TH.PprLib.PprM
instance GHC.Base.Applicative Language.Haskell.TH.PprLib.PprM
instance GHC.Base.Monad Language.Haskell.TH.PprLib.PprM
-- | contains a prettyprinter for the Template Haskell datatypes
module Language.Haskell.TH.Ppr
nestDepth :: Int
type Precedence = Int
appPrec :: Precedence
opPrec :: Precedence
unopPrec :: Precedence
sigPrec :: Precedence
noPrec :: Precedence
parensIf :: Bool -> Doc -> Doc
pprint :: Ppr a => a -> String
class Ppr a
ppr :: Ppr a => a -> Doc
ppr_list :: Ppr a => [a] -> Doc
ppr_sig :: Name -> Type -> Doc
pprFixity :: Name -> Fixity -> Doc
-- | Pretty prints a pattern synonym type signature
pprPatSynSig :: Name -> PatSynType -> Doc
-- | Pretty prints a pattern synonym's type; follows the usual conventions
-- to print a pattern synonym type compactly, yet unambiguously. See the
-- note on PatSynType and the section on pattern synonyms in the
-- GHC user's guide for more information.
pprPatSynType :: PatSynType -> Doc
pprPrefixOcc :: Name -> Doc
isSymOcc :: Name -> Bool
pprInfixExp :: Exp -> Doc
pprExp :: Precedence -> Exp -> Doc
pprFields :: [(Name, Exp)] -> Doc
pprMaybeExp :: Precedence -> Maybe Exp -> Doc
pprMatchPat :: Pat -> Doc
pprGuarded :: Doc -> (Guard, Exp) -> Doc
pprBody :: Bool -> Body -> Doc
pprLit :: Precedence -> Lit -> Doc
bytesToString :: [Word8] -> String
pprString :: String -> Doc
pprPat :: Precedence -> Pat -> Doc
ppr_dec :: Bool -> Dec -> Doc
ppr_deriv_strategy :: DerivStrategy -> Doc
ppr_overlap :: Overlap -> Doc
ppr_data :: Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc
ppr_newtype :: Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> Con -> [DerivClause] -> Doc
ppr_typedef :: String -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc
ppr_deriv_clause :: DerivClause -> Doc
ppr_tySyn :: Doc -> Maybe Name -> Doc -> Type -> Doc
ppr_tf_head :: TypeFamilyHead -> Doc
ppr_bndrs :: PprFlag flag => Maybe [TyVarBndr flag] -> Doc
commaSepApplied :: [Name] -> Doc
pprForall :: [TyVarBndr Specificity] -> Cxt -> Doc
pprForallVis :: [TyVarBndr ()] -> Cxt -> Doc
pprForall' :: PprFlag flag => ForallVisFlag -> [TyVarBndr flag] -> Cxt -> Doc
pprRecFields :: [(Name, Strict, Type)] -> Type -> Doc
pprGadtRHS :: [(Strict, Type)] -> Type -> Doc
pprVarBangType :: VarBangType -> Doc
pprBangType :: BangType -> Doc
-- | Deprecated: As of template-haskell-2.11.0.0,
-- VarStrictType has been replaced by VarBangType. Please
-- use pprVarBangType instead.
pprVarStrictType :: (Name, Strict, Type) -> Doc
-- | Deprecated: As of template-haskell-2.11.0.0,
-- StrictType has been replaced by BangType. Please use
-- pprBangType instead.
pprStrictType :: (Strict, Type) -> Doc
pprParendType :: Type -> Doc
pprInfixT :: Type -> Doc
pprParendTypeArg :: TypeArg -> Doc
isStarT :: Type -> Bool
pprTyApp :: (Type, [TypeArg]) -> Doc
fromTANormal :: TypeArg -> Maybe Type
pprFunArgType :: Type -> Doc
data ForallVisFlag
ForallVis :: ForallVisFlag
ForallInvis :: ForallVisFlag
data TypeArg
TANormal :: Type -> TypeArg
TyArg :: Kind -> TypeArg
split :: Type -> (Type, [TypeArg])
pprTyLit :: TyLit -> Doc
class PprFlag flag
pprTyVarBndr :: PprFlag flag => TyVarBndr flag -> Doc
pprCxt :: Cxt -> Doc
ppr_cxt_preds :: Cxt -> Doc
where_clause :: [Dec] -> Doc
showtextl :: Show a => a -> Doc
hashParens :: Doc -> Doc
quoteParens :: Doc -> Doc
sepWith :: Doc -> (a -> Doc) -> [a] -> Doc
commaSep :: Ppr a => [a] -> Doc
commaSepWith :: (a -> Doc) -> [a] -> Doc
semiSep :: Ppr a => [a] -> Doc
semiSepWith :: (a -> Doc) -> [a] -> Doc
unboxedSumBars :: Doc -> SumAlt -> SumArity -> Doc
bar :: Doc
instance GHC.Show.Show Language.Haskell.TH.Ppr.ForallVisFlag
instance Language.Haskell.TH.Ppr.PprFlag ()
instance Language.Haskell.TH.Ppr.PprFlag Language.Haskell.TH.Syntax.Specificity
instance Language.Haskell.TH.Ppr.PprFlag flag => Language.Haskell.TH.Ppr.Ppr (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Ppr.TypeArg
instance Language.Haskell.TH.Ppr.Ppr a => Language.Haskell.TH.Ppr.Ppr [a]
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Name
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Info
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Module
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.ModuleInfo
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Exp
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Stmt
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Match
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Lit
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Pat
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Dec
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.FunDep
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.FamilyResultSig
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.InjectivityAnn
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Foreign
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Pragma
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Inline
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.RuleMatch
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Phases
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.RuleBndr
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Clause
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Con
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.PatSynDir
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.PatSynArgs
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Bang
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.SourceUnpackedness
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.SourceStrictness
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.DecidedStrictness
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Type
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.TyLit
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Role
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Range
instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Loc
-- | Language.Haskell.TH.Lib.Internal exposes some additional functionality
-- that is used internally in GHC's integration with Template Haskell.
-- This is not a part of the public API, and as such, there are no API
-- guarantees for this module from version to version.
module Language.Haskell.TH.Lib.Internal
-- | Representation-polymorphic since template-haskell-2.17.0.0.
type TExpQ a = Q (TExp a)
type CodeQ = Code Q
type InfoQ = Q Info
type PatQ = Q Pat
type FieldPatQ = Q FieldPat
type ExpQ = Q Exp
type DecQ = Q Dec
type DecsQ = Q [Dec]
type Decs = [Dec]
type ConQ = Q Con
type TypeQ = Q Type
type KindQ = Q Kind
type TyLitQ = Q TyLit
type CxtQ = Q Cxt
type PredQ = Q Pred
type DerivClauseQ = Q DerivClause
type MatchQ = Q Match
type ClauseQ = Q Clause
type BodyQ = Q Body
type GuardQ = Q Guard
type StmtQ = Q Stmt
type RangeQ = Q Range
type SourceStrictnessQ = Q SourceStrictness
type SourceUnpackednessQ = Q SourceUnpackedness
type BangQ = Q Bang
type BangTypeQ = Q BangType
type VarBangTypeQ = Q VarBangType
type StrictTypeQ = Q StrictType
type VarStrictTypeQ = Q VarStrictType
type FieldExpQ = Q FieldExp
type RuleBndrQ = Q RuleBndr
type TySynEqnQ = Q TySynEqn
type PatSynDirQ = Q PatSynDir
type PatSynArgsQ = Q PatSynArgs
type FamilyResultSigQ = Q FamilyResultSig
type DerivStrategyQ = Q DerivStrategy
type Role = Role
type InjectivityAnn = InjectivityAnn
type TyVarBndrUnit = TyVarBndr ()
type TyVarBndrSpec = TyVarBndr Specificity
intPrimL :: Integer -> Lit
wordPrimL :: Integer -> Lit
floatPrimL :: Rational -> Lit
doublePrimL :: Rational -> Lit
integerL :: Integer -> Lit
charL :: Char -> Lit
charPrimL :: Char -> Lit
stringL :: String -> Lit
stringPrimL :: [Word8] -> Lit
bytesPrimL :: Bytes -> Lit
rationalL :: Rational -> Lit
litP :: Quote m => Lit -> m Pat
varP :: Quote m => Name -> m Pat
tupP :: Quote m => [m Pat] -> m Pat
unboxedTupP :: Quote m => [m Pat] -> m Pat
unboxedSumP :: Quote m => m Pat -> SumAlt -> SumArity -> m Pat
conP :: Quote m => Name -> [m Type] -> [m Pat] -> m Pat
infixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
uInfixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
parensP :: Quote m => m Pat -> m Pat
tildeP :: Quote m => m Pat -> m Pat
bangP :: Quote m => m Pat -> m Pat
asP :: Quote m => Name -> m Pat -> m Pat
wildP :: Quote m => m Pat
recP :: Quote m => Name -> [m FieldPat] -> m Pat
listP :: Quote m => [m Pat] -> m Pat
sigP :: Quote m => m Pat -> m Type -> m Pat
viewP :: Quote m => m Exp -> m Pat -> m Pat
fieldPat :: Quote m => Name -> m Pat -> m FieldPat
bindS :: Quote m => m Pat -> m Exp -> m Stmt
letS :: Quote m => [m Dec] -> m Stmt
noBindS :: Quote m => m Exp -> m Stmt
parS :: Quote m => [[m Stmt]] -> m Stmt
recS :: Quote m => [m Stmt] -> m Stmt
fromR :: Quote m => m Exp -> m Range
fromThenR :: Quote m => m Exp -> m Exp -> m Range
fromToR :: Quote m => m Exp -> m Exp -> m Range
fromThenToR :: Quote m => m Exp -> m Exp -> m Exp -> m Range
normalB :: Quote m => m Exp -> m Body
guardedB :: Quote m => [m (Guard, Exp)] -> m Body
normalG :: Quote m => m Exp -> m Guard
normalGE :: Quote m => m Exp -> m Exp -> m (Guard, Exp)
patG :: Quote m => [m Stmt] -> m Guard
patGE :: Quote m => [m Stmt] -> m Exp -> m (Guard, Exp)
-- | Use with caseE
match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match
-- | Use with funD
clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause
-- | Dynamically binding a variable (unhygenic)
dyn :: Quote m => String -> m Exp
varE :: Quote m => Name -> m Exp
conE :: Quote m => Name -> m Exp
litE :: Quote m => Lit -> m Exp
appE :: Quote m => m Exp -> m Exp -> m Exp
appTypeE :: Quote m => m Exp -> m Type -> m Exp
parensE :: Quote m => m Exp -> m Exp
uInfixE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
infixE :: Quote m => Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixApp :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
sectionL :: Quote m => m Exp -> m Exp -> m Exp
sectionR :: Quote m => m Exp -> m Exp -> m Exp
lamE :: Quote m => [m Pat] -> m Exp -> m Exp
-- | Single-arg lambda
lam1E :: Quote m => m Pat -> m Exp -> m Exp
lamCaseE :: Quote m => [m Match] -> m Exp
tupE :: Quote m => [Maybe (m Exp)] -> m Exp
unboxedTupE :: Quote m => [Maybe (m Exp)] -> m Exp
unboxedSumE :: Quote m => m Exp -> SumAlt -> SumArity -> m Exp
condE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
multiIfE :: Quote m => [m (Guard, Exp)] -> m Exp
letE :: Quote m => [m Dec] -> m Exp -> m Exp
caseE :: Quote m => m Exp -> [m Match] -> m Exp
doE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp
mdoE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp
compE :: Quote m => [m Stmt] -> m Exp
arithSeqE :: Quote m => m Range -> m Exp
listE :: Quote m => [m Exp] -> m Exp
sigE :: Quote m => m Exp -> m Type -> m Exp
recConE :: Quote m => Name -> [m (Name, Exp)] -> m Exp
recUpdE :: Quote m => m Exp -> [m (Name, Exp)] -> m Exp
stringE :: Quote m => String -> m Exp
fieldExp :: Quote m => Name -> m Exp -> m (Name, Exp)
-- |
-- staticE x = [| static x |]
--
staticE :: Quote m => m Exp -> m Exp
unboundVarE :: Quote m => Name -> m Exp
labelE :: Quote m => String -> m Exp
implicitParamVarE :: Quote m => String -> m Exp
getFieldE :: Quote m => m Exp -> String -> m Exp
projectionE :: Quote m => NonEmpty String -> m Exp
fromE :: Quote m => m Exp -> m Exp
fromThenE :: Quote m => m Exp -> m Exp -> m Exp
fromToE :: Quote m => m Exp -> m Exp -> m Exp
fromThenToE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
valD :: Quote m => m Pat -> m Body -> [m Dec] -> m Dec
funD :: Quote m => Name -> [m Clause] -> m Dec
tySynD :: Quote m => Name -> [m (TyVarBndr ())] -> m Type -> m Dec
dataD :: Quote m => m Cxt -> Name -> [m (TyVarBndr ())] -> Maybe (m Kind) -> [m Con] -> [m DerivClause] -> m Dec
newtypeD :: Quote m => m Cxt -> Name -> [m (TyVarBndr ())] -> Maybe (m Kind) -> m Con -> [m DerivClause] -> m Dec
classD :: Quote m => m Cxt -> Name -> [m (TyVarBndr ())] -> [FunDep] -> [m Dec] -> m Dec
instanceD :: Quote m => m Cxt -> m Type -> [m Dec] -> m Dec
instanceWithOverlapD :: Quote m => Maybe Overlap -> m Cxt -> m Type -> [m Dec] -> m Dec
sigD :: Quote m => Name -> m Type -> m Dec
kiSigD :: Quote m => Name -> m Kind -> m Dec
forImpD :: Quote m => Callconv -> Safety -> String -> Name -> m Type -> m Dec
infixLD :: Quote m => Int -> Name -> m Dec
infixRD :: Quote m => Int -> Name -> m Dec
infixND :: Quote m => Int -> Name -> m Dec
defaultD :: Quote m => [m Type] -> m Dec
pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec
pragOpaqueD :: Quote m => Name -> m Dec
pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec
pragSpecInlD :: Quote m => Name -> m Type -> Inline -> Phases -> m Dec
pragSpecInstD :: Quote m => m Type -> m Dec
pragRuleD :: Quote m => String -> Maybe [m (TyVarBndr ())] -> [m RuleBndr] -> m Exp -> m Exp -> Phases -> m Dec
pragAnnD :: Quote m => AnnTarget -> m Exp -> m Dec
pragLineD :: Quote m => Int -> String -> m Dec
pragCompleteD :: Quote m => [Name] -> Maybe Name -> m Dec
dataInstD :: Quote m => m Cxt -> Maybe [m (TyVarBndr ())] -> m Type -> Maybe (m Kind) -> [m Con] -> [m DerivClause] -> m Dec
newtypeInstD :: Quote m => m Cxt -> Maybe [m (TyVarBndr ())] -> m Type -> Maybe (m Kind) -> m Con -> [m DerivClause] -> m Dec
tySynInstD :: Quote m => m TySynEqn -> m Dec
dataFamilyD :: Quote m => Name -> [m (TyVarBndr ())] -> Maybe (m Kind) -> m Dec
openTypeFamilyD :: Quote m => Name -> [m (TyVarBndr ())] -> m FamilyResultSig -> Maybe InjectivityAnn -> m Dec
closedTypeFamilyD :: Quote m => Name -> [m (TyVarBndr ())] -> m FamilyResultSig -> Maybe InjectivityAnn -> [m TySynEqn] -> m Dec
roleAnnotD :: Quote m => Name -> [Role] -> m Dec
standaloneDerivD :: Quote m => m Cxt -> m Type -> m Dec
standaloneDerivWithStrategyD :: Quote m => Maybe (m DerivStrategy) -> m Cxt -> m Type -> m Dec
defaultSigD :: Quote m => Name -> m Type -> m Dec
-- | Pattern synonym declaration
patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec
-- | Pattern synonym type signature
patSynSigD :: Quote m => Name -> m Type -> m Dec
-- | Implicit parameter binding declaration. Can only be used in let and
-- where clauses which consist entirely of implicit bindings.
implicitParamBindD :: Quote m => String -> m Exp -> m Dec
tySynEqn :: Quote m => Maybe [m (TyVarBndr ())] -> m Type -> m Type -> m TySynEqn
cxt :: Quote m => [m Pred] -> m Cxt
derivClause :: Quote m => Maybe (m DerivStrategy) -> [m Pred] -> m DerivClause
stockStrategy :: Quote m => m DerivStrategy
anyclassStrategy :: Quote m => m DerivStrategy
newtypeStrategy :: Quote m => m DerivStrategy
viaStrategy :: Quote m => m Type -> m DerivStrategy
normalC :: Quote m => Name -> [m BangType] -> m Con
recC :: Quote m => Name -> [m VarBangType] -> m Con
infixC :: Quote m => m (Bang, Type) -> Name -> m (Bang, Type) -> m Con
forallC :: Quote m => [m (TyVarBndr Specificity)] -> m Cxt -> m Con -> m Con
gadtC :: Quote m => [Name] -> [m StrictType] -> m Type -> m Con
recGadtC :: Quote m => [Name] -> [m VarStrictType] -> m Type -> m Con
forallT :: Quote m => [m (TyVarBndr Specificity)] -> m Cxt -> m Type -> m Type
forallVisT :: Quote m => [m (TyVarBndr ())] -> m Type -> m Type
varT :: Quote m => Name -> m Type
conT :: Quote m => Name -> m Type
infixT :: Quote m => m Type -> Name -> m Type -> m Type
uInfixT :: Quote m => m Type -> Name -> m Type -> m Type
promotedInfixT :: Quote m => m Type -> Name -> m Type -> m Type
promotedUInfixT :: Quote m => m Type -> Name -> m Type -> m Type
parensT :: Quote m => m Type -> m Type
appT :: Quote m => m Type -> m Type -> m Type
appKindT :: Quote m => m Type -> m Kind -> m Type
arrowT :: Quote m => m Type
mulArrowT :: Quote m => m Type
listT :: Quote m => m Type
litT :: Quote m => m TyLit -> m Type
tupleT :: Quote m => Int -> m Type
unboxedTupleT :: Quote m => Int -> m Type
unboxedSumT :: Quote m => SumArity -> m Type
sigT :: Quote m => m Type -> m Kind -> m Type
equalityT :: Quote m => m Type
wildCardT :: Quote m => m Type
implicitParamT :: Quote m => String -> m Type -> m Type
-- | Deprecated: As of template-haskell-2.10, constraint predicates
-- (Pred) are just types (Type), in keeping with ConstraintKinds. Please
-- use conT and appT.
classP :: Quote m => Name -> [m Type] -> m Pred
-- | Deprecated: As of template-haskell-2.10, constraint predicates
-- (Pred) are just types (Type), in keeping with ConstraintKinds. Please
-- see equalityT.
equalP :: Quote m => m Type -> m Type -> m Pred
promotedT :: Quote m => Name -> m Type
promotedTupleT :: Quote m => Int -> m Type
promotedNilT :: Quote m => m Type
promotedConsT :: Quote m => m Type
noSourceUnpackedness :: Quote m => m SourceUnpackedness
sourceNoUnpack :: Quote m => m SourceUnpackedness
sourceUnpack :: Quote m => m SourceUnpackedness
noSourceStrictness :: Quote m => m SourceStrictness
sourceLazy :: Quote m => m SourceStrictness
sourceStrict :: Quote m => m SourceStrictness
-- | Deprecated: Use bang. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example
-- usage: 'bang noSourceUnpackedness sourceStrict'
isStrict :: Quote m => m Strict
-- | Deprecated: Use bang. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example
-- usage: 'bang noSourceUnpackedness noSourceStrictness'
notStrict :: Quote m => m Strict
-- | Deprecated: Use bang. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example
-- usage: 'bang sourceUnpack sourceStrict'
unpacked :: Quote m => m Strict
bang :: Quote m => m SourceUnpackedness -> m SourceStrictness -> m Bang
bangType :: Quote m => m Bang -> m Type -> m BangType
varBangType :: Quote m => Name -> m BangType -> m VarBangType
-- | Deprecated: As of template-haskell-2.11.0.0,
-- StrictType has been replaced by BangType. Please use
-- bangType instead.
strictType :: Quote m => m Strict -> m Type -> m StrictType
-- | Deprecated: As of template-haskell-2.11.0.0,
-- VarStrictType has been replaced by VarBangType. Please
-- use varBangType instead.
varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType
numTyLit :: Quote m => Integer -> m TyLit
strTyLit :: Quote m => String -> m TyLit
charTyLit :: Quote m => Char -> m TyLit
plainTV :: Quote m => Name -> m (TyVarBndr ())
plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity)
kindedTV :: Quote m => Name -> m Kind -> m (TyVarBndr ())
kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity)
specifiedSpec :: Specificity
inferredSpec :: Specificity
varK :: Name -> Kind
conK :: Name -> Kind
tupleK :: Int -> Kind
arrowK :: Kind
listK :: Kind
appK :: Kind -> Kind -> Kind
starK :: Quote m => m Kind
constraintK :: Quote m => m Kind
noSig :: Quote m => m FamilyResultSig
kindSig :: Quote m => m Kind -> m FamilyResultSig
tyVarSig :: Quote m => m (TyVarBndr ()) -> m FamilyResultSig
injectivityAnn :: Name -> [Name] -> InjectivityAnn
nominalR :: Role
representationalR :: Role
phantomR :: Role
inferR :: Role
cCall :: Callconv
stdCall :: Callconv
cApi :: Callconv
prim :: Callconv
javaScript :: Callconv
unsafe :: Safety
safe :: Safety
interruptible :: Safety
funDep :: [Name] -> [Name] -> FunDep
ruleVar :: Quote m => Name -> m RuleBndr
typedRuleVar :: Quote m => Name -> m Type -> m RuleBndr
valueAnnotation :: Name -> AnnTarget
typeAnnotation :: Name -> AnnTarget
moduleAnnotation :: AnnTarget
unidir :: Quote m => m PatSynDir
implBidir :: Quote m => m PatSynDir
explBidir :: Quote m => [m Clause] -> m PatSynDir
prefixPatSyn :: Quote m => [Name] -> m PatSynArgs
recordPatSyn :: Quote m => [Name] -> m PatSynArgs
infixPatSyn :: Quote m => Name -> Name -> m PatSynArgs
appsE :: Quote m => [m Exp] -> m Exp
-- | pure the Module at the place of splicing. Can be used as an input for
-- reifyModule.
thisModule :: Q Module
-- | Attaches Haddock documentation to the declaration provided. Unlike
-- putDoc, the names do not need to be in scope when calling this
-- function so it can be used for quoted declarations and anything else
-- currently being spliced. Not all declarations can have documentation
-- attached to them. For those that can't, withDecDoc will return
-- it unchanged without any side effects.
withDecDoc :: String -> Q Dec -> Q Dec
-- | Variant of withDecDoc that applies the same documentation to
-- multiple declarations. Useful for documenting quoted declarations.
withDecsDoc :: String -> Q [Dec] -> Q [Dec]
-- | Variant of funD that attaches Haddock documentation.
funD_doc :: Name -> [Q Clause] -> Maybe String -> [Maybe String] -> Q Dec
-- | Variant of dataD that attaches Haddock documentation.
dataD_doc :: Q Cxt -> Name -> [Q (TyVarBndr ())] -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of newtypeD that attaches Haddock documentation.
newtypeD_doc :: Q Cxt -> Name -> [Q (TyVarBndr ())] -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of dataInstD that attaches Haddock documentation.
dataInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of newtypeInstD that attaches Haddock documentation.
newtypeInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of patSynD that attaches Haddock documentation.
patSynD_doc :: Name -> Q PatSynArgs -> Q PatSynDir -> Q Pat -> Maybe String -> [Maybe String] -> Q Dec
-- | Document a data/newtype constructor with its arguments.
docCons :: (Q Con, Maybe String, [Maybe String]) -> Q ()
-- | Language.Haskell.TH.Lib contains lots of useful helper functions for
-- generating and manipulating Template Haskell terms
module Language.Haskell.TH.Lib
type InfoQ = Q Info
type ExpQ = Q Exp
-- | Representation-polymorphic since template-haskell-2.17.0.0.
type TExpQ a = Q (TExp a)
type CodeQ = Code Q
type DecQ = Q Dec
type DecsQ = Q [Dec]
type ConQ = Q Con
type TypeQ = Q Type
type KindQ = Q Kind
type TyLitQ = Q TyLit
type CxtQ = Q Cxt
type PredQ = Q Pred
type DerivClauseQ = Q DerivClause
type MatchQ = Q Match
type ClauseQ = Q Clause
type BodyQ = Q Body
type GuardQ = Q Guard
type StmtQ = Q Stmt
type RangeQ = Q Range
type SourceStrictnessQ = Q SourceStrictness
type SourceUnpackednessQ = Q SourceUnpackedness
type BangQ = Q Bang
type BangTypeQ = Q BangType
type VarBangTypeQ = Q VarBangType
type StrictTypeQ = Q StrictType
type VarStrictTypeQ = Q VarStrictType
type FieldExpQ = Q FieldExp
type PatQ = Q Pat
type FieldPatQ = Q FieldPat
type RuleBndrQ = Q RuleBndr
type TySynEqnQ = Q TySynEqn
type PatSynDirQ = Q PatSynDir
type PatSynArgsQ = Q PatSynArgs
type FamilyResultSigQ = Q FamilyResultSig
type DerivStrategyQ = Q DerivStrategy
type TyVarBndrUnit = TyVarBndr ()
type TyVarBndrSpec = TyVarBndr Specificity
intPrimL :: Integer -> Lit
wordPrimL :: Integer -> Lit
floatPrimL :: Rational -> Lit
doublePrimL :: Rational -> Lit
integerL :: Integer -> Lit
rationalL :: Rational -> Lit
charL :: Char -> Lit
stringL :: String -> Lit
stringPrimL :: [Word8] -> Lit
charPrimL :: Char -> Lit
bytesPrimL :: Bytes -> Lit
-- | Create a Bytes datatype representing raw bytes to be embedded into the
-- program/library binary.
mkBytes :: ForeignPtr Word8 -> Word -> Word -> Bytes
litP :: Quote m => Lit -> m Pat
varP :: Quote m => Name -> m Pat
tupP :: Quote m => [m Pat] -> m Pat
unboxedTupP :: Quote m => [m Pat] -> m Pat
unboxedSumP :: Quote m => m Pat -> SumAlt -> SumArity -> m Pat
conP :: Quote m => Name -> [m Pat] -> m Pat
uInfixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
parensP :: Quote m => m Pat -> m Pat
infixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
tildeP :: Quote m => m Pat -> m Pat
bangP :: Quote m => m Pat -> m Pat
asP :: Quote m => Name -> m Pat -> m Pat
wildP :: Quote m => m Pat
recP :: Quote m => Name -> [m FieldPat] -> m Pat
listP :: Quote m => [m Pat] -> m Pat
sigP :: Quote m => m Pat -> m Type -> m Pat
viewP :: Quote m => m Exp -> m Pat -> m Pat
fieldPat :: Quote m => Name -> m Pat -> m FieldPat
normalB :: Quote m => m Exp -> m Body
guardedB :: Quote m => [m (Guard, Exp)] -> m Body
normalG :: Quote m => m Exp -> m Guard
normalGE :: Quote m => m Exp -> m Exp -> m (Guard, Exp)
patG :: Quote m => [m Stmt] -> m Guard
patGE :: Quote m => [m Stmt] -> m Exp -> m (Guard, Exp)
-- | Use with caseE
match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match
-- | Use with funD
clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause
-- | Dynamically binding a variable (unhygenic)
dyn :: Quote m => String -> m Exp
varE :: Quote m => Name -> m Exp
unboundVarE :: Quote m => Name -> m Exp
labelE :: Quote m => String -> m Exp
implicitParamVarE :: Quote m => String -> m Exp
conE :: Quote m => Name -> m Exp
litE :: Quote m => Lit -> m Exp
-- |
-- staticE x = [| static x |]
--
staticE :: Quote m => m Exp -> m Exp
appE :: Quote m => m Exp -> m Exp -> m Exp
appTypeE :: Quote m => m Exp -> m Type -> m Exp
uInfixE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
parensE :: Quote m => m Exp -> m Exp
infixE :: Quote m => Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
infixApp :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
sectionL :: Quote m => m Exp -> m Exp -> m Exp
sectionR :: Quote m => m Exp -> m Exp -> m Exp
lamE :: Quote m => [m Pat] -> m Exp -> m Exp
-- | Single-arg lambda
lam1E :: Quote m => m Pat -> m Exp -> m Exp
lamCaseE :: Quote m => [m Match] -> m Exp
tupE :: Quote m => [m Exp] -> m Exp
unboxedTupE :: Quote m => [m Exp] -> m Exp
unboxedSumE :: Quote m => m Exp -> SumAlt -> SumArity -> m Exp
condE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
multiIfE :: Quote m => [m (Guard, Exp)] -> m Exp
letE :: Quote m => [m Dec] -> m Exp -> m Exp
caseE :: Quote m => m Exp -> [m Match] -> m Exp
appsE :: Quote m => [m Exp] -> m Exp
listE :: Quote m => [m Exp] -> m Exp
sigE :: Quote m => m Exp -> m Type -> m Exp
recConE :: Quote m => Name -> [m (Name, Exp)] -> m Exp
recUpdE :: Quote m => m Exp -> [m (Name, Exp)] -> m Exp
stringE :: Quote m => String -> m Exp
fieldExp :: Quote m => Name -> m Exp -> m (Name, Exp)
getFieldE :: Quote m => m Exp -> String -> m Exp
projectionE :: Quote m => NonEmpty String -> m Exp
fromE :: Quote m => m Exp -> m Exp
fromThenE :: Quote m => m Exp -> m Exp -> m Exp
fromToE :: Quote m => m Exp -> m Exp -> m Exp
fromThenToE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
arithSeqE :: Quote m => m Range -> m Exp
fromR :: Quote m => m Exp -> m Range
fromThenR :: Quote m => m Exp -> m Exp -> m Range
fromToR :: Quote m => m Exp -> m Exp -> m Range
fromThenToR :: Quote m => m Exp -> m Exp -> m Exp -> m Range
doE :: Quote m => [m Stmt] -> m Exp
mdoE :: Quote m => [m Stmt] -> m Exp
compE :: Quote m => [m Stmt] -> m Exp
bindS :: Quote m => m Pat -> m Exp -> m Stmt
letS :: Quote m => [m Dec] -> m Stmt
noBindS :: Quote m => m Exp -> m Stmt
parS :: Quote m => [[m Stmt]] -> m Stmt
recS :: Quote m => [m Stmt] -> m Stmt
forallT :: Quote m => [TyVarBndr Specificity] -> m Cxt -> m Type -> m Type
forallVisT :: Quote m => [m (TyVarBndr ())] -> m Type -> m Type
varT :: Quote m => Name -> m Type
conT :: Quote m => Name -> m Type
appT :: Quote m => m Type -> m Type -> m Type
appKindT :: Quote m => m Type -> m Kind -> m Type
arrowT :: Quote m => m Type
mulArrowT :: Quote m => m Type
infixT :: Quote m => m Type -> Name -> m Type -> m Type
uInfixT :: Quote m => m Type -> Name -> m Type -> m Type
promotedInfixT :: Quote m => m Type -> Name -> m Type -> m Type
promotedUInfixT :: Quote m => m Type -> Name -> m Type -> m Type
parensT :: Quote m => m Type -> m Type
equalityT :: Quote m => m Type
listT :: Quote m => m Type
tupleT :: Quote m => Int -> m Type
unboxedTupleT :: Quote m => Int -> m Type
unboxedSumT :: Quote m => SumArity -> m Type
sigT :: Quote m => m Type -> Kind -> m Type
litT :: Quote m => m TyLit -> m Type
wildCardT :: Quote m => m Type
promotedT :: Quote m => Name -> m Type
promotedTupleT :: Quote m => Int -> m Type
promotedNilT :: Quote m => m Type
promotedConsT :: Quote m => m Type
implicitParamT :: Quote m => String -> m Type -> m Type
numTyLit :: Quote m => Integer -> m TyLit
strTyLit :: Quote m => String -> m TyLit
charTyLit :: Quote m => Char -> m TyLit
noSourceUnpackedness :: Quote m => m SourceUnpackedness
sourceNoUnpack :: Quote m => m SourceUnpackedness
sourceUnpack :: Quote m => m SourceUnpackedness
noSourceStrictness :: Quote m => m SourceStrictness
sourceLazy :: Quote m => m SourceStrictness
sourceStrict :: Quote m => m SourceStrictness
-- | Deprecated: Use bang. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example
-- usage: 'bang noSourceUnpackedness sourceStrict'
isStrict :: Quote m => m Strict
-- | Deprecated: Use bang. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example
-- usage: 'bang noSourceUnpackedness noSourceStrictness'
notStrict :: Quote m => m Strict
-- | Deprecated: Use bang. See
-- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example
-- usage: 'bang sourceUnpack sourceStrict'
unpacked :: Quote m => m Strict
bang :: Quote m => m SourceUnpackedness -> m SourceStrictness -> m Bang
bangType :: Quote m => m Bang -> m Type -> m BangType
varBangType :: Quote m => Name -> m BangType -> m VarBangType
-- | Deprecated: As of template-haskell-2.11.0.0,
-- StrictType has been replaced by BangType. Please use
-- bangType instead.
strictType :: Quote m => m Strict -> m Type -> m StrictType
-- | Deprecated: As of template-haskell-2.11.0.0,
-- VarStrictType has been replaced by VarBangType. Please
-- use varBangType instead.
varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType
cxt :: Quote m => [m Pred] -> m Cxt
-- | Deprecated: As of template-haskell-2.10, constraint predicates
-- (Pred) are just types (Type), in keeping with ConstraintKinds. Please
-- use conT and appT.
classP :: Quote m => Name -> [m Type] -> m Pred
-- | Deprecated: As of template-haskell-2.10, constraint predicates
-- (Pred) are just types (Type), in keeping with ConstraintKinds. Please
-- see equalityT.
equalP :: Quote m => m Type -> m Type -> m Pred
normalC :: Quote m => Name -> [m BangType] -> m Con
recC :: Quote m => Name -> [m VarBangType] -> m Con
infixC :: Quote m => m (Bang, Type) -> Name -> m (Bang, Type) -> m Con
forallC :: Quote m => [TyVarBndr Specificity] -> m Cxt -> m Con -> m Con
gadtC :: Quote m => [Name] -> [m StrictType] -> m Type -> m Con
recGadtC :: Quote m => [Name] -> [m VarStrictType] -> m Type -> m Con
varK :: Name -> Kind
conK :: Name -> Kind
tupleK :: Int -> Kind
arrowK :: Kind
listK :: Kind
appK :: Kind -> Kind -> Kind
starK :: Kind
constraintK :: Kind
plainTV :: Name -> TyVarBndr ()
kindedTV :: Name -> Kind -> TyVarBndr ()
plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity)
kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity)
specifiedSpec :: Specificity
inferredSpec :: Specificity
nominalR :: Role
representationalR :: Role
phantomR :: Role
inferR :: Role
valD :: Quote m => m Pat -> m Body -> [m Dec] -> m Dec
funD :: Quote m => Name -> [m Clause] -> m Dec
tySynD :: Quote m => Name -> [TyVarBndr ()] -> m Type -> m Dec
dataD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> [m Con] -> [m DerivClause] -> m Dec
newtypeD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> m Con -> [m DerivClause] -> m Dec
derivClause :: Quote m => Maybe DerivStrategy -> [m Pred] -> m DerivClause
-- | A single deriving clause at the end of a datatype.
data DerivClause
-- |
-- { deriving stock (Eq, Ord) }
--
DerivClause :: Maybe DerivStrategy -> Cxt -> DerivClause
stockStrategy :: Quote m => m DerivStrategy
anyclassStrategy :: Quote m => m DerivStrategy
newtypeStrategy :: Quote m => m DerivStrategy
viaStrategy :: Quote m => m Type -> m DerivStrategy
-- | What the user explicitly requests when deriving an instance.
data DerivStrategy
-- | A "standard" derived instance
StockStrategy :: DerivStrategy
-- |
-- -XDeriveAnyClass
--
AnyclassStrategy :: DerivStrategy
-- |
-- -XGeneralizedNewtypeDeriving
--
NewtypeStrategy :: DerivStrategy
-- |
-- -XDerivingVia
--
ViaStrategy :: Type -> DerivStrategy
classD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> [FunDep] -> [m Dec] -> m Dec
instanceD :: Quote m => m Cxt -> m Type -> [m Dec] -> m Dec
instanceWithOverlapD :: Quote m => Maybe Overlap -> m Cxt -> m Type -> [m Dec] -> m Dec
-- | Varieties of allowed instance overlap.
data Overlap
-- | May be overlapped by more specific instances
Overlappable :: Overlap
-- | May overlap a more general instance
Overlapping :: Overlap
-- | Both Overlapping and Overlappable
Overlaps :: Overlap
-- | Both Overlapping and Overlappable, and pick an arbitrary
-- one if multiple choices are available.
Incoherent :: Overlap
sigD :: Quote m => Name -> m Type -> m Dec
kiSigD :: Quote m => Name -> m Kind -> m Dec
standaloneDerivD :: Quote m => m Cxt -> m Type -> m Dec
standaloneDerivWithStrategyD :: Quote m => Maybe DerivStrategy -> m Cxt -> m Type -> m Dec
defaultSigD :: Quote m => Name -> m Type -> m Dec
roleAnnotD :: Quote m => Name -> [Role] -> m Dec
dataFamilyD :: Quote m => Name -> [TyVarBndr ()] -> Maybe Kind -> m Dec
openTypeFamilyD :: Quote m => Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> m Dec
closedTypeFamilyD :: Quote m => Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> [m TySynEqn] -> m Dec
dataInstD :: Quote m => m Cxt -> Name -> [m Type] -> Maybe Kind -> [m Con] -> [m DerivClause] -> m Dec
newtypeInstD :: Quote m => m Cxt -> Name -> [m Type] -> Maybe Kind -> m Con -> [m DerivClause] -> m Dec
tySynInstD :: Quote m => m TySynEqn -> m Dec
tySynEqn :: Quote m => Maybe [TyVarBndr ()] -> m Type -> m Type -> m TySynEqn
injectivityAnn :: Name -> [Name] -> InjectivityAnn
noSig :: FamilyResultSig
kindSig :: Kind -> FamilyResultSig
tyVarSig :: TyVarBndr () -> FamilyResultSig
infixLD :: Quote m => Int -> Name -> m Dec
infixRD :: Quote m => Int -> Name -> m Dec
infixND :: Quote m => Int -> Name -> m Dec
defaultD :: Quote m => [m Type] -> m Dec
cCall :: Callconv
stdCall :: Callconv
cApi :: Callconv
prim :: Callconv
javaScript :: Callconv
unsafe :: Safety
safe :: Safety
interruptible :: Safety
forImpD :: Quote m => Callconv -> Safety -> String -> Name -> m Type -> m Dec
funDep :: [Name] -> [Name] -> FunDep
ruleVar :: Quote m => Name -> m RuleBndr
typedRuleVar :: Quote m => Name -> m Type -> m RuleBndr
valueAnnotation :: Name -> AnnTarget
typeAnnotation :: Name -> AnnTarget
moduleAnnotation :: AnnTarget
pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec
pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec
pragSpecInlD :: Quote m => Name -> m Type -> Inline -> Phases -> m Dec
pragSpecInstD :: Quote m => m Type -> m Dec
pragRuleD :: Quote m => String -> [m RuleBndr] -> m Exp -> m Exp -> Phases -> m Dec
pragAnnD :: Quote m => AnnTarget -> m Exp -> m Dec
pragLineD :: Quote m => Int -> String -> m Dec
pragCompleteD :: Quote m => [Name] -> Maybe Name -> m Dec
-- | Pattern synonym declaration
patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec
-- | Pattern synonym type signature
patSynSigD :: Quote m => Name -> m Type -> m Dec
unidir :: Quote m => m PatSynDir
implBidir :: Quote m => m PatSynDir
explBidir :: Quote m => [m Clause] -> m PatSynDir
prefixPatSyn :: Quote m => [Name] -> m PatSynArgs
infixPatSyn :: Quote m => Name -> Name -> m PatSynArgs
recordPatSyn :: Quote m => [Name] -> m PatSynArgs
-- | Implicit parameter binding declaration. Can only be used in let and
-- where clauses which consist entirely of implicit bindings.
implicitParamBindD :: Quote m => String -> m Exp -> m Dec
-- | pure the Module at the place of splicing. Can be used as an input for
-- reifyModule.
thisModule :: Q Module
-- | Attaches Haddock documentation to the declaration provided. Unlike
-- putDoc, the names do not need to be in scope when calling this
-- function so it can be used for quoted declarations and anything else
-- currently being spliced. Not all declarations can have documentation
-- attached to them. For those that can't, withDecDoc will return
-- it unchanged without any side effects.
withDecDoc :: String -> Q Dec -> Q Dec
-- | Variant of withDecDoc that applies the same documentation to
-- multiple declarations. Useful for documenting quoted declarations.
withDecsDoc :: String -> Q [Dec] -> Q [Dec]
-- | Variant of funD that attaches Haddock documentation.
funD_doc :: Name -> [Q Clause] -> Maybe String -> [Maybe String] -> Q Dec
-- | Variant of dataD that attaches Haddock documentation.
dataD_doc :: Q Cxt -> Name -> [Q (TyVarBndr ())] -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of newtypeD that attaches Haddock documentation.
newtypeD_doc :: Q Cxt -> Name -> [Q (TyVarBndr ())] -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of dataInstD that attaches Haddock documentation.
dataInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of newtypeInstD that attaches Haddock documentation.
newtypeInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec
-- | Variant of patSynD that attaches Haddock documentation.
patSynD_doc :: Name -> Q PatSynArgs -> Q PatSynDir -> Q Pat -> Maybe String -> [Maybe String] -> Q Dec
-- | The public face of Template Haskell
--
-- For other documentation, refer to:
-- http://www.haskell.org/haskellwiki/Template_Haskell
module Language.Haskell.TH
data Q a
runQ :: Quasi m => Q a -> m a
-- | The Quote class implements the minimal interface which is
-- necessary for desugaring quotations.
--
--
-- - The Monad m superclass is needed to stitch together the
-- different AST fragments.
-- - newName is used when desugaring binding structures such as
-- lambdas to generate fresh names.
--
--
-- Therefore the type of an untyped quotation in GHC is `Quote m => m
-- Exp`
--
-- For many years the type of a quotation was fixed to be `Q Exp` but by
-- more precisely specifying the minimal interface it enables the
-- Exp to be extracted purely from the quotation without
-- interacting with Q.
class Monad m => Quote m
-- | Generate a fresh name, which cannot be captured.
--
-- For example, this:
--
--
-- f = $(do
-- nm1 <- newName "x"
-- let nm2 = mkName "x"
-- return (LamE [VarP nm1] (LamE [VarP nm2] (VarE nm1)))
-- )
--
--
-- will produce the splice
--
--
-- f = \x0 -> \x -> x0
--
--
-- In particular, the occurrence VarE nm1 refers to the binding
-- VarP nm1, and is not captured by the binding VarP
-- nm2.
--
-- Although names generated by newName cannot be
-- captured, they can capture other names. For example, this:
--
--
-- g = $(do
-- nm1 <- newName "x"
-- let nm2 = mkName "x"
-- return (LamE [VarP nm2] (LamE [VarP nm1] (VarE nm2)))
-- )
--
--
-- will produce the splice
--
--
-- g = \x -> \x0 -> x0
--
--
-- since the occurrence VarE nm2 is captured by the innermost
-- binding of x, namely VarP nm1.
newName :: Quote m => String -> m Name
-- | Report an error to the user, but allow the current splice's
-- computation to carry on. To abort the computation, use fail.
reportError :: String -> Q ()
-- | Report a warning to the user, and carry on.
reportWarning :: String -> Q ()
-- | Report an error (True) or warning (False), but carry on; use
-- fail to stop.
-- | Deprecated: Use reportError or reportWarning instead
report :: Bool -> String -> Q ()
-- | Recover from errors raised by reportError or fail.
recover :: Q a -> Q a -> Q a
-- | The location at which this computation is spliced.
location :: Q Loc
data Loc
Loc :: String -> String -> String -> CharPos -> CharPos -> Loc
[loc_filename] :: Loc -> String
[loc_package] :: Loc -> String
[loc_module] :: Loc -> String
[loc_start] :: Loc -> CharPos
[loc_end] :: Loc -> CharPos
-- | The runIO function lets you run an I/O computation in the
-- Q monad. Take care: you are guaranteed the ordering of calls to
-- runIO within a single Q computation, but not about the
-- order in which splices are run.
--
-- Note: for various murky reasons, stdout and stderr handles are not
-- necessarily flushed when the compiler finishes running, so you should
-- flush them yourself.
runIO :: IO a -> Q a
-- | reify looks up information about the Name. It will fail
-- with a compile error if the Name is not visible. A Name
-- is visible if it is imported or defined in a prior top-level
-- declaration group. See the documentation for
-- newDeclarationGroup for more details.
--
-- It is sometimes useful to construct the argument name using
-- lookupTypeName or lookupValueName to ensure that we are
-- reifying from the right namespace. For instance, in this context:
--
--
-- data D = D
--
--
-- which D does reify (mkName "D") return information
-- about? (Answer: D-the-type, but don't rely on it.) To ensure
-- we get information about D-the-value, use
-- lookupValueName:
--
--
-- do
-- Just nm <- lookupValueName "D"
-- reify nm
--
--
-- and to get information about D-the-type, use
-- lookupTypeName.
reify :: Name -> Q Info
-- | reifyModule mod looks up information about module
-- mod. To look up the current module, call this function with
-- the return value of thisModule.
reifyModule :: Module -> Q ModuleInfo
-- | Template Haskell is capable of reifying information about types and
-- terms defined in previous declaration groups. Top-level declaration
-- splices break up declaration groups.
--
-- For an example, consider this code block. We define a datatype
-- X and then try to call reify on the datatype.
--
--
-- module Check where
--
-- data X = X
-- deriving Eq
--
-- $(do
-- info <- reify ''X
-- runIO $ print info
-- )
--
--
-- This code fails to compile, noting that X is not available
-- for reification at the site of reify. We can fix this by
-- creating a new declaration group using an empty top-level splice:
--
--
-- data X = X
-- deriving Eq
--
-- $(pure [])
--
-- $(do
-- info <- reify ''X
-- runIO $ print info
-- )
--
--
-- We provide newDeclarationGroup as a means of documenting this
-- behavior and providing a name for the pattern.
--
-- Since top level splices infer the presence of the $( ... )
-- brackets, we can also write:
--
--
-- data X = X
-- deriving Eq
--
-- newDeclarationGroup
--
-- $(do
-- info <- reify ''X
-- runIO $ print info
-- )
--
newDeclarationGroup :: Q [Dec]
-- | Obtained from reify in the Q Monad.
data Info
-- | A class, with a list of its visible instances
ClassI :: Dec -> [InstanceDec] -> Info
-- | A class method
ClassOpI :: Name -> Type -> ParentName -> Info
-- | A "plain" type constructor. "Fancier" type constructors are returned
-- using PrimTyConI or FamilyI as appropriate. At present,
-- this reified declaration will never have derived instances attached to
-- it (if you wish to check for an instance, see reifyInstances).
TyConI :: Dec -> Info
-- | A type or data family, with a list of its visible instances. A closed
-- type family is returned with 0 instances.
FamilyI :: Dec -> [InstanceDec] -> Info
-- | A "primitive" type constructor, which can't be expressed with a
-- Dec. Examples: (->), Int#.
PrimTyConI :: Name -> Arity -> Unlifted -> Info
-- | A data constructor
DataConI :: Name -> Type -> ParentName -> Info
-- | A pattern synonym
PatSynI :: Name -> PatSynType -> Info
-- | A "value" variable (as opposed to a type variable, see TyVarI).
--
-- The Maybe Dec field contains Just the declaration
-- which defined the variable - including the RHS of the declaration - or
-- else Nothing, in the case where the RHS is unavailable to the
-- compiler. At present, this value is always Nothing:
-- returning the RHS has not yet been implemented because of lack of
-- interest.
VarI :: Name -> Type -> Maybe Dec -> Info
-- | A type variable.
--
-- The Type field contains the type which underlies the
-- variable. At present, this is always VarT theName, but
-- future changes may permit refinement of this.
TyVarI :: Name -> Type -> Info
-- | Obtained from reifyModule in the Q Monad.
data ModuleInfo
-- | Contains the import list of the module.
ModuleInfo :: [Module] -> ModuleInfo
-- | InstanceDec describes a single instance of a class or type
-- function. It is just a Dec, but guaranteed to be one of the
-- following:
--
--
type InstanceDec = Dec
-- | In ClassOpI and DataConI, name of the parent class or
-- type
type ParentName = Name
-- | In UnboxedSumE and UnboxedSumP, the number associated
-- with a particular data constructor. SumAlts are one-indexed and
-- should never exceed the value of its corresponding SumArity.
-- For example:
--
--
type SumAlt = Int
-- | In UnboxedSumE, UnboxedSumT, and UnboxedSumP, the
-- total number of SumAlts. For example, (#|#) has a
-- SumArity of 2.
type SumArity = Int
-- | In PrimTyConI, arity of the type constructor
type Arity = Int
-- | In PrimTyConI, is the type constructor unlifted?
type Unlifted = Bool
-- | The language extensions known to GHC.
--
-- Note that there is an orphan Binary instance for this type
-- supplied by the GHC.LanguageExtensions module provided by
-- ghc-boot. We can't provide here as this would require adding
-- transitive dependencies to the template-haskell package,
-- which must have a minimal dependency set.
data Extension
Cpp :: Extension
OverlappingInstances :: Extension
UndecidableInstances :: Extension
IncoherentInstances :: Extension
UndecidableSuperClasses :: Extension
MonomorphismRestriction :: Extension
MonoLocalBinds :: Extension
RelaxedPolyRec :: Extension
ExtendedDefaultRules :: Extension
ForeignFunctionInterface :: Extension
UnliftedFFITypes :: Extension
InterruptibleFFI :: Extension
CApiFFI :: Extension
GHCForeignImportPrim :: Extension
JavaScriptFFI :: Extension
ParallelArrays :: Extension
Arrows :: Extension
TemplateHaskell :: Extension
TemplateHaskellQuotes :: Extension
QualifiedDo :: Extension
QuasiQuotes :: Extension
ImplicitParams :: Extension
ImplicitPrelude :: Extension
ScopedTypeVariables :: Extension
AllowAmbiguousTypes :: Extension
UnboxedTuples :: Extension
UnboxedSums :: Extension
UnliftedNewtypes :: Extension
UnliftedDatatypes :: Extension
BangPatterns :: Extension
TypeFamilies :: Extension
TypeFamilyDependencies :: Extension
TypeInType :: Extension
OverloadedStrings :: Extension
OverloadedLists :: Extension
NumDecimals :: Extension
DisambiguateRecordFields :: Extension
RecordWildCards :: Extension
NamedFieldPuns :: Extension
ViewPatterns :: Extension
GADTs :: Extension
GADTSyntax :: Extension
NPlusKPatterns :: Extension
DoAndIfThenElse :: Extension
BlockArguments :: Extension
RebindableSyntax :: Extension
ConstraintKinds :: Extension
PolyKinds :: Extension
DataKinds :: Extension
InstanceSigs :: Extension
ApplicativeDo :: Extension
LinearTypes :: Extension
StandaloneDeriving :: Extension
DeriveDataTypeable :: Extension
AutoDeriveTypeable :: Extension
DeriveFunctor :: Extension
DeriveTraversable :: Extension
DeriveFoldable :: Extension
DeriveGeneric :: Extension
DefaultSignatures :: Extension
DeriveAnyClass :: Extension
DeriveLift :: Extension
DerivingStrategies :: Extension
DerivingVia :: Extension
TypeSynonymInstances :: Extension
FlexibleContexts :: Extension
FlexibleInstances :: Extension
ConstrainedClassMethods :: Extension
MultiParamTypeClasses :: Extension
NullaryTypeClasses :: Extension
FunctionalDependencies :: Extension
UnicodeSyntax :: Extension
ExistentialQuantification :: Extension
MagicHash :: Extension
EmptyDataDecls :: Extension
KindSignatures :: Extension
RoleAnnotations :: Extension
ParallelListComp :: Extension
TransformListComp :: Extension
MonadComprehensions :: Extension
GeneralizedNewtypeDeriving :: Extension
RecursiveDo :: Extension
PostfixOperators :: Extension
TupleSections :: Extension
PatternGuards :: Extension
LiberalTypeSynonyms :: Extension
RankNTypes :: Extension
ImpredicativeTypes :: Extension
TypeOperators :: Extension
ExplicitNamespaces :: Extension
PackageImports :: Extension
ExplicitForAll :: Extension
AlternativeLayoutRule :: Extension
AlternativeLayoutRuleTransitional :: Extension
DatatypeContexts :: Extension
NondecreasingIndentation :: Extension
RelaxedLayout :: Extension
TraditionalRecordSyntax :: Extension
LambdaCase :: Extension
MultiWayIf :: Extension
BinaryLiterals :: Extension
NegativeLiterals :: Extension
HexFloatLiterals :: Extension
DuplicateRecordFields :: Extension
OverloadedLabels :: Extension
EmptyCase :: Extension
PatternSynonyms :: Extension
PartialTypeSignatures :: Extension
NamedWildCards :: Extension
StaticPointers :: Extension
TypeApplications :: Extension
Strict :: Extension
StrictData :: Extension
EmptyDataDeriving :: Extension
NumericUnderscores :: Extension
QuantifiedConstraints :: Extension
StarIsType :: Extension
ImportQualifiedPost :: Extension
CUSKs :: Extension
StandaloneKindSignatures :: Extension
LexicalNegation :: Extension
FieldSelectors :: Extension
OverloadedRecordDot :: Extension
OverloadedRecordUpdate :: Extension
-- | List all enabled language extensions.
extsEnabled :: Q [Extension]
-- | Determine whether the given language extension is enabled in the
-- Q monad.
isExtEnabled :: Extension -> Q Bool
-- | Look up the given name in the (type namespace of the) current splice's
-- scope. See Language.Haskell.TH.Syntax#namelookup for more
-- details.
lookupTypeName :: String -> Q (Maybe Name)
-- | Look up the given name in the (value namespace of the) current
-- splice's scope. See Language.Haskell.TH.Syntax#namelookup for
-- more details.
lookupValueName :: String -> Q (Maybe Name)
-- | reifyFixity nm attempts to find a fixity declaration for
-- nm. For example, if the function foo has the fixity
-- declaration infixr 7 foo, then reifyFixity 'foo
-- would return Just (Fixity 7 InfixR). If
-- the function bar does not have a fixity declaration, then
-- reifyFixity 'bar returns Nothing, so you may assume
-- bar has defaultFixity.
reifyFixity :: Name -> Q (Maybe Fixity)
-- | reifyType nm attempts to find the type or kind of
-- nm. For example, reifyType 'not returns Bool
-- -> Bool, and reifyType ''Bool returns Type.
-- This works even if there's no explicit signature and the type or kind
-- is inferred.
reifyType :: Name -> Q Type
-- | reifyInstances nm tys returns a list of visible instances of
-- nm tys. That is, if nm is the name of a type class,
-- then all instances of this class at the types tys are
-- returned. Alternatively, if nm is the name of a data family
-- or type family, all instances of this family at the types tys
-- are returned.
--
-- Note that this is a "shallow" test; the declarations returned merely
-- have instance heads which unify with nm tys, they need not
-- actually be satisfiable.
--
--
-- - reifyInstances ''Eq [ TupleT 2 `AppT`
-- ConT ''A `AppT` ConT ''B ] contains the
-- instance (Eq a, Eq b) => Eq (a, b) regardless of whether
-- A and B themselves implement Eq
-- - reifyInstances ''Show [ VarT (mkName "a") ]
-- produces every available instance of Eq
--
--
-- There is one edge case: reifyInstances ''Typeable tys
-- currently always produces an empty list (no matter what tys
-- are given).
--
-- An instance is visible if it is imported or defined in a prior
-- top-level declaration group. See the documentation for
-- newDeclarationGroup for more details.
reifyInstances :: Name -> [Type] -> Q [InstanceDec]
-- | Is the list of instances returned by reifyInstances nonempty?
--
-- If you're confused by an instance not being visible despite being
-- defined in the same module and above the splice in question, see the
-- docs for newDeclarationGroup for a possible explanation.
isInstance :: Name -> [Type] -> Q Bool
-- | reifyRoles nm returns the list of roles associated with the
-- parameters (both visible and invisible) of the tycon nm.
-- Fails if nm cannot be found or is not a tycon. The returned
-- list should never contain InferR.
--
-- An invisible parameter to a tycon is often a kind parameter. For
-- example, if we have
--
--
-- type Proxy :: forall k. k -> Type
-- data Proxy a = MkProxy
--
--
-- and reifyRoles Proxy, we will get [NominalR,
-- PhantomR]. The NominalR is the role of the
-- invisible k parameter. Kind parameters are always nominal.
reifyRoles :: Name -> Q [Role]
-- | reifyAnnotations target returns the list of annotations
-- associated with target. Only the annotations that are
-- appropriately typed is returned. So if you have Int and
-- String annotations for the same target, you have to call this
-- function twice.
reifyAnnotations :: Data a => AnnLookup -> Q [a]
-- | Annotation target for reifyAnnotations
data AnnLookup
AnnLookupModule :: Module -> AnnLookup
AnnLookupName :: Name -> AnnLookup
-- | reifyConStrictness nm looks up the strictness information for
-- the fields of the constructor with the name nm. Note that the
-- strictness information that reifyConStrictness returns may not
-- correspond to what is written in the source code. For example, in the
-- following data declaration:
--
--
-- data Pair a = Pair a a
--
--
-- reifyConStrictness would return [DecidedLazy,
-- DecidedLazy] under most circumstances, but it would return
-- [DecidedStrict, DecidedStrict] if the
-- -XStrictData language extension was enabled.
reifyConStrictness :: Name -> Q [DecidedStrictness]
-- | Represents an expression which has type a. Built on top of
-- Exp, typed expressions allow for type-safe splicing via:
--
--
-- - typed quotes, written as [|| ... ||] where ...
-- is an expression; if that expression has type a, then the
-- quotation has type Q (TExp a)
-- - typed splices inside of typed quotes, written as $$(...)
-- where ... is an arbitrary expression of type Q
-- (TExp a)
--
--
-- Traditional expression quotes and splices let us construct ill-typed
-- expressions:
--
--
-- >>> fmap ppr $ runQ [| True == $( [| "foo" |] ) |]
-- GHC.Types.True GHC.Classes.== "foo"
--
-- >>> GHC.Types.True GHC.Classes.== "foo"
-- <interactive> error:
-- • Couldn't match expected type ‘Bool’ with actual type ‘[Char]’
-- • In the second argument of ‘(==)’, namely ‘"foo"’
-- In the expression: True == "foo"
-- In an equation for ‘it’: it = True == "foo"
--
--
-- With typed expressions, the type error occurs when constructing
-- the Template Haskell expression:
--
--
-- >>> fmap ppr $ runQ [|| True == $$( [|| "foo" ||] ) ||]
-- <interactive> error:
-- • Couldn't match type ‘[Char]’ with ‘Bool’
-- Expected type: Q (TExp Bool)
-- Actual type: Q (TExp [Char])
-- • In the Template Haskell quotation [|| "foo" ||]
-- In the expression: [|| "foo" ||]
-- In the Template Haskell splice $$([|| "foo" ||])
--
--
-- Representation-polymorphic since template-haskell-2.16.0.0.
data TExp (a :: TYPE (r :: RuntimeRep))
-- | Underlying untyped Template Haskell expression
unType :: TExp a -> Exp
newtype Code m (a :: TYPE (r :: RuntimeRep))
Code :: m (TExp a) -> Code m (a :: TYPE (r :: RuntimeRep))
-- | Underlying monadic value
[examineCode] :: Code m (a :: TYPE (r :: RuntimeRep)) -> m (TExp a)
-- | Extract the untyped representation from the typed representation
unTypeCode :: forall (r :: RuntimeRep) (a :: TYPE r) m. Quote m => Code m a -> m Exp
-- | Unsafely convert an untyped code representation into a typed code
-- representation.
unsafeCodeCoerce :: forall (r :: RuntimeRep) (a :: TYPE r) m. Quote m => m Exp -> Code m a
-- | Modify the ambient monad used during code generation. For example, you
-- can use hoistCode to handle a state effect: handleState ::
-- Code (StateT Int Q) a -> Code Q a handleState = hoistCode (flip
-- runState 0)
hoistCode :: forall m n (r :: RuntimeRep) (a :: TYPE r). Monad m => (forall x. m x -> n x) -> Code m a -> Code n a
-- | Variant of (>>=) which allows effectful computations to be
-- injected into code generation.
bindCode :: forall m a (r :: RuntimeRep) (b :: TYPE r). Monad m => m a -> (a -> Code m b) -> Code m b
-- | Variant of (>>) which allows effectful computations to be
-- injected into code generation.
bindCode_ :: forall m a (r :: RuntimeRep) (b :: TYPE r). Monad m => m a -> Code m b -> Code m b
-- | A useful combinator for embedding monadic actions into Code
-- myCode :: ... => Code m a myCode = joinCode $ do x <-
-- someSideEffect return (makeCodeWith x)
joinCode :: forall m (r :: RuntimeRep) (a :: TYPE r). Monad m => m (Code m a) -> Code m a
-- | Lift a monadic action producing code into the typed Code
-- representation
liftCode :: forall (r :: RuntimeRep) (a :: TYPE r) m. m (TExp a) -> Code m a
-- | An abstract type representing names in the syntax tree.
--
-- Names can be constructed in several ways, which come with
-- different name-capture guarantees (see
-- Language.Haskell.TH.Syntax#namecapture for an explanation of
-- name capture):
--
--
-- - the built-in syntax 'f and ''T can be used to
-- construct names, The expression 'f gives a Name
-- which refers to the value f currently in scope, and
-- ''T gives a Name which refers to the type T
-- currently in scope. These names can never be captured.
-- - lookupValueName and lookupTypeName are similar to
-- 'f and ''T respectively, but the Names are
-- looked up at the point where the current splice is being run. These
-- names can never be captured.
-- - newName monadically generates a new name, which can never
-- be captured.
-- - mkName generates a capturable name.
--
--
-- Names constructed using newName and mkName may be
-- used in bindings (such as let x = ... or x ->
-- ...), but names constructed using lookupValueName,
-- lookupTypeName, 'f, ''T may not.
data Name
data NameSpace
-- | Generate a capturable name. Occurrences of such names will be resolved
-- according to the Haskell scoping rules at the occurrence site.
--
-- For example:
--
--
-- f = [| pi + $(varE (mkName "pi")) |]
-- ...
-- g = let pi = 3 in $f
--
--
-- In this case, g is desugared to
--
--
-- g = Prelude.pi + 3
--
--
-- Note that mkName may be used with qualified names:
--
--
-- mkName "Prelude.pi"
--
--
-- See also dyn for a useful combinator. The above example could
-- be rewritten using dyn as
--
--
-- f = [| pi + $(dyn "pi") |]
--
mkName :: String -> Name
-- | The name without its module prefix.
--
-- Examples
--
--
-- >>> nameBase ''Data.Either.Either
-- "Either"
--
-- >>> nameBase (mkName "foo")
-- "foo"
--
-- >>> nameBase (mkName "Module.foo")
-- "foo"
--
nameBase :: Name -> String
-- | Module prefix of a name, if it exists.
--
-- Examples
--
--
-- >>> nameModule ''Data.Either.Either
-- Just "Data.Either"
--
-- >>> nameModule (mkName "foo")
-- Nothing
--
-- >>> nameModule (mkName "Module.foo")
-- Just "Module"
--
nameModule :: Name -> Maybe String
-- | A name's package, if it exists.
--
-- Examples
--
--
-- >>> namePackage ''Data.Either.Either
-- Just "base"
--
-- >>> namePackage (mkName "foo")
-- Nothing
--
-- >>> namePackage (mkName "Module.foo")
-- Nothing
--
namePackage :: Name -> Maybe String
-- | Returns whether a name represents an occurrence of a top-level
-- variable (VarName), data constructor (DataName), type
-- constructor, or type class (TcClsName). If we can't be sure, it
-- returns Nothing.
--
-- Examples
--
--
-- >>> nameSpace 'Prelude.id
-- Just VarName
--
-- >>> nameSpace (mkName "id")
-- Nothing -- only works for top-level variable names
--
-- >>> nameSpace 'Data.Maybe.Just
-- Just DataName
--
-- >>> nameSpace ''Data.Maybe.Maybe
-- Just TcClsName
--
-- >>> nameSpace ''Data.Ord.Ord
-- Just TcClsName
--
nameSpace :: Name -> Maybe NameSpace
-- | Tuple type constructor
tupleTypeName :: Int -> Name
-- | Tuple data constructor
tupleDataName :: Int -> Name
-- | Unboxed tuple type constructor
unboxedTupleTypeName :: Int -> Name
-- | Unboxed tuple data constructor
unboxedTupleDataName :: Int -> Name
-- | Unboxed sum type constructor
unboxedSumTypeName :: SumArity -> Name
-- | Unboxed sum data constructor
unboxedSumDataName :: SumAlt -> SumArity -> Name
data Dec
-- |
-- { f p1 p2 = b where decs }
--
FunD :: Name -> [Clause] -> Dec
-- |
-- { p = b where decs }
--
ValD :: Pat -> Body -> [Dec] -> Dec
-- |
-- { data Cxt x => T x = A x | B (T x)
-- deriving (Z,W)
-- deriving stock Eq }
--
DataD :: Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> [Con] -> [DerivClause] -> Dec
-- |
-- { newtype Cxt x => T x = A (B x)
-- deriving (Z,W Q)
-- deriving stock Eq }
--
NewtypeD :: Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> Con -> [DerivClause] -> Dec
-- |
-- { type T x = (x,x) }
--
TySynD :: Name -> [TyVarBndr ()] -> Type -> Dec
-- |
-- { class Eq a => Ord a where ds }
--
ClassD :: Cxt -> Name -> [TyVarBndr ()] -> [FunDep] -> [Dec] -> Dec
-- |
-- { instance {-# OVERLAPS #-}
-- Show w => Show [w] where ds }
--
InstanceD :: Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec
-- |
-- { length :: [a] -> Int }
--
SigD :: Name -> Type -> Dec
-- |
-- { type TypeRep :: k -> Type }
--
KiSigD :: Name -> Kind -> Dec
-- |
-- { foreign import ... }
-- { foreign export ... }
--
ForeignD :: Foreign -> Dec
-- |
-- { infix 3 foo }
--
InfixD :: Fixity -> Name -> Dec
-- |
-- { default (Integer, Double) }
--
DefaultD :: [Type] -> Dec
-- |
-- { {-# INLINE [1] foo #-} }
--
PragmaD :: Pragma -> Dec
-- |
-- { data family T a b c :: * }
--
DataFamilyD :: Name -> [TyVarBndr ()] -> Maybe Kind -> Dec
-- |
-- { data instance Cxt x => T [x]
-- = A x | B (T x)
-- deriving (Z,W)
-- deriving stock Eq }
--
DataInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> [Con] -> [DerivClause] -> Dec
-- |
-- { newtype instance Cxt x => T [x]
-- = A (B x)
-- deriving (Z,W)
-- deriving stock Eq }
--
NewtypeInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> Con -> [DerivClause] -> Dec
-- |
-- { type instance ... }
--
TySynInstD :: TySynEqn -> Dec
-- |
-- { type family T a b c = (r :: *) | r -> a b }
--
OpenTypeFamilyD :: TypeFamilyHead -> Dec
-- |
-- { type family F a b = (r :: *) | r -> a where ... }
--
ClosedTypeFamilyD :: TypeFamilyHead -> [TySynEqn] -> Dec
-- |
-- { type role T nominal representational }
--
RoleAnnotD :: Name -> [Role] -> Dec
-- |
-- { deriving stock instance Ord a => Ord (Foo a) }
--
StandaloneDerivD :: Maybe DerivStrategy -> Cxt -> Type -> Dec
-- |
-- { default size :: Data a => a -> Int }
--
DefaultSigD :: Name -> Type -> Dec
-- | { pattern P v1 v2 .. vn <- p } unidirectional or {
-- pattern P v1 v2 .. vn = p } implicit bidirectional or {
-- pattern P v1 v2 .. vn <- p where P v1 v2 .. vn = e } explicit
-- bidirectional
--
-- also, besides prefix pattern synonyms, both infix and record pattern
-- synonyms are supported. See PatSynArgs for details
PatSynD :: Name -> PatSynArgs -> PatSynDir -> Pat -> Dec
-- | A pattern synonym's type signature.
PatSynSigD :: Name -> PatSynType -> Dec
-- |
-- { ?x = expr }
--
--
-- Implicit parameter binding declaration. Can only be used in let and
-- where clauses which consist entirely of implicit bindings.
ImplicitParamBindD :: String -> Exp -> Dec
-- | A single data constructor.
--
-- The constructors for Con can roughly be divided up into two
-- categories: those for constructors with "vanilla" syntax
-- (NormalC, RecC, and InfixC), and those for
-- constructors with GADT syntax (GadtC and RecGadtC). The
-- ForallC constructor, which quantifies additional type variables
-- and class contexts, can surround either variety of constructor.
-- However, the type variables that it quantifies are different depending
-- on what constructor syntax is used:
--
--
-- - If a ForallC surrounds a constructor with vanilla syntax,
-- then the ForallC will only quantify existential type
-- variables. For example:
--
--
--
-- data Foo a = forall b. MkFoo a b
--
--
--
-- In MkFoo, ForallC will quantify b, but not
-- a.
--
--
-- - If a ForallC surrounds a constructor with GADT syntax, then
-- the ForallC will quantify all type variables used in the
-- constructor. For example:
--
--
--
-- data Bar a b where
-- MkBar :: (a ~ b) => c -> MkBar a b
--
--
--
-- In MkBar, ForallC will quantify a,
-- b, and c.
--
-- Multiplicity annotations for data types are currently not supported in
-- Template Haskell (i.e. all fields represented by Template Haskell will
-- be linear).
data Con
-- |
-- C Int a
--
NormalC :: Name -> [BangType] -> Con
-- |
-- C { v :: Int, w :: a }
--
RecC :: Name -> [VarBangType] -> Con
-- |
-- Int :+ a
--
InfixC :: BangType -> Name -> BangType -> Con
-- |
-- forall a. Eq a => C [a]
--
ForallC :: [TyVarBndr Specificity] -> Cxt -> Con -> Con
-- |
-- C :: a -> b -> T b Int
--
GadtC :: [Name] -> [BangType] -> Type -> Con
-- |
-- C :: { v :: Int } -> T b Int
--
RecGadtC :: [Name] -> [VarBangType] -> Type -> Con
data Clause
-- |
-- f { p1 p2 = body where decs }
--
Clause :: [Pat] -> Body -> [Dec] -> Clause
data SourceUnpackedness
-- |
-- C a
--
NoSourceUnpackedness :: SourceUnpackedness
-- |
-- C { {-# NOUNPACK #-} } a
--
SourceNoUnpack :: SourceUnpackedness
-- |
-- C { {-# UNPACK #-} } a
--
SourceUnpack :: SourceUnpackedness
data SourceStrictness
-- |
-- C a
--
NoSourceStrictness :: SourceStrictness
-- |
-- C {~}a
--
SourceLazy :: SourceStrictness
-- |
-- C {!}a
--
SourceStrict :: SourceStrictness
-- | Unlike SourceStrictness and SourceUnpackedness,
-- DecidedStrictness refers to the strictness that the compiler
-- chooses for a data constructor field, which may be different from what
-- is written in source code. See reifyConStrictness for more
-- information.
data DecidedStrictness
DecidedLazy :: DecidedStrictness
DecidedStrict :: DecidedStrictness
DecidedUnpack :: DecidedStrictness
data Bang
-- |
-- C { {-# UNPACK #-} !}a
--
Bang :: SourceUnpackedness -> SourceStrictness -> Bang
-- | As of template-haskell-2.11.0.0, Strict has been
-- replaced by Bang.
type Strict = Bang
data Foreign
ImportF :: Callconv -> Safety -> String -> Name -> Type -> Foreign
ExportF :: Callconv -> String -> Name -> Type -> Foreign
data Callconv
CCall :: Callconv
StdCall :: Callconv
CApi :: Callconv
Prim :: Callconv
JavaScript :: Callconv
data Safety
Unsafe :: Safety
Safe :: Safety
Interruptible :: Safety
data Pragma
InlineP :: Name -> Inline -> RuleMatch -> Phases -> Pragma
OpaqueP :: Name -> Pragma
SpecialiseP :: Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseInstP :: Type -> Pragma
RuleP :: String -> Maybe [TyVarBndr ()] -> [RuleBndr] -> Exp -> Exp -> Phases -> Pragma
AnnP :: AnnTarget -> Exp -> Pragma
LineP :: Int -> String -> Pragma
-- |
-- { {-# COMPLETE C_1, ..., C_i [ :: T ] #-} }
--
CompleteP :: [Name] -> Maybe Name -> Pragma
data Inline
NoInline :: Inline
Inline :: Inline
Inlinable :: Inline
data RuleMatch
ConLike :: RuleMatch
FunLike :: RuleMatch
data Phases
AllPhases :: Phases
FromPhase :: Int -> Phases
BeforePhase :: Int -> Phases
data RuleBndr
RuleVar :: Name -> RuleBndr
TypedRuleVar :: Name -> Type -> RuleBndr
data AnnTarget
ModuleAnnotation :: AnnTarget
TypeAnnotation :: Name -> AnnTarget
ValueAnnotation :: Name -> AnnTarget
data FunDep
FunDep :: [Name] -> [Name] -> FunDep
-- | One equation of a type family instance or closed type family. The
-- arguments are the left-hand-side type and the right-hand-side result.
--
-- For instance, if you had the following type family:
--
--
-- type family Foo (a :: k) :: k where
-- forall k (a :: k). Foo @k a = a
--
--
-- The Foo @k a = a equation would be represented as follows:
--
--
-- TySynEqn (Just [PlainTV k, KindedTV a (VarT k)])
-- (AppT (AppKindT (ConT ''Foo) (VarT k)) (VarT a))
-- (VarT a)
--
data TySynEqn
TySynEqn :: Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
-- | Common elements of OpenTypeFamilyD and
-- ClosedTypeFamilyD. By analogy with "head" for type classes and
-- type class instances as defined in Type classes: an exploration of
-- the design space, the TypeFamilyHead is defined to be the
-- elements of the declaration between type family and
-- where.
data TypeFamilyHead
TypeFamilyHead :: Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> TypeFamilyHead
data Fixity
Fixity :: Int -> FixityDirection -> Fixity
data FixityDirection
InfixL :: FixityDirection
InfixR :: FixityDirection
InfixN :: FixityDirection
-- | Default fixity: infixl 9
defaultFixity :: Fixity
-- | Highest allowed operator precedence for Fixity constructor
-- (answer: 9)
maxPrecedence :: Int
-- | A pattern synonym's directionality.
data PatSynDir
-- |
-- pattern P x {<-} p
--
Unidir :: PatSynDir
-- |
-- pattern P x {=} p
--
ImplBidir :: PatSynDir
-- |
-- pattern P x {<-} p where P x = e
--
ExplBidir :: [Clause] -> PatSynDir
-- | A pattern synonym's argument type.
data PatSynArgs
-- |
-- pattern P {x y z} = p
--
PrefixPatSyn :: [Name] -> PatSynArgs
-- |
-- pattern {x P y} = p
--
InfixPatSyn :: Name -> Name -> PatSynArgs
-- |
-- pattern P { {x,y,z} } = p
--
RecordPatSyn :: [Name] -> PatSynArgs
data Exp
-- |
-- { x }
--
VarE :: Name -> Exp
-- |
-- data T1 = C1 t1 t2; p = {C1} e1 e2
--
ConE :: Name -> Exp
-- |
-- { 5 or 'c'}
--
LitE :: Lit -> Exp
-- |
-- { f x }
--
AppE :: Exp -> Exp -> Exp
-- |
-- { f @Int }
--
AppTypeE :: Exp -> Type -> Exp
-- |
-- {x + y} or {(x+)} or {(+ x)} or {(+)}
--
InfixE :: Maybe Exp -> Exp -> Maybe Exp -> Exp
-- |
-- {x + y}
--
--
-- See Language.Haskell.TH.Syntax#infix
UInfixE :: Exp -> Exp -> Exp -> Exp
-- |
-- { (e) }
--
--
-- See Language.Haskell.TH.Syntax#infix
ParensE :: Exp -> Exp
-- |
-- { \ p1 p2 -> e }
--
LamE :: [Pat] -> Exp -> Exp
-- |
-- { \case m1; m2 }
--
LamCaseE :: [Match] -> Exp
-- |
-- { (e1,e2) }
--
--
-- The Maybe is necessary for handling tuple sections.
--
--
-- (1,)
--
--
-- translates to
--
--
-- TupE [Just (LitE (IntegerL 1)),Nothing]
--
TupE :: [Maybe Exp] -> Exp
-- |
-- { (# e1,e2 #) }
--
--
-- The Maybe is necessary for handling tuple sections.
--
--
-- (# 'c', #)
--
--
-- translates to
--
--
-- UnboxedTupE [Just (LitE (CharL 'c')),Nothing]
--
UnboxedTupE :: [Maybe Exp] -> Exp
-- |
-- { (#|e|#) }
--
UnboxedSumE :: Exp -> SumAlt -> SumArity -> Exp
-- |
-- { if e1 then e2 else e3 }
--
CondE :: Exp -> Exp -> Exp -> Exp
-- |
-- { if | g1 -> e1 | g2 -> e2 }
--
MultiIfE :: [(Guard, Exp)] -> Exp
-- |
-- { let { x=e1; y=e2 } in e3 }
--
LetE :: [Dec] -> Exp -> Exp
-- |
-- { case e of m1; m2 }
--
CaseE :: Exp -> [Match] -> Exp
-- | { do { p <- e1; e2 } } or a qualified do if the module
-- name is present
DoE :: Maybe ModName -> [Stmt] -> Exp
-- | { mdo { x <- e1 y; y <- e2 x; } } or a qualified mdo if
-- the module name is present
MDoE :: Maybe ModName -> [Stmt] -> Exp
-- |
-- { [ (x,y) | x <- xs, y <- ys ] }
--
--
-- The result expression of the comprehension is the last of the
-- Stmts, and should be a NoBindS.
--
-- E.g. translation:
--
--
-- [ f x | x <- xs ]
--
--
--
-- CompE [BindS (VarP x) (VarE xs), NoBindS (AppE (VarE f) (VarE x))]
--
CompE :: [Stmt] -> Exp
-- |
-- { [ 1 ,2 .. 10 ] }
--
ArithSeqE :: Range -> Exp
-- |
-- { [1,2,3] }
--
ListE :: [Exp] -> Exp
-- |
-- { e :: t }
--
SigE :: Exp -> Type -> Exp
-- |
-- { T { x = y, z = w } }
--
RecConE :: Name -> [FieldExp] -> Exp
-- |
-- { (f x) { z = w } }
--
RecUpdE :: Exp -> [FieldExp] -> Exp
-- |
-- { static e }
--
StaticE :: Exp -> Exp
-- |
-- { _x }
--
--
-- This is used for holes or unresolved identifiers in AST quotes. Note
-- that it could either have a variable name or constructor name.
UnboundVarE :: Name -> Exp
-- | { #x } ( Overloaded label )
LabelE :: String -> Exp
-- | { ?x } ( Implicit parameter )
ImplicitParamVarE :: String -> Exp
-- | { exp.field } ( Overloaded Record Dot )
GetFieldE :: Exp -> String -> Exp
-- | (.x) or (.x.y) (Record projections)
ProjectionE :: NonEmpty String -> Exp
data Match
-- |
-- case e of { pat -> body where decs }
--
Match :: Pat -> Body -> [Dec] -> Match
data Body
-- |
-- f p { | e1 = e2
-- | e3 = e4 }
-- where ds
--
GuardedB :: [(Guard, Exp)] -> Body
-- |
-- f p { = e } where ds
--
NormalB :: Exp -> Body
data Guard
-- |
-- f x { | odd x } = x
--
NormalG :: Exp -> Guard
-- |
-- f x { | Just y <- x, Just z <- y } = z
--
PatG :: [Stmt] -> Guard
data Stmt
-- |
-- p <- e
--
BindS :: Pat -> Exp -> Stmt
-- |
-- { let { x=e1; y=e2 } }
--
LetS :: [Dec] -> Stmt
-- |
-- e
--
NoBindS :: Exp -> Stmt
-- | x <- e1 | s2, s3 | s4 (in CompE)
ParS :: [[Stmt]] -> Stmt
-- |
-- rec { s1; s2 }
--
RecS :: [Stmt] -> Stmt
data Range
FromR :: Exp -> Range
FromThenR :: Exp -> Exp -> Range
FromToR :: Exp -> Exp -> Range
FromThenToR :: Exp -> Exp -> Exp -> Range
data Lit
CharL :: Char -> Lit
StringL :: String -> Lit
-- | Used for overloaded and non-overloaded literals. We don't have a good
-- way to represent non-overloaded literals at the moment. Maybe that
-- doesn't matter?
IntegerL :: Integer -> Lit
RationalL :: Rational -> Lit
IntPrimL :: Integer -> Lit
WordPrimL :: Integer -> Lit
FloatPrimL :: Rational -> Lit
DoublePrimL :: Rational -> Lit
-- | A primitive C-style string, type Addr#
StringPrimL :: [Word8] -> Lit
-- | Some raw bytes, type Addr#:
BytesPrimL :: Bytes -> Lit
CharPrimL :: Char -> Lit
-- | Pattern in Haskell given in {}
data Pat
-- |
-- { 5 or 'c' }
--
LitP :: Lit -> Pat
-- |
-- { x }
--
VarP :: Name -> Pat
-- |
-- { (p1,p2) }
--
TupP :: [Pat] -> Pat
-- |
-- { (# p1,p2 #) }
--
UnboxedTupP :: [Pat] -> Pat
-- |
-- { (#|p|#) }
--
UnboxedSumP :: Pat -> SumAlt -> SumArity -> Pat
-- |
-- data T1 = C1 t1 t2; {C1 @ty1 p1 p2} = e
--
ConP :: Name -> [Type] -> [Pat] -> Pat
-- |
-- foo ({x :+ y}) = e
--
InfixP :: Pat -> Name -> Pat -> Pat
-- |
-- foo ({x :+ y}) = e
--
--
-- See Language.Haskell.TH.Syntax#infix
UInfixP :: Pat -> Name -> Pat -> Pat
-- |
-- {(p)}
--
--
-- See Language.Haskell.TH.Syntax#infix
ParensP :: Pat -> Pat
-- |
-- { ~p }
--
TildeP :: Pat -> Pat
-- |
-- { !p }
--
BangP :: Pat -> Pat
-- |
-- { x @ p }
--
AsP :: Name -> Pat -> Pat
-- |
-- { _ }
--
WildP :: Pat
-- |
-- f (Pt { pointx = x }) = g x
--
RecP :: Name -> [FieldPat] -> Pat
-- |
-- { [1,2,3] }
--
ListP :: [Pat] -> Pat
-- |
-- { p :: t }
--
SigP :: Pat -> Type -> Pat
-- |
-- { e -> p }
--
ViewP :: Exp -> Pat -> Pat
type FieldExp = (Name, Exp)
type FieldPat = (Name, Pat)
data Type
-- |
-- forall <vars>. <ctxt> => <type>
--
ForallT :: [TyVarBndr Specificity] -> Cxt -> Type -> Type
-- |
-- forall <vars> -> <type>
--
ForallVisT :: [TyVarBndr ()] -> Type -> Type
-- |
-- T a b
--
AppT :: Type -> Type -> Type
-- |
-- T @k t
--
AppKindT :: Type -> Kind -> Type
-- |
-- t :: k
--
SigT :: Type -> Kind -> Type
-- |
-- a
--
VarT :: Name -> Type
-- |
-- T
--
ConT :: Name -> Type
-- |
-- 'T
--
PromotedT :: Name -> Type
-- |
-- T + T
--
InfixT :: Type -> Name -> Type -> Type
-- |
-- T + T
--
--
-- See Language.Haskell.TH.Syntax#infix
UInfixT :: Type -> Name -> Type -> Type
-- |
-- T :+: T
--
PromotedInfixT :: Type -> Name -> Type -> Type
-- |
-- T :+: T
--
--
-- See Language.Haskell.TH.Syntax#infix
PromotedUInfixT :: Type -> Name -> Type -> Type
-- |
-- (T)
--
ParensT :: Type -> Type
-- |
-- (,), (,,), etc.
--
TupleT :: Int -> Type
-- |
-- (#,#), (#,,#), etc.
--
UnboxedTupleT :: Int -> Type
-- |
-- (#|#), (#||#), etc.
--
UnboxedSumT :: SumArity -> Type
-- |
-- ->
--
ArrowT :: Type
-- |
-- %n ->
--
--
-- Generalised arrow type with multiplicity argument
MulArrowT :: Type
-- |
-- ~
--
EqualityT :: Type
-- |
-- []
--
ListT :: Type
-- |
-- '(), '(,), '(,,), etc.
--
PromotedTupleT :: Int -> Type
-- |
-- '[]
--
PromotedNilT :: Type
-- |
-- (':)
--
PromotedConsT :: Type
-- |
-- *
--
StarT :: Type
-- |
-- Constraint
--
ConstraintT :: Type
-- |
-- 0,1,2, etc.
--
LitT :: TyLit -> Type
-- |
-- _
--
WildCardT :: Type
-- |
-- ?x :: t
--
ImplicitParamT :: String -> Type -> Type
data TyVarBndr flag
-- |
-- a
--
PlainTV :: Name -> flag -> TyVarBndr flag
-- |
-- (a :: k)
--
KindedTV :: Name -> flag -> Kind -> TyVarBndr flag
data TyLit
-- |
-- 2
--
NumTyLit :: Integer -> TyLit
-- |
-- "Hello"
--
StrTyLit :: String -> TyLit
-- | 'C', @since 4.16.0.0
CharTyLit :: Char -> TyLit
-- | To avoid duplication between kinds and types, they are defined to be
-- the same. Naturally, you would never have a type be StarT and
-- you would never have a kind be SigT, but many of the other
-- constructors are shared. Note that the kind Bool is denoted
-- with ConT, not PromotedT. Similarly, tuple kinds are
-- made with TupleT, not PromotedTupleT.
type Kind = Type
type Cxt = [Pred] " @(Eq a, Ord b)@"
-- | Since the advent of ConstraintKinds, constraints are really
-- just types. Equality constraints use the EqualityT constructor.
-- Constraints may also be tuples of other constraints.
type Pred = Type
-- | Role annotations
data Role
-- |
-- nominal
--
NominalR :: Role
-- |
-- representational
--
RepresentationalR :: Role
-- |
-- phantom
--
PhantomR :: Role
-- |
-- _
--
InferR :: Role
data Specificity
-- |
-- a
--
SpecifiedSpec :: Specificity
-- |
-- {a}
--
InferredSpec :: Specificity
-- | Type family result signature
data FamilyResultSig
-- | no signature
NoSig :: FamilyResultSig
-- |
-- k
--
KindSig :: Kind -> FamilyResultSig
-- |
-- = r, = (r :: k)
--
TyVarSig :: TyVarBndr () -> FamilyResultSig
-- | Injectivity annotation
data InjectivityAnn
InjectivityAnn :: Name -> [Name] -> InjectivityAnn
-- | A pattern synonym's type. Note that a pattern synonym's fully
-- specified type has a peculiar shape coming with two forall quantifiers
-- and two constraint contexts. For example, consider the pattern synonym
--
--
-- pattern P x1 x2 ... xn = <some-pattern>
--
--
-- P's complete type is of the following form
--
--
-- pattern P :: forall universals. required constraints
-- => forall existentials. provided constraints
-- => t1 -> t2 -> ... -> tn -> t
--
--
-- consisting of four parts:
--
--
-- - the (possibly empty lists of) universally quantified type
-- variables and required constraints on them.
-- - the (possibly empty lists of) existentially quantified type
-- variables and the provided constraints on them.
-- - the types t1, t2, .., tn of
-- x1, x2, .., xn, respectively
-- - the type t of <some-pattern>, mentioning
-- only universals.
--
--
-- Pattern synonym types interact with TH when (a) reifying a pattern
-- synonym, (b) pretty printing, or (c) specifying a pattern synonym's
-- type signature explicitly:
--
--
-- - Reification always returns a pattern synonym's fully
-- specified type in abstract syntax.
-- - Pretty printing via pprPatSynType abbreviates a pattern
-- synonym's type unambiguously in concrete syntax: The rule of thumb is
-- to print initial empty universals and the required context as ()
-- =>, if existentials and a provided context follow. If only
-- universals and their required context, but no existentials are
-- specified, only the universals and their required context are printed.
-- If both or none are specified, so both (or none) are printed.
-- - When specifying a pattern synonym's type explicitly with
-- PatSynSigD either one of the universals, the existentials, or
-- their contexts may be left empty.
--
--
-- See the GHC user's guide for more information on pattern synonyms and
-- their types:
-- https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#pattern-synonyms.
type PatSynType = Type
type BangType = (Bang, Type)
type VarBangType = (Name, Bang, Type)
-- | Add Haddock documentation to the specified location. This will
-- overwrite any documentation at the location if it already exists. This
-- will reify the specified name, so it must be in scope when you call
-- it. If you want to add documentation to something that you are
-- currently splicing, you can use addModFinalizer e.g.
--
--
-- do
-- let nm = mkName "x"
-- addModFinalizer $ putDoc (DeclDoc nm) "Hello"
-- [d| $(varP nm) = 42 |]
--
--
-- The helper functions withDecDoc and withDecsDoc will
-- do this for you, as will the funD_doc and other _doc
-- combinators. You most likely want to have the -haddock flag
-- turned on when using this. Adding documentation to anything outside of
-- the current module will cause an error.
putDoc :: DocLoc -> String -> Q ()
-- | Retreives the Haddock documentation at the specified location, if one
-- exists. It can be used to read documentation on things defined outside
-- of the current module, provided that those modules were compiled with
-- the -haddock flag.
getDoc :: DocLoc -> Q (Maybe String)
-- | A location at which to attach Haddock documentation. Note that adding
-- documentation to a Name defined oustide of the current module
-- will cause an error.
data DocLoc
-- | At the current module's header.
ModuleDoc :: DocLoc
-- | At a declaration, not necessarily top level.
DeclDoc :: Name -> DocLoc
-- | At a specific argument of a function, indexed by its position.
ArgDoc :: Name -> Int -> DocLoc
-- | At a class or family instance.
InstDoc :: Type -> DocLoc
class Ppr a
ppr :: Ppr a => a -> Doc
ppr_list :: Ppr a => [a] -> Doc
pprint :: Ppr a => a -> String
pprExp :: Precedence -> Exp -> Doc
pprLit :: Precedence -> Lit -> Doc
pprPat :: Precedence -> Pat -> Doc
pprParendType :: Type -> Doc
-- | Abstract Haskell syntax for expressions.
module Language.Haskell.Syntax.Expr
-- | RecordDotSyntax field updates
type LFieldLabelStrings p = XRec p (FieldLabelStrings p)
newtype FieldLabelStrings p
FieldLabelStrings :: [XRec p (DotFieldOcc p)] -> FieldLabelStrings p
pprFieldLabelStrings :: forall p. (UnXRec p, Outputable (XRec p FieldLabelString)) => FieldLabelStrings p -> SDoc
type RecProj p arg = HsFieldBind (LFieldLabelStrings p) arg
type LHsRecProj p arg = XRec p (RecProj p arg)
type RecUpdProj p = RecProj p (LHsExpr p)
type LHsRecUpdProj p = XRec p (RecUpdProj p)
-- | Located Haskell Expression
type LHsExpr p = XRec p (HsExpr p) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when in a list"
-- | Syntax Expression
--
-- SyntaxExpr is represents the function used in interpreting rebindable
-- syntax. In the parser, we have no information to supply; in the
-- renamer, we have the name of the function (but see Note [Monad fail :
-- Rebindable syntax, overloaded strings] for a wrinkle) and in the
-- type-checker we have a more elaborate structure SyntaxExprTc.
--
-- In some contexts, rebindable syntax is not implemented, and so we have
-- constructors to represent that possibility in both the renamer and
-- typechecker instantiations.
--
-- 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
type family SyntaxExpr p
-- | Command Syntax Table (for Arrow syntax)
type CmdSyntaxTable p = [(Name, HsExpr p)]
-- | A Haskell expression.
data HsExpr p
-- | Variable See Note [Located RdrNames]
HsVar :: XVar p -> LIdP p -> HsExpr p
-- | 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. The (XUnboundVar p) field becomes an HoleExprRef after
-- typechecking; this is where the erroring expression will be written
-- after solving. See Note [Holes] in GHC.Tc.Types.Constraint.
HsUnboundVar :: XUnboundVar p -> OccName -> HsExpr p
-- | Variable pointing to record selector See Note [Non-overloaded record
-- field selectors] and Note [Record selectors in the AST]
HsRecSel :: XRecSel p -> FieldOcc p -> HsExpr p
-- | Overloaded label (Note [Overloaded labels] in GHC.OverloadedLabels)
HsOverLabel :: XOverLabel p -> FastString -> HsExpr p
-- | Implicit parameter (not in use after typechecking)
HsIPVar :: XIPVar p -> HsIPName -> HsExpr p
-- | Overloaded literals
HsOverLit :: XOverLitE p -> HsOverLit p -> HsExpr p
-- | Simple (non-overloaded) literals
HsLit :: XLitE p -> HsLit p -> HsExpr p
-- | Lambda abstraction. Currently always a single match
--
--
HsLam :: XLam p -> MatchGroup p (LHsExpr p) -> HsExpr p
-- | Lambda-case
--
--
HsLamCase :: XLamCase p -> MatchGroup p (LHsExpr p) -> HsExpr p
-- | Application
HsApp :: XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
-- | Visible type application
--
-- Explicit type argument; e.g f @Int x y NB: Has wildcards, but no
-- implicit quantification
--
--
HsAppType :: XAppTypeE p -> LHsExpr p -> LHsWcType (NoGhcTc p) -> HsExpr p
-- | Operator applications: NB Bracketed ops such as (+) come out as Vars.
OpApp :: XOpApp p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
-- | Negation operator. Contains the negated expression and the name of
-- negate
--
--
NegApp :: XNegApp p -> LHsExpr p -> SyntaxExpr p -> HsExpr p
-- |
HsPar :: XPar p -> !LHsToken "(" p -> LHsExpr p -> !LHsToken ")" p -> HsExpr p
SectionL :: XSectionL p -> LHsExpr p -> LHsExpr p -> HsExpr p
SectionR :: XSectionR p -> LHsExpr p -> LHsExpr p -> HsExpr p
-- | Used for explicit tuples and sections thereof
--
--
ExplicitTuple :: XExplicitTuple p -> [HsTupArg p] -> Boxity -> HsExpr p
-- | Used for unboxed sum types
--
--
--
-- There will be multiple AnnVbar, (1 - alternative) before the
-- expression, (arity - alternative) after it
ExplicitSum :: XExplicitSum p -> ConTag -> Arity -> LHsExpr p -> HsExpr p
-- |
HsCase :: XCase p -> LHsExpr p -> MatchGroup p (LHsExpr p) -> HsExpr p
-- |
HsIf :: XIf p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
-- | Multi-way if
--
--
HsMultiIf :: XMultiIf p -> [LGRHS p (LHsExpr p)] -> HsExpr p
-- | let(rec)
--
--
HsLet :: XLet p -> !LHsToken "let" p -> HsLocalBinds p -> !LHsToken "in" p -> LHsExpr p -> HsExpr p
-- |
HsDo :: XDo p -> HsDoFlavour -> XRec p [ExprLStmt p] -> HsExpr p
-- | Syntactic list: [a,b,c,...]
--
--
ExplicitList :: XExplicitList p -> [LHsExpr p] -> HsExpr p
-- | Record construction
--
--
RecordCon :: XRecordCon p -> XRec p (ConLikeP p) -> HsRecordBinds p -> HsExpr p
[rcon_ext] :: HsExpr p -> XRecordCon p
[rcon_con] :: HsExpr p -> XRec p (ConLikeP p)
[rcon_flds] :: HsExpr p -> HsRecordBinds p
-- | Record update
--
--
RecordUpd :: XRecordUpd p -> LHsExpr p -> Either [LHsRecUpdField p] [LHsRecUpdProj p] -> HsExpr p
[rupd_ext] :: HsExpr p -> XRecordUpd p
[rupd_expr] :: HsExpr p -> LHsExpr p
[rupd_flds] :: HsExpr p -> Either [LHsRecUpdField p] [LHsRecUpdProj p]
-- | Record field selection e.g z.x.
--
--
HsGetField :: XGetField p -> LHsExpr p -> XRec p (DotFieldOcc p) -> HsExpr p
[gf_ext] :: HsExpr p -> XGetField p
[gf_expr] :: HsExpr p -> LHsExpr p
[gf_field] :: HsExpr p -> XRec p (DotFieldOcc p)
-- | Record field selector. e.g. (.x) or (.x.y)
--
-- This case only arises when the OverloadedRecordDot langauge extensions
-- is enabled. See Note [Record selectors in the AST].
HsProjection :: XProjection p -> NonEmpty (XRec p (DotFieldOcc p)) -> HsExpr p
[proj_ext] :: HsExpr p -> XProjection p
[proj_flds] :: HsExpr p -> NonEmpty (XRec p (DotFieldOcc p))
-- | Expression with an explicit type signature. e :: type
--
--
ExprWithTySig :: XExprWithTySig p -> LHsExpr p -> LHsSigWcType (NoGhcTc p) -> HsExpr p
-- | Arithmetic sequence
--
--
ArithSeq :: XArithSeq p -> Maybe (SyntaxExpr p) -> ArithSeqInfo p -> HsExpr p
-- |
HsTypedBracket :: XTypedBracket p -> LHsExpr p -> HsExpr p
HsUntypedBracket :: XUntypedBracket p -> HsQuote p -> HsExpr p
-- |
HsSpliceE :: XSpliceE p -> HsSplice p -> HsExpr p
-- | proc notation for Arrows
--
--
HsProc :: XProc p -> LPat p -> LHsCmdTop p -> HsExpr p
-- |
HsStatic :: XStatic p -> LHsExpr p -> HsExpr p
HsPragE :: XPragE p -> HsPragE p -> LHsExpr p -> HsExpr p
XExpr :: !XXExpr p -> HsExpr p
data DotFieldOcc p
DotFieldOcc :: XCDotFieldOcc p -> XRec p FieldLabelString -> DotFieldOcc p
[dfoExt] :: DotFieldOcc p -> XCDotFieldOcc p
[dfoLabel] :: DotFieldOcc p -> XRec p FieldLabelString
XDotFieldOcc :: !XXDotFieldOcc p -> DotFieldOcc p
-- | A pragma, written as {--}, that may appear within an expression.
data HsPragE p
HsPragSCC :: XSCC p -> SourceText -> StringLiteral -> HsPragE p
-- |
-- - AnnKeywordId : AnnOpen, AnnOpen '{-#
-- GENERATED', AnnVal,AnnVal,
-- AnnColon,AnnVal, AnnMinus,
-- AnnVal,AnnColon, AnnVal, AnnClose
-- '#-}'
--
XHsPragE :: !XXPragE p -> HsPragE p
-- | 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 = XRec id (HsTupArg id)
-- |
--
-- Haskell Tuple Argument
data HsTupArg id
-- | The argument
Present :: XPresent id -> LHsExpr id -> HsTupArg id
-- | The argument is missing, but this is its type
Missing :: XMissing id -> HsTupArg id
-- | Extension point; see Note [Trees That Grow] in
-- Language.Haskell.Syntax.Extension
XTupArg :: !XXTupArg id -> HsTupArg id
pprExternalSrcLoc :: (StringLiteral, (Int, Int), (Int, Int)) -> SDoc
-- | Located Haskell Command (for arrow syntax)
type LHsCmd id = XRec id (HsCmd id)
-- | Haskell Command (e.g. a "statement" in an Arrow proc block)
data HsCmd id
-- |
HsCmdArrApp :: XCmdArrApp id -> LHsExpr id -> LHsExpr id -> HsArrAppType -> Bool -> HsCmd id
-- |
HsCmdArrForm :: XCmdArrForm id -> LHsExpr id -> LexicalFixity -> Maybe Fixity -> [LHsCmdTop id] -> HsCmd id
HsCmdApp :: XCmdApp id -> LHsCmd id -> LHsExpr id -> HsCmd id
-- |
HsCmdLam :: XCmdLam id -> MatchGroup id (LHsCmd id) -> HsCmd id
-- |
HsCmdPar :: XCmdPar id -> !LHsToken "(" id -> LHsCmd id -> !LHsToken ")" id -> HsCmd id
-- |
HsCmdCase :: XCmdCase id -> LHsExpr id -> MatchGroup id (LHsCmd id) -> HsCmd id
-- |
HsCmdLamCase :: XCmdLamCase id -> MatchGroup id (LHsCmd id) -> HsCmd id
-- |
HsCmdIf :: XCmdIf id -> SyntaxExpr id -> LHsExpr id -> LHsCmd id -> LHsCmd id -> HsCmd id
-- |
HsCmdLet :: XCmdLet id -> !LHsToken "let" id -> HsLocalBinds id -> !LHsToken "in" id -> LHsCmd id -> HsCmd id
-- |
HsCmdDo :: XCmdDo id -> XRec id [CmdLStmt id] -> HsCmd id
XCmd :: !XXCmd id -> HsCmd id
-- | Haskell arrow application type.
data HsArrAppType
-- | First order arrow application -<
HsHigherOrderApp :: HsArrAppType
-- | Higher order arrow application -<<
HsFirstOrderApp :: HsArrAppType
pprHsArrType :: HsArrAppType -> SDoc
-- | 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 p = XRec p (HsCmdTop p)
-- | Haskell Top-level Command
data HsCmdTop p
HsCmdTop :: XCmdTop p -> LHsCmd p -> HsCmdTop p
XCmdTop :: !XXCmdTop p -> HsCmdTop p
-- | Haskell Record Bindings
type HsRecordBinds p = HsRecFields p (LHsExpr p)
data MatchGroup p body
MG :: XMG p body -> XRec p [LMatch p body] -> Origin -> MatchGroup p body
[mg_ext] :: MatchGroup p body -> XMG p body
[mg_alts] :: MatchGroup p body -> XRec p [LMatch p body]
[mg_origin] :: MatchGroup p body -> Origin
XMatchGroup :: !XXMatchGroup p body -> MatchGroup p body
data MatchGroupTc
MatchGroupTc :: [Scaled Type] -> Type -> MatchGroupTc
[mg_arg_tys] :: MatchGroupTc -> [Scaled Type]
[mg_res_ty] :: MatchGroupTc -> Type
-- | Located Match
--
-- May have AnnKeywordId : AnnSemi when in a list
type LMatch id body = XRec id (Match id body)
data Match p body
Match :: XCMatch p body -> HsMatchContext p -> [LPat p] -> GRHSs p body -> Match p body
[m_ext] :: Match p body -> XCMatch p body
[m_ctxt] :: Match p body -> HsMatchContext p
[m_pats] :: Match p body -> [LPat p]
[m_grhss] :: Match p body -> GRHSs p body
XMatch :: !XXMatch p body -> Match p body
isInfixMatch :: Match id body -> Bool
-- | Guarded Right-Hand Sides
--
-- GRHSs are used both for pattern bindings and for Matches
--
--
data GRHSs p body
GRHSs :: XCGRHSs p body -> [LGRHS p body] -> HsLocalBinds p -> GRHSs p body
[grhssExt] :: GRHSs p body -> XCGRHSs p body
-- | Guarded RHSs
[grhssGRHSs] :: GRHSs p body -> [LGRHS p body]
-- | The where clause
[grhssLocalBinds] :: GRHSs p body -> HsLocalBinds p
XGRHSs :: !XXGRHSs p body -> GRHSs p body
-- | Located Guarded Right-Hand Side
type LGRHS id body = XRec id (GRHS id body)
-- | Guarded Right Hand Side.
data GRHS p body
GRHS :: XCGRHS p body -> [GuardLStmt p] -> body -> GRHS p body
XGRHS :: !XXGRHS p body -> GRHS p body
-- | Located do block Statement
type LStmt id body = XRec id (StmtLR id id body)
-- | Located Statement with separate Left and Right id's
type LStmtLR idL idR body = XRec idL (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 Statement
type GhciLStmt id = LStmt id (LHsExpr id)
-- | Ghci Statement
type GhciStmt id = Stmt id (LHsExpr id)
-- | Exact print annotations when in qualifier lists or guards -
-- AnnKeywordId : AnnVbar, AnnComma,AnnThen,
-- AnnBy,AnnBy, AnnGroup,AnnUsing
data StmtLR idL idR body
LastStmt :: XLastStmt idL idR body -> body -> Maybe Bool -> SyntaxExpr idR -> StmtLR idL idR body
BindStmt :: XBindStmt idL idR body -> LPat idL -> body -> 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 GHC.Rename.Expr
ApplicativeStmt :: XApplicativeStmt idL idR body -> [(SyntaxExpr idR, ApplicativeArg idL)] -> Maybe (SyntaxExpr idR) -> StmtLR idL idR body
BodyStmt :: XBodyStmt idL idR body -> body -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body
-- |
LetStmt :: XLetStmt idL idR body -> HsLocalBindsLR idL idR -> StmtLR idL idR body
ParStmt :: XParStmt idL idR body -> [ParStmtBlock idL idR] -> HsExpr idR -> SyntaxExpr idR -> StmtLR idL idR body
TransStmt :: XTransStmt idL idR body -> TransForm -> [ExprLStmt idL] -> [(IdP idR, IdP idR)] -> LHsExpr idR -> Maybe (LHsExpr idR) -> SyntaxExpr idR -> SyntaxExpr idR -> HsExpr idR -> StmtLR idL idR body
[trS_ext] :: StmtLR idL idR body -> XTransStmt idL idR body
[trS_form] :: StmtLR idL idR body -> TransForm
[trS_stmts] :: StmtLR idL idR body -> [ExprLStmt idL]
[trS_bndrs] :: StmtLR idL idR body -> [(IdP idR, IdP 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_fmap] :: StmtLR idL idR body -> HsExpr idR
-- |
RecStmt :: XRecStmt idL idR body -> XRec idR [LStmtLR idL idR body] -> [IdP idR] -> [IdP idR] -> SyntaxExpr idR -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body
[recS_ext] :: StmtLR idL idR body -> XRecStmt idL idR body
[recS_stmts] :: StmtLR idL idR body -> XRec idR [LStmtLR idL idR body]
[recS_later_ids] :: StmtLR idL idR body -> [IdP idR]
[recS_rec_ids] :: StmtLR idL idR body -> [IdP 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
XStmtLR :: !XXStmtLR idL idR body -> StmtLR idL idR body
data TransForm
ThenForm :: TransForm
GroupForm :: TransForm
-- | Parenthesised Statement Block
data ParStmtBlock idL idR
ParStmtBlock :: XParStmtBlock idL idR -> [ExprLStmt idL] -> [IdP idR] -> SyntaxExpr idR -> ParStmtBlock idL idR
XParStmtBlock :: !XXParStmtBlock idL idR -> ParStmtBlock idL idR
-- | The fail operator
--
-- This is used for `.. <-` "bind statements" in do notation,
-- including non-monadic "binds" in applicative.
--
-- The fail operator is 'Just expr' if it potentially fail monadically.
-- if the pattern match cannot fail, or shouldn't fail monadically
-- (regular incomplete pattern exception), it is Nothing.
--
-- See Note [Monad fail : Rebindable syntax, overloaded strings] for the
-- type of expression in the Just case, and why it is so.
--
-- See Note [Failing pattern matches in Stmts] for which contexts for
-- 'BindStmt's should use the monadic fail and which shouldn't.
type FailOperator id = Maybe (SyntaxExpr id)
-- | Applicative Argument
data ApplicativeArg idL
ApplicativeArgOne :: XApplicativeArgOne idL -> LPat idL -> LHsExpr idL -> Bool -> ApplicativeArg idL
-- | The fail operator, after renaming
--
-- The fail operator is needed if this is a BindStmt where the pattern
-- can fail. E.g.: (Just a) <- stmt The fail operator will be invoked
-- if the pattern match fails. It is also used for guards in
-- MonadComprehensions. The fail operator is Nothing if the pattern match
-- can't fail
[xarg_app_arg_one] :: ApplicativeArg idL -> XApplicativeArgOne idL
[app_arg_pattern] :: ApplicativeArg idL -> LPat idL
[arg_expr] :: ApplicativeArg idL -> LHsExpr idL
-- | True = was a BodyStmt, False = was a BindStmt. See Note
-- [Applicative BodyStmt]
[is_body_stmt] :: ApplicativeArg idL -> Bool
ApplicativeArgMany :: XApplicativeArgMany idL -> [ExprLStmt idL] -> HsExpr idL -> LPat idL -> HsDoFlavour -> ApplicativeArg idL
[xarg_app_arg_many] :: ApplicativeArg idL -> XApplicativeArgMany idL
[app_stmts] :: ApplicativeArg idL -> [ExprLStmt idL]
[final_expr] :: ApplicativeArg idL -> HsExpr idL
[bv_pattern] :: ApplicativeArg idL -> LPat idL
-- | context of the do expression, used in pprArg
[stmt_context] :: ApplicativeArg idL -> HsDoFlavour
XApplicativeArg :: !XXApplicativeArg idL -> ApplicativeArg idL
-- | Haskell Splice
data HsSplice id
HsTypedSplice :: XTypedSplice id -> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id
HsUntypedSplice :: XUntypedSplice id -> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id
HsQuasiQuote :: XQuasiQuote id -> IdP id -> IdP id -> SrcSpan -> FastString -> HsSplice id
HsSpliced :: XSpliced id -> ThModFinalizers -> HsSplicedThing id -> HsSplice id
XSplice :: !XXSplice 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
DollarSplice :: SpliceDecoration
-- | bare splice
BareSplice :: SpliceDecoration
isTypedSplice :: HsSplice id -> Bool
-- | Finalizers produced by a splice with addModFinalizer
--
-- See Note [Delaying modFinalizers in untyped splices] in
-- GHC.Rename.Splice. 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
data UntypedSpliceFlavour
UntypedExpSplice :: UntypedSpliceFlavour
UntypedPatSplice :: UntypedSpliceFlavour
UntypedTypeSplice :: UntypedSpliceFlavour
UntypedDeclSplice :: UntypedSpliceFlavour
-- | Haskell (Untyped) Quote = Expr + Pat + Type + Var
data HsQuote p
ExpBr :: XExpBr p -> LHsExpr p -> HsQuote p
PatBr :: XPatBr p -> LPat p -> HsQuote p
DecBrL :: XDecBrL p -> [LHsDecl p] -> HsQuote p
DecBrG :: XDecBrG p -> HsGroup p -> HsQuote p
TypBr :: XTypBr p -> LHsType p -> HsQuote p
VarBr :: XVarBr p -> Bool -> LIdP p -> HsQuote p
XQuote :: !XXQuote p -> HsQuote p
-- | 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
-- | Haskell Match Context
--
-- Context of a pattern match. This is more subtle than it would seem.
-- See Note [FunBind vs PatBind].
data HsMatchContext p
-- | A pattern matching on an argument of a function binding
FunRhs :: LIdP p -> LexicalFixity -> SrcStrictness -> HsMatchContext p
-- | function binder of f
[mc_fun] :: HsMatchContext p -> LIdP p
-- | fixing of f
[mc_fixity] :: HsMatchContext p -> LexicalFixity
-- | was f banged? See Note [FunBind vs PatBind]
[mc_strictness] :: HsMatchContext p -> SrcStrictness
-- | Patterns of a lambda
LambdaExpr :: HsMatchContext p
-- | Patterns and guards on a case alternative
CaseAlt :: HsMatchContext p
-- | Guards of a multi-way if alternative
IfAlt :: HsMatchContext p
-- | A pattern match inside arrow notation
ArrowMatchCtxt :: HsArrowMatchContext -> HsMatchContext p
-- | A pattern binding eg [y] <- e = e
PatBindRhs :: HsMatchContext p
-- | Guards of pattern bindings, e.g., (Just b) | Just _ <- x = e |
-- otherwise = e'
PatBindGuards :: HsMatchContext p
-- | Record update [used only in GHC.HsToCore.Expr to tell matchWrapper
-- what sort of runtime error message to generate]
RecUpd :: HsMatchContext p
-- | Pattern of a do-stmt, list comprehension, pattern guard, etc
StmtCtxt :: HsStmtContext p -> HsMatchContext p
-- | A Template Haskell pattern splice
ThPatSplice :: HsMatchContext p
-- | A Template Haskell pattern quotation [p| (a,b) |]
ThPatQuote :: HsMatchContext p
-- | A pattern synonym declaration
PatSyn :: HsMatchContext p
isPatSynCtxt :: HsMatchContext p -> Bool
-- | Haskell Statement Context.
data HsStmtContext p
-- | Context for HsDo (do-notation and comprehensions)
HsDoStmt :: HsDoFlavour -> HsStmtContext p
-- | Pattern guard for specified thing
PatGuard :: HsMatchContext p -> HsStmtContext p
-- | A branch of a parallel stmt
ParStmtCtxt :: HsStmtContext p -> HsStmtContext p
-- | A branch of a transform stmt
TransStmtCtxt :: HsStmtContext p -> HsStmtContext p
-- | do-notation in an arrow-command context
ArrowExpr :: HsStmtContext p
-- | Haskell arrow match context.
data HsArrowMatchContext
-- | A proc expression
ProcExpr :: HsArrowMatchContext
-- | A case alternative inside arrow notation
ArrowCaseAlt :: HsArrowMatchContext
-- | An arrow kappa abstraction
KappaExpr :: HsArrowMatchContext
data HsDoFlavour
-- |
-- - ModuleName. do { ... }
--
DoExpr :: Maybe ModuleName -> HsDoFlavour
-- |
-- - ModuleName. mdo { ... } ie recursive do-expression
--
MDoExpr :: Maybe ModuleName -> HsDoFlavour
-- | A command-line Stmt in GHCi pat <- rhs
GhciStmtCtxt :: HsDoFlavour
ListComp :: HsDoFlavour
MonadComp :: HsDoFlavour
qualifiedDoModuleName_maybe :: HsStmtContext p -> Maybe ModuleName
isComprehensionContext :: HsStmtContext id -> Bool
isDoComprehensionContext :: HsDoFlavour -> Bool
-- | Is this a monadic context?
isMonadStmtContext :: HsStmtContext id -> Bool
isMonadDoStmtContext :: HsDoFlavour -> Bool
isMonadCompContext :: HsStmtContext id -> Bool
isMonadDoCompContext :: HsDoFlavour -> Bool
matchSeparator :: HsMatchContext p -> SDoc
pprMatchContext :: (Outputable (IdP p), UnXRec p) => HsMatchContext p -> SDoc
pprMatchContextNoun :: forall p. (Outputable (IdP p), UnXRec p) => HsMatchContext p -> SDoc
pprArrowMatchContextNoun :: HsArrowMatchContext -> SDoc
pprAStmtContext :: (Outputable (IdP p), UnXRec p) => HsStmtContext p -> SDoc
pprStmtContext :: (Outputable (IdP p), UnXRec p) => HsStmtContext p -> SDoc
pprAHsDoFlavour :: HsDoFlavour -> SDoc
pprHsDoFlavour :: HsDoFlavour -> SDoc
prependQualified :: Maybe ModuleName -> SDoc -> SDoc
instance Data.Data.Data Language.Haskell.Syntax.Expr.HsArrAppType
instance Data.Data.Data Language.Haskell.Syntax.Expr.MatchGroupTc
instance Data.Data.Data Language.Haskell.Syntax.Expr.TransForm
instance GHC.Show.Show Language.Haskell.Syntax.Expr.SpliceDecoration
instance GHC.Classes.Eq Language.Haskell.Syntax.Expr.SpliceDecoration
instance Data.Data.Data Language.Haskell.Syntax.Expr.SpliceDecoration
instance Data.Data.Data Language.Haskell.Syntax.Expr.UntypedSpliceFlavour
instance Data.Data.Data Language.Haskell.Syntax.Expr.ThModFinalizers
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Expr.SpliceDecoration
instance (Language.Haskell.Syntax.Extension.UnXRec p, GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec p GHC.Types.FieldLabel.FieldLabelString)) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.FieldLabelStrings p)
instance (Language.Haskell.Syntax.Extension.UnXRec p, GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec p GHC.Types.FieldLabel.FieldLabelString)) => GHC.Utils.Outputable.OutputableBndr (Language.Haskell.Syntax.Expr.FieldLabelStrings p)
instance (Language.Haskell.Syntax.Extension.UnXRec p, GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec p GHC.Types.FieldLabel.FieldLabelString)) => GHC.Utils.Outputable.OutputableBndr (GHC.Types.SrcLoc.Located (Language.Haskell.Syntax.Expr.FieldLabelStrings p))
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XRec p GHC.Types.FieldLabel.FieldLabelString) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.DotFieldOcc p)
module Language.Haskell.Syntax
module GHC.Hs.Type
-- | Mult is a type alias for Type.
--
-- Mult must contain Type because multiplicity variables are mere type
-- variables (of kind Multiplicity) in Haskell. So the simplest
-- implementation is to make Mult be Type.
--
-- Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon)
-- - Many: GHC.Types.Many (= manyDataCon) - Multiplication:
-- GHC.Types.MultMul (= multMulTyCon)
--
-- So that Mult feels a bit more structured, we provide pattern synonyms
-- and smart constructors for these.
type Mult = Type
-- | This is used in the syntax. In constructor declaration. It must keep
-- the arrow representation.
data HsScaled pass a
HsScaled :: HsArrow pass -> a -> HsScaled pass a
hsMult :: HsScaled pass a -> HsArrow pass
hsScaledThing :: HsScaled pass a -> a
-- | Denotes the type of arrows in the surface language
data HsArrow pass
-- | a -> b or a → b
HsUnrestrictedArrow :: !LHsUniToken "->" "\8594" pass -> HsArrow pass
-- | a %1 -> b or a %1 → b, or a ⊸ b
HsLinearArrow :: !HsLinearArrowTokens pass -> HsArrow pass
-- | a %m -> b or a %m → b (very much including `a %Many -> b`! This
-- is how the programmer wrote it). It is stored as an HsType so
-- as to preserve the syntax as written in the program.
HsExplicitMult :: !LHsToken "%" pass -> !LHsType pass -> !LHsUniToken "->" "\8594" pass -> HsArrow pass
-- | Convert an arrow into its corresponding multiplicity. In essence this
-- erases the information of whether the programmer wrote an explicit
-- multiplicity or a shorthand.
arrowToHsType :: HsArrow GhcRn -> LHsType GhcRn
data HsLinearArrowTokens pass
HsPct1 :: !LHsToken "%1" pass -> !LHsUniToken "->" "\8594" pass -> HsLinearArrowTokens pass
HsLolly :: !LHsToken "\8888" pass -> HsLinearArrowTokens pass
hsLinear :: a -> HsScaled (GhcPass p) a
hsUnrestricted :: a -> HsScaled (GhcPass p) a
isUnrestricted :: HsArrow GhcRn -> Bool
pprHsArrow :: OutputableBndrId pass => HsArrow (GhcPass pass) -> SDoc
-- | Haskell Type
data HsType pass
-- |
HsForAllTy :: XForAllTy pass -> HsForAllTelescope pass -> LHsType pass -> HsType pass
[hst_xforall] :: HsType pass -> XForAllTy pass
[hst_tele] :: HsType pass -> HsForAllTelescope pass
[hst_body] :: HsType pass -> LHsType pass
HsQualTy :: XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass
[hst_xqual] :: HsType pass -> XQualTy pass
[hst_ctxt] :: HsType pass -> LHsContext pass
[hst_body] :: HsType pass -> LHsType pass
-- |
HsTyVar :: XTyVar pass -> PromotionFlag -> LIdP pass -> HsType pass
-- |
HsAppTy :: XAppTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppKindTy :: XAppKindTy pass -> LHsType pass -> LHsKind pass -> HsType pass
-- |
HsFunTy :: XFunTy pass -> HsArrow pass -> LHsType pass -> LHsType pass -> HsType pass
-- |
HsListTy :: XListTy pass -> LHsType pass -> HsType pass
-- |
HsTupleTy :: XTupleTy pass -> HsTupleSort -> [LHsType pass] -> HsType pass
-- |
HsSumTy :: XSumTy pass -> [LHsType pass] -> HsType pass
-- |
HsOpTy :: XOpTy pass -> LHsType pass -> LIdP pass -> LHsType pass -> HsType pass
-- |
HsParTy :: XParTy pass -> LHsType pass -> HsType pass
-- |
-- (?x :: ty)
--
--
--
HsIParamTy :: XIParamTy pass -> XRec pass HsIPName -> LHsType pass -> HsType pass
-- |
HsStarTy :: XStarTy pass -> Bool -> HsType pass
-- |
-- (ty :: kind)
--
--
--
HsKindSig :: XKindSig pass -> LHsType pass -> LHsKind pass -> HsType pass
-- |
HsSpliceTy :: XSpliceTy pass -> HsSplice pass -> HsType pass
-- |
HsDocTy :: XDocTy pass -> LHsType pass -> LHsDoc pass -> HsType pass
-- |
HsBangTy :: XBangTy pass -> HsSrcBang -> LHsType pass -> HsType pass
-- |
HsRecTy :: XRecTy pass -> [LConDeclField pass] -> HsType pass
-- |
HsExplicitListTy :: XExplicitListTy pass -> PromotionFlag -> [LHsType pass] -> HsType pass
-- |
HsExplicitTupleTy :: XExplicitTupleTy pass -> [LHsType pass] -> HsType pass
-- |
HsTyLit :: XTyLit pass -> HsTyLit -> HsType pass
-- |
HsWildCardTy :: XWildCardTy pass -> HsType pass
XHsType :: !XXType pass -> HsType pass
type HsCoreTy = Type
-- | Located Haskell Type
type LHsType pass = XRec pass (HsType pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when in a list"
-- | Haskell Kind
type HsKind pass = HsType pass
-- | Located Haskell Kind
type LHsKind pass = XRec pass (HsKind pass) " 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon'"
-- | The type variable binders in an HsForAllTy. See also Note
-- [Variable Specificity and Forall Visibility] in
-- GHC.Tc.Gen.HsType.
data HsForAllTelescope pass
-- | A visible forall (e.g., forall a -> {...}). These
-- do not have any notion of specificity, so we use () as a
-- placeholder value.
HsForAllVis :: XHsForAllVis pass -> [LHsTyVarBndr () pass] -> HsForAllTelescope pass
[hsf_xvis] :: HsForAllTelescope pass -> XHsForAllVis pass
[hsf_vis_bndrs] :: HsForAllTelescope pass -> [LHsTyVarBndr () pass]
-- | An invisible forall (e.g., forall a {b} c. {...}),
-- where each binder has a Specificity.
HsForAllInvis :: XHsForAllInvis pass -> [LHsTyVarBndr Specificity pass] -> HsForAllTelescope pass
[hsf_xinvis] :: HsForAllTelescope pass -> XHsForAllInvis pass
[hsf_invis_bndrs] :: HsForAllTelescope pass -> [LHsTyVarBndr Specificity pass]
XHsForAllTelescope :: !XXHsForAllTelescope pass -> HsForAllTelescope pass
type EpAnnForallTy = EpAnn (AddEpAnn, AddEpAnn) " Location of 'forall' and '->' for HsForAllVis Location of 'forall' and '.' for HsForAllInvis"
-- | Haskell Type Variable Binder The flag annotates the binder. It is
-- Specificity in places where explicit specificity is allowed
-- (e.g. x :: forall {a} b. ...) or () in other places.
data HsTyVarBndr flag pass
UserTyVar :: XUserTyVar pass -> flag -> LIdP pass -> HsTyVarBndr flag pass
-- |
KindedTyVar :: XKindedTyVar pass -> flag -> LIdP pass -> LHsKind pass -> HsTyVarBndr flag pass
XTyVarBndr :: !XXTyVarBndr pass -> HsTyVarBndr flag pass
-- | Located Haskell Type Variable Binder
type LHsTyVarBndr flag pass = XRec pass (HsTyVarBndr flag pass)
-- | Located Haskell Quantified Type Variables
data LHsQTyVars pass
HsQTvs :: XHsQTvs pass -> [LHsTyVarBndr () pass] -> LHsQTyVars pass
[hsq_ext] :: LHsQTyVars pass -> XHsQTvs pass
[hsq_explicit] :: LHsQTyVars pass -> [LHsTyVarBndr () pass]
XLHsQTyVars :: !XXLHsQTyVars pass -> LHsQTyVars pass
-- | The outermost type variables in a type that obeys the
-- forall-or-nothing rule. See Note [forall-or-nothing
-- rule].
data HsOuterTyVarBndrs flag pass
-- | Implicit forall, e.g., f :: a -> b -> b
HsOuterImplicit :: XHsOuterImplicit pass -> HsOuterTyVarBndrs flag pass
[hso_ximplicit] :: HsOuterTyVarBndrs flag pass -> XHsOuterImplicit pass
-- | Explicit forall, e.g., f :: forall a b. a -> b -> b
HsOuterExplicit :: XHsOuterExplicit pass flag -> [LHsTyVarBndr flag (NoGhcTc pass)] -> HsOuterTyVarBndrs flag pass
[hso_xexplicit] :: HsOuterTyVarBndrs flag pass -> XHsOuterExplicit pass flag
[hso_bndrs] :: HsOuterTyVarBndrs flag pass -> [LHsTyVarBndr flag (NoGhcTc pass)]
XHsOuterTyVarBndrs :: !XXHsOuterTyVarBndrs pass -> HsOuterTyVarBndrs flag pass
-- | Used for type-family instance equations, e.g.,
--
--
-- type instance forall a. F [a] = Tree a
--
--
-- The notion of specificity is irrelevant in type family equations, so
-- we use () for the HsOuterTyVarBndrs flag.
type HsOuterFamEqnTyVarBndrs = HsOuterTyVarBndrs ()
-- | Used for signatures, e.g.,
--
--
-- f :: forall a {b}. blah
--
--
-- We use Specificity for the HsOuterTyVarBndrs
-- flag to allow distinguishing between specified and inferred
-- type variables.
type HsOuterSigTyVarBndrs = HsOuterTyVarBndrs Specificity
-- | Haskell Wildcard Binders
data HsWildCardBndrs pass thing
HsWC :: XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
[hswc_ext] :: HsWildCardBndrs pass thing -> XHsWC pass thing
[hswc_body] :: HsWildCardBndrs pass thing -> thing
XHsWildCardBndrs :: !XXHsWildCardBndrs pass thing -> HsWildCardBndrs pass thing
-- | Types that can appear in pattern signatures, as well as the signatures
-- for term-level binders in RULES. See Note [Pattern signature
-- binders and scoping].
--
-- This is very similar to HsSigWcType, but with slightly
-- different semantics: see Note [HsType binders]. See also
-- Note [The wildcard story for types].
data HsPatSigType pass
HsPS :: XHsPS pass -> LHsType pass -> HsPatSigType pass
-- | After renamer: HsPSRn
[hsps_ext] :: HsPatSigType pass -> XHsPS pass
-- | Main payload (the type itself)
[hsps_body] :: HsPatSigType pass -> LHsType pass
XHsPatSigType :: !XXHsPatSigType pass -> HsPatSigType pass
-- | The extension field for HsPatSigType, which is only used in the
-- renamer onwards. See Note [Pattern signature binders and
-- scoping].
data HsPSRn
HsPSRn :: [Name] -> [Name] -> HsPSRn
-- | Wildcard names
[hsps_nwcs] :: HsPSRn -> [Name]
-- | Implicitly bound variable names
[hsps_imp_tvs] :: HsPSRn -> [Name]
-- | A type signature that obeys the forall-or-nothing rule. In
-- other words, an LHsType that uses an
-- HsOuterSigTyVarBndrs to represent its outermost type variable
-- quantification. See Note [Representing type signatures].
data HsSigType pass
HsSig :: XHsSig pass -> HsOuterSigTyVarBndrs pass -> LHsType pass -> HsSigType pass
[sig_ext] :: HsSigType pass -> XHsSig pass
[sig_bndrs] :: HsSigType pass -> HsOuterSigTyVarBndrs pass
[sig_body] :: HsSigType pass -> LHsType pass
XHsSigType :: !XXHsSigType pass -> HsSigType pass
-- | Located Haskell Signature Type
type LHsSigType pass = XRec pass (HsSigType pass)
-- | Located Haskell Signature Wildcard Type
type LHsSigWcType pass = HsWildCardBndrs pass (LHsSigType pass)
-- | Located Haskell Wildcard Type
type LHsWcType pass = HsWildCardBndrs pass (LHsType pass)
-- | Haskell Tuple Sort
data HsTupleSort
HsUnboxedTuple :: HsTupleSort
HsBoxedOrConstraintTuple :: HsTupleSort
-- | Haskell Context
type HsContext pass = [LHsType pass]
-- | Located Haskell Context
type LHsContext pass = XRec pass (HsContext pass) " 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnUnit' For details on above see Note [exact print annotations] in GHC.Parser.Annotation"
fromMaybeContext :: Maybe (LHsContext (GhcPass p)) -> HsContext (GhcPass p)
-- | Haskell Type Literal
data HsTyLit
HsNumTy :: SourceText -> Integer -> HsTyLit
HsStrTy :: SourceText -> FastString -> HsTyLit
HsCharTy :: SourceText -> Char -> 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
data HsArg tm ty
HsValArg :: tm -> HsArg tm ty
HsTypeArg :: SrcSpan -> ty -> HsArg tm ty
HsArgPar :: SrcSpan -> HsArg tm ty
numVisibleArgs :: [HsArg tm ty] -> Arity
-- | pprHsArgsApp id fixity args pretty-prints an
-- application of id to args, using the fixity
-- to tell whether id should be printed prefix or infix.
-- Examples:
--
--
-- pprHsArgsApp T Prefix [HsTypeArg Bool, HsValArg Int] = T @Bool Int
-- pprHsArgsApp T Prefix [HsTypeArg Bool, HsArgPar, HsValArg Int] = (T @Bool) Int
-- pprHsArgsApp (++) Infix [HsValArg Char, HsValArg Double] = Char ++ Double
-- pprHsArgsApp (++) Infix [HsValArg Char, HsValArg Double, HsVarArg Ordering] = (Char ++ Double) Ordering
--
pprHsArgsApp :: (OutputableBndr id, Outputable tm, Outputable ty) => id -> LexicalFixity -> [HsArg tm ty] -> SDoc
type LHsTypeArg p = HsArg (LHsType p) (LHsKind p)
-- | Compute the SrcSpan associated with an LHsTypeArg.
lhsTypeArgSrcSpan :: LHsTypeArg (GhcPass pass) -> SrcSpan
class OutputableBndrFlag flag p
-- | Located Bang Type
type LBangType pass = XRec pass (BangType pass)
-- | Bang Type
--
-- In the parser, strictness and packedness annotations bind more tightly
-- than docstrings. This means that when consuming a BangType (and
-- looking for HsBangTy) we must be ready to peer behind a
-- potential layer of HsDocTy. See #15206 for motivation and
-- getBangType for an example.
type BangType pass = HsType pass
-- | 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, or one with an unlifted type
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 (GhcPass p) -> LHsType (GhcPass p)
getBangStrictness :: LHsType (GhcPass p) -> HsSrcBang
-- | Constructor Declaration Field
data ConDeclField pass
-- |
ConDeclField :: XConDeclField pass -> [LFieldOcc pass] -> LBangType pass -> Maybe (LHsDoc pass) -> ConDeclField pass
[cd_fld_ext] :: ConDeclField pass -> XConDeclField pass
-- | See Note [ConDeclField passs]
[cd_fld_names] :: ConDeclField pass -> [LFieldOcc pass]
[cd_fld_type] :: ConDeclField pass -> LBangType pass
[cd_fld_doc] :: ConDeclField pass -> Maybe (LHsDoc pass)
XConDeclField :: !XXConDeclField pass -> ConDeclField pass
-- | Located Constructor Declaration Field
type LConDeclField pass = XRec pass (ConDeclField pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when in a list"
pprConDeclFields :: OutputableBndrId p => [LConDeclField (GhcPass p)] -> SDoc
-- | Describes the arguments to a data constructor. This is a common
-- representation for several constructor-related concepts, including:
--
--
-- - The arguments in a Haskell98-style constructor declaration (see
-- HsConDeclH98Details in GHC.Hs.Decls).
-- - The arguments in constructor patterns in case/function
-- definitions (see HsConPatDetails in GHC.Hs.Pat).
-- - The left-hand side arguments in a pattern synonym binding (see
-- HsPatSynDetails in GHC.Hs.Binds).
--
--
-- One notable exception is the arguments in a GADT constructor, which
-- uses a separate data type entirely (see HsConDeclGADTDetails
-- in GHC.Hs.Decls). This is because GADT constructors cannot be
-- declared with infix syntax, unlike the concepts above (#18844).
data HsConDetails tyarg arg rec
PrefixCon :: [tyarg] -> [arg] -> HsConDetails tyarg arg rec
RecCon :: rec -> HsConDetails tyarg arg rec
InfixCon :: arg -> arg -> HsConDetails tyarg arg rec
-- | An empty list that can be used to indicate that there are no type
-- arguments allowed in cases where HsConDetails is applied to Void.
noTypeArgs :: [Void]
-- | Field Occurrence
--
-- Represents an *occurrence* of a field. This may or may not be a
-- binding occurrence (e.g. this type is used in ConDeclField and
-- RecordPatSynField which bind their fields, but also in
-- HsRecField for record construction and patterns, which do
-- not).
--
-- We store both the RdrName the user originally wrote, and after
-- the renamer we use the extension field to store the selector function.
data FieldOcc pass
FieldOcc :: XCFieldOcc pass -> XRec pass RdrName -> FieldOcc pass
[foExt] :: FieldOcc pass -> XCFieldOcc pass
[foLabel] :: FieldOcc pass -> XRec pass RdrName
XFieldOcc :: !XXFieldOcc pass -> FieldOcc pass
-- | Located Field Occurrence
type LFieldOcc pass = XRec pass (FieldOcc pass)
mkFieldOcc :: LocatedN RdrName -> FieldOcc GhcPs
-- | 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 GHC.Hs.Pat. See Note
-- [Located RdrNames] in GHC.Hs.Expr.
data AmbiguousFieldOcc pass
Unambiguous :: XUnambiguous pass -> LocatedN RdrName -> AmbiguousFieldOcc pass
Ambiguous :: XAmbiguous pass -> LocatedN RdrName -> AmbiguousFieldOcc pass
XAmbiguousFieldOcc :: !XXAmbiguousFieldOcc pass -> AmbiguousFieldOcc pass
-- | Located Ambiguous Field Occurence
type LAmbiguousFieldOcc pass = XRec pass (AmbiguousFieldOcc pass)
mkAmbiguousFieldOcc :: LocatedN RdrName -> AmbiguousFieldOcc GhcPs
rdrNameAmbiguousFieldOcc :: AmbiguousFieldOcc (GhcPass p) -> RdrName
selectorAmbiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> Id
unambiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> FieldOcc GhcTc
ambiguousFieldOcc :: FieldOcc GhcTc -> AmbiguousFieldOcc GhcTc
mkAnonWildCardTy :: HsType GhcPs
pprAnonWildCard :: SDoc
hsOuterTyVarNames :: HsOuterTyVarBndrs flag GhcRn -> [Name]
hsOuterExplicitBndrs :: HsOuterTyVarBndrs flag (GhcPass p) -> [LHsTyVarBndr flag (NoGhcTc (GhcPass p))]
mapHsOuterImplicit :: (XHsOuterImplicit pass -> XHsOuterImplicit pass) -> HsOuterTyVarBndrs flag pass -> HsOuterTyVarBndrs flag pass
mkHsOuterImplicit :: HsOuterTyVarBndrs flag GhcPs
mkHsOuterExplicit :: EpAnnForallTy -> [LHsTyVarBndr flag GhcPs] -> HsOuterTyVarBndrs flag GhcPs
mkHsImplicitSigType :: LHsType GhcPs -> HsSigType GhcPs
mkHsExplicitSigType :: EpAnnForallTy -> [LHsTyVarBndr Specificity GhcPs] -> LHsType GhcPs -> HsSigType GhcPs
mkHsWildCardBndrs :: thing -> HsWildCardBndrs GhcPs thing
mkHsPatSigType :: EpAnn EpaLocation -> LHsType GhcPs -> HsPatSigType GhcPs
mkEmptyWildCardBndrs :: thing -> HsWildCardBndrs GhcRn thing
mkHsForAllVisTele :: EpAnnForallTy -> [LHsTyVarBndr () (GhcPass p)] -> HsForAllTelescope (GhcPass p)
mkHsForAllInvisTele :: EpAnnForallTy -> [LHsTyVarBndr Specificity (GhcPass p)] -> HsForAllTelescope (GhcPass p)
mkHsQTvs :: [LHsTyVarBndr () GhcPs] -> LHsQTyVars GhcPs
hsQTvExplicit :: LHsQTyVars pass -> [LHsTyVarBndr () pass]
emptyLHsQTvs :: LHsQTyVars GhcRn
-- | Does this HsTyVarBndr come with an explicit kind annotation?
isHsKindedTyVar :: HsTyVarBndr flag pass -> Bool
-- | Do all type variables in this LHsQTyVars come with kind
-- annotations?
hsTvbAllKinded :: LHsQTyVars (GhcPass p) -> Bool
hsScopedTvs :: LHsSigType GhcRn -> [Name]
hsWcScopedTvs :: LHsSigWcType GhcRn -> [Name]
dropWildCards :: LHsSigWcType pass -> LHsSigType pass
hsTyVarName :: HsTyVarBndr flag (GhcPass p) -> IdP (GhcPass p)
hsAllLTyVarNames :: LHsQTyVars GhcRn -> [Name]
hsLTyVarLocNames :: LHsQTyVars (GhcPass p) -> [LocatedN (IdP (GhcPass p))]
hsLTyVarName :: LHsTyVarBndr flag (GhcPass p) -> IdP (GhcPass p)
hsLTyVarNames :: [LHsTyVarBndr flag (GhcPass p)] -> [IdP (GhcPass p)]
hsLTyVarLocName :: LHsTyVarBndr flag (GhcPass p) -> LocatedN (IdP (GhcPass p))
hsExplicitLTyVarNames :: LHsQTyVars (GhcPass p) -> [IdP (GhcPass p)]
-- | Decompose a type class instance type (of the form forall
-- tvs. context => instance_head) into its constituent
-- parts. Note that the [Name]s returned correspond to either:
--
--
-- - The implicitly bound type variables (if the type lacks an
-- outermost forall), or
-- - The explicitly bound type variables (if the type has an outermost
-- forall).
--
--
-- This function is careful not to look through parentheses. See Note
-- [No nested foralls or contexts in instance types] for why this is
-- important.
splitLHsInstDeclTy :: LHsSigType GhcRn -> ([Name], Maybe (LHsContext GhcRn), LHsType GhcRn)
-- | Decompose a type class instance type (of the form forall
-- tvs. context => instance_head) into the
-- instance_head.
getLHsInstDeclHead :: LHsSigType (GhcPass p) -> LHsType (GhcPass p)
-- | Decompose a type class instance type (of the form forall
-- tvs. context => instance_head) into the
-- instance_head and retrieve the underlying class type
-- constructor (if it exists).
getLHsInstDeclClass_maybe :: Anno (IdGhcP p) ~ SrcSpanAnnN => LHsSigType (GhcPass p) -> Maybe (LocatedN (IdP (GhcPass p)))
-- | Decompose a pattern synonym type signature into its constituent parts.
--
-- Note that this function looks through parentheses, so it will work on
-- types such as (forall a. ...). The downside to this is
-- that it is not generally possible to take the returned types and
-- reconstruct the original type (parentheses and all) from them.
splitLHsPatSynTy :: LHsSigType (GhcPass p) -> ([LHsTyVarBndr Specificity (GhcPass (NoGhcTcPass p))], Maybe (LHsContext (GhcPass p)), [LHsTyVarBndr Specificity (GhcPass p)], Maybe (LHsContext (GhcPass p)), LHsType (GhcPass p))
-- | Decompose a type of the form forall tvs. body into its
-- constituent parts. Only splits type variable binders that were
-- quantified invisibly (e.g., forall a., with a dot).
--
-- This function is used to split apart certain types, such as instance
-- declaration types, which disallow visible foralls. For
-- instance, if GHC split apart the forall in instance
-- forall a -> Show (Blah a), then that declaration would
-- mistakenly be accepted!
--
-- Note that this function looks through parentheses, so it will work on
-- types such as (forall a. ...). The downside to this is
-- that it is not generally possible to take the returned types and
-- reconstruct the original type (parentheses and all) from them. Unlike
-- splitLHsSigmaTyInvis, this function does not look through
-- parentheses, hence the suffix _KP (short for "Keep
-- Parentheses").
splitLHsForAllTyInvis :: LHsType (GhcPass pass) -> ((EpAnnForallTy, [LHsTyVarBndr Specificity (GhcPass pass)]), LHsType (GhcPass pass))
-- | Decompose a type of the form forall tvs. body into its
-- constituent parts. Only splits type variable binders that were
-- quantified invisibly (e.g., forall a., with a dot).
--
-- This function is used to split apart certain types, such as instance
-- declaration types, which disallow visible foralls. For
-- instance, if GHC split apart the forall in instance
-- forall a -> Show (Blah a), then that declaration would
-- mistakenly be accepted!
--
-- Unlike splitLHsForAllTyInvis, this function does not look
-- through parentheses, hence the suffix _KP (short for "Keep
-- Parentheses").
splitLHsForAllTyInvis_KP :: LHsType (GhcPass pass) -> (Maybe (EpAnnForallTy, [LHsTyVarBndr Specificity (GhcPass pass)]), LHsType (GhcPass pass))
-- | Decompose a type of the form context => body into its
-- constituent parts.
--
-- Note that this function looks through parentheses, so it will work on
-- types such as (context => ...). The downside to
-- this is that it is not generally possible to take the returned types
-- and reconstruct the original type (parentheses and all) from them.
splitLHsQualTy :: LHsType (GhcPass pass) -> (Maybe (LHsContext (GhcPass pass)), LHsType (GhcPass pass))
-- | Decompose a sigma type (of the form forall tvs. context
-- => body) into its constituent parts. Only splits type variable
-- binders that were quantified invisibly (e.g., forall a., with
-- a dot).
--
-- This function is used to split apart certain types, such as instance
-- declaration types, which disallow visible foralls. For
-- instance, if GHC split apart the forall in instance
-- forall a -> Show (Blah a), then that declaration would
-- mistakenly be accepted!
--
-- Note that this function looks through parentheses, so it will work on
-- types such as (forall a. ...). The downside to this is
-- that it is not generally possible to take the returned types and
-- reconstruct the original type (parentheses and all) from them.
splitLHsSigmaTyInvis :: LHsType (GhcPass p) -> ([LHsTyVarBndr Specificity (GhcPass p)], Maybe (LHsContext (GhcPass p)), LHsType (GhcPass p))
-- | Decompose a GADT type into its constituent parts. Returns
-- (outer_bndrs, mb_ctxt, body), where:
--
--
-- - outer_bndrs are HsOuterExplicit if the type has
-- explicit, outermost type variable binders. Otherwise, they are
-- HsOuterImplicit.
-- - mb_ctxt is Just the context, if it is provided.
-- Otherwise, it is Nothing.
-- - body is the body of the type after the optional
-- foralls and context.
--
--
-- This function is careful not to look through parentheses. See Note
-- [GADT abstract syntax] (Wrinkle: No nested foralls or contexts)
-- GHC.Hs.Decls for why this is important.
splitLHsGadtTy :: LHsSigType GhcPs -> (HsOuterSigTyVarBndrs GhcPs, Maybe (LHsContext GhcPs), LHsType GhcPs)
splitHsFunType :: LHsType (GhcPass p) -> ([AddEpAnn], EpAnnComments, [HsScaled (GhcPass p) (LHsType (GhcPass p))], LHsType (GhcPass p))
-- | Retrieve the name of the "head" of a nested type application. This is
-- somewhat like GHC.Tc.Gen.HsType.splitHsAppTys, but a little
-- more thorough. The purpose of this function is to examine instance
-- heads, so it doesn't handle *all* cases (like lists, tuples,
-- (~), etc.).
hsTyGetAppHead_maybe :: Anno (IdGhcP p) ~ SrcSpanAnnN => LHsType (GhcPass p) -> Maybe (LocatedN (IdP (GhcPass p)))
mkHsOpTy :: Anno (IdGhcP p) ~ SrcSpanAnnN => LHsType (GhcPass p) -> LocatedN (IdP (GhcPass p)) -> LHsType (GhcPass p) -> HsType (GhcPass p)
mkHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
mkHsAppTys :: LHsType (GhcPass p) -> [LHsType (GhcPass p)] -> LHsType (GhcPass p)
mkHsAppKindTy :: XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
ignoreParens :: LHsType (GhcPass p) -> LHsType (GhcPass p)
hsSigWcType :: forall p. UnXRec p => LHsSigWcType p -> LHsType p
hsPatSigType :: HsPatSigType pass -> LHsType pass
-- | Get the kind signature of a type, ignoring parentheses:
--
-- hsTyKindSig `Maybe ` = Nothing hsTyKindSig `Maybe :: Type -> Type `
-- = Just `Type -> Type` hsTyKindSig `Maybe :: ((Type -> Type))` =
-- Just `Type -> Type`
--
-- This is used to extract the result kind of type synonyms with a CUSK:
--
-- type S = (F :: res_kind) ^^^^^^^^
hsTyKindSig :: LHsType (GhcPass p) -> Maybe (LHsKind (GhcPass p))
-- | Set the attached flag
setHsTyVarBndrFlag :: flag -> HsTyVarBndr flag' (GhcPass pass) -> HsTyVarBndr flag (GhcPass pass)
-- | Return the attached flag
hsTyVarBndrFlag :: HsTyVarBndr flag (GhcPass pass) -> flag
pprHsType :: OutputableBndrId p => HsType (GhcPass p) -> SDoc
-- | Prints a forall; When passed an empty list, prints forall
-- ./forall -> only when -dppr-debug is
-- enabled.
pprHsForAll :: forall p. OutputableBndrId p => HsForAllTelescope (GhcPass p) -> Maybe (LHsContext (GhcPass p)) -> SDoc
-- | Prints the explicit forall in a type family equation if one
-- is written. If there is no explicit forall, nothing is
-- printed.
pprHsOuterFamEqnTyVarBndrs :: OutputableBndrId p => HsOuterFamEqnTyVarBndrs (GhcPass p) -> SDoc
-- | Prints the outermost forall in a type signature if one is
-- written. If there is no outermost forall, nothing is printed.
pprHsOuterSigTyVarBndrs :: OutputableBndrId p => HsOuterSigTyVarBndrs (GhcPass p) -> SDoc
pprLHsContext :: OutputableBndrId p => Maybe (LHsContext (GhcPass p)) -> SDoc
-- | hsTypeNeedsParens p t returns True if the type
-- t needs parentheses under precedence p.
hsTypeNeedsParens :: PprPrec -> HsType (GhcPass p) -> Bool
-- | parenthesizeHsType p ty checks if
-- hsTypeNeedsParens p ty is true, and if so, surrounds
-- ty with an HsParTy. Otherwise, it simply returns
-- ty.
parenthesizeHsType :: PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
-- | parenthesizeHsContext p ctxt checks if ctxt
-- is a single constraint c such that
-- hsTypeNeedsParens p c is true, and if so, surrounds
-- c with an HsParTy to form a parenthesized
-- ctxt. Otherwise, it simply returns ctxt unchanged.
parenthesizeHsContext :: PprPrec -> LHsContext (GhcPass p) -> LHsContext (GhcPass p)
instance GHC.Hs.Type.OutputableBndrFlag () p
instance GHC.Hs.Type.OutputableBndrFlag GHC.Types.Var.Specificity p
instance (GHC.Hs.Type.OutputableBndrFlag flag p, GHC.Hs.Type.OutputableBndrFlag flag (GHC.Hs.Extension.NoGhcTcPass p), GHC.Hs.Extension.OutputableBndrId p) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsOuterTyVarBndrs flag (GHC.Hs.Extension.GhcPass p))
instance (GHC.Hs.Extension.OutputableBndrId p, GHC.Hs.Type.OutputableBndrFlag flag p) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsTyVarBndr flag (GHC.Hs.Extension.GhcPass p))
instance GHC.Types.Name.NamedThing (Language.Haskell.Syntax.Type.HsTyVarBndr flag GHC.Hs.Extension.GhcRn)
instance GHC.Hs.Extension.OutputableBndrId pass => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsArrow (GHC.Hs.Extension.GhcPass pass))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.ConDeclField (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.AmbiguousFieldOcc (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.OutputableBndr (Language.Haskell.Syntax.Type.AmbiguousFieldOcc (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.OutputableBndr (GHC.Types.SrcLoc.Located (Language.Haskell.Syntax.Type.AmbiguousFieldOcc (GHC.Hs.Extension.GhcPass p)))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsSigType (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsType (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.LHsQTyVars (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsForAllTelescope (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.Outputable thing => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsWildCardBndrs (GHC.Hs.Extension.GhcPass p) thing)
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Type.HsPatSigType (GHC.Hs.Extension.GhcPass p))
-- | Source-language literals
module GHC.Hs.Lit
data OverLitTc
OverLitTc :: Bool -> HsExpr GhcTc -> Type -> OverLitTc
[$sel:ol_rebindable:OverLitTc] :: OverLitTc -> Bool
[$sel:ol_witness:OverLitTc] :: OverLitTc -> HsExpr GhcTc
[$sel:ol_type:OverLitTc] :: OverLitTc -> Type
data OverLitRn
OverLitRn :: Bool -> LIdP GhcRn -> OverLitRn
[$sel:ol_rebindable:OverLitRn] :: OverLitRn -> Bool
[$sel:ol_from_fun:OverLitRn] :: OverLitRn -> LIdP GhcRn
pprXOverLit :: GhcPass p -> XOverLit (GhcPass p) -> SDoc
overLitType :: HsOverLit GhcTc -> Type
-- | Convert a literal from one index type to another
convertLit :: HsLit (GhcPass p1) -> HsLit (GhcPass p2)
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 (GhcPass x) -> SDoc
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Lit.HsLit (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Lit.HsOverLit (GHC.Hs.Extension.GhcPass p))
module GHC.Hs.Binds
-- | Type checker Specification Pragma
data TcSpecPrag
-- | The Id to be specialised, a wrapper that specialises the polymorphic
-- function, and inlining spec for the specialised function
SpecPrag :: Id -> HsWrapper -> InlinePragma -> TcSpecPrag
-- | Located Type checker Specification Pragmas
type LTcSpecPrag = Located TcSpecPrag
-- | 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
data AnnSig
AnnSig :: AddEpAnn -> [AddEpAnn] -> AnnSig
[asDcolon] :: AnnSig -> AddEpAnn
[asRest] :: AnnSig -> [AddEpAnn]
-- | Abstraction Bindings Export
data ABExport
ABE :: Id -> Id -> HsWrapper -> TcSpecPrags -> ABExport
-- | Any INLINE pragma is attached to this Id
[abe_poly] :: ABExport -> Id
[abe_mono] :: ABExport -> Id
-- | See Note [ABExport wrapper] Shape: (forall abs_tvs. abs_ev_vars =>
-- abe_mono) ~ abe_poly
[abe_wrap] :: ABExport -> HsWrapper
-- | SPECIALISE pragmas
[abe_prags] :: ABExport -> TcSpecPrags
-- | Typechecked, generalised bindings, used in the output to the type
-- checker. See Note [AbsBinds].
data AbsBinds
AbsBinds :: [TyVar] -> [EvVar] -> [ABExport] -> [TcEvBinds] -> LHsBinds GhcTc -> Bool -> AbsBinds
[abs_tvs] :: AbsBinds -> [TyVar]
-- | Includes equality constraints
[abs_ev_vars] :: AbsBinds -> [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] :: AbsBinds -> [ABExport]
-- | Evidence bindings Why a list? See GHC.Tc.TyCl.Instance Note
-- [Typechecking plan for instance declarations]
[abs_ev_binds] :: AbsBinds -> [TcEvBinds]
-- | Typechecked user bindings
[abs_binds] :: AbsBinds -> LHsBinds GhcTc
[abs_sig] :: AbsBinds -> Bool
data NHsValBindsLR idL
NValBinds :: [(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL
pprLHsBinds :: (OutputableBndrId idL, OutputableBndrId idR) => LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
pprLHsBindsForUser :: (OutputableBndrId idL, OutputableBndrId idR, OutputableBndrId id2) => LHsBindsLR (GhcPass idL) (GhcPass idR) -> [LSig (GhcPass id2)] -> [SDoc]
pprDeclList :: [SDoc] -> SDoc
emptyLocalBinds :: HsLocalBindsLR (GhcPass a) (GhcPass b)
eqEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
isEmptyValBinds :: HsValBindsLR (GhcPass a) (GhcPass b) -> Bool
emptyValBindsIn :: HsValBindsLR (GhcPass a) (GhcPass b)
emptyValBindsOut :: HsValBindsLR (GhcPass a) (GhcPass b)
emptyLHsBinds :: LHsBindsLR (GhcPass idL) idR
isEmptyLHsBinds :: LHsBindsLR (GhcPass idL) idR -> Bool
plusHsValBinds :: HsValBinds (GhcPass a) -> HsValBinds (GhcPass a) -> HsValBinds (GhcPass a)
ppr_monobind :: forall idL idR. (OutputableBndrId idL, OutputableBndrId idR) => HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc
pprTicks :: SDoc -> SDoc -> SDoc
isEmptyIPBindsPR :: HsIPBinds (GhcPass p) -> Bool
isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool
noSpecPrags :: TcSpecPrags
hasSpecPrags :: TcSpecPrags -> Bool
isDefaultMethod :: TcSpecPrags -> Bool
ppr_sig :: forall p. OutputableBndrId p => Sig (GhcPass p) -> 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 (GenLocated l name) -> SDoc
instance Data.Data.Data GHC.Hs.Binds.AnnSig
instance Data.Data.Data GHC.Hs.Binds.TcSpecPrag
instance Data.Data.Data GHC.Hs.Binds.TcSpecPrags
instance GHC.Utils.Outputable.Outputable GHC.Hs.Binds.ABExport
instance GHC.Utils.Outputable.Outputable GHC.Hs.Binds.TcSpecPrag
instance (GHC.Hs.Extension.OutputableBndrId pl, GHC.Hs.Extension.OutputableBndrId pr) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.HsValBindsLR (GHC.Hs.Extension.GhcPass pl) (GHC.Hs.Extension.GhcPass pr))
instance (GHC.Hs.Extension.OutputableBndrId pl, GHC.Hs.Extension.OutputableBndrId pr) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.HsLocalBindsLR (GHC.Hs.Extension.GhcPass pl) (GHC.Hs.Extension.GhcPass pr))
instance (GHC.Hs.Extension.OutputableBndrId pl, GHC.Hs.Extension.OutputableBndrId pr) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.HsBindLR (GHC.Hs.Extension.GhcPass pl) (GHC.Hs.Extension.GhcPass pr))
instance (GHC.Hs.Extension.OutputableBndrId l, GHC.Hs.Extension.OutputableBndrId r) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.PatSynBind (GHC.Hs.Extension.GhcPass l) (GHC.Hs.Extension.GhcPass r))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.HsIPBinds (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.IPBind (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.Sig (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Binds.FixitySig (GHC.Hs.Extension.GhcPass p))
module GHC.Hs.Pat
-- | Pattern
--
--
data Pat p
-- | Wildcard Pattern The sole reason for a type on a WildPat is to support
-- hsPatType :: Pat Id -> Type
WildPat :: XWildPat p -> Pat p
-- | Variable Pattern
VarPat :: XVarPat p -> LIdP p -> Pat p
-- | Lazy Pattern ^ - AnnKeywordId : AnnTilde
LazyPat :: XLazyPat p -> LPat p -> Pat p
-- | As pattern ^ - AnnKeywordId : AnnAt
AsPat :: XAsPat p -> LIdP p -> LPat p -> Pat p
ParPat :: XParPat p -> !LHsToken "(" p -> LPat p -> !LHsToken ")" p -> Pat p
-- | Bang pattern ^ - AnnKeywordId : AnnBang
BangPat :: XBangPat p -> LPat p -> Pat p
-- | Syntactic List
--
--
ListPat :: XListPat p -> [LPat p] -> Pat p
-- | Tuple sub-patterns
--
--
TuplePat :: XTuplePat p -> [LPat p] -> Boxity -> Pat p
-- | Anonymous sum pattern
--
--
SumPat :: XSumPat p -> LPat p -> ConTag -> Arity -> Pat p
-- | Constructor Pattern
ConPat :: XConPat p -> XRec p (ConLikeP p) -> HsConPatDetails p -> Pat p
[pat_con_ext] :: Pat p -> XConPat p
[pat_con] :: Pat p -> XRec p (ConLikeP p)
[pat_args] :: Pat p -> HsConPatDetails p
-- | View Pattern
ViewPat :: XViewPat p -> LHsExpr p -> LPat p -> Pat p
-- | Splice Pattern (Includes quasi-quotes)
SplicePat :: XSplicePat p -> HsSplice p -> Pat p
-- | Literal Pattern Used for *non-overloaded* literal patterns: Int, Int,
-- Char, String, etc.
LitPat :: XLitPat p -> HsLit p -> Pat p
-- | Natural Pattern
--
--
NPat :: XNPat p -> XRec p (HsOverLit p) -> Maybe (SyntaxExpr p) -> SyntaxExpr p -> Pat p
-- | n+k pattern
NPlusKPat :: XNPlusKPat p -> LIdP p -> XRec p (HsOverLit p) -> HsOverLit p -> SyntaxExpr p -> SyntaxExpr p -> Pat p
-- | Pattern with a type signature
SigPat :: XSigPat p -> LPat p -> HsPatSigType (NoGhcTc p) -> Pat p
XPat :: !XXPat p -> Pat p
type LPat p = XRec p (Pat p)
data EpAnnSumPat
EpAnnSumPat :: [AddEpAnn] -> [EpaLocation] -> [EpaLocation] -> EpAnnSumPat
[sumPatParens] :: EpAnnSumPat -> [AddEpAnn]
[sumPatVbarsBefore] :: EpAnnSumPat -> [EpaLocation]
[sumPatVbarsAfter] :: EpAnnSumPat -> [EpaLocation]
-- | This is the extension field for ConPat, added after typechecking It
-- adds quite a few extra fields, to support elaboration of pattern
-- matching.
data ConPatTc
ConPatTc :: [Type] -> [TyVar] -> [EvVar] -> TcEvBinds -> HsWrapper -> ConPatTc
-- | The universal arg types 1-1 with the universal tyvars of the
-- constructor/pattern synonym Use (conLikeResTy pat_con cpt_arg_tys) to
-- get the type of the pattern
[cpt_arg_tys] :: ConPatTc -> [Type]
-- | Existentially bound type variables in correctly-scoped order e.g. [k:*
-- x:k]
[cpt_tvs] :: ConPatTc -> [TyVar]
-- | Ditto *coercion variables* and *dictionaries* One reason for putting
-- coercion variable here I think is to ensure their kinds are zonked
[cpt_dicts] :: ConPatTc -> [EvVar]
-- | Bindings involving those dictionaries
[cpt_binds] :: ConPatTc -> TcEvBinds
-- | Extra wrapper to pass to the matcher Only relevant for
-- pattern-synonyms; ignored for data cons
[cpt_wrap] :: ConPatTc -> HsWrapper
type family ConLikeP x
data HsPatExpansion a b
HsPatExpanded :: a -> b -> HsPatExpansion a b
-- | Extension constructor for Pat, added after typechecking.
data XXPatGhcTc
-- | Coercion Pattern (translation only)
--
-- During desugaring a (CoPat co pat) turns into a cast with co
-- on the scrutinee, followed by a match on pat.
CoPat :: HsWrapper -> Pat GhcTc -> Type -> XXPatGhcTc
-- | Coercion Pattern If co :: t1 ~ t2, p :: t2, then (CoPat co p) :: t1
[co_cpt_wrap] :: XXPatGhcTc -> HsWrapper
-- | Why not LPat? Ans: existing locn will do
[co_pat_inner] :: XXPatGhcTc -> Pat GhcTc
-- | Type of whole pattern, t1
[co_pat_ty] :: XXPatGhcTc -> Type
-- | Pattern expansion: original pattern, and desugared pattern, for
-- RebindableSyntax and other overloaded syntax such as OverloadedLists.
-- See Note [Rebindable syntax and HsExpansion].
ExpansionPat :: Pat GhcRn -> Pat GhcTc -> XXPatGhcTc
-- | Haskell Constructor Pattern Details
type HsConPatDetails p = HsConDetails (HsPatSigType (NoGhcTc p)) (LPat p) (HsRecFields p (LPat p))
hsConPatArgs :: forall p. UnXRec p => HsConPatDetails p -> [LPat p]
-- | Haskell Record Fields
--
-- HsRecFields is used only for patterns and expressions (not data type
-- declarations)
data HsRecFields p arg
HsRecFields :: [LHsRecField p arg] -> Maybe (Located Int) -> HsRecFields p arg
[rec_flds] :: HsRecFields p arg -> [LHsRecField p arg]
[rec_dotdot] :: HsRecFields p arg -> Maybe (Located Int)
-- | Haskell Field Binding
--
--
--
-- For details on above see Note [exact print annotations] in
-- GHC.Parser.Annotation
data HsFieldBind lhs rhs
HsFieldBind :: XHsFieldBind lhs -> lhs -> rhs -> Bool -> HsFieldBind lhs rhs
[hfbAnn] :: HsFieldBind lhs rhs -> XHsFieldBind lhs
[hfbLHS] :: HsFieldBind lhs rhs -> lhs
-- | Filled in by renamer when punning
[hfbRHS] :: HsFieldBind lhs rhs -> rhs
-- | Note [Punning]
[hfbPun] :: HsFieldBind lhs rhs -> Bool
-- | Located Haskell Record Field
type LHsFieldBind p id arg = XRec p (HsFieldBind id arg)
-- | Haskell Record Field
type HsRecField p arg = HsFieldBind (LFieldOcc p) arg
-- | Located Haskell Record Field
type LHsRecField p arg = XRec p (HsRecField p arg)
-- | Haskell Record Update Field
type HsRecUpdField p = HsFieldBind (LAmbiguousFieldOcc p) (LHsExpr p)
-- | Located Haskell Record Update Field
type LHsRecUpdField p = XRec p (HsRecUpdField p)
hsRecFields :: forall p arg. UnXRec p => HsRecFields p arg -> [XCFieldOcc p]
hsRecFieldSel :: forall p arg. UnXRec p => HsRecField p arg -> XCFieldOcc p
hsRecFieldId :: HsRecField GhcTc arg -> Id
hsRecFieldsArgs :: forall p arg. UnXRec p => HsRecFields p arg -> [arg]
hsRecUpdFieldId :: HsFieldBind (LAmbiguousFieldOcc GhcTc) arg -> Located Id
hsRecUpdFieldOcc :: HsFieldBind (LAmbiguousFieldOcc GhcTc) arg -> LFieldOcc GhcTc
hsRecUpdFieldRdr :: HsRecUpdField (GhcPass p) -> Located RdrName
mkPrefixConPat :: DataCon -> [LPat GhcTc] -> [Type] -> LPat GhcTc
mkCharLitPat :: SourceText -> Char -> LPat GhcTc
mkNilPat :: Type -> LPat GhcTc
-- | Is the pattern any of combination of:
--
--
-- - (pat)
-- - pat :: Type
-- - ~pat
-- - !pat
-- - x (variable)
--
isSimplePat :: LPat (GhcPass x) -> Maybe (IdP (GhcPass x))
looksLazyPatBind :: HsBind GhcTc -> Bool
isBangedLPat :: LPat (GhcPass p) -> Bool
-- | Parenthesize a pattern without token information
gParPat :: LPat (GhcPass pass) -> Pat (GhcPass pass)
-- | patNeedsParens p pat returns True if the
-- pattern pat needs parentheses under precedence p.
patNeedsParens :: forall p. IsPass p => PprPrec -> Pat (GhcPass p) -> Bool
-- | parenthesizePat p pat checks if
-- patNeedsParens p pat is true, and if so, surrounds
-- pat with a ParPat. Otherwise, it simply returns
-- pat.
parenthesizePat :: IsPass p => PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
isIrrefutableHsPat :: forall p. OutputableBndrId p => DynFlags -> LPat (GhcPass p) -> Bool
collectEvVarsPat :: Pat GhcTc -> Bag EvVar
collectEvVarsPats :: [Pat GhcTc] -> Bag EvVar
pprParendLPat :: OutputableBndrId p => PprPrec -> LPat (GhcPass p) -> SDoc
pprConArgs :: (OutputableBndrId p, Outputable (Anno (IdGhcP p))) => HsConPatDetails (GhcPass p) -> SDoc
pprLPat :: OutputableBndrId p => LPat (GhcPass p) -> SDoc
instance Data.Data.Data GHC.Hs.Pat.EpAnnSumPat
instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (GHC.Hs.Pat.HsPatExpansion a b)
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b) => GHC.Utils.Outputable.Outputable (GHC.Hs.Pat.HsPatExpansion a b)
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Pat.Pat (GHC.Hs.Extension.GhcPass p))
module GHC.Parser.Types
data SumOrTuple b
-- | Last two are the locations of the '|' before and after the payload
Sum :: ConTag -> Arity -> LocatedA b -> [EpaLocation] -> [EpaLocation] -> SumOrTuple b
Tuple :: [Either (EpAnn EpaLocation) (LocatedA b)] -> SumOrTuple b
pprSumOrTuple :: Outputable b => Boxity -> SumOrTuple b -> SDoc
-- | See Note [Ambiguous syntactic categories] and Note [PatBuilder]
data PatBuilder p
PatBuilderPat :: Pat p -> PatBuilder p
PatBuilderPar :: LHsToken "(" p -> LocatedA (PatBuilder p) -> LHsToken ")" p -> PatBuilder p
PatBuilderApp :: LocatedA (PatBuilder p) -> LocatedA (PatBuilder p) -> PatBuilder p
PatBuilderAppType :: LocatedA (PatBuilder p) -> HsPatSigType GhcPs -> PatBuilder p
PatBuilderOpApp :: LocatedA (PatBuilder p) -> LocatedN RdrName -> LocatedA (PatBuilder p) -> EpAnn [AddEpAnn] -> PatBuilder p
PatBuilderVar :: LocatedN RdrName -> PatBuilder p
PatBuilderOverLit :: HsOverLit GhcPs -> PatBuilder p
-- | An accumulator to build a prefix data constructor, e.g. when parsing
-- MkT A B C, the accumulator will evolve as follows:
--
--
-- 1. PrefixDataConBuilder [] MkT
-- 2. PrefixDataConBuilder [A] MkT
-- 3. PrefixDataConBuilder [A, B] MkT
-- 4. PrefixDataConBuilder [A, B, C] MkT
--
--
--
-- There are two reasons we have a separate builder type instead of using
-- HsConDeclDetails GhcPs directly:
--
--
-- - It's faster, because OrdList gives us constant-time
-- snoc.
-- - Having a separate type helps ensure that we don't forget to
-- finalize a RecTy into a RecCon (we do that in
-- dataConBuilderDetails).
--
--
-- See Note [PatBuilder] for another builder type used in the parser.
-- Here the technique is similar, but the motivation is different.
data DataConBuilder
PrefixDataConBuilder :: OrdList (LHsType GhcPs) -> LocatedN RdrName -> DataConBuilder
InfixDataConBuilder :: LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> DataConBuilder
instance GHC.Utils.Outputable.Outputable GHC.Parser.Types.DataConBuilder
instance GHC.Utils.Outputable.Outputable (GHC.Parser.Types.PatBuilder GHC.Hs.Extension.GhcPs)
-- | Abstract syntax of global declarations.
--
-- Definitions for: SynDecl and ConDecl,
-- ClassDecl, InstDecl, DefaultDecl and
-- ForeignDecl.
module GHC.Hs.Decls
-- | A Haskell Declaration
data HsDecl p
-- | Type or Class Declaration
TyClD :: XTyClD p -> TyClDecl p -> HsDecl p
-- | Instance declaration
InstD :: XInstD p -> InstDecl p -> HsDecl p
-- | Deriving declaration
DerivD :: XDerivD p -> DerivDecl p -> HsDecl p
-- | Value declaration
ValD :: XValD p -> HsBind p -> HsDecl p
-- | Signature declaration
SigD :: XSigD p -> Sig p -> HsDecl p
-- | Standalone kind signature
KindSigD :: XKindSigD p -> StandaloneKindSig p -> HsDecl p
-- | 'default' declaration
DefD :: XDefD p -> DefaultDecl p -> HsDecl p
-- | Foreign declaration
ForD :: XForD p -> ForeignDecl p -> HsDecl p
-- | Warning declaration
WarningD :: XWarningD p -> WarnDecls p -> HsDecl p
-- | Annotation declaration
AnnD :: XAnnD p -> AnnDecl p -> HsDecl p
-- | Rule declaration
RuleD :: XRuleD p -> RuleDecls p -> HsDecl p
-- | Splice declaration (Includes quasi-quotes)
SpliceD :: XSpliceD p -> SpliceDecl p -> HsDecl p
-- | Documentation comment declaration
DocD :: XDocD p -> DocDecl p -> HsDecl p
-- | Role annotation declaration
RoleAnnotD :: XRoleAnnotD p -> RoleAnnotDecl p -> HsDecl p
XHsDecl :: !XXHsDecl p -> HsDecl p
type LHsDecl p = XRec p (HsDecl p) " When in a list this may have - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' "
-- | Haskell Data type Definition
data HsDataDefn pass
-- | Declares a data type or newtype, giving its constructors
-- data/newtype T a = constrs data/newtype instance T [a] =
-- constrs
HsDataDefn :: XCHsDataDefn pass -> NewOrData -> Maybe (LHsContext pass) -> Maybe (XRec pass CType) -> Maybe (LHsKind pass) -> [LConDecl pass] -> HsDeriving pass -> HsDataDefn pass
[dd_ext] :: HsDataDefn pass -> XCHsDataDefn pass
[dd_ND] :: HsDataDefn pass -> NewOrData
-- | Context
[dd_ctxt] :: HsDataDefn pass -> Maybe (LHsContext pass)
[dd_cType] :: HsDataDefn pass -> Maybe (XRec pass 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 pass -> Maybe (LHsKind pass)
-- | 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 pass -> [LConDecl pass]
-- | Optional 'deriving' clause
[dd_derivs] :: HsDataDefn pass -> HsDeriving pass
XHsDataDefn :: !XXHsDataDefn pass -> HsDataDefn pass
-- | Haskell Deriving clause
type HsDeriving pass = [LHsDerivingClause pass] " 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."
type LHsFunDep pass = XRec pass (FunDep pass)
-- | A single deriving clause of a data declaration.
--
--
data HsDerivingClause pass
HsDerivingClause :: XCHsDerivingClause pass -> Maybe (LDerivStrategy pass) -> LDerivClauseTys pass -> HsDerivingClause pass
[deriv_clause_ext] :: HsDerivingClause pass -> XCHsDerivingClause pass
-- | The user-specified strategy (if any) to use when deriving
-- deriv_clause_tys.
[deriv_clause_strategy] :: HsDerivingClause pass -> Maybe (LDerivStrategy pass)
-- | The types to derive.
[deriv_clause_tys] :: HsDerivingClause pass -> LDerivClauseTys pass
XHsDerivingClause :: !XXHsDerivingClause pass -> HsDerivingClause pass
type LHsDerivingClause pass = XRec pass (HsDerivingClause pass)
-- | The types mentioned in a single deriving clause. This can
-- come in two forms, DctSingle or DctMulti, depending on
-- whether the types are surrounded by enclosing parentheses or not.
-- These parentheses are semantically different than HsParTy. For
-- example, deriving () means "derive zero classes" rather than
-- "derive an instance of the 0-tuple".
--
-- DerivClauseTys use LHsSigType because deriving
-- clauses 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).
data DerivClauseTys pass
-- | A deriving clause with a single type. Moreover, that type can
-- only be a type constructor without any arguments.
--
-- Example: deriving Eq
DctSingle :: XDctSingle pass -> LHsSigType pass -> DerivClauseTys pass
-- | A deriving clause with a comma-separated list of types,
-- surrounded by enclosing parentheses.
--
-- Example: deriving (Eq, C a)
DctMulti :: XDctMulti pass -> [LHsSigType pass] -> DerivClauseTys pass
XDerivClauseTys :: !XXDerivClauseTys pass -> DerivClauseTys pass
type LDerivClauseTys pass = XRec pass (DerivClauseTys pass)
data NewOrData
-- |
-- newtype Blah ...
--
NewType :: NewOrData
-- |
-- data Blah ...
--
DataType :: NewOrData
-- | Convert a NewOrData to a TyConFlavour
newOrDataToFlavour :: NewOrData -> TyConFlavour
data StandaloneKindSig pass
StandaloneKindSig :: XStandaloneKindSig pass -> LIdP pass -> LHsSigType pass -> StandaloneKindSig pass
XStandaloneKindSig :: !XXStandaloneKindSig pass -> StandaloneKindSig pass
-- | Located Standalone Kind Signature
type LStandaloneKindSig pass = XRec pass (StandaloneKindSig pass)
standaloneKindSigName :: StandaloneKindSig (GhcPass p) -> IdP (GhcPass p)
-- | A type or class declaration.
data TyClDecl pass
-- |
-- type/data family T :: *->*
--
--
--
-- - AnnKeywordId : AnnType, AnnData,
-- AnnFamily,AnnDcolon, AnnWhere,AnnOpenP,
-- AnnDcolon,AnnCloseP, AnnEqual,AnnRarrow,
-- AnnVbar
--
FamDecl :: XFamDecl pass -> FamilyDecl pass -> TyClDecl pass
[tcdFExt] :: TyClDecl pass -> XFamDecl pass
[tcdFam] :: TyClDecl pass -> FamilyDecl pass
-- | type declaration
--
--
SynDecl :: XSynDecl pass -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> LHsType pass -> TyClDecl pass
-- | Post renameer, FVs
[tcdSExt] :: TyClDecl pass -> XSynDecl pass
-- | Type constructor
[tcdLName] :: TyClDecl pass -> LIdP pass
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl pass -> LexicalFixity
[tcdRhs] :: TyClDecl pass -> LHsType pass
-- | data declaration
--
--
DataDecl :: XDataDecl pass -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> HsDataDefn pass -> TyClDecl pass
-- | Post renamer, CUSK flag, FVs
[tcdDExt] :: TyClDecl pass -> XDataDecl pass
-- | Type constructor
[tcdLName] :: TyClDecl pass -> LIdP pass
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl pass -> LexicalFixity
[tcdDataDefn] :: TyClDecl pass -> HsDataDefn pass
-- |
ClassDecl :: XClassDecl pass -> Maybe (LHsContext pass) -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> [LHsFunDep pass] -> [LSig pass] -> LHsBinds pass -> [LFamilyDecl pass] -> [LTyFamDefltDecl pass] -> [LDocDecl pass] -> TyClDecl pass
-- | Post renamer, FVs
[tcdCExt] :: TyClDecl pass -> XClassDecl pass
-- | Context...
[tcdCtxt] :: TyClDecl pass -> Maybe (LHsContext pass)
-- | Type constructor
[tcdLName] :: TyClDecl pass -> LIdP pass
-- | Type variables; for an associated type these include outer binders
[tcdTyVars] :: TyClDecl pass -> LHsQTyVars pass
-- | Fixity used in the declaration
[tcdFixity] :: TyClDecl pass -> LexicalFixity
-- | Functional deps
[tcdFDs] :: TyClDecl pass -> [LHsFunDep pass]
-- | Methods' signatures
[tcdSigs] :: TyClDecl pass -> [LSig pass]
-- | Default methods
[tcdMeths] :: TyClDecl pass -> LHsBinds pass
-- | Associated types;
[tcdATs] :: TyClDecl pass -> [LFamilyDecl pass]
-- | Associated type defaults
[tcdATDefs] :: TyClDecl pass -> [LTyFamDefltDecl pass]
-- | Haddock docs
[tcdDocs] :: TyClDecl pass -> [LDocDecl pass]
XTyClDecl :: !XXTyClDecl pass -> TyClDecl pass
-- | Located Declaration of a Type or Class
type LTyClDecl pass = XRec pass (TyClDecl pass)
data DataDeclRn
DataDeclRn :: Bool -> NameSet -> DataDeclRn
-- | does this have a CUSK? See Note [CUSKs: complete user-supplied kind
-- signatures]
[tcdDataCusk] :: DataDeclRn -> Bool
[tcdFVs] :: DataDeclRn -> NameSet
-- | Type or Class Group
data TyClGroup pass
TyClGroup :: XCTyClGroup pass -> [LTyClDecl pass] -> [LRoleAnnotDecl pass] -> [LStandaloneKindSig pass] -> [LInstDecl pass] -> TyClGroup pass
[group_ext] :: TyClGroup pass -> XCTyClGroup pass
[group_tyclds] :: TyClGroup pass -> [LTyClDecl pass]
[group_roles] :: TyClGroup pass -> [LRoleAnnotDecl pass]
[group_kisigs] :: TyClGroup pass -> [LStandaloneKindSig pass]
[group_instds] :: TyClGroup pass -> [LInstDecl pass]
XTyClGroup :: !XXTyClGroup pass -> TyClGroup pass
tyClGroupTyClDecls :: [TyClGroup pass] -> [LTyClDecl pass]
tyClGroupInstDecls :: [TyClGroup pass] -> [LInstDecl pass]
tyClGroupRoleDecls :: [TyClGroup pass] -> [LRoleAnnotDecl pass]
tyClGroupKindSigs :: [TyClGroup pass] -> [LStandaloneKindSig pass]
-- | type class
isClassDecl :: TyClDecl pass -> Bool
-- | True = argument is a data/newtype
-- declaration.
isDataDecl :: TyClDecl pass -> Bool
-- | type or type instance declaration
isSynDecl :: TyClDecl pass -> Bool
tcdName :: Anno (IdGhcP p) ~ SrcSpanAnnN => TyClDecl (GhcPass p) -> IdP (GhcPass p)
-- | type/data family declaration
isFamilyDecl :: TyClDecl pass -> Bool
-- | type family declaration
isTypeFamilyDecl :: TyClDecl pass -> Bool
-- | data family declaration
isDataFamilyDecl :: TyClDecl pass -> Bool
-- | open type family info
isOpenTypeFamilyInfo :: FamilyInfo pass -> Bool
-- | closed type family info
isClosedTypeFamilyInfo :: FamilyInfo pass -> Bool
tyFamInstDeclName :: Anno (IdGhcP p) ~ SrcSpanAnnN => TyFamInstDecl (GhcPass p) -> IdP (GhcPass p)
tyFamInstDeclLName :: Anno (IdGhcP p) ~ SrcSpanAnnN => TyFamInstDecl (GhcPass p) -> LocatedN (IdP (GhcPass p))
countTyClDecls :: [TyClDecl pass] -> (Int, Int, Int, Int, Int)
pprTyClDeclFlavour :: TyClDecl (GhcPass p) -> SDoc
tyClDeclLName :: Anno (IdGhcP p) ~ SrcSpanAnnN => TyClDecl (GhcPass p) -> LocatedN (IdP (GhcPass p))
tyClDeclTyVars :: TyClDecl pass -> LHsQTyVars pass
-- | Does this declaration have a complete, user-supplied kind signature?
-- See Note [CUSKs: complete user-supplied kind signatures]
hsDeclHasCusk :: TyClDecl GhcRn -> Bool
famResultKindSignature :: FamilyResultSig (GhcPass p) -> Maybe (LHsKind (GhcPass p))
-- | type Family Declaration
data FamilyDecl pass
FamilyDecl :: XCFamilyDecl pass -> FamilyInfo pass -> TopLevelFlag -> LIdP pass -> LHsQTyVars pass -> LexicalFixity -> LFamilyResultSig pass -> Maybe (LInjectivityAnn pass) -> FamilyDecl pass
[fdExt] :: FamilyDecl pass -> XCFamilyDecl pass
[fdInfo] :: FamilyDecl pass -> FamilyInfo pass
[fdTopLevel] :: FamilyDecl pass -> TopLevelFlag
[fdLName] :: FamilyDecl pass -> LIdP pass
[fdTyVars] :: FamilyDecl pass -> LHsQTyVars pass
[fdFixity] :: FamilyDecl pass -> LexicalFixity
[fdResultSig] :: FamilyDecl pass -> LFamilyResultSig pass
[fdInjectivityAnn] :: FamilyDecl pass -> Maybe (LInjectivityAnn pass)
-- |
XFamilyDecl :: !XXFamilyDecl pass -> FamilyDecl pass
-- | Located type Family Declaration
type LFamilyDecl pass = XRec pass (FamilyDecl pass)
data FunDep pass
FunDep :: XCFunDep pass -> [LIdP pass] -> [LIdP pass] -> FunDep pass
XFunDep :: !XXFunDep pass -> FunDep pass
-- | Instance Declaration
data InstDecl pass
ClsInstD :: XClsInstD pass -> ClsInstDecl pass -> InstDecl pass
[cid_d_ext] :: InstDecl pass -> XClsInstD pass
[cid_inst] :: InstDecl pass -> ClsInstDecl pass
DataFamInstD :: XDataFamInstD pass -> DataFamInstDecl pass -> InstDecl pass
[dfid_ext] :: InstDecl pass -> XDataFamInstD pass
[dfid_inst] :: InstDecl pass -> DataFamInstDecl pass
TyFamInstD :: XTyFamInstD pass -> TyFamInstDecl pass -> InstDecl pass
[tfid_ext] :: InstDecl pass -> XTyFamInstD pass
[tfid_inst] :: InstDecl pass -> TyFamInstDecl pass
XInstDecl :: !XXInstDecl pass -> InstDecl pass
-- | Located Instance Declaration
type LInstDecl pass = XRec pass (InstDecl pass)
data FamilyInfo pass
DataFamily :: FamilyInfo pass
OpenTypeFamily :: FamilyInfo pass
-- | Nothing if we're in an hs-boot file and the user said "type
-- family Foo x where .."
ClosedTypeFamily :: Maybe [LTyFamInstEqn pass] -> FamilyInfo pass
-- | Type Family Instance Declaration
data TyFamInstDecl pass
-- |
TyFamInstDecl :: XCTyFamInstDecl pass -> TyFamInstEqn pass -> TyFamInstDecl pass
[tfid_xtn] :: TyFamInstDecl pass -> XCTyFamInstDecl pass
[tfid_eqn] :: TyFamInstDecl pass -> TyFamInstEqn pass
XTyFamInstDecl :: !XXTyFamInstDecl pass -> TyFamInstDecl pass
-- | Located Type Family Instance Declaration
type LTyFamInstDecl pass = XRec pass (TyFamInstDecl pass)
instDeclDataFamInsts :: [LInstDecl (GhcPass p)] -> [DataFamInstDecl (GhcPass p)]
-- | Type family default declarations. A convenient synonym for
-- TyFamInstDecl. See Note [Type family instance declarations
-- in HsSyn].
type TyFamDefltDecl = TyFamInstDecl
-- | Located type family default declarations.
type LTyFamDefltDecl pass = XRec pass (TyFamDefltDecl pass)
-- | Data Family Instance Declaration
newtype DataFamInstDecl pass
-- |
DataFamInstDecl :: FamEqn pass (HsDataDefn pass) -> DataFamInstDecl pass
[dfid_eqn] :: DataFamInstDecl pass -> FamEqn pass (HsDataDefn pass)
-- | Located Data Family Instance Declaration
type LDataFamInstDecl pass = XRec pass (DataFamInstDecl pass)
pprDataFamInstFlavour :: DataFamInstDecl (GhcPass p) -> SDoc
pprTyFamInstDecl :: OutputableBndrId p => TopLevelFlag -> TyFamInstDecl (GhcPass p) -> SDoc
pprHsFamInstLHS :: OutputableBndrId p => IdP (GhcPass p) -> HsOuterFamEqnTyVarBndrs (GhcPass p) -> HsTyPats (GhcPass p) -> LexicalFixity -> Maybe (LHsContext (GhcPass p)) -> SDoc
-- | Family Equation
--
-- One equation in a type family instance declaration, data family
-- instance declaration, or type family default. See Note [Type family
-- instance declarations in HsSyn] See Note [Family instance declaration
-- binders]
data FamEqn pass rhs
-- |
FamEqn :: XCFamEqn pass rhs -> LIdP pass -> HsOuterFamEqnTyVarBndrs pass -> HsTyPats pass -> LexicalFixity -> rhs -> FamEqn pass rhs
[feqn_ext] :: FamEqn pass rhs -> XCFamEqn pass rhs
[feqn_tycon] :: FamEqn pass rhs -> LIdP pass
-- | Optional quantified type vars
[feqn_bndrs] :: FamEqn pass rhs -> HsOuterFamEqnTyVarBndrs pass
[feqn_pats] :: FamEqn pass rhs -> HsTyPats pass
-- | Fixity used in the declaration
[feqn_fixity] :: FamEqn pass rhs -> LexicalFixity
[feqn_rhs] :: FamEqn pass rhs -> rhs
XFamEqn :: !XXFamEqn pass rhs -> FamEqn pass rhs
-- | Type Family Instance Equation
type TyFamInstEqn pass = FamEqn pass (LHsType pass)
-- | Located Type Family Instance Equation
type LTyFamInstEqn pass = XRec pass (TyFamInstEqn pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when in a list"
-- | Haskell Type Patterns
type HsTyPats pass = [LHsTypeArg pass]
-- | Located Class Instance Declaration
type LClsInstDecl pass = XRec pass (ClsInstDecl pass)
-- | Class Instance Declaration - AnnKeywordId : AnnInstance,
-- AnnWhere, AnnOpen,AnnClose, For details on above
-- see Note [exact print annotations] in GHC.Parser.Annotation
data ClsInstDecl pass
ClsInstDecl :: XCClsInstDecl pass -> LHsSigType pass -> LHsBinds pass -> [LSig pass] -> [LTyFamInstDecl pass] -> [LDataFamInstDecl pass] -> Maybe (XRec pass OverlapMode) -> ClsInstDecl pass
[cid_ext] :: ClsInstDecl pass -> XCClsInstDecl pass
[cid_poly_ty] :: ClsInstDecl pass -> LHsSigType pass
[cid_binds] :: ClsInstDecl pass -> LHsBinds pass
[cid_sigs] :: ClsInstDecl pass -> [LSig pass]
[cid_tyfam_insts] :: ClsInstDecl pass -> [LTyFamInstDecl pass]
[cid_datafam_insts] :: ClsInstDecl pass -> [LDataFamInstDecl pass]
-- |
[cid_overlap_mode] :: ClsInstDecl pass -> Maybe (XRec pass OverlapMode)
XClsInstDecl :: !XXClsInstDecl pass -> ClsInstDecl pass
-- | Stand-alone 'deriving instance' declaration
data DerivDecl pass
DerivDecl :: XCDerivDecl pass -> LHsSigWcType pass -> Maybe (LDerivStrategy pass) -> Maybe (XRec pass OverlapMode) -> DerivDecl pass
[deriv_ext] :: DerivDecl pass -> XCDerivDecl pass
-- | The instance type to derive.
--
-- It uses an LHsSigWcType because the context is allowed to be a
-- single wildcard:
--
--
-- deriving instance _ => Eq (Foo a)
--
--
-- Which signifies that the context should be inferred.
[deriv_type] :: DerivDecl pass -> LHsSigWcType pass
[deriv_strategy] :: DerivDecl pass -> Maybe (LDerivStrategy pass)
-- |
[deriv_overlap_mode] :: DerivDecl pass -> Maybe (XRec pass OverlapMode)
XDerivDecl :: !XXDerivDecl pass -> DerivDecl pass
-- | Located stand-alone 'deriving instance' declaration
type LDerivDecl pass = XRec pass (DerivDecl pass)
-- | Which technique the user explicitly requested when deriving an
-- instance.
data DerivStrategy pass
-- | 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 :: XStockStrategy pass -> DerivStrategy pass
-- |
-- -XDeriveAnyClass
--
AnyclassStrategy :: XAnyClassStrategy pass -> DerivStrategy pass
-- |
-- -XGeneralizedNewtypeDeriving
--
NewtypeStrategy :: XNewtypeStrategy pass -> DerivStrategy pass
-- |
-- -XDerivingVia
--
ViaStrategy :: XViaStrategy pass -> DerivStrategy pass
-- | A Located DerivStrategy.
type LDerivStrategy pass = XRec pass (DerivStrategy pass)
-- | A short description of a DerivStrategy'.
derivStrategyName :: DerivStrategy a -> SDoc
-- | Eliminate a DerivStrategy.
foldDerivStrategy :: p ~ GhcPass pass => r -> (XViaStrategy p -> r) -> DerivStrategy p -> r
-- | Map over the via type if dealing with ViaStrategy.
-- Otherwise, return the DerivStrategy unchanged.
mapDerivStrategy :: p ~ GhcPass pass => (XViaStrategy p -> XViaStrategy p) -> DerivStrategy p -> DerivStrategy p
data XViaStrategyPs
XViaStrategyPs :: EpAnn [AddEpAnn] -> LHsSigType GhcPs -> XViaStrategyPs
-- | Located Rule Declarations
type LRuleDecls pass = XRec pass (RuleDecls pass)
-- | Rule Declarations
data RuleDecls pass
HsRules :: XCRuleDecls pass -> SourceText -> [LRuleDecl pass] -> RuleDecls pass
[rds_ext] :: RuleDecls pass -> XCRuleDecls pass
[rds_src] :: RuleDecls pass -> SourceText
[rds_rules] :: RuleDecls pass -> [LRuleDecl pass]
XRuleDecls :: !XXRuleDecls pass -> RuleDecls pass
-- | Rule Declaration
data RuleDecl pass
-- |
HsRule :: XHsRule pass -> XRec pass (SourceText, RuleName) -> Activation -> Maybe [LHsTyVarBndr () (NoGhcTc pass)] -> [LRuleBndr pass] -> XRec pass (HsExpr pass) -> XRec pass (HsExpr pass) -> RuleDecl pass
-- | After renamer, free-vars from the LHS and RHS
[rd_ext] :: RuleDecl pass -> XHsRule pass
-- | Note [Pragma source text] in GHC.Types.Basic
[rd_name] :: RuleDecl pass -> XRec pass (SourceText, RuleName)
[rd_act] :: RuleDecl pass -> Activation
-- | Forall'd type vars
[rd_tyvs] :: RuleDecl pass -> Maybe [LHsTyVarBndr () (NoGhcTc pass)]
-- | Forall'd term vars, before typechecking; after typechecking this
-- includes all forall'd vars
[rd_tmvs] :: RuleDecl pass -> [LRuleBndr pass]
[rd_lhs] :: RuleDecl pass -> XRec pass (HsExpr pass)
[rd_rhs] :: RuleDecl pass -> XRec pass (HsExpr pass)
XRuleDecl :: !XXRuleDecl pass -> RuleDecl pass
-- | Located Rule Declaration
type LRuleDecl pass = XRec pass (RuleDecl pass)
data HsRuleRn
HsRuleRn :: NameSet -> NameSet -> HsRuleRn
data HsRuleAnn
HsRuleAnn :: Maybe (AddEpAnn, AddEpAnn) -> Maybe (AddEpAnn, AddEpAnn) -> [AddEpAnn] -> HsRuleAnn
-- | The locations of forall and . for forall'd type vars
-- Using AddEpAnn to capture possible unicode variants
[ra_tyanns] :: HsRuleAnn -> Maybe (AddEpAnn, AddEpAnn)
-- | The locations of forall and . for forall'd term vars
-- Using AddEpAnn to capture possible unicode variants
[ra_tmanns] :: HsRuleAnn -> Maybe (AddEpAnn, AddEpAnn)
[ra_rest] :: HsRuleAnn -> [AddEpAnn]
-- | Rule Binder
data RuleBndr pass
RuleBndr :: XCRuleBndr pass -> LIdP pass -> RuleBndr pass
RuleBndrSig :: XRuleBndrSig pass -> LIdP pass -> HsPatSigType pass -> RuleBndr pass
-- |
XRuleBndr :: !XXRuleBndr pass -> RuleBndr pass
-- | Located Rule Binder
type LRuleBndr pass = XRec pass (RuleBndr pass)
collectRuleBndrSigTys :: [RuleBndr pass] -> [HsPatSigType pass]
flattenRuleDecls :: [LRuleDecls (GhcPass p)] -> [LRuleDecl (GhcPass p)]
pprFullRuleName :: GenLocated a (SourceText, RuleName) -> SDoc
-- | Default Declaration
data DefaultDecl pass
-- |
DefaultDecl :: XCDefaultDecl pass -> [LHsType pass] -> DefaultDecl pass
XDefaultDecl :: !XXDefaultDecl pass -> DefaultDecl pass
-- | Located Default Declaration
type LDefaultDecl pass = XRec pass (DefaultDecl pass)
data SpliceExplicitFlag
-- | = $(f x y)
ExplicitSplice :: SpliceExplicitFlag
-- | = f x y, i.e. a naked top level expression
ImplicitSplice :: SpliceExplicitFlag
-- | Splice Declaration
data SpliceDecl p
SpliceDecl :: XSpliceDecl p -> XRec p (HsSplice p) -> SpliceExplicitFlag -> SpliceDecl p
XSpliceDecl :: !XXSpliceDecl p -> SpliceDecl p
-- | Located Splice Declaration
type LSpliceDecl pass = XRec pass (SpliceDecl pass)
-- | Foreign Declaration
data ForeignDecl pass
ForeignImport :: XForeignImport pass -> LIdP pass -> LHsSigType pass -> ForeignImport -> ForeignDecl pass
[fd_i_ext] :: ForeignDecl pass -> XForeignImport pass
[fd_name] :: ForeignDecl pass -> LIdP pass
[fd_sig_ty] :: ForeignDecl pass -> LHsSigType pass
[fd_fi] :: ForeignDecl pass -> ForeignImport
-- |
ForeignExport :: XForeignExport pass -> LIdP pass -> LHsSigType pass -> ForeignExport -> ForeignDecl pass
[fd_e_ext] :: ForeignDecl pass -> XForeignExport pass
[fd_name] :: ForeignDecl pass -> LIdP pass
[fd_sig_ty] :: ForeignDecl pass -> LHsSigType pass
[fd_fe] :: ForeignDecl pass -> ForeignExport
XForeignDecl :: !XXForeignDecl pass -> ForeignDecl pass
-- | Located Foreign Declaration
type LForeignDecl pass = XRec pass (ForeignDecl pass)
data ForeignImport
CImport :: Located CCallConv -> Located Safety -> Maybe Header -> CImportSpec -> Located SourceText -> ForeignImport
data ForeignExport
CExport :: Located CExportSpec -> Located SourceText -> ForeignExport
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 pass
ConDeclGADT :: XConDeclGADT pass -> [LIdP pass] -> XRec pass (HsOuterSigTyVarBndrs pass) -> Maybe (LHsContext pass) -> HsConDeclGADTDetails pass -> LHsType pass -> Maybe (LHsDoc pass) -> ConDecl pass
[con_g_ext] :: ConDecl pass -> XConDeclGADT pass
[con_names] :: ConDecl pass -> [LIdP pass]
-- | The outermost type variable binders, be they explicit or implicit. The
-- XRec is used to anchor exact print annotations, AnnForall and
-- AnnDot.
[con_bndrs] :: ConDecl pass -> XRec pass (HsOuterSigTyVarBndrs pass)
-- | User-written context (if any)
[con_mb_cxt] :: ConDecl pass -> Maybe (LHsContext pass)
-- | Arguments; never infix
[con_g_args] :: ConDecl pass -> HsConDeclGADTDetails pass
-- | Result type
[con_res_ty] :: ConDecl pass -> LHsType pass
-- | A possible Haddock comment.
[con_doc] :: ConDecl pass -> Maybe (LHsDoc pass)
ConDeclH98 :: XConDeclH98 pass -> LIdP pass -> Bool -> [LHsTyVarBndr Specificity pass] -> Maybe (LHsContext pass) -> HsConDeclH98Details pass -> Maybe (LHsDoc pass) -> ConDecl pass
[con_ext] :: ConDecl pass -> XConDeclH98 pass
[con_name] :: ConDecl pass -> LIdP pass
-- | True = explicit user-written forall e.g. data T a = forall b.
-- MkT b (b->a) con_ex_tvs = {b} False => con_ex_tvs is empty
[con_forall] :: ConDecl pass -> Bool
-- | Existentials only
[con_ex_tvs] :: ConDecl pass -> [LHsTyVarBndr Specificity pass]
-- | User-written context (if any)
[con_mb_cxt] :: ConDecl pass -> Maybe (LHsContext pass)
-- | Arguments; can be infix
[con_args] :: ConDecl pass -> HsConDeclH98Details pass
-- | A possible Haddock comment.
[con_doc] :: ConDecl pass -> Maybe (LHsDoc pass)
XConDecl :: !XXConDecl pass -> ConDecl pass
-- | Located data Constructor Declaration
type LConDecl pass = XRec pass (ConDecl pass) " May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when in a GADT constructor list"
-- | The arguments in a Haskell98-style data constructor.
type HsConDeclH98Details pass = HsConDetails Void (HsScaled pass (LBangType pass)) (XRec pass [LConDeclField pass])
-- | The arguments in a GADT constructor. Unlike Haskell98-style
-- constructors, GADT constructors cannot be declared with infix syntax.
-- As a result, we do not use HsConDetails here, as
-- InfixCon would be an unrepresentable state. (There is a notion
-- of infix GADT constructors for the purposes of derived Show
-- instances—see Note [Infix GADT constructors] in GHC.Tc.TyCl—but that
-- is an orthogonal concern.)
data HsConDeclGADTDetails pass
PrefixConGADT :: [HsScaled pass (LBangType pass)] -> HsConDeclGADTDetails pass
RecConGADT :: XRec pass [LConDeclField pass] -> LHsUniToken "->" "\8594" pass -> HsConDeclGADTDetails pass
hsConDeclTheta :: Maybe (LHsContext (GhcPass p)) -> [LHsType (GhcPass p)]
getConNames :: ConDecl GhcRn -> [LocatedN Name]
-- | Return Just fields if a data constructor declaration
-- uses record syntax (i.e., RecCon), where fields are
-- the field selectors. Otherwise, return Nothing.
getRecConArgs_maybe :: ConDecl GhcRn -> Maybe (LocatedL [LConDeclField GhcRn])
-- | Documentation comment Declaration
data DocDecl pass
DocCommentNext :: LHsDoc pass -> DocDecl pass
DocCommentPrev :: LHsDoc pass -> DocDecl pass
DocCommentNamed :: String -> LHsDoc pass -> DocDecl pass
DocGroup :: Int -> LHsDoc pass -> DocDecl pass
-- | Located Documentation comment Declaration
type LDocDecl pass = XRec pass (DocDecl pass)
docDeclDoc :: DocDecl pass -> LHsDoc pass
-- | Warning pragma Declaration
data WarnDecl pass
Warning :: XWarning pass -> [LIdP pass] -> WarningTxt pass -> WarnDecl pass
XWarnDecl :: !XXWarnDecl pass -> WarnDecl pass
-- | Located Warning pragma Declaration
type LWarnDecl pass = XRec pass (WarnDecl pass)
-- | Warning pragma Declarations
data WarnDecls pass
Warnings :: XWarnings pass -> SourceText -> [LWarnDecl pass] -> WarnDecls pass
[wd_ext] :: WarnDecls pass -> XWarnings pass
[wd_src] :: WarnDecls pass -> SourceText
[wd_warnings] :: WarnDecls pass -> [LWarnDecl pass]
XWarnDecls :: !XXWarnDecls pass -> WarnDecls pass
-- | Located Warning Declarations
type LWarnDecls pass = XRec pass (WarnDecls pass)
-- | Annotation Declaration
data AnnDecl pass
-- |
HsAnnotation :: XHsAnnotation pass -> SourceText -> AnnProvenance pass -> XRec pass (HsExpr pass) -> AnnDecl pass
XAnnDecl :: !XXAnnDecl pass -> AnnDecl pass
-- | Located Annotation Declaration
type LAnnDecl pass = XRec pass (AnnDecl pass)
-- | Annotation Provenance
data AnnProvenance pass
ValueAnnProvenance :: LIdP pass -> AnnProvenance pass
TypeAnnProvenance :: LIdP pass -> AnnProvenance pass
ModuleAnnProvenance :: AnnProvenance pass
annProvenanceName_maybe :: forall p. UnXRec p => AnnProvenance p -> Maybe (IdP p)
-- | Role Annotation Declaration
data RoleAnnotDecl pass
-- |
RoleAnnotDecl :: XCRoleAnnotDecl pass -> LIdP pass -> [XRec pass (Maybe Role)] -> RoleAnnotDecl pass
XRoleAnnotDecl :: !XXRoleAnnotDecl pass -> RoleAnnotDecl pass
-- | Located Role Annotation Declaration
type LRoleAnnotDecl pass = XRec pass (RoleAnnotDecl pass)
roleAnnotDeclName :: RoleAnnotDecl (GhcPass p) -> IdP (GhcPass p)
-- | type Family Result Signature
data FamilyResultSig pass
-- |
NoSig :: XNoSig pass -> FamilyResultSig pass
-- |
KindSig :: XCKindSig pass -> LHsKind pass -> FamilyResultSig pass
-- |
TyVarSig :: XTyVarSig pass -> LHsTyVarBndr () pass -> FamilyResultSig pass
XFamilyResultSig :: !XXFamilyResultSig pass -> FamilyResultSig pass
-- | Located type Family Result Signature
type LFamilyResultSig pass = XRec pass (FamilyResultSig pass)
-- | 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 pass
-- |
InjectivityAnn :: XCInjectivityAnn pass -> LIdP pass -> [LIdP pass] -> InjectivityAnn pass
XInjectivityAnn :: !XXInjectivityAnn pass -> InjectivityAnn pass
-- | Located Injectivity Annotation
type LInjectivityAnn pass = XRec pass (InjectivityAnn pass)
-- | Maybe return name of the result type variable
resultVariableName :: FamilyResultSig (GhcPass a) -> Maybe (IdP (GhcPass a))
familyDeclLName :: FamilyDecl (GhcPass p) -> XRec (GhcPass p) (IdP (GhcPass p))
familyDeclName :: FamilyDecl (GhcPass p) -> IdP (GhcPass p)
-- | Haskell Group
--
-- A HsDecl is categorised into a HsGroup before being fed
-- to the renamer.
data HsGroup p
HsGroup :: XCHsGroup p -> HsValBinds p -> [LSpliceDecl p] -> [TyClGroup p] -> [LDerivDecl p] -> [LFixitySig p] -> [LDefaultDecl p] -> [LForeignDecl p] -> [LWarnDecls p] -> [LAnnDecl p] -> [LRuleDecls p] -> [LDocDecl p] -> HsGroup p
[hs_ext] :: HsGroup p -> XCHsGroup p
[hs_valds] :: HsGroup p -> HsValBinds p
[hs_splcds] :: HsGroup p -> [LSpliceDecl p]
[hs_tyclds] :: HsGroup p -> [TyClGroup p]
[hs_derivds] :: HsGroup p -> [LDerivDecl p]
[hs_fixds] :: HsGroup p -> [LFixitySig p]
[hs_defds] :: HsGroup p -> [LDefaultDecl p]
[hs_fords] :: HsGroup p -> [LForeignDecl p]
[hs_warnds] :: HsGroup p -> [LWarnDecls p]
[hs_annds] :: HsGroup p -> [LAnnDecl p]
[hs_ruleds] :: HsGroup p -> [LRuleDecls p]
[hs_docs] :: HsGroup p -> [LDocDecl p]
XHsGroup :: !XXHsGroup p -> HsGroup p
emptyRdrGroup :: HsGroup (GhcPass p)
emptyRnGroup :: HsGroup (GhcPass p)
appendGroups :: HsGroup (GhcPass p) -> HsGroup (GhcPass p) -> HsGroup (GhcPass p)
hsGroupInstDecls :: HsGroup id -> [LInstDecl id]
-- | The fixity signatures for each top-level declaration and class method
-- in an HsGroup. See Note [Top-level fixity signatures in an
-- HsGroup]
hsGroupTopLevelFixitySigs :: HsGroup (GhcPass p) -> [LFixitySig (GhcPass p)]
-- | Partition a list of HsDecls into function/pattern bindings,
-- signatures, type family declarations, type family instances, and
-- documentation comments.
--
-- Panics when given a declaration that cannot be put into any of the
-- output groups.
--
-- The primary use of this function is to implement
-- cvBindsAndSigs.
partitionBindsAndSigs :: [LHsDecl GhcPs] -> (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs], [LTyFamInstDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl GhcPs])
instance GHC.Classes.Eq GHC.Hs.Decls.HsRuleAnn
instance Data.Data.Data GHC.Hs.Decls.HsRuleAnn
instance GHC.Utils.Outputable.Outputable GHC.Hs.Decls.XViaStrategyPs
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.HsDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.HsGroup (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.SpliceDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.TyClDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.TyClGroup (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.FunDep (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.FamilyDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.HsDerivingClause (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.DerivClauseTys (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.HsDataDefn (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.StandaloneKindSig (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.ConDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.TyFamInstDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.DataFamInstDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.ClsInstDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.InstDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.DerivDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.DerivStrategy (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.DefaultDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.ForeignDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.RuleDecls (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.RuleDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.RuleBndr (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.WarnDecls (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.WarnDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.AnnDecl (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.OutputableBndr (Language.Haskell.Syntax.Extension.IdP (GHC.Hs.Extension.GhcPass p)) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Decls.RoleAnnotDecl (GHC.Hs.Extension.GhcPass p))
-- | Abstract Haskell syntax for expressions.
module GHC.Hs.Expr
pprFunBind :: OutputableBndrId idR => MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
pprPatBind :: forall bndr p. (OutputableBndrId bndr, OutputableBndrId p) => LPat (GhcPass bndr) -> GRHSs (GhcPass p) (LHsExpr (GhcPass p)) -> SDoc
pprSpliceDecl :: OutputableBndrId p => HsSplice (GhcPass p) -> SpliceExplicitFlag -> SDoc
pprSplice :: forall p. OutputableBndrId p => HsSplice (GhcPass p) -> SDoc
pprExpr :: OutputableBndrId p => HsExpr (GhcPass p) -> SDoc
pprLExpr :: OutputableBndrId p => LHsExpr (GhcPass p) -> SDoc
-- | Pending Type-checker Splice
data PendingTcSplice
PendingTcSplice :: SplicePointName -> LHsExpr GhcTc -> PendingTcSplice
-- | Pending Renamer Splice
data PendingRnSplice
PendingRnSplice :: UntypedSpliceFlavour -> SplicePointName -> LHsExpr GhcRn -> PendingRnSplice
type SplicePointName = Name
data DelayedSplice
DelayedSplice :: TcLclEnv -> LHsExpr GhcRn -> TcType -> LHsExpr GhcTc -> DelayedSplice
newtype HsSplicedT
HsSplicedT :: DelayedSplice -> HsSplicedT
data XBindStmtTc
XBindStmtTc :: SyntaxExpr GhcTc -> Type -> Mult -> FailOperator GhcTc -> XBindStmtTc
[xbstc_bindOp] :: XBindStmtTc -> SyntaxExpr GhcTc
[xbstc_boundResultType] :: XBindStmtTc -> Type
[xbstc_boundResultMult] :: XBindStmtTc -> Mult
[xbstc_failOp] :: XBindStmtTc -> FailOperator GhcTc
data XBindStmtRn
XBindStmtRn :: SyntaxExpr GhcRn -> FailOperator GhcRn -> XBindStmtRn
[xbsrn_bindOp] :: XBindStmtRn -> SyntaxExpr GhcRn
[xbsrn_failOp] :: XBindStmtRn -> FailOperator GhcRn
data RecStmtTc
RecStmtTc :: Type -> [PostTcExpr] -> [PostTcExpr] -> Type -> RecStmtTc
[recS_bind_ty] :: RecStmtTc -> Type
[recS_later_rets] :: RecStmtTc -> [PostTcExpr]
[recS_rec_rets] :: RecStmtTc -> [PostTcExpr]
[recS_ret_ty] :: RecStmtTc -> Type
data GrhsAnn
GrhsAnn :: Maybe EpaLocation -> AddEpAnn -> GrhsAnn
[ga_vbar] :: GrhsAnn -> Maybe EpaLocation
-- | Match separator location
[ga_sep] :: GrhsAnn -> AddEpAnn
data CmdTopTc
CmdTopTc :: Type -> Type -> CmdSyntaxTable GhcTc -> CmdTopTc
data HsExpansion orig expanded
HsExpanded :: orig -> expanded -> HsExpansion orig expanded
data XXExprGhcTc
WrapExpr :: {-# UNPACK #-} !HsWrap HsExpr -> XXExprGhcTc
ExpansionExpr :: {-# UNPACK #-} !HsExpansion (HsExpr GhcRn) (HsExpr GhcTc) -> XXExprGhcTc
ConLikeTc :: ConLike -> [InvisTVBinder] -> [Scaled TcType] -> XXExprGhcTc
HsTick :: CoreTickish -> LHsExpr GhcTc -> XXExprGhcTc
HsBinTick :: Int -> Int -> LHsExpr GhcTc -> XXExprGhcTc
data AnnsIf
AnnsIf :: EpaLocation -> EpaLocation -> EpaLocation -> Maybe EpaLocation -> Maybe EpaLocation -> AnnsIf
[aiIf] :: AnnsIf -> EpaLocation
[aiThen] :: AnnsIf -> EpaLocation
[aiElse] :: AnnsIf -> EpaLocation
[aiThenSemi] :: AnnsIf -> Maybe EpaLocation
[aiElseSemi] :: AnnsIf -> Maybe EpaLocation
data AnnProjection
AnnProjection :: EpaLocation -> EpaLocation -> AnnProjection
-- | '('
[apOpen] :: AnnProjection -> EpaLocation
-- | ')'
[apClose] :: AnnProjection -> EpaLocation
data AnnFieldLabel
AnnFieldLabel :: Maybe EpaLocation -> AnnFieldLabel
[afDot] :: AnnFieldLabel -> Maybe EpaLocation
data AnnExplicitSum
AnnExplicitSum :: EpaLocation -> [EpaLocation] -> [EpaLocation] -> EpaLocation -> AnnExplicitSum
[aesOpen] :: AnnExplicitSum -> EpaLocation
[aesBarsBefore] :: AnnExplicitSum -> [EpaLocation]
[aesBarsAfter] :: AnnExplicitSum -> [EpaLocation]
[aesClose] :: AnnExplicitSum -> EpaLocation
data EpAnnUnboundVar
EpAnnUnboundVar :: (EpaLocation, EpaLocation) -> EpaLocation -> EpAnnUnboundVar
[hsUnboundBackquotes] :: EpAnnUnboundVar -> (EpaLocation, EpaLocation)
[hsUnboundHole] :: EpAnnUnboundVar -> EpaLocation
data EpAnnHsCase
EpAnnHsCase :: EpaLocation -> EpaLocation -> [AddEpAnn] -> EpAnnHsCase
[hsCaseAnnCase] :: EpAnnHsCase -> EpaLocation
[hsCaseAnnOf] :: EpAnnHsCase -> EpaLocation
[hsCaseAnnsRest] :: EpAnnHsCase -> [AddEpAnn]
data HsBracketTc
HsBracketTc :: HsQuote GhcRn -> Type -> Maybe QuoteWrapper -> [PendingTcSplice] -> HsBracketTc
[brack_renamed_quote] :: HsBracketTc -> HsQuote GhcRn
[brack_ty] :: HsBracketTc -> Type
[brack_quote_wrapper] :: HsBracketTc -> Maybe QuoteWrapper
[brack_pending_splices] :: HsBracketTc -> [PendingTcSplice]
-- | HsWrap appears only in typechecker output
data HsWrap hs_syn
HsWrap :: HsWrapper -> hs_syn GhcTc -> HsWrap hs_syn
-- | Extra data fields for a RecordUpd, added by the type checker
data RecordUpdTc
RecordUpdTc :: [ConLike] -> [Type] -> [Type] -> HsWrapper -> RecordUpdTc
[rupd_cons] :: RecordUpdTc -> [ConLike]
[rupd_in_tys] :: RecordUpdTc -> [Type]
[rupd_out_tys] :: RecordUpdTc -> [Type]
[rupd_wrap] :: RecordUpdTc -> HsWrapper
-- | An expression with wrappers, used for rebindable syntax
--
-- 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.
data SyntaxExprTc
SyntaxExprTc :: HsExpr GhcTc -> [HsWrapper] -> HsWrapper -> SyntaxExprTc
[syn_expr] :: SyntaxExprTc -> HsExpr GhcTc
[syn_arg_wraps] :: SyntaxExprTc -> [HsWrapper]
[syn_res_wrap] :: SyntaxExprTc -> HsWrapper
NoSyntaxExprTc :: SyntaxExprTc
-- | The function to use in rebindable syntax. See Note [NoSyntaxExpr].
data SyntaxExprRn
SyntaxExprRn :: HsExpr GhcRn -> SyntaxExprRn
NoSyntaxExprRn :: SyntaxExprRn
type family SyntaxExprGhc (p :: Pass) = (r :: Type) | r -> p
-- | 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)]
-- | Post-Type checking Expression
--
-- PostTcExpr is an evidence expression attached to the syntax tree by
-- the type checker (c.f. postTcType).
type PostTcExpr = HsExpr GhcTc
-- | This is used for rebindable-syntax pieces that are too polymorphic for
-- tcSyntaxOp (trS_fmap and the mzip in ParStmt)
noExpr :: HsExpr (GhcPass p)
noSyntaxExpr :: forall p. IsPass p => SyntaxExpr (GhcPass p)
-- | Make a 'SyntaxExpr GhcRn' from an expression Used only in
-- getMonadFailOp. See Note [Monad fail : Rebindable syntax, overloaded
-- strings] in GHC.Rename.Expr
mkSyntaxExpr :: HsExpr GhcRn -> SyntaxExprRn
-- | Make a SyntaxExpr from a Name (the "rn" is because this
-- is used in the renamer).
mkRnSyntaxExpr :: Name -> SyntaxExprRn
tupArgPresent :: HsTupArg (GhcPass p) -> Bool
isQuietHsExpr :: HsExpr id -> Bool
pprBinds :: (OutputableBndrId idL, OutputableBndrId idR) => HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
ppr_lexpr :: OutputableBndrId p => LHsExpr (GhcPass p) -> SDoc
ppr_expr :: forall p. OutputableBndrId p => HsExpr (GhcPass p) -> SDoc
ppr_infix_expr :: forall p. OutputableBndrId p => HsExpr (GhcPass p) -> Maybe SDoc
ppr_infix_expr_rn :: HsExpansion (HsExpr GhcRn) (HsExpr GhcRn) -> Maybe SDoc
ppr_infix_expr_tc :: XXExprGhcTc -> Maybe SDoc
ppr_apps :: OutputableBndrId p => HsExpr (GhcPass p) -> [Either (LHsExpr (GhcPass p)) (LHsWcType (NoGhcTc (GhcPass p)))] -> SDoc
pprDebugParendExpr :: OutputableBndrId p => PprPrec -> LHsExpr (GhcPass p) -> SDoc
pprParendLExpr :: OutputableBndrId p => PprPrec -> LHsExpr (GhcPass p) -> SDoc
pprParendExpr :: OutputableBndrId p => PprPrec -> HsExpr (GhcPass p) -> SDoc
-- | hsExprNeedsParens p e returns True if the
-- expression e needs parentheses under precedence p.
hsExprNeedsParens :: forall p. IsPass p => PprPrec -> HsExpr (GhcPass p) -> Bool
-- | Parenthesize an expression without token information
gHsPar :: LHsExpr (GhcPass id) -> HsExpr (GhcPass id)
-- | parenthesizeHsExpr p e checks if
-- hsExprNeedsParens p e is true, and if so, surrounds
-- e with an HsPar. Otherwise, it simply returns
-- e.
parenthesizeHsExpr :: IsPass p => PprPrec -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
stripParensLHsExpr :: LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
stripParensHsExpr :: HsExpr (GhcPass p) -> HsExpr (GhcPass p)
isAtomicHsExpr :: forall p. IsPass p => HsExpr (GhcPass p) -> Bool
pprLCmd :: OutputableBndrId p => LHsCmd (GhcPass p) -> SDoc
pprCmd :: OutputableBndrId p => HsCmd (GhcPass p) -> SDoc
isQuietHsCmd :: HsCmd id -> Bool
ppr_lcmd :: OutputableBndrId p => LHsCmd (GhcPass p) -> SDoc
ppr_cmd :: forall p. OutputableBndrId p => HsCmd (GhcPass p) -> SDoc
pprCmdArg :: OutputableBndrId p => HsCmdTop (GhcPass p) -> SDoc
isEmptyMatchGroup :: MatchGroup (GhcPass p) body -> Bool
-- | Is there only one RHS in this list of matches?
isSingletonMatchGroup :: [LMatch (GhcPass p) body] -> Bool
matchGroupArity :: MatchGroup (GhcPass id) body -> Arity
hsLMatchPats :: LMatch (GhcPass id) body -> [LPat (GhcPass id)]
pprMatches :: (OutputableBndrId idR, Outputable body) => MatchGroup (GhcPass idR) body -> SDoc
pprMatch :: (OutputableBndrId idR, Outputable body) => Match (GhcPass idR) body -> SDoc
pprGRHSs :: (OutputableBndrId idR, Outputable body) => HsMatchContext passL -> GRHSs (GhcPass idR) body -> SDoc
pprGRHS :: (OutputableBndrId idR, Outputable body) => HsMatchContext passL -> GRHS (GhcPass idR) body -> SDoc
pp_rhs :: Outputable body => HsMatchContext passL -> body -> SDoc
pprStmt :: forall idL idR body. (OutputableBndrId idL, OutputableBndrId idR, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA, Outputable body) => StmtLR (GhcPass idL) (GhcPass idR) body -> SDoc
pprBindStmt :: (Outputable pat, Outputable expr) => pat -> expr -> SDoc
pprArg :: forall idL. OutputableBndrId idL => ApplicativeArg (GhcPass idL) -> SDoc
pprTransformStmt :: OutputableBndrId p => [IdP (GhcPass p)] -> LHsExpr (GhcPass p) -> Maybe (LHsExpr (GhcPass p)) -> SDoc
pprTransStmt :: Outputable body => Maybe body -> body -> TransForm -> SDoc
pprBy :: Outputable body => Maybe body -> SDoc
pprDo :: (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => HsDoFlavour -> [LStmt (GhcPass p) body] -> SDoc
pprArrowExpr :: (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => [LStmt (GhcPass p) body] -> SDoc
ppr_module_name_prefix :: Maybe ModuleName -> SDoc
ppr_do_stmts :: (OutputableBndrId idL, OutputableBndrId idR, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA, Outputable body) => [LStmtLR (GhcPass idL) (GhcPass idR) body] -> SDoc
pprComp :: (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => [LStmt (GhcPass p) body] -> SDoc
pprQuals :: (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => [LStmt (GhcPass p) body] -> SDoc
pprPendingSplice :: OutputableBndrId p => SplicePointName -> LHsExpr (GhcPass p) -> SDoc
ppr_splice_decl :: OutputableBndrId p => HsSplice (GhcPass p) -> SDoc
ppr_quasi :: OutputableBndr p => p -> p -> FastString -> SDoc
ppr_splice :: OutputableBndrId p => SDoc -> IdP (GhcPass p) -> LHsExpr (GhcPass p) -> SDoc -> SDoc
thBrackets :: SDoc -> SDoc -> SDoc
thTyBrackets :: SDoc -> SDoc
ppr_with_pending_tc_splices :: SDoc -> [PendingTcSplice] -> SDoc
pp_dotdot :: SDoc
matchContextErrString :: OutputableBndrId p => HsMatchContext (GhcPass p) -> SDoc
matchArrowContextErrString :: HsArrowMatchContext -> SDoc
matchDoContextErrString :: HsDoFlavour -> SDoc
pprMatchInCtxt :: (OutputableBndrId idR, Outputable body) => Match (GhcPass idR) body -> SDoc
pprStmtInCtxt :: (OutputableBndrId idL, OutputableBndrId idR, OutputableBndrId ctx, Outputable body, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA) => HsStmtContext (GhcPass ctx) -> StmtLR (GhcPass idL) (GhcPass idR) body -> SDoc
instance Data.Data.Data GHC.Hs.Expr.EpAnnHsCase
instance Data.Data.Data GHC.Hs.Expr.EpAnnUnboundVar
instance Data.Data.Data GHC.Hs.Expr.AnnExplicitSum
instance Data.Data.Data GHC.Hs.Expr.AnnFieldLabel
instance Data.Data.Data GHC.Hs.Expr.AnnProjection
instance Data.Data.Data GHC.Hs.Expr.AnnsIf
instance (Data.Data.Data orig, Data.Data.Data expanded) => Data.Data.Data (GHC.Hs.Expr.HsExpansion orig expanded)
instance Data.Data.Data GHC.Hs.Expr.GrhsAnn
instance Data.Data.Data GHC.Hs.Expr.HsSplicedT
instance (Data.Data.Data (hs_syn GHC.Hs.Extension.GhcTc), Data.Typeable.Internal.Typeable hs_syn) => Data.Data.Data (GHC.Hs.Expr.HsWrap hs_syn)
instance GHC.Utils.Outputable.Outputable GHC.Hs.Expr.PendingTcSplice
instance GHC.Utils.Outputable.Outputable GHC.Hs.Expr.PendingRnSplice
instance Data.Data.Data GHC.Hs.Expr.DelayedSplice
instance GHC.Utils.Outputable.Outputable GHC.Hs.Expr.GrhsAnn
instance GHC.Utils.Outputable.Outputable GHC.Hs.Expr.XXExprGhcTc
instance (GHC.Utils.Outputable.Outputable a, GHC.Utils.Outputable.Outputable b) => GHC.Utils.Outputable.Outputable (GHC.Hs.Expr.HsExpansion a b)
instance GHC.Utils.Outputable.Outputable GHC.Hs.Expr.SyntaxExprTc
instance GHC.Utils.Outputable.Outputable GHC.Hs.Expr.SyntaxExprRn
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsExpr (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsPragE (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsCmd (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsCmdTop (GHC.Hs.Extension.GhcPass p))
instance (GHC.Hs.Extension.OutputableBndrId pr, GHC.Utils.Outputable.Outputable body) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.Match (GHC.Hs.Extension.GhcPass pr) body)
instance (GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.StmtLR (GHC.Hs.Extension.GhcPass idL) (GHC.Hs.Extension.GhcPass idL) (Language.Haskell.Syntax.Expr.LHsExpr (GHC.Hs.Extension.GhcPass idL))), GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Extension.XXParStmtBlock (GHC.Hs.Extension.GhcPass idL) (GHC.Hs.Extension.GhcPass idR))) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.ParStmtBlock (GHC.Hs.Extension.GhcPass idL) (GHC.Hs.Extension.GhcPass idR))
instance (GHC.Hs.Extension.OutputableBndrId pl, GHC.Hs.Extension.OutputableBndrId pr, Language.Haskell.Syntax.Extension.Anno (Language.Haskell.Syntax.Expr.StmtLR (GHC.Hs.Extension.GhcPass pl) (GHC.Hs.Extension.GhcPass pr) body) GHC.Types.~ GHC.Parser.Annotation.SrcSpanAnnA, GHC.Utils.Outputable.Outputable body) => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.StmtLR (GHC.Hs.Extension.GhcPass pl) (GHC.Hs.Extension.GhcPass pr) body)
instance GHC.Hs.Extension.OutputableBndrId idL => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.ApplicativeArg (GHC.Hs.Extension.GhcPass idL))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsSplicedThing (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsSplice (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsQuote (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.ArithSeqInfo (GHC.Hs.Extension.GhcPass p))
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsMatchContext (GHC.Hs.Extension.GhcPass p))
instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Expr.HsArrowMatchContext
instance GHC.Hs.Extension.OutputableBndrId p => GHC.Utils.Outputable.Outputable (Language.Haskell.Syntax.Expr.HsStmtContext (GHC.Hs.Extension.GhcPass p))
instance (Language.Haskell.Syntax.Extension.Anno a GHC.Types.~ GHC.Parser.Annotation.SrcSpanAnn' (GHC.Parser.Annotation.EpAnn an)) => Language.Haskell.Syntax.Extension.WrapXRec (GHC.Hs.Extension.GhcPass p) a
module GHC.Types.Hint.Ppr
perhapsAsPat :: SDoc
instance GHC.Utils.Outputable.Outputable GHC.Types.Hint.GhcHint
-- | Here we collect a variety of helper functions that construct or
-- analyse HsSyn. All these functions deal with generic HsSyn; functions
-- which deal with the instantiated versions are located elsewhere:
--
-- Parameterised by Module ---------------- ------------- GhcPs/RdrName
-- GHC.Parser.PostProcess GhcRn/Name GHC.Rename.* GhcTc/Id
-- GHC.Tc.Utils.Zonk
--
-- The mk* functions attempt to construct a
-- not-completely-useless SrcSpan from their components, compared with
-- the nl* functions which just attach noSrcSpan to everything.
module GHC.Hs.Utils
-- |
-- e => (e)
--
mkHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsAppWith :: (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApps :: LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
mkHsAppsWith :: (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
mkHsAppType :: LHsExpr GhcRn -> LHsWcType GhcRn -> LHsExpr GhcRn
mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn
-- | A simple case alternative with a single pattern, no binds, no guards;
-- pre-typechecking
mkHsCaseAlt :: (Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcAnn NoEpAnns, Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA) => LPat (GhcPass p) -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkSimpleMatch :: (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA, Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcAnn NoEpAnns) => HsMatchContext (GhcPass p) -> [LPat (GhcPass p)] -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
unguardedGRHSs :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcAnn NoEpAnns => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn -> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
unguardedRHS :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcAnn NoEpAnns => EpAnn GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p)) -> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
mkMatchGroup :: AnnoBody p body => Origin -> LocatedL [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] -> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatch :: forall p. IsPass p => HsMatchContext (GhcPass p) -> [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> HsLocalBinds (GhcPass p) -> LMatch (GhcPass p) (LHsExpr (GhcPass p))
-- | Make a prefix, non-strict function HsMatchContext
mkPrefixFunRhs :: LIdP p -> HsMatchContext p
mkHsLam :: (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField) => [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> EpAnn AnnsIf -> HsExpr GhcPs
mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsWrapCo :: TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCoR :: TcCoercionR -> HsExpr GhcTc -> HsExpr GhcTc
mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
-- | A useful function for building OpApps. The operator is always
-- a variable, and we don't know the fixity yet.
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsDo :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDoAnns :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> EpAnn AnnList -> HsExpr GhcPs
mkHsComp :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsCompAnns :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> EpAnn AnnList -> HsExpr GhcPs
mkHsWrapPat :: HsWrapper -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc
-- | Wrap in parens if hsExprNeedsParens appPrec says it
-- needs them So f x becomes (f x), but 3
-- stays as 3.
mkLHsPar :: IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsCmdWrap :: HsWrapper -> HsCmd GhcTc -> HsCmd GhcTc
mkLHsCmdWrap :: HsWrapper -> LHsCmd GhcTc -> LHsCmd GhcTc
mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> EpAnn AnnsIf -> HsCmd GhcPs
mkConLikeTc :: ConLike -> HsExpr GhcTc
nlHsTyApp :: Id -> [Type] -> LHsExpr GhcTc
nlHsTyApps :: Id -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsVar :: IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsExpr (GhcPass p)
nl_HsVar :: IsSrcSpanAnn p a => IdP (GhcPass p) -> HsExpr (GhcPass p)
-- | NB: Only for LHsExpr Id.
nlHsDataCon :: DataCon -> LHsExpr GhcTc
nlHsLit :: HsLit (GhcPass p) -> LHsExpr (GhcPass p)
nlHsApp :: IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsApps :: IsSrcSpanAnn p a => IdP (GhcPass p) -> [LHsExpr (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsIntLit :: Integer -> LHsExpr (GhcPass p)
nlHsVarApps :: IsSrcSpanAnn p a => IdP (GhcPass p) -> [IdP (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsDo :: HsDoFlavour -> [LStmt GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs
nlHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs
mkLHsTupleExpr :: [LHsExpr (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsVarTuple :: IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
missingTupArg :: EpAnn EpaLocation -> HsTupArg GhcPs
mkLocatedList :: Semigroup a => [GenLocated (SrcAnn a) e2] -> LocatedAn an [GenLocated (SrcAnn a) e2]
-- | Lifts a "small" constructor into a "big" constructor by recursive
-- decomposition
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]]
-- | Not infix, with place holders for coercion and free vars
mkFunBind :: Origin -> LocatedN RdrName -> [LMatch GhcPs (LHsExpr GhcPs)] -> HsBind GhcPs
mkVarBind :: IdP (GhcPass p) -> LHsExpr (GhcPass p) -> LHsBind (GhcPass p)
mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
-- | Convenience function using mkFunBind. This is for generated
-- bindings only, do not use for user-written code.
mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> [LPat GhcPs] -> LHsExpr GhcPs -> LHsBind GhcPs
-- | In Name-land, with empty bind_fvs
mkTopFunBind :: Origin -> LocatedN Name -> [LMatch GhcRn (LHsExpr GhcRn)] -> HsBind GhcRn
mkPatSynBind :: LocatedN RdrName -> HsPatSynDetails GhcPs -> LPat GhcPs -> HsPatSynDir GhcPs -> EpAnn [AddEpAnn] -> HsBind GhcPs
-- | If any of the matches in the FunBind are infix, the
-- FunBind is considered infix.
isInfixFunBind :: forall id1 id2. UnXRec id2 => HsBindLR id1 id2 -> Bool
-- | Return the SrcSpan encompassing the contents of any enclosed
-- binds
spanHsLocaLBinds :: HsLocalBinds (GhcPass p) -> SrcSpan
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsFractional :: FractionalLit -> HsOverLit GhcPs
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
mkHsString :: String -> HsLit (GhcPass p)
mkHsStringPrimLit :: FastString -> HsLit (GhcPass p)
mkHsCharPrimLit :: Char -> HsLit (GhcPass p)
mkNPat :: LocatedAn NoEpAnns (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpAnn [AddEpAnn] -> Pat GhcPs
mkNPlusKPat :: LocatedN RdrName -> LocatedAn NoEpAnns (HsOverLit GhcPs) -> EpAnn EpaLocation -> Pat GhcPs
nlVarPat :: IsSrcSpanAnn p a => IdP (GhcPass p) -> LPat (GhcPass p)
nlLitPat :: HsLit GhcPs -> LPat GhcPs
nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs
nlConVarPatName :: Name -> [Name] -> LPat GhcRn
nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn
nlInfixConPat :: RdrName -> LPat GhcPs -> LPat GhcPs -> LPat GhcPs
nlNullaryConPat :: RdrName -> LPat GhcPs
nlWildConPat :: DataCon -> LPat GhcPs
-- | Wildcard pattern - after parsing
nlWildPat :: LPat GhcPs
-- | Wildcard pattern - after renaming
nlWildPatName :: LPat GhcRn
nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
mkParPat :: IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
nlParPat :: LPat (GhcPass name) -> LPat (GhcPass name)
-- | The Big equivalents for the source tuple expressions
mkBigLHsVarTup :: IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkBigLHsTup :: [LHsExpr (GhcPass id)] -> XExplicitTuple (GhcPass id) -> LHsExpr (GhcPass id)
-- | The Big equivalents for the source tuple patterns
mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn
mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
mkHsAppKindTy :: XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
-- | Convert an LHsType to an LHsSigType.
hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
-- | Convert an LHsType to an LHsSigWcType.
hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
-- | Convert TypeSig to ClassOpSig. The former is what is
-- parsed, but the latter is what we need in class/instance declarations
mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs]
mkHsSigEnv :: forall a. (LSig GhcRn -> Maybe ([LocatedN Name], a)) -> [LSig GhcRn] -> NameEnv a
nlHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy :: LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar :: IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsFunTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy :: LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsTyConApp :: IsSrcSpanAnn p a => LexicalFixity -> IdP (GhcPass p) -> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p)
mkTransformStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkTransformByStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkBodyStmt :: LocatedA (bodyR GhcPs) -> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
mkPsBindStmt :: EpAnn [AddEpAnn] -> LPat GhcPs -> LocatedA (bodyR GhcPs) -> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs))
mkRnBindStmt :: LPat GhcRn -> LocatedA (bodyR GhcRn) -> StmtLR GhcRn GhcRn (LocatedA (bodyR GhcRn))
mkTcBindStmt :: LPat GhcTc -> LocatedA (bodyR GhcTc) -> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc))
mkLastStmt :: IsPass idR => LocatedA (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
emptyTransStmt :: EpAnn [AddEpAnn] -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupUsingStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupByUsingStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyRecStmt :: Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnL => StmtLR (GhcPass idL) GhcPs bodyR
emptyRecStmtName :: Anno [GenLocated (Anno (StmtLR GhcRn GhcRn bodyR)) (StmtLR GhcRn GhcRn bodyR)] ~ SrcSpanAnnL => StmtLR GhcRn GhcRn bodyR
emptyRecStmtId :: Stmt GhcTc (LocatedA (HsCmd GhcTc))
mkRecStmt :: Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnL => EpAnn AnnList -> LocatedL [LStmtLR (GhcPass idL) GhcPs bodyR] -> StmtLR (GhcPass idL) GhcPs bodyR
unitRecStmtTc :: RecStmtTc
mkLetStmt :: EpAnn [AddEpAnn] -> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b)
mkUntypedSplice :: EpAnn [AddEpAnn] -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs
mkTypedSplice :: EpAnn [AddEpAnn] -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs
mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice GhcPs
-- | 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 checks] is GHC.HsToCore.Binds.
isUnliftedHsBind :: HsBind GhcTc -> Bool
-- | Is a binding a strict variable or pattern bind (e.g. !x =
-- ...)?
isBangedHsBind :: HsBind GhcTc -> Bool
collectLocalBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectHsValBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) idR -> [IdP (GhcPass idL)]
-- | Same as collectHsBindsBinders, but works over a list of
-- bindings
collectHsBindListBinders :: forall p idR. CollectPass p => CollectFlag p -> [LHsBindLR p idR] -> [IdP p]
-- | Collect Id binders only, or Ids + pattern synonyms,
-- respectively
collectHsIdBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectHsBindsBinders :: CollectPass p => CollectFlag p -> LHsBindsLR p idR -> [IdP p]
-- | Collect both Ids and pattern-synonym binders
collectHsBindBinders :: CollectPass p => CollectFlag p -> HsBindLR p idR -> [IdP p]
-- | Used exclusively for the bindings of an instance decl which are all
-- FunBinds
collectMethodBinders :: forall idL idR. UnXRec idL => LHsBindsLR idL idR -> [LIdP idL]
collectPatBinders :: CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatsBinders :: CollectPass p => CollectFlag p -> [LPat p] -> [IdP p]
collectLStmtsBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
collectStmtsBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
collectLStmtBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectStmtBinders :: CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
-- | This class specifies how to collect variable identifiers from
-- extension patterns in the given pass. Consumers of the GHC API that
-- define their own passes should feel free to implement instances in
-- order to make use of functions which depend on it.
--
-- In particular, Haddock already makes use of this, with an instance for
-- its DocNameI pass so that it can reuse the code in GHC for
-- collecting binders.
class UnXRec p => CollectPass p
collectXXPat :: CollectPass p => CollectFlag p -> XXPat p -> [IdP p] -> [IdP p]
collectXXHsBindsLR :: forall pR. CollectPass p => XXHsBindsLR p pR -> [IdP p] -> [IdP p]
-- | Indicate if evidence binders have to be collected.
--
-- This type is used as a boolean (should we collect evidence binders or
-- not?) but also to pass an evidence that the AST has been typechecked
-- when we do want to collect evidence binders, otherwise these binders
-- are not available.
--
-- See Note [Dictionary binders in ConPatOut]
data CollectFlag p
-- | Don't collect evidence binders
[CollNoDictBinders] :: CollectFlag p
-- | Collect evidence binders
[CollWithDictBinders] :: CollectFlag GhcTc
-- | Returns all the binding names of the decl. The first one is
-- guaranteed to be the name of the decl. The first component represents
-- all binding names except record fields; the second represents field
-- occurrences. For record fields mentioned in multiple constructors, the
-- SrcLoc will be from the first occurrence.
--
-- Each returned (Located name) has a SrcSpan for the whole
-- declaration. See Note [SrcSpan for binders]
hsLTyClDeclBinders :: IsPass p => LocatedA (TyClDecl (GhcPass p)) -> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsTyClForeignBinders :: [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name]
-- | Collects record pattern-synonym selectors only; the pattern synonym
-- names are collected by collectHsValBinders.
hsPatSynSelectors :: IsPass p => HsValBinds (GhcPass p) -> [FieldOcc (GhcPass p)]
getPatSynBinds :: forall id. UnXRec id => [(RecFlag, LHsBinds id)] -> [PatSynBind id id]
-- | See Note [SrcSpan for binders]
hsForeignDeclsBinders :: forall p a. (UnXRec (GhcPass p), IsSrcSpanAnn p a) => [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
hsGroupBinders :: HsGroup GhcRn -> [Name]
-- | the SrcLoc returned are for the whole declarations, not just
-- the names
hsDataFamInstBinders :: IsPass p => DataFamInstDecl (GhcPass p) -> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
lStmtsImplicits :: [LStmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))] -> [(SrcSpan, [Name])]
hsValBindsImplicits :: HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
lPatImplicits :: LPat GhcRn -> [(SrcSpan, [Name])]
instance GHC.Hs.Extension.IsPass p => GHC.Hs.Utils.CollectPass (GHC.Hs.Extension.GhcPass p)
-- | Handy functions for creating much Core syntax
module GHC.Core.Make
-- | Bind a binding group over an expression, using a let or
-- case as appropriate (see GHC.Core#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
--
-- Respects the let/app invariant by building a case expression where
-- necessary See Note [Core let/app invariant] in GHC.Core
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 Note [Core let/app invariant] in GHC.Core
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
-- | Make a case expression whose case binder is unused The alts and res_ty
-- should not have any occurrences of WildId
mkWildCase :: CoreExpr -> Scaled 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 GHC.Core.Opt.Simplify.Env
mkWildValBinder :: Mult -> Type -> Id
mkWildEvBinder :: PredType -> EvVar
mkSingleAltCase :: CoreExpr -> Id -> AltCon -> [Var] -> CoreExpr -> CoreExpr
-- | Sort the variables, putting type and covars first, in scoped order,
-- and then other Ids
--
-- It is a deterministic sort, meaining it doesn't look at the values of
-- Uniques. For explanation why it's important See Note [Unique
-- Determinism] in GHC.Types.Unique.
sortQuantVars :: [Var] -> [Var]
castBottomExpr :: CoreExpr -> Type -> CoreExpr
mkLitRubbish :: Type -> Maybe CoreExpr
-- | Create a CoreExpr which will evaluate to the a Word
-- with the given value
mkWordExpr :: Platform -> Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given Int
mkIntExpr :: Platform -> Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given Int
mkIntExprInt :: Platform -> Int -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Int. Don't check that the number is in the range of the
-- target platform Int
mkUncheckedIntExpr :: Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Integer
mkIntegerExpr :: Platform -> Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Natural
mkNaturalExpr :: Platform -> Integer -> 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 :: MkStringIds -> FastString -> CoreExpr
data MkStringIds
MkStringIds :: !Id -> !Id -> MkStringIds
[unpackCStringId] :: MkStringIds -> !Id
[unpackCStringUtf8Id] :: MkStringIds -> !Id
getMkStringIds :: Applicative m => (Name -> m Id) -> m MkStringIds
data FloatBind
FloatLet :: CoreBind -> FloatBind
FloatCase :: CoreExpr -> Id -> AltCon -> [Var] -> FloatBind
wrapFloat :: FloatBind -> CoreExpr -> CoreExpr
-- | Applies the floats from right to left. That is wrapFloats [b1, b2,
-- …, bn] u = let b1 in let b2 in … in let bn in u
wrapFloats :: [FloatBind] -> CoreExpr -> CoreExpr
floatBindings :: FloatBind -> [Var]
-- | 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
-- | Build an unboxed sum.
--
-- Alternative number ("alt") starts from 1.
mkCoreUbxSum :: Int -> Int -> [Type] -> CoreExpr -> CoreExpr
-- | Make a core tuple of the given boxity; don't flatten 1-tuples
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.
--
-- A tuple selector is not linear in its argument. Consequently, the case
-- expression built by mkTupleSelector must consume its scrutinee
-- Many times. And all the argument variables must have
-- multiplicity Many.
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.
--
-- A tuple selector is not linear in its argument. Consequently, the case
-- expression built by mkTupleSelector must consume its scrutinee
-- Many times. And all the argument variables must have
-- multiplicity Many.
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 :: (MonadFail m, MonadThings m, MonadUnique m) => Type -> ((Id, Type) -> (Id, Type) -> m CoreExpr) -> m CoreExpr
mkNonEmptyListExpr :: Type -> CoreExpr -> [CoreExpr] -> 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
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
aBSENT_SUM_FIELD_ERROR_ID :: Id
instance GHC.Utils.Outputable.Outputable GHC.Core.Make.FloatBind
module GHC.Core.SimpleOpt
-- | Simple optimiser options
data SimpleOpts
SimpleOpts :: !UnfoldingOpts -> !OptCoercionOpts -> SimpleOpts
-- | Unfolding options
[so_uf_opts] :: SimpleOpts -> !UnfoldingOpts
-- | Coercion optimiser options
[so_co_opts] :: SimpleOpts -> !OptCoercionOpts
-- | Default options for the Simple optimiser.
defaultSimpleOpts :: SimpleOpts
simpleOptPgm :: SimpleOpts -> Module -> CoreProgram -> [CoreRule] -> (CoreProgram, [CoreRule], CoreProgram)
simpleOptExpr :: HasDebugCallStack => SimpleOpts -> CoreExpr -> CoreExpr
simpleOptExprWith :: HasDebugCallStack => SimpleOpts -> 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 ([b1..bp], dc, [t1..tk], [x1..xn]) if the
-- argument expression is a *saturated* constructor application of the
-- form let b1 in .. let bp in dc t1..tk x1 .. xn, where t1..tk
-- are the *universally-quantified* type args of dc. Floats can
-- also be (and most likely are) single-alternative case expressions. Why
-- does exprIsConApp_maybe return floats? We may have to look
-- through lets and cases to detect that we are in the presence of a data
-- constructor wrapper. In this case, we need to return the lets and
-- cases that we traversed. See Note [exprIsConApp_maybe on data
-- constructors with wrappers]. Data constructor wrappers are unfolded
-- late, but we really want to trigger case-of-known-constructor as early
-- as possible. See also Note [Activation for data constructor wrappers]
-- in GHC.Types.Id.Make.
--
-- We also return the incoming InScopeSet, augmented with the binders
-- from any [FloatBind] that we return
exprIsConApp_maybe :: HasDebugCallStack => InScopeEnv -> CoreExpr -> Maybe (InScopeSet, [FloatBind], DataCon, [Type], [CoreExpr])
exprIsLiteral_maybe :: InScopeEnv -> CoreExpr -> Maybe Literal
exprIsLambda_maybe :: HasDebugCallStack => InScopeEnv -> CoreExpr -> Maybe (Var, CoreExpr, [CoreTickish])
instance GHC.Utils.Outputable.Outputable GHC.Core.SimpleOpt.SimpleOptEnv
module GHC.Types.Id.Make
mkDictFunId :: Name -> [TyVar] -> ThetaType -> Class -> [Type] -> Id
mkDictFunTy :: [TyVar] -> ThetaType -> Class -> [Type] -> Type
mkDictSelId :: Name -> Class -> Id
mkDictSelRhs :: Class -> Int -> CoreExpr
mkFCallId :: Unique -> ForeignCall -> Type -> Id
unwrapNewTypeBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
wrapFamInstBody :: TyCon -> [Type] -> CoreExpr -> CoreExpr
-- | Data Constructor Boxer
newtype DataConBoxer
DCB :: ([Type] -> [Var] -> UniqSM ([Var], [CoreBind])) -> DataConBoxer
vanillaDataConBoxer :: DataConBoxer
mkDataConRep :: DataConBangOpts -> FamInstEnvs -> Name -> DataCon -> UniqSM DataConRep
mkDataConWorkId :: Name -> DataCon -> Id
data DataConBangOpts
-- | Used for imported data constructors See Note [Bangs on imported data
-- constructors]
FixedBangOpts :: [HsImplBang] -> DataConBangOpts
SrcBangOpts :: !BangOpts -> DataConBangOpts
data BangOpts
BangOpts :: !Bool -> !Bool -> !Bool -> !Bool -> BangOpts
-- | Strict fields by default
[bang_opt_strict_data] :: BangOpts -> !Bool
-- | Disable automatic field unboxing (e.g. if we aren't optimising)
[bang_opt_unbox_disable] :: BangOpts -> !Bool
-- | Unbox strict fields
[bang_opt_unbox_strict] :: BangOpts -> !Bool
-- | Unbox small strict fields
[bang_opt_unbox_small] :: BangOpts -> !Bool
wiredInIds :: [Id]
ghcPrimIds :: [Id]
realWorldPrimId :: Id
voidPrimId :: Id
voidArgId :: Id
nullAddrId :: Id
seqId :: Id
lazyId :: Id
lazyIdKey :: Unique
coercionTokenId :: Id
coerceId :: Id
proxyHashId :: Id
noinlineId :: Id
noinlineIdName :: Name
coerceName :: Name
leftSectionName :: Name
rightSectionName :: Name
-- | Functions for converting Core things to interface file things.
module GHC.CoreToIface
toIfaceTvBndr :: TyVar -> IfaceTvBndr
toIfaceTvBndrs :: [TyVar] -> [IfaceTvBndr]
toIfaceIdBndr :: Id -> IfaceIdBndr
toIfaceBndr :: Var -> IfaceBndr
toIfaceForAllBndr :: VarBndr TyCoVar flag -> VarBndr IfaceBndr flag
toIfaceTyCoVarBinders :: [VarBndr Var vis] -> [VarBndr IfaceBndr vis]
toIfaceTyVar :: TyVar -> FastString
toIfaceType :: Type -> IfaceType
toIfaceTypeX :: VarSet -> Type -> IfaceType
toIfaceKind :: Type -> IfaceType
toIfaceTcArgs :: TyCon -> [Type] -> IfaceAppArgs
toIfaceTyCon :: TyCon -> IfaceTyCon
toIfaceTyCon_name :: Name -> IfaceTyCon
toIfaceTyLit :: TyLit -> IfaceTyLit
tidyToIfaceType :: TidyEnv -> Type -> IfaceType
tidyToIfaceContext :: TidyEnv -> ThetaType -> IfaceContext
tidyToIfaceTcArgs :: TidyEnv -> TyCon -> [Type] -> IfaceAppArgs
toIfaceCoercion :: Coercion -> IfaceCoercion
toIfaceCoercionX :: VarSet -> 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
toIfaceTickish :: CoreTickish -> Maybe IfaceTickish
toIfaceBind :: Bind Id -> IfaceBinding
toIfaceAlt :: CoreAlt -> IfaceAlt
toIfaceCon :: AltCon -> IfaceConAlt
toIfaceApp :: Expr CoreBndr -> [Arg CoreBndr] -> IfaceExpr
toIfaceVar :: Id -> IfaceExpr
toIfaceLFInfo :: Name -> LambdaFormInfo -> IfaceLFInfo
-- | Functions for collecting together and applying rewrite rules to a
-- module. The CoreRule datatype itself is declared elsewhere.
module GHC.Core.Rules
emptyRuleBase :: RuleBase
mkRuleBase :: [CoreRule] -> RuleBase
extendRuleBaseList :: RuleBase -> [CoreRule] -> RuleBase
pprRuleBase :: RuleBase -> SDoc
extendRuleEnv :: RuleEnv -> RuleBase -> RuleEnv
-- | Report partial matches for rules beginning with the specified string
-- for the purposes of error reporting
ruleCheckProgram :: RuleOpts -> CompilerPhase -> String -> (Id -> [CoreRule]) -> CoreProgram -> SDoc
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 :: [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 :: RuleOpts -> 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 GHC.Types.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]
-- | Initialize RuleOpts from DynFlags
initRuleOpts :: DynFlags -> RuleOpts
-- | Constant Folder
module GHC.Core.Opt.ConstantFold
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 :: Platform -> CoreExpr -> Maybe (CoreExpr, AltCon -> Maybe AltCon, Id -> CoreExpr)
instance GHC.Base.Functor GHC.Core.Opt.ConstantFold.RuleM
instance GHC.Base.Applicative GHC.Core.Opt.ConstantFold.RuleM
instance GHC.Base.Monad GHC.Core.Opt.ConstantFold.RuleM
instance Control.Monad.Fail.MonadFail GHC.Core.Opt.ConstantFold.RuleM
instance GHC.Base.Alternative GHC.Core.Opt.ConstantFold.RuleM
instance GHC.Base.MonadPlus GHC.Core.Opt.ConstantFold.RuleM
module GHC.Hs.Instances
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsLocalBindsLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsLocalBindsLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsLocalBindsLR GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsLocalBindsLR GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsValBindsLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsValBindsLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsValBindsLR GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsValBindsLR GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (GHC.Hs.Binds.NHsValBindsLR GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (GHC.Hs.Binds.NHsValBindsLR GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (GHC.Hs.Binds.NHsValBindsLR GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsBindLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsBindLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsBindLR GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsBindLR GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data GHC.Hs.Binds.AbsBinds
instance Data.Data.Data GHC.Hs.Binds.ABExport
instance Data.Data.Data (Language.Haskell.Syntax.Binds.RecordPatSynField GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.RecordPatSynField GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.RecordPatSynField GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.PatSynBind GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.PatSynBind GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.PatSynBind GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.PatSynBind GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsIPBinds GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsIPBinds GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsIPBinds GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.IPBind GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.IPBind GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.IPBind GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.Sig GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.Sig GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.Sig GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.FixitySig GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.FixitySig GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.FixitySig GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.StandaloneKindSig GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.StandaloneKindSig GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.StandaloneKindSig GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsPatSynDir GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsPatSynDir GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.HsPatSynDir GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsGroup GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsGroup GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsGroup GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.SpliceDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.SpliceDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.SpliceDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyClDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyClDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyClDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FunDep GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FunDep GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FunDep GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyClGroup GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyClGroup GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyClGroup GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyResultSig GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyResultSig GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyResultSig GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.InjectivityAnn GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.InjectivityAnn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.InjectivityAnn GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyInfo GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyInfo GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.FamilyInfo GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDataDefn GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDataDefn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDataDefn GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDerivingClause GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDerivingClause GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsDerivingClause GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivClauseTys GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivClauseTys GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivClauseTys GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ConDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ConDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ConDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsConDeclGADTDetails GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsConDeclGADTDetails GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.HsConDeclGADTDetails GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyFamInstDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyFamInstDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.TyFamInstDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DataFamInstDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DataFamInstDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DataFamInstDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data rhs => Data.Data.Data (Language.Haskell.Syntax.Decls.FamEqn GHC.Hs.Extension.GhcPs rhs)
instance Data.Data.Data rhs => Data.Data.Data (Language.Haskell.Syntax.Decls.FamEqn GHC.Hs.Extension.GhcRn rhs)
instance Data.Data.Data rhs => Data.Data.Data (Language.Haskell.Syntax.Decls.FamEqn GHC.Hs.Extension.GhcTc rhs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ClsInstDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ClsInstDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ClsInstDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.InstDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.InstDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.InstDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivStrategy GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivStrategy GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DerivStrategy GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DefaultDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DefaultDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.DefaultDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ForeignDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ForeignDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.ForeignDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleDecls GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleDecls GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleDecls GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleBndr GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleBndr GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RuleBndr GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.WarnDecls GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.WarnDecls GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.WarnDecls GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.WarnDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.WarnDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.WarnDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.AnnProvenance GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.AnnProvenance GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.AnnProvenance GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.AnnDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.AnnDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.AnnDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RoleAnnotDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RoleAnnotDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Decls.RoleAnnotDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.FieldLabelStrings GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.FieldLabelStrings GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.FieldLabelStrings GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.DotFieldOcc GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.DotFieldOcc GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.DotFieldOcc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsPragE GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsPragE GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsPragE GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsTupArg GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsTupArg GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsTupArg GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsCmdTop GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsCmdTop GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsCmdTop GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.MatchGroup GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.MatchGroup GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.MatchGroup GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.MatchGroup GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.MatchGroup GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.MatchGroup GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.Match GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.Match GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.Match GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.Match GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.Match GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.Match GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHSs GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHSs GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHSs GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHSs GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHSs GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHSs GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHS GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHS GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHS GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHS GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHS GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.GRHS GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcRn)))
instance Data.Data.Data (Language.Haskell.Syntax.Expr.StmtLR GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcTc)))
instance Data.Data.Data GHC.Hs.Expr.RecStmtTc
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ParStmtBlock GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ParStmtBlock GHC.Hs.Extension.GhcPs GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ParStmtBlock GHC.Hs.Extension.GhcRn GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ParStmtBlock GHC.Hs.Extension.GhcTc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ApplicativeArg GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ApplicativeArg GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ApplicativeArg GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsStmtContext GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsStmtContext GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsStmtContext GHC.Hs.Extension.GhcTc)
instance Data.Data.Data Language.Haskell.Syntax.Expr.HsArrowMatchContext
instance Data.Data.Data Language.Haskell.Syntax.Expr.HsDoFlavour
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsMatchContext GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsMatchContext GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsMatchContext GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsSplice GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsSplice GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsSplice GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsSplicedThing GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsSplicedThing GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsSplicedThing GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsQuote GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsQuote GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsQuote GHC.Hs.Extension.GhcTc)
instance Data.Data.Data GHC.Hs.Expr.HsBracketTc
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ArithSeqInfo GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ArithSeqInfo GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.ArithSeqInfo GHC.Hs.Extension.GhcTc)
instance Data.Data.Data GHC.Hs.Expr.RecordUpdTc
instance Data.Data.Data GHC.Hs.Expr.CmdTopTc
instance Data.Data.Data GHC.Hs.Expr.PendingRnSplice
instance Data.Data.Data GHC.Hs.Expr.PendingTcSplice
instance Data.Data.Data GHC.Hs.Expr.SyntaxExprRn
instance Data.Data.Data GHC.Hs.Expr.SyntaxExprTc
instance Data.Data.Data GHC.Hs.Expr.XBindStmtRn
instance Data.Data.Data GHC.Hs.Expr.XBindStmtTc
instance Data.Data.Data (Language.Haskell.Syntax.Lit.HsLit GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Lit.HsLit GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Lit.HsLit GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Lit.HsOverLit GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Lit.HsOverLit GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Lit.HsOverLit GHC.Hs.Extension.GhcTc)
instance Data.Data.Data GHC.Hs.Lit.OverLitRn
instance Data.Data.Data GHC.Hs.Lit.OverLitTc
instance Data.Data.Data (Language.Haskell.Syntax.Pat.Pat GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Pat.Pat GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Pat.Pat GHC.Hs.Extension.GhcTc)
instance Data.Data.Data GHC.Hs.Pat.ConPatTc
instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Language.Haskell.Syntax.Pat.HsFieldBind a b)
instance Data.Data.Data body => Data.Data.Data (Language.Haskell.Syntax.Pat.HsRecFields GHC.Hs.Extension.GhcPs body)
instance Data.Data.Data body => Data.Data.Data (Language.Haskell.Syntax.Pat.HsRecFields GHC.Hs.Extension.GhcRn body)
instance Data.Data.Data body => Data.Data.Data (Language.Haskell.Syntax.Pat.HsRecFields GHC.Hs.Extension.GhcTc body)
instance Data.Data.Data (Language.Haskell.Syntax.Type.LHsQTyVars GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.LHsQTyVars GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.LHsQTyVars GHC.Hs.Extension.GhcTc)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.Syntax.Type.HsOuterTyVarBndrs flag GHC.Hs.Extension.GhcPs)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.Syntax.Type.HsOuterTyVarBndrs flag GHC.Hs.Extension.GhcRn)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.Syntax.Type.HsOuterTyVarBndrs flag GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsSigType GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsSigType GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsSigType GHC.Hs.Extension.GhcTc)
instance Data.Data.Data thing => Data.Data.Data (Language.Haskell.Syntax.Type.HsWildCardBndrs GHC.Hs.Extension.GhcPs thing)
instance Data.Data.Data thing => Data.Data.Data (Language.Haskell.Syntax.Type.HsWildCardBndrs GHC.Hs.Extension.GhcRn thing)
instance Data.Data.Data thing => Data.Data.Data (Language.Haskell.Syntax.Type.HsWildCardBndrs GHC.Hs.Extension.GhcTc thing)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsPatSigType GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsPatSigType GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsPatSigType GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsForAllTelescope GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsForAllTelescope GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsForAllTelescope GHC.Hs.Extension.GhcTc)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.Syntax.Type.HsTyVarBndr flag GHC.Hs.Extension.GhcPs)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.Syntax.Type.HsTyVarBndr flag GHC.Hs.Extension.GhcRn)
instance Data.Data.Data flag => Data.Data.Data (Language.Haskell.Syntax.Type.HsTyVarBndr flag GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsType GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsType GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsType GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsLinearArrowTokens GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsLinearArrowTokens GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsLinearArrowTokens GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsArrow GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsArrow GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.HsArrow GHC.Hs.Extension.GhcTc)
instance Data.Data.Data thing => Data.Data.Data (Language.Haskell.Syntax.Type.HsScaled GHC.Hs.Extension.GhcPs thing)
instance Data.Data.Data thing => Data.Data.Data (Language.Haskell.Syntax.Type.HsScaled GHC.Hs.Extension.GhcRn thing)
instance Data.Data.Data thing => Data.Data.Data (Language.Haskell.Syntax.Type.HsScaled GHC.Hs.Extension.GhcTc thing)
instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Language.Haskell.Syntax.Type.HsArg a b)
instance Data.Data.Data (Language.Haskell.Syntax.Type.ConDeclField GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.ConDeclField GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.ConDeclField GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.FieldOcc GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.FieldOcc GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.FieldOcc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (Language.Haskell.Syntax.Type.AmbiguousFieldOcc GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Type.AmbiguousFieldOcc GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Type.AmbiguousFieldOcc GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (GHC.Hs.ImpExp.ImportDecl GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (GHC.Hs.ImpExp.ImportDecl GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (GHC.Hs.ImpExp.ImportDecl GHC.Hs.Extension.GhcTc)
instance Data.Data.Data (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcTc)
instance GHC.Classes.Eq (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcPs)
instance GHC.Classes.Eq (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcRn)
instance GHC.Classes.Eq (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcTc)
instance Data.Data.Data GHC.Hs.Expr.XXExprGhcTc
instance Data.Data.Data GHC.Hs.Pat.XXPatGhcTc
instance Data.Data.Data GHC.Hs.Decls.XViaStrategyPs
module GHC.Hs
data Fixity
-- | Haskell Module
--
-- All we actually declare here is the top-level structure for a module.
data HsModule
-- | AnnKeywordIds
--
--
HsModule :: EpAnn AnnsModule -> LayoutInfo -> Maybe (LocatedA ModuleName) -> Maybe (LocatedL [LIE GhcPs]) -> [LImportDecl GhcPs] -> [LHsDecl GhcPs] -> Maybe (LocatedP (WarningTxt GhcPs)) -> Maybe (LHsDoc GhcPs) -> HsModule
[hsmodAnn] :: HsModule -> EpAnn AnnsModule
-- | Layout info for the module. For incomplete modules (e.g. the output of
-- parseHeader), it is NoLayoutInfo.
[hsmodLayout] :: HsModule -> LayoutInfo
-- | Nothing: "module X where" is omitted (in which case the next
-- field is Nothing too)
[hsmodName] :: HsModule -> Maybe (LocatedA ModuleName)
-- | Export list
--
--
-- - Nothing: export list omitted, so export everything
-- - Just []: export nothing
-- - Just [...]: as you would expect...
-- - AnnKeywordIds : AnnOpen ,AnnClose
--
[hsmodExports] :: HsModule -> Maybe (LocatedL [LIE GhcPs])
-- | 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 -> [LImportDecl GhcPs]
-- | Type, class, value, and interface signature decls
[hsmodDecls] :: HsModule -> [LHsDecl GhcPs]
-- | reason/explanation for warning/deprecation of this module
--
--
[hsmodDeprecMessage] :: HsModule -> Maybe (LocatedP (WarningTxt GhcPs))
-- | Haddock module info and description, unparsed
--
--
[hsmodHaddockModHeader] :: HsModule -> Maybe (LHsDoc GhcPs)
data AnnsModule
AnnsModule :: [AddEpAnn] -> AnnList -> AnnsModule
[am_main] :: AnnsModule -> [AddEpAnn]
[am_decls] :: AnnsModule -> AnnList
data HsParsedModule
HsParsedModule :: Located HsModule -> [FilePath] -> HsParsedModule
[hpm_module] :: HsParsedModule -> Located HsModule
-- | 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]
instance GHC.Classes.Eq GHC.Hs.AnnsModule
instance Data.Data.Data GHC.Hs.AnnsModule
instance Data.Data.Data GHC.Hs.HsModule
instance GHC.Utils.Outputable.Outputable GHC.Hs.HsModule
-- | A ModSummary is a node in the compilation manager's dependency graph
-- (ModuleGraph)
module GHC.Unit.Module.ModSummary
-- | Data for a module node in a ModuleGraph. Module nodes of the
-- module graph are one of:
--
--
-- - A regular Haskell source module
-- - A hi-boot source module
--
data ModSummary
ModSummary :: Module -> HscSource -> ModLocation -> Fingerprint -> Maybe UTCTime -> !Maybe UTCTime -> Maybe UTCTime -> Maybe UTCTime -> [(PkgQual, Located ModuleName)] -> [(PkgQual, Located ModuleName)] -> !Bool -> Maybe HsParsedModule -> FilePath -> DynFlags -> Maybe StringBuffer -> ModSummary
-- | Identity of the module
[ms_mod] :: ModSummary -> Module
-- | The module source either plain Haskell, hs-boot, or hsig
[ms_hsc_src] :: ModSummary -> HscSource
-- | Location of the various files belonging to the module
[ms_location] :: ModSummary -> ModLocation
-- | Content hash of source file
[ms_hs_hash] :: ModSummary -> Fingerprint
-- | Timestamp of object, if we have one
[ms_obj_date] :: ModSummary -> Maybe UTCTime
-- | Timestamp of dynamic object, if we have one
[ms_dyn_obj_date] :: ModSummary -> !Maybe UTCTime
-- | Timestamp of hi file, if we have one See Note [When source is
-- considered modified] and #9243
[ms_iface_date] :: ModSummary -> Maybe UTCTime
-- | Timestamp of hie file, if we have one
[ms_hie_date] :: ModSummary -> Maybe UTCTime
-- | Source imports of the module
[ms_srcimps] :: ModSummary -> [(PkgQual, Located ModuleName)]
-- | Non-source imports of the module from the module *text*
[ms_textual_imps] :: ModSummary -> [(PkgQual, Located ModuleName)]
-- | Whether the special module GHC.Prim was imported explicitliy
[ms_ghc_prim_import] :: ModSummary -> !Bool
-- | 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_unitid :: ModSummary -> UnitId
ms_installed_mod :: ModSummary -> InstalledModule
ms_mod_name :: ModSummary -> ModuleName
-- | Textual imports, plus plugin imports but not SOURCE imports.
ms_imps :: ModSummary -> [(PkgQual, Located ModuleName)]
-- | Plugin imports
ms_plugin_imps :: ModSummary -> [(PkgQual, Located ModuleName)]
ms_mnwib :: ModSummary -> ModuleNameWithIsBoot
-- | 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 -> [(PkgQual, Located ModuleName)]
msHiFilePath :: ModSummary -> FilePath
msDynHiFilePath :: ModSummary -> FilePath
msHsFilePath :: ModSummary -> FilePath
msObjFilePath :: ModSummary -> FilePath
msDynObjFilePath :: ModSummary -> FilePath
-- | Returns the dependencies of the ModSummary s.
msDeps :: ModSummary -> [(PkgQual, GenWithIsBoot (Located ModuleName))]
-- | Did this ModSummary originate from a hs-boot file?
isBootSummary :: ModSummary -> IsBootInterface
-- | Find the first target in the provided list which matches the specified
-- ModSummary.
findTarget :: ModSummary -> [Target] -> Maybe Target
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.ModSummary.ModSummary
module GHC.Unit.Module.Graph
-- | A 'ModuleGraph' contains all the nodes from the home package
-- (only). See 'ModuleGraphNode' for information about the
-- nodes.
--
-- Modules need to be compiled. hs-boots need to be typechecked before
-- the associated "real" module so modules with {--} imports can be
-- built. Instantiations also need to be typechecked to ensure that the
-- module fits the signature. Substantiation typechecking is roughly
-- comparable to the check that the module and its hs-boot agree.
--
-- The graph is not necessarily stored in topologically-sorted order. Use
-- topSortModuleGraph and flattenSCC to achieve this.
data ModuleGraph
-- | A 'ModuleGraphNode' is a node in the 'ModuleGraph'.
-- Edges between nodes mark dependencies arising from module imports and
-- dependencies arising from backpack instantiations.
data ModuleGraphNode
-- | Instantiation nodes track the instantiation of other units (backpack
-- dependencies) with the holes (signatures) of the current package.
InstantiationNode :: UnitId -> InstantiatedUnit -> ModuleGraphNode
-- | There is a module summary node for each module, signature, and boot
-- module being built.
ModuleNode :: [NodeKey] -> ModSummary -> ModuleGraphNode
-- | Link nodes are whether are are creating a linked product (ie
-- executable/shared object etc) for a unit.
LinkNode :: [NodeKey] -> UnitId -> ModuleGraphNode
-- | Collect the immediate dependencies of a ModuleGraphNode, optionally
-- avoiding hs-boot dependencies. If the drop_hs_boot_nodes flag is
-- False, and if this is a .hs and there is an equivalent .hs-boot, add a
-- link from the former to the latter. This has the effect of detecting
-- bogus cases where the .hs-boot depends on the .hs, by introducing a
-- cycle. Additionally, it ensures that we will always process the
-- .hs-boot before the .hs, and so the HomePackageTable will always have
-- the most up to date information.
nodeDependencies :: Bool -> ModuleGraphNode -> [NodeKey]
emptyMG :: ModuleGraph
mkModuleGraph :: [ModuleGraphNode] -> ModuleGraph
-- | Add an ExtendedModSummary to ModuleGraph. Assumes that the new
-- ModSummary is not an element of the ModuleGraph.
extendMG :: ModuleGraph -> [NodeKey] -> ModSummary -> ModuleGraph
extendMGInst :: ModuleGraph -> UnitId -> InstantiatedUnit -> ModuleGraph
extendMG' :: ModuleGraph -> ModuleGraphNode -> ModuleGraph
isTemplateHaskellOrQQNonBoot :: ModSummary -> Bool
-- | This function filters out all the instantiation nodes from each SCC of
-- a topological sort. Use this with care, as the resulting "strongly
-- connected components" may not really be strongly connected in a direct
-- way, as instantiations have been removed. It would probably be best to
-- eliminate uses of this function where possible.
filterToposortToModules :: [SCC ModuleGraphNode] -> [SCC ModSummary]
-- | Map a function f over all the ModSummaries. To
-- preserve invariants f can't change the isBoot status.
mapMG :: (ModSummary -> ModSummary) -> ModuleGraph -> ModuleGraph
mgModSummaries :: ModuleGraph -> [ModSummary]
mgModSummaries' :: ModuleGraph -> [ModuleGraphNode]
-- | Look up a ModSummary in the ModuleGraph
mgLookupModule :: ModuleGraph -> Module -> Maybe ModSummary
mgTransDeps :: ModuleGraph -> Map NodeKey (Set NodeKey)
showModMsg :: DynFlags -> Bool -> ModuleGraphNode -> SDoc
moduleGraphNodeModule :: ModuleGraphNode -> Maybe ModuleName
moduleGraphNodeModSum :: ModuleGraphNode -> Maybe ModSummary
-- | Turn a list of graph nodes into an efficient queriable graph. The
-- first boolean parameter indicates whether nodes corresponding to
-- hs-boot files should be collapsed into their relevant hs nodes.
moduleGraphNodes :: Bool -> [ModuleGraphNode] -> (Graph SummaryNode, NodeKey -> Maybe SummaryNode)
type SummaryNode = Node Int ModuleGraphNode
summaryNodeSummary :: SummaryNode -> ModuleGraphNode
data NodeKey
NodeKey_Unit :: {-# UNPACK #-} !InstantiatedUnit -> NodeKey
NodeKey_Module :: {-# UNPACK #-} !ModNodeKeyWithUid -> NodeKey
NodeKey_Link :: !UnitId -> NodeKey
type ModNodeKey = ModuleNameWithIsBoot
mkNodeKey :: ModuleGraphNode -> NodeKey
msKey :: ModSummary -> ModNodeKeyWithUid
moduleGraphNodeUnitId :: ModuleGraphNode -> UnitId
data ModNodeKeyWithUid
ModNodeKeyWithUid :: ModuleNameWithIsBoot -> UnitId -> ModNodeKeyWithUid
[mnkModuleName] :: ModNodeKeyWithUid -> ModuleNameWithIsBoot
[mnkUnitId] :: ModNodeKeyWithUid -> UnitId
instance GHC.Classes.Ord GHC.Unit.Module.Graph.ModNodeKeyWithUid
instance GHC.Classes.Eq GHC.Unit.Module.Graph.ModNodeKeyWithUid
instance GHC.Classes.Ord GHC.Unit.Module.Graph.NodeKey
instance GHC.Classes.Eq GHC.Unit.Module.Graph.NodeKey
instance Data.Foldable.Foldable GHC.Unit.Module.Graph.NodeMap
instance Data.Traversable.Traversable GHC.Unit.Module.Graph.NodeMap
instance GHC.Base.Functor GHC.Unit.Module.Graph.NodeMap
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Graph.ModuleGraphNode
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Graph.NodeKey
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Graph.ModNodeKeyWithUid
module GHC.Unit.Module.ModIface
type ModIface = ModIface_ 'ModIfaceFinal
-- | 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.
--
-- See Note [Strictness in ModIface] to learn about why some fields are
-- strict and others are not.
data ModIface_ (phase :: ModIfacePhase)
ModIface :: !Module -> !Maybe Module -> !HscSource -> Dependencies -> [Usage] -> ![IfaceExport] -> !Bool -> [(OccName, Fixity)] -> Warnings GhcRn -> [IfaceAnnotation] -> [IfaceDeclExts phase] -> !Maybe GlobalRdrEnv -> [IfaceClsInst] -> [IfaceFamInst] -> [IfaceRule] -> !AnyHpcUsage -> !IfaceTrustInfo -> !Bool -> ![IfaceCompleteMatch] -> Maybe Docs -> !IfaceBackendExts phase -> !ExtensibleFields -> !Fingerprint -> ModIface_ (phase :: ModIfacePhase)
-- | Name of the module we are for
[mi_module] :: ModIface_ (phase :: ModIfacePhase) -> !Module
-- | Are we a sig of another mod?
[mi_sig_of] :: ModIface_ (phase :: ModIfacePhase) -> !Maybe Module
-- | Boot? Signature?
[mi_hsc_src] :: ModIface_ (phase :: ModIfacePhase) -> !HscSource
-- | The dependencies of the module. This is consulted for
-- directly-imported modules, but not for anything else (hence lazy)
[mi_deps] :: ModIface_ (phase :: ModIfacePhase) -> 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_ (phase :: ModIfacePhase) -> [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_ (phase :: ModIfacePhase) -> ![IfaceExport]
-- | Module required TH splices when it was compiled. This disables
-- recompilation avoidance (see #481).
[mi_used_th] :: ModIface_ (phase :: ModIfacePhase) -> !Bool
-- | Fixities NOT STRICT! we read this field lazily from the interface file
[mi_fixities] :: ModIface_ (phase :: ModIfacePhase) -> [(OccName, Fixity)]
-- | Warnings NOT STRICT! we read this field lazily from the interface file
[mi_warns] :: ModIface_ (phase :: ModIfacePhase) -> Warnings GhcRn
-- | Annotations NOT STRICT! we read this field lazily from the interface
-- file
[mi_anns] :: ModIface_ (phase :: ModIfacePhase) -> [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_ (phase :: ModIfacePhase) -> [IfaceDeclExts phase]
-- | 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_ (phase :: ModIfacePhase) -> !Maybe GlobalRdrEnv
-- | Sorted class instance
[mi_insts] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceClsInst]
-- | Sorted family instances
[mi_fam_insts] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceFamInst]
-- | Sorted rules
[mi_rules] :: ModIface_ (phase :: ModIfacePhase) -> [IfaceRule]
-- | True if this program uses Hpc at any point in the program.
[mi_hpc] :: ModIface_ (phase :: ModIfacePhase) -> !AnyHpcUsage
-- | Safe Haskell Trust information for this module.
[mi_trust] :: ModIface_ (phase :: ModIfacePhase) -> !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 [Trust Own Package] in GHC.Rename.Names
[mi_trust_pkg] :: ModIface_ (phase :: ModIfacePhase) -> !Bool
[mi_complete_matches] :: ModIface_ (phase :: ModIfacePhase) -> ![IfaceCompleteMatch]
-- | Docstrings and related data for use by haddock, the ghci :doc
-- command, and other tools.
--
-- Just _ = the module was built with
-- -haddock.
[mi_docs] :: ModIface_ (phase :: ModIfacePhase) -> Maybe Docs
-- | Either () or ModIfaceBackend for a fully instantiated
-- interface.
[mi_final_exts] :: ModIface_ (phase :: ModIfacePhase) -> !IfaceBackendExts phase
-- | Additional optional fields, where the Map key represents the field
-- name, resulting in a (size, serialized data) pair. Because the data is
-- intended to be serialized through the internal Binary class
-- (increasing compatibility with types using Name and
-- FastString, such as HIE), this format is chosen over
-- ByteStrings.
[mi_ext_fields] :: ModIface_ (phase :: ModIfacePhase) -> !ExtensibleFields
-- | Hash of the .hs source, used for recompilation checking.
[mi_src_hash] :: ModIface_ (phase :: ModIfacePhase) -> !Fingerprint
type PartialModIface = ModIface_ 'ModIfaceCore
-- | Extends a PartialModIface with information which is either: * Computed
-- after codegen * Or computed just before writing the iface to disk.
-- (Hashes) In order to fully instantiate it.
data ModIfaceBackend
ModIfaceBackend :: !Fingerprint -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !Fingerprint -> !WhetherHasOrphans -> !WhetherHasFamInst -> !Fingerprint -> !Fingerprint -> !OccName -> Maybe (WarningTxt GhcRn) -> !OccName -> Maybe Fixity -> !OccName -> Maybe (OccName, Fingerprint) -> ModIfaceBackend
-- | Hash of the whole interface
[mi_iface_hash] :: ModIfaceBackend -> !Fingerprint
-- | Hash of the ABI only
[mi_mod_hash] :: ModIfaceBackend -> !Fingerprint
-- | Hash of the important flags used when compiling the module, excluding
-- optimisation flags
[mi_flag_hash] :: ModIfaceBackend -> !Fingerprint
-- | Hash of optimisation flags
[mi_opt_hash] :: ModIfaceBackend -> !Fingerprint
-- | Hash of hpc flags
[mi_hpc_hash] :: ModIfaceBackend -> !Fingerprint
-- | Hash of plugins
[mi_plugin_hash] :: ModIfaceBackend -> !Fingerprint
-- | Whether this module has orphans
[mi_orphan] :: ModIfaceBackend -> !WhetherHasOrphans
-- | Whether this module has family instances. See Note [The type family
-- instance consistency story].
[mi_finsts] :: ModIfaceBackend -> !WhetherHasFamInst
-- | Hash of export list
[mi_exp_hash] :: ModIfaceBackend -> !Fingerprint
-- | Hash for orphan rules, class and family instances combined
[mi_orphan_hash] :: ModIfaceBackend -> !Fingerprint
-- | Cached lookup for mi_warns
[mi_warn_fn] :: ModIfaceBackend -> !OccName -> Maybe (WarningTxt GhcRn)
-- | Cached lookup for mi_fixities
[mi_fix_fn] :: ModIfaceBackend -> !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] :: ModIfaceBackend -> !OccName -> Maybe (OccName, Fingerprint)
-- | Selects a IfaceDecl representation. For fully instantiated interfaces
-- we also maintain a fingerprint, which is used for recompilation
-- checks.
type family IfaceDeclExts (phase :: ModIfacePhase)
type family IfaceBackendExts (phase :: ModIfacePhase)
-- | The original names declared of a certain module that are exported
type IfaceExport = AvailInfo
-- | 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 rewrite rule in a module other than the one defining the
-- function in the head of the rule
--
type WhetherHasOrphans = Bool
-- | Does this module define family instances?
type WhetherHasFamInst = Bool
-- | Old-style accessor for whether or not the ModIface came from an
-- hs-boot file.
mi_boot :: ModIface -> IsBootInterface
-- | 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_ a -> Module
-- | The "precise" free holes, e.g., the signatures that this
-- ModIface depends on.
mi_free_holes :: ModIface -> UniqDSet ModuleName
mi_mnwib :: ModIface -> ModuleNameWithIsBoot
-- | 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
emptyPartialModIface :: Module -> PartialModIface
emptyFullModIface :: Module -> ModIface
-- | Constructs cache for the mi_hash_fn field of a ModIface
mkIfaceHashCache :: [(Fingerprint, IfaceDecl)] -> OccName -> Maybe (OccName, Fingerprint)
emptyIfaceHashCache :: OccName -> Maybe (OccName, Fingerprint)
forceModIface :: ModIface -> IO ()
instance GHC.Utils.Binary.Binary GHC.Unit.Module.ModIface.ModIface
instance (Control.DeepSeq.NFData (GHC.Unit.Module.ModIface.IfaceBackendExts phase), Control.DeepSeq.NFData (GHC.Unit.Module.ModIface.IfaceDeclExts phase)) => Control.DeepSeq.NFData (GHC.Unit.Module.ModIface.ModIface_ phase)
instance Control.DeepSeq.NFData GHC.Unit.Module.ModIface.ModIfaceBackend
-- | Info about modules in the "home" unit
module GHC.Unit.Home.ModInfo
-- | 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
-- | Helps us find information about modules in the home package
type HomePackageTable = DModuleNameEnv HomeModInfo
-- | Constructs an empty HomePackageTable
emptyHomePackageTable :: HomePackageTable
lookupHpt :: HomePackageTable -> ModuleName -> Maybe HomeModInfo
eltsHpt :: HomePackageTable -> [HomeModInfo]
filterHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> HomePackageTable
allHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> Bool
anyHpt :: (HomeModInfo -> Bool) -> HomePackageTable -> Bool
mapHpt :: (HomeModInfo -> HomeModInfo) -> HomePackageTable -> HomePackageTable
delFromHpt :: HomePackageTable -> ModuleName -> HomePackageTable
addToHpt :: HomePackageTable -> ModuleName -> HomeModInfo -> HomePackageTable
addHomeModInfoToHpt :: HomeModInfo -> HomePackageTable -> HomePackageTable
addListToHpt :: HomePackageTable -> [(ModuleName, HomeModInfo)] -> HomePackageTable
lookupHptDirectly :: HomePackageTable -> Unique -> Maybe HomeModInfo
lookupHptByModule :: HomePackageTable -> Module -> Maybe HomeModInfo
listToHpt :: [(ModuleName, HomeModInfo)] -> HomePackageTable
listHMIToHpt :: [HomeModInfo] -> HomePackageTable
pprHPT :: HomePackageTable -> SDoc
module GHC.Unit.External
-- | Information about the currently loaded external packages. This is
-- mutable because packages will be demand-loaded during a compilation
-- run as required.
newtype ExternalUnitCache
ExternalUnitCache :: IORef ExternalPackageState -> ExternalUnitCache
[euc_eps] :: ExternalUnitCache -> IORef ExternalPackageState
initExternalUnitCache :: IO ExternalUnitCache
-- | Information about other packages that we have slurped in by reading
-- their interface files
data ExternalPackageState
EPS :: !InstalledModuleEnv ModuleNameWithIsBoot -> !PackageIfaceTable -> InstalledModuleEnv (UniqDSet ModuleName) -> !PackageTypeEnv -> !PackageInstEnv -> !PackageFamInstEnv -> !PackageRuleBase -> !PackageAnnEnv -> !PackageCompleteMatches -> !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 -> !InstalledModuleEnv ModuleNameWithIsBoot
-- | 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 AnnEnv accumulated from all the external-package
-- modules
[eps_ann_env] :: ExternalPackageState -> !PackageAnnEnv
-- | The total CompleteMatches accumulated from all the
-- external-package modules
[eps_complete_matches] :: ExternalPackageState -> !PackageCompleteMatches
-- | 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
initExternalPackageState :: ExternalPackageState
-- | 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
type PackageInstEnv = InstEnv
type PackageFamInstEnv = FamInstEnv
type PackageRuleBase = RuleBase
type PackageCompleteMatches = CompleteMatches
-- | Constructs an empty PackageIfaceTable
emptyPackageIfaceTable :: PackageIfaceTable
module GHC.Unit.Env
data UnitEnv
UnitEnv :: {-# UNPACK #-} !ExternalUnitCache -> UnitId -> !HomeUnitGraph -> !Platform -> !GhcNameVersion -> UnitEnv
-- | Information about the currently loaded external packages. This is
-- mutable because packages will be demand-loaded during a compilation
-- run as required.
[ue_eps] :: UnitEnv -> {-# UNPACK #-} !ExternalUnitCache
[ue_current_unit] :: UnitEnv -> UnitId
[ue_home_unit_graph] :: UnitEnv -> !HomeUnitGraph
-- | Platform
[ue_platform] :: UnitEnv -> !Platform
-- | GHC name/version (used for dynamic library suffix)
[ue_namever] :: UnitEnv -> !GhcNameVersion
initUnitEnv :: UnitId -> HomeUnitGraph -> GhcNameVersion -> Platform -> IO UnitEnv
-- | Get home-unit
--
-- Unsafe because the home-unit may not be set
unsafeGetHomeUnit :: UnitEnv -> HomeUnit
updateHug :: (HomeUnitGraph -> HomeUnitGraph) -> UnitEnv -> UnitEnv
updateHpt :: (HomePackageTable -> HomePackageTable) -> UnitEnv -> UnitEnv
ue_units :: HasDebugCallStack => UnitEnv -> UnitState
ue_currentHomeUnitEnv :: HasDebugCallStack => UnitEnv -> HomeUnitEnv
ue_setUnits :: UnitState -> UnitEnv -> UnitEnv
ue_setUnitFlags :: HasDebugCallStack => UnitId -> DynFlags -> UnitEnv -> UnitEnv
ue_unit_dbs :: UnitEnv -> Maybe [UnitDatabase UnitId]
ue_setUnitDbs :: Maybe [UnitDatabase UnitId] -> UnitEnv -> UnitEnv
ue_hpt :: HasDebugCallStack => UnitEnv -> HomePackageTable
ue_homeUnit :: UnitEnv -> Maybe HomeUnit
ue_unsafeHomeUnit :: UnitEnv -> HomeUnit
ue_setFlags :: HasDebugCallStack => DynFlags -> UnitEnv -> UnitEnv
ue_setActiveUnit :: UnitId -> UnitEnv -> UnitEnv
ue_currentUnit :: UnitEnv -> UnitId
ue_findHomeUnitEnv :: HasDebugCallStack => UnitId -> UnitEnv -> HomeUnitEnv
ue_updateHomeUnitEnv :: (HomeUnitEnv -> HomeUnitEnv) -> UnitId -> UnitEnv -> UnitEnv
ue_unitHomeUnit :: UnitId -> UnitEnv -> HomeUnit
ue_unitFlags :: HasDebugCallStack => UnitId -> UnitEnv -> DynFlags
-- | Rename a unit id in the internal unit env.
--
-- ue_renameUnitId oldUnit newUnit UnitEnv, it is assumed
-- that the oldUnit exists in the map, otherwise we panic. The
-- DynFlags associated with the home unit will have its field
-- homeUnitId set to newUnit.
ue_renameUnitId :: HasDebugCallStack => UnitId -> UnitId -> UnitEnv -> UnitEnv
ue_transitiveHomeDeps :: UnitId -> UnitEnv -> [UnitId]
type HomeUnitGraph = UnitEnvGraph HomeUnitEnv
data HomeUnitEnv
HomeUnitEnv :: !UnitState -> !Maybe [UnitDatabase UnitId] -> DynFlags -> HomePackageTable -> !Maybe HomeUnit -> HomeUnitEnv
-- | External units
[homeUnitEnv_units] :: HomeUnitEnv -> !UnitState
-- | Stack of unit databases for the target platform.
--
-- This field is populated with the result of initUnits.
--
-- Nothing means the databases have never been read from disk.
--
-- Usually we don't reload the databases from disk if they are cached,
-- even if the database flags changed!
[homeUnitEnv_unit_dbs] :: HomeUnitEnv -> !Maybe [UnitDatabase UnitId]
-- | The dynamic flag settings
[homeUnitEnv_dflags] :: HomeUnitEnv -> DynFlags
-- | 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
-- homeUnitEnv_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.)
--
-- homeUnitEnv_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.)
[homeUnitEnv_hpt] :: HomeUnitEnv -> HomePackageTable
-- | Home-unit
[homeUnitEnv_home_unit] :: HomeUnitEnv -> !Maybe HomeUnit
mkHomeUnitEnv :: DynFlags -> HomePackageTable -> Maybe HomeUnit -> HomeUnitEnv
lookupHugByModule :: Module -> HomeUnitGraph -> Maybe HomeModInfo
hugElts :: HomeUnitGraph -> [(UnitId, HomeUnitEnv)]
lookupHug :: HomeUnitGraph -> UnitId -> ModuleName -> Maybe HomeModInfo
addHomeModInfoToHug :: HomeModInfo -> HomeUnitGraph -> HomeUnitGraph
newtype UnitEnvGraph v
UnitEnvGraph :: Map UnitEnvGraphKey v -> UnitEnvGraph v
[unitEnv_graph] :: UnitEnvGraph v -> Map UnitEnvGraphKey v
unitEnv_insert :: UnitEnvGraphKey -> v -> UnitEnvGraph v -> UnitEnvGraph v
unitEnv_delete :: UnitEnvGraphKey -> UnitEnvGraph v -> UnitEnvGraph v
unitEnv_adjust :: (v -> v) -> UnitEnvGraphKey -> UnitEnvGraph v -> UnitEnvGraph v
unitEnv_new :: Map UnitEnvGraphKey v -> UnitEnvGraph v
unitEnv_singleton :: UnitEnvGraphKey -> v -> UnitEnvGraph v
unitEnv_map :: (v -> v) -> UnitEnvGraph v -> UnitEnvGraph v
unitEnv_member :: UnitEnvGraphKey -> UnitEnvGraph v -> Bool
unitEnv_lookup_maybe :: UnitEnvGraphKey -> UnitEnvGraph v -> Maybe v
unitEnv_lookup :: UnitEnvGraphKey -> UnitEnvGraph v -> v
unitEnv_keys :: UnitEnvGraph v -> Set UnitEnvGraphKey
unitEnv_elts :: UnitEnvGraph v -> [(UnitEnvGraphKey, v)]
unitEnv_hpts :: UnitEnvGraph HomeUnitEnv -> [HomePackageTable]
unitEnv_foldWithKey :: (b -> UnitEnvGraphKey -> a -> b) -> b -> UnitEnvGraph a -> b
unitEnv_mapWithKey :: (UnitEnvGraphKey -> v -> b) -> UnitEnvGraph v -> UnitEnvGraph b
assertUnitEnvInvariant :: HasDebugCallStack => UnitEnv -> UnitEnv
-- | Lookup UnitInfo for every preload unit from the UnitState and
-- for every unit used to instantiate the home unit.
preloadUnitsInfo :: UnitEnv -> MaybeErr UnitErr [UnitInfo]
-- | Lookup UnitInfo for every preload unit from the UnitState, for
-- every unit used to instantiate the home unit, and for every unit
-- explicitly passed in the given list of UnitId.
preloadUnitsInfo' :: UnitEnv -> [UnitId] -> MaybeErr UnitErr [UnitInfo]
-- | Test if the module comes from the home unit
isUnitEnvInstalledModule :: UnitEnv -> InstalledModule -> Bool
instance Data.Traversable.Traversable GHC.Unit.Env.UnitEnvGraph
instance Data.Foldable.Foldable GHC.Unit.Env.UnitEnvGraph
instance GHC.Base.Functor GHC.Unit.Env.UnitEnvGraph
instance GHC.Utils.Outputable.Outputable (GHC.Unit.Env.UnitEnvGraph GHC.Unit.Env.HomeUnitEnv)
instance GHC.Utils.Outputable.Outputable GHC.Unit.Env.HomeUnitEnv
module GHC.Types.Name.Ppr
-- | Creates some functions that work out the best ways to format names for
-- the user according to a set of heuristics.
mkPrintUnqualified :: UnitEnv -> GlobalRdrEnv -> PrintUnqualified
-- | 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 :: UnitState -> Maybe HomeUnit -> QueryQualifyModule
-- | 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 :: UnitState -> QueryQualifyPackage
-- | A function which only qualifies package names if necessary; but
-- qualifies all other identifiers.
pkgQual :: UnitState -> PrintUnqualified
module GHC.Unit.Module.ModGuts
-- | 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, FilePath)] -> !Warnings GhcRn -> [Annotation] -> [CompleteMatch] -> !HpcInfo -> !Maybe ModBreaks -> InstEnv -> FamInstEnv -> !NameSet -> SafeHaskellMode -> Bool -> !Maybe Docs -> 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 GHC.Core.Rules
[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, FilePath)]
-- | Warnings declared in the module
[mg_warns] :: ModGuts -> !Warnings GhcRn
-- | Annotations declared in this module
[mg_anns] :: ModGuts -> [Annotation]
-- | Complete Matches
[mg_complete_matches] :: ModGuts -> [CompleteMatch]
-- | Coverage tick boxes in the module
[mg_hpc_info] :: ModGuts -> !HpcInfo
-- | Breakpoints for the module
[mg_modBreaks] :: ModGuts -> !Maybe ModBreaks
-- | 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
[mg_boot_exports] :: ModGuts -> !NameSet
-- | Safe Haskell mode
[mg_safe_haskell] :: ModGuts -> SafeHaskellMode
-- | Do we need to trust our own package for Safe Haskell? See Note [Trust
-- Own Package] in GHC.Rename.Names
[mg_trust_pkg] :: ModGuts -> Bool
-- | Documentation.
[mg_docs] :: ModGuts -> !Maybe Docs
mg_mnwib :: ModGuts -> ModuleNameWithIsBoot
-- | A restricted form of ModGuts for code generation purposes
data CgGuts
CgGuts :: !Module -> [TyCon] -> CoreProgram -> [CostCentre] -> !ForeignStubs -> ![(ForeignSrcLang, FilePath)] -> !Set UnitId -> !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 regard them as part of the
-- code-gen of tycons
[cg_binds] :: CgGuts -> CoreProgram
[cg_ccs] :: CgGuts -> [CostCentre]
-- | Foreign export stubs
[cg_foreign] :: CgGuts -> !ForeignStubs
[cg_foreign_files] :: CgGuts -> ![(ForeignSrcLang, FilePath)]
-- | Dependent packages, used to generate #includes for C code gen
[cg_dep_pkgs] :: CgGuts -> !Set UnitId
-- | 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
-- GHC.Iface.Tidy.StaticPtrTable
[cg_spt_entries] :: CgGuts -> [SptEntry]
module GHC.Unit.Module.Status
-- | Action to perform in backend compilation
data HscBackendAction
-- | Update the boot and signature file results.
HscUpdate :: ModIface -> HscBackendAction
-- | Recompile this module.
HscRecomp :: CgGuts -> !ModLocation -> !PartialModIface -> !Maybe Fingerprint -> HscBackendAction
-- | Information for the code generator.
[hscs_guts] :: HscBackendAction -> CgGuts
-- | Module info
[hscs_mod_location] :: HscBackendAction -> !ModLocation
-- | Partial interface
[hscs_partial_iface] :: HscBackendAction -> !PartialModIface
-- | Old interface hash for this compilation, if an old interface file
-- exists. Pass to hscMaybeWriteIface when writing the interface
-- to avoid updating the existing interface when the interface isn't
-- changed.
[hscs_old_iface_hash] :: HscBackendAction -> !Maybe Fingerprint
-- | Status of a module in incremental compilation
data HscRecompStatus
-- | Nothing to do because code already exists.
HscUpToDate :: ModIface -> Maybe Linkable -> HscRecompStatus
-- | Recompilation of module, or update of interface is required.
-- Optionally pass the old interface hash to avoid updating the existing
-- interface when it has not changed.
HscRecompNeeded :: Maybe Fingerprint -> HscRecompStatus
instance GHC.Utils.Outputable.Outputable GHC.Unit.Module.Status.HscBackendAction
-- | Metaprogramming types
module GHC.Types.Meta
-- | The supported metaprogramming result types
data MetaRequest
MetaE :: (LHsExpr GhcPs -> MetaResult) -> MetaRequest
MetaP :: (LPat GhcPs -> MetaResult) -> MetaRequest
MetaT :: (LHsType GhcPs -> MetaResult) -> MetaRequest
MetaD :: ([LHsDecl GhcPs] -> MetaResult) -> MetaRequest
MetaAW :: (Serialized -> MetaResult) -> MetaRequest
type MetaHook f = MetaRequest -> LHsExpr GhcTc -> f MetaResult
-- | data constructors not exported to ensure correct result type
data MetaResult
metaRequestE :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LHsExpr GhcPs)
metaRequestP :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LPat GhcPs)
metaRequestT :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LHsType GhcPs)
metaRequestD :: Functor f => MetaHook f -> LHsExpr GhcTc -> f [LHsDecl GhcPs]
metaRequestAW :: Functor f => MetaHook f -> LHsExpr GhcTc -> f Serialized
-- | Describes the provenance of types as they flow through the
-- type-checker. The datatypes here are mainly used for error message
-- generation.
module GHC.Tc.Types.Origin
-- | UserTypeCtxt describes the origin of the polymorphic type in the
-- places where we need an expression to have that type
data UserTypeCtxt
FunSigCtxt :: Name -> ReportRedundantConstraints -> UserTypeCtxt
InfSigCtxt :: Name -> UserTypeCtxt
ExprSigCtxt :: ReportRedundantConstraints -> UserTypeCtxt
KindSigCtxt :: UserTypeCtxt
StandaloneKindSigCtxt :: Name -> UserTypeCtxt
TypeAppCtxt :: UserTypeCtxt
ConArgCtxt :: Name -> UserTypeCtxt
TySynCtxt :: Name -> UserTypeCtxt
PatSynCtxt :: Name -> UserTypeCtxt
PatSigCtxt :: UserTypeCtxt
RuleSigCtxt :: FastString -> Name -> UserTypeCtxt
ForSigCtxt :: Name -> UserTypeCtxt
DefaultDeclCtxt :: UserTypeCtxt
InstDeclCtxt :: Bool -> UserTypeCtxt
SpecInstCtxt :: UserTypeCtxt
GenSigCtxt :: UserTypeCtxt
GhciCtxt :: Bool -> UserTypeCtxt
ClassSCCtxt :: Name -> UserTypeCtxt
SigmaCtxt :: UserTypeCtxt
DataTyCtxt :: Name -> UserTypeCtxt
DerivClauseCtxt :: UserTypeCtxt
TyVarBndrKindCtxt :: Name -> UserTypeCtxt
DataKindCtxt :: Name -> UserTypeCtxt
TySynKindCtxt :: Name -> UserTypeCtxt
TyFamResKindCtxt :: Name -> UserTypeCtxt
pprUserTypeCtxt :: UserTypeCtxt -> SDoc
isSigMaybe :: UserTypeCtxt -> Maybe Name
-- | Report Redundant Constraints.
data ReportRedundantConstraints
-- | Don't report redundant constraints
NoRRC :: ReportRedundantConstraints
-- | Report redundant constraints, and here is the SrcSpan for the
-- constraints E.g. f :: (Eq a, Ord b) => blah The span is for the (Eq
-- a, Ord b)
WantRRC :: SrcSpan -> ReportRedundantConstraints
reportRedundantConstraints :: ReportRedundantConstraints -> Bool
redundantConstraintsSpan :: UserTypeCtxt -> SrcSpan
-- | SkolemInfo stores the origin of a skolem type variable, so that
-- we can display this information to the user in case of a type error.
--
-- The Unique field allows us to report all skolem type variables
-- bound in the same place in a single report.
data SkolemInfo
SkolemInfo :: Unique -> SkolemInfoAnon -> SkolemInfo
-- | SkolemInfoAnon stores the origin of a skolem type variable
-- (e.g. bound by a user-written forall, the header of a data
-- declaration, a deriving clause, ...).
--
-- This information is displayed when reporting an error message, such as
--
--
-- "Couldn't match k with l"
--
--
-- This allows us to explain where the type variable came from.
--
-- When several skolem type variables are bound at once, prefer using
-- SkolemInfo, which stores a Unique which allows these
-- type variables to be reported
data SkolemInfoAnon
SigSkol :: UserTypeCtxt -> TcType -> [(Name, TcTyVar)] -> SkolemInfoAnon
SigTypeSkol :: UserTypeCtxt -> SkolemInfoAnon
ForAllSkol :: TyVarBndrs -> SkolemInfoAnon
DerivSkol :: Type -> SkolemInfoAnon
InstSkol :: SkolemInfoAnon
FamInstSkol :: SkolemInfoAnon
PatSkol :: ConLike -> HsMatchContext GhcTc -> SkolemInfoAnon
IPSkol :: [HsIPName] -> SkolemInfoAnon
RuleSkol :: RuleName -> SkolemInfoAnon
InferSkol :: [(Name, TcType)] -> SkolemInfoAnon
BracketSkol :: SkolemInfoAnon
UnifyForAllSkol :: TcType -> SkolemInfoAnon
TyConSkol :: TyConFlavour -> Name -> SkolemInfoAnon
DataConSkol :: Name -> SkolemInfoAnon
ReifySkol :: SkolemInfoAnon
QuantCtxtSkol :: SkolemInfoAnon
RuntimeUnkSkol :: SkolemInfoAnon
ArrowReboundIfSkol :: SkolemInfoAnon
UnkSkol :: CallStack -> SkolemInfoAnon
-- | Wrap up the origin of a skolem type variable with a new Unique,
-- so that we can common up skolem type variables whose SkolemInfo
-- shares a certain Unique.
mkSkolemInfo :: MonadIO m => SkolemInfoAnon -> m SkolemInfo
getSkolemInfo :: SkolemInfo -> SkolemInfoAnon
pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
pprSkolInfo :: SkolemInfoAnon -> SDoc
-- | Use this when you can't specify a helpful origin for some skolem type
-- variable.
--
-- We're hoping to be able to get rid of this entirely, but for the
-- moment it's still needed.
unkSkol :: HasCallStack => SkolemInfo
unkSkolAnon :: HasCallStack => SkolemInfoAnon
data CtOrigin
-- | A given constraint from a user-written type signature. The
-- SkolemInfo inside gives more information.
GivenOrigin :: SkolemInfoAnon -> CtOrigin
-- | InstSCOrigin is used for a Given constraint obtained by
-- superclass selection from the context of an instance declaration. E.g.
-- instance (Foo a, Bar a) => C [a] where ... When
-- typechecking the instance decl itself, including producing evidence
-- for the superclasses of C, the superclasses of (Foo
-- a) and (Bar a) will have InstSCOrigin origin.
InstSCOrigin :: ScDepth -> TypeSize -> CtOrigin
-- | OtherSCOrigin is used for a Given constraint obtained by
-- superclass selection from a constraint other than the context
-- of an instance declaration. (For the latter we use
-- InstSCOrigin.) E.g. f :: Foo a => blah f = e When
-- typechecking body of f, the superclasses of the Given (Foo a)
-- will have OtherSCOrigin. Needed for Note [Replacement vs
-- keeping] and Note [Use only the best local instance], both in
-- GHC.Tc.Solver.Interact.
OtherSCOrigin :: ScDepth -> SkolemInfoAnon -> CtOrigin
OccurrenceOf :: Name -> CtOrigin
OccurrenceOfRecSel :: RdrName -> CtOrigin
AppOrigin :: CtOrigin
SpecPragOrigin :: UserTypeCtxt -> CtOrigin
TypeEqOrigin :: TcType -> TcType -> Maybe TypedThing -> Bool -> CtOrigin
[uo_actual] :: CtOrigin -> TcType
[uo_expected] :: CtOrigin -> TcType
-- | The thing that has type "actual"
[uo_thing] :: CtOrigin -> Maybe TypedThing
-- | Is at least one of the three elements above visible? (Errors from the
-- polymorphic subsumption check are considered visible.) Only used for
-- prioritizing error messages.
[uo_visible] :: CtOrigin -> Bool
KindEqOrigin :: TcType -> TcType -> CtOrigin -> Maybe TypeOrKind -> CtOrigin
IPOccOrigin :: HsIPName -> CtOrigin
OverLabelOrigin :: FastString -> CtOrigin
LiteralOrigin :: HsOverLit GhcRn -> CtOrigin
NegateOrigin :: CtOrigin
ArithSeqOrigin :: ArithSeqInfo GhcRn -> CtOrigin
AssocFamPatOrigin :: CtOrigin
SectionOrigin :: CtOrigin
HasFieldOrigin :: FastString -> CtOrigin
TupleOrigin :: CtOrigin
ExprSigOrigin :: CtOrigin
PatSigOrigin :: CtOrigin
PatOrigin :: CtOrigin
ProvCtxtOrigin :: PatSynBind GhcRn GhcRn -> CtOrigin
RecordUpdOrigin :: CtOrigin
ViewPatOrigin :: CtOrigin
-- | ScOrigin is used only for the Wanted constraints for the
-- superclasses of an instance declaration. If the instance head is C
-- ty1 .. tyn then TypeSize = sizeTypes [ty1, .., tyn] See
-- Note [Solving superclass constraints] in GHC.Tc.TyCl.Instance
ScOrigin :: TypeSize -> CtOrigin
DerivClauseOrigin :: CtOrigin
DerivOriginDC :: DataCon -> Int -> Bool -> CtOrigin
DerivOriginCoerce :: Id -> Type -> Type -> Bool -> CtOrigin
StandAloneDerivOrigin :: CtOrigin
DefaultOrigin :: CtOrigin
DoOrigin :: CtOrigin
DoPatOrigin :: LPat GhcRn -> CtOrigin
MCompOrigin :: CtOrigin
MCompPatOrigin :: LPat GhcRn -> CtOrigin
ProcOrigin :: CtOrigin
ArrowCmdOrigin :: CtOrigin
AnnOrigin :: CtOrigin
FunDepOrigin1 :: PredType -> CtOrigin -> RealSrcSpan -> PredType -> CtOrigin -> RealSrcSpan -> CtOrigin
FunDepOrigin2 :: PredType -> CtOrigin -> PredType -> SrcSpan -> CtOrigin
InjTFOrigin1 :: PredType -> CtOrigin -> RealSrcSpan -> PredType -> CtOrigin -> RealSrcSpan -> CtOrigin
ExprHoleOrigin :: Maybe OccName -> CtOrigin
TypeHoleOrigin :: OccName -> CtOrigin
PatCheckOrigin :: CtOrigin
ListOrigin :: CtOrigin
IfThenElseOrigin :: CtOrigin
BracketOrigin :: CtOrigin
StaticOrigin :: CtOrigin
Shouldn'tHappenOrigin :: String -> CtOrigin
GhcBug20076 :: CtOrigin
-- | Testing whether the constraint associated with an instance declaration
-- in a signature file is satisfied upon instantiation.
--
-- Test cases: backpackshould_failbkpfail{11,43}.bkp
InstProvidedOrigin :: Module -> ClsInst -> CtOrigin
NonLinearPatternOrigin :: CtOrigin
UsageEnvironmentOf :: Name -> CtOrigin
CycleBreakerOrigin :: CtOrigin -> CtOrigin
FixedRuntimeRepOrigin :: !Type -> !FRROrigin -> CtOrigin
WantedSuperclassOrigin :: PredType -> CtOrigin -> CtOrigin
InstanceSigOrigin :: Name -> Type -> Type -> CtOrigin
AmbiguityCheckOrigin :: UserTypeCtxt -> CtOrigin
exprCtOrigin :: HsExpr GhcRn -> CtOrigin
-- | Extract a suitable CtOrigin from a HsExpr
lexprCtOrigin :: LHsExpr GhcRn -> CtOrigin
-- | Extract a suitable CtOrigin from a MatchGroup
matchesCtOrigin :: MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
-- | Extract a suitable CtOrigin from guarded RHSs
grhssCtOrigin :: GRHSs GhcRn (LHsExpr GhcRn) -> CtOrigin
isVisibleOrigin :: CtOrigin -> Bool
toInvisibleOrigin :: CtOrigin -> CtOrigin
pprCtOrigin :: CtOrigin -> SDoc
isGivenOrigin :: CtOrigin -> Bool
isWantedWantedFunDepOrigin :: CtOrigin -> Bool
-- | Did a constraint arise from expanding a Wanted constraint to look at
-- superclasses?
isWantedSuperclassOrigin :: CtOrigin -> Bool
-- | Some thing which has a type.
--
-- This datatype is used when we want to report to the user that
-- something has an unexpected type.
data TypedThing
HsTypeRnThing :: HsType GhcRn -> TypedThing
TypeThing :: Type -> TypedThing
HsExprRnThing :: HsExpr GhcRn -> TypedThing
NameThing :: Name -> TypedThing
-- | Some kind of type variable binder.
--
-- Used for reporting errors, in SkolemInfo and
-- TcSolverReportMsg.
data TyVarBndrs
HsTyVarBndrsRn :: [HsTyVarBndr flag GhcRn] -> TyVarBndrs
isPushCallStackOrigin :: CtOrigin -> Bool
callStackOriginFS :: CtOrigin -> FastString
-- | In what context are we checking that a type has a fixed runtime
-- representation?
data FRROrigin
-- | Function arguments must have a fixed runtime representation.
--
-- Test case: RepPolyApp.
FRRApp :: !HsExpr GhcTc -> FRROrigin
-- | Record fields in record updates must have a fixed runtime
-- representation.
--
-- Test case: RepPolyRecordUpdate.
FRRRecordUpdate :: !RdrName -> !HsExpr GhcTc -> FRROrigin
-- | Variable binders must have a fixed runtime representation.
--
-- Test cases: LevPolyLet, RepPolyPatBind.
FRRBinder :: !Name -> FRROrigin
-- | The type of the scrutinee in a case statement must have a fixed
-- runtime representation.
--
-- Test cases: RepPolyCase{1,2}.
FRRCase :: FRROrigin
-- | An instantiation of a newtype/data constructor in which an argument
-- type does not have a fixed runtime representation.
--
-- The argument can either be an expression or a pattern.
--
-- Test cases: Expression: UnliftedNewtypesLevityBinder. Pattern: T20363.
FRRDataConArg :: !ExprOrPat -> !DataCon -> !Int -> FRROrigin
-- | An instantiation of an Id with no binding (e.g.
-- coerce, `unsafeCoerce#`) in which one of the remaining
-- arguments types does not have a fixed runtime representation.
--
-- Test cases: RepPolyWrappedVar, T14561, UnliftedNewtypesCoerceFail.
FRRNoBindingResArg :: !Id -> !Int -> FRROrigin
-- | Arguments to unboxed tuples must have fixed runtime representations.
--
-- Test case: RepPolyTuple.
FRRTupleArg :: !Int -> FRROrigin
-- | Tuple sections must have a fixed runtime representation.
--
-- Test case: RepPolyTupleSection.
FRRTupleSection :: !Int -> FRROrigin
-- | Unboxed sums must have a fixed runtime representation.
--
-- Test cases: RepPolySum.
FRRUnboxedSum :: FRROrigin
-- | The body of a do expression or a monad comprehension must
-- have a fixed runtime representation.
--
-- Test cases: RepPolyDoBody{1,2}, RepPolyMcBody.
FRRBodyStmt :: !StmtOrigin -> !Int -> FRROrigin
-- | Arguments to a guard in a monad comprehesion must have a fixed runtime
-- representation.
--
-- Test case: RepPolyMcGuard.
FRRBodyStmtGuard :: FRROrigin
-- | Arguments to (>>=) arising from a do expression
-- or a monad comprehension must have a fixed runtime representation.
--
-- Test cases: RepPolyDoBind, RepPolyMcBind.
FRRBindStmt :: !StmtOrigin -> FRROrigin
-- | A value bound by a pattern guard must have a fixed runtime
-- representation.
--
-- Test cases: none.
FRRBindStmtGuard :: FRROrigin
-- | A representation-polymorphism check arising from arrow notation.
--
-- See FRRArrowOrigin for more details.
FRRArrow :: !FRRArrowOrigin -> FRROrigin
-- | argument position (0-indexed)
FRRExpectedFunTy :: !ExpectedFunTyOrigin -> !Int -> FRROrigin
-- | Print the context for a FixedRuntimeRep
-- representation-polymorphism check.
--
-- Note that this function does not include the specific
-- RuntimeRep which is not fixed. That information is added by
-- mkFRRErr.
pprFRROrigin :: FRROrigin -> SDoc
-- | Are we in a do expression or a monad comprehension?
--
-- This datatype is only used to report this context to the user in error
-- messages.
data StmtOrigin
MonadComprehension :: StmtOrigin
DoNotation :: StmtOrigin
-- | While typechecking arrow notation, in which context did a
-- representation polymorphism check arise?
--
-- See FRROrigin for more general origins of representation
-- polymorphism checks.
data FRRArrowOrigin
-- | The result of an arrow command does not have a fixed runtime
-- representation.
--
-- Test case: RepPolyArrowCmd.
ArrowCmdResTy :: !HsCmd GhcRn -> FRRArrowOrigin
-- | The argument to an arrow in an arrow command application does not have
-- a fixed runtime representation.
--
-- Test cases: none.
ArrowCmdApp :: !HsCmd GhcRn -> !HsExpr GhcRn -> FRRArrowOrigin
-- | A function in an arrow application does not have a fixed runtime
-- representation.
--
-- Test cases: none.
ArrowCmdArrApp :: !HsExpr GhcRn -> !HsExpr GhcRn -> !HsArrAppType -> FRRArrowOrigin
-- | A pattern in an arrow command abstraction does not have a fixed
-- runtime representation.
--
-- Test cases: none.
ArrowCmdLam :: !Int -> FRRArrowOrigin
-- | The scrutinee type in an arrow command case or lambda-case statement
-- does not have a fixed runtime representation.
--
-- Test cases: none.
ArrowCmdCase :: Bool -> FRRArrowOrigin
-- | Whether this is a lambda-case (True) or a normal case (False)
[isCmdLamCase] :: FRRArrowOrigin -> Bool
-- | The overall type of an arrow proc expression does not have a fixed
-- runtime representation.
--
-- Test case: RepPolyArrowFun.
ArrowFun :: !HsExpr GhcRn -> FRRArrowOrigin
pprFRRArrowOrigin :: FRRArrowOrigin -> SDoc
-- | In what context are we calling matchExpectedFunTys or
-- matchActualFunTySigma?
--
-- Used for two things:
--
--
-- - Reporting error messages which explain that a function has been
-- given an unexpected number of arguments. Uses
-- pprExpectedFunTyHerald. See Note [Herald for
-- matchExpectedFunTys] in GHC.Tc.Utils.Unify.
-- - Reporting representation-polymorphism errors when a function
-- argument doesn't have a fixed RuntimeRep as per Note [Fixed
-- RuntimeRep] in GHC.Tc.Utils.Concrete. Uses
-- pprExpectedFunTyOrigin. See FRROrigin for more general
-- origins of representation polymorphism checks.
--
data ExpectedFunTyOrigin
ExpectedFunTySyntaxOp :: !CtOrigin -> !HsExpr GhcRn -> ExpectedFunTyOrigin
ExpectedFunTyViewPat :: !HsExpr GhcRn -> ExpectedFunTyOrigin
ExpectedFunTyArg :: !TypedThing -> !HsExpr (GhcPass p) -> ExpectedFunTyOrigin
ExpectedFunTyMatches :: !TypedThing -> !MatchGroup GhcRn (LHsExpr GhcRn) -> ExpectedFunTyOrigin
ExpectedFunTyLam :: !MatchGroup GhcRn (LHsExpr GhcRn) -> ExpectedFunTyOrigin
ExpectedFunTyLamCase :: !HsExpr GhcRn -> ExpectedFunTyOrigin
pprExpectedFunTyOrigin :: ExpectedFunTyOrigin -> Int -> SDoc
pprExpectedFunTyHerald :: ExpectedFunTyOrigin -> SDoc
instance GHC.Classes.Eq GHC.Tc.Types.Origin.ReportRedundantConstraints
instance GHC.Classes.Eq GHC.Tc.Types.Origin.UserTypeCtxt
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.CtOrigin
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.FRROrigin
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.FRRArrowOrigin
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.StmtOrigin
instance GHC.Types.Unique.Uniquable GHC.Tc.Types.Origin.SkolemInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.SkolemInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.SkolemInfoAnon
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.TyVarBndrs
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Origin.TypedThing
-- | This module defines types and simple operations over constraints, as
-- used in the type-checker and constraint solver.
module GHC.Tc.Types.Constraint
data QCInst
QCI :: CtEvidence -> [TcTyVar] -> TcPredType -> Bool -> QCInst
[qci_ev] :: QCInst -> CtEvidence
[qci_tvs] :: QCInst -> [TcTyVar]
[qci_pred] :: QCInst -> TcPredType
[qci_pend_sc] :: QCInst -> Bool
isPendingScInst :: QCInst -> Maybe QCInst
-- | A Xi-type is one that has been fully rewritten with respect to
-- the inert set; that is, it has been rewritten by the algorithm in
-- GHC.Tc.Solver.Rewrite. (Historical note: Xi, for years and
-- years, meant that a type was type-family-free. It does *not* mean this
-- any more.)
type Xi = TcType
data Ct
CDictCan :: CtEvidence -> Class -> [Xi] -> Bool -> Bool -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_class] :: Ct -> Class
[cc_tyargs] :: Ct -> [Xi]
[cc_pend_sc] :: Ct -> Bool
[cc_fundeps] :: Ct -> Bool
CIrredCan :: CtEvidence -> CtIrredReason -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_reason] :: Ct -> CtIrredReason
CEqCan :: CtEvidence -> CanEqLHS -> Xi -> EqRel -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_lhs] :: Ct -> CanEqLHS
[cc_rhs] :: Ct -> Xi
[cc_eq_rel] :: Ct -> EqRel
CNonCanonical :: CtEvidence -> Ct
[cc_ev] :: Ct -> CtEvidence
CQuantCan :: QCInst -> Ct
-- | A special canonical constraint: a constraint that is used internally
-- by GHC's typechecker.
--
-- See #20000.
CSpecialCan :: CtEvidence -> SpecialPred -> Ct
[cc_ev] :: Ct -> CtEvidence
[cc_special_pred] :: Ct -> SpecialPred
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
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 :: WantedConstraints -> Bool
getPendingWantedScs :: Cts -> ([Ct], Cts)
isWantedCt :: Ct -> Bool
isGivenCt :: Ct -> Bool
isUserTypeError :: PredType -> 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 :: PredType -> Maybe Type
ctEvidence :: Ct -> CtEvidence
ctLoc :: Ct -> CtLoc
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
ctRewriters :: Ct -> RewriterSet
ctEvId :: HasDebugCallStack => Ct -> EvVar
-- | Returns the evidence Id for the argument Ct when this
-- Ct is a Wanted which can hold evidence (i.e. doesn't
-- have NoDest TcEvDest).
--
-- Returns Nothing otherwise.
wantedEvId_maybe :: Ct -> Maybe EvVar
-- | 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]
mkIrredCt :: CtIrredReason -> CtEvidence -> Ct
ctEvPred :: CtEvidence -> TcPredType
ctEvLoc :: CtEvidence -> CtLoc
ctEvOrigin :: CtEvidence -> CtOrigin
-- | Get the equality relation relevant for a CtEvidence
ctEvEqRel :: CtEvidence -> EqRel
ctEvExpr :: HasDebugCallStack => CtEvidence -> EvExpr
ctEvTerm :: CtEvidence -> EvTerm
ctEvCoercion :: HasDebugCallStack => CtEvidence -> TcCoercion
ctEvEvId :: HasDebugCallStack => CtEvidence -> EvVar
-- | Extract the set of rewriters from a CtEvidence See Note
-- [Wanteds rewrite Wanteds] If the provided CtEvidence is not for a
-- Wanted, just return an empty set.
ctEvRewriters :: CtEvidence -> RewriterSet
-- | 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 GHC.Utils.FV.
tyCoVarsOfCts :: Cts -> TcTyCoVarSet
-- | Returns free variables of constraints as a deterministically ordered
-- list. See Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfCtList :: Ct -> [TcTyCoVar]
-- | Returns free variables of a bag of constraints as a deterministically
-- ordered list. See Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfCtsList :: Cts -> [TcTyCoVar]
-- | Used to indicate extra information about why a CIrredCan is
-- irreducible
data CtIrredReason
-- | this constraint has a non-canonical shape (e.g. c Int, for a
-- variable c)
IrredShapeReason :: CtIrredReason
-- | an equality where some invariant other than (TyEq:H) of CEqCan
-- is not satisfied; the CheckTyEqResult states exactly why
NonCanonicalReason :: CheckTyEqResult -> CtIrredReason
-- | an equality that cannot be decomposed because it is representational.
-- Example: a b ~R# Int. These might still be solved later.
-- INVARIANT: The constraint is a representational equality constraint
ReprEqReason :: CtIrredReason
-- | a nominal equality that relates two wholly different types, like
-- Int ~# Bool or a b ~# 3. INVARIANT: The constraint
-- is a nominal equality constraint
ShapeMismatchReason :: CtIrredReason
-- | an equality like T a b c ~ Q d e where either T or
-- Q is an abstract type constructor. See Note [Skolem abstract
-- data] in GHC.Core.TyCon. INVARIANT: The constraint is an equality
-- constraint between two TyConApps
AbstractTyConReason :: CtIrredReason
-- | Are we sure that more solving will never solve this constraint?
isInsolubleReason :: CtIrredReason -> Bool
-- | A set of problems in checking the validity of a type equality. See
-- checkTypeEq.
data CheckTyEqResult
-- | An individual problem that might be logged in a CheckTyEqResult
data CheckTyEqProblem
cteProblem :: CheckTyEqProblem -> CheckTyEqResult
cterClearOccursCheck :: CheckTyEqResult -> CheckTyEqResult
-- | No problems in checking the validity of a type equality.
cteOK :: CheckTyEqResult
cteImpredicative :: CheckTyEqProblem
cteTypeFamily :: CheckTyEqProblem
cteInsolubleOccurs :: CheckTyEqProblem
cteSolubleOccurs :: CheckTyEqProblem
-- | Mark a CheckTyEqResult as not having an insoluble occurs-check:
-- any occurs check under a type family or in a representation equality
-- is soluble.
cterSetOccursCheckSoluble :: CheckTyEqResult -> CheckTyEqResult
-- | Check whether a CheckTyEqResult is marked successful.
cterHasNoProblem :: CheckTyEqResult -> Bool
-- | Check whether a CheckTyEqResult has a CheckTyEqProblem
cterHasProblem :: CheckTyEqResult -> CheckTyEqProblem -> Bool
-- | Check whether a CheckTyEqResult has one CheckTyEqProblem
-- and no other
cterHasOnlyProblem :: CheckTyEqResult -> CheckTyEqProblem -> Bool
cterRemoveProblem :: CheckTyEqResult -> CheckTyEqProblem -> CheckTyEqResult
cterHasOccursCheck :: CheckTyEqResult -> Bool
-- | Retain only information about occurs-check failures, because only that
-- matters after recurring into a kind.
cterFromKind :: CheckTyEqResult -> CheckTyEqResult
-- | A CanEqLHS is a type that can appear on the left of a canonical
-- equality: a type variable or exactly-saturated type family
-- application.
data CanEqLHS
TyVarLHS :: TcTyVar -> CanEqLHS
TyFamLHS :: TyCon -> [Xi] -> CanEqLHS
-- | Is a type a canonical LHS? That is, is it a tyvar or an
-- exactly-saturated type family application? Does not look through type
-- synonyms.
canEqLHS_maybe :: Xi -> Maybe CanEqLHS
-- | Retrieve the kind of a CanEqLHS
canEqLHSKind :: CanEqLHS -> TcKind
-- | Convert a CanEqLHS back into a Type
canEqLHSType :: CanEqLHS -> TcType
-- | Are two CanEqLHSs equal?
eqCanEqLHS :: CanEqLHS -> CanEqLHS -> Bool
-- | A hole stores the information needed to report diagnostics about holes
-- in terms (unbound identifiers or underscores) or in types (also called
-- wildcards, as used in partial type signatures). See Note [Holes].
data Hole
Hole :: HoleSort -> OccName -> TcType -> CtLoc -> Hole
-- | What flavour of hole is this?
[hole_sort] :: Hole -> HoleSort
-- | The name of this hole
[hole_occ] :: Hole -> OccName
-- | Type to be printed to the user For expression holes: type of expr For
-- type holes: the missing type
[hole_ty] :: Hole -> TcType
-- | Where hole was written
[hole_loc] :: Hole -> CtLoc
-- | Used to indicate which sort of hole we have.
data HoleSort
-- | Either an out-of-scope variable or a "true" hole in an expression
-- (TypedHoles). The HoleExprRef says where to write the the erroring
-- expression for -fdefer-type-errors.
ExprHole :: HoleExprRef -> HoleSort
-- | A hole in a type (PartialTypeSignatures)
TypeHole :: HoleSort
-- | A hole in a constraint, like @f :: (_, Eq a) => ... Differentiated
-- from TypeHole because a ConstraintHole is simplified differently. See
-- Note [Do not simplify ConstraintHoles] in GHC.Tc.Solver.
ConstraintHole :: HoleSort
-- | Does this hole represent an "out of scope" error? See Note [Insoluble
-- holes]
isOutOfScopeHole :: Hole -> Bool
data WantedConstraints
WC :: Cts -> Bag Implication -> Bag Hole -> WantedConstraints
[wc_simple] :: WantedConstraints -> Cts
[wc_impl] :: WantedConstraints -> Bag Implication
[wc_holes] :: WantedConstraints -> Bag Hole
insolubleWC :: WantedConstraints -> Bool
emptyWC :: WantedConstraints
isEmptyWC :: WantedConstraints -> Bool
-- | Checks whether a the given wanted constraints are solved, i.e. that
-- there are no simple constraints left and all the implications are
-- solved.
isSolvedWC :: WantedConstraints -> Bool
andWC :: WantedConstraints -> WantedConstraints -> WantedConstraints
unionsWC :: [WantedConstraints] -> WantedConstraints
mkSimpleWC :: [CtEvidence] -> WantedConstraints
mkImplicWC :: Bag Implication -> WantedConstraints
addInsols :: WantedConstraints -> Bag Ct -> WantedConstraints
dropMisleading :: WantedConstraints -> WantedConstraints
addSimples :: WantedConstraints -> Bag Ct -> WantedConstraints
addImplics :: WantedConstraints -> Bag Implication -> WantedConstraints
addHoles :: WantedConstraints -> Bag Hole -> WantedConstraints
-- | Returns free variables of WantedConstraints as a non-deterministic
-- set. See Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet
-- | Returns free variables of WantedConstraints as a deterministically
-- ordered list. See Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfWCList :: WantedConstraints -> [TyCoVar]
insolubleWantedCt :: Ct -> Bool
insolubleEqCt :: Ct -> Bool
-- | Returns True of equality constraints that are definitely insoluble, as
-- well as TypeError constraints. Can return True for Given
-- constraints, unlike insolubleWantedCt.
--
-- This function is critical for accurate pattern-match overlap warnings.
-- See Note [Pattern match warnings with insoluble Givens] in
-- GHC.Tc.Solver
--
-- Note that this does not traverse through the constraint to find nested
-- custom type errors: it only detects TypeError msg ::
-- Constraint, and not e.g. Eq (TypeError msg).
insolubleCt :: Ct -> Bool
insolubleImplic :: Implication -> Bool
data Implication
Implic :: TcLevel -> SkolemInfoAnon -> [TcTyVar] -> [EvVar] -> HasGivenEqs -> Bool -> TcLclEnv -> WantedConstraints -> EvBindsVar -> VarSet -> VarSet -> ImplicStatus -> Implication
[ic_tclvl] :: Implication -> TcLevel
[ic_info] :: Implication -> SkolemInfoAnon
[ic_skols] :: Implication -> [TcTyVar]
[ic_given] :: Implication -> [EvVar]
[ic_given_eqs] :: Implication -> HasGivenEqs
[ic_warn_inaccessible] :: Implication -> Bool
[ic_env] :: Implication -> TcLclEnv
[ic_wanted] :: Implication -> WantedConstraints
[ic_binds] :: Implication -> EvBindsVar
[ic_need_inner] :: Implication -> VarSet
[ic_need_outer] :: Implication -> VarSet
[ic_status] :: Implication -> ImplicStatus
implicationPrototype :: Implication
checkTelescopeSkol :: SkolemInfoAnon -> Bool
data ImplicStatus
IC_Solved :: [EvVar] -> ImplicStatus
[ics_dead] :: ImplicStatus -> [EvVar]
IC_Insoluble :: ImplicStatus
IC_BadTelescope :: ImplicStatus
IC_Unsolved :: ImplicStatus
isInsolubleStatus :: ImplicStatus -> Bool
isSolvedStatus :: ImplicStatus -> Bool
type UserGiven = Implication
getUserGivensFromImplics :: [Implication] -> [UserGiven]
data HasGivenEqs
NoGivenEqs :: HasGivenEqs
LocalGivenEqs :: HasGivenEqs
MaybeGivenEqs :: HasGivenEqs
checkImplicationInvariants :: (HasCallStack, Applicative m) => Implication -> m ()
-- | 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
isGivenLoc :: CtLoc -> Bool
setCtLocOrigin :: CtLoc -> CtOrigin -> CtLoc
updateCtLocOrigin :: CtLoc -> (CtOrigin -> CtOrigin) -> CtLoc
setCtLocEnv :: CtLoc -> TcLclEnv -> CtLoc
setCtLocSpan :: CtLoc -> RealSrcSpan -> CtLoc
pprCtLoc :: CtLoc -> SDoc
data CtEvidence
CtGiven :: TcPredType -> EvVar -> CtLoc -> CtEvidence
[ctev_pred] :: CtEvidence -> TcPredType
[ctev_evar] :: CtEvidence -> EvVar
[ctev_loc] :: CtEvidence -> CtLoc
CtWanted :: TcPredType -> TcEvDest -> CtLoc -> RewriterSet -> CtEvidence
[ctev_pred] :: CtEvidence -> TcPredType
[ctev_dest] :: CtEvidence -> TcEvDest
[ctev_loc] :: CtEvidence -> CtLoc
[ctev_rewriters] :: CtEvidence -> RewriterSet
-- | A place for type-checking evidence to go after it is generated.
--
--
-- - Wanted equalities use HoleDest,
-- - IsRefl# constraints use NoDest,
-- - other Wanteds use 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 GHC.Core.TyCo.Rep
HoleDest :: CoercionHole -> TcEvDest
-- | we don't need to record any evidence. This is used for 'IsRefl#'
-- constraints.
NoDest :: TcEvDest
mkKindLoc :: TcType -> TcType -> CtLoc -> CtLoc
-- | Take a CtLoc and moves it to the kind level
toKindLoc :: CtLoc -> CtLoc
mkGivenLoc :: TcLevel -> SkolemInfoAnon -> TcLclEnv -> CtLoc
isWanted :: CtEvidence -> Bool
isGiven :: CtEvidence -> Bool
-- | Get the role relevant for a CtEvidence
ctEvRole :: CtEvidence -> Role
-- | Set the type of CtEvidence.
--
-- This function ensures that the invariants on CtEvidence hold,
-- by updating the evidence and the ctev_pred in sync with each other.
-- See Note [CtEvidence invariants].
setCtEvPredType :: HasDebugCallStack => CtEvidence -> Type -> CtEvidence
setCtEvLoc :: CtEvidence -> CtLoc -> CtEvidence
arisesFromGivens :: Ct -> Bool
-- | Returns free variables of constraints as a deterministically ordered
-- list. See Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfCtEvList :: CtEvidence -> [TcTyCoVar]
-- | Returns free variables of constraints as a non-deterministic set
tyCoVarsOfCtEv :: CtEvidence -> TcTyCoVarSet
-- | Returns free variables of a bag of constraints as a deterministically
-- ordered list. See Note [Deterministic FV] in GHC.Utils.FV.
tyCoVarsOfCtEvsList :: [CtEvidence] -> [TcTyCoVar]
ctEvUnique :: CtEvidence -> Unique
tcEvDestUnique :: TcEvDest -> Unique
-- | Stores a set of CoercionHoles that have been used to rewrite a
-- constraint. See Note [Wanteds rewrite Wanteds].
newtype RewriterSet
RewriterSet :: UniqSet CoercionHole -> RewriterSet
emptyRewriterSet :: RewriterSet
isEmptyRewriterSet :: RewriterSet -> Bool
-- | Makes a RewriterSet from all the coercion holes that occur in
-- the given type.
rewriterSetFromType :: Type -> RewriterSet
-- | Makes a RewriterSet from all the coercion holes that occur in
-- the given types.
rewriterSetFromTypes :: [Type] -> RewriterSet
-- | Makes a RewriterSet from all the coercion holes that occur in
-- the given coercion.
rewriterSetFromCo :: Coercion -> RewriterSet
addRewriterSet :: RewriterSet -> CoercionHole -> RewriterSet
wrapType :: Type -> [TyVar] -> [PredType] -> Type
data CtFlavour
Given :: CtFlavour
Wanted :: CtFlavour
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 GHC.Tc.Solver.InertSet
type CtFlavourRole = (CtFlavour, EqRel)
-- | Extract the flavour, role, and boxity from a CtEvidence
ctEvFlavourRole :: CtEvidence -> CtFlavourRole
-- | Extract the flavour and role from a Ct
ctFlavourRole :: Ct -> CtFlavourRole
eqCanRewrite :: EqRel -> EqRel -> Bool
eqCanRewriteFR :: CtFlavourRole -> CtFlavourRole -> Bool
pprEvVarTheta :: [EvVar] -> SDoc
pprEvVars :: [EvVar] -> SDoc
pprEvVarWithType :: EvVar -> SDoc
instance GHC.Classes.Eq GHC.Tc.Types.Constraint.HasGivenEqs
instance GHC.Base.Monoid GHC.Tc.Types.Constraint.RewriterSet
instance GHC.Base.Semigroup GHC.Tc.Types.Constraint.RewriterSet
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.RewriterSet
instance GHC.Classes.Eq GHC.Tc.Types.Constraint.CtFlavour
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.SubGoalDepth
instance GHC.Classes.Ord GHC.Tc.Types.Constraint.SubGoalDepth
instance GHC.Classes.Eq GHC.Tc.Types.Constraint.SubGoalDepth
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.WantedConstraints
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.Implication
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.Hole
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.Ct
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.QCInst
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.CtEvidence
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.CtFlavour
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.TcEvDest
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.HasGivenEqs
instance GHC.Base.Semigroup GHC.Tc.Types.Constraint.HasGivenEqs
instance GHC.Base.Monoid GHC.Tc.Types.Constraint.HasGivenEqs
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.ImplicStatus
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.CtIrredReason
instance GHC.Base.Semigroup GHC.Tc.Types.Constraint.CheckTyEqResult
instance GHC.Base.Monoid GHC.Tc.Types.Constraint.CheckTyEqResult
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.CheckTyEqResult
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.HoleSort
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.Constraint.CanEqLHS
-- | Utility types used within the constraint solver
module GHC.Tc.Solver.Types
type DictMap a = TcAppMap a
emptyDictMap :: DictMap a
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 -> CtLoc -> Class -> [Type] -> Maybe a
dictsToBag :: DictMap a -> Bag a
partitionDicts :: (Ct -> Bool) -> DictMap Ct -> (Bag Ct, DictMap Ct)
type FunEqMap a = TcAppMap a
emptyFunEqs :: TcAppMap a
foldFunEqs :: (a -> b -> b) -> FunEqMap a -> b -> b
findFunEq :: FunEqMap a -> TyCon -> [Type] -> Maybe a
insertFunEq :: FunEqMap a -> TyCon -> [Type] -> a -> FunEqMap a
findFunEqsByTyCon :: FunEqMap a -> TyCon -> [a]
type TcAppMap a = DTyConEnv (ListMap LooseTypeMap a)
emptyTcAppMap :: TcAppMap a
isEmptyTcAppMap :: TcAppMap a -> Bool
insertTcApp :: TcAppMap a -> TyCon -> [Type] -> a -> TcAppMap a
alterTcApp :: forall a. TcAppMap a -> TyCon -> [Type] -> XT a -> TcAppMap a
filterTcAppMap :: forall a. (a -> Bool) -> TcAppMap a -> TcAppMap a
tcAppMapToBag :: TcAppMap a -> Bag a
foldTcAppMap :: (a -> b -> b) -> TcAppMap a -> b -> b
type EqualCtList = [Ct]
filterEqualCtList :: (Ct -> Bool) -> EqualCtList -> Maybe EqualCtList
addToEqualCtList :: Ct -> EqualCtList -> EqualCtList
module GHC.Tc.Solver.InertSet
data WorkList
WL :: [Ct] -> [Ct] -> Bag Implication -> WorkList
[wl_eqs] :: WorkList -> [Ct]
[wl_rest] :: WorkList -> [Ct]
[wl_implics] :: WorkList -> Bag Implication
isEmptyWorkList :: WorkList -> Bool
emptyWorkList :: WorkList
extendWorkListNonEq :: Ct -> WorkList -> WorkList
extendWorkListCt :: Ct -> WorkList -> WorkList
extendWorkListCts :: [Ct] -> WorkList -> WorkList
extendWorkListEq :: Ct -> WorkList -> WorkList
appendWorkList :: WorkList -> WorkList -> WorkList
extendWorkListImplic :: Implication -> WorkList -> WorkList
workListSize :: WorkList -> Int
selectWorkItem :: WorkList -> Maybe (Ct, WorkList)
data InertSet
IS :: InertCans -> CycleBreakerVarStack -> FunEqMap Reduction -> DictMap CtEvidence -> InertSet
[inert_cans] :: InertSet -> InertCans
[inert_cycle_breakers] :: InertSet -> CycleBreakerVarStack
[inert_famapp_cache] :: InertSet -> FunEqMap Reduction
[inert_solved_dicts] :: InertSet -> DictMap CtEvidence
data InertCans
IC :: InertEqs -> FunEqMap EqualCtList -> DictMap Ct -> [QCInst] -> DictMap Ct -> Cts -> TcLevel -> Bool -> InertCans
[inert_eqs] :: InertCans -> InertEqs
[inert_funeqs] :: InertCans -> FunEqMap EqualCtList
[inert_dicts] :: InertCans -> DictMap Ct
[inert_insts] :: InertCans -> [QCInst]
-- | See Note [Safe Haskell Overlapping Instances Implementation] in
-- GHC.Tc.Solver
[inert_safehask] :: InertCans -> DictMap Ct
[inert_irreds] :: InertCans -> Cts
[inert_given_eq_lvl] :: InertCans -> TcLevel
[inert_given_eqs] :: InertCans -> Bool
type InertEqs = DTyVarEnv EqualCtList
emptyInert :: InertSet
addInertItem :: TcLevel -> InertCans -> Ct -> InertCans
-- | 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
-- GHC.Tc.Solver.Interact
matchableGivens :: CtLoc -> PredType -> InertSet -> Cts
mightEqualLater :: InertSet -> TcPredType -> CtLoc -> TcPredType -> CtLoc -> Bool
prohibitedSuperClassSolve :: CtLoc -> CtLoc -> Bool
foldTyEqs :: (Ct -> b -> b) -> InertEqs -> b -> b
delEq :: InertCans -> CanEqLHS -> TcType -> InertCans
findEq :: InertCans -> CanEqLHS -> [Ct]
partitionInertEqs :: (Ct -> Bool) -> InertEqs -> ([Ct], InertEqs)
partitionFunEqs :: (Ct -> Bool) -> FunEqMap EqualCtList -> ([Ct], FunEqMap EqualCtList)
kickOutRewritableLHS :: CtFlavourRole -> CanEqLHS -> InertCans -> (WorkList, InertCans)
type CycleBreakerVarStack = NonEmpty [(TcTyVar, TcType)] " a stack of (CycleBreakerTv, original family applications) lists first element in the stack corresponds to current implication; later elements correspond to outer implications used to undo the cycle-breaking needed to handle Note [Type variable cycles] in GHC.Tc.Solver.Canonical Why store the outer implications? For the use in mightEqualLater (only)"
-- | Push a fresh environment onto the cycle-breaker var stack. Useful when
-- entering a nested implication.
pushCycleBreakerVarStack :: CycleBreakerVarStack -> CycleBreakerVarStack
-- | Add a new cycle-breaker binding to the top environment on the stack.
insertCycleBreakerBinding :: TcTyVar -> TcType -> CycleBreakerVarStack -> CycleBreakerVarStack
-- | Perform a monadic operation on all pairs in the top environment in the
-- stack.
forAllCycleBreakerBindings_ :: Monad m => CycleBreakerVarStack -> (TcTyVar -> TcType -> m ()) -> m ()
instance GHC.Utils.Outputable.Outputable GHC.Tc.Solver.InertSet.InertSet
instance GHC.Utils.Outputable.Outputable GHC.Tc.Solver.InertSet.InertCans
instance GHC.Utils.Outputable.Outputable GHC.Tc.Solver.InertSet.WorkList
-- | Domain types used in GHC.HsToCore.Pmc.Solver. The ultimate goal
-- is to define Nabla, which models normalised refinement types
-- from the paper Lower Your Guards: A Compositional Pattern-Match
-- Coverage Checker".
module GHC.HsToCore.Pmc.Solver.Types
-- | See vi_bot.
data BotInfo
IsBot :: BotInfo
IsNotBot :: BotInfo
MaybeBot :: BotInfo
data PmAltConApp
PACA :: !PmAltCon -> ![TyVar] -> ![Id] -> PmAltConApp
[paca_con] :: PmAltConApp -> !PmAltCon
[paca_tvs] :: PmAltConApp -> ![TyVar]
[paca_ids] :: PmAltConApp -> ![Id]
-- | Information about an Id. Stores positive (vi_pos) facts,
-- like x ~ Just 42, and negative (vi_neg) facts, like "x
-- is not (:)". Also caches the type (vi_ty), the
-- ResidualCompleteMatches of a COMPLETE set (vi_rcm).
--
-- Subject to Note [The Pos/Neg invariant] in
-- GHC.HsToCore.Pmc.Solver.
data VarInfo
VI :: !Id -> ![PmAltConApp] -> !PmAltConSet -> BotInfo -> !ResidualCompleteMatches -> VarInfo
-- | The Id in question. Important for adding new constraints
-- relative to this VarInfo when we don't easily have the
-- Id available.
[vi_id] :: VarInfo -> !Id
-- | Positive info: PmAltCon apps it is (i.e. x ~ [Just y,
-- PatSyn z]), all at the same time (i.e. conjunctive). We need a
-- list because of nested pattern matches involving pattern synonym case
-- x of { Just y -> case x of PatSyn z -> ... } However, no more
-- than one RealDataCon in the list, otherwise contradiction because of
-- generativity.
[vi_pos] :: VarInfo -> ![PmAltConApp]
-- | Negative info: A list of PmAltCons that it cannot match.
-- Example, assuming
--
--
-- data T = Leaf Int | Branch T T | Node Int T
--
--
-- then x ≁ [Leaf, Node] means that x cannot match a
-- Leaf or Node, and hence can only match
-- Branch. Is orthogonal to anything from vi_pos, in the
-- sense that eqPmAltCon returns PossiblyOverlap for any
-- pairing between vi_pos and vi_neg.
[vi_neg] :: VarInfo -> !PmAltConSet
-- | Can this variable be ⊥? Models (mutually contradicting) x ~ ⊥
-- and x ≁ ⊥ constraints. E.g. * MaybeBot: Don't know;
-- Neither x ~ ⊥ nor x ≁ ⊥. * IsBot: x ~
-- ⊥ * IsNotBot: x ≁ ⊥
[vi_bot] :: VarInfo -> BotInfo
-- | A cache of the associated COMPLETE sets. At any time a superset of
-- possible constructors of each COMPLETE set. So, if it's not in here,
-- we can't possibly match on it. Complementary to vi_neg. We
-- still need it to recognise completion of a COMPLETE set efficiently
-- for large enums.
[vi_rcm] :: VarInfo -> !ResidualCompleteMatches
-- | The term oracle state. Stores VarInfo for encountered
-- Ids. These entries are possibly shared when we figure out that
-- two variables must be equal, thus represent the same set of values.
--
-- See Note [TmState invariants] in GHC.HsToCore.Pmc.Solver.
data TmState
TmSt :: !UniqSDFM Id VarInfo -> !CoreMap Id -> !DIdSet -> TmState
-- | Facts about term variables. Deterministic env, so that we generate
-- deterministic error messages.
[ts_facts] :: TmState -> !UniqSDFM Id VarInfo
-- | An environment for looking up whether we already encountered
-- semantically equivalent expressions that we want to represent by the
-- same Id representative.
[ts_reps] :: TmState -> !CoreMap Id
-- | Which VarInfo needs to be checked for inhabitants because of
-- new negative constraints (e.g. x ≁ ⊥ or x ≁ K).
[ts_dirty] :: TmState -> !DIdSet
-- | The type oracle state. An InertSet that we incrementally add
-- local type constraints to, together with a sequence number that counts
-- the number of times we extended it with new facts.
data TyState
TySt :: !Int -> !InertSet -> TyState
[ty_st_n] :: TyState -> !Int
[ty_st_inert] :: TyState -> !InertSet
-- | A normalised refinement type ∇ ("nabla"), comprised of an inert set of
-- canonical (i.e. mutually compatible) term and type constraints that
-- form the refinement type's predicate.
data Nabla
MkNabla :: !TyState -> !TmState -> Nabla
-- | Type oracle; things like a~Int
[nabla_ty_st] :: Nabla -> !TyState
-- | Term oracle; things like x~Nothing
[nabla_tm_st] :: Nabla -> !TmState
-- | A disjunctive bag of Nablas, representing a refinement type.
newtype Nablas
MkNablas :: Bag Nabla -> Nablas
initNablas :: Nablas
lookupRefuts :: Nabla -> Id -> [PmAltCon]
lookupSolution :: Nabla -> Id -> Maybe PmAltConApp
lookupVarInfo :: TmState -> Id -> VarInfo
-- | Like lookupVarInfo ts x, but lookupVarInfo ts x = (y,
-- vi) also looks through newtype constructors. We have x ~ N1
-- (... (Nk y)) such that the returned y doesn't have a
-- positive newtype constructor constraint associated with it (yet). The
-- VarInfo returned is that of y's representative.
--
-- Careful, this means that idType x might be different to
-- idType y, even modulo type normalisation!
--
-- See also Note [Coverage checking Newtype matches] in
-- GHC.HsToCore.Pmc.Solver.
lookupVarInfoNT :: TmState -> Id -> (Id, VarInfo)
trvVarInfo :: Functor f => (VarInfo -> f (a, VarInfo)) -> Nabla -> Id -> f (a, Nabla)
-- | A list of conlikes which represents a complete pattern match. These
-- arise from COMPLETE signatures. See also Note [Implementation
-- of COMPLETE pragmas].
data CompleteMatch
-- | A data type that caches for the VarInfo of x the
-- results of querying dsGetCompleteMatches and then striking
-- out all occurrences of K for which we already know x ≁
-- K from these sets.
--
-- For motivation, see Section 5.3 in Lower Your Guards. See also Note
-- [Implementation of COMPLETE pragmas]
data ResidualCompleteMatches
RCM :: !Maybe CompleteMatch -> !Maybe [CompleteMatch] -> ResidualCompleteMatches
-- | The residual set for the vanilla COMPLETE set from the data defn.
-- Tracked separately from rcm_pragmas, because it might only be
-- known much later (when we have enough type information to see the
-- TyCon of the match), or not at all even. Until that happens, it
-- is Nothing.
[rcm_vanilla] :: ResidualCompleteMatches -> !Maybe CompleteMatch
-- | The residual sets for all COMPLETE sets from pragmas that are
-- visible when compiling this module. Querying that set with
-- dsGetCompleteMatches requires DsM, so we initialise
-- it with Nothing until first needed in a DsM context.
[rcm_pragmas] :: ResidualCompleteMatches -> !Maybe [CompleteMatch]
getRcm :: ResidualCompleteMatches -> [CompleteMatch]
isRcmInitialised :: ResidualCompleteMatches -> Bool
-- | Literals (simple and overloaded ones) for pattern match checking.
--
-- See Note [Undecidable Equality for PmAltCons]
data PmLit
PmLit :: Type -> PmLitValue -> PmLit
[pm_lit_ty] :: PmLit -> Type
[pm_lit_val] :: PmLit -> PmLitValue
data PmLitValue
PmLitInt :: Integer -> PmLitValue
PmLitRat :: Rational -> PmLitValue
PmLitChar :: Char -> PmLitValue
PmLitString :: FastString -> PmLitValue
PmLitOverInt :: Int -> Integer -> PmLitValue
PmLitOverRat :: Int -> FractionalLit -> PmLitValue
PmLitOverString :: FastString -> PmLitValue
-- | Represents the head of a match against a ConLike or literal.
-- Really similar to AltCon.
data PmAltCon
PmAltConLike :: ConLike -> PmAltCon
PmAltLit :: PmLit -> PmAltCon
-- | Type of a PmLit
pmLitType :: PmLit -> Type
-- | Type of a PmAltCon
pmAltConType :: PmAltCon -> [Type] -> Type
-- | Is a match on this constructor forcing the match variable? True of
-- data constructors, literals and pattern synonyms (#17357), but not of
-- newtypes. See Note [Coverage checking Newtype matches] in
-- GHC.HsToCore.Pmc.Solver.
isPmAltConMatchStrict :: PmAltCon -> Bool
pmAltConImplBangs :: PmAltCon -> [HsImplBang]
data PmAltConSet
emptyPmAltConSet :: PmAltConSet
isEmptyPmAltConSet :: PmAltConSet -> Bool
-- | Whether there is a PmAltCon in the PmAltConSet that
-- compares Equal to the given PmAltCon according to
-- eqPmAltCon.
elemPmAltConSet :: PmAltCon -> PmAltConSet -> Bool
extendPmAltConSet :: PmAltConSet -> PmAltCon -> PmAltConSet
pmAltConSetElems :: PmAltConSet -> [PmAltCon]
-- | Undecidable semantic equality result. See Note [Undecidable Equality
-- for PmAltCons]
data PmEquality
Equal :: PmEquality
Disjoint :: PmEquality
PossiblyOverlap :: PmEquality
-- | We can't in general decide whether two PmAltCons match the same
-- set of values. In addition to the reasons in eqPmLit and
-- eqConLike, a PmAltConLike might or might not represent
-- the same value as a PmAltLit. See Note [Undecidable Equality
-- for PmAltCons].
--
--
-- - Just True ==> Surely equal
-- - Just False ==> Surely different (non-overlapping,
-- even!)
-- - Nothing ==> Equality relation undecidable
--
--
-- Examples (omitting some constructor wrapping):
--
--
-- - eqPmAltCon (LitInt 42) (LitInt 1) == Just False: Lit
-- equality is decidable
-- - eqPmAltCon (DataCon A) (DataCon B) == Just False: DataCon
-- equality is decidable
-- - eqPmAltCon (LitOverInt 42) (LitOverInt 1) == Nothing:
-- OverLit equality is undecidable
-- - eqPmAltCon (PatSyn PA) (PatSyn PB) == Nothing: PatSyn
-- equality is undecidable
-- - eqPmAltCon (DataCon I#) (LitInt 1) == Nothing: DataCon to
-- Lit comparisons are undecidable without reasoning about the wrapped
-- Int#
-- - eqPmAltCon (LitOverInt 1) (LitOverInt 1) == Just True: We
-- assume reflexivity for overloaded literals
-- - eqPmAltCon (PatSyn PA) (PatSyn PA) == Just True: We
-- assume reflexivity for Pattern Synonyms
--
eqPmAltCon :: PmAltCon -> PmAltCon -> PmEquality
literalToPmLit :: Type -> Literal -> Maybe PmLit
negatePmLit :: PmLit -> Maybe PmLit
overloadPmLit :: Type -> PmLit -> Maybe PmLit
pmLitAsStringLit :: PmLit -> Maybe FastString
coreExprAsPmLit :: CoreExpr -> Maybe PmLit
instance GHC.Classes.Eq GHC.HsToCore.Pmc.Solver.Types.BotInfo
instance GHC.Show.Show GHC.HsToCore.Pmc.Solver.Types.PmEquality
instance GHC.Classes.Eq GHC.HsToCore.Pmc.Solver.Types.PmEquality
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.Nablas
instance GHC.Base.Semigroup GHC.HsToCore.Pmc.Solver.Types.Nablas
instance GHC.Base.Monoid GHC.HsToCore.Pmc.Solver.Types.Nablas
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.Nabla
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.TmState
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.VarInfo
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.PmAltConSet
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.PmAltConApp
instance GHC.Classes.Eq GHC.HsToCore.Pmc.Solver.Types.PmAltCon
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.PmAltCon
instance GHC.Classes.Eq GHC.HsToCore.Pmc.Solver.Types.PmLit
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.PmEquality
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.PmLit
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.PmLitValue
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.ResidualCompleteMatches
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.BotInfo
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Solver.Types.TyState
-- | Types used through-out pattern match checking. This module is mostly
-- there to be imported from GHC.HsToCore.Types. The exposed API
-- is that of GHC.HsToCore.Pmc.
--
-- These types model the paper Lower Your Guards: A Compositional
-- Pattern-Match Coverage Checker".
module GHC.HsToCore.Pmc.Types
-- | Means by which we identify a source construct for later
-- pretty-printing in a warning message. SDoc for the equation to
-- show, Located for the location.
newtype SrcInfo
SrcInfo :: Located SDoc -> SrcInfo
-- | A very simple language for pattern guards. Let bindings, bang
-- patterns, and matching variables against flat constructor patterns.
-- The LYG guard language.
data PmGrd
-- | PmCon x K dicts args corresponds to a K dicts args <-
-- x guard. The args are bound in this construct, the
-- x is just a use. For the arguments' meaning see
-- ConPatOut.
PmCon :: !Id -> !PmAltCon -> ![TyVar] -> ![EvVar] -> ![Id] -> PmGrd
[pm_id] :: PmGrd -> !Id
[pm_con_con] :: PmGrd -> !PmAltCon
[pm_con_tvs] :: PmGrd -> ![TyVar]
[pm_con_dicts] :: PmGrd -> ![EvVar]
[pm_con_args] :: PmGrd -> ![Id]
-- | PmBang x corresponds to a seq x True guard. If the
-- extra SrcInfo is present, the bang guard came from a source
-- bang pattern, in which case we might want to report it as redundant.
-- See Note [Dead bang patterns] in GHC.HsToCore.Pmc.Check.
PmBang :: !Id -> !Maybe SrcInfo -> PmGrd
[pm_id] :: PmGrd -> !Id
[_pm_loc] :: PmGrd -> !Maybe SrcInfo
-- | PmLet x expr corresponds to a let x = expr guard.
-- This actually binds x.
PmLet :: !Id -> !CoreExpr -> PmGrd
[pm_id] :: PmGrd -> !Id
[_pm_let_expr] :: PmGrd -> !CoreExpr
-- | A sequence of PmGrds.
newtype GrdVec
GrdVec :: [PmGrd] -> GrdVec
-- | A guard tree denoting MatchGroup.
newtype PmMatchGroup p
PmMatchGroup :: NonEmpty (PmMatch p) -> PmMatchGroup p
-- | A guard tree denoting Match: A payload describing the pats
-- and a bunch of GRHS.
data PmMatch p
PmMatch :: !p -> !PmGRHSs p -> PmMatch p
[pm_pats] :: PmMatch p -> !p
[pm_grhss] :: PmMatch p -> !PmGRHSs p
-- | A guard tree denoting GRHSs: A bunch of PmLet guards
-- for local bindings from the GRHSss where clauses and
-- the actual list of GRHS. See Note [Long-distance information
-- for HsLocalBinds] in GHC.HsToCore.Pmc.Desugar.
data PmGRHSs p
PmGRHSs :: !p -> !NonEmpty (PmGRHS p) -> PmGRHSs p
[pgs_lcls] :: PmGRHSs p -> !p
[pgs_grhss] :: PmGRHSs p -> !NonEmpty (PmGRHS p)
-- | A guard tree denoting GRHS: A payload describing the grds and
-- a SrcInfo useful for printing out in warnings messages.
data PmGRHS p
PmGRHS :: !p -> !SrcInfo -> PmGRHS p
[pg_grds] :: PmGRHS p -> !p
[pg_rhs] :: PmGRHS p -> !SrcInfo
-- | A guard tree denoting a pattern binding.
newtype PmPatBind p
PmPatBind :: PmGRHS p -> PmPatBind p
-- | A guard tree denoting an -XEmptyCase.
newtype PmEmptyCase
PmEmptyCase :: Id -> PmEmptyCase
[pe_var] :: PmEmptyCase -> Id
-- | Redundancy sets, used to determine redundancy of RHSs and bang
-- patterns (later digested into a CIRB).
data RedSets
RedSets :: !Nablas -> !Nablas -> !OrdList (Nablas, SrcInfo) -> RedSets
-- | The Covered set; the set of values reaching a particular
-- program point.
[rs_cov] :: RedSets -> !Nablas
-- | The Diverging set; empty if no match can lead to divergence. If
-- it wasn't empty, we have to turn redundancy warnings into
-- inaccessibility warnings for any subclauses.
[rs_div] :: RedSets -> !Nablas
-- | If any of the Nablas is empty, the corresponding SrcInfo
-- pin-points a bang pattern in source that is redundant. See Note [Dead
-- bang patterns].
[rs_bangs] :: RedSets -> !OrdList (Nablas, SrcInfo)
data Precision
Approximate :: Precision
Precise :: Precision
-- | Pattern-match coverage check result
data CheckResult a
CheckResult :: !a -> !Nablas -> !Precision -> CheckResult a
-- | A hole for redundancy info and covered sets.
[cr_ret] :: CheckResult a -> !a
-- | The set of uncovered values falling out at the bottom. (for
-- -Wincomplete-patterns, but also important state for the algorithm)
[cr_uncov] :: CheckResult a -> !Nablas
-- | A flag saying whether we ran into the maxPmCheckModels limit
-- for the purpose of suggesting to crank it up in the warning message.
-- Writer state.
[cr_approx] :: CheckResult a -> !Precision
-- | Used as tree payload pre-checking. The LYG guards to check.
type Pre = GrdVec
-- | Used as tree payload post-checking. The redundancy info we elaborated.
type Post = RedSets
instance GHC.Show.Show GHC.HsToCore.Pmc.Types.Precision
instance GHC.Classes.Eq GHC.HsToCore.Pmc.Types.Precision
instance GHC.Base.Functor GHC.HsToCore.Pmc.Types.CheckResult
instance GHC.Utils.Outputable.Outputable a => GHC.Utils.Outputable.Outputable (GHC.HsToCore.Pmc.Types.CheckResult a)
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Types.RedSets
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Types.Precision
instance GHC.Base.Semigroup GHC.HsToCore.Pmc.Types.Precision
instance GHC.Base.Monoid GHC.HsToCore.Pmc.Types.Precision
instance GHC.Utils.Outputable.Outputable p => GHC.Utils.Outputable.Outputable (GHC.HsToCore.Pmc.Types.PmPatBind p)
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Types.PmEmptyCase
instance GHC.Utils.Outputable.Outputable p => GHC.Utils.Outputable.Outputable (GHC.HsToCore.Pmc.Types.PmMatchGroup p)
instance GHC.Utils.Outputable.Outputable p => GHC.Utils.Outputable.Outputable (GHC.HsToCore.Pmc.Types.PmMatch p)
instance GHC.Utils.Outputable.Outputable p => GHC.Utils.Outputable.Outputable (GHC.HsToCore.Pmc.Types.PmGRHSs p)
instance GHC.Utils.Outputable.Outputable p => GHC.Utils.Outputable.Outputable (GHC.HsToCore.Pmc.Types.PmGRHS p)
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Types.GrdVec
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Types.PmGrd
instance GHC.Utils.Outputable.Outputable GHC.HsToCore.Pmc.Types.SrcInfo
-- | Provides factilities for pretty-printing Nablas in a way
-- appropriate for user facing pattern match warnings.
module GHC.HsToCore.Pmc.Ppr
-- | Pretty-print the guts of an uncovered value vector abstraction, i.e.,
-- its components and refutable shapes associated to any mentioned
-- variables.
--
-- Example for ([Just p, q], [p :-> [3,4], q :-> [0,5]]):
--
--
-- (Just p) q
-- where p is not one of {3, 4}
-- q is not one of {0, 5}
--
--
-- When the set of refutable shapes contains more than 3 elements, the
-- additional elements are indicated by "...".
pprUncovered :: Nabla -> [Id] -> SDoc
module GHC.Tc.Errors.Types
-- | An error which might arise during typechecking/renaming.
data TcRnMessage
-- | Simply wraps a generic Diagnostic message a. It can be
-- used by plugins to provide custom diagnostic messages originated
-- during typechecking/renaming.
[TcRnUnknownMessage] :: (Diagnostic a, Typeable a) => a -> TcRnMessage
-- | TcRnMessageWithInfo is a constructor which is used when extra
-- information is needed to be provided in order to qualify a diagnostic
-- and where it was originated (and why). It carries an extra
-- UnitState which can be used to pretty-print some names and it
-- wraps a TcRnMessageDetailed, which includes any extra context
-- associated with this diagnostic.
[TcRnMessageWithInfo] :: !UnitState -> !TcRnMessageDetailed -> TcRnMessage
-- | TcRnSolverReport is the constructor used to report unsolved
-- constraints after constraint solving, as well as other errors such as
-- hole fit errors.
--
-- See the documentation of the TcSolverReportMsg datatype for an
-- overview of the different errors.
[TcRnSolverReport] :: [SolverReportWithCtxt] -> DiagnosticReason -> [GhcHint] -> TcRnMessage
-- | TcRnRedundantConstraints is a warning that is emitted when a binding
-- has a user-written type signature which contains superfluous
-- constraints.
--
-- Example:
--
-- f :: (Eq a, Ord a) => a -> a -> a f x y = (x < y) || x ==
-- y -- `Eq a` is superfluous: the `Ord a` constraint suffices.
--
-- Test cases: T9939, T10632, T18036a, T20602, PluralS, T19296.
[TcRnRedundantConstraints] :: [Id] -> (SkolemInfoAnon, Bool) -> TcRnMessage
-- | TcRnInaccessibleCode is a warning that is emitted when the RHS of a
-- pattern match is inaccessible, because the constraint solver has
-- detected a contradiction.
--
-- Example:
--
-- data B a where { MkTrue :: B True; MkFalse :: B False }
--
-- foo :: B False -> Bool foo MkFalse = False foo MkTrue = True --
-- Inaccessible: requires True ~ False
--
-- Test cases: T7293, T7294, T15558, T17646, T18572, T18610, tcfail167.
[TcRnInaccessibleCode] :: Implication -> NonEmpty SolverReportWithCtxt -> TcRnMessage
-- | A type which was expected to have a fixed runtime representation does
-- not have a fixed runtime representation.
--
-- Example:
--
-- data D (a :: TYPE r) = MkD a
--
-- Test cases: T11724, T18534, RepPolyPatSynArg,
-- RepPolyPatSynUnliftedNewtype, RepPolyPatSynRes, T20423
[TcRnTypeDoesNotHaveFixedRuntimeRep] :: !Type -> !FixedRuntimeRepProvenance -> !ErrInfo -> TcRnMessage
-- | TcRnImplicitLift is a warning (controlled with -Wimplicit-lift) that
-- occurs when a Template Haskell quote implicitly uses lift.
--
-- Example: warning1 :: Lift t => t -> Q Exp warning1 x = [| x |]
--
-- Test cases: th/T17804
[TcRnImplicitLift] :: Outputable var => var -> !ErrInfo -> TcRnMessage
-- | TcRnUnusedPatternBinds is a warning (controlled with
-- -Wunused-pattern-binds) that occurs if a pattern binding binds no
-- variables at all, unless it is a lone wild-card pattern, or a banged
-- pattern.
--
-- Example: Just _ = rhs3 -- Warning: unused pattern binding (_, _) =
-- rhs4 -- Warning: unused pattern binding _ = rhs3 -- No warning: lone
-- wild-card pattern !() = rhs4 -- No warning: banged pattern; behaves
-- like seq
--
-- Test cases: rename/{T13646,T17c,T17e,T7085}
[TcRnUnusedPatternBinds] :: HsBind GhcRn -> TcRnMessage
-- | TcRnDodgyImports is a warning (controlled with -Wdodgy-imports) that
-- occurs when a datatype T is imported with all constructors,
-- i.e. 'T(..)', but has been exported abstractly, i.e. T.
--
-- Test cases: renameshould_compileT7167
[TcRnDodgyImports] :: RdrName -> TcRnMessage
-- | TcRnDodgyExports is a warning (controlled by -Wdodgy-exports) that
-- occurs when a datatype T is exported with all constructors,
-- i.e. 'T(..)', but is it just a type synonym or a type/data family.
--
-- Example: module Foo ( T(..) -- Warning: T is a type synonym , A(..) --
-- Warning: A is a type family , C(..) -- Warning: C is a data family )
-- where
--
-- type T = Int type family A :: * -> * data family C :: * -> *
--
-- Test cases: warningsshould_compileDodgyExports01
[TcRnDodgyExports] :: Name -> TcRnMessage
-- | TcRnMissingImportList is a warning (controlled by
-- -Wmissing-import-lists) that occurs when an import declaration does
-- not explicitly list all the names brought into scope.
--
-- Test cases: renameshould_compileT4489
[TcRnMissingImportList] :: IE GhcPs -> TcRnMessage
-- | When a module marked trustworthy or unsafe (using -XTrustworthy or
-- -XUnsafe) is compiled with a plugin, the TcRnUnsafeDueToPlugin warning
-- (controlled by -Wunsafe) is used as the reason the module was inferred
-- to be unsafe. This warning is not raised if the -fplugin-trustworthy
-- flag is passed.
--
-- Test cases: plugins/T19926
[TcRnUnsafeDueToPlugin] :: TcRnMessage
-- | TcRnModMissingRealSrcSpan is an error that occurrs when compiling a
-- module that lacks an associated RealSrcSpan.
--
-- Test cases: None
[TcRnModMissingRealSrcSpan] :: Module -> TcRnMessage
-- | TcRnIdNotExportedFromModuleSig is an error pertaining to backpack that
-- occurs when an identifier required by a signature is not exported by
-- the module or signature that is being used as a substitution for that
-- signature.
--
-- Example(s): None
--
-- Test cases: backpackshould_failbkpfail36
[TcRnIdNotExportedFromModuleSig] :: Name -> Module -> TcRnMessage
-- | TcRnIdNotExportedFromLocalSig is an error pertaining to backpack that
-- occurs when an identifier which is necessary for implementing a module
-- signature is not exported from that signature.
--
-- Example(s): None
--
-- Test cases: backpackshould_failbkpfail30
-- backpackshould_failbkpfail31
-- backpackshould_failbkpfail34
[TcRnIdNotExportedFromLocalSig] :: Name -> TcRnMessage
-- | TcRnShadowedName is a warning (controlled by -Wname-shadowing) that
-- occurs whenever an inner-scope value has the same name as an
-- outer-scope value, i.e. the inner value shadows the outer one. This
-- can catch typographical errors that turn into hard-to-find bugs. The
-- warning is suppressed for names beginning with an underscore.
--
-- Examples(s): f = ... let f = id in ... f ... -- NOT OK, f is
-- shadowed f x = do { _ignore <- this; _ignore <- that; return
-- (the other) } -- suppressed via underscore
--
-- Test cases: typecheckshould_compileT10971a
-- renameshould_compilern039 renameshould_compilern064
-- renameshould_compileT1972 renameshould_failT2723
-- renameshould_compileT3262 driver/werror
[TcRnShadowedName] :: OccName -> ShadowedNameProvenance -> TcRnMessage
-- | TcRnDuplicateWarningDecls is an error that occurs whenever a warning
-- is declared twice.
--
-- Examples(s): None.
--
-- Test cases: None.
[TcRnDuplicateWarningDecls] :: !LocatedN RdrName -> !RdrName -> TcRnMessage
-- | TcRnDuplicateWarningDecls is an error that occurs whenever the
-- constraint solver in the simplifier hits the iterations' limit.
--
-- Examples(s): None.
--
-- Test cases: None.
[TcRnSimplifierTooManyIterations] :: Cts -> !IntWithInf -> WantedConstraints -> TcRnMessage
-- | TcRnIllegalPatSynDecl is an error that occurs whenever there is an
-- illegal pattern synonym declaration.
--
-- Examples(s):
--
-- varWithLocalPatSyn x = case x of P -> () where pattern P = () --
-- not valid, it can't be local, it must be defined at top-level.
--
-- Test cases: patsynshould_faillocal
[TcRnIllegalPatSynDecl] :: !LIdP GhcPs -> TcRnMessage
-- | TcRnLinearPatSyn is an error that occurs whenever a pattern synonym
-- signature uses a field that is not unrestricted.
--
-- Example(s): None
--
-- Test cases: linearshould_failLinearPatSyn2
[TcRnLinearPatSyn] :: !Type -> TcRnMessage
-- | TcRnEmptyRecordUpdate is an error that occurs whenever a record is
-- updated without specifying any field.
--
-- Examples(s):
--
-- $(deriveJSON defaultOptions{} ''Bad) -- not ok, no fields selected for
-- update of defaultOptions
--
-- Test cases: th/T12788
[TcRnEmptyRecordUpdate] :: TcRnMessage
-- | TcRnIllegalFieldPunning is an error that occurs whenever field punning
-- is used without the NamedFieldPuns extension enabled.
--
-- Examples(s):
--
-- data Foo = Foo { a :: Int }
--
-- foo :: Foo -> Int foo Foo{a} = a -- Not ok, punning used without
-- extension.
--
-- Test cases: parsershould_failRecordDotSyntaxFail12
[TcRnIllegalFieldPunning] :: !Located RdrName -> TcRnMessage
-- | TcRnIllegalWildcardsInRecord is an error that occurs whenever
-- wildcards (..) are used in a record without the relevant extension
-- being enabled.
--
-- Examples(s):
--
-- data Foo = Foo { a :: Int }
--
-- foo :: Foo -> Int foo Foo{..} = a -- Not ok, wildcards used without
-- extension.
--
-- Test cases: parsershould_failRecordWildCardsFail
[TcRnIllegalWildcardsInRecord] :: !RecordFieldPart -> TcRnMessage
-- | TcRnIllegalWildcardInType is an error that occurs when a wildcard
-- appears in a type in a location in which wildcards aren't allowed.
--
-- Examples:
--
-- Type synonyms:
--
-- type T = _
--
-- Class declarations and instances:
--
-- class C _ instance C _
--
-- Standalone kind signatures:
--
-- type D :: _ data D
--
-- Test cases: ExtraConstraintsWildcardInTypeSplice2
-- ExtraConstraintsWildcardInTypeSpliceUsed
-- ExtraConstraintsWildcardNotLast ExtraConstraintsWildcardTwice
-- NestedExtraConstraintsWildcard NestedNamedExtraConstraintsWildcard
-- PartialClassMethodSignature PartialClassMethodSignature2 T12039
-- T13324_fail1 UnnamedConstraintWildcard1 UnnamedConstraintWildcard2
-- WildcardInADT1 WildcardInADT2 WildcardInADT3 WildcardInADTContext1
-- WildcardInDefault WildcardInDefaultSignature WildcardInDeriving
-- WildcardInForeignExport WildcardInForeignImport WildcardInGADT1
-- WildcardInGADT2 WildcardInInstanceHead WildcardInInstanceSig
-- WildcardInNewtype WildcardInPatSynSig WildcardInStandaloneDeriving
-- WildcardInTypeFamilyInstanceRHS WildcardInTypeSynonymRHS saks_fail003
-- T15433a
[TcRnIllegalWildcardInType] :: Maybe Name -> !BadAnonWildcardContext -> !Maybe HsDocContext -> TcRnMessage
-- | TcRnDuplicateFieldName is an error that occurs whenever there are
-- duplicate field names in a record.
--
-- Examples(s): None.
--
-- Test cases: None.
[TcRnDuplicateFieldName] :: !RecordFieldPart -> NonEmpty RdrName -> TcRnMessage
-- | TcRnIllegalViewPattern is an error that occurs whenever the
-- ViewPatterns syntax is used but the ViewPatterns language extension is
-- not enabled.
--
-- Examples(s): data Foo = Foo { a :: Int }
--
-- foo :: Foo -> Int foo (a -> l) = l -- not OK, the
-- ViewPattern extension is not enabled.
--
-- Test cases: parsershould_failViewPatternsFail
[TcRnIllegalViewPattern] :: !Pat GhcPs -> TcRnMessage
-- | TcRnCharLiteralOutOfRange is an error that occurs whenever a character
-- is out of range.
--
-- Examples(s): None
--
-- Test cases: None
[TcRnCharLiteralOutOfRange] :: !Char -> TcRnMessage
-- | TcRnIllegalWildcardsInConstructor is an error that occurs whenever the
-- record wildcards '..' are used inside a constructor without labeled
-- fields.
--
-- Examples(s): None
--
-- Test cases: None
[TcRnIllegalWildcardsInConstructor] :: !Name -> TcRnMessage
-- | TcRnIgnoringAnnotations is a warning that occurs when the source code
-- contains annotation pragmas but the platform in use does not support
-- an external interpreter such as GHCi and therefore the annotations are
-- ignored.
--
-- Example(s): None
--
-- Test cases: None
[TcRnIgnoringAnnotations] :: [LAnnDecl GhcRn] -> TcRnMessage
-- | TcRnAnnotationInSafeHaskell is an error that occurs if annotation
-- pragmas are used in conjunction with Safe Haskell.
--
-- Example(s): None
--
-- Test cases: annotationsshould_failT10826
[TcRnAnnotationInSafeHaskell] :: TcRnMessage
-- | TcRnInvalidTypeApplication is an error that occurs when a visible type
-- application is used with an expression that does not accept
-- "specified" type arguments.
--
-- Example(s): foo :: forall {a}. a -> a foo x = x bar :: () bar = let
-- x = foo @Int 42 in ()
--
-- Test cases: overloadedrecfldsshould_failoverloadedlabelsfail03
-- typecheckshould_failExplicitSpecificity1
-- typecheckshould_failExplicitSpecificity10
-- typecheckshould_failExplicitSpecificity2
-- typecheckshould_failT17173 typecheckshould_failVtaFail
[TcRnInvalidTypeApplication] :: Type -> LHsWcType GhcRn -> TcRnMessage
-- | TcRnTagToEnumMissingValArg is an error that occurs when the
-- 'tagToEnum#' function is not applied to a single value argument.
--
-- Example(s): tagToEnum# 1 2
--
-- Test cases: None
[TcRnTagToEnumMissingValArg] :: TcRnMessage
-- | TcRnTagToEnumUnspecifiedResTy is an error that occurs when the
-- 'tagToEnum#' function is not given a concrete result type.
--
-- Example(s): foo :: forall a. a foo = tagToEnum
--
-- Test cases: typecheckshould_failtcfail164
[TcRnTagToEnumUnspecifiedResTy] :: Type -> TcRnMessage
-- | TcRnTagToEnumResTyNotAnEnum is an error that occurs when the
-- 'tagToEnum#' function is given a result type that is not an
-- enumeration type.
--
-- Example(s): foo :: Int -- not an enumeration TyCon foo = tagToEnum
--
-- Test cases: typecheckshould_failtcfail164
[TcRnTagToEnumResTyNotAnEnum] :: Type -> TcRnMessage
-- | TcRnArrowIfThenElsePredDependsOnResultTy is an error that occurs when
-- the predicate type of an ifThenElse expression in arrow notation
-- depends on the type of the result.
--
-- Example(s): None
--
-- Test cases: None
[TcRnArrowIfThenElsePredDependsOnResultTy] :: TcRnMessage
-- | TcRnArrowCommandExpected is an error that occurs if a non-arrow
-- command is used where an arrow command is expected.
--
-- Example(s): None
--
-- Test cases: None
[TcRnArrowCommandExpected] :: HsCmd GhcRn -> TcRnMessage
-- | TcRnIllegalHsBootFileDecl is an error that occurs when an hs-boot file
-- contains declarations that are not allowed, such as bindings.
--
-- Example(s): None
--
-- Test cases: None
[TcRnIllegalHsBootFileDecl] :: TcRnMessage
-- | TcRnRecursivePatternSynonym is an error that occurs when a pattern
-- synonym is defined in terms of itself, either directly or indirectly.
--
-- Example(s): pattern A = B pattern B = A
--
-- Test cases: patsynshould_failT16900
[TcRnRecursivePatternSynonym] :: LHsBinds GhcRn -> TcRnMessage
-- | TcRnPartialTypeSigTyVarMismatch is an error that occurs when a partial
-- type signature attempts to unify two different types.
--
-- Example(s): f :: a -> b -> _ f x y = [x, y]
--
-- Test cases: partial-sigsshould_failT14449
[TcRnPartialTypeSigTyVarMismatch] :: Name -> Name -> Name -> LHsSigWcType GhcRn -> TcRnMessage
-- | TcRnPartialTypeSigBadQuantifier is an error that occurs when a type
-- variable being quantified over in the partial type signature of a
-- function gets unified with a type that is free in that function's
-- context.
--
-- Example(s): foo :: Num a => a -> a foo xxx = g xxx where g ::
-- forall b. Num b => _ -> b g y = xxx + y
--
-- Test cases: partial-sigshould_failT14479
[TcRnPartialTypeSigBadQuantifier] :: Name -> Name -> Maybe Type -> LHsSigWcType GhcRn -> TcRnMessage
-- | TcRnMissingSignature is a warning that occurs when a top-level binding
-- or a pattern synonym does not have a type signature.
--
-- Controlled by the flags: -Wmissing-signatures
-- -Wmissing-exported-signatures -Wmissing-pattern-synonym-signatures
-- -Wmissing-exported-pattern-synonym-signatures
-- -Wmissing-kind-signatures
--
-- Test cases: T11077 (top-level bindings) T12484 (pattern synonyms)
-- T19564 (kind signatures)
[TcRnMissingSignature] :: MissingSignature -> Exported -> Bool -> TcRnMessage
-- | TcRnPolymorphicBinderMissingSig is a warning controlled by
-- -Wmissing-local-signatures that occurs when a local polymorphic
-- binding lacks a type signature.
--
-- Example(s): id a = a
--
-- Test cases: warningsshould_compileT12574
[TcRnPolymorphicBinderMissingSig] :: Name -> Type -> TcRnMessage
-- | TcRnOverloadedSig is an error that occurs when a binding group
-- conflicts with the monomorphism restriction.
--
-- Example(s): data T a = T a mono = ... where x :: Applicative f => f
-- a T x = ...
--
-- Test cases: typecheckshould_compileT11339
[TcRnOverloadedSig] :: TcIdSigInfo -> TcRnMessage
-- | TcRnTupleConstraintInst is an error that occurs whenever an instance
-- for a tuple constraint is specified.
--
-- Examples(s): class C m a class D m a f :: (forall a. Eq a => (C m
-- a, D m a)) => m a f = undefined
--
-- Test cases: quantified-constraints/T15334
[TcRnTupleConstraintInst] :: !Class -> TcRnMessage
-- | TcRnAbstractClassInst is an error that occurs whenever an instance of
-- an abstract class is specified.
--
-- Examples(s): -- A.hs-boot module A where class C a
--
--
-- - - B.hs module B where import A instance C Int where
-- - - A.hs module A where import B class C a where f :: a
-- - - Main.hs import A main = print (f :: Int)
--
--
-- Test cases: typecheckshould_failT13068
[TcRnAbstractClassInst] :: !Class -> TcRnMessage
-- | TcRnNoClassInstHead is an error that occurs whenever an instance head
-- is not headed by a class.
--
-- Examples(s): instance c
--
-- Test cases: typecheckrenameT5513 typecheckrenameT16385
[TcRnNoClassInstHead] :: !Type -> TcRnMessage
-- | TcRnUserTypeError is an error that occurs due to a user's custom type
-- error, which can be triggered by adding a TypeError
-- constraint in a type signature or typeclass instance.
--
-- Examples(s): f :: TypeError (Text "This is a type error") f =
-- undefined
--
-- Test cases: typecheckshould_failCustomTypeErrors02
-- typecheckshould_failCustomTypeErrors03
[TcRnUserTypeError] :: !Type -> TcRnMessage
-- | TcRnConstraintInKind is an error that occurs whenever a constraint is
-- specified in a kind.
--
-- Examples(s): data Q :: Eq a => Type where {}
--
-- Test cases: dependentshould_failT13895 polykinds/T16263
-- saksshould_failsaks_fail004 typecheckshould_failT16059a
-- typecheckshould_failT18714
[TcRnConstraintInKind] :: !Type -> TcRnMessage
-- | TcRnUnboxedTupleTypeFuncArg is an error that occurs whenever an
-- unboxed tuple or unboxed sum type is specified as a function argument,
-- when the appropriate extension (`-XUnboxedTuples` or `-XUnboxedSums`)
-- isn't enabled.
--
-- Examples(s): -- T15073.hs import T15073a newtype Foo a = MkFoo a
-- deriving P
--
--
-- - - T15073a.hs class P a where p :: a -> ()
--
--
-- Test cases: derivingshould_failT15073.hs
-- derivingshould_failT15073a.hs
-- typecheckshould_failT16059d
[TcRnUnboxedTupleOrSumTypeFuncArg] :: UnboxedTupleOrSum -> !Type -> TcRnMessage
-- | TcRnLinearFuncInKind is an error that occurs whenever a linear
-- function is specified in a kind.
--
-- Examples(s): data A :: * %1 -> *
--
-- Test cases: linearshould_failLinearKind
-- linearshould_failLinearKind2
-- linearshould_failLinearKind3
[TcRnLinearFuncInKind] :: !Type -> TcRnMessage
-- | TcRnForAllEscapeError is an error that occurs whenever a quantified
-- type's kind mentions quantified type variable.
--
-- Examples(s): type T :: TYPE (BoxedRep l) data T = MkT
--
-- Test cases: unlifted-datatypesshould_failUnlDataNullaryPoly
[TcRnForAllEscapeError] :: !Type -> !Kind -> TcRnMessage
-- | TcRnVDQInTermType is an error that occurs whenever a visible dependent
-- quantification is specified in the type of a term.
--
-- Examples(s): a = (undefined :: forall k -> k -> Type) @Int
--
-- Test cases: dependentshould_failT15859
-- dependentshould_failT16326_Fail1
-- dependentshould_failT16326_Fail2
-- dependentshould_failT16326_Fail3
-- dependentshould_failT16326_Fail4
-- dependentshould_failT16326_Fail5
-- dependentshould_failT16326_Fail6
-- dependentshould_failT16326_Fail7
-- dependentshould_failT16326_Fail8
-- dependentshould_failT16326_Fail9
-- dependentshould_failT16326_Fail10
-- dependentshould_failT16326_Fail11
-- dependentshould_failT16326_Fail12
-- dependentshould_failT17687 dependentshould_failT18271
[TcRnVDQInTermType] :: !Type -> TcRnMessage
-- | TcRnBadQuantPredHead is an error that occurs whenever a quantified
-- predicate lacks a class or type variable head.
--
-- Examples(s): class (forall a. A t a => A t [a]) => B t where
-- type A t a :: Constraint
--
-- Test cases: quantified-constraints/T16474
[TcRnBadQuantPredHead] :: !Type -> TcRnMessage
-- | TcRnIllegalTupleConstraint is an error that occurs whenever an illegal
-- tuple constraint is specified.
--
-- Examples(s): g :: ((Show a, Num a), Eq a) => a -> a g =
-- undefined
--
-- Test cases: typecheckshould_failtcfail209a
[TcRnIllegalTupleConstraint] :: !Type -> TcRnMessage
-- | TcRnNonTypeVarArgInConstraint is an error that occurs whenever a non
-- type-variable argument is specified in a constraint.
--
-- Examples(s): data T instance Eq Int => Eq T
--
-- Test cases: ghciscriptsT13202 ghciscriptsT13202a
-- polykinds/T12055a typecheckshould_failT10351
-- typecheckshould_failT19187 typecheckshould_failT6022
-- typecheckshould_failT8883
[TcRnNonTypeVarArgInConstraint] :: !Type -> TcRnMessage
-- | TcRnIllegalImplicitParam is an error that occurs whenever an illegal
-- implicit parameter is specified.
--
-- Examples(s): type Bla = ?x::Int data T = T instance Bla => Eq T
--
-- Test cases: polykinds/T11466 typecheckshould_failT8912
-- typecheckshould_failtcfail041
-- typecheckshould_failtcfail211
-- typecheckshould_failtcrun045
[TcRnIllegalImplicitParam] :: !Type -> TcRnMessage
-- | TcRnIllegalConstraintSynonymOfKind is an error that occurs whenever an
-- illegal constraint synonym of kind is specified.
--
-- Examples(s): type Showish = Show f :: (Showish a) => a -> a f =
-- undefined
--
-- Test cases: typecheckshould_failtcfail209
[TcRnIllegalConstraintSynonymOfKind] :: !Type -> TcRnMessage
-- | TcRnIllegalClassInst is an error that occurs whenever a class instance
-- is specified for a non-class.
--
-- Examples(s): type C1 a = (Show (a -> Bool)) instance C1 Int where
--
-- Test cases: polykinds/T13267
[TcRnIllegalClassInst] :: !TyConFlavour -> TcRnMessage
-- | TcRnOversaturatedVisibleKindArg is an error that occurs whenever an
-- illegal oversaturated visible kind argument is specified.
--
-- Examples(s): type family F2 :: forall (a :: Type). Type where F2 @a =
-- Maybe a
--
-- Test cases: typecheckshould_failT15793
-- typecheckshould_failT16255
[TcRnOversaturatedVisibleKindArg] :: !Type -> TcRnMessage
-- | TcRnBadAssociatedType is an error that occurs whenever a class doesn't
-- have an associated type.
--
-- Examples(s): $(do d <- instanceD (cxt []) (conT ''Eq appT
-- conT ''Foo) [tySynInstD $ tySynEqn Nothing (conT ''Rep appT
-- conT ''Foo) (conT ''Maybe)] return [d]) ======> instance Eq Foo
-- where type Rep Foo = Maybe
--
-- Test cases: th/T12387a
[TcRnBadAssociatedType] :: !Name -> !Name -> TcRnMessage
-- | TcRnForAllRankErr is an error that occurs whenever an illegal ranked
-- type is specified.
--
-- Examples(s): foo :: (a,b) -> (a~b => t) -> (a,b) foo p x = p
--
-- Test cases: - ghcishould_runT15806 -
-- indexed-typesshould_failSimpleFail15 -
-- typecheckshould_failT11355 - typecheckshould_failT12083a
-- - typecheckshould_failT12083b -
-- typecheckshould_failT16059c -
-- typecheckshould_failT16059e - typecheckshould_failT17213
-- - typecheckshould_failT18939_Fail -
-- typecheckshould_failT2538 - typecheckshould_failT5957 -
-- typecheckshould_failT7019 - typecheckshould_failT7019a -
-- typecheckshould_failT7809 - typecheckshould_failT9196 -
-- typecheckshould_failtcfail127 -
-- typecheckshould_failtcfail184 -
-- typecheckshould_failtcfail196 -
-- typecheckshould_failtcfail197
[TcRnForAllRankErr] :: !Rank -> !Type -> TcRnMessage
-- | TcRnMonomorphicBindings is a warning (controlled by
-- -Wmonomorphism-restriction) that arise when the monomorphism
-- restriction applies to the given bindings.
--
-- Examples(s):
--
-- bar = 10
--
-- foo :: Int foo = bar
--
-- main :: IO () main = print foo
--
-- The example above emits the warning (for bar), because
-- without monomorphism restriction the inferred type for bar is
-- 'bar :: Num p => p'. This warning tells us that if we were
-- to enable '-XMonomorphismRestriction' we would make bar less
-- polymorphic, as its type would become 'bar :: Int', so GHC warns us
-- about that.
--
-- Test cases: typecheckshould_compileT13785
[TcRnMonomorphicBindings] :: [Name] -> TcRnMessage
-- | TcRnOrphanInstance is a warning (controlled by -Wwarn-orphans) that
-- arises when a typeclass instance is an "orphan", i.e. if it appears in
-- a module in which neither the class nor the type being instanced are
-- declared in the same module.
--
-- Examples(s): None
--
-- Test cases: warningsshould_compileT9178
-- typecheckshould_compileT4912
[TcRnOrphanInstance] :: ClsInst -> TcRnMessage
-- | TcRnFunDepConflict is an error that occurs when there are functional
-- dependencies conflicts between instance declarations.
--
-- Examples(s): None
--
-- Test cases: typecheckshould_failT2307
-- typecheckshould_failtcfail096
-- typecheckshould_failtcfail202
[TcRnFunDepConflict] :: !UnitState -> NonEmpty ClsInst -> TcRnMessage
-- | TcRnDupInstanceDecls is an error that occurs when there are duplicate
-- instance declarations.
--
-- Examples(s): class Foo a where foo :: a -> Int
--
-- instance Foo Int where foo = id
--
-- instance Foo Int where foo = const 42
--
-- Test cases: cabalT12733T12733
-- typecheckshould_failtcfail035
-- typecheckshould_failtcfail023
-- backpackshould_failbkpfail18
-- typecheckshould_failTcNullaryTCFail
-- typecheckshould_failtcfail036
-- typecheckshould_failtcfail073 module/mod51 module/mod52
-- module/mod44
[TcRnDupInstanceDecls] :: !UnitState -> NonEmpty ClsInst -> TcRnMessage
-- | TcRnConflictingFamInstDecls is an error that occurs when there are
-- conflicting family instance declarations.
--
-- Examples(s): None.
--
-- Test cases: indexed-typesshould_failExplicitForAllFams4b
-- indexed-typesshould_failNoGood
-- indexed-typesshould_failOver
-- indexed-typesshould_failOverDirectThisMod
-- indexed-typesshould_failOverIndirectThisMod
-- indexed-typesshould_failSimpleFail11a
-- indexed-typesshould_failSimpleFail11b
-- indexed-typesshould_failSimpleFail11c
-- indexed-typesshould_failSimpleFail11d
-- indexed-typesshould_failSimpleFail2a
-- indexed-typesshould_failSimpleFail2b
-- indexed-typesshould_failT13092/T13092
-- indexed-typesshould_failT13092c/T13092c
-- indexed-typesshould_failT14179
-- indexed-typesshould_failT2334A
-- indexed-typesshould_failT2677
-- indexed-typesshould_failT3330b
-- indexed-typesshould_failT4246
-- indexed-typesshould_failT7102a
-- indexed-typesshould_failT9371 polykinds/T7524
-- typecheckshould_failUnliftedNewtypesOverlap
[TcRnConflictingFamInstDecls] :: NonEmpty FamInst -> TcRnMessage
[TcRnFamInstNotInjective] :: InjectivityErrReason -> TyCon -> NonEmpty CoAxBranch -> TcRnMessage
-- | TcRnBangOnUnliftedType is a warning (controlled by
-- -Wredundant-strictness-flags) that occurs when a strictness annotation
-- is applied to an unlifted type.
--
-- Example(s): data T = MkT !Int# -- Strictness flag has no effect on
-- unlifted types
--
-- Test cases: typecheckshould_compileT20187a
-- typecheckshould_compileT20187b
[TcRnBangOnUnliftedType] :: !Type -> TcRnMessage
-- | TcRnMultipleDefaultDeclarations is an error that occurs when a module
-- has more than one default declaration.
--
-- Example: default (Integer, Int) default (Double, Float) -- 2nd default
-- declaration not allowed
--
-- Text cases: module/mod58
[TcRnMultipleDefaultDeclarations] :: [LDefaultDecl GhcRn] -> TcRnMessage
-- | TcRnBadDefaultType is an error that occurs when a type used in a
-- default declaration does not have an instance for any of the
-- applicable classes.
--
-- Example(s): data Foo default (Foo)
--
-- Test cases: typecheckshould_failT11974b
[TcRnBadDefaultType] :: Type -> [Class] -> TcRnMessage
-- | TcRnPatSynBundledWithNonDataCon is an error that occurs when a
-- module's export list bundles a pattern synonym with a type that is not
-- a proper `data` or `newtype` construction.
--
-- Example(s): module Foo (MyClass(.., P)) where pattern P = Nothing
-- class MyClass a where foo :: a -> Int
--
-- Test cases: patsynshould_failexport-class
[TcRnPatSynBundledWithNonDataCon] :: TcRnMessage
-- | TcRnPatSynBundledWithWrongType is an error that occurs when the export
-- list of a module has a pattern synonym bundled with a type that does
-- not match the type of the pattern synonym.
--
-- Example(s): module Foo (R(P,x)) where data Q = Q Int data R = R
-- pattern P{x} = Q x
--
-- Text cases: patsynshould_failexport-ps-rec-sel
-- patsynshould_failexport-type-synonym
-- patsynshould_failexport-type
[TcRnPatSynBundledWithWrongType] :: Type -> Type -> TcRnMessage
-- | TcRnDupeModuleExport is a warning controlled by
-- -Wduplicate-exports that occurs when a module appears more
-- than once in an export list.
--
-- Example(s): module Foo (module Bar, module Bar) import Bar
--
-- Text cases: None
[TcRnDupeModuleExport] :: ModuleName -> TcRnMessage
-- | TcRnExportedModNotImported is an error that occurs when an export list
-- contains a module that is not imported.
--
-- Example(s): None
--
-- Text cases: module/mod135 module/mod8
-- renameshould_failrnfail028 backpackshould_failbkpfail48
[TcRnExportedModNotImported] :: ModuleName -> TcRnMessage
-- | TcRnNullExportedModule is a warning controlled by -Wdodgy-exports that
-- occurs when an export list contains a module that has no exports.
--
-- Example(s): module Foo (module Bar) where import Bar ()
--
-- Test cases: None
[TcRnNullExportedModule] :: ModuleName -> TcRnMessage
-- | TcRnMissingExportList is a warning controlled by
-- -Wmissing-export-lists that occurs when a module does not have an
-- explicit export list.
--
-- Example(s): None
--
-- Test cases: typecheckshould_failMissingExportList03
[TcRnMissingExportList] :: ModuleName -> TcRnMessage
-- | TcRnExportHiddenComponents is an error that occurs when an export
-- contains constructor or class methods that are not visible.
--
-- Example(s): None
--
-- Test cases: None
[TcRnExportHiddenComponents] :: IE GhcPs -> TcRnMessage
-- | TcRnDuplicateExport is a warning (controlled by -Wduplicate-exports)
-- that occurs when an identifier appears in an export list more than
-- once.
--
-- Example(s): None
--
-- Test cases: module/MultiExport module/mod128 module/mod14 module/mod5
-- overloadedrecfldsshould_failDuplicateExports
-- patsynshould_compileT11959
[TcRnDuplicateExport] :: GreName -> IE GhcPs -> IE GhcPs -> TcRnMessage
-- | TcRnExportedParentChildMismatch is an error that occurs when an export
-- is bundled with a parent that it does not belong to
--
-- Example(s): module Foo (T(a)) where data T a = True
--
-- Test cases: module/T11970 module/T11970B module/mod17 module/mod3
-- overloadedrecfldsshould_failNoParent
[TcRnExportedParentChildMismatch] :: Name -> TyThing -> GreName -> [Name] -> TcRnMessage
-- | TcRnConflictingExports is an error that occurs when different
-- identifiers that have the same name are being exported by a module.
--
-- Example(s): module Foo (Bar.f, module Baz) where import qualified Bar
-- (f) import Baz (f)
--
-- Test cases: module/mod131 module/mod142 module/mod143 module/mod144
-- module/mod145 module/mod146 module/mod150 module/mod155
-- overloadedrecfldsshould_failT14953
-- overloadedrecfldsshould_failoverloadedrecfldsfail10
-- renameshould_failrnfail029 renameshould_failrnfail040
-- typecheckshould_failT16453E2
-- typecheckshould_failtcfail025
-- typecheckshould_failtcfail026
[TcRnConflictingExports] :: OccName -> GreName -> GlobalRdrElt -> IE GhcPs -> GreName -> GlobalRdrElt -> IE GhcPs -> TcRnMessage
-- | TcRnAmbiguousField is a warning controlled by -Wambiguous-fields
-- occurring when a record update's type cannot be precisely determined.
-- This will not be supported by -XDuplicateRecordFields in future
-- releases.
--
-- Example(s): data Person = MkPerson { personId :: Int, name :: String }
-- data Address = MkAddress { personId :: Int, address :: String } bad1 x
-- = x { personId = 4 } :: Person -- ambiguous bad2 (x :: Person) = x {
-- personId = 4 } -- ambiguous good x = (x :: Person) { personId = 4 } --
-- not ambiguous
--
-- Test cases: overloadedrecfldsshould_failoverloadedrecfldsfail06
[TcRnAmbiguousField] :: HsExpr GhcRn -> TyCon -> TcRnMessage
-- | TcRnMissingFields is a warning controlled by -Wmissing-fields
-- occurring when the intialisation of a record is missing one or more
-- (lazy) fields.
--
-- Example(s): data Rec = Rec { a :: Int, b :: String, c :: Bool } x =
-- Rec { a = 1, b = "two" } -- missing field c
--
-- Test cases: deSugarshould_compileT13870
-- deSugarshould_compileds041 patsynshould_compileT11283
-- renameshould_compileT5334 renameshould_compileT12229
-- renameshould_compileT5892a
-- warningsshould_failWerrorFail2
[TcRnMissingFields] :: ConLike -> [(FieldLabelString, TcType)] -> TcRnMessage
-- | TcRnFieldUpdateInvalidType is an error occurring when an updated
-- field's type mentions something that is outside the universally
-- quantified variables of the data constructor, such as an existentially
-- quantified type.
--
-- Example(s): data X = forall a. MkX { f :: a } x = (MkX ()) { f = False
-- }
--
-- Test cases: patsynshould_failrecords-exquant
-- typecheckshould_failT3323
[TcRnFieldUpdateInvalidType] :: [(FieldLabelString, TcType)] -> TcRnMessage
-- | TcRnNoConstructorHasAllFields is an error that occurs when a record
-- update has fields that no single constructor encompasses.
--
-- Example(s): data Foo = A { x :: Bool } | B { y :: Int } foo = (A
-- False) { x = True, y = 5 }
--
-- Test cases: overloadedrecfldsshould_failoverloadedrecfldsfail08
-- patsynshould_failmixed-pat-syn-record-sels
-- typecheckshould_failT7989
[TcRnNoConstructorHasAllFields] :: [FieldLabelString] -> TcRnMessage
[TcRnMixedSelectors] :: Name -> [Id] -> Name -> [Id] -> TcRnMessage
[TcRnMissingStrictFields] :: ConLike -> [(FieldLabelString, TcType)] -> TcRnMessage
[TcRnNoPossibleParentForFields] :: [LHsRecUpdField GhcRn] -> TcRnMessage
[TcRnBadOverloadedRecordUpdate] :: [LHsRecUpdField GhcRn] -> TcRnMessage
[TcRnStaticFormNotClosed] :: Name -> NotClosedReason -> TcRnMessage
-- | TcRnSpecialClassInst is an error that occurs when a user attempts to
-- define an instance for a built-in typeclass such as
-- Coercible, Typeable, or KnownNat, outside of
-- a signature file.
--
-- Test cases: derivingshould_failT9687
-- derivingshould_failT14916 polykinds/T8132
-- typecheckshould_failTcCoercibleFail2
-- typecheckshould_failT12837 typecheckshould_failT14390
[TcRnSpecialClassInst] :: !Class -> !Bool -> TcRnMessage
-- | TcRnUselessTypeable is a warning (controlled by -Wderiving-typeable)
-- that occurs when trying to derive an instance of the Typeable
-- class. Deriving Typeable is no longer necessary (hence the
-- "useless") as all types automatically derive Typeable in modern
-- GHC versions.
--
-- Example(s): None.
--
-- Test cases: warningsshould_compileDerivingTypeable
[TcRnUselessTypeable] :: TcRnMessage
-- | TcRnDerivingDefaults is a warning (controlled by -Wderiving-defaults)
-- that occurs when both DeriveAnyClass and
-- GeneralizedNewtypeDeriving are enabled, and therefore GHC
-- defaults to DeriveAnyClass, which might not be what the user
-- wants.
--
-- Example(s): None.
--
-- Test cases: typecheckshould_compileT15839a
-- derivingshould_compileT16179
[TcRnDerivingDefaults] :: !Class -> TcRnMessage
-- | TcRnNonUnaryTypeclassConstraint is an error that occurs when GHC
-- encounters a non-unary constraint when trying to derive a typeclass.
--
-- Example(s): class A deriving instance A data B deriving A -- We cannot
-- derive A, is not unary (i.e. 'class A a').
--
-- Test cases: derivingshould_failT7959
-- derivingshould_faildrvfail005
-- derivingshould_faildrvfail009
-- derivingshould_faildrvfail006
[TcRnNonUnaryTypeclassConstraint] :: !LHsSigType GhcRn -> TcRnMessage
-- | TcRnPartialTypeSignatures is a warning (controlled by
-- -Wpartial-type-signatures) that occurs when a wildcard '_' is found in
-- place of a type in a signature or a type class derivation
--
-- Example(s): foo :: _ -> Int foo = ...
--
-- deriving instance _ => Eq (Foo a)
--
-- Test cases: dependentshould_compileT11241
-- dependentshould_compileT15076
-- dependentshould_compileT14880-2
-- typecheckshould_compileT17024
-- typecheckshould_compileT10072
-- partial-sigsshould_failTidyClash2
-- partial-sigsshould_failDefaulting1MROff
-- partial-sigsshould_failWildcardsInPatternAndExprSig
-- partial-sigsshould_failT10615
-- partial-sigsshould_failT14584a
-- partial-sigsshould_failTidyClash
-- partial-sigsshould_failT11122
-- partial-sigsshould_failT14584
-- partial-sigsshould_failT10045
-- partial-sigsshould_failPartialTypeSignaturesDisabled
-- partial-sigsshould_failT10999
-- partial-sigsshould_failExtraConstraintsWildcardInExpressionSignature
-- partial-sigsshould_failExtraConstraintsWildcardInPatternSplice
-- partial-sigsshould_failWildcardInstantiations
-- partial-sigsshould_runT15415
-- partial-sigsshould_compileT10463
-- partial-sigsshould_compileT15039a
-- partial-sigsshould_compileT16728b
-- partial-sigsshould_compileT15039c
-- partial-sigsshould_compileT10438
-- partial-sigsshould_compileSplicesUsed
-- partial-sigsshould_compileT18008
-- partial-sigsshould_compileExprSigLocal
-- partial-sigsshould_compileT11339a
-- partial-sigsshould_compileT11670
-- partial-sigsshould_compileWarningWildcardInstantiations
-- partial-sigsshould_compileT16728
-- partial-sigsshould_compileT12033
-- partial-sigsshould_compileT15039b
-- partial-sigsshould_compileT10403
-- partial-sigsshould_compileT11192
-- partial-sigsshould_compileT16728a
-- partial-sigsshould_compileTypedSplice
-- partial-sigsshould_compileT15039d
-- partial-sigsshould_compileT11016
-- partial-sigsshould_compileT13324_compile2
-- linearshould_failLinearPartialSig polykinds/T14265
-- polykinds/T14172
[TcRnPartialTypeSignatures] :: !SuggestPartialTypeSignatures -> !ThetaType -> TcRnMessage
-- | TcRnCannotDeriveInstance is an error that occurs every time a
-- typeclass instance can't be derived. The
-- DeriveInstanceErrReason will contain the specific reason this
-- error arose.
--
-- Example(s): None.
--
-- Test cases: genericsT10604T10604_no_PolyKinds
-- derivingshould_faildrvfail009
-- derivingshould_faildrvfail-functor2
-- derivingshould_failT10598_fail3
-- derivingshould_failderiving-via-fail2
-- derivingshould_failderiving-via-fail
-- derivingshould_failT16181
[TcRnCannotDeriveInstance] :: !Class -> [Type] -> !Maybe (DerivStrategy GhcTc) -> !UsingGeneralizedNewtypeDeriving -> !DeriveInstanceErrReason -> TcRnMessage
-- | TcRnLazyGADTPattern is an error that occurs when a user writes a
-- nested GADT pattern match inside a lazy (~) pattern.
--
-- Test case: gadt/lazypat
[TcRnLazyGADTPattern] :: TcRnMessage
-- | TcRnArrowProcGADTPattern is an error that occurs when a user writes a
-- GADT pattern inside arrow proc notation.
--
-- Test case: arrowsshould_failarrowfail004.
[TcRnArrowProcGADTPattern] :: TcRnMessage
-- | TcRnForallIdentifier is a warning (controlled with
-- -Wforall-identifier) that occurs when a definition uses
-- forall as an identifier.
--
-- Example: forall x = () g forall = ()
--
-- Test cases: T20609 T20609a T20609b T20609c T20609d
[TcRnForallIdentifier] :: RdrName -> TcRnMessage
-- | TcRnTypeEqualityOutOfScope is a warning (controlled by
-- -Wtype-equality-out-of-scope) that occurs when the type equality (a ~
-- b) is not in scope.
--
-- Test case: T18862b
[TcRnTypeEqualityOutOfScope] :: TcRnMessage
-- | TcRnTypeEqualityRequiresOperators is a warning (controlled by
-- -Wtype-equality-requires-operators) that occurs when the type equality
-- (a ~ b) is used without the TypeOperators extension.
--
-- Example:
--
-- f :: (a ~ b) => a -> b
--
-- Test case: T18862a
[TcRnTypeEqualityRequiresOperators] :: TcRnMessage
-- | TcRnIllegalTypeOperator is an error that occurs when a type operator
-- is used without the TypeOperators extension.
--
-- Example:
--
-- f :: Vec a n -> Vec a m -> Vec a (n + m)
--
-- Test case: T12811
[TcRnIllegalTypeOperator] :: !SDoc -> !RdrName -> TcRnMessage
-- | TcRnGADTMonoLocalBinds is a warning controlled by
-- -Wgadt-mono-local-binds that occurs when pattern matching on a GADT
-- when -XMonoLocalBinds is off.
--
-- Example(s): None
--
-- Test cases: T20485, T20485a
[TcRnGADTMonoLocalBinds] :: TcRnMessage
-- | The TcRnNotInScope constructor is used for various not-in-scope
-- errors. See NotInScopeError for more details.
[TcRnNotInScope] :: NotInScopeError -> RdrName -> [ImportError] -> [GhcHint] -> TcRnMessage
-- | TcRnUntickedPromotedConstructor is a warning (controlled with
-- -Wunticked-promoted-constructors) that is triggered by an unticked
-- occurrence of a promoted data constructor.
--
-- Example:
--
-- data A = MkA type family F (a :: A) where { F MkA = Bool }
--
-- Test case: T9778.
[TcRnUntickedPromotedConstructor] :: Name -> TcRnMessage
-- | TcRnIllegalBuiltinSyntax is an error that occurs when built-in syntax
-- appears in an unexpected location, e.g. as a data constructor or in a
-- fixity declaration.
--
-- Examples:
--
-- infixl 5 :
--
-- data P = (,)
--
-- Test cases: rnfail042, T14907b, T15124, T15233.
[TcRnIllegalBuiltinSyntax] :: SDoc -> RdrName -> TcRnMessage
-- | TcRnWarnDefaulting is a warning (controlled by -Wtype-defaults) that
-- is triggered whenever a Wanted typeclass constraint is solving through
-- the defaulting of a type variable.
--
-- Example:
--
-- one = show 1 -- We get Wanteds Show a0, Num a0, and default a0 to
-- Integer.
--
-- Test cases: none (which are really specific to defaulting), but see
-- e.g. tcfail204.
[TcRnWarnDefaulting] :: [Ct] -> Maybe TyVar -> Type -> TcRnMessage
-- | TcRnIncorrectNameSpace is an error that occurs when a Name is
-- used in the incorrect NameSpace, e.g. a type constructor or
-- class used in a term, or a term variable used in a type.
--
-- Example:
--
-- f x = Int
--
-- Test cases: T18740a, T20884.
[TcRnIncorrectNameSpace] :: Name -> Bool -> TcRnMessage
[TcRnForeignImportPrimExtNotSet] :: ForeignImport -> TcRnMessage
[TcRnForeignImportPrimSafeAnn] :: ForeignImport -> TcRnMessage
[TcRnForeignFunctionImportAsValue] :: ForeignImport -> TcRnMessage
[TcRnFunPtrImportWithoutAmpersand] :: ForeignImport -> TcRnMessage
[TcRnIllegalForeignDeclBackend] :: Either ForeignExport ForeignImport -> Backend -> ExpectedBackends -> TcRnMessage
[TcRnUnsupportedCallConv] :: Either ForeignExport ForeignImport -> UnsupportedCallConvention -> TcRnMessage
[TcRnIllegalForeignType] :: !Maybe ArgOrResult -> !IllegalForeignTypeReason -> TcRnMessage
[TcRnInvalidCIdentifier] :: !CLabelString -> TcRnMessage
-- | TcRnMessageDetailed is an "internal" type (used only inside
-- Monad that wraps a TcRnMessage while also providing any
-- extra info needed to correctly pretty-print this diagnostic later on.
data TcRnMessageDetailed
TcRnMessageDetailed :: !ErrInfo -> !TcRnMessage -> TcRnMessageDetailed
data ErrInfo
ErrInfo :: !SDoc -> !SDoc -> ErrInfo
-- | Extra context associated to the error.
[errInfoContext] :: ErrInfo -> !SDoc
-- | Extra supplementary info associated to the error.
[errInfoSupplementary] :: ErrInfo -> !SDoc
-- | In what context did we require a type to have a fixed runtime
-- representation?
--
-- Used by checkTypeHasFixedRuntimeRep for throwing representation
-- polymorphism errors when validity checking.
--
-- See Note [Representation polymorphism checking] in
-- GHC.Tc.Utils.Concrete
data FixedRuntimeRepProvenance
-- | Data constructor fields must have a fixed runtime representation.
--
-- Tests: T11734, T18534.
FixedRuntimeRepDataConField :: FixedRuntimeRepProvenance
-- | Pattern synonym signature arguments must have a fixed runtime
-- representation.
--
-- Test: RepPolyPatSynArg.
FixedRuntimeRepPatSynSigArg :: FixedRuntimeRepProvenance
-- | Pattern synonym signature scrutinee must have a fixed runtime
-- representation.
--
-- Test: RepPolyPatSynRes.
FixedRuntimeRepPatSynSigRes :: FixedRuntimeRepProvenance
pprFixedRuntimeRepProvenance :: FixedRuntimeRepProvenance -> SDoc
-- | Where a shadowed name comes from
data ShadowedNameProvenance
-- | The shadowed name is local to the module
ShadowedNameProvenanceLocal :: !SrcLoc -> ShadowedNameProvenance
-- | The shadowed name is global, typically imported from elsewhere.
ShadowedNameProvenanceGlobal :: [GlobalRdrElt] -> ShadowedNameProvenance
-- | Which parts of a record field are affected by a particular error or
-- warning.
data RecordFieldPart
RecordFieldConstructor :: !Name -> RecordFieldPart
RecordFieldPattern :: !Name -> RecordFieldPart
RecordFieldUpdate :: RecordFieldPart
-- | Why the particular injectivity error arose together with more
-- information, if any.
data InjectivityErrReason
InjErrRhsBareTyVar :: [Type] -> InjectivityErrReason
InjErrRhsCannotBeATypeFam :: InjectivityErrReason
InjErrRhsOverlap :: InjectivityErrReason
InjErrCannotInferFromRhs :: !TyVarSet -> !HasKinds -> !SuggestUndecidableInstances -> InjectivityErrReason
data HasKinds
YesHasKinds :: HasKinds
NoHasKinds :: HasKinds
hasKinds :: Bool -> HasKinds
data SuggestUndecidableInstances
YesSuggestUndecidableInstaces :: SuggestUndecidableInstances
NoSuggestUndecidableInstaces :: SuggestUndecidableInstances
suggestUndecidableInstances :: Bool -> SuggestUndecidableInstances
-- | A data type to describe why a variable is not closed. See Note
-- [Not-closed error messages] in GHC.Tc.Gen.Expr
data NotClosedReason
NotLetBoundReason :: NotClosedReason
NotTypeClosed :: VarSet -> NotClosedReason
NotClosed :: Name -> NotClosedReason -> NotClosedReason
data SuggestPartialTypeSignatures
YesSuggestPartialTypeSignatures :: SuggestPartialTypeSignatures
NoSuggestPartialTypeSignatures :: SuggestPartialTypeSignatures
suggestPartialTypeSignatures :: Bool -> SuggestPartialTypeSignatures
-- | Why a particular typeclass instance couldn't be derived.
data DeriveInstanceErrReason
-- | The typeclass instance is not well-kinded.
DerivErrNotWellKinded :: !TyCon -> !Kind -> !Int -> DeriveInstanceErrReason
DerivErrSafeHaskellGenericInst :: DeriveInstanceErrReason
DerivErrDerivingViaWrongKind :: !Kind -> !Type -> !Kind -> DeriveInstanceErrReason
-- | The instance type | We cannot derive instances in boot files
DerivErrNoEtaReduce :: !Type -> DeriveInstanceErrReason
DerivErrBootFileFound :: DeriveInstanceErrReason
DerivErrDataConsNotAllInScope :: !TyCon -> DeriveInstanceErrReason
-- | We cannot use GND on non-newtype types
DerivErrGNDUsedOnData :: DeriveInstanceErrReason
-- | We cannot derive instances of nullary classes
DerivErrNullaryClasses :: DeriveInstanceErrReason
-- | Last arg must be newtype or data application
DerivErrLastArgMustBeApp :: DeriveInstanceErrReason
DerivErrNoFamilyInstance :: !TyCon -> [Type] -> DeriveInstanceErrReason
DerivErrNotStockDeriveable :: !DeriveAnyClassEnabled -> DeriveInstanceErrReason
DerivErrHasAssociatedDatatypes :: !HasAssociatedDataFamInsts -> !AssociatedTyLastVarInKind -> !AssociatedTyNotParamOverLastTyVar -> DeriveInstanceErrReason
DerivErrNewtypeNonDeriveableClass :: DeriveInstanceErrReason
DerivErrCannotEtaReduceEnough :: !Bool -> DeriveInstanceErrReason
DerivErrOnlyAnyClassDeriveable :: !TyCon -> !DeriveAnyClassEnabled -> DeriveInstanceErrReason
DerivErrNotDeriveable :: !DeriveAnyClassEnabled -> DeriveInstanceErrReason
-- | The given PredType is not a class.
DerivErrNotAClass :: !PredType -> DeriveInstanceErrReason
-- | The given (representation of the) TyCon has no data
-- constructors.
DerivErrNoConstructors :: !TyCon -> DeriveInstanceErrReason
DerivErrLangExtRequired :: !Extension -> DeriveInstanceErrReason
-- | GHC simply doesn't how to how derive the input Class for the
-- given Type.
DerivErrDunnoHowToDeriveForType :: !Type -> DeriveInstanceErrReason
-- | The given TyCon must be an enumeration. See Note [Enumeration
-- types] in GHC.Core.TyCon
DerivErrMustBeEnumType :: !TyCon -> DeriveInstanceErrReason
-- | The given TyCon must have precisely one constructor.
DerivErrMustHaveExactlyOneConstructor :: !TyCon -> DeriveInstanceErrReason
-- | The given data type must have some parameters.
DerivErrMustHaveSomeParameters :: !TyCon -> DeriveInstanceErrReason
-- | The given data type must not have a class context.
DerivErrMustNotHaveClassContext :: !TyCon -> !ThetaType -> DeriveInstanceErrReason
-- | We couldn't derive an instance for a particular data constructor for a
-- variety of reasons.
DerivErrBadConstructor :: !Maybe HasWildcard -> [DeriveInstanceBadConstructor] -> DeriveInstanceErrReason
-- | We couldn't derive a Generic instance for the given type for
-- a variety of reasons
DerivErrGenerics :: [DeriveGenericsErrReason] -> DeriveInstanceErrReason
-- | We couldn't derive an instance either because the type was not an enum
-- type or because it did have more than one constructor.
DerivErrEnumOrProduct :: !DeriveInstanceErrReason -> !DeriveInstanceErrReason -> DeriveInstanceErrReason
data UsingGeneralizedNewtypeDeriving
YesGeneralizedNewtypeDeriving :: UsingGeneralizedNewtypeDeriving
NoGeneralizedNewtypeDeriving :: UsingGeneralizedNewtypeDeriving
usingGeneralizedNewtypeDeriving :: Bool -> UsingGeneralizedNewtypeDeriving
data DeriveAnyClassEnabled
YesDeriveAnyClassEnabled :: DeriveAnyClassEnabled
NoDeriveAnyClassEnabled :: DeriveAnyClassEnabled
deriveAnyClassEnabled :: Bool -> DeriveAnyClassEnabled
data DeriveInstanceBadConstructor
-- | The given DataCon must be truly polymorphic in the last
-- argument of the data type.
DerivErrBadConExistential :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon must not use the type variable in a function
-- argument"
DerivErrBadConCovariant :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon must not contain function types
DerivErrBadConFunTypes :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon must use the type variable only as the last
-- argument of a data type
DerivErrBadConWrongArg :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon is a GADT so we cannot directly derive an
-- istance for it.
DerivErrBadConIsGADT :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon has existentials type vars in its type.
DerivErrBadConHasExistentials :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon has constraints in its type.
DerivErrBadConHasConstraints :: !DataCon -> DeriveInstanceBadConstructor
-- | The given DataCon has a higher-rank type.
DerivErrBadConHasHigherRankType :: !DataCon -> DeriveInstanceBadConstructor
data HasWildcard
YesHasWildcard :: HasWildcard
NoHasWildcard :: HasWildcard
hasWildcard :: Bool -> HasWildcard
-- | A context in which we don't allow anonymous wildcards.
data BadAnonWildcardContext
WildcardNotLastInConstraint :: BadAnonWildcardContext
ExtraConstraintWildcardNotAllowed :: SoleExtraConstraintWildcardAllowed -> BadAnonWildcardContext
WildcardsNotAllowedAtAll :: BadAnonWildcardContext
-- | Whether a sole extra-constraint wildcard is allowed, e.g. _ =>
-- .. as opposed to ( .., _ ) => ...
data SoleExtraConstraintWildcardAllowed
SoleExtraConstraintWildcardNotAllowed :: SoleExtraConstraintWildcardAllowed
SoleExtraConstraintWildcardAllowed :: SoleExtraConstraintWildcardAllowed
data DeriveGenericsErrReason
-- | The type must not have some datatype context.
DerivErrGenericsMustNotHaveDatatypeContext :: !TyCon -> DeriveGenericsErrReason
-- | The data constructor must not have exotic unlifted or polymorphic
-- arguments.
DerivErrGenericsMustNotHaveExoticArgs :: !DataCon -> DeriveGenericsErrReason
-- | The data constructor must be a vanilla constructor.
DerivErrGenericsMustBeVanillaDataCon :: !DataCon -> DeriveGenericsErrReason
-- | The type must have some type parameters. check (d) from Note
-- [Requirements for deriving Generic and Rep] in GHC.Tc.Deriv.Generics.
DerivErrGenericsMustHaveSomeTypeParams :: !TyCon -> DeriveGenericsErrReason
-- | The data constructor must not have existential arguments.
DerivErrGenericsMustNotHaveExistentials :: !DataCon -> DeriveGenericsErrReason
-- | The derivation applies a type to an argument involving the last
-- parameter but the applied type is not of kind * -> *.
DerivErrGenericsWrongArgKind :: !DataCon -> DeriveGenericsErrReason
-- | A type representing whether or not the input type has associated data
-- family instances.
data HasAssociatedDataFamInsts
YesHasAdfs :: HasAssociatedDataFamInsts
NoHasAdfs :: HasAssociatedDataFamInsts
hasAssociatedDataFamInsts :: Bool -> HasAssociatedDataFamInsts
-- | If YesAssocTyLastVarInKind, the associated type of a typeclass
-- contains the last type variable of the class in a kind, which is not
-- (yet) allowed by GHC.
data AssociatedTyLastVarInKind
-- | The associated type family of the class
YesAssocTyLastVarInKind :: !TyCon -> AssociatedTyLastVarInKind
NoAssocTyLastVarInKind :: AssociatedTyLastVarInKind
associatedTyLastVarInKind :: Maybe TyCon -> AssociatedTyLastVarInKind
-- | If NoAssociatedTyNotParamOverLastTyVar, the associated type of
-- a typeclass is not parameterized over the last type variable of the
-- class
data AssociatedTyNotParamOverLastTyVar
-- | The associated type family of the class
YesAssociatedTyNotParamOverLastTyVar :: !TyCon -> AssociatedTyNotParamOverLastTyVar
NoAssociatedTyNotParamOverLastTyVar :: AssociatedTyNotParamOverLastTyVar
associatedTyNotParamOverLastTyVar :: Maybe TyCon -> AssociatedTyNotParamOverLastTyVar
-- | What kind of thing is missing a type signature?
--
-- Used for reporting "missing signature" warnings, see
-- tcRnMissingSignature.
data MissingSignature
MissingTopLevelBindingSig :: Name -> Type -> MissingSignature
MissingPatSynSig :: PatSyn -> MissingSignature
-- | whether -XCUSKs is enabled
MissingTyConKindSig :: TyCon -> Bool -> MissingSignature
-- | Is the object we are dealing with exported or not?
--
-- Used for reporting "missing signature" warnings, see
-- TcRnMissingSignature.
data Exported
IsNotExported :: Exported
IsExported :: Exported
data HsDocContext
TypeSigCtx :: SDoc -> HsDocContext
StandaloneKindSigCtx :: SDoc -> HsDocContext
PatCtx :: HsDocContext
SpecInstSigCtx :: HsDocContext
DefaultDeclCtx :: HsDocContext
ForeignDeclCtx :: LocatedN RdrName -> HsDocContext
DerivDeclCtx :: HsDocContext
RuleCtx :: FastString -> HsDocContext
TyDataCtx :: LocatedN RdrName -> HsDocContext
TySynCtx :: LocatedN RdrName -> HsDocContext
TyFamilyCtx :: LocatedN RdrName -> HsDocContext
FamPatCtx :: LocatedN RdrName -> HsDocContext
ConDeclCtx :: [LocatedN Name] -> HsDocContext
ClassDeclCtx :: LocatedN RdrName -> HsDocContext
ExprWithTySigCtx :: HsDocContext
TypBrCtx :: HsDocContext
HsTypeCtx :: HsDocContext
HsTypePatCtx :: HsDocContext
GHCiCtx :: HsDocContext
SpliceTypeCtx :: LHsType GhcPs -> HsDocContext
ClassInstanceCtx :: HsDocContext
GenericCtx :: SDoc -> HsDocContext
-- | A predicate with its arising location; used to encapsulate a
-- constraint that will give rise to a diagnostic.
data ErrorItem
EI :: PredType -> Maybe TcEvDest -> CtFlavour -> CtLoc -> Maybe CtIrredReason -> Bool -> ErrorItem
[ei_pred] :: ErrorItem -> PredType
[ei_evdest] :: ErrorItem -> Maybe TcEvDest
[ei_flavour] :: ErrorItem -> CtFlavour
[ei_loc] :: ErrorItem -> CtLoc
[ei_m_reason] :: ErrorItem -> Maybe CtIrredReason
[ei_suppress] :: ErrorItem -> Bool
errorItemOrigin :: ErrorItem -> CtOrigin
errorItemEqRel :: ErrorItem -> EqRel
errorItemPred :: ErrorItem -> PredType
errorItemCtLoc :: ErrorItem -> CtLoc
-- | A collection of main error messages and supplementary information.
--
-- In practice, we will: - display the important messages first, - then
-- the error context (e.g. by way of a call to mkErrorReport), -
-- then the supplementary information (e.g. relevant bindings, valid hole
-- fits), - then the hints ("Possible fix: ...").
--
-- So this is mostly just a way of making sure that the error context
-- appears early on rather than at the end of the message.
--
-- See Note [Error report] for details.
data SolverReport
SolverReport :: [SolverReportWithCtxt] -> [SolverReportSupplementary] -> [GhcHint] -> SolverReport
[sr_important_msgs] :: SolverReport -> [SolverReportWithCtxt]
[sr_supplementary] :: SolverReport -> [SolverReportSupplementary]
[sr_hints] :: SolverReport -> [GhcHint]
-- | Additional information to print in a SolverReport, after the
-- important messages and after the error context.
--
-- See Note [Error report].
data SolverReportSupplementary
SupplementaryBindings :: RelevantBindings -> SolverReportSupplementary
SupplementaryHoleFits :: ValidHoleFits -> SolverReportSupplementary
SupplementaryCts :: [(PredType, RealSrcSpan)] -> SolverReportSupplementary
-- | A TcSolverReportMsg, together with context (e.g. enclosing
-- implication constraints) that are needed in order to report it.
data SolverReportWithCtxt
SolverReportWithCtxt :: SolverReportErrCtxt -> TcSolverReportMsg -> SolverReportWithCtxt
-- | Context for what we wish to report. This can change as we enter
-- implications, so is stored alongside the content.
[reportContext] :: SolverReportWithCtxt -> SolverReportErrCtxt
-- | The content of the message to report.
[reportContent] :: SolverReportWithCtxt -> TcSolverReportMsg
-- | Context needed when reporting a TcSolverReportMsg, such as the
-- enclosing implication constraints or whether we are deferring type
-- errors.
data SolverReportErrCtxt
CEC :: [Implication] -> TidyEnv -> EvBindsVar -> DiagnosticReason -> DiagnosticReason -> DiagnosticReason -> DiagnosticReason -> Bool -> Bool -> Bool -> SolverReportErrCtxt
-- | Enclosing implications (innermost first) ic_skols and givens are
-- tidied, rest are not
[cec_encl] :: SolverReportErrCtxt -> [Implication]
[cec_tidy] :: SolverReportErrCtxt -> TidyEnv
-- | We make some errors (depending on cec_defer) into warnings, and emit
-- evidence bindings into cec_binds for unsolved constraints
[cec_binds] :: SolverReportErrCtxt -> EvBindsVar
-- | Whether to defer type errors until runtime
[cec_defer_type_errors] :: SolverReportErrCtxt -> DiagnosticReason
-- | Reason for reporting holes in expressions.
[cec_expr_holes] :: SolverReportErrCtxt -> DiagnosticReason
-- | Reason for reporting holes in types.
[cec_type_holes] :: SolverReportErrCtxt -> DiagnosticReason
-- | Reason for reporting out of scope holes.
[cec_out_of_scope_holes] :: SolverReportErrCtxt -> DiagnosticReason
-- | True = -Wredundant-constraints
[cec_warn_redundant] :: SolverReportErrCtxt -> Bool
-- | True = -fprint-expanded-synonyms
[cec_expand_syns] :: SolverReportErrCtxt -> Bool
-- | True = More important errors have occurred, so create bindings
-- if need be, but don't issue any more errors/warnings See Note
-- [Suppressing error messages]
[cec_suppress] :: SolverReportErrCtxt -> Bool
getUserGivens :: SolverReportErrCtxt -> [UserGiven]
discardProvCtxtGivens :: CtOrigin -> [UserGiven] -> [UserGiven]
-- | An error reported after constraint solving. This is usually, some sort
-- of unsolved constraint error, but we try to be specific about the
-- precise problem we encountered.
data TcSolverReportMsg
-- | Wrap a message with additional information.
--
-- Prefer using the mkTcReportWithInfo smart constructor
TcReportWithInfo :: TcSolverReportMsg -> NonEmpty TcSolverReportInfo -> TcSolverReportMsg
-- | Quantified variables appear out of dependency order.
--
-- Example:
--
-- forall (a :: k) k. ...
--
-- Test cases: BadTelescope2, T16418, T16247, T16726, T18451.
BadTelescope :: TyVarBndrs -> [TyCoVar] -> TcSolverReportMsg
-- | We came across a custom type error and we have decided to report it.
--
-- Example:
--
-- type family F a where F a = TypeError (Text "error")
--
-- err :: F () err = ()
--
-- Test cases: CustomTypeErrors0{1,2,3,4,5}, T12104.
UserTypeError :: Type -> TcSolverReportMsg
-- | We want to report an out of scope variable or a typed hole. See
-- HoleError.
ReportHoleError :: Hole -> HoleError -> TcSolverReportMsg
-- | A type equality between a type variable and a polytype.
--
-- Test cases: T12427a, T2846b, T10194, ...
CannotUnifyWithPolytype :: ErrorItem -> TyVar -> Type -> TcSolverReportMsg
-- | Couldn't unify two types or kinds.
--
-- Example:
--
-- 3 + 3# -- can't match a lifted type with an unlifted type
--
-- Test cases: T1396, T8263, ...
Mismatch :: Bool -> ErrorItem -> Type -> Type -> TcSolverReportMsg
-- | Should this be phrased in terms of expected vs actual?
[mismatch_ea] :: TcSolverReportMsg -> Bool
-- | The constraint in which the mismatch originated.
[mismatch_item] :: TcSolverReportMsg -> ErrorItem
-- | First type (the expected type if if mismatch_ea is True)
[mismatch_ty1] :: TcSolverReportMsg -> Type
-- | Second type (the actual type if mismatch_ea is True)
[mismatch_ty2] :: TcSolverReportMsg -> Type
-- | A type has an unexpected kind.
--
-- Test cases: T2994, T7609, ...
KindMismatch :: TypedThing -> Type -> Type -> TcSolverReportMsg
-- | What thing is kmismatch_actual the kind of?
[kmismatch_what] :: TcSolverReportMsg -> TypedThing
[kmismatch_expected] :: TcSolverReportMsg -> Type
[kmismatch_actual] :: TcSolverReportMsg -> Type
-- | A mismatch between two types, which arose from a type equality.
--
-- Test cases: T1470, tcfail212.
TypeEqMismatch :: Bool -> ErrorItem -> Type -> Type -> Type -> Type -> Maybe TypedThing -> TcSolverReportMsg
[teq_mismatch_ppr_explicit_kinds] :: TcSolverReportMsg -> Bool
[teq_mismatch_item] :: TcSolverReportMsg -> ErrorItem
[teq_mismatch_ty1] :: TcSolverReportMsg -> Type
[teq_mismatch_ty2] :: TcSolverReportMsg -> Type
-- | The overall expected type
[teq_mismatch_expected] :: TcSolverReportMsg -> Type
-- | The overall actual type
[teq_mismatch_actual] :: TcSolverReportMsg -> Type
-- | What thing is teq_mismatch_actual the kind of?
[teq_mismatch_what] :: TcSolverReportMsg -> Maybe TypedThing
-- | A violation of the representation-polymorphism invariants, i.e. an
-- unsolved `Concrete# ty` constraint.
--
-- See FRROrigin for more information.
FixedRuntimeRepError :: [FixedRuntimeRepErrorInfo] -> TcSolverReportMsg
-- | A skolem type variable escapes its scope.
--
-- Example:
--
-- data Ex where { MkEx :: a -> MkEx } foo (MkEx x) = x
--
-- Test cases: TypeSkolEscape, T11142.
SkolemEscape :: ErrorItem -> Implication -> [TyVar] -> TcSolverReportMsg
-- | Trying to unify an untouchable variable, e.g. a variable from an outer
-- scope.
--
-- Test case: Simple14
UntouchableVariable :: TyVar -> Implication -> TcSolverReportMsg
-- | An equality between two types is blocked on a kind equality beteen
-- their kinds.
--
-- Test cases: none.
BlockedEquality :: ErrorItem -> TcSolverReportMsg
-- | Something was not applied to sufficiently many arguments.
--
-- Example:
--
-- instance Eq Maybe where {..}
--
-- Test case: T11563.
ExpectingMoreArguments :: Int -> TypedThing -> TcSolverReportMsg
-- | Trying to use an unbound implicit parameter.
--
-- Example:
--
-- foo :: Int foo = ?param
--
-- Test case: tcfail130.
UnboundImplicitParams :: NonEmpty ErrorItem -> TcSolverReportMsg
-- | Couldn't solve some Wanted constraints using the Givens. This is the
-- most commonly used constructor, used for generic "No instance for
-- ..." and "Could not deduce ... from" messages.
CouldNotDeduce :: [Implication] -> NonEmpty ErrorItem -> Maybe CND_Extra -> TcSolverReportMsg
[cnd_user_givens] :: TcSolverReportMsg -> [Implication]
-- | The Wanted constraints we couldn't solve.
--
-- N.B.: the ErrorItem at the head of the list has been tidied,
-- perhaps not the others.
[cnd_wanted] :: TcSolverReportMsg -> NonEmpty ErrorItem
-- | Some additional info consumed by mk_supplementary_ea_msg.
[cnd_extra] :: TcSolverReportMsg -> Maybe CND_Extra
-- | A constraint couldn't be solved because it contains ambiguous type
-- variables.
--
-- Example:
--
-- class C a b where f :: (a,b)
--
-- x = fst f
--
-- Test case: T4921.
AmbiguityPreventsSolvingCt :: ErrorItem -> ([TyVar], [TyVar]) -> TcSolverReportMsg
-- | Could not solve a constraint; there were several unifying candidate
-- instances but no matching instances. This is used to report as much
-- useful information as possible about why we couldn't choose any
-- instance, e.g. because of ambiguous type variables.
CannotResolveInstance :: ErrorItem -> [ClsInst] -> [ClsInst] -> [ImportError] -> [GhcHint] -> RelevantBindings -> TcSolverReportMsg
[cannotResolve_item] :: TcSolverReportMsg -> ErrorItem
[cannotResolve_unifiers] :: TcSolverReportMsg -> [ClsInst]
[cannotResolve_candidates] :: TcSolverReportMsg -> [ClsInst]
[cannotResolve_importErrors] :: TcSolverReportMsg -> [ImportError]
[cannotResolve_suggestions] :: TcSolverReportMsg -> [GhcHint]
[cannotResolve_relevant_bindings] :: TcSolverReportMsg -> RelevantBindings
-- | Could not solve a constraint using available instances because the
-- instances overlap.
--
-- Test cases: tcfail118, tcfail121, tcfail218.
OverlappingInstances :: ErrorItem -> [ClsInst] -> [ClsInst] -> TcSolverReportMsg
[overlappingInstances_item] :: TcSolverReportMsg -> ErrorItem
[overlappingInstances_matches] :: TcSolverReportMsg -> [ClsInst]
[overlappingInstances_unifiers] :: TcSolverReportMsg -> [ClsInst]
-- | Could not solve a constraint from instances because instances declared
-- in a Safe module cannot overlap instances from other modules (with
-- -XSafeHaskell).
--
-- Test cases: SH_Overlap{1,2,5,6,7,11}.
UnsafeOverlap :: ErrorItem -> [ClsInst] -> [ClsInst] -> TcSolverReportMsg
[unsafeOverlap_item] :: TcSolverReportMsg -> ErrorItem
[unsafeOverlap_matches] :: TcSolverReportMsg -> [ClsInst]
[unsafeOverlapped] :: TcSolverReportMsg -> [ClsInst]
-- | Additional information that can be appended to an existing
-- TcSolverReportMsg.
data TcSolverReportInfo
-- | Some type variables remained ambiguous: print them to the user.
Ambiguity :: Bool -> ([TyVar], [TyVar]) -> TcSolverReportInfo
-- | True = start the message with "Ambiguous type variable ..."
-- False = create a message of the form "The type variable is
-- ambiguous."
[lead_with_ambig_msg] :: TcSolverReportInfo -> Bool
-- | Ambiguous kind and type variables, respectively. Guaranteed to not
-- both be empty.
[ambig_tyvars] :: TcSolverReportInfo -> ([TyVar], [TyVar])
-- | Specify some information about a type variable, e.g. its
-- SkolemInfo.
TyVarInfo :: TyVar -> TcSolverReportInfo
-- | Remind the user that a particular type family is not injective.
NonInjectiveTyFam :: TyCon -> TcSolverReportInfo
-- | Explain why we couldn't coerce between two types. See
-- CoercibleMsg.
ReportCoercibleMsg :: CoercibleMsg -> TcSolverReportInfo
-- | Display the expected and actual types.
ExpectedActual :: Type -> TcSolverReportInfo
[ea_expected, ea_actual] :: TcSolverReportInfo -> Type
-- | Display the expected and actual types, after expanding type synonyms.
ExpectedActualAfterTySynExpansion :: Type -> TcSolverReportInfo
[ea_expanded_expected, ea_expanded_actual] :: TcSolverReportInfo -> Type
-- | Explain how a kind equality originated.
WhenMatching :: TcType -> TcType -> CtOrigin -> Maybe TypeOrKind -> TcSolverReportInfo
-- | Add some information to disambiguate errors in which two
-- Names would otherwise appear to be identical.
--
-- See Note [Disambiguating (X ~ X) errors].
SameOcc :: Bool -> Name -> Name -> TcSolverReportInfo
-- | Whether the two Names also came from the same package.
[sameOcc_same_pkg] :: TcSolverReportInfo -> Bool
[sameOcc_lhs] :: TcSolverReportInfo -> Name
[sameOcc_rhs] :: TcSolverReportInfo -> Name
-- | Report some type variables that might be participating in an
-- occurs-check failure.
OccursCheckInterestingTyVars :: NonEmpty TyVar -> TcSolverReportInfo
-- | Stores the information we have when performing a
-- representation-polymorphism check.
data FixedRuntimeRepErrorInfo
-- | Was this check due to 'IsRefl#', i.e. it's a PHASE 1 check?
--
-- See Note [The Concrete mechanism] in GHC.Tc.Utils.Concrete.
FixedRuntimeRepErrorInfo :: !FRROrigin -> !Type -> !Bool -> FixedRuntimeRepErrorInfo
-- | Context for the representation-polymorphism check.
[frrInfo_origin] :: FixedRuntimeRepErrorInfo -> !FRROrigin
-- | The type which we are insisting must have a fixed runtime
-- representation.
[frrInfo_type] :: FixedRuntimeRepErrorInfo -> !Type
[frrInfo_isReflPrim] :: FixedRuntimeRepErrorInfo -> !Bool
-- | Additional information to be given in a CouldNotDeduce message,
-- which is then passed on to mk_supplementary_ea_msg.
data CND_Extra
CND_Extra :: TypeOrKind -> Type -> Type -> CND_Extra
-- | Append additional information to a TcSolverReportMsg.
mkTcReportWithInfo :: TcSolverReportMsg -> [TcSolverReportInfo] -> TcSolverReportMsg
-- | A collection of valid hole fits or refinement fits, in which some fits
-- might have been suppressed.
data FitsMbSuppressed
Fits :: [HoleFit] -> Bool -> FitsMbSuppressed
[fits] :: FitsMbSuppressed -> [HoleFit]
-- | Whether we have suppressed any fits because there were too many.
[fitsSuppressed] :: FitsMbSuppressed -> Bool
-- | A collection of hole fits and refinement fits.
data ValidHoleFits
ValidHoleFits :: FitsMbSuppressed -> FitsMbSuppressed -> ValidHoleFits
[holeFits] :: ValidHoleFits -> FitsMbSuppressed
[refinementFits] :: ValidHoleFits -> FitsMbSuppressed
noValidHoleFits :: ValidHoleFits
-- | Configuration for pretty-printing valid hole fits.
data HoleFitDispConfig
HFDC :: Bool -> HoleFitDispConfig
[showWrap, showWrapVars, showType, showProv, showMatches] :: HoleFitDispConfig -> Bool
data RelevantBindings
RelevantBindings :: [(Name, Type)] -> Bool -> RelevantBindings
[relevantBindingNamesAndTys] :: RelevantBindings -> [(Name, Type)]
-- | Whether we ran out of fuel generating the bindings.
[ranOutOfFuel] :: RelevantBindings -> Bool
-- | Display some relevant bindings.
pprRelevantBindings :: RelevantBindings -> SDoc
-- | Some form of "not in scope" error. See also the
-- OutOfScopeHole constructor of HoleError.
data NotInScopeError
-- | A run-of-the-mill "not in scope" error.
NotInScope :: NotInScopeError
-- | An exact Name was not in scope.
--
-- This usually indicates a problem with a Template Haskell splice.
--
-- Test cases: T5971, T18263.
NoExactName :: Name -> NotInScopeError
-- | always at least 2 elements
SameName :: [GlobalRdrElt] -> NotInScopeError
MissingBinding :: SDoc -> [GhcHint] -> NotInScopeError
-- | Couldn't find a top-level binding.
--
-- Happens when specifying an annotation for something that is not in
-- scope.
--
-- Test cases: annfail01, annfail02, annfail11.
NoTopLevelBinding :: NotInScopeError
-- | A class doesnt have a method with this name, or, a class doesn't have
-- an associated type with this name, or, a record doesn't have a record
-- field with this name.
UnknownSubordinate :: SDoc -> NotInScopeError
-- | Create a "not in scope" error message for the given
-- RdrName.
mkTcRnNotInScope :: RdrName -> NotInScopeError -> TcRnMessage
-- | Explain a problem with an import.
data ImportError
-- | Couldn't find a module with the requested name.
MissingModule :: ModuleName -> ImportError
-- | The imported modules don't export what we're looking for.
ModulesDoNotExport :: NonEmpty Module -> OccName -> ImportError
-- | Report an error involving a Hole.
--
-- This could be an out of scope data constructor or variable, a typed
-- hole, or a wildcard in a type.
data HoleError
-- | Report an out-of-scope data constructor or variable masquerading as an
-- expression hole.
--
-- See Note [Insoluble holes] in GHC.Tc.Types.Constraint. See
-- NotInScopeError for other not-in-scope errors.
--
-- Test cases: T9177a.
OutOfScopeHole :: [ImportError] -> HoleError
-- | Report a typed hole, or wildcard, with additional information.
HoleError :: HoleSort -> [TcTyVar] -> [(SkolemInfoAnon, [TcTyVar])] -> HoleError
-- | A message that aims to explain why two types couldn't be seen to be
-- representationally equal.
data CoercibleMsg
-- | Not knowing the role of a type constructor prevents us from concluding
-- that two types are representationally equal.
--
-- Example:
--
-- foo :: Applicative m => m (Sum Int) foo = coerce (pure $ 1 :: Int)
--
-- We don't know what role m has, so we can't coerce `m Int` to
-- `m (Sum Int)`.
--
-- Test cases: T8984, TcCoercibleFail.
UnknownRoles :: Type -> CoercibleMsg
-- | The fact that a TyCon is abstract prevents us from decomposing
-- a TyConApp and deducing that two types are representationally
-- equal.
--
-- Test cases: none.
TyConIsAbstract :: TyCon -> CoercibleMsg
-- | We can't unwrap a newtype whose constructor is not in scope.
--
-- Example:
--
-- import Data.Ord (Down) -- NB: not importing the constructor foo :: Int
-- -> Down Int foo = coerce
--
-- Test cases: TcCoercibleFail.
OutOfScopeNewtypeConstructor :: TyCon -> DataCon -> CoercibleMsg
-- | This datatype collates instances that match or unifier, in order to
-- report an error message for an unsolved typeclass constraint.
data PotentialInstances
PotentialInstances :: [ClsInst] -> [ClsInst] -> PotentialInstances
[matches] :: PotentialInstances -> [ClsInst]
[unifiers] :: PotentialInstances -> [ClsInst]
-- | Specifies which calling convention is unsupported on the current
-- platform
data UnsupportedCallConvention
StdCallConvUnsupported :: UnsupportedCallConvention
PrimCallConvUnsupported :: UnsupportedCallConvention
JavaScriptCallConvUnsupported :: UnsupportedCallConvention
-- | Specifies which backend code generators where expected for an FFI
-- declaration
data ExpectedBackends
-- | C, Asm, or LLVM
COrAsmOrLlvm :: ExpectedBackends
-- | C, Asm, LLVM, or interpreted
COrAsmOrLlvmOrInterp :: ExpectedBackends
-- | Whether the error pertains to a function argument or a result.
data ArgOrResult
Arg :: ArgOrResult
Result :: ArgOrResult
instance GHC.Classes.Eq GHC.Tc.Errors.Types.ExpectedBackends
instance GHC.Classes.Eq GHC.Tc.Errors.Types.UnsupportedCallConvention
instance GHC.Classes.Eq GHC.Tc.Errors.Types.HasKinds
instance GHC.Show.Show GHC.Tc.Errors.Types.HasKinds
instance GHC.Classes.Eq GHC.Tc.Errors.Types.SuggestUndecidableInstances
instance GHC.Show.Show GHC.Tc.Errors.Types.SuggestUndecidableInstances
instance GHC.Classes.Eq GHC.Tc.Errors.Types.SuggestPartialTypeSignatures
instance GHC.Show.Show GHC.Tc.Errors.Types.SuggestPartialTypeSignatures
instance GHC.Classes.Eq GHC.Tc.Errors.Types.UsingGeneralizedNewtypeDeriving
instance GHC.Classes.Eq GHC.Tc.Errors.Types.DeriveAnyClassEnabled
instance GHC.Classes.Eq GHC.Tc.Errors.Types.HasWildcard
instance GHC.Classes.Eq GHC.Tc.Errors.Types.HasAssociatedDataFamInsts
instance GHC.Classes.Eq GHC.Tc.Errors.Types.AssociatedTyLastVarInKind
instance GHC.Classes.Eq GHC.Tc.Errors.Types.AssociatedTyNotParamOverLastTyVar
instance GHC.Base.Semigroup GHC.Tc.Errors.Types.SolverReport
instance GHC.Base.Monoid GHC.Tc.Errors.Types.SolverReport
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Types.ErrorItem
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Types.Exported
module GHC.Tc.Errors.Ppr
pprTypeDoesNotHaveFixedRuntimeRep :: Type -> FixedRuntimeRepProvenance -> SDoc
pprScopeError :: RdrName -> NotInScopeError -> SDoc
tidySkolemInfo :: TidyEnv -> SkolemInfo -> SkolemInfo
tidySkolemInfoAnon :: TidyEnv -> SkolemInfoAnon -> SkolemInfoAnon
withHsDocContext :: HsDocContext -> SDoc -> SDoc
pprHsDocContext :: HsDocContext -> SDoc
inHsDocContext :: HsDocContext -> SDoc
instance GHC.Types.Error.Diagnostic GHC.Tc.Errors.Types.TcRnMessage
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Types.SolverReportErrCtxt
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Types.ImportError
module GHC.Parser.Errors.Types
type PsWarning = PsMessage
type PsError = PsMessage
data PsHeaderMessage
PsErrParseLanguagePragma :: PsHeaderMessage
PsErrUnsupportedExt :: !String -> ![String] -> PsHeaderMessage
PsErrParseOptionsPragma :: !String -> PsHeaderMessage
-- | PsErrUnsupportedOptionsPragma is an error that occurs when an unknown
-- OPTIONS_GHC pragma is supplied is found.
--
-- Example(s):
--
-- Test case(s):
--
-- testssafeHaskellflags/SafeFlags28
-- testssafeHaskellflags/SafeFlags19
-- testssafeHaskellflags/SafeFlags29
-- testsparsershould_fail/T19923c
-- testsparsershould_fail/T19923b
-- testsparsershould_fail/readFail044 testsdriverT2499
PsErrUnknownOptionsPragma :: !String -> PsHeaderMessage
data PsMessage
-- | An "unknown" message from the parser. This type constructor allows
-- arbitrary messages to be embedded. The typical use case would be GHC
-- plugins willing to emit custom diagnostics.
PsUnknownMessage :: a -> PsMessage
-- | A group of parser messages emitted in Header. See Note
-- [Messages from GHC.Parser.Header].
PsHeaderMessage :: !PsHeaderMessage -> PsMessage
-- | PsWarnBidirectionalFormatChars is a warning (controlled by the
-- -Wwarn-bidirectional-format-characters flag) that occurs when unicode
-- bi-directional format characters are found within in a file
--
-- The PsLoc contains the exact position in the buffer the
-- character occured, and the string contains a description of the
-- character.
PsWarnBidirectionalFormatChars :: NonEmpty (PsLoc, Char, String) -> PsMessage
-- | Number of other occurrences other than the first one
PsWarnTab :: !Word -> PsMessage
-- | PsWarnTransitionalLayout is a warning (controlled by the
-- -Walternative-layout-rule-transitional flag) that occurs when pipes
-- ('|') or 'where' are at the same depth of an implicit layout block.
--
-- Example(s):
--
-- f :: IO () f | True = do let x = () y = () return () | True = return
-- ()
--
-- Test case(s): layout/layout006 layout/layout003 layout/layout001
PsWarnTransitionalLayout :: !TransLayoutReason -> PsMessage
-- | Unrecognised pragma
PsWarnUnrecognisedPragma :: PsMessage
-- | Invalid Haddock comment position
PsWarnHaddockInvalidPos :: PsMessage
-- | Multiple Haddock comment for the same entity
PsWarnHaddockIgnoreMulti :: PsMessage
-- | Found binding occurrence of "*" while StarIsType is enabled
PsWarnStarBinder :: PsMessage
-- | Using "*" for Type without StarIsType enabled
PsWarnStarIsType :: PsMessage
-- | Pre qualified import with WarnPrepositiveQualifiedModule
-- enabled
PsWarnImportPreQualified :: PsMessage
PsWarnOperatorWhitespaceExtConflict :: !OperatorWhitespaceSymbol -> PsMessage
PsWarnOperatorWhitespace :: !FastString -> !OperatorWhitespaceOccurrence -> PsMessage
-- | LambdaCase syntax used without the extension enabled
PsErrLambdaCase :: PsMessage
-- | A lambda requires at least one parameter
PsErrEmptyLambda :: PsMessage
-- | Underscores in literals without the extension enabled
PsErrNumUnderscores :: !NumUnderscoreReason -> PsMessage
-- | Invalid character in primitive string
PsErrPrimStringInvalidChar :: PsMessage
-- | Missing block
PsErrMissingBlock :: PsMessage
-- | Lexer error
PsErrLexer :: !LexErr -> !LexErrKind -> PsMessage
-- | Suffix occurrence of `@`
PsErrSuffixAT :: PsMessage
-- | Parse errors
PsErrParse :: !String -> !PsErrParseDetails -> PsMessage
-- | Cmm lexer error
PsErrCmmLexer :: PsMessage
-- | Unsupported boxed sum in expression
PsErrUnsupportedBoxedSumExpr :: !SumOrTuple (HsExpr GhcPs) -> PsMessage
-- | Unsupported boxed sum in pattern
PsErrUnsupportedBoxedSumPat :: !SumOrTuple (PatBuilder GhcPs) -> PsMessage
-- | Unexpected qualified constructor
PsErrUnexpectedQualifiedConstructor :: !RdrName -> PsMessage
-- | Tuple section in pattern context
PsErrTupleSectionInPat :: PsMessage
-- | Bang-pattern without BangPattterns enabled
PsErrIllegalBangPattern :: !Pat GhcPs -> PsMessage
-- | Operator applied to too few arguments
PsErrOpFewArgs :: !StarIsType -> !RdrName -> PsMessage
-- | Import: multiple occurrences of qualified
PsErrImportQualifiedTwice :: PsMessage
-- | Post qualified import without ImportQualifiedPost
PsErrImportPostQualified :: PsMessage
-- | Explicit namespace keyword without ExplicitNamespaces
PsErrIllegalExplicitNamespace :: PsMessage
-- | Expecting a type constructor but found a variable
PsErrVarForTyCon :: !RdrName -> PsMessage
-- | Illegal export form allowed by PatternSynonyms
PsErrIllegalPatSynExport :: PsMessage
-- | Malformed entity string
PsErrMalformedEntityString :: PsMessage
-- | Dots used in record update
PsErrDotsInRecordUpdate :: PsMessage
-- | Precedence out of range
PsErrPrecedenceOutOfRange :: !Int -> PsMessage
-- | Invalid use of record dot syntax .
PsErrOverloadedRecordDotInvalid :: PsMessage
-- | OverloadedRecordUpdate is not enabled.
PsErrOverloadedRecordUpdateNotEnabled :: PsMessage
-- | Can't use qualified fields when OverloadedRecordUpdate is enabled.
PsErrOverloadedRecordUpdateNoQualifiedFields :: PsMessage
-- | Cannot parse data constructor in a data/newtype declaration
PsErrInvalidDataCon :: !HsType GhcPs -> PsMessage
-- | Cannot parse data constructor in a data/newtype declaration
PsErrInvalidInfixDataCon :: !HsType GhcPs -> !RdrName -> !HsType GhcPs -> PsMessage
-- | UNPACK applied to a data constructor
PsErrUnpackDataCon :: PsMessage
-- | Unexpected kind application in data/newtype declaration
PsErrUnexpectedKindAppInDataCon :: !DataConBuilder -> !HsType GhcPs -> PsMessage
-- | Not a record constructor
PsErrInvalidRecordCon :: !PatBuilder GhcPs -> PsMessage
-- | Illegal unboxed string literal in pattern
PsErrIllegalUnboxedStringInPat :: !HsLit GhcPs -> PsMessage
-- | Illegal primitive floating point literal in pattern
PsErrIllegalUnboxedFloatingLitInPat :: !HsLit GhcPs -> PsMessage
-- | Do-notation in pattern
PsErrDoNotationInPat :: PsMessage
-- | If-then-else syntax in pattern
PsErrIfThenElseInPat :: PsMessage
-- | Lambda-case in pattern
PsErrLambdaCaseInPat :: PsMessage
-- | case..of in pattern
PsErrCaseInPat :: PsMessage
-- | let-syntax in pattern
PsErrLetInPat :: PsMessage
-- | Lambda-syntax in pattern
PsErrLambdaInPat :: PsMessage
-- | Arrow expression-syntax in pattern
PsErrArrowExprInPat :: !HsExpr GhcPs -> PsMessage
-- | Arrow command-syntax in pattern
PsErrArrowCmdInPat :: !HsCmd GhcPs -> PsMessage
-- | Arrow command-syntax in expression
PsErrArrowCmdInExpr :: !HsCmd GhcPs -> PsMessage
-- | View-pattern in expression
PsErrViewPatInExpr :: !LHsExpr GhcPs -> !LHsExpr GhcPs -> PsMessage
-- | Type-application without space before '@'
PsErrTypeAppWithoutSpace :: !RdrName -> !LHsExpr GhcPs -> PsMessage
-- | Lazy-pattern ('~') without space after it
PsErrLazyPatWithoutSpace :: !LHsExpr GhcPs -> PsMessage
-- | Bang-pattern (!) without space after it
PsErrBangPatWithoutSpace :: !LHsExpr GhcPs -> PsMessage
-- | Pragma not allowed in this position
PsErrUnallowedPragma :: !HsPragE GhcPs -> PsMessage
-- | Qualified do block in command
PsErrQualifiedDoInCmd :: !ModuleName -> PsMessage
-- | Invalid infix hole, expected an infix operator
PsErrInvalidInfixHole :: PsMessage
-- | Unexpected semi-colons in conditional expression
PsErrSemiColonsInCondExpr :: !HsExpr GhcPs -> !Bool -> !HsExpr GhcPs -> !Bool -> !HsExpr GhcPs -> PsMessage
-- | Unexpected semi-colons in conditional command
PsErrSemiColonsInCondCmd :: !HsExpr GhcPs -> !Bool -> !HsCmd GhcPs -> !Bool -> !HsCmd GhcPs -> PsMessage
-- | @-operator in a pattern position
PsErrAtInPatPos :: PsMessage
-- | Unexpected lambda command in function application
PsErrLambdaCmdInFunAppCmd :: !LHsCmd GhcPs -> PsMessage
-- | Unexpected case command in function application
PsErrCaseCmdInFunAppCmd :: !LHsCmd GhcPs -> PsMessage
-- | Unexpected if command in function application
PsErrIfCmdInFunAppCmd :: !LHsCmd GhcPs -> PsMessage
-- | Unexpected let command in function application
PsErrLetCmdInFunAppCmd :: !LHsCmd GhcPs -> PsMessage
-- | Unexpected do command in function application
PsErrDoCmdInFunAppCmd :: !LHsCmd GhcPs -> PsMessage
-- | Unexpected do block in function application
PsErrDoInFunAppExpr :: !Maybe ModuleName -> !LHsExpr GhcPs -> PsMessage
-- | Unexpected mdo block in function application
PsErrMDoInFunAppExpr :: !Maybe ModuleName -> !LHsExpr GhcPs -> PsMessage
-- | Unexpected lambda expression in function application
PsErrLambdaInFunAppExpr :: !LHsExpr GhcPs -> PsMessage
-- | Unexpected case expression in function application
PsErrCaseInFunAppExpr :: !LHsExpr GhcPs -> PsMessage
-- | Unexpected lambda-case expression in function application
PsErrLambdaCaseInFunAppExpr :: !LHsExpr GhcPs -> PsMessage
-- | Unexpected let expression in function application
PsErrLetInFunAppExpr :: !LHsExpr GhcPs -> PsMessage
-- | Unexpected if expression in function application
PsErrIfInFunAppExpr :: !LHsExpr GhcPs -> PsMessage
-- | Unexpected proc expression in function application
PsErrProcInFunAppExpr :: !LHsExpr GhcPs -> PsMessage
-- | Malformed head of type or class declaration
PsErrMalformedTyOrClDecl :: !LHsType GhcPs -> PsMessage
-- | Illegal 'where' keyword in data declaration
PsErrIllegalWhereInDataDecl :: PsMessage
-- | Illegal datatype context
PsErrIllegalDataTypeContext :: !LHsContext GhcPs -> PsMessage
-- | Parse error on input
PsErrParseErrorOnInput :: !OccName -> PsMessage
-- | Malformed ... declaration for ...
PsErrMalformedDecl :: !SDoc -> !RdrName -> PsMessage
-- | Unexpected type application in a declaration
PsErrUnexpectedTypeAppInDecl :: !LHsType GhcPs -> !SDoc -> !RdrName -> PsMessage
-- | Not a data constructor
PsErrNotADataCon :: !RdrName -> PsMessage
-- | Record syntax used in pattern synonym declaration
PsErrRecordSyntaxInPatSynDecl :: !LPat GhcPs -> PsMessage
-- | Empty 'where' clause in pattern-synonym declaration
PsErrEmptyWhereInPatSynDecl :: !RdrName -> PsMessage
-- | Invalid binding name in 'where' clause of pattern-synonym declaration
PsErrInvalidWhereBindInPatSynDecl :: !RdrName -> !HsDecl GhcPs -> PsMessage
-- | Multiple bindings in 'where' clause of pattern-synonym declaration
PsErrNoSingleWhereBindInPatSynDecl :: !RdrName -> !HsDecl GhcPs -> PsMessage
-- | Declaration splice not a top-level
PsErrDeclSpliceNotAtTopLevel :: !SpliceDecl GhcPs -> PsMessage
-- | Inferred type variables not allowed here
PsErrInferredTypeVarNotAllowed :: PsMessage
-- | Multiple names in standalone kind signatures
PsErrMultipleNamesInStandaloneKindSignature :: [LIdP GhcPs] -> PsMessage
-- | Illegal import bundle form
PsErrIllegalImportBundleForm :: PsMessage
-- | Illegal role name
PsErrIllegalRoleName :: !FastString -> [Role] -> PsMessage
-- | Invalid type signature
PsErrInvalidTypeSignature :: !LHsExpr GhcPs -> PsMessage
-- | Unexpected type in declaration
PsErrUnexpectedTypeInDecl :: !LHsType GhcPs -> !SDoc -> !RdrName -> [LHsTypeArg GhcPs] -> !SDoc -> PsMessage
-- | Expected a hyphen
PsErrExpectedHyphen :: PsMessage
-- | Found a space in a SCC
PsErrSpaceInSCC :: PsMessage
-- | Is TH on?
PsErrEmptyDoubleQuotes :: !Bool -> PsMessage
-- | Invalid package name
PsErrInvalidPackageName :: !FastString -> PsMessage
-- | Invalid rule activation marker
PsErrInvalidRuleActivationMarker :: PsMessage
-- | Linear function found but LinearTypes not enabled
PsErrLinearFunction :: PsMessage
-- | Multi-way if-expression found but MultiWayIf not enabled
PsErrMultiWayIf :: PsMessage
-- | is Unicode forall?
PsErrExplicitForall :: !Bool -> PsMessage
-- | Found qualified-do without QualifiedDo enabled
PsErrIllegalQualifiedDo :: !SDoc -> PsMessage
-- | Cmm parser error
PsErrCmmParser :: !CmmParserError -> PsMessage
-- | Illegal traditional record syntax
--
-- TODO: distinguish errors without using SDoc
PsErrIllegalTraditionalRecordSyntax :: !SDoc -> PsMessage
-- | Parse error in command
--
-- TODO: distinguish errors without using SDoc
PsErrParseErrorInCmd :: !SDoc -> PsMessage
-- | Parse error in pattern
PsErrInPat :: !PatBuilder GhcPs -> !PsErrInPatDetails -> PsMessage
-- | Parse error in right operator section pattern TODO: embed the proper
-- operator, if possible
PsErrParseRightOpSectionInPat :: !infixOcc -> !PatBuilder GhcPs -> PsMessage
-- | Illegal linear arrow or multiplicity annotation in GADT record syntax
PsErrIllegalGadtRecordMultiplicity :: !HsArrow GhcPs -> PsMessage
PsErrInvalidCApiImport :: PsMessage
-- | Extra details about a parse error, which helps us in determining which
-- should be the hints to suggest.
data PsErrParseDetails
PsErrParseDetails :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> PsErrParseDetails
[ped_th_enabled] :: PsErrParseDetails -> !Bool
-- | Is there a 'do' in the last 100 characters?
[ped_do_in_last_100] :: PsErrParseDetails -> !Bool
-- | Is there an mdo in the last 100 characters?
[ped_mdo_in_last_100] :: PsErrParseDetails -> !Bool
-- | Is PatternSynonyms enabled?
[ped_pat_syn_enabled] :: PsErrParseDetails -> !Bool
-- | Did we parse a "pattern" keyword?
[ped_pattern_parsed] :: PsErrParseDetails -> !Bool
-- | Is the parsed pattern recursive?
data PatIsRecursive
YesPatIsRecursive :: PatIsRecursive
NoPatIsRecursive :: PatIsRecursive
data PatIncompleteDoBlock
YesIncompleteDoBlock :: PatIncompleteDoBlock
NoIncompleteDoBlock :: PatIncompleteDoBlock
-- | Extra information for the expression GHC is currently
-- inspecting/parsing. It can be used to generate more informative parser
-- diagnostics and hints.
data ParseContext
ParseContext :: !Maybe RdrName -> !PatIncompleteDoBlock -> ParseContext
-- | If Just, this is an infix pattern with the binded operator name
[is_infix] :: ParseContext -> !Maybe RdrName
-- | Did the parser likely fail due to an incomplete do block?
[incomplete_do_block] :: ParseContext -> !PatIncompleteDoBlock
data PsErrInPatDetails
-- | Negative application pattern?
PEIP_NegApp :: PsErrInPatDetails
-- | The list of type arguments for the pattern
PEIP_TypeArgs :: [HsPatSigType GhcPs] -> PsErrInPatDetails
PEIP_RecPattern :: [LPat GhcPs] -> !PatIsRecursive -> !ParseContext -> PsErrInPatDetails
PEIP_OtherPatDetails :: !ParseContext -> PsErrInPatDetails
noParseContext :: ParseContext
incompleteDoBlock :: ParseContext
-- | Builds a PsErrInPatDetails with the information provided by the
-- ParseContext.
fromParseContext :: ParseContext -> PsErrInPatDetails
data NumUnderscoreReason
NumUnderscore_Integral :: NumUnderscoreReason
NumUnderscore_Float :: NumUnderscoreReason
data LexErrKind
-- | End of input
LexErrKind_EOF :: LexErrKind
-- | UTF-8 decoding error
LexErrKind_UTF8 :: LexErrKind
-- | Error at given character
LexErrKind_Char :: !Char -> LexErrKind
data LexErr
-- | Lexical error
LexError :: LexErr
-- | Unknown pragma
LexUnknownPragma :: LexErr
-- | Lexical error in pragma
LexErrorInPragma :: LexErr
-- | Numeric escape sequence out of range
LexNumEscapeRange :: LexErr
-- | Lexical error in string/character literal
LexStringCharLit :: LexErr
-- | Unexpected end-of-file in string/character literal
LexStringCharLitEOF :: LexErr
-- | Unterminated `{-'
LexUnterminatedComment :: LexErr
-- | Unterminated OPTIONS pragma
LexUnterminatedOptions :: LexErr
-- | Unterminated quasiquotation
LexUnterminatedQQ :: LexErr
-- | Errors from the Cmm parser
data CmmParserError
-- | Unknown Cmm primitive
CmmUnknownPrimitive :: !FastString -> CmmParserError
-- | Unknown macro
CmmUnknownMacro :: !FastString -> CmmParserError
-- | Unknown calling convention
CmmUnknownCConv :: !String -> CmmParserError
-- | Unrecognised safety
CmmUnrecognisedSafety :: !String -> CmmParserError
-- | Unrecognised hint
CmmUnrecognisedHint :: !String -> CmmParserError
data TransLayoutReason
-- | "`where' clause at the same depth as implicit layout block"
TransLayout_Where :: TransLayoutReason
-- | "`|' at the same depth as implicit layout block")
TransLayout_Pipe :: TransLayoutReason
instance GHC.Classes.Eq GHC.Parser.Errors.Types.PatIncompleteDoBlock
instance GHC.Classes.Eq GHC.Parser.Errors.Types.ParseContext
instance GHC.Classes.Ord GHC.Parser.Errors.Types.NumUnderscoreReason
instance GHC.Classes.Eq GHC.Parser.Errors.Types.NumUnderscoreReason
instance GHC.Show.Show GHC.Parser.Errors.Types.NumUnderscoreReason
instance GHC.Classes.Ord GHC.Parser.Errors.Types.LexErrKind
instance GHC.Classes.Eq GHC.Parser.Errors.Types.LexErrKind
instance GHC.Show.Show GHC.Parser.Errors.Types.LexErrKind
module GHC.Parser.Errors.Ppr
psHeaderMessageDiagnostic :: PsHeaderMessage -> DecoratedSDoc
psHeaderMessageReason :: PsHeaderMessage -> DiagnosticReason
psHeaderMessageHints :: PsHeaderMessage -> [GhcHint]
suggestParensAndBlockArgs :: [GhcHint]
pp_unexpected_fun_app :: Outputable a => SDoc -> a -> SDoc
parse_error_in_pat :: SDoc
forallSym :: Bool -> SDoc
instance GHC.Types.Error.Diagnostic GHC.Parser.Errors.Types.PsMessage
module GHC.Parser.Lexer
data Token
ITas :: Token
ITcase :: Token
ITclass :: Token
ITdata :: Token
ITdefault :: Token
ITderiving :: Token
ITdo :: Maybe FastString -> 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 :: Maybe FastString -> Token
ITfamily :: Token
ITrole :: Token
ITgroup :: Token
ITby :: Token
ITusing :: Token
ITpattern :: Token
ITstatic :: Token
ITstock :: Token
ITanyclass :: Token
ITvia :: Token
ITunit :: Token
ITsignature :: Token
ITdependency :: Token
ITrequires :: Token
ITinline_prag :: SourceText -> InlineSpec -> RuleMatchInfo -> Token
ITopaque_prag :: SourceText -> 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 :: SourceText -> Token
ITcolumn_prag :: SourceText -> Token
ITscc_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
ITminimal_prag :: SourceText -> Token
IToverlappable_prag :: SourceText -> Token
IToverlapping_prag :: SourceText -> Token
IToverlaps_prag :: SourceText -> Token
ITincoherent_prag :: SourceText -> Token
ITctype :: SourceText -> Token
ITcomment_line_prag :: Token
ITdotdot :: Token
ITcolon :: Token
ITdcolon :: IsUnicodeSyntax -> Token
ITequal :: Token
ITlam :: Token
ITlcase :: Token
ITvbar :: Token
ITlarrow :: IsUnicodeSyntax -> Token
ITrarrow :: IsUnicodeSyntax -> Token
ITdarrow :: IsUnicodeSyntax -> Token
ITlolly :: Token
ITminus :: Token
ITprefixminus :: Token
ITbang :: Token
ITtilde :: Token
ITat :: Token
ITtypeApp :: Token
ITpercent :: Token
ITstar :: IsUnicodeSyntax -> Token
ITdot :: Token
ITproj :: Bool -> 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 :: IntegralLit -> 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
ITdollar :: Token
ITdollardollar :: Token
ITtyQuote :: Token
ITquasiQuote :: (FastString, FastString, PsSpan) -> Token
ITqQuasiQuote :: (FastString, FastString, FastString, PsSpan) -> Token
ITproc :: Token
ITrec :: Token
-- |
-- (|
--
IToparenbar :: IsUnicodeSyntax -> Token
-- |
-- |)
--
ITcparenbar :: IsUnicodeSyntax -> Token
-- |
-- -<
--
ITlarrowtail :: IsUnicodeSyntax -> Token
-- |
-- >-
--
ITrarrowtail :: IsUnicodeSyntax -> Token
-- |
-- -<<
--
ITLarrowtail :: IsUnicodeSyntax -> Token
-- |
-- >>-
--
ITRarrowtail :: IsUnicodeSyntax -> Token
-- | Used when the lexer can't make sense of it
ITunknown :: String -> Token
-- | end of file token
ITeof :: Token
-- | The HsDocString contains more details about what this is and how to
-- pretty print it
ITdocComment :: HsDocString -> PsSpan -> Token
-- | doc options (prune, ignore-exports, etc)
ITdocOptions :: String -> PsSpan -> Token
-- | comment starting by "--"
ITlineComment :: String -> PsSpan -> Token
-- | comment in {- -}
ITblockComment :: String -> PsSpan -> Token
lexer :: Bool -> (Located Token -> P a) -> P a
lexerDbg :: Bool -> (Located Token -> P a) -> P a
-- | Parser options.
--
-- See mkParserOpts to construct this.
data ParserOpts
ParserOpts :: !ExtsBitmap -> !DiagOpts -> [String] -> ParserOpts
-- | bitmap of permitted extensions
[pExtsBitmap] :: ParserOpts -> !ExtsBitmap
-- | Options to construct diagnostic messages.
[pDiagOpts] :: ParserOpts -> !DiagOpts
-- | supported extensions (only used for suggestions in error messages)
[pSupportedExts] :: ParserOpts -> [String]
-- | Given exactly the information needed, set up the ParserOpts
mkParserOpts :: EnumSet Extension -> DiagOpts -> [String] -> Bool -> Bool -> Bool -> Bool -> ParserOpts
data PState
PState :: StringBuffer -> ParserOpts -> Messages PsMessage -> Messages PsMessage -> Maybe RealSrcSpan -> !Word -> Maybe (PsLocated Token) -> PsSpan -> PsSpan -> PsSpan -> !Int -> PsLoc -> [LayoutContext] -> [Int] -> [FastString] -> [PsLocated Token] -> Maybe (PsLocated Token) -> PsSpan -> [ALRContext] -> Maybe ALRLayout -> Bool -> Maybe (Pair RealSrcSpan RealSrcSpan) -> Maybe [LEpaComment] -> [LEpaComment] -> OrdList (PsLocated HdkComment) -> PState
[buffer] :: PState -> StringBuffer
[options] :: PState -> ParserOpts
[warnings] :: PState -> Messages PsMessage
[errors] :: PState -> Messages PsMessage
[tab_first] :: PState -> Maybe RealSrcSpan
[tab_count] :: PState -> !Word
[last_tk] :: PState -> Maybe (PsLocated Token)
[prev_loc] :: PState -> PsSpan
[prev_loc2] :: PState -> PsSpan
[last_loc] :: PState -> PsSpan
[last_len] :: PState -> !Int
[loc] :: PState -> PsLoc
[context] :: PState -> [LayoutContext]
[lex_state] :: PState -> [Int]
[srcfiles] :: PState -> [FastString]
[alr_pending_implicit_tokens] :: PState -> [PsLocated Token]
[alr_next_token] :: PState -> Maybe (PsLocated Token)
[alr_last_loc] :: PState -> PsSpan
[alr_context] :: PState -> [ALRContext]
[alr_expecting_ocurly] :: PState -> Maybe ALRLayout
[alr_justClosedExplicitLetBlock] :: PState -> Bool
[eof_pos] :: PState -> Maybe (Pair RealSrcSpan RealSrcSpan)
[header_comments] :: PState -> Maybe [LEpaComment]
[comment_q] :: PState -> [LEpaComment]
[hdk_comments] :: PState -> OrdList (PsLocated HdkComment)
-- | Creates a parse state from a ParserOpts value
initParserState :: ParserOpts -> StringBuffer -> RealSrcLoc -> PState
-- | Set parser options for parsing OPTIONS pragmas
initPragState :: ParserOpts -> StringBuffer -> RealSrcLoc -> PState
-- | The parsing monad, isomorphic to StateT PState Maybe.
newtype P a
P :: (PState -> ParseResult a) -> P a
[unP] :: P a -> PState -> ParseResult a
-- | The result of running a parser.
data ParseResult a
-- | The parser has consumed a (possibly empty) prefix of the input and
-- produced a result. Use getPsMessages to check for accumulated
-- warnings and non-fatal errors.
--
-- The carried parsing state can be used to resume parsing.
pattern POk :: PState -> a -> ParseResult a
-- | The parser has consumed a (possibly empty) prefix of the input and
-- failed.
--
-- The carried parsing state can be used to resume parsing. It is the
-- state right before failure, including the fatal parse error.
-- getPsMessages and getPsErrorMessages must return a
-- non-empty bag of errors.
pattern PFailed :: PState -> ParseResult a
allocateComments :: RealSrcSpan -> [LEpaComment] -> ([LEpaComment], [LEpaComment])
allocatePriorComments :: RealSrcSpan -> [LEpaComment] -> Maybe [LEpaComment] -> (Maybe [LEpaComment], [LEpaComment], [LEpaComment])
allocateFinalComments :: RealSrcSpan -> [LEpaComment] -> Maybe [LEpaComment] -> (Maybe [LEpaComment], [LEpaComment], [LEpaComment])
-- | An mtl-style class for monads that support parsing-related operations.
-- For example, sometimes we make a second pass over the parsing results
-- to validate, disambiguate, or rearrange them, and we do so in the PV
-- monad which cannot consume input but can report parsing errors, check
-- for extension bits, and accumulate parsing annotations. Both P and PV
-- are instances of MonadP.
--
-- MonadP grants us convenient overloading. The other option is to have
-- separate operations for each monad: addErrorP vs addErrorPV, getBitP
-- vs getBitPV, and so on.
class Monad m => MonadP m
-- | Add a non-fatal error. Use this when the parser can produce a result
-- despite the error.
--
-- For example, when GHC encounters a forall in a type, but
-- -XExplicitForAll is disabled, the parser constructs
-- ForAllTy as if -XExplicitForAll was enabled, adding
-- a non-fatal error to the accumulator.
--
-- Control flow wise, non-fatal errors act like warnings: they are added
-- to the accumulator and parsing continues. This allows GHC to report
-- more than one parse error per file.
addError :: MonadP m => MsgEnvelope PsMessage -> m ()
-- | Add a warning to the accumulator. Use getPsMessages to get the
-- accumulated warnings.
addWarning :: MonadP m => MsgEnvelope PsMessage -> m ()
-- | Add a fatal error. This will be the last error reported by the parser,
-- and the parser will not produce any result, ending in a PFailed
-- state.
addFatalError :: MonadP m => MsgEnvelope PsMessage -> m a
-- | Check if a given flag is currently set in the bitmap.
getBit :: MonadP m => ExtBits -> m Bool
-- | Go through the comment_q in PState and remove all
-- comments that belong within the given span
allocateCommentsP :: MonadP m => RealSrcSpan -> m EpAnnComments
-- | Go through the comment_q in PState and remove all
-- comments that come before or within the given span
allocatePriorCommentsP :: MonadP m => RealSrcSpan -> m EpAnnComments
-- | Go through the comment_q in PState and remove all
-- comments that come after the given span
allocateFinalCommentsP :: MonadP m => RealSrcSpan -> m EpAnnComments
getRealSrcLoc :: P RealSrcLoc
getPState :: P PState
failMsgP :: (SrcSpan -> MsgEnvelope PsMessage) -> P a
failLocMsgP :: RealSrcLoc -> RealSrcLoc -> (SrcSpan -> MsgEnvelope PsMessage) -> P a
srcParseFail :: P a
-- | Get a bag of the errors that have been accumulated so far. Does not
-- take -Werror into account.
getPsErrorMessages :: PState -> Messages PsMessage
-- | Get the warnings and errors accumulated so far. Does not take -Werror
-- into account.
getPsMessages :: PState -> (Messages PsMessage, Messages PsMessage)
popContext :: P ()
pushModuleContext :: P ()
setLastToken :: PsSpan -> Int -> P ()
setSrcLoc :: RealSrcLoc -> P ()
activeContext :: P Bool
nextIsEOF :: P Bool
getLexState :: P Int
popLexState :: P Int
pushLexState :: Int -> P ()
-- | Various boolean flags, mostly language extensions, that impact lexing
-- and parsing. Note that a handful of these can change during
-- lexing/parsing.
data ExtBits
FfiBit :: ExtBits
InterruptibleFfiBit :: ExtBits
CApiFfiBit :: ExtBits
ArrowsBit :: ExtBits
ThBit :: ExtBits
ThQuotesBit :: ExtBits
IpBit :: ExtBits
OverloadedLabelsBit :: ExtBits
ExplicitForallBit :: ExtBits
BangPatBit :: ExtBits
PatternSynonymsBit :: ExtBits
HaddockBit :: ExtBits
MagicHashBit :: ExtBits
RecursiveDoBit :: ExtBits
QualifiedDoBit :: ExtBits
UnicodeSyntaxBit :: ExtBits
UnboxedParensBit :: ExtBits
DatatypeContextsBit :: ExtBits
MonadComprehensionsBit :: ExtBits
TransformComprehensionsBit :: ExtBits
QqBit :: ExtBits
RawTokenStreamBit :: ExtBits
AlternativeLayoutRuleBit :: ExtBits
ALRTransitionalBit :: ExtBits
RelaxedLayoutBit :: ExtBits
NondecreasingIndentationBit :: ExtBits
SafeHaskellBit :: ExtBits
TraditionalRecordSyntaxBit :: ExtBits
ExplicitNamespacesBit :: ExtBits
LambdaCaseBit :: ExtBits
BinaryLiteralsBit :: ExtBits
NegativeLiteralsBit :: ExtBits
HexFloatLiteralsBit :: ExtBits
StaticPointersBit :: ExtBits
NumericUnderscoresBit :: ExtBits
StarIsTypeBit :: ExtBits
BlockArgumentsBit :: ExtBits
NPlusKPatternsBit :: ExtBits
DoAndIfThenElseBit :: ExtBits
MultiWayIfBit :: ExtBits
GadtSyntaxBit :: ExtBits
ImportQualifiedPostBit :: ExtBits
LinearTypesBit :: ExtBits
NoLexicalNegationBit :: ExtBits
OverloadedRecordDotBit :: ExtBits
OverloadedRecordUpdateBit :: ExtBits
InRulePragBit :: ExtBits
InNestedCommentBit :: ExtBits
-- | If this is enabled, '{-}' and '{--}' update the internal position.
-- Otherwise, those pragmas are lexed as tokens of their own.
UsePosPragsBit :: ExtBits
xtest :: ExtBits -> ExtsBitmap -> Bool
xunset :: ExtBits -> ExtsBitmap -> ExtsBitmap
xset :: ExtBits -> ExtsBitmap -> ExtsBitmap
disableHaddock :: ParserOpts -> ParserOpts
lexTokenStream :: ParserOpts -> StringBuffer -> RealSrcLoc -> ParseResult [Located Token]
-- | Given a RealSrcSpan that surrounds a HsPar or
-- HsParTy, generate AddEpAnn values for the opening and
-- closing bordering on the start and end of the span
mkParensEpAnn :: RealSrcSpan -> (AddEpAnn, AddEpAnn)
getCommentsFor :: MonadP m => SrcSpan -> m EpAnnComments
getPriorCommentsFor :: MonadP m => SrcSpan -> m EpAnnComments
getFinalCommentsFor :: MonadP m => SrcSpan -> m EpAnnComments
getEofPos :: P (Maybe (Pair RealSrcSpan RealSrcSpan))
commentToAnnotation :: RealLocated Token -> LEpaComment
-- | Haddock comment as produced by the lexer. These are accumulated in
-- PState and then processed in
-- GHC.Parser.PostProcess.Haddock. The location of the
-- HsDocStrings spans over the contents of the docstring - i.e. it
-- does not include the decorator ("-- |", "{-|" etc.)
data HdkComment
HdkCommentNext :: HsDocString -> HdkComment
HdkCommentPrev :: HsDocString -> HdkComment
HdkCommentNamed :: String -> HsDocString -> HdkComment
HdkCommentSection :: Int -> HsDocString -> HdkComment
-- | Test whether a WarningFlag is set
warnopt :: WarningFlag -> ParserOpts -> Bool
adjustChar :: Char -> Word8
addPsMessage :: SrcSpan -> PsMessage -> P ()
instance GHC.Show.Show GHC.Parser.Lexer.Token
instance GHC.Show.Show GHC.Parser.Lexer.LayoutContext
instance GHC.Show.Show GHC.Parser.Lexer.HdkComment
instance GHC.Enum.Enum GHC.Parser.Lexer.ExtBits
instance GHC.Parser.Lexer.MonadP GHC.Parser.Lexer.P
instance GHC.Base.Functor GHC.Parser.Lexer.P
instance GHC.Base.Applicative GHC.Parser.Lexer.P
instance GHC.Base.Monad GHC.Parser.Lexer.P
instance GHC.Utils.Outputable.Outputable GHC.Parser.Lexer.Token
module GHC.Parser.PostProcess
mkRdrGetField :: SrcSpanAnnA -> LHsExpr GhcPs -> LocatedAn NoEpAnns (DotFieldOcc GhcPs) -> EpAnnCO -> LHsExpr GhcPs
mkRdrProjection :: NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs)) -> EpAnn AnnProjection -> HsExpr GhcPs
type Fbind b = Either (LHsRecField GhcPs (LocatedA b)) (LHsRecProj GhcPs (LocatedA b))
-- | A useful function for building OpApps. The operator is always
-- a variable, and we don't know the fixity yet.
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsFractional :: FractionalLit -> HsOverLit GhcPs
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
mkHsDo :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
mkSpliceDecl :: LHsExpr GhcPs -> P (LHsDecl GhcPs)
mkRoleAnnotDecl :: SrcSpan -> LocatedN RdrName -> [Located (Maybe FastString)] -> [AddEpAnn] -> P (LRoleAnnotDecl GhcPs)
mkClassDecl :: SrcSpan -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a, [LHsFunDep GhcPs]) -> OrdList (LHsDecl GhcPs) -> LayoutInfo -> [AddEpAnn] -> P (LTyClDecl GhcPs)
mkTyData :: SrcSpan -> NewOrData -> Maybe (LocatedP CType) -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> [AddEpAnn] -> P (LTyClDecl GhcPs)
mkDataFamInst :: SrcSpan -> NewOrData -> Maybe (LocatedP CType) -> (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs GhcPs, LHsType GhcPs) -> Maybe (LHsKind GhcPs) -> [LConDecl GhcPs] -> Located (HsDeriving GhcPs) -> [AddEpAnn] -> P (LInstDecl GhcPs)
mkTySynonym :: SrcSpan -> LHsType GhcPs -> LHsType GhcPs -> [AddEpAnn] -> P (LTyClDecl GhcPs)
mkTyFamInstEqn :: SrcSpan -> HsOuterFamEqnTyVarBndrs GhcPs -> LHsType GhcPs -> LHsType GhcPs -> [AddEpAnn] -> P (LTyFamInstEqn GhcPs)
mkStandaloneKindSig :: SrcSpan -> Located [LocatedN RdrName] -> LHsSigType GhcPs -> [AddEpAnn] -> P (LStandaloneKindSig GhcPs)
mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> [AddEpAnn] -> P (LInstDecl GhcPs)
mkFamDecl :: SrcSpan -> FamilyInfo GhcPs -> TopLevelFlag -> LHsType GhcPs -> LFamilyResultSig GhcPs -> Maybe (LInjectivityAnn GhcPs) -> [AddEpAnn] -> P (LTyClDecl GhcPs)
mkInlinePragma :: SourceText -> (InlineSpec, RuleMatchInfo) -> Maybe Activation -> InlinePragma
mkOpaquePragma :: SourceText -> InlinePragma
mkPatSynMatchGroup :: LocatedN RdrName -> LocatedL (OrdList (LHsDecl GhcPs)) -> P (MatchGroup GhcPs (LHsExpr GhcPs))
mkRecConstrOrUpdate :: Bool -> LHsExpr GhcPs -> SrcSpan -> ([Fbind (HsExpr GhcPs)], Maybe SrcSpan) -> EpAnn [AddEpAnn] -> PV (HsExpr GhcPs)
-- | 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 (GhcPass p) -> LHsDecl (GhcPass p)
mkInstD :: LInstDecl (GhcPass p) -> LHsDecl (GhcPass p)
mkRdrRecordCon :: LocatedN RdrName -> HsRecordBinds GhcPs -> EpAnn [AddEpAnn] -> HsExpr GhcPs
mkRdrRecordUpd :: Bool -> LHsExpr GhcPs -> [Fbind (HsExpr GhcPs)] -> EpAnn [AddEpAnn] -> PV (HsExpr GhcPs)
-- | 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
-- | Converts LHsTyVarBndr annotated with its Specificity to
-- one without annotations. Only accepts specified variables, and errors
-- if the provided binder has an InferredSpec annotation.
fromSpecTyVarBndr :: LHsTyVarBndr Specificity GhcPs -> P (LHsTyVarBndr () GhcPs)
-- | Converts a list of LHsTyVarBndrs annotated with their
-- Specificity to binders without annotations. Only accepts
-- specified variables, and errors if any of the provided binders has an
-- InferredSpec annotation.
fromSpecTyVarBndrs :: [LHsTyVarBndr Specificity GhcPs] -> P [LHsTyVarBndr () GhcPs]
-- | Add the annotation for a 'where' keyword to existing
-- HsLocalBinds
annBinds :: AddEpAnn -> EpAnnComments -> HsLocalBinds GhcPs -> (HsLocalBinds GhcPs, Maybe EpAnnComments)
fixValbindsAnn :: EpAnn AnnList -> EpAnn AnnList
cvBindGroup :: OrdList (LHsDecl GhcPs) -> P (HsValBinds GhcPs)
cvBindsAndSigs :: OrdList (LHsDecl GhcPs) -> P (LHsBinds GhcPs, [LSig GhcPs], [LFamilyDecl GhcPs], [LTyFamInstDecl GhcPs], [LDataFamInstDecl GhcPs], [LDocDecl GhcPs])
-- | 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 GhcPs) -> [LHsDecl GhcPs]
placeHolderPunRhs :: DisambECP b => PV (LocatedA b)
mkImport :: Located CCallConv -> Located Safety -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> P (EpAnn [AddEpAnn] -> HsDecl GhcPs)
parseCImport :: Located CCallConv -> Located Safety -> FastString -> String -> Located SourceText -> Maybe ForeignImport
mkExport :: Located CCallConv -> (Located StringLiteral, LocatedN RdrName, LHsSigType GhcPs) -> P (EpAnn [AddEpAnn] -> HsDecl GhcPs)
mkExtName :: RdrName -> CLabelString
-- | Construct a GADT-style data constructor from the constructor names and
-- their type. Some interesting aspects of this function:
--
--
-- - This splits up the constructor type into its quantified type
-- variables (if provided), context (if provided), argument types, and
-- result type, and records whether this is a prefix or record GADT
-- constructor. See Note [GADT abstract syntax] in GHC.Hs.Decls
-- for more details.
--
mkGadtDecl :: SrcSpan -> [LocatedN RdrName] -> LHsSigType GhcPs -> [AddEpAnn] -> P (LConDecl GhcPs)
mkConDeclH98 :: EpAnn [AddEpAnn] -> LocatedN RdrName -> Maybe [LHsTyVarBndr Specificity GhcPs] -> Maybe (LHsContext GhcPs) -> HsConDeclH98Details GhcPs -> ConDecl GhcPs
checkImportDecl :: Maybe EpaLocation -> Maybe EpaLocation -> P ()
-- | Yield a parse error if we have a function applied directly to a do
-- block etc. and BlockArguments is not enabled.
checkExpBlockArguments :: LHsExpr GhcPs -> PV ()
checkCmdBlockArguments :: LHsCmd GhcPs -> PV ()
-- | Check if a fixity is valid. We support bypassing the usual bound
-- checks for some special operators.
checkPrecP :: Located (SourceText, Int) -> Located (OrdList (LocatedN RdrName)) -> P ()
-- | Validate the context constraints and break up a context into a list of
-- predicates.
--
--
-- (Eq a, Ord b) --> [Eq a, Ord b]
-- Eq a --> [Eq a]
-- (Eq a) --> [Eq a]
-- (((Eq a))) --> [Eq a]
--
checkContext :: LHsType GhcPs -> P (LHsContext GhcPs)
checkPattern :: LocatedA (PatBuilder GhcPs) -> P (LPat GhcPs)
checkPattern_details :: ParseContext -> PV (LocatedA (PatBuilder GhcPs)) -> P (LPat GhcPs)
incompleteDoBlock :: ParseContext
-- | Extra information for the expression GHC is currently
-- inspecting/parsing. It can be used to generate more informative parser
-- diagnostics and hints.
data ParseContext
ParseContext :: !Maybe RdrName -> !PatIncompleteDoBlock -> ParseContext
-- | If Just, this is an infix pattern with the binded operator name
[is_infix] :: ParseContext -> !Maybe RdrName
-- | Did the parser likely fail due to an incomplete do block?
[incomplete_do_block] :: ParseContext -> !PatIncompleteDoBlock
-- | Check for monad comprehensions
--
-- If the flag MonadComprehensions is set, return a MonadComp
-- context, otherwise use the usual ListComp context
checkMonadComp :: PV HsDoFlavour
checkValDef :: SrcSpan -> LocatedA (PatBuilder GhcPs) -> Maybe (AddEpAnn, LHsType GhcPs) -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> P (HsBind GhcPs)
checkValSigLhs :: LHsExpr GhcPs -> P (LocatedN RdrName)
type LRuleTyTmVar = LocatedAn NoEpAnns RuleTyTmVar
-- | Essentially a wrapper for a RuleBndr GhcPs
data RuleTyTmVar
RuleTyTmVar :: EpAnn [AddEpAnn] -> LocatedN RdrName -> Maybe (LHsType GhcPs) -> RuleTyTmVar
mkRuleBndrs :: [LRuleTyTmVar] -> [LRuleBndr GhcPs]
mkRuleTyVarBndrs :: [LRuleTyTmVar] -> [LHsTyVarBndr () GhcPs]
checkRuleTyVarBndrNames :: [LHsTyVarBndr flag GhcPs] -> P ()
checkRecordSyntax :: (MonadP m, Outputable a) => LocatedA a -> m (LocatedA a)
-- | Check if the gadt_constrlist is empty. Only raise parse error for
-- `data T where` to avoid affecting existing error message, see #8258.
checkEmptyGADTs :: Located ([AddEpAnn], [LConDecl GhcPs]) -> P (Located ([AddEpAnn], [LConDecl GhcPs]))
-- | Add a fatal error. This will be the last error reported by the parser,
-- and the parser will not produce any result, ending in a PFailed
-- state.
addFatalError :: MonadP m => MsgEnvelope PsMessage -> m a
-- | Hint about bang patterns, assuming BangPatterns is off.
hintBangPat :: SrcSpan -> Pat GhcPs -> PV ()
mkBangTy :: EpAnn [AddEpAnn] -> SrcStrictness -> LHsType GhcPs -> HsType GhcPs
-- | Result of parsing {-# UNPACK #-} or {-# NOUNPACK
-- #-}.
data UnpackednessPragma
UnpackednessPragma :: [AddEpAnn] -> SourceText -> SrcUnpackedness -> UnpackednessPragma
mkMultTy :: LHsToken "%" GhcPs -> LHsType GhcPs -> LHsUniToken "->" "\8594" GhcPs -> HsArrow GhcPs
mkTokenLocation :: SrcSpan -> TokenLocation
data ImpExpSubSpec
ImpExpAbs :: ImpExpSubSpec
ImpExpAll :: ImpExpSubSpec
ImpExpList :: [LocatedA ImpExpQcSpec] -> ImpExpSubSpec
ImpExpAllWith :: [LocatedA ImpExpQcSpec] -> ImpExpSubSpec
data ImpExpQcSpec
ImpExpQcName :: LocatedN RdrName -> ImpExpQcSpec
ImpExpQcType :: EpaLocation -> LocatedN RdrName -> ImpExpQcSpec
ImpExpQcWildcard :: ImpExpQcSpec
mkModuleImpExp :: [AddEpAnn] -> LocatedA ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs)
mkTypeImpExp :: LocatedN RdrName -> P (LocatedN RdrName)
mkImpExpSubSpec :: [LocatedA ImpExpQcSpec] -> P ([AddEpAnn], ImpExpSubSpec)
checkImportSpec :: LocatedL [LIE GhcPs] -> P (LocatedL [LIE GhcPs])
starSym :: Bool -> String
warnStarIsType :: SrcSpan -> P ()
warnPrepositiveQualifiedModule :: SrcSpan -> P ()
failOpFewArgs :: MonadP m => LocatedN RdrName -> m a
failOpNotEnabledImportQualifiedPost :: SrcSpan -> P ()
failOpImportQualifiedTwice :: SrcSpan -> P ()
data SumOrTuple b
-- | Last two are the locations of the '|' before and after the payload
Sum :: ConTag -> Arity -> LocatedA b -> [EpaLocation] -> [EpaLocation] -> SumOrTuple b
Tuple :: [Either (EpAnn EpaLocation) (LocatedA b)] -> SumOrTuple b
data PV a
runPV :: PV a -> P a
newtype ECP
ECP :: (forall b. DisambECP b => PV (LocatedA b)) -> ECP
[unECP] :: ECP -> forall b. DisambECP b => PV (LocatedA b)
-- | Disambiguate infix operators. See Note [Ambiguous syntactic
-- categories]
class DisambInfixOp b
mkHsVarOpPV :: DisambInfixOp b => LocatedN RdrName -> PV (LocatedN b)
mkHsConOpPV :: DisambInfixOp b => LocatedN RdrName -> PV (LocatedN b)
mkHsInfixHolePV :: DisambInfixOp b => SrcSpan -> (EpAnnComments -> EpAnn EpAnnUnboundVar) -> PV (Located b)
-- | Disambiguate constructs that may appear when we do not know ahead of
-- time whether we are parsing an expression, a command, or a pattern.
-- See Note [Ambiguous syntactic categories]
class (b ~ (Body b) GhcPs, AnnoBody b) => DisambECP b where {
-- | See Note [Body in DisambECP]
type family Body b :: Type -> Type;
-- | Infix operator representation
type family InfixOp b;
-- | Function argument representation
type family FunArg b;
}
-- | Return a command without ambiguity, or fail in a non-command context.
ecpFromCmd' :: DisambECP b => LHsCmd GhcPs -> PV (LocatedA b)
-- | Return an expression without ambiguity, or fail in a non-expression
-- context.
ecpFromExp' :: DisambECP b => LHsExpr GhcPs -> PV (LocatedA b)
mkHsProjUpdatePV :: DisambECP b => SrcSpan -> Located [LocatedAn NoEpAnns (DotFieldOcc GhcPs)] -> LocatedA b -> Bool -> [AddEpAnn] -> PV (LHsRecProj GhcPs (LocatedA b))
-- | Disambiguate "... -> ..." (lambda)
mkHsLamPV :: DisambECP b => SrcSpan -> (EpAnnComments -> MatchGroup GhcPs (LocatedA b)) -> PV (LocatedA b)
-- | Disambiguate "let ... in ..."
mkHsLetPV :: DisambECP b => SrcSpan -> LHsToken "let" GhcPs -> HsLocalBinds GhcPs -> LHsToken "in" GhcPs -> LocatedA b -> PV (LocatedA b)
-- | Bring superclass constraints on InfixOp into scope. See Note
-- [UndecidableSuperClasses for associated types]
superInfixOp :: DisambECP b => (DisambInfixOp (InfixOp b) => PV (LocatedA b)) -> PV (LocatedA b)
-- | Disambiguate "f # x" (infix operator)
mkHsOpAppPV :: DisambECP b => SrcSpan -> LocatedA b -> LocatedN (InfixOp b) -> LocatedA b -> PV (LocatedA b)
-- | Disambiguate "case ... of ..."
mkHsCasePV :: DisambECP b => SrcSpan -> LHsExpr GhcPs -> LocatedL [LMatch GhcPs (LocatedA b)] -> EpAnnHsCase -> PV (LocatedA b)
mkHsLamCasePV :: DisambECP b => SrcSpan -> LocatedL [LMatch GhcPs (LocatedA b)] -> [AddEpAnn] -> PV (LocatedA b)
-- | Bring superclass constraints on FunArg into scope. See Note
-- [UndecidableSuperClasses for associated types]
superFunArg :: DisambECP b => (DisambECP (FunArg b) => PV (LocatedA b)) -> PV (LocatedA b)
-- | Disambiguate "f x" (function application)
mkHsAppPV :: DisambECP b => SrcSpanAnnA -> LocatedA b -> LocatedA (FunArg b) -> PV (LocatedA b)
-- | Disambiguate "f @t" (visible type application)
mkHsAppTypePV :: DisambECP b => SrcSpanAnnA -> LocatedA b -> SrcSpan -> LHsType GhcPs -> PV (LocatedA b)
-- | Disambiguate "if ... then ... else ..."
mkHsIfPV :: DisambECP b => SrcSpan -> LHsExpr GhcPs -> Bool -> LocatedA b -> Bool -> LocatedA b -> AnnsIf -> PV (LocatedA b)
-- | Disambiguate "do { ... }" (do notation)
mkHsDoPV :: DisambECP b => SrcSpan -> Maybe ModuleName -> LocatedL [LStmt GhcPs (LocatedA b)] -> AnnList -> PV (LocatedA b)
-- | Disambiguate "( ... )" (parentheses)
mkHsParPV :: DisambECP b => SrcSpan -> LHsToken "(" GhcPs -> LocatedA b -> LHsToken ")" GhcPs -> PV (LocatedA b)
-- | Disambiguate a variable "f" or a data constructor MkF.
mkHsVarPV :: DisambECP b => LocatedN RdrName -> PV (LocatedA b)
-- | Disambiguate a monomorphic literal
mkHsLitPV :: DisambECP b => Located (HsLit GhcPs) -> PV (Located b)
-- | Disambiguate an overloaded literal
mkHsOverLitPV :: DisambECP b => LocatedAn a (HsOverLit GhcPs) -> PV (LocatedAn a b)
-- | Disambiguate a wildcard
mkHsWildCardPV :: DisambECP b => SrcSpan -> PV (Located b)
-- | Disambiguate "a :: t" (type annotation)
mkHsTySigPV :: DisambECP b => SrcSpanAnnA -> LocatedA b -> LHsType GhcPs -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate "[a,b,c]" (list syntax)
mkHsExplicitListPV :: DisambECP b => SrcSpan -> [LocatedA b] -> AnnList -> PV (LocatedA b)
-- | Disambiguate "$(...)" and "[quasi|...|]" (TH splices)
mkHsSplicePV :: DisambECP b => Located (HsSplice GhcPs) -> PV (Located b)
-- | Disambiguate "f { a = b, ... }" syntax (record construction and record
-- updates)
mkHsRecordPV :: DisambECP b => Bool -> SrcSpan -> SrcSpan -> LocatedA b -> ([Fbind b], Maybe SrcSpan) -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate "-a" (negation)
mkHsNegAppPV :: DisambECP b => SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate "(# a)" (right operator section)
mkHsSectionR_PV :: DisambECP b => SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (Located b)
-- | Disambiguate "(a -> b)" (view pattern)
mkHsViewPatPV :: DisambECP b => SrcSpan -> LHsExpr GhcPs -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate "a@b" (as-pattern)
mkHsAsPatPV :: DisambECP b => SrcSpan -> LocatedN RdrName -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate "~a" (lazy pattern)
mkHsLazyPatPV :: DisambECP b => SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate "!a" (bang pattern)
mkHsBangPatPV :: DisambECP b => SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
-- | Disambiguate tuple sections and unboxed sums
mkSumOrTuplePV :: DisambECP b => SrcSpanAnnA -> Boxity -> SumOrTuple b -> [AddEpAnn] -> PV (LocatedA b)
-- | Validate infixexp LHS to reject unwanted {--} pragmas
rejectPragmaPV :: DisambECP b => LocatedA b -> PV ()
ecpFromExp :: LHsExpr GhcPs -> ECP
ecpFromCmd :: LHsCmd GhcPs -> ECP
-- | See Note [Ambiguous syntactic categories] and Note [PatBuilder]
data PatBuilder p
-- | Disambiguate constructs that may appear when we do not know ahead of
-- time whether we are parsing a type or a newtype/data constructor.
--
-- See Note [Ambiguous syntactic categories] for the general idea.
--
-- See Note [Parsing data constructors is hard] for the specific issue
-- this particular class is solving.
class DisambTD b
-- | Process the head of a type-level function/constructor application,
-- i.e. the H in H a b c.
mkHsAppTyHeadPV :: DisambTD b => LHsType GhcPs -> PV (LocatedA b)
-- | Disambiguate f x (function application or prefix data
-- constructor).
mkHsAppTyPV :: DisambTD b => LocatedA b -> LHsType GhcPs -> PV (LocatedA b)
-- | Disambiguate f @t (visible kind application)
mkHsAppKindTyPV :: DisambTD b => LocatedA b -> SrcSpan -> LHsType GhcPs -> PV (LocatedA b)
-- | Disambiguate f # x (infix operator)
mkHsOpTyPV :: DisambTD b => LHsType GhcPs -> LocatedN RdrName -> LHsType GhcPs -> PV (LocatedA b)
-- | Disambiguate {-# UNPACK #-} t (unpack/nounpack pragma)
mkUnpackednessPV :: DisambTD b => Located UnpackednessPragma -> LocatedA b -> PV (LocatedA b)
-- | Annotate a type with either an {-# UNPACK #-} or a {-#
-- NOUNPACK #-} pragma.
addUnpackednessP :: MonadP m => Located UnpackednessPragma -> LHsType GhcPs -> m (LHsType GhcPs)
dataConBuilderCon :: DataConBuilder -> LocatedN RdrName
dataConBuilderDetails :: DataConBuilder -> HsConDeclH98Details GhcPs
instance GHC.Parser.PostProcess.DisambECP (Language.Haskell.Syntax.Expr.HsCmd GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.DisambECP (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.DisambECP (GHC.Parser.Types.PatBuilder GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.DisambInfixOp (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.DisambInfixOp GHC.Types.Name.Reader.RdrName
instance GHC.Parser.PostProcess.DisambTD (Language.Haskell.Syntax.Type.HsType GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.DisambTD GHC.Parser.Types.DataConBuilder
instance GHC.Base.Functor GHC.Parser.PostProcess.PV
instance GHC.Base.Applicative GHC.Parser.PostProcess.PV
instance GHC.Base.Monad GHC.Parser.PostProcess.PV
instance GHC.Parser.Lexer.MonadP GHC.Parser.PostProcess.PV
module GHC.Parser.HaddockLex
-- | Lex identifiers from a docstring.
lexHsDoc :: P (LocatedN RdrName) -> HsDocString -> HsDoc GhcPs
-- | Lex StringLiteral for warning messages
lexStringLiteral :: P (LocatedN RdrName) -> Located StringLiteral -> Located (WithHsDocIdentifiers StringLiteral GhcPs)
-- | This module implements addHaddockToModule, which inserts
-- Haddock comments accumulated during parsing into the AST (#17544).
--
-- We process Haddock comments in two phases:
--
--
-- - Parse the program (via the Happy parser in y), generating
-- an AST, and (quite separately) a list of all the Haddock comments
-- found in the file. More precisely, the Haddock comments are
-- accumulated in the hdk_comments field of the PState, the
-- parser state (see Lexer.x):data PState = PState { ... , hdk_comments
-- :: [PsLocated HdkComment] }
--
--
-- Each of these Haddock comments has a PsSpan, which gives the
-- BufPos of the beginning and end of the Haddock comment.
--
--
-- - Walk over the AST, attaching the Haddock comments to the correct
-- parts of the tree. This step is called addHaddockToModule, and
-- is implemented in this module.
--
--
-- See Note [Adding Haddock comments to the syntax tree].
--
-- This approach codifies an important principle:
--
-- The presence or absence of a Haddock comment should never change the
-- parsing of a program.
--
-- Alternative approaches that did not work properly:
--
--
-- - Using RealSrcLoc instead of BufPos. This led to
-- failures in presence of and other sources of line pragmas. See
-- documentation on BufPos (in GHC.Types.SrcLoc) for the
-- details.
-- - In earlier versions of GHC, the Haddock comments were incorporated
-- into the Parser.y grammar. The parser constructed the AST and attached
-- comments to it in a single pass. See Note [Old solution: Haddock in
-- the grammar] for the details.
--
module GHC.Parser.PostProcess.Haddock
-- | Add Haddock documentation accumulated in the parser state to a parsed
-- HsModule.
--
-- Reports badly positioned comments when -Winvalid-haddock is enabled.
addHaddockToModule :: Located HsModule -> P (Located HsModule)
instance GHC.Base.Monoid GHC.Parser.PostProcess.Haddock.HasInnerDocs
instance GHC.Base.Semigroup GHC.Parser.PostProcess.Haddock.HasInnerDocs
instance GHC.Show.Show GHC.Parser.PostProcess.Haddock.LowerLocBound
instance GHC.Show.Show GHC.Parser.PostProcess.Haddock.UpperLocBound
instance GHC.Show.Show GHC.Parser.PostProcess.Haddock.ColumnBound
instance GHC.Base.Monad GHC.Parser.PostProcess.Haddock.HdkM
instance GHC.Base.Applicative GHC.Parser.PostProcess.Haddock.HdkM
instance GHC.Base.Functor GHC.Parser.PostProcess.Haddock.HdkM
instance GHC.Base.Functor GHC.Parser.PostProcess.Haddock.HdkA
instance GHC.Parser.PostProcess.Haddock.HasHaddock a => GHC.Parser.PostProcess.Haddock.HasHaddock [a]
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Types.SrcLoc.Located GHC.Hs.HsModule)
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedL [GHC.Parser.Annotation.LocatedA (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcPs)])
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedA (GHC.Hs.ImpExp.IE GHC.Hs.Extension.GhcPs))
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Decls.HsDecl GHC.Hs.Extension.GhcPs))
instance GHC.Parser.PostProcess.Haddock.HasHaddock (Language.Haskell.Syntax.Decls.HsDecl GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.Haddock.HasHaddock (Language.Haskell.Syntax.Decls.HsDataDefn GHC.Hs.Extension.GhcPs)
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Types.SrcLoc.Located [GHC.Parser.Annotation.LocatedAn GHC.Parser.Annotation.NoEpAnns (Language.Haskell.Syntax.Decls.HsDerivingClause GHC.Hs.Extension.GhcPs)])
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedAn GHC.Parser.Annotation.NoEpAnns (Language.Haskell.Syntax.Decls.HsDerivingClause GHC.Hs.Extension.GhcPs))
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedC (Language.Haskell.Syntax.Decls.DerivClauseTys GHC.Hs.Extension.GhcPs))
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Decls.ConDecl GHC.Hs.Extension.GhcPs))
instance GHC.Parser.PostProcess.Haddock.HasHaddock a => GHC.Parser.PostProcess.Haddock.HasHaddock (Language.Haskell.Syntax.Type.HsScaled GHC.Hs.Extension.GhcPs a)
instance GHC.Parser.PostProcess.Haddock.HasHaddock a => GHC.Parser.PostProcess.Haddock.HasHaddock (Language.Haskell.Syntax.Type.HsWildCardBndrs GHC.Hs.Extension.GhcPs a)
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Type.HsSigType GHC.Hs.Extension.GhcPs))
instance GHC.Parser.PostProcess.Haddock.HasHaddock (GHC.Parser.Annotation.LocatedA (Language.Haskell.Syntax.Type.HsType GHC.Hs.Extension.GhcPs))
instance GHC.Base.Applicative GHC.Parser.PostProcess.Haddock.HdkA
instance GHC.Base.Semigroup GHC.Parser.PostProcess.Haddock.LocRange
instance GHC.Base.Monoid GHC.Parser.PostProcess.Haddock.LocRange
instance GHC.Base.Semigroup GHC.Parser.PostProcess.Haddock.ColumnBound
instance GHC.Base.Monoid GHC.Parser.PostProcess.Haddock.ColumnBound
instance GHC.Base.Semigroup GHC.Parser.PostProcess.Haddock.UpperLocBound
instance GHC.Base.Monoid GHC.Parser.PostProcess.Haddock.UpperLocBound
instance GHC.Base.Semigroup GHC.Parser.PostProcess.Haddock.LowerLocBound
instance GHC.Base.Monoid GHC.Parser.PostProcess.Haddock.LowerLocBound
module GHC.Driver.Config.Parser
-- | Extracts the flags needed for parsing
initParserOpts :: DynFlags -> ParserOpts
module GHC.HsToCore.Errors.Types
newtype MinBound
MinBound :: Integer -> MinBound
newtype MaxBound
MaxBound :: Integer -> MaxBound
type MaxUncoveredPatterns = Int
type MaxPmCheckModels = Int
-- | Diagnostics messages emitted during desugaring.
data DsMessage
-- | Simply wraps a generic Diagnostic message.
DsUnknownMessage :: a -> DsMessage
-- | DsEmptyEnumeration is a warning (controlled by the
-- -Wempty-enumerations flag) that is emitted if an enumeration is empty.
--
-- Example(s):
--
-- main :: IO () main = do let enum = [5 .. 3] print enum
--
-- Here enum would yield an empty list, because 5 is greater
-- than 3.
--
-- Test case(s): warningsshould_compileT10930
-- warningsshould_compileT18402
-- warningsshould_compileT10930b
-- numericshould_compileT10929 numericshould_compileT7881
-- deSugarshould_runT18172
DsEmptyEnumeration :: DsMessage
-- | DsIdentitiesFound is a warning (controlled by the -Widentities flag)
-- that is emitted on uses of Prelude numeric conversions that are
-- probably the identity (and hence could be omitted).
--
-- Example(s):
--
-- main :: IO () main = do let x = 10 print $ conv 10
--
-- where conv :: Int -> Int conv x = fromIntegral x
--
-- Here calling conv is essentially the identity function, and
-- therefore can be omitted.
--
-- Test case(s): deSugarshould_compileT4488
DsIdentitiesFound :: !Id -> !Type -> DsMessage
DsOverflowedLiterals :: !Integer -> !Name -> !Maybe (MinBound, MaxBound) -> !NegLiteralExtEnabled -> DsMessage
DsRedundantBangPatterns :: !HsMatchContext GhcRn -> !SDoc -> DsMessage
DsOverlappingPatterns :: !HsMatchContext GhcRn -> !SDoc -> DsMessage
DsInaccessibleRhs :: !HsMatchContext GhcRn -> !SDoc -> DsMessage
DsMaxPmCheckModelsReached :: !MaxPmCheckModels -> DsMessage
DsNonExhaustivePatterns :: !HsMatchContext GhcRn -> !ExhaustivityCheckType -> !MaxUncoveredPatterns -> [Id] -> [Nabla] -> DsMessage
DsTopLevelBindsNotAllowed :: !BindsType -> !HsBindLR GhcTc GhcTc -> DsMessage
DsUselessSpecialiseForClassMethodSelector :: !Id -> DsMessage
DsUselessSpecialiseForNoInlineFunction :: !Id -> DsMessage
DsMultiplicityCoercionsNotSupported :: DsMessage
DsOrphanRule :: !CoreRule -> DsMessage
DsRuleLhsTooComplicated :: !CoreExpr -> !CoreExpr -> DsMessage
DsRuleIgnoredDueToConstructor :: !DataCon -> DsMessage
DsRuleBindersNotBound :: ![Var] -> ![Var] -> !CoreExpr -> !CoreExpr -> DsMessage
DsMultipleConForNewtype :: [LocatedN Name] -> DsMessage
DsLazyPatCantBindVarsOfUnliftedType :: [Var] -> DsMessage
DsNotYetHandledByTH :: !ThRejectionReason -> DsMessage
DsAggregatedViewExpressions :: [[LHsExpr GhcTc]] -> DsMessage
DsUnbangedStrictPatterns :: !HsBindLR GhcTc GhcTc -> DsMessage
DsCannotMixPolyAndUnliftedBindings :: !HsBindLR GhcTc GhcTc -> DsMessage
DsInvalidInstantiationDictAtType :: !Type -> DsMessage
DsWrongDoBind :: !LHsExpr GhcTc -> !Type -> DsMessage
DsUnusedDoBind :: !LHsExpr GhcTc -> !Type -> DsMessage
DsRecBindsNotAllowedForUnliftedTys :: ![LHsBindLR GhcTc GhcTc] -> DsMessage
DsRuleMightInlineFirst :: !RuleName -> !Var -> !Activation -> DsMessage
DsAnotherRuleMightFireFirst :: !RuleName -> !RuleName -> !Var -> DsMessage
newtype DsArgNum
DsArgNum :: Int -> DsArgNum
-- | Why TemplateHaskell rejected the splice. Used in the
-- DsNotYetHandledByTH constructor of a DsMessage.
data ThRejectionReason
ThAmbiguousRecordUpdates :: !HsRecUpdField GhcRn -> ThRejectionReason
ThAbstractClosedTypeFamily :: !LFamilyDecl GhcRn -> ThRejectionReason
ThForeignLabel :: !CLabelString -> ThRejectionReason
ThForeignExport :: !LForeignDecl GhcRn -> ThRejectionReason
ThMinimalPragmas :: ThRejectionReason
ThSCCPragmas :: ThRejectionReason
ThNoUserInline :: ThRejectionReason
ThExoticFormOfType :: !HsType GhcRn -> ThRejectionReason
ThAmbiguousRecordSelectors :: !HsExpr GhcRn -> ThRejectionReason
ThMonadComprehensionSyntax :: !HsExpr GhcRn -> ThRejectionReason
ThCostCentres :: !HsExpr GhcRn -> ThRejectionReason
ThExpressionForm :: !HsExpr GhcRn -> ThRejectionReason
ThExoticStatement :: [Stmt GhcRn (LHsExpr GhcRn)] -> ThRejectionReason
ThExoticLiteral :: !HsLit GhcRn -> ThRejectionReason
ThExoticPattern :: !Pat GhcRn -> ThRejectionReason
ThGuardedLambdas :: !Match GhcRn (LHsExpr GhcRn) -> ThRejectionReason
ThNegativeOverloadedPatterns :: !Pat GhcRn -> ThRejectionReason
ThHaddockDocumentation :: ThRejectionReason
ThWarningAndDeprecationPragmas :: [LIdP GhcRn] -> ThRejectionReason
ThSplicesWithinDeclBrackets :: ThRejectionReason
ThNonLinearDataCon :: ThRejectionReason
data NegLiteralExtEnabled
YesUsingNegLiterals :: NegLiteralExtEnabled
NotUsingNegLiterals :: NegLiteralExtEnabled
negLiteralExtEnabled :: DynFlags -> NegLiteralExtEnabled
newtype ExhaustivityCheckType
ExhaustivityCheckType :: Maybe WarningFlag -> ExhaustivityCheckType
data BindsType
UnliftedTypeBinds :: BindsType
StrictBinds :: BindsType
module GHC.Driver.Errors.Types
-- | The umbrella type that encompasses all the different messages that GHC
-- might output during the different compilation stages. See Note
-- [GhcMessage].
data GhcMessage
-- | A message from the parsing phase.
[GhcPsMessage] :: PsMessage -> GhcMessage
-- | A message from typecheck/renaming phase.
[GhcTcRnMessage] :: TcRnMessage -> GhcMessage
-- | A message from the desugaring (HsToCore) phase.
[GhcDsMessage] :: DsMessage -> GhcMessage
-- | A message from the driver.
[GhcDriverMessage] :: DriverMessage -> GhcMessage
-- | An "escape" hatch which can be used when we don't know the source of
-- the message or if the message is not one of the typed ones. The
-- Diagnostic and Typeable constraints ensure that if we
-- know, at pattern-matching time, the originating type, we can
-- attempt a cast and access the fully-structured error. This would be
-- the case for a GHC plugin that offers a domain-specific error type but
-- that doesn't want to place the burden on IDEs/application code to
-- "know" it. The Diagnostic constraint ensures that worst case
-- scenario we can still render this into something which can be
-- eventually converted into a DecoratedSDoc.
[GhcUnknownMessage] :: forall a. (Diagnostic a, Typeable a) => a -> GhcMessage
-- | A message from the driver.
data DriverMessage
-- | Simply wraps a generic Diagnostic message a.
[DriverUnknownMessage] :: (Diagnostic a, Typeable a) => a -> DriverMessage
-- | A parse error in parsing a Haskell file header during dependency
-- analysis
[DriverPsHeaderMessage] :: !PsMessage -> DriverMessage
-- | DriverMissingHomeModules is a warning (controlled with
-- -Wmissing-home-modules) that arises when running GHC in --make mode
-- when some modules needed for compilation are not included on the
-- command line. For example, if A imports B, `ghc --make A.hs` will
-- cause this warning, while `ghc --make A.hs B.hs` will not.
--
-- Useful for cabal to ensure GHC won't pick up modules listed neither in
-- 'exposed-modules' nor in 'other-modules'.
--
-- Test case: warningsshould_compileMissingMod
[DriverMissingHomeModules] :: [ModuleName] -> !BuildingCabalPackage -> DriverMessage
-- | DriverUnknown is a warning that arises when a user tries to reexport a
-- module which isn't part of that unit.
[DriverUnknownReexportedModules] :: [ModuleName] -> DriverMessage
-- | DriverUnknownHiddenModules is a warning that arises when a user tries
-- to hide a module which isn't part of that unit.
[DriverUnknownHiddenModules] :: [ModuleName] -> DriverMessage
-- | DriverUnusedPackages occurs when when package is requested on command
-- line, but was never needed during compilation. Activated by
-- -Wunused-packages.
--
-- Test cases: warningsshould_compileUnusedPackages
[DriverUnusedPackages] :: [PackageArg] -> DriverMessage
-- | DriverUnnecessarySourceImports (controlled with -Wunused-imports)
-- occurs if there are imports which are not necessary. See
-- warnUnnecessarySourceImports in Make.
--
-- Test cases: warningsshould_compileT10637
[DriverUnnecessarySourceImports] :: !ModuleName -> DriverMessage
-- | DriverDuplicatedModuleDeclaration occurs if a module A is
-- declared in multiple files.
--
-- Test cases: None.
[DriverDuplicatedModuleDeclaration] :: !Module -> [FilePath] -> DriverMessage
-- | DriverModuleNotFound occurs if a module A can't be found.
--
-- Test cases: None.
[DriverModuleNotFound] :: !ModuleName -> DriverMessage
-- | DriverFileModuleNameMismatch occurs if a module A is defined
-- in a file with a different name. The first field is the name written
-- in the source code; the second argument is the name extracted from the
-- filename.
--
-- Test cases: modulemod178, driver/bug1677
[DriverFileModuleNameMismatch] :: !ModuleName -> !ModuleName -> DriverMessage
-- | DriverUnexpectedSignature occurs when GHC encounters a module
-- A that imports a signature file which is neither in the
-- signatures section of a '.cabal' file nor in any package in
-- the home modules.
--
-- Example:
--
--
-- - - MyStr.hsig is defined, but not added to signatures in
-- the '.cabal' file. signature MyStr where data Str
-- - - A.hs, which tries to import the signature. module A where import
-- MyStr
--
--
-- Test cases: driver/T12955
[DriverUnexpectedSignature] :: !ModuleName -> !BuildingCabalPackage -> GenInstantiations UnitId -> DriverMessage
-- | DriverFileNotFound occurs when the input file (e.g. given on the
-- command line) can't be found.
--
-- Test cases: None.
[DriverFileNotFound] :: !FilePath -> DriverMessage
-- | DriverStaticPointersNotSupported occurs when the
-- StaticPointers extension is used in an interactive GHCi
-- context.
--
-- Test cases: ghciscriptsStaticPtr
[DriverStaticPointersNotSupported] :: DriverMessage
-- | DriverBackpackModuleNotFound occurs when Backpack can't find a
-- particular module during its dependency analysis.
--
-- Test cases: -
[DriverBackpackModuleNotFound] :: !ModuleName -> DriverMessage
-- | DriverUserDefinedRuleIgnored is a warning that occurs when
-- user-defined rules are ignored. This typically happens when Safe
-- Haskell.
--
-- Test cases:
--
-- testssafeHaskellsafeInfered/UnsafeWarn05
-- testssafeHaskellsafeInfered/UnsafeWarn06
-- testssafeHaskellsafeInfered/UnsafeWarn07
-- testssafeHaskellsafeInfered/UnsafeInfered11
-- testssafeHaskellsafeLanguage/SafeLang03
[DriverUserDefinedRuleIgnored] :: !RuleDecl GhcTc -> DriverMessage
-- | DriverMixedSafetyImport is an error that occurs when a module is
-- imported both as safe and unsafe.
--
-- Test cases:
--
-- testssafeHaskellsafeInfered/Mixed03
-- testssafeHaskellsafeInfered/Mixed02
[DriverMixedSafetyImport] :: !ModuleName -> DriverMessage
-- | DriverCannotLoadInterfaceFile is an error that occurs when we cannot
-- load the interface file for a particular module. This can happen for
-- example in the context of Safe Haskell, when we have to load a module
-- to check if it can be safely imported.
--
-- Test cases: None.
[DriverCannotLoadInterfaceFile] :: !Module -> DriverMessage
-- | DriverInferredSafeImport is a warning (controlled by the Opt_WarnSafe
-- flag) that occurs when a module is inferred safe.
--
-- Test cases: None.
[DriverInferredSafeModule] :: !Module -> DriverMessage
-- | DriverMarkedTrustworthyButInferredSafe is a warning (controlled by the
-- Opt_WarnTrustworthySafe flag) that occurs when a module is marked
-- trustworthy in SafeHaskell but it has been inferred safe.
--
-- Test cases: testssafeHaskellsafeInfered/TrustworthySafe02
-- testssafeHaskellsafeInfered/TrustworthySafe03
[DriverMarkedTrustworthyButInferredSafe] :: !Module -> DriverMessage
-- | DriverInferredSafeImport is a warning (controlled by the
-- Opt_WarnInferredSafeImports flag) that occurs when a safe-inferred
-- module is imported from a safe module.
--
-- Test cases: None.
[DriverInferredSafeImport] :: !Module -> DriverMessage
-- | DriverCannotImportUnsafeModule is an error that occurs when an usafe
-- module is being imported from a safe one.
--
-- Test cases: None.
[DriverCannotImportUnsafeModule] :: !Module -> DriverMessage
-- | DriverMissingSafeHaskellMode is a warning (controlled by the
-- Opt_WarnMissingSafeHaskellMode flag) that occurs when a module is
-- using SafeHaskell features but SafeHaskell mode is not enabled.
--
-- Test cases: None.
[DriverMissingSafeHaskellMode] :: !Module -> DriverMessage
-- | DriverPackageNotTrusted is an error that occurs when a package is
-- required to be trusted but it isn't.
--
-- Test cases: testssafeHaskellcheck/Check01
-- testssafeHaskellcheck/Check08
-- testssafeHaskellcheck/Check06
-- testssafeHaskellcheckpkg01ImpSafeOnly09
-- testssafeHaskellcheckpkg01ImpSafe03
-- testssafeHaskellcheckpkg01ImpSafeOnly07
-- testssafeHaskellcheckpkg01ImpSafeOnly08
[DriverPackageNotTrusted] :: !UnitState -> !UnitId -> DriverMessage
-- | DriverCannotImportFromUntrustedPackage is an error that occurs in the
-- context of Safe Haskell when trying to import a module coming from an
-- untrusted package.
--
-- Test cases: testssafeHaskellcheck/Check09
-- testssafeHaskellcheckpkg01ImpSafe01
-- testssafeHaskellcheckpkg01ImpSafe04
-- testssafeHaskellcheckpkg01ImpSafeOnly03
-- testssafeHaskellcheckpkg01ImpSafeOnly05
-- testssafeHaskellflags/SafeFlags17
-- testssafeHaskellflags/SafeFlags22
-- testssafeHaskellflags/SafeFlags23
-- testssafeHaskellghci/p11 testssafeHaskellghci/p12
-- testssafeHaskellghci/p17 testssafeHaskellghci/p3
-- testssafeHaskellsafeInfered/UnsafeInfered01
-- testssafeHaskellsafeInfered/UnsafeInfered02
-- testssafeHaskellsafeInfered/UnsafeInfered02
-- testssafeHaskellsafeInfered/UnsafeInfered03
-- testssafeHaskellsafeInfered/UnsafeInfered05
-- testssafeHaskellsafeInfered/UnsafeInfered06
-- testssafeHaskellsafeInfered/UnsafeInfered09
-- testssafeHaskellsafeInfered/UnsafeInfered10
-- testssafeHaskellsafeInfered/UnsafeInfered11
-- testssafeHaskellsafeInfered/UnsafeWarn01
-- testssafeHaskellsafeInfered/UnsafeWarn03
-- testssafeHaskellsafeInfered/UnsafeWarn04
-- testssafeHaskellsafeInfered/UnsafeWarn05
-- testssafeHaskellunsafeLibs/BadImport01
-- testssafeHaskellunsafeLibs/BadImport06
-- testssafeHaskellunsafeLibs/BadImport07
-- testssafeHaskellunsafeLibs/BadImport08
-- testssafeHaskellunsafeLibs/BadImport09
-- testssafeHaskellunsafeLibs/Dep05
-- testssafeHaskellunsafeLibs/Dep06
-- testssafeHaskellunsafeLibs/Dep07
-- testssafeHaskellunsafeLibs/Dep08
-- testssafeHaskellunsafeLibs/Dep09
-- testssafeHaskellunsafeLibs/Dep10
[DriverCannotImportFromUntrustedPackage] :: !UnitState -> !Module -> DriverMessage
[DriverRedirectedNoMain] :: !ModuleName -> DriverMessage
[DriverHomePackagesNotClosed] :: ![UnitId] -> DriverMessage
-- | A collection of driver messages
type DriverMessages = Messages DriverMessage
data PsMessage
-- | A group of parser messages emitted in Header. See Note
-- [Messages from GHC.Parser.Header].
PsHeaderMessage :: !PsHeaderMessage -> PsMessage
-- | Pass to a DriverMessage the information whether or not the
-- '-fbuilding-cabal-package' flag is set.
data BuildingCabalPackage
YesBuildingCabalPackage :: BuildingCabalPackage
NoBuildingCabalPackage :: BuildingCabalPackage
-- | A collection of warning messages. INVARIANT: Each
-- GhcMessage in the collection should have SevWarning
-- severity.
type WarningMessages = Messages GhcMessage
-- | A collection of error messages. INVARIANT: Each
-- GhcMessage in the collection should have SevError
-- severity.
type ErrorMessages = Messages GhcMessage
-- | A single warning message. INVARIANT: It must have
-- SevWarning severity.
type WarnMsg = MsgEnvelope GhcMessage
-- | Creates a new GhcMessage out of any diagnostic. This function
-- is also provided to ease the integration of #18516 by allowing
-- diagnostics to be wrapped into the general (but structured)
-- GhcMessage type, so that the conversion can happen gradually.
-- This function should not be needed within GHC, as it would typically
-- be used by plugin or library authors (see comment for the
-- GhcUnknownMessage type constructor)
ghcUnknownMessage :: (Diagnostic a, Typeable a) => a -> GhcMessage
-- | Abstracts away the frequent pattern where we are calling
-- ioMsgMaybe on the result of 'IO (Messages TcRnMessage, a)'.
hoistTcRnMessage :: Monad m => m (Messages TcRnMessage, a) -> m (Messages GhcMessage, a)
-- | Abstracts away the frequent pattern where we are calling
-- ioMsgMaybe on the result of 'IO (Messages DsMessage, a)'.
hoistDsMessage :: Monad m => m (Messages DsMessage, a) -> m (Messages GhcMessage, a)
-- | Checks if we are building a cabal package by consulting the
-- DynFlags.
checkBuildingCabalPackage :: DynFlags -> BuildingCabalPackage
instance GHC.Classes.Eq GHC.Driver.Errors.Types.BuildingCabalPackage
module GHC.HsToCore.Errors.Ppr
badMonadBind :: Type -> SDoc
pprEqn :: HsMatchContext GhcRn -> SDoc -> String -> SDoc
pprContext :: Bool -> HsMatchContext GhcRn -> SDoc -> ((SDoc -> SDoc) -> SDoc) -> SDoc
dots :: Int -> [a] -> SDoc
instance GHC.Types.Error.Diagnostic GHC.HsToCore.Errors.Types.DsMessage
module GHC.Driver.Errors.Ppr
-- | Suggests a list of InstantiationSuggestion for the '.hsig' file
-- to the user.
suggestInstantiatedWith :: ModuleName -> GenInstantiations UnitId -> [InstantiationSuggestion]
instance GHC.Types.Error.Diagnostic GHC.Driver.Errors.Types.GhcMessage
instance GHC.Types.Error.Diagnostic GHC.Driver.Errors.Types.DriverMessage
-- | Source errors
module GHC.Types.SourceError
-- | 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.
newtype SourceError
SourceError :: Messages GhcMessage -> SourceError
mkSrcErr :: Messages GhcMessage -> SourceError
srcErrorMessages :: SourceError -> Messages GhcMessage
throwErrors :: MonadIO io => Messages GhcMessage -> io a
throwOneError :: MonadIO io => MsgEnvelope GhcMessage -> io a
-- | Perform the given action and call the exception handler if the action
-- throws a SourceError. See SourceError for more
-- information.
handleSourceError :: MonadCatch m => (SourceError -> m a) -> m a -> m a
instance GHC.Show.Show GHC.Types.SourceError.SourceError
instance GHC.Exception.Type.Exception GHC.Types.SourceError.SourceError
module GHC.Driver.Errors
-- | Given a bag of diagnostics, turn them into an exception if any has
-- SevError, or print them out otherwise.
printOrThrowDiagnostics :: Logger -> DiagOpts -> Messages GhcMessage -> IO ()
printMessages :: Diagnostic a => Logger -> DiagOpts -> Messages a -> IO ()
handleFlagWarnings :: Logger -> DiagOpts -> [Warn] -> IO ()
-- | Convert a PsError into a wrapped DriverMessage; use it
-- for dealing with parse errors when the driver is doing dependency
-- analysis. Defined here to avoid module loops between
-- GHC.Driver.Error.Types and GHC.Driver.Error.Ppr
mkDriverPsHeaderMessage :: MsgEnvelope PsMessage -> MsgEnvelope DriverMessage
-- | Contains a debug function to dump parts of the GHC.Hs 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 GHC.Hs.Dump
-- | 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 -> BlankEpAnnotations -> a -> SDoc
-- | Show the full AST as the compiler sees it.
showAstDataFull :: Data a => a -> SDoc
-- | Should source spans be removed from output.
data BlankSrcSpan
BlankSrcSpan :: BlankSrcSpan
BlankSrcSpanFile :: BlankSrcSpan
NoBlankSrcSpan :: BlankSrcSpan
-- | Should EpAnnotations be removed from output.
data BlankEpAnnotations
BlankEpAnnotations :: BlankEpAnnotations
NoBlankEpAnnotations :: BlankEpAnnotations
instance GHC.Show.Show GHC.Hs.Dump.BlankSrcSpan
instance GHC.Classes.Eq GHC.Hs.Dump.BlankSrcSpan
instance GHC.Show.Show GHC.Hs.Dump.BlankEpAnnotations
instance GHC.Classes.Eq GHC.Hs.Dump.BlankEpAnnotations
-- | This is the syntax for bkp files which are parsed in 'ghc --backpack'
-- mode. This syntax is used purely for testing purposes.
module GHC.Driver.Backpack.Syntax
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 -> UnitId -> HsComponentId
[hsPackageName] :: HsComponentId -> PackageName
[hsComponentId] :: HsComponentId -> UnitId
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)
-- | A declaration in a package, e.g. a module or signature definition, or
-- an include.
data HsUnitDecl n
DeclD :: HscSource -> Located ModuleName -> Located HsModule -> HsUnitDecl n
IncludeD :: IncludeDecl n -> HsUnitDecl n
-- | 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 GHC.Utils.Outputable.Outputable GHC.Driver.Backpack.Syntax.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 :: ParserOpts -> String -> P a -> ParseResult a
-- runParser opts str parser = unP parser parseState
-- where
-- filename = "<interactive>"
-- location = mkRealSrcLoc (mkFastString filename) 1 1
-- buffer = stringToStringBuffer str
-- parseState = initParserState opts buffer location
--
module GHC.Parser
-- | Parse a Haskell module with Haddock comments. This is done in two
-- steps:
--
--
--
-- This is the only parser entry point that deals with Haddock comments.
-- The other entry points (parseDeclaration,
-- parseExpression, etc) do not insert them into the AST.
parseModule :: P (Located HsModule)
parseSignature :: P (Located HsModule)
parseImport :: P (GenLocated SrcSpanAnnA (ImportDecl GhcPs))
parseStatement :: P (GenLocated SrcSpanAnnA (StmtLR GhcPs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))))
parseBackpack :: P [LHsUnit PackageName]
parseDeclaration :: P (GenLocated SrcSpanAnnA (HsDecl GhcPs))
parseExpression :: P ECP
parsePattern :: P (GenLocated SrcSpanAnnA (Pat GhcPs))
parseTypeSignature :: P (GenLocated SrcSpanAnnA (HsDecl GhcPs))
parseStmt :: P (Maybe (GenLocated SrcSpanAnnA (StmtLR GhcPs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))))
parseIdentifier :: P (LocatedN RdrName)
parseType :: P (GenLocated SrcSpanAnnA (HsType GhcPs))
parseHeader :: P (Located HsModule)
parseModuleNoHaddock :: P (Located HsModule)
-- | Parsing the top of a Haskell source file to get its module name,
-- imports and options.
--
-- (c) Simon Marlow 2005 (c) Lemmih 2006
module GHC.Parser.Header
-- | Parse the imports of a source file.
--
-- Throws a SourceError if parsing fails.
getImports :: ParserOpts -> Bool -> StringBuffer -> FilePath -> FilePath -> IO (Either (Messages PsMessage) ([(RawPkgQual, Located ModuleName)], [(RawPkgQual, Located ModuleName)], Bool, Located ModuleName))
mkPrelImports :: ModuleName -> SrcSpan -> Bool -> [LImportDecl GhcPs] -> [LImportDecl GhcPs]
-- | Parse OPTIONS and LANGUAGE pragmas of the source file.
--
-- Throws a SourceError if flag parsing fails (including
-- unsupported flags.)
getOptionsFromFile :: ParserOpts -> FilePath -> IO [Located String]
-- | Parse OPTIONS and LANGUAGE pragmas of the source file.
--
-- Throws a SourceError if flag parsing fails (including
-- unsupported flags.)
getOptions :: ParserOpts -> StringBuffer -> FilePath -> [Located String]
toArgs :: RealSrcLoc -> String -> Either String [Located String]
-- | 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 => [Located String] -> m ()
module GHCi.TH.Binary
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Loc
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Name
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.ModName
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.NameFlavour
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.PkgName
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.NameSpace
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Module
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Info
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Type
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.TyLit
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Specificity
instance Data.Binary.Class.Binary flag => Data.Binary.Class.Binary (Language.Haskell.TH.Syntax.TyVarBndr flag)
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Role
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Lit
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Range
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Stmt
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Pat
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Exp
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Dec
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Overlap
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.DerivClause
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.DerivStrategy
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Guard
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Body
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Match
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Fixity
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.TySynEqn
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.FunDep
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.AnnTarget
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.RuleBndr
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Phases
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.RuleMatch
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Inline
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Pragma
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Safety
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Callconv
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Foreign
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Bang
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.SourceUnpackedness
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.SourceStrictness
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.DecidedStrictness
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.FixityDirection
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.OccName
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Con
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.AnnLookup
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.ModuleInfo
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Clause
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.InjectivityAnn
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.FamilyResultSig
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.TypeFamilyHead
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.PatSynDir
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.PatSynArgs
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.DocLoc
instance Data.Binary.Class.Binary GHC.Serialized.Serialized
instance Data.Binary.Class.Binary Language.Haskell.TH.Syntax.Bytes
-- | Remote GHCi message types and serialization.
--
-- For details on Remote GHCi, see Note [Remote GHCi] in
-- compilerGHCRuntime/Interpreter.hs.
module GHCi.Message
-- | 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 ()
[RtsRevertCAFs] :: Message ()
[InitLinker] :: Message ()
[LookupSymbol] :: String -> Message (Maybe (RemotePtr ()))
[LookupClosure] :: String -> Message (Maybe HValueRef)
[LoadDLL] :: String -> Message (Maybe String)
[LoadArchive] :: String -> Message ()
[LoadObj] :: String -> Message ()
[UnloadObj] :: String -> Message ()
[AddLibrarySearchPath] :: String -> Message (RemotePtr ())
[RemoveLibrarySearchPath] :: RemotePtr () -> Message Bool
[ResolveObjs] :: Message Bool
[FindSystemLibrary] :: String -> 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 compilerGHCRuntime/Interpreter.hs.
[CreateBCOs] :: [ByteString] -> Message [HValueRef]
-- | Release HValueRefs
[FreeHValueRefs] :: [HValueRef] -> Message ()
-- | Add entries to the Static Pointer Table
[AddSptEntry] :: Fingerprint -> HValueRef -> Message ()
-- | Malloc some data and return a RemotePtr to it
[MallocData] :: ByteString -> Message (RemotePtr ())
[MallocStrings] :: [ByteString] -> Message [RemotePtr ()]
-- | Calls prepareForeignCall
[PrepFFI] :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)
-- | Free data previously created by PrepFFI
[FreeFFI] :: RemotePtr C_ffi_cif -> Message ()
-- | Create an info table for a constructor
[MkConInfoTable] :: Bool -> Int -> Int -> Int -> Int -> ByteString -> Message (RemotePtr StgInfoTable)
-- | Evaluate a statement
[EvalStmt] :: EvalOpts -> EvalExpr HValueRef -> Message (EvalStatus [HValueRef])
-- | Resume evaluation of a statement after a breakpoint
[ResumeStmt] :: EvalOpts -> RemoteRef (ResumeContext [HValueRef]) -> Message (EvalStatus [HValueRef])
-- | Abandon evaluation of a statement after a breakpoint
[AbandonStmt] :: RemoteRef (ResumeContext [HValueRef]) -> Message ()
-- | Evaluate something of type IO String
[EvalString] :: HValueRef -> Message (EvalResult String)
-- | Evaluate something of type String -> IO String
[EvalStringToString] :: HValueRef -> String -> Message (EvalResult String)
-- | Evaluate something of type IO ()
[EvalIO] :: HValueRef -> Message (EvalResult ())
-- | Create a set of CostCentres with the same module name
[MkCostCentres] :: String -> [(String, String)] -> Message [RemotePtr CostCentre]
-- | Show a CostCentreStack as a [String]
[CostCentreStackInfo] :: RemotePtr CostCentreStack -> Message [String]
-- | Create a new array of breakpoint flags
[NewBreakArray] :: Int -> Message (RemoteRef BreakArray)
-- | Set how many times a breakpoint should be ignored also used for
-- enable/disable
[SetupBreakpoint] :: RemoteRef BreakArray -> Int -> Int -> Message ()
-- | Query the status of a breakpoint (True = enabled)
[BreakpointStatus] :: RemoteRef BreakArray -> Int -> Message Bool
-- | Get a reference to a free variable at a breakpoint
[GetBreakpointVar] :: HValueRef -> Int -> 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] :: RemoteRef (IORef QState) -> HValueRef -> THResultType -> Maybe Loc -> Message (QResult ByteString)
-- | Run the given mod finalizers.
[RunModFinalizers] :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (QResult ())
-- | Remote interface to GHC.Exts.Heap.getClosureData. This is used by the
-- GHCi debugger to inspect values in the heap for :print and type
-- reconstruction.
[GetClosure] :: HValueRef -> Message (GenClosure HValueRef)
-- | Evaluate something. This is used to support :force in GHCi.
[Seq] :: HValueRef -> Message (EvalStatus ())
-- | Resume forcing a free variable in a breakpoint (#2950)
[ResumeSeq] :: RemoteRef (ResumeContext ()) -> Message (EvalStatus ())
data Msg
Msg :: Message a -> Msg
-- | Messages sent back to GHC from GHCi.TH, to implement the methods of
-- Quasi. For an overview of how TH works with Remote GHCi, see
-- Note [Remote Template Haskell] in GHCi.TH.
data THMessage a
[NewName] :: String -> THMessage (THResult Name)
[Report] :: Bool -> String -> THMessage (THResult ())
[LookupName] :: Bool -> String -> THMessage (THResult (Maybe Name))
[Reify] :: Name -> THMessage (THResult Info)
[ReifyFixity] :: Name -> THMessage (THResult (Maybe Fixity))
[ReifyType] :: Name -> THMessage (THResult Type)
[ReifyInstances] :: Name -> [Type] -> THMessage (THResult [Dec])
[ReifyRoles] :: Name -> THMessage (THResult [Role])
[ReifyAnnotations] :: AnnLookup -> TypeRep -> THMessage (THResult [ByteString])
[ReifyModule] :: Module -> THMessage (THResult ModuleInfo)
[ReifyConStrictness] :: Name -> THMessage (THResult [DecidedStrictness])
[GetPackageRoot] :: THMessage (THResult FilePath)
[AddDependentFile] :: FilePath -> THMessage (THResult ())
[AddTempFile] :: String -> THMessage (THResult FilePath)
[AddModFinalizer] :: RemoteRef (Q ()) -> THMessage (THResult ())
[AddCorePlugin] :: String -> THMessage (THResult ())
[AddTopDecls] :: [Dec] -> THMessage (THResult ())
[AddForeignFilePath] :: ForeignSrcLang -> FilePath -> THMessage (THResult ())
[IsExtEnabled] :: Extension -> THMessage (THResult Bool)
[ExtsEnabled] :: THMessage (THResult [Extension])
[PutDoc] :: DocLoc -> String -> THMessage (THResult ())
[GetDoc] :: DocLoc -> THMessage (THResult (Maybe String))
[StartRecover] :: THMessage ()
[EndRecover] :: Bool -> THMessage ()
[FailIfErrs] :: THMessage (THResult ())
-- | Indicates that this RunTH is finished, and the next message will be
-- the result of RunTH (a QResult).
[RunTHDone] :: THMessage ()
data THMsg
THMsg :: THMessage a -> THMsg
-- | Template Haskell return values
data QResult a
-- | RunTH finished successfully; return value follows
QDone :: a -> QResult a
-- | RunTH threw an exception
QException :: String -> QResult a
-- | RunTH called fail
QFail :: String -> QResult a
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
data EvalOpts
EvalOpts :: Bool -> Bool -> Bool -> Bool -> EvalOpts
[useSandboxThread] :: EvalOpts -> Bool
[singleStep] :: EvalOpts -> Bool
[breakOnException] :: EvalOpts -> Bool
[breakOnError] :: EvalOpts -> Bool
-- | 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
data SerializableException
EUserInterrupt :: SerializableException
EExitCode :: ExitCode -> SerializableException
EOtherException :: String -> SerializableException
toSerializableException :: SomeException -> SerializableException
fromSerializableException :: SerializableException -> SomeException
data THResult a
THException :: String -> THResult a
THComplete :: a -> THResult a
data THResultType
THExp :: THResultType
THPat :: THResultType
THType :: THResultType
THDec :: THResultType
THAnnWrapper :: THResultType
data ResumeContext a
ResumeContext :: MVar () -> MVar (EvalStatus a) -> ThreadId -> ResumeContext a
[resumeBreakMVar] :: ResumeContext a -> MVar ()
[resumeStatusMVar] :: ResumeContext a -> MVar (EvalStatus a)
[resumeThreadId] :: ResumeContext a -> ThreadId
-- | The server-side Template Haskell state. This is created by the StartTH
-- message. A new one is created per module that GHC typechecks.
data QState
QState :: Map TypeRep Dynamic -> Maybe Loc -> Pipe -> QState
-- | persistent data between splices in a module
[qsMap] :: QState -> Map TypeRep Dynamic
-- | location for current splice, if any
[qsLocation] :: QState -> Maybe Loc
-- | pipe to communicate with GHC
[qsPipe] :: QState -> Pipe
getMessage :: Get Msg
putMessage :: Message a -> Put
getTHMessage :: Get THMsg
putTHMessage :: THMessage a -> Put
data Pipe
Pipe :: Handle -> Handle -> IORef (Maybe ByteString) -> Pipe
[pipeRead] :: Pipe -> Handle
[pipeWrite] :: Pipe -> Handle
[pipeLeftovers] :: Pipe -> IORef (Maybe ByteString)
remoteCall :: Binary a => Pipe -> Message a -> IO a
remoteTHCall :: Binary a => Pipe -> THMessage a -> IO a
readPipe :: Pipe -> Get a -> IO a
writePipe :: Pipe -> Put -> IO ()
instance GHC.Show.Show a => GHC.Show.Show (GHCi.Message.QResult a)
instance GHC.Generics.Generic (GHCi.Message.QResult a)
instance GHC.Show.Show GHCi.Message.EvalOpts
instance GHC.Generics.Generic GHCi.Message.EvalOpts
instance GHC.Show.Show a => GHC.Show.Show (GHCi.Message.EvalExpr a)
instance GHC.Generics.Generic (GHCi.Message.EvalExpr a)
instance GHC.Show.Show GHCi.Message.SerializableException
instance GHC.Generics.Generic GHCi.Message.SerializableException
instance GHC.Show.Show a => GHC.Show.Show (GHCi.Message.EvalResult a)
instance GHC.Generics.Generic (GHCi.Message.EvalResult a)
instance GHC.Show.Show a => GHC.Show.Show (GHCi.Message.EvalStatus_ a b)
instance GHC.Generics.Generic (GHCi.Message.EvalStatus_ a b)
instance GHC.Show.Show a => GHC.Show.Show (GHCi.Message.THResult a)
instance GHC.Generics.Generic (GHCi.Message.THResult a)
instance GHC.Generics.Generic GHCi.Message.THResultType
instance GHC.Show.Show GHCi.Message.THResultType
instance GHC.Enum.Enum GHCi.Message.THResultType
instance GHC.Show.Show (GHCi.Message.Message a)
instance GHC.Show.Show (GHCi.Message.THMessage a)
instance GHC.Show.Show GHCi.Message.QState
instance Data.Binary.Class.Binary GHCi.Message.THResultType
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHCi.Message.THResult a)
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHCi.Message.EvalStatus_ a b)
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHCi.Message.EvalResult a)
instance Data.Binary.Class.Binary GHCi.Message.SerializableException
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHCi.Message.EvalExpr a)
instance Data.Binary.Class.Binary GHCi.Message.EvalOpts
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHCi.Message.QResult a)
instance Data.Binary.Class.Binary GHC.IO.Exception.ExitCode
instance Data.Binary.Class.Binary (GHC.Ptr.Ptr a)
instance Data.Binary.Class.Binary (GHC.Ptr.FunPtr a)
instance Data.Binary.Class.Binary GHC.Exts.Heap.ProfInfo.Types.StgTSOProfInfo
instance Data.Binary.Class.Binary GHC.Exts.Heap.ProfInfo.Types.CostCentreStack
instance Data.Binary.Class.Binary GHC.Exts.Heap.ProfInfo.Types.CostCentre
instance Data.Binary.Class.Binary GHC.Exts.Heap.ProfInfo.Types.IndexTable
instance Data.Binary.Class.Binary GHC.Exts.Heap.Closures.WhatNext
instance Data.Binary.Class.Binary GHC.Exts.Heap.Closures.WhyBlocked
instance Data.Binary.Class.Binary GHC.Exts.Heap.Closures.TsoFlags
instance Data.Binary.Class.Binary GHC.Exts.Heap.InfoTable.Types.StgInfoTable
instance Data.Binary.Class.Binary GHC.Exts.Heap.ClosureTypes.ClosureType
instance Data.Binary.Class.Binary GHC.Exts.Heap.Closures.PrimType
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHC.Exts.Heap.Closures.GenClosure a)
-- | Types used by the runtime interpreter
module GHC.Runtime.Interpreter.Types
-- | Interpreter
data Interp
Interp :: !InterpInstance -> !Loader -> Interp
-- | Interpreter instance (internal, external)
[interpInstance] :: Interp -> !InterpInstance
-- | Interpreter loader
[interpLoader] :: Interp -> !Loader
data InterpInstance
-- | External interpreter
ExternalInterp :: !IServConfig -> !IServ -> InterpInstance
-- | External interpreter
--
-- The external interpreter is spawned lazily (on first use) to avoid
-- slowing down sessions that don't require it. The contents of the MVar
-- reflects the state of the interpreter (running or not).
newtype IServ
IServ :: MVar IServState -> IServ
-- | External interpreter instance
data IServInstance
IServInstance :: !Pipe -> !ProcessHandle -> !UniqFM FastString (Ptr ()) -> ![HValueRef] -> IServInstance
[iservPipe] :: IServInstance -> !Pipe
[iservProcess] :: IServInstance -> !ProcessHandle
[iservLookupSymbolCache] :: IServInstance -> !UniqFM FastString (Ptr ())
-- | Values that need to be freed before the next command is sent. Threads
-- can append values to this list asynchronously (by modifying the IServ
-- state MVar).
[iservPendingFrees] :: IServInstance -> ![HValueRef]
-- | Configuration needed to spawn an external interpreter
data IServConfig
IServConfig :: !String -> ![String] -> !Bool -> !Bool -> !Maybe (CreateProcess -> IO ProcessHandle) -> IO () -> IServConfig
-- | External program to run
[iservConfProgram] :: IServConfig -> !String
-- | Command-line options
[iservConfOpts] :: IServConfig -> ![String]
-- | Use Profiling way
[iservConfProfiled] :: IServConfig -> !Bool
-- | Use Dynamic way
[iservConfDynamic] :: IServConfig -> !Bool
-- | Hook
[iservConfHook] :: IServConfig -> !Maybe (CreateProcess -> IO ProcessHandle)
-- | Trace action executed after spawn
[iservConfTrace] :: IServConfig -> IO ()
-- | State of an external interpreter
data IServState
-- | Not spawned yet
IServPending :: IServState
-- | Running
IServRunning :: !IServInstance -> IServState
-- | Interacting with the iserv interpreter, whether it is running on an
-- external process or in the current process.
module GHC.Runtime.Interpreter
newtype BCOOpts
BCOOpts :: Int -> BCOOpts
-- | Number of parallel jobs doing BCO serialization
[bco_n_jobs] :: BCOOpts -> Int
-- | Execute an action of type IO [a], returning
-- ForeignHValues for each of the results.
evalStmt :: Interp -> EvalOpts -> 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 :: Interp -> EvalOpts -> ForeignRef (ResumeContext [HValueRef]) -> IO (EvalStatus_ [ForeignHValue] [HValueRef])
abandonStmt :: Interp -> ForeignRef (ResumeContext [HValueRef]) -> IO ()
-- | Execute an action of type IO ()
evalIO :: Interp -> ForeignHValue -> IO ()
-- | Execute an action of type IO String
evalString :: Interp -> ForeignHValue -> IO String
-- | Execute an action of type String -> IO String
evalStringToIOString :: Interp -> ForeignHValue -> String -> IO String
-- | Allocate and store the given bytes in memory, returning a pointer to
-- the memory in the remote process.
mallocData :: Interp -> ByteString -> IO (RemotePtr ())
-- | Create a set of BCOs that may be mutually recursive.
createBCOs :: Interp -> BCOOpts -> [ResolvedBCO] -> IO [HValueRef]
addSptEntry :: Interp -> Fingerprint -> ForeignHValue -> IO ()
mkCostCentres :: Interp -> String -> [(String, String)] -> IO [RemotePtr CostCentre]
costCentreStackInfo :: Interp -> RemotePtr CostCentreStack -> IO [String]
newBreakArray :: Interp -> Int -> IO (ForeignRef BreakArray)
storeBreakpoint :: Interp -> ForeignRef BreakArray -> Int -> Int -> IO ()
breakpointStatus :: Interp -> ForeignRef BreakArray -> Int -> IO Bool
getBreakpointVar :: Interp -> ForeignHValue -> Int -> IO (Maybe ForeignHValue)
getClosure :: Interp -> ForeignHValue -> IO (GenClosure ForeignHValue)
getModBreaks :: HomeModInfo -> ModBreaks
-- | Send a Seq message to the iserv process to force a value #2950
seqHValue :: Interp -> UnitEnv -> ForeignHValue -> IO (EvalResult ())
-- | Interpreter uses Dynamic way
interpreterDynamic :: Interp -> Bool
-- | Interpreter uses Profiling way
interpreterProfiled :: Interp -> Bool
initObjLinker :: Interp -> IO ()
lookupSymbol :: Interp -> FastString -> IO (Maybe (Ptr ()))
lookupClosure :: Interp -> 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 :: Interp -> String -> IO (Maybe String)
loadArchive :: Interp -> String -> IO ()
loadObj :: Interp -> String -> IO ()
unloadObj :: Interp -> String -> IO ()
addLibrarySearchPath :: Interp -> String -> IO (Ptr ())
removeLibrarySearchPath :: Interp -> Ptr () -> IO Bool
resolveObjs :: Interp -> IO SuccessFlag
findSystemLibrary :: Interp -> 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.
interpCmd :: Binary a => Interp -> 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 ()
[RtsRevertCAFs] :: Message ()
[InitLinker] :: Message ()
[LookupSymbol] :: String -> Message (Maybe (RemotePtr ()))
[LookupClosure] :: String -> Message (Maybe HValueRef)
[LoadDLL] :: String -> Message (Maybe String)
[LoadArchive] :: String -> Message ()
[LoadObj] :: String -> Message ()
[UnloadObj] :: String -> Message ()
[AddLibrarySearchPath] :: String -> Message (RemotePtr ())
[RemoveLibrarySearchPath] :: RemotePtr () -> Message Bool
[ResolveObjs] :: Message Bool
[FindSystemLibrary] :: String -> 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 compilerGHCRuntime/Interpreter.hs.
[CreateBCOs] :: [ByteString] -> Message [HValueRef]
-- | Release HValueRefs
[FreeHValueRefs] :: [HValueRef] -> Message ()
-- | Add entries to the Static Pointer Table
[AddSptEntry] :: Fingerprint -> HValueRef -> Message ()
-- | Malloc some data and return a RemotePtr to it
[MallocData] :: ByteString -> Message (RemotePtr ())
[MallocStrings] :: [ByteString] -> Message [RemotePtr ()]
-- | Calls prepareForeignCall
[PrepFFI] :: FFIConv -> [FFIType] -> FFIType -> Message (RemotePtr C_ffi_cif)
-- | Free data previously created by PrepFFI
[FreeFFI] :: RemotePtr C_ffi_cif -> Message ()
-- | Create an info table for a constructor
[MkConInfoTable] :: Bool -> Int -> Int -> Int -> Int -> ByteString -> Message (RemotePtr StgInfoTable)
-- | Evaluate a statement
[EvalStmt] :: EvalOpts -> EvalExpr HValueRef -> Message (EvalStatus [HValueRef])
-- | Resume evaluation of a statement after a breakpoint
[ResumeStmt] :: EvalOpts -> RemoteRef (ResumeContext [HValueRef]) -> Message (EvalStatus [HValueRef])
-- | Abandon evaluation of a statement after a breakpoint
[AbandonStmt] :: RemoteRef (ResumeContext [HValueRef]) -> Message ()
-- | Evaluate something of type IO String
[EvalString] :: HValueRef -> Message (EvalResult String)
-- | Evaluate something of type String -> IO String
[EvalStringToString] :: HValueRef -> String -> Message (EvalResult String)
-- | Evaluate something of type IO ()
[EvalIO] :: HValueRef -> Message (EvalResult ())
-- | Create a set of CostCentres with the same module name
[MkCostCentres] :: String -> [(String, String)] -> Message [RemotePtr CostCentre]
-- | Show a CostCentreStack as a [String]
[CostCentreStackInfo] :: RemotePtr CostCentreStack -> Message [String]
-- | Create a new array of breakpoint flags
[NewBreakArray] :: Int -> Message (RemoteRef BreakArray)
-- | Set how many times a breakpoint should be ignored also used for
-- enable/disable
[SetupBreakpoint] :: RemoteRef BreakArray -> Int -> Int -> Message ()
-- | Query the status of a breakpoint (True = enabled)
[BreakpointStatus] :: RemoteRef BreakArray -> Int -> Message Bool
-- | Get a reference to a free variable at a breakpoint
[GetBreakpointVar] :: HValueRef -> Int -> 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] :: RemoteRef (IORef QState) -> HValueRef -> THResultType -> Maybe Loc -> Message (QResult ByteString)
-- | Run the given mod finalizers.
[RunModFinalizers] :: RemoteRef (IORef QState) -> [RemoteRef (Q ())] -> Message (QResult ())
-- | Remote interface to GHC.Exts.Heap.getClosureData. This is used by the
-- GHCi debugger to inspect values in the heap for :print and type
-- reconstruction.
[GetClosure] :: HValueRef -> Message (GenClosure HValueRef)
-- | Evaluate something. This is used to support :force in GHCi.
[Seq] :: HValueRef -> Message (EvalStatus ())
-- | Resume forcing a free variable in a breakpoint (#2950)
[ResumeSeq] :: RemoteRef (ResumeContext ()) -> Message (EvalStatus ())
-- | Grab a lock on the IServ and do something with it. Overloaded
-- because this is used from TcM as well as IO.
withIServ :: ExceptionMonad m => IServConfig -> IServ -> (IServInstance -> m (IServInstance, a)) -> m a
withIServ_ :: (MonadIO m, ExceptionMonad m) => IServConfig -> IServ -> (IServInstance -> m a) -> m a
-- | Stop the interpreter
stopInterp :: Interp -> IO ()
-- | Send a Message and receive the response from the iserv process
iservCall :: Binary a => IServInstance -> Message a -> IO a
-- | Read a value from the iserv process
readIServ :: IServInstance -> Get a -> IO a
-- | Send a value to the iserv process
writeIServ :: IServInstance -> Put -> IO ()
purgeLookupSymbolCache :: Interp -> IO ()
freeHValueRefs :: Interp -> [HValueRef] -> IO ()
-- | Creates a ForeignRef that will automatically release the
-- RemoteRef when it is no longer referenced.
mkFinalizedHValue :: Interp -> 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 :: Interp -> 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 :: Interp -> RemoteRef a -> IO a
fromEvalResult :: EvalResult a -> IO a
module GHC.Runtime.Eval.Types
data Resume
Resume :: String -> ForeignRef (ResumeContext [HValueRef]) -> ResumeBindings -> [Id] -> ForeignHValue -> Maybe BreakInfo -> SrcSpan -> String -> RemotePtr CostCentreStack -> [History] -> Int -> Resume
[resumeStmt] :: Resume -> String
[resumeContext] :: Resume -> ForeignRef (ResumeContext [HValueRef])
[resumeBindings] :: Resume -> ResumeBindings
[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
type ResumeBindings = ([TyThing], IcGlobalRdrEnv)
-- | Essentially a GlobalRdrEnv, but with additional cached values to allow
-- efficient re-calculation when the imports change. Fields are strict to
-- avoid space leaks (see T4029) All operations are in
-- GHC.Runtime.Context. See Note [icReaderEnv recalculation]
data IcGlobalRdrEnv
IcGlobalRdrEnv :: !GlobalRdrEnv -> !GlobalRdrEnv -> IcGlobalRdrEnv
-- | The final environment
[igre_env] :: IcGlobalRdrEnv -> !GlobalRdrEnv
-- | Just the things defined at the prompt (excluding imports!)
[igre_prompt_env] :: IcGlobalRdrEnv -> !GlobalRdrEnv
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
module GHC.Runtime.Context
-- | Interactive context, recording information about the state of the
-- context in which statements are executed in a GHCi session.
data InteractiveContext
InteractiveContext :: DynFlags -> Int -> [InteractiveImport] -> [TyThing] -> IcGlobalRdrEnv -> (InstEnv, [FamInst]) -> FixityEnv -> Maybe [Type] -> [Resume] -> Name -> Name -> Maybe FilePath -> !Plugins -> InteractiveContext
-- | The DynFlags used to evaluate interactive 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 (icReaderEnv) 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). Also used in GHC.Tc.Module.runTcInteractive to
-- fill the type checker environment. See Note [ic_tythings]
[ic_tythings] :: InteractiveContext -> [TyThing]
-- | Essentially the cached GlobalRdrEnv.
--
-- The GlobalRdrEnv contains everything in scope at the command line,
-- both imported and everything in ic_tythings, with the correct
-- shadowing.
--
-- The IcGlobalRdrEnv contains extra data to allow efficient
-- recalculation when the set of imports change. See Note [icReaderEnv
-- recalculation]
[ic_gre_cache] :: InteractiveContext -> IcGlobalRdrEnv
-- | 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 -> (InstEnv, [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
-- | virtual CWD of the program
[ic_cwd] :: InteractiveContext -> Maybe FilePath
-- | Cache of loaded plugins. We store them here to avoid having to load
-- them everytime we switch to the interctive context.
[ic_plugins] :: InteractiveContext -> !Plugins
data InteractiveImport
-- | Bring the exports of a particular module (filtered by an import decl)
-- into scope
IIDecl :: ImportDecl GhcPs -> InteractiveImport
-- | Bring into scope the entire top-level envt of of this module,
-- including the things imported into it.
IIModule :: ModuleName -> InteractiveImport
-- | Constructs an empty InteractiveContext.
emptyInteractiveContext :: DynFlags -> InteractiveContext
-- | extendInteractiveContext is called with new TyThings recently defined
-- to update the InteractiveContext to include them. By putting new
-- things first, unqualified use will pick the most recently defined
-- thing with a given name, while still keeping the old names in scope in
-- their qualified form (Ghci1.foo).
extendInteractiveContext :: InteractiveContext -> [TyThing] -> InstEnv -> [FamInst] -> Maybe [Type] -> FixityEnv -> InteractiveContext
extendInteractiveContextWithIds :: InteractiveContext -> [Id] -> InteractiveContext
setInteractivePrintName :: InteractiveContext -> Name -> InteractiveContext
substInteractiveContext :: InteractiveContext -> TCvSubst -> InteractiveContext
replaceImportEnv :: IcGlobalRdrEnv -> GlobalRdrEnv -> IcGlobalRdrEnv
icReaderEnv :: InteractiveContext -> GlobalRdrEnv
icInteractiveModule :: InteractiveContext -> Module
-- | This function returns the list of visible TyThings (useful for e.g.
-- showBindings).
--
-- It picks only those TyThings that are not shadowed by later
-- definitions on the interpreter, to not clutter :showBindings with
-- shadowed ids, which would show up as Ghci9.foo.
--
-- Some TyThings define many names; we include them if _any_ name is
-- still available unqualified.
icInScopeTTs :: InteractiveContext -> [TyThing]
-- | Get the PrintUnqualified function based on the flags and this
-- InteractiveContext
icPrintUnqual :: UnitEnv -> InteractiveContext -> PrintUnqualified
instance GHC.Utils.Outputable.Outputable GHC.Runtime.Context.InteractiveImport
module GHC.Driver.Env.Types
-- | The Hsc monad: Passing an environment and diagnostic state
newtype Hsc a
Hsc :: (HscEnv -> Messages GhcMessage -> IO (a, Messages GhcMessage)) -> Hsc a
-- | 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--. It's also used to store the dynamic linker state to allow for
-- multiple linkers in the same address space. 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 -> {-# UNPACK #-} !NameCache -> {-# UNPACK #-} !FinderCache -> KnotVars (IORef TypeEnv) -> Maybe Interp -> !Plugins -> UnitEnv -> !Logger -> !Hooks -> !TmpFs -> 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
-- | Global Name cache so that each Name gets a single Unique. Also track
-- the origin of the Names.
[hsc_NC] :: HscEnv -> {-# UNPACK #-} !NameCache
-- | The cached result of performing finding in the file system
[hsc_FC] :: HscEnv -> {-# UNPACK #-} !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_vars] :: HscEnv -> KnotVars (IORef TypeEnv)
-- | target code interpreter (if any) to use for TH and GHCi. See Note
-- [Target code interpreter]
[hsc_interp] :: HscEnv -> Maybe Interp
-- | Plugins
[hsc_plugins] :: HscEnv -> !Plugins
-- | Unit environment (unit state, home unit, etc.).
--
-- Initialized from the databases cached in hsc_unit_dbs and
-- from the DynFlags.
[hsc_unit_env] :: HscEnv -> UnitEnv
-- | Logger with its flags.
--
-- Don't forget to update the logger flags if the logging related
-- DynFlags change. Or better, use hscSetFlags setter which does it.
[hsc_logger] :: HscEnv -> !Logger
-- | Hooks
[hsc_hooks] :: HscEnv -> !Hooks
-- | Temporary files
[hsc_tmpfs] :: HscEnv -> !TmpFs
instance Control.Monad.IO.Class.MonadIO GHC.Driver.Env.Types.Hsc
instance GHC.Base.Monad GHC.Driver.Env.Types.Hsc
instance GHC.Base.Applicative GHC.Driver.Env.Types.Hsc
instance GHC.Base.Functor GHC.Driver.Env.Types.Hsc
instance GHC.Driver.Session.HasDynFlags GHC.Driver.Env.Types.Hsc
instance GHC.Utils.Logger.HasLogger GHC.Driver.Env.Types.Hsc
instance GHC.Driver.Session.ContainsDynFlags GHC.Driver.Env.Types.HscEnv
module GHC.Driver.Env
-- | The Hsc monad: Passing an environment and diagnostic state
newtype Hsc a
Hsc :: (HscEnv -> Messages GhcMessage -> IO (a, Messages GhcMessage)) -> Hsc a
-- | 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--. It's also used to store the dynamic linker state to allow for
-- multiple linkers in the same address space. 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 -> {-# UNPACK #-} !NameCache -> {-# UNPACK #-} !FinderCache -> KnotVars (IORef TypeEnv) -> Maybe Interp -> !Plugins -> UnitEnv -> !Logger -> !Hooks -> !TmpFs -> 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
-- | Global Name cache so that each Name gets a single Unique. Also track
-- the origin of the Names.
[hsc_NC] :: HscEnv -> {-# UNPACK #-} !NameCache
-- | The cached result of performing finding in the file system
[hsc_FC] :: HscEnv -> {-# UNPACK #-} !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_vars] :: HscEnv -> KnotVars (IORef TypeEnv)
-- | target code interpreter (if any) to use for TH and GHCi. See Note
-- [Target code interpreter]
[hsc_interp] :: HscEnv -> Maybe Interp
-- | Plugins
[hsc_plugins] :: HscEnv -> !Plugins
-- | Unit environment (unit state, home unit, etc.).
--
-- Initialized from the databases cached in hsc_unit_dbs and
-- from the DynFlags.
[hsc_unit_env] :: HscEnv -> UnitEnv
-- | Logger with its flags.
--
-- Don't forget to update the logger flags if the logging related
-- DynFlags change. Or better, use hscSetFlags setter which does it.
[hsc_logger] :: HscEnv -> !Logger
-- | Hooks
[hsc_hooks] :: HscEnv -> !Hooks
-- | Temporary files
[hsc_tmpfs] :: HscEnv -> !TmpFs
-- | Update Flags
hscUpdateFlags :: (DynFlags -> DynFlags) -> HscEnv -> HscEnv
-- | Set Flags
hscSetFlags :: HasDebugCallStack => DynFlags -> HscEnv -> HscEnv
hsc_home_unit :: HscEnv -> HomeUnit
hsc_home_unit_maybe :: HscEnv -> Maybe HomeUnit
hsc_units :: HasDebugCallStack => HscEnv -> UnitState
hsc_HPT :: HscEnv -> HomePackageTable
hsc_HUE :: HscEnv -> HomeUnitEnv
hsc_HUG :: HscEnv -> HomeUnitGraph
hsc_all_home_unit_ids :: HscEnv -> Set UnitId
-- | Update the LogFlags of the Log in hsc_logger from the DynFlags in
-- hsc_dflags. You need to call this when DynFlags are modified.
hscUpdateLoggerFlags :: HscEnv -> HscEnv
hscUpdateHUG :: (HomeUnitGraph -> HomeUnitGraph) -> HscEnv -> HscEnv
hscUpdateHPT :: (HomePackageTable -> HomePackageTable) -> HscEnv -> HscEnv
hscSetActiveHomeUnit :: HasDebugCallStack => HomeUnit -> HscEnv -> HscEnv
hscSetActiveUnitId :: HasDebugCallStack => UnitId -> HscEnv -> HscEnv
hscActiveUnitId :: HscEnv -> UnitId
runHsc :: HscEnv -> Hsc a -> IO a
runHsc' :: HscEnv -> Hsc a -> IO (a, Messages GhcMessage)
-- | Switches in the DynFlags and Plugins from the InteractiveContext
mkInteractiveHscEnv :: HscEnv -> HscEnv
-- | A variant of runHsc that switches in the DynFlags and Plugins from the
-- InteractiveContext before running the Hsc computation.
runInteractiveHsc :: HscEnv -> Hsc a -> IO a
-- | Retrieve the ExternalPackageState cache.
hscEPS :: HscEnv -> IO ExternalPackageState
-- | Retrieve the target code interpreter
--
-- Fails if no target code interpreter is available
hscInterp :: HscEnv -> Interp
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.
hptAllInstances :: HscEnv -> (InstEnv, [FamInst])
-- | Find instances visible from the given set of imports
hptInstancesBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> (InstEnv, [FamInst])
-- | Get annotations from modules "below" this one (in the dependency
-- sense)
hptAnns :: HscEnv -> Maybe (UnitId, ModuleNameWithIsBoot) -> [Annotation]
hptAllThings :: (HomeModInfo -> [a]) -> HscEnv -> [a]
-- | Get things from modules "below" this one (in the dependency sense) C.f
-- Inst.hptInstances
hptSomeThingsBelowUs :: (HomeModInfo -> [a]) -> Bool -> HscEnv -> UnitId -> ModuleNameWithIsBoot -> [a]
-- | Get rules from modules "below" this one (in the dependency sense)
hptRules :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> [CoreRule]
-- | Deal with gathering annotations in from all possible places and
-- combining them into a single AnnEnv
prepareAnnotations :: HscEnv -> Maybe ModGuts -> IO AnnEnv
-- | Discard the contents of the InteractiveContext, but keep the DynFlags
-- and the loaded plugins. It will also keep ic_int_print and ic_monad if
-- their names are from external packages.
discardIC :: HscEnv -> HscEnv
-- | 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 :: HscEnv -> Name -> IO (Maybe TyThing)
-- | Find the ModIface for a Module, searching in both the
-- loaded home and external package module information
lookupIfaceByModule :: HomeUnitGraph -> PackageIfaceTable -> Module -> Maybe ModIface
mainModIs :: HomeUnitEnv -> Module
module GHC.Driver.Monad
-- | 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, ExceptionMonad m, HasDynFlags m, HasLogger 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 => 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 ()
-- | Set the current session to the result of applying the current session
-- to the argument.
modifySessionM :: GhcMonad m => (HscEnv -> m HscEnv) -> m ()
-- | Call an action with a temporarily modified Session.
withTempSession :: GhcMonad m => (HscEnv -> HscEnv) -> m a -> m a
-- | Modify the logger
modifyLogger :: GhcMonad m => (Logger -> Logger) -> m ()
-- | Push a log hook on the stack
pushLogHookM :: GhcMonad m => (LogAction -> LogAction) -> m ()
-- | Pop a log hook from the stack
popLogHookM :: GhcMonad m => m ()
-- | Put a log message
putLogMsgM :: GhcMonad m => MessageClass -> SrcSpan -> SDoc -> m ()
-- | Put a log message
putMsgM :: GhcMonad m => SDoc -> m ()
-- | Time an action
withTimingM :: GhcMonad m => SDoc -> (b -> ()) -> m b -> m b
-- | A monad that allows logging of diagnostics.
logDiagnostics :: GhcMonad m => Messages GhcMessage -> m ()
-- | Print the all diagnostics in a SourceError. Useful inside
-- exception handlers.
printException :: (HasLogger m, MonadIO m, HasDynFlags m) => SourceError -> m ()
-- | A function called to log warnings and errors.
type WarnErrLogger = forall m. (HasDynFlags m, MonadIO m, HasLogger m) => Maybe SourceError -> m ()
defaultWarnErrLogger :: WarnErrLogger
instance Control.Monad.Catch.MonadMask GHC.Driver.Monad.Ghc
instance Control.Monad.Catch.MonadCatch GHC.Driver.Monad.Ghc
instance Control.Monad.Catch.MonadThrow GHC.Driver.Monad.Ghc
instance GHC.Base.Functor GHC.Driver.Monad.Ghc
instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (GHC.Driver.Monad.GhcT m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (GHC.Driver.Monad.GhcT m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (GHC.Driver.Monad.GhcT m)
instance GHC.Base.Functor m => GHC.Base.Functor (GHC.Driver.Monad.GhcT m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (GHC.Driver.Monad.GhcT m)
instance GHC.Base.Monad m => GHC.Base.Monad (GHC.Driver.Monad.GhcT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (GHC.Driver.Monad.GhcT m)
instance Control.Monad.IO.Class.MonadIO m => GHC.Driver.Session.HasDynFlags (GHC.Driver.Monad.GhcT m)
instance Control.Monad.IO.Class.MonadIO m => GHC.Utils.Logger.HasLogger (GHC.Driver.Monad.GhcT m)
instance GHC.Utils.Exception.ExceptionMonad m => GHC.Driver.Monad.GhcMonad (GHC.Driver.Monad.GhcT m)
instance GHC.Base.Applicative GHC.Driver.Monad.Ghc
instance GHC.Base.Monad GHC.Driver.Monad.Ghc
instance Control.Monad.IO.Class.MonadIO GHC.Driver.Monad.Ghc
instance Control.Monad.Fix.MonadFix GHC.Driver.Monad.Ghc
instance GHC.Driver.Session.HasDynFlags GHC.Driver.Monad.Ghc
instance GHC.Utils.Logger.HasLogger GHC.Driver.Monad.Ghc
instance GHC.Driver.Monad.GhcMonad GHC.Driver.Monad.Ghc
module GHC.Core.Opt.Monad
data CoreToDo
CoreDoSimplify :: Int -> SimplMode -> CoreToDo
CoreDoPluginPass :: String -> CorePluginPass -> CoreToDo
CoreDoFloatInwards :: CoreToDo
CoreDoFloatOutwards :: FloatOutSwitches -> CoreToDo
CoreLiberateCase :: CoreToDo
CoreDoPrintCore :: CoreToDo
CoreDoStaticArgs :: CoreToDo
CoreDoCallArity :: CoreToDo
CoreDoExitify :: CoreToDo
CoreDoDemand :: CoreToDo
CoreDoCpr :: CoreToDo
CoreDoWorkerWrapper :: CoreToDo
CoreDoSpecialising :: CoreToDo
CoreDoSpecConstr :: CoreToDo
CoreCSE :: CoreToDo
CoreDoRuleCheck :: CompilerPhase -> String -> CoreToDo
CoreDoNothing :: CoreToDo
CoreDoPasses :: [CoreToDo] -> CoreToDo
CoreDesugar :: CoreToDo
CoreDesugarOpt :: CoreToDo
CoreTidy :: CoreToDo
CorePrep :: CoreToDo
CoreAddCallerCcs :: CoreToDo
CoreAddLateCcs :: CoreToDo
CoreOccurAnal :: CoreToDo
runWhen :: Bool -> CoreToDo -> CoreToDo
runMaybe :: Maybe a -> (a -> CoreToDo) -> CoreToDo
data SimplMode
SimplMode :: [String] -> CompilerPhase -> !UnfoldingOpts -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Logger -> DynFlags -> SimplMode
-- | Name(s) of the phase
[sm_names] :: SimplMode -> [String]
[sm_phase] :: SimplMode -> CompilerPhase
-- | Unfolding options
[sm_uf_opts] :: SimplMode -> !UnfoldingOpts
-- | Whether RULES are enabled
[sm_rules] :: SimplMode -> !Bool
-- | Whether inlining is enabled
[sm_inline] :: SimplMode -> !Bool
-- | Whether case-of-case is enabled
[sm_case_case] :: SimplMode -> !Bool
-- | Whether eta-expansion is enabled
[sm_eta_expand] :: SimplMode -> !Bool
-- | Do we swizzle casts past lambdas?
[sm_cast_swizzle] :: SimplMode -> !Bool
-- | Whether pre-inlining is enabled
[sm_pre_inline] :: SimplMode -> !Bool
[sm_logger] :: SimplMode -> !Logger
[sm_dflags] :: SimplMode -> DynFlags
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
-- GHC.Core.Opt.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 CorePluginPass = 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
SimplifierDone :: Tick
-- | The monad used by Core-to-Core passes to register simplification
-- statistics. Also used to have common state (in the form of
-- UniqueSupply) for generating Uniques.
data CoreM a
runCoreM :: HscEnv -> RuleBase -> Char -> 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
getPackageFamInstEnv :: CoreM PackageFamInstEnv
getVisibleOrphanMods :: CoreM ModuleSet
getUniqMask :: CoreM Char
getPrintUnqualified :: CoreM PrintUnqualified
getSrcSpanM :: CoreM SrcSpan
addSimplCount :: SimplCount -> CoreM ()
-- | Lift a computation from the IO monad.
liftIO :: MonadIO m => IO a -> m a
-- | Lift an IO operation into CoreM while consuming its
-- SimplCount
liftIOWithCount :: IO (SimplCount, a) -> CoreM a
-- | 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 (ModuleEnv [a], NameEnv [a])
-- | Get at most one annotation of a given type per annotatable item.
getFirstAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (ModuleEnv a, NameEnv 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 ()
msg :: MessageClass -> 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 ()
instance GHC.Base.Functor GHC.Core.Opt.Monad.CoreM
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.Monad.CoreToDo
instance GHC.Base.Monad GHC.Core.Opt.Monad.CoreM
instance GHC.Base.Applicative GHC.Core.Opt.Monad.CoreM
instance GHC.Base.Alternative GHC.Core.Opt.Monad.CoreM
instance GHC.Base.MonadPlus GHC.Core.Opt.Monad.CoreM
instance GHC.Types.Unique.Supply.MonadUnique GHC.Core.Opt.Monad.CoreM
instance Control.Monad.IO.Class.MonadIO GHC.Core.Opt.Monad.CoreM
instance GHC.Driver.Session.HasDynFlags GHC.Core.Opt.Monad.CoreM
instance GHC.Utils.Logger.HasLogger GHC.Core.Opt.Monad.CoreM
instance GHC.Unit.Module.HasModule GHC.Core.Opt.Monad.CoreM
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.Monad.Tick
instance GHC.Classes.Eq GHC.Core.Opt.Monad.Tick
instance GHC.Classes.Ord GHC.Core.Opt.Monad.Tick
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.Monad.FloatOutSwitches
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.Monad.SimplMode
-- | Adds cost-centers to call sites selected with the
-- -fprof-caller=... flag.
module GHC.Core.Opt.CallerCC
addCallerCostCentres :: ModGuts -> CoreM ModGuts
data CallerCcFilter
CallerCcFilter :: Maybe ModuleName -> NamePattern -> CallerCcFilter
[ccfModuleName] :: CallerCcFilter -> Maybe ModuleName
[ccfFuncName] :: CallerCcFilter -> NamePattern
data NamePattern
PChar :: Char -> NamePattern -> NamePattern
PWildcard :: NamePattern -> NamePattern
PEnd :: NamePattern
parseCallerCcFilter :: String -> Either String CallerCcFilter
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.CallerCC.CallerCcFilter
instance GHC.Utils.Binary.Binary GHC.Core.Opt.CallerCC.CallerCcFilter
instance GHC.Utils.Outputable.Outputable GHC.Core.Opt.CallerCC.NamePattern
instance GHC.Utils.Binary.Binary GHC.Core.Opt.CallerCC.NamePattern
module GHC.Core.Lint
-- | Type-check a CoreProgram. See Note [Core Lint guarantee].
lintCoreBindings :: DynFlags -> CoreToDo -> [Var] -> CoreProgram -> WarnsAndErrs
lintUnfolding :: Bool -> DynFlags -> SrcLoc -> VarSet -> CoreExpr -> Maybe (Bag SDoc)
lintPassResult :: HscEnv -> CoreToDo -> CoreProgram -> IO ()
lintInteractiveExpr :: SDoc -> HscEnv -> CoreExpr -> IO ()
lintExpr :: DynFlags -> [Var] -> CoreExpr -> Maybe (Bag SDoc)
-- | 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
lintAxioms :: Logger -> DynFlags -> SDoc -> [CoAxiom Branched] -> IO ()
interactiveInScope :: InteractiveContext -> [Var]
endPass :: CoreToDo -> CoreProgram -> [CoreRule] -> CoreM ()
endPassIO :: HscEnv -> PrintUnqualified -> CoreToDo -> CoreProgram -> [CoreRule] -> IO ()
displayLintResults :: Logger -> Bool -> SDoc -> SDoc -> WarnsAndErrs -> IO ()
dumpPassResult :: Logger -> Bool -> PrintUnqualified -> Maybe DumpFlag -> String -> SDoc -> CoreProgram -> [CoreRule] -> IO ()
instance GHC.Classes.Eq GHC.Core.Lint.StaticPtrCheck
instance GHC.Base.Functor GHC.Core.Lint.LintM
instance GHC.Base.Applicative GHC.Core.Lint.LintM
instance GHC.Base.Monad GHC.Core.Lint.LintM
instance Control.Monad.Fail.MonadFail GHC.Core.Lint.LintM
instance GHC.Driver.Session.HasDynFlags GHC.Core.Lint.LintM
-- | Various types used during typechecking.
--
-- Please see GHC.Tc.Utils.Monad as well for operations on these
-- types. You probably want to import it, instead of this module.
--
-- All the monads exported here are built on top of the same IOEnv monad.
-- The monad functions like a Reader monad in the way it passes the
-- environment around. This is done to allow the environment to be
-- manipulated in a stack like fashion when entering expressions... etc.
--
-- For state that is global and should be returned at the end (e.g not
-- part of the stack mechanism), you should use a TcRef (= IORef) to
-- store them.
module GHC.Tc.Types
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 #-} !Char -> gbl -> lcl -> Env gbl lcl
[env_top] :: Env gbl lcl -> !HscEnv
[env_um] :: Env gbl lcl -> {-# UNPACK #-} !Char
[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 -> KnotVars (IORef TypeEnv) -> !InstEnv -> !FamInstEnv -> AnnEnv -> [AvailInfo] -> ImportAvails -> DefUses -> TcRef [GlobalRdrElt] -> TcRef NameSet -> TcRef Bool -> TcRef Bool -> TcRef ([Linkable], PkgsLoaded) -> TcRef OccSet -> [(Module, Fingerprint)] -> Maybe [(LIE GhcRn, Avails)] -> [LImportDecl GhcRn] -> Maybe (HsGroup GhcRn) -> TcRef [FilePath] -> TcRef [LHsDecl GhcPs] -> TcRef [(ForeignSrcLang, FilePath)] -> TcRef NameSet -> TcRef [(TcLclEnv, ThModFinalizers)] -> TcRef [String] -> TcRef (Map TypeRep Dynamic) -> TcRef (Maybe (ForeignRef (IORef QState))) -> TcRef THDocs -> Bag EvBind -> Maybe Id -> LHsBinds GhcTc -> NameSet -> [LTcSpecPrag] -> Warnings GhcRn -> [Annotation] -> [TyCon] -> NameSet -> [ClsInst] -> [FamInst] -> [LRuleDecl GhcTc] -> [LForeignDecl GhcTc] -> [PatSyn] -> Maybe (LHsDoc GhcRn) -> !AnyHpcUsage -> SelfBootInfo -> Maybe Name -> TcRef Bool -> TcRef (Messages TcRnMessage) -> [TcPluginSolver] -> UniqFM TyCon [TcPluginRewriter] -> [FillDefaulting] -> [HoleFitPlugin] -> RealSrcSpan -> TcRef WantedConstraints -> !CompleteMatches -> TcRef CostCentreState -> TcRef (ModuleEnv Int) -> 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
-- GHC.Runtime.Context
[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 GHC.Runtime.Context
[tcg_type_env] :: TcGblEnv -> TypeEnv
[tcg_type_env_var] :: TcGblEnv -> KnotVars (IORef TypeEnv)
-- | Instance envt for all home-package modules; Includes the dfuns
-- in tcg_insts NB. BangPattern is to fix a leak, see #15111
[tcg_inst_env] :: TcGblEnv -> !InstEnv
-- | Ditto for family instances NB. BangPattern is to fix a leak, see
-- #15111
[tcg_fam_inst_env] :: TcGblEnv -> !FamInstEnv
-- | And for annotations
[tcg_ann_env] :: TcGblEnv -> AnnEnv
-- | 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 transitive
-- trusted package requirements.
--
-- There are not many uses of this field, so you can grep for all them.
--
-- The ImportAvails records information about the following things:
--
--
-- - All of the modules you directly imported (tcRnImports)
-- - The orphans (only!) of all imported modules in a GHCi session
-- (runTcInteractive)
-- - The module that instantiated a signature
-- - Each of the signatures that merged in
--
--
-- It is used in the following ways: - imp_orphs is used to determine
-- what orphan modules should be visible in the context
-- (tcVisibleOrphanMods) - imp_finsts is used to determine what family
-- instances should be visible (tcExtendLocalFamInstEnv) - To resolve the
-- meaning of the export list of a module (tcRnExports) - imp_mods is
-- used to compute usage info (mkIfaceTc, deSugar) - imp_trust_own_pkg is
-- used for Safe Haskell in interfaces (mkIfaceTc, as well as in
-- GHC.Driver.Main) - To create the Dependencies field in
-- interface (mkDependencies)
[tcg_imports] :: TcGblEnv -> ImportAvails
[tcg_dus] :: TcGblEnv -> DefUses
[tcg_used_gres] :: TcGblEnv -> TcRef [GlobalRdrElt]
[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
-- | The set of runtime dependencies required by this module See Note
-- [Object File Dependencies]
[tcg_th_needed_deps] :: TcGblEnv -> TcRef ([Linkable], PkgsLoaded)
-- | 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 [(LIE GhcRn, Avails)]
[tcg_rn_imports] :: TcGblEnv -> [LImportDecl GhcRn]
-- | Renamed decls, maybe. Nothing <=> Don't retain renamed
-- decls.
[tcg_rn_decls] :: TcGblEnv -> Maybe (HsGroup GhcRn)
-- | dependencies from addDependentFile
[tcg_dependent_files] :: TcGblEnv -> TcRef [FilePath]
-- | Top-level declarations from addTopDecls
[tcg_th_topdecls] :: TcGblEnv -> TcRef [LHsDecl GhcPs]
-- | Foreign files emitted from TH.
[tcg_th_foreign_files] :: TcGblEnv -> TcRef [(ForeignSrcLang, FilePath)]
-- | Exact names bound in top-level declarations in tcg_th_topdecls
[tcg_th_topnames] :: TcGblEnv -> TcRef NameSet
-- | Template Haskell module finalizers.
--
-- They can use particular local environments.
[tcg_th_modfinalizers] :: TcGblEnv -> TcRef [(TcLclEnv, ThModFinalizers)]
-- | Core plugins added by Template Haskell code.
[tcg_th_coreplugins] :: TcGblEnv -> TcRef [String]
[tcg_th_state] :: TcGblEnv -> TcRef (Map TypeRep Dynamic)
-- | Template Haskell state
[tcg_th_remote_state] :: TcGblEnv -> TcRef (Maybe (ForeignRef (IORef QState)))
-- | Docs added in Template Haskell via putDoc.
[tcg_th_docs] :: TcGblEnv -> TcRef THDocs
[tcg_ev_binds] :: TcGblEnv -> Bag EvBind
[tcg_tr_module] :: TcGblEnv -> Maybe Id
[tcg_binds] :: TcGblEnv -> LHsBinds GhcTc
[tcg_sigs] :: TcGblEnv -> NameSet
[tcg_imp_specs] :: TcGblEnv -> [LTcSpecPrag]
[tcg_warns] :: TcGblEnv -> Warnings GhcRn
[tcg_anns] :: TcGblEnv -> [Annotation]
[tcg_tcs] :: TcGblEnv -> [TyCon]
[tcg_ksigs] :: TcGblEnv -> NameSet
[tcg_insts] :: TcGblEnv -> [ClsInst]
[tcg_fam_insts] :: TcGblEnv -> [FamInst]
[tcg_rules] :: TcGblEnv -> [LRuleDecl GhcTc]
[tcg_fords] :: TcGblEnv -> [LForeignDecl GhcTc]
[tcg_patsyns] :: TcGblEnv -> [PatSyn]
-- | Maybe Haddock header docs
[tcg_doc_hdr] :: TcGblEnv -> Maybe (LHsDoc GhcRn)
-- | True if any part of the prog uses hpc instrumentation. NB.
-- BangPattern is to fix a leak, see #15111
[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_safe_infer] :: TcGblEnv -> TcRef Bool
-- | Unreported reasons why tcg_safe_infer is False. INVARIANT: If this
-- Messages is non-empty, then tcg_safe_infer is False. It may be that
-- tcg_safe_infer is False but this is empty, if no reasons are supplied
-- (#19714), or if those reasons have already been reported by
-- GHC.Driver.Main.markUnsafeInfer
[tcg_safe_infer_reasons] :: TcGblEnv -> TcRef (Messages TcRnMessage)
-- | A list of user-defined type-checking plugins for constraint solving.
[tcg_tc_plugin_solvers] :: TcGblEnv -> [TcPluginSolver]
-- | A collection of all the user-defined type-checking plugins for
-- rewriting type family applications, collated by their type family
-- TyCons.
[tcg_tc_plugin_rewriters] :: TcGblEnv -> UniqFM TyCon [TcPluginRewriter]
-- | A list of user-defined plugins for type defaulting plugins.
[tcg_defaulting_plugins] :: TcGblEnv -> [FillDefaulting]
-- | A list of user-defined plugins for hole fit suggestions.
[tcg_hf_plugins] :: TcGblEnv -> [HoleFitPlugin]
-- | 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
-- | Tracking indices for cost centre annotations
[tcg_complete_matches] :: TcGblEnv -> !CompleteMatches
[tcg_cc_st] :: TcGblEnv -> TcRef CostCentreState
-- | See Note [Generating fresh names for FFI wrappers]
[tcg_next_wrapper_num] :: TcGblEnv -> TcRef (ModuleEnv Int)
data TcLclEnv
TcLclEnv :: RealSrcSpan -> [ErrCtxt] -> Bool -> TcLevel -> ThStage -> ThBindEnv -> ArrowCtxt -> LocalRdrEnv -> TcTypeEnv -> TcRef UsageEnv -> TcBinderStack -> TcRef WantedConstraints -> TcRef (Messages TcRnMessage) -> TcLclEnv
[tcl_loc] :: TcLclEnv -> RealSrcSpan
[tcl_ctxt] :: TcLclEnv -> [ErrCtxt]
[tcl_in_gen_code] :: TcLclEnv -> Bool
[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_usage] :: TcLclEnv -> TcRef UsageEnv
[tcl_bndrs] :: TcLclEnv -> TcBinderStack
[tcl_lie] :: TcLclEnv -> TcRef WantedConstraints
[tcl_errs] :: TcLclEnv -> TcRef (Messages TcRnMessage)
setLclEnvTcLevel :: TcLclEnv -> TcLevel -> TcLclEnv
getLclEnvTcLevel :: TcLclEnv -> TcLevel
setLclEnvLoc :: TcLclEnv -> RealSrcSpan -> TcLclEnv
getLclEnvLoc :: TcLclEnv -> RealSrcSpan
data IfGblEnv
IfGblEnv :: SDoc -> KnotVars (IfG TypeEnv) -> IfGblEnv
[if_doc] :: IfGblEnv -> SDoc
[if_rec_types] :: IfGblEnv -> KnotVars (IfG TypeEnv)
data IfLclEnv
IfLclEnv :: !Module -> IsBootInterface -> SDoc -> Maybe NameShape -> Maybe TypeEnv -> FastStringEnv TyVar -> FastStringEnv Id -> IfLclEnv
[if_mod] :: IfLclEnv -> !Module
[if_boot] :: IfLclEnv -> IsBootInterface
[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
-- | A RewriteEnv carries the necessary context for performing
-- rewrites (i.e. type family reductions and following filled-in
-- metavariables) in the solver.
data RewriteEnv
RE :: !CtLoc -> !CtFlavour -> !EqRel -> !TcRef RewriterSet -> RewriteEnv
-- | In which context are we rewriting?
--
-- Type-checking plugins might want to use this location information when
-- emitting new Wanted constraints when rewriting type family
-- applications. This ensures that such Wanted constraints will, when
-- unsolved, give rise to error messages with the correct source
-- location.
[re_loc] :: RewriteEnv -> !CtLoc
[re_flavour] :: RewriteEnv -> !CtFlavour
-- | At what role are we rewriting?
--
-- See Note [Rewriter EqRels] in GHC.Tc.Solver.Rewrite
[re_eq_rel] :: RewriteEnv -> !EqRel
-- | See Note [Wanteds rewrite Wanteds]
[re_rewriters] :: RewriteEnv -> !TcRef RewriterSet
-- | FrontendResult describes the result of running the frontend of
-- a Haskell module. Currently one always gets a
-- FrontendTypecheck, since running the frontend involves
-- typechecking a program. hs-sig merges are not handled here.
--
-- This data type really should be in GHC.Driver.Env, but it needs to
-- have a TcGblEnv which is only defined here.
data FrontendResult
FrontendTypecheck :: TcGblEnv -> FrontendResult
type ErrCtxt = (Bool, TidyEnv -> TcM (TidyEnv, SDoc))
type RecFieldEnv = NameEnv [FieldLabel]
pushErrCtxt :: CtOrigin -> ErrCtxt -> CtLoc -> CtLoc
pushErrCtxtSameOrigin :: ErrCtxt -> CtLoc -> CtLoc
-- | 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 -> InstalledModuleEnv ModuleNameWithIsBoot -> Set UnitId -> Bool -> Set UnitId -> InstalledModuleEnv ModuleNameWithIsBoot -> [ModuleName] -> [Module] -> [Module] -> ImportAvails
-- | Domain is all directly-imported modules
--
-- See the documentation on ImportedModsVal in
-- GHC.Unit.Module.Imported 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 directly imported by the module being compiled.
[imp_direct_dep_mods] :: ImportAvails -> InstalledModuleEnv ModuleNameWithIsBoot
-- | Packages directly needed by the module being compiled
[imp_dep_direct_pkgs] :: ImportAvails -> Set UnitId
-- | 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 [Trust Own Package]
-- in GHC.Rename.Names
[imp_trust_own_pkg] :: ImportAvails -> Bool
-- | This 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. See Note
-- [Tracking Trust Transitively] in GHC.Rename.Names
[imp_trust_pkgs] :: ImportAvails -> Set UnitId
-- | Domain is all modules which have hs-boot files, and whether we should
-- import the boot version of interface file. Only used in one-shot mode
-- to populate eps_is_boot.
[imp_boot_mods] :: ImportAvails -> InstalledModuleEnv ModuleNameWithIsBoot
-- | Signature modules below this one
[imp_sig_mods] :: ImportAvails -> [ModuleName]
-- | 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 :: Set (UnitId, ModuleNameWithIsBoot) -> InstalledModuleEnv ModuleNameWithIsBoot
type TcTypeEnv = NameEnv TcTyThing
type TcBinderStack = [TcBinder]
data TcBinder
TcIdBndr :: TcId -> TopLevelFlag -> TcBinder
TcIdBndr_ExpType :: Name -> ExpType -> TopLevelFlag -> TcBinder
TcTvBndr :: Name -> TyVar -> TcBinder
-- | A typecheckable thing available in a local context. Could be
-- AGlobal TyThing, but also lexically scoped variables,
-- etc. See GHC.Tc.Utils.Env 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
-- | Matches on either a global TyCon or a TcTyCon.
tcTyThingTyCon_maybe :: TcTyThing -> Maybe TyCon
data PromotionErr
TyConPE :: PromotionErr
ClassPE :: PromotionErr
FamDataConPE :: PromotionErr
ConstrainedDataConPE :: PredType -> PromotionErr
PatSynPE :: PromotionErr
RecDataConPE :: PromotionErr
NoDataKindsDC :: PromotionErr
-- | IdBindingInfo describes how an Id is bound.
--
-- It is used for the following purposes: a) for static forms in
-- checkClosedInStaticForm and b) to figure out when a nested
-- binding can be generalised, in 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
bootExports :: SelfBootInfo -> NameSet
tcTyThingCategory :: TcTyThing -> String
pprTcTyThingCategory :: TcTyThing -> SDoc
peCategory :: PromotionErr -> String
pprPECategory :: PromotionErr -> SDoc
-- | A list of conlikes which represents a complete pattern match. These
-- arise from COMPLETE signatures. See also Note [Implementation
-- of COMPLETE pragmas].
data CompleteMatch
type CompleteMatches = [CompleteMatch]
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 -> QuoteWrapper -> PendingStuff
topStage :: ThStage
topAnnStage :: ThStage
topSpliceStage :: ThStage
type ThLevel = Int
impLevel :: ThLevel
outerLevel :: ThLevel
thLevel :: ThStage -> ThLevel
-- | Foreign formats supported by GHC via TH
data ForeignSrcLang
-- | C
LangC :: ForeignSrcLang
-- | C++
LangCxx :: ForeignSrcLang
-- | Objective C
LangObjc :: ForeignSrcLang
-- | Objective C++
LangObjcxx :: ForeignSrcLang
-- | Assembly language (.s)
LangAsm :: ForeignSrcLang
-- | Object (.o)
RawObject :: ForeignSrcLang
-- | The current collection of docs that Template Haskell has built up via
-- putDoc.
type THDocs = Map DocLoc (HsDoc GhcRn)
-- | This is a mirror of Template Haskell's DocLoc, but the TH names are
-- resolved to GHC names.
data DocLoc
DeclDoc :: Name -> DocLoc
ArgDoc :: Name -> Int -> DocLoc
InstDoc :: Name -> DocLoc
ModuleDoc :: DocLoc
type ThBindEnv = NameEnv (TopLevelFlag, ThLevel)
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 GhcRn -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo
[psig_name] :: TcIdSigInfo -> Name
[psig_hs_ty] :: TcIdSigInfo -> LHsSigWcType GhcRn
[sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt
[sig_loc] :: TcIdSigInfo -> SrcSpan
data TcIdSigInst
TISI :: TcIdSigInfo -> [(Name, InvisTVBinder)] -> TcThetaType -> TcSigmaType -> [(Name, TcTyVar)] -> Maybe TcType -> TcIdSigInst
[sig_inst_sig] :: TcIdSigInst -> TcIdSigInfo
[sig_inst_skols] :: TcIdSigInst -> [(Name, InvisTVBinder)]
[sig_inst_theta] :: TcIdSigInst -> TcThetaType
[sig_inst_tau] :: TcIdSigInst -> TcSigmaType
[sig_inst_wcs] :: TcIdSigInst -> [(Name, TcTyVar)]
[sig_inst_wcx] :: TcIdSigInst -> Maybe TcType
data TcPatSynInfo
TPSI :: Name -> [InvisTVBinder] -> [InvisTVBinder] -> TcThetaType -> [InvisTVBinder] -> TcThetaType -> TcSigmaType -> TcPatSynInfo
[patsig_name] :: TcPatSynInfo -> Name
[patsig_implicit_bndrs] :: TcPatSynInfo -> [InvisTVBinder]
[patsig_univ_bndrs] :: TcPatSynInfo -> [InvisTVBinder]
[patsig_req] :: TcPatSynInfo -> TcThetaType
[patsig_ex_bndrs] :: TcPatSynInfo -> [InvisTVBinder]
[patsig_prov] :: TcPatSynInfo -> TcThetaType
[patsig_body_ty] :: TcPatSynInfo -> TcSigmaType
isPartialSig :: TcIdSigInst -> Bool
-- | No signature or a partial signature
hasCompleteSig :: TcSigFun -> Name -> Bool
type TcId = Id
type TcIdSet = IdSet
-- | A NameShape is a substitution on Names that can be used
-- to refine the identities of a hole while we are renaming interfaces
-- (see GHC.Iface.Rename). 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
removeBindingShadowing :: HasOccName a => [a] -> [a]
-- | Get target platform
getPlatform :: TcM Platform
data TcPlugin
TcPlugin :: TcPluginM s -> (s -> EvBindsVar -> TcPluginSolver) -> (s -> UniqFM TyCon TcPluginRewriter) -> (s -> TcPluginM ()) -> TcPlugin
-- | Initialize plugin, when entering type-checker.
[tcPluginInit] :: TcPlugin -> TcPluginM s
-- | Solve some constraints.
--
-- This function will be invoked at two points in the constraint solving
-- process: once to simplify Given constraints, and once to solve Wanted
-- constraints. In the first case (and only in the first case), no Wanted
-- constraints will be passed to the plugin.
--
-- The plugin can either return a contradiction, or specify that it has
-- solved some constraints (with evidence), and possibly emit additional
-- constraints. These returned constraints must be Givens in the first
-- case, and Wanteds in the second.
--
-- Use \ _ _ _ _ _ -> pure $ TcPluginOK [] [] if your
-- plugin does not provide this functionality.
[tcPluginSolve] :: TcPlugin -> s -> EvBindsVar -> TcPluginSolver
-- | Rewrite saturated type family applications.
--
-- The plugin is expected to supply a mapping from type family names to
-- rewriting functions. For each type family TyCon, the plugin
-- should provide a function which takes in the given constraints and
-- arguments of a saturated type family application, and return a
-- possible rewriting. See TcPluginRewriter for the expected shape
-- of such a function.
--
-- Use \ _ -> emptyUFM if your plugin does not provide this
-- functionality.
[tcPluginRewrite] :: TcPlugin -> s -> UniqFM TyCon TcPluginRewriter
-- | Clean up after the plugin, when exiting the type-checker.
[tcPluginStop] :: TcPlugin -> s -> TcPluginM ()
-- | Result of running a solver plugin.
data TcPluginSolveResult
TcPluginSolveResult :: [Ct] -> [(EvTerm, Ct)] -> [Ct] -> TcPluginSolveResult
-- | Insoluble constraints found by the plugin.
--
-- These constraints will be added to the inert set, and reported as
-- insoluble to the user.
[tcPluginInsolubleCts] :: TcPluginSolveResult -> [Ct]
-- | Solved constraints, together with their evidence.
--
-- These are removed from the inert set, and the evidence for them is
-- recorded.
[tcPluginSolvedCts] :: TcPluginSolveResult -> [(EvTerm, Ct)]
-- | New constraints that the plugin wishes to emit.
--
-- These will be added to the work list.
[tcPluginNewCts] :: TcPluginSolveResult -> [Ct]
-- | The plugin found a contradiction. The returned constraints are removed
-- from the inert set, and recorded as insoluble.
--
-- The returned list of constraints should never be empty.
pattern TcPluginContradiction :: [Ct] -> TcPluginSolveResult
-- | The plugin has not found any contradictions,
--
-- The first field is for constraints that were solved. The second field
-- contains new work, that should be processed by the constraint solver.
pattern TcPluginOk :: [(EvTerm, Ct)] -> [Ct] -> TcPluginSolveResult
data TcPluginRewriteResult
-- | The plugin does not rewrite the type family application.
TcPluginNoRewrite :: TcPluginRewriteResult
-- | The plugin rewrites the type family application providing a rewriting
-- together with evidence: a Reduction, which contains the
-- rewritten type together with a Coercion whose right-hand-side
-- type is the rewritten type.
--
-- The plugin can also emit additional Wanted constraints.
TcPluginRewriteTo :: !Reduction -> [Ct] -> TcPluginRewriteResult
[tcPluginReduction] :: TcPluginRewriteResult -> !Reduction
[tcRewriterNewWanteds] :: TcPluginRewriteResult -> [Ct]
-- | The solve function of a type-checking plugin takes in Given
-- and Wanted constraints, and should return a TcPluginSolveResult
-- indicating which Wanted constraints it could solve, or whether any are
-- insoluble.
type TcPluginSolver = [Ct] " Givens" -> [Ct] " Wanteds" -> TcPluginM TcPluginSolveResult
-- | For rewriting type family applications, a type-checking plugin
-- provides a function of this type for each type family TyCon.
--
-- The function is provided with the current set of Given constraints,
-- together with the arguments to the type family. The type family
-- application will always be fully saturated.
type TcPluginRewriter = RewriteEnv " Rewriter environment" -> [Ct] " Givens" -> [TcType] " type family arguments" -> TcPluginM TcPluginRewriteResult
-- | TcPluginM is the monad in which type-checking plugins operate.
data TcPluginM 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
-- | A plugin for controlling defaulting.
data DefaultingPlugin
DefaultingPlugin :: TcPluginM s -> (s -> FillDefaulting) -> (s -> TcPluginM ()) -> DefaultingPlugin
-- | Initialize plugin, when entering type-checker.
[dePluginInit] :: DefaultingPlugin -> TcPluginM s
-- | Default some types
[dePluginRun] :: DefaultingPlugin -> s -> FillDefaulting
-- | Clean up after the plugin, when exiting the type-checker.
[dePluginStop] :: DefaultingPlugin -> s -> TcPluginM ()
-- | A collection of candidate default types for a type variable.
data DefaultingProposal
DefaultingProposal :: TcTyVar -> [Type] -> [Ct] -> DefaultingProposal
-- | The type variable to default.
[deProposalTyVar] :: DefaultingProposal -> TcTyVar
-- | Candidate types to default the type variable to.
[deProposalCandidates] :: DefaultingProposal -> [Type]
-- | The constraints against which defaults are checked.
[deProposalCts] :: DefaultingProposal -> [Ct]
type FillDefaulting = WantedConstraints -> TcPluginM DefaultingPluginResult
type DefaultingPluginResult = [DefaultingProposal]
type RoleAnnotEnv = NameEnv (LRoleAnnotDecl GhcRn)
emptyRoleAnnotEnv :: RoleAnnotEnv
mkRoleAnnotEnv :: [LRoleAnnotDecl GhcRn] -> RoleAnnotEnv
lookupRoleAnnot :: RoleAnnotEnv -> Name -> Maybe (LRoleAnnotDecl GhcRn)
getRoleAnnots :: [Name] -> RoleAnnotEnv -> [LRoleAnnotDecl GhcRn]
-- | Check the TcGblEnv for consistency. Currently, only checks
-- axioms, but should check other aspects, too.
lintGblEnv :: Logger -> DynFlags -> TcGblEnv -> TcM ()
-- | An error which might arise during typechecking/renaming.
data TcRnMessage
instance GHC.Classes.Ord GHC.Tc.Types.DocLoc
instance GHC.Classes.Eq GHC.Tc.Types.DocLoc
instance Control.Monad.Fail.MonadFail GHC.Tc.Types.TcPluginM
instance GHC.Base.Monad GHC.Tc.Types.TcPluginM
instance GHC.Base.Applicative GHC.Tc.Types.TcPluginM
instance GHC.Base.Functor GHC.Tc.Types.TcPluginM
instance GHC.Unit.Module.ContainsModule GHC.Tc.Types.TcGblEnv
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.DefaultingProposal
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.TcSigInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.TcPatSynInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.TcIdSigInst
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.TcIdSigInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.WhereFrom
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.TcTyThing
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.IdBindingInfo
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.PromotionErr
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.ThStage
instance GHC.Utils.Outputable.Outputable GHC.Tc.Types.TcBinder
instance GHC.Types.Name.Occurrence.HasOccName GHC.Tc.Types.TcBinder
instance GHC.Driver.Session.ContainsDynFlags (GHC.Tc.Types.Env gbl lcl)
instance GHC.Driver.Hooks.ContainsHooks (GHC.Tc.Types.Env gbl lcl)
instance GHC.Utils.Logger.ContainsLogger (GHC.Tc.Types.Env gbl lcl)
instance GHC.Unit.Module.ContainsModule gbl => GHC.Unit.Module.ContainsModule (GHC.Tc.Types.Env gbl lcl)
module GHC.Tc.Errors.Hole.FitTypes
data TypedHole
TypedHole :: Bag CtEvidence -> [Implication] -> Maybe Hole -> TypedHole
-- | Any relevant Cts to the hole
[th_relevant_cts] :: TypedHole -> Bag CtEvidence
-- | The nested implications of the hole with the innermost implication
-- first.
[th_implics] :: TypedHole -> [Implication]
-- | The hole itself, if available.
[th_hole] :: TypedHole -> Maybe Hole
-- | HoleFit is the type we use for valid hole fits. It contains the
-- element that was checked, the Id of that element as found by
-- tcLookup, and the refinement level of the fit, which is the
-- number of extra argument holes that this fit uses (e.g. if hfRefLvl is
-- 2, the fit is for `Id _ _`).
data HoleFit
HoleFit :: Id -> HoleFitCandidate -> TcType -> Int -> [TcType] -> [TcType] -> Maybe [HsDocString] -> HoleFit
-- | The elements id in the TcM
[hfId] :: HoleFit -> Id
-- | The candidate that was checked.
[hfCand] :: HoleFit -> HoleFitCandidate
-- | The type of the id, possibly zonked.
[hfType] :: HoleFit -> TcType
-- | The number of holes in this fit.
[hfRefLvl] :: HoleFit -> Int
-- | The wrapper for the match.
[hfWrap] :: HoleFit -> [TcType]
-- | What the refinement variables got matched with, if anything
[hfMatches] :: HoleFit -> [TcType]
-- | Documentation of this HoleFit, if available.
[hfDoc] :: HoleFit -> Maybe [HsDocString]
-- | A fit that is just displayed as is. Here so thatHoleFitPlugins can
-- inject any fit they want.
RawHoleFit :: SDoc -> HoleFit
-- | HoleFitCandidates are passed to hole fit plugins and then checked
-- whether they fit a given typed-hole.
data HoleFitCandidate
IdHFCand :: Id -> HoleFitCandidate
NameHFCand :: Name -> HoleFitCandidate
GreHFCand :: GlobalRdrElt -> HoleFitCandidate
-- | A plugin for modifying the candidate hole fits *before* they're
-- checked.
type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate]
-- | A plugin for modifying hole fits *after* they've been found.
type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit]
-- | A HoleFitPlugin is a pair of candidate and fit plugins.
data HoleFitPlugin
HoleFitPlugin :: CandPlugin -> FitPlugin -> HoleFitPlugin
[candPlugin] :: HoleFitPlugin -> CandPlugin
[fitPlugin] :: HoleFitPlugin -> FitPlugin
-- | HoleFitPluginR adds a TcRef to hole fit plugins so that plugins can
-- track internal state. Note the existential quantification, ensuring
-- that the state cannot be modified from outside the plugin.
data HoleFitPluginR
HoleFitPluginR :: TcM (TcRef s) -> (TcRef s -> HoleFitPlugin) -> (TcRef s -> TcM ()) -> HoleFitPluginR
-- | Initializes the TcRef to be passed to the plugin
[hfPluginInit] :: HoleFitPluginR -> TcM (TcRef s)
-- | The function defining the plugin itself
[hfPluginRun] :: HoleFitPluginR -> TcRef s -> HoleFitPlugin
-- | Cleanup of state, guaranteed to be called even on error
[hfPluginStop] :: HoleFitPluginR -> TcRef s -> TcM ()
hfIsLcl :: HoleFit -> Bool
pprHoleFitCand :: HoleFitCandidate -> SDoc
instance GHC.Classes.Eq GHC.Tc.Errors.Hole.FitTypes.HoleFit
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Hole.FitTypes.HoleFit
instance GHC.Classes.Ord GHC.Tc.Errors.Hole.FitTypes.HoleFit
instance GHC.Classes.Eq GHC.Tc.Errors.Hole.FitTypes.HoleFitCandidate
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Hole.FitTypes.HoleFitCandidate
instance GHC.Types.Name.NamedThing GHC.Tc.Errors.Hole.FitTypes.HoleFitCandidate
instance GHC.Types.Name.Occurrence.HasOccName GHC.Tc.Errors.Hole.FitTypes.HoleFitCandidate
instance GHC.Classes.Ord GHC.Tc.Errors.Hole.FitTypes.HoleFitCandidate
instance GHC.Utils.Outputable.Outputable GHC.Tc.Errors.Hole.FitTypes.TypedHole
-- | Definitions for writing plugins for GHC. Plugins can hook into
-- several areas of the compiler. See the Plugin type. These
-- plugins include type-checker plugins, source plugins, and core-to-core
-- plugins.
module GHC.Driver.Plugins
data Plugins
Plugins :: ![StaticPlugin] -> ![LoadedPlugin] -> !([Linkable], PkgsLoaded) -> Plugins
-- | Static plugins which do not need dynamic loading. These plugins are
-- intended to be added by GHC API users directly to this list.
--
-- To add dynamically loaded plugins through the GHC API see
-- addPluginModuleName instead.
[staticPlugins] :: Plugins -> ![StaticPlugin]
-- | Plugins dynamically loaded after processing arguments. What will be
-- loaded here is directed by DynFlags.pluginModNames. Arguments are
-- loaded from DynFlags.pluginModNameOpts.
--
-- The purpose of this field is to cache the plugins so they don't have
-- to be loaded each time they are needed. See initializePlugins.
[loadedPlugins] :: Plugins -> ![LoadedPlugin]
-- | The object files required by the loaded plugins See Note [Plugin
-- dependencies]
[loadedPluginDeps] :: Plugins -> !([Linkable], PkgsLoaded)
emptyPlugins :: Plugins
-- | Plugin is the 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 :: CorePlugin -> TcPlugin -> DefaultingPlugin -> HoleFitPlugin -> ([CommandLineOption] -> HscEnv -> IO HscEnv) -> ([CommandLineOption] -> IO PluginRecompile) -> ([CommandLineOption] -> ModSummary -> HsParsedModule -> (Messages PsWarning, Messages PsError) -> Hsc (HsParsedModule, (Messages PsWarning, Messages PsError))) -> ([CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)) -> ([CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv) -> ([CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)) -> (forall lcl. [CommandLineOption] -> ModIface -> IfM lcl ModIface) -> 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 -> CorePlugin
-- | An optional typechecker plugin, which may modify the behaviour of the
-- constraint solver.
[tcPlugin] :: Plugin -> TcPlugin
-- | An optional defaulting plugin, which may specify the additional
-- type-defaulting rules.
[defaultingPlugin] :: Plugin -> DefaultingPlugin
-- | An optional plugin to handle hole fits, which may re-order or change
-- the list of valid hole fits and refinement hole fits.
[holeFitPlugin] :: Plugin -> HoleFitPlugin
-- | An optional plugin to update HscEnv, right after plugin
-- loading. This can be used to register hooks or tweak any field of
-- DynFlags before doing actual work on a module.
[driverPlugin] :: Plugin -> [CommandLineOption] -> HscEnv -> IO HscEnv
-- | Specify how the plugin should affect recompilation.
[pluginRecompile] :: Plugin -> [CommandLineOption] -> IO PluginRecompile
-- | Modify the module when it is parsed. This is called by
-- GHC.Driver.Main when the parser has produced no or only
-- non-fatal errors. Compilation will fail if the messages produced by
-- this function contain any errors.
[parsedResultAction] :: Plugin -> [CommandLineOption] -> ModSummary -> HsParsedModule -> (Messages PsWarning, Messages PsError) -> Hsc (HsParsedModule, (Messages PsWarning, Messages PsError))
-- | Modify each group after it is renamed. This is called after each
-- HsGroup has been renamed.
[renamedResultAction] :: Plugin -> [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)
-- | Modify the module when it is type checked. This is called at the very
-- end of typechecking.
[typeCheckResultAction] :: Plugin -> [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv
-- | Modify the TH splice or quasiqoute before it is run.
[spliceRunAction] :: Plugin -> [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)
-- | Modify an interface that have been loaded. This is called by
-- GHC.Iface.Load when an interface is successfully loaded. Not
-- applied to the loading of the plugin interface. Tools that rely on
-- information from modules other than the currently compiled one should
-- implement this function.
[interfaceLoadAction] :: Plugin -> forall lcl. [CommandLineOption] -> ModIface -> IfM lcl ModIface
-- | Default plugin: does nothing at all, except for marking that safe
-- inference has failed unless -fplugin-trustworthy is passed.
-- For compatibility reason you should base all your plugin definitions
-- on this default value.
defaultPlugin :: Plugin
-- | Command line options gathered from the -PModule.Name:stuff syntax are
-- given to you as this type
type CommandLineOption = String
purePlugin :: [CommandLineOption] -> IO PluginRecompile
impurePlugin :: [CommandLineOption] -> IO PluginRecompile
flagRecompile :: [CommandLineOption] -> IO PluginRecompile
data PluginRecompile
ForceRecompile :: PluginRecompile
NoForceRecompile :: PluginRecompile
MaybeRecompile :: Fingerprint -> PluginRecompile
data FrontendPlugin
FrontendPlugin :: FrontendPluginAction -> FrontendPlugin
[frontend] :: FrontendPlugin -> FrontendPluginAction
defaultFrontendPlugin :: FrontendPlugin
type FrontendPluginAction = [String] -> [(String, Maybe Phase)] -> Ghc ()
type CorePlugin = [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
type TcPlugin = [CommandLineOption] -> Maybe TcPlugin
-- | A renamer plugin which mades the renamed source available in a
-- typechecker plugin.
keepRenamedSource :: [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)
type DefaultingPlugin = [CommandLineOption] -> Maybe DefaultingPlugin
-- | HoleFitPluginR adds a TcRef to hole fit plugins so that plugins can
-- track internal state. Note the existential quantification, ensuring
-- that the state cannot be modified from outside the plugin.
data HoleFitPluginR
data PluginWithArgs
PluginWithArgs :: Plugin -> [CommandLineOption] -> PluginWithArgs
-- | the actual callable plugin
[paPlugin] :: PluginWithArgs -> Plugin
-- | command line arguments for the plugin
[paArguments] :: PluginWithArgs -> [CommandLineOption]
pluginsWithArgs :: Plugins -> [PluginWithArgs]
pluginRecompile' :: PluginWithArgs -> IO PluginRecompile
-- | A plugin with its arguments. The result of loading the plugin.
data LoadedPlugin
LoadedPlugin :: PluginWithArgs -> ModIface -> LoadedPlugin
-- | the actual plugin together with its commandline arguments
[lpPlugin] :: LoadedPlugin -> PluginWithArgs
-- | the module containing the plugin
[lpModule] :: LoadedPlugin -> ModIface
lpModuleName :: LoadedPlugin -> ModuleName
-- | A static plugin with its arguments. For registering compiled-in
-- plugins through the GHC API.
data StaticPlugin
StaticPlugin :: PluginWithArgs -> StaticPlugin
-- | the actual plugin together with its commandline arguments
[spPlugin] :: StaticPlugin -> PluginWithArgs
mapPlugins :: Plugins -> (Plugin -> [CommandLineOption] -> a) -> [a]
-- | Perform an operation by using all of the plugins in turn.
withPlugins :: Monad m => Plugins -> PluginOperation m a -> a -> m a
-- | Perform a constant operation by using all of the plugins in turn.
withPlugins_ :: Monad m => Plugins -> ConstPluginOperation m a -> a -> m ()
instance GHC.Utils.Outputable.Outputable GHC.Driver.Plugins.PluginRecompile
instance GHC.Base.Semigroup GHC.Driver.Plugins.PluginRecompile
instance GHC.Base.Monoid GHC.Driver.Plugins.PluginRecompile
module GHC.Driver.Pipeline.Phases
data TPhase res
[T_Unlit] :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_FileArgs] :: HscEnv -> FilePath -> TPhase (DynFlags, [Warn])
[T_Cpp] :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_HsPp] :: PipeEnv -> HscEnv -> FilePath -> FilePath -> TPhase FilePath
[T_HscRecomp] :: PipeEnv -> HscEnv -> FilePath -> HscSource -> TPhase (HscEnv, ModSummary, HscRecompStatus)
[T_Hsc] :: HscEnv -> ModSummary -> TPhase (FrontendResult, Messages GhcMessage)
[T_HscPostTc] :: HscEnv -> ModSummary -> FrontendResult -> Messages GhcMessage -> Maybe Fingerprint -> TPhase HscBackendAction
[T_HscBackend] :: PipeEnv -> HscEnv -> ModuleName -> HscSource -> ModLocation -> HscBackendAction -> TPhase ([FilePath], ModIface, Maybe Linkable, FilePath)
[T_CmmCpp] :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_Cmm] :: PipeEnv -> HscEnv -> FilePath -> TPhase ([FilePath], FilePath)
[T_Cc] :: Phase -> PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_As] :: Bool -> PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> TPhase FilePath
[T_LlvmOpt] :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_LlvmLlc] :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_LlvmMangle] :: PipeEnv -> HscEnv -> FilePath -> TPhase FilePath
[T_MergeForeign] :: PipeEnv -> HscEnv -> FilePath -> [FilePath] -> TPhase FilePath
-- | A wrapper around the interpretation function for phases.
data PhaseHook
PhaseHook :: (forall a. TPhase a -> IO a) -> PhaseHook
module GHC.Driver.Hooks
data Hooks
class HasHooks m
getHooks :: HasHooks m => m Hooks
class ContainsHooks a
extractHooks :: ContainsHooks a => a -> 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
type family DsForeignsHook :: Type
-- | Actual type: Maybe ([LForeignDecl GhcTc] -> DsM (ForeignStubs,
-- OrdList (Id, CoreExpr)))
dsForeignsHook :: Hooks -> Maybe DsForeignsHook
tcForeignImportsHook :: Hooks -> Maybe ([LForeignDecl GhcRn] -> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt))
tcForeignExportsHook :: Hooks -> Maybe ([LForeignDecl GhcRn] -> TcM (LHsBinds GhcTc, [LForeignDecl GhcTc], Bag GlobalRdrElt))
hscFrontendHook :: Hooks -> Maybe (ModSummary -> Hsc FrontendResult)
hscCompileCoreExprHook :: Hooks -> Maybe (HscEnv -> SrcSpan -> CoreExpr -> IO (ForeignHValue, [Linkable], PkgsLoaded))
ghcPrimIfaceHook :: Hooks -> Maybe ModIface
runPhaseHook :: Hooks -> Maybe PhaseHook
runMetaHook :: Hooks -> Maybe (MetaHook TcM)
linkHook :: Hooks -> Maybe (GhcLink -> DynFlags -> Bool -> HomePackageTable -> IO SuccessFlag)
runRnSpliceHook :: Hooks -> Maybe (HsSplice GhcRn -> RnM (HsSplice GhcRn))
getValueSafelyHook :: Hooks -> Maybe (HscEnv -> Name -> Type -> IO (Either Type (HValue, [Linkable], PkgsLoaded)))
createIservProcessHook :: Hooks -> Maybe (CreateProcess -> IO ProcessHandle)
stgToCmmHook :: Hooks -> Maybe (StgToCmmConfig -> InfoTableProvMap -> [TyCon] -> CollectedCCs -> [CgStgTopBinding] -> HpcInfo -> Stream IO CmmGroup ModuleLFInfos)
cmmToRawCmmHook :: Hooks -> forall a. Maybe (DynFlags -> Maybe Module -> Stream IO CmmGroupSRTs a -> IO (Stream IO RawCmmGroup a))
-- | Subsystem configuration
module GHC.Driver.Config
-- | Initialise coercion optimiser configuration from DynFlags
initOptCoercionOpts :: DynFlags -> OptCoercionOpts
-- | Initialise Simple optimiser configuration from DynFlags
initSimpleOpts :: DynFlags -> SimpleOpts
-- | Extract BCO options from DynFlags
initBCOOpts :: DynFlags -> IO BCOOpts
-- | Extract GHCi options from DynFlags and step
initEvalOpts :: DynFlags -> Bool -> EvalOpts