-- 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 9.2.1.20220109 -- | 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/includes/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/includes/rts/storage/TSO.h -- for more details on this data structure. data 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/includes/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/includes/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/includes/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/includes/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 BlockedOnIOCompletion :: 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/includes/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 BlockedOnIOCompletion :: 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/includes/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/includes/rts/storage/TSO.h -- for more details on this data structure. data 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/includes/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/includes/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/includes/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 RecordPuns :: 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 ArchSPARC :: Arch ArchSPARC64 :: 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.Eq GHC.Platform.ArchOS.ArmISA instance GHC.Show.Show GHC.Platform.ArchOS.ArmISA instance GHC.Read.Read GHC.Platform.ArchOS.ArmISA 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.Eq GHC.Platform.ArchOS.ArmABI instance GHC.Show.Show GHC.Platform.ArchOS.ArmABI instance GHC.Read.Read GHC.Platform.ArchOS.ArmABI 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.Eq GHC.Platform.ArchOS.Arch instance GHC.Show.Show GHC.Platform.ArchOS.Arch instance GHC.Read.Read GHC.Platform.ArchOS.Arch 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.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 -> 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 parseConstantsHeader :: FilePath -> IO 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]
enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: -- Int]
enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
enumFromTo 42 1 :: [Integer] = []
enumFromThenTo 4 2 -6 :: [Integer] = -- [4,2,0,-2,-4,-6]
enumFromThenTo 6 8 2 :: [Int] = []
-- (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: -- --
-- 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: -- --
-- 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: -- --
-- 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: -- --
-- 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, -- --
-- 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 -- --
-- (<*>) = liftA2 id ---- --
-- liftA2 f x y = f <$> x <*> y ---- -- Further, any definition must satisfy the following: -- --
pure id <*> v = -- v
pure (.) <*> u -- <*> v <*> w = u <*> (v -- <*> w)
pure f <*> -- pure x = pure (f x)
u <*> pure y = -- pure ($ y) <*> u
-- 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: -- --
-- 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: -- --
-- >>> "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"). -- --
-- >>> 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. -- --
-- >>> 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: -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
clearBit zeroBits n == -- zeroBits
setBit zeroBits n == bit -- n
testBit zeroBits n == False
popCount zeroBits == 0
-- 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 -- | 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 -- --
-- (<*>) = liftA2 id ---- --
-- liftA2 f x y = f <$> x <*> y ---- -- Further, any definition must satisfy the following: -- --
pure id <*> v = -- v
pure (.) <*> u -- <*> v <*> w = u <*> (v -- <*> w)
pure f <*> -- pure x = pure (f x)
u <*> pure y = -- pure ($ y) <*> u
-- 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. -- --
-- >>> 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: -- --
-- 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]) 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 -- | 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 only :: [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) isIn :: Eq a => String -> a -> [a] -> Bool isn'tIn :: Eq a => String -> a -> [a] -> Bool -- | Split a list into chunks of n elements chunkList :: Int -> [a] -> [[a]] -- | Replace the last element of a list with another element. changeLast :: [a] -> a -> [a] -- | 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 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] 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] looksLikeModuleName :: String -> Bool looksLikePackageName :: String -> Bool getCmd :: String -> Either String (String, String) toCmdArgs :: String -> Either String (String, [String]) toArgs :: String -> Either String [String] -- | 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) 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) data OverridingBool Auto :: OverridingBool Always :: OverridingBool Never :: OverridingBool overrideWith :: Bool -> OverridingBool -> Bool instance GHC.Show.Show GHC.Utils.Misc.OverridingBool 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.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 :: [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) -- | 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 -> !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 includesrtsstorage/InfoTables.h. [platformTablesNextToCode] :: 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 ArchSPARC :: Arch ArchSPARC64 :: 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 -> Bool -> Bool -> String -> PlatformMisc [platformMisc_targetPlatformString] :: PlatformMisc -> String [platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool [platformMisc_ghcWithSMP] :: PlatformMisc -> Bool [platformMisc_ghcRTSWays] :: PlatformMisc -> String [platformMisc_libFFI] :: PlatformMisc -> Bool [platformMisc_ghcRtsWithLibdw] :: 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 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 -> 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 -- | 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.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 -> 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_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 -> String -> FilePath -> FileSettings [fileSettings_ghcUsagePath] :: FileSettings -> FilePath [fileSettings_ghciUsagePath] :: FileSettings -> FilePath [fileSettings_toolDir] :: FileSettings -> Maybe FilePath [fileSettings_topDir] :: FileSettings -> FilePath [fileSettings_tmpDir] :: FileSettings -> String [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 -> !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 includesrtsstorage/InfoTables.h. [platformTablesNextToCode] :: 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 -> Bool -> Bool -> String -> PlatformMisc [platformMisc_targetPlatformString] :: PlatformMisc -> String [platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool [platformMisc_ghcWithSMP] :: PlatformMisc -> Bool [platformMisc_ghcRTSWays] :: PlatformMisc -> String [platformMisc_libFFI] :: PlatformMisc -> Bool [platformMisc_ghcRtsWithLibdw] :: 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 sTmpDir :: Settings -> String 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_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 sGhcWithSMP :: Settings -> Bool sGhcRTSWays :: Settings -> String sLibFFI :: Settings -> Bool sGhcRtsWithLibdw :: Settings -> Bool -- | 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 -- | There are two principal string types used internally by GHC: -- --
-- text "hi" $$ nest 5 (text "there") ---- -- lays out as -- --
-- hi there ---- -- rather than -- --
-- hi -- there ---- -- $$ is associative, with identity empty, and also -- satisfies -- -- ($$) :: 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: -- --
nest 0 x = x
nest k (nest k' x) = nest (k+k') -- x
nest k (x <> y) = nest k z -- <> nest k y
nest k (x $$ y) = nest k x $$ -- nest k y
nest k empty = empty
-- 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 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 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 showSDocUnsafe :: SDoc -> String showPprUnsafe :: Outputable a => a -> String showSDocOneLine :: SDocContext -> SDoc -> String renderWithContext :: SDocContext -> SDoc -> String pprInfixVar :: Bool -> SDoc -> SDoc pprPrefixVar :: Bool -> SDoc -> SDoc -- | Special combinator for showing character literals. pprHsChar :: Char -> SDoc -- | Special combinator for showing string literals. pprHsString :: FastString -> SDoc -- | Special combinator for showing bytestring literals. pprHsBytes :: ByteString -> SDoc primFloatSuffix :: SDoc primCharSuffix :: SDoc 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 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 -- | The name of this GHC. progName :: String -- | 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 => String -> Int -> SDoc -> a -- | Panics and asserts. sorry :: String -> 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
-- | 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
-- | 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 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 :: Maybe FilePath -> String -> String -- | Returns a Unix-format path pointing to TopDir. findTopDir :: Maybe String -> IO String findToolDir :: 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 -- | 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. -- -- 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.
--
-- `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
plusMaybeUFM_C :: (elt -> elt -> Maybe elt) -> UniqFM key elt -> UniqFM key elt -> UniqFM key elt
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
plusUFMList :: [UniqFM key elt] -> UniqFM key elt
minusUFM :: 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
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]
eltsUFM :: 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
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)
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.Base.Semigroup (GHC.Types.Unique.DFM.UniqDFM key a)
instance GHC.Base.Monoid (GHC.Types.Unique.DFM.UniqDFM key a)
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)
-- | 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 GHC.Base.Monoid (GHC.Types.Unique.DSet.UniqDSet a)
instance GHC.Base.Semigroup (GHC.Types.Unique.DSet.UniqDSet a)
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
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:
--
--
-- 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 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 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.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 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 -- | 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 newtype CStub CStub :: SDoc -> CStub [getCStub] :: CStub -> SDoc appendStubC :: ForeignStubs -> CStub -> ForeignStubs instance GHC.Base.Semigroup GHC.Types.ForeignStubs.CHeader instance GHC.Base.Monoid GHC.Types.ForeignStubs.CHeader instance GHC.Base.Monoid GHC.Types.ForeignStubs.CStub instance GHC.Base.Semigroup GHC.Types.ForeignStubs.CStub -- | 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 -- | Allows caller to specify the PrintUnqualified to use showSDocForUser :: DynFlags -> UnitState -> PrintUnqualified -> SDoc -> String showSDocDebug :: DynFlags -> SDoc -> String showSDocDump :: SDocContext -> SDoc -> String showPpr :: Outputable a => DynFlags -> a -> String pprDebugAndThen :: SDocContext -> (String -> a) -> SDoc -> SDoc -> a printForUser :: DynFlags -> Handle -> PrintUnqualified -> Depth -> SDoc -> IO () -- | Like printSDocLn but specialized with LeftMode and -- PprCode CStyle. This is typically used to -- output C-- code. printForC :: DynFlags -> Handle -> SDoc -> IO () -- | Just warn about an assertion failure, recording the given file and -- line number. Should typically be accessed with the WARN macros warnPprTrace :: HasCallStack => Bool -> String -> Int -> SDoc -> a -> a -- | If debug output is on, show some SDoc on the screen pprTrace :: String -> SDoc -> a -> a -- | If debug output is on, show some SDoc on the screen pprTraceWithFlags :: DynFlags -> 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 -- | 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 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_asm_expanded :: 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_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 -- | Final STG (after stg2stg) 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_vt_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 -- | Enumerates the simple on-or-off dynamic flags data GeneralFlag -- | Append dump output to files instead of stdout. Opt_DumpToFile :: GeneralFlag Opt_D_faststring_stats :: GeneralFlag Opt_D_dump_minimal_imports :: GeneralFlag Opt_DoCoreLinting :: GeneralFlag Opt_DoLinearCoreLinting :: GeneralFlag Opt_DoStgLinting :: GeneralFlag Opt_DoCmmLinting :: GeneralFlag Opt_DoAsmLinting :: GeneralFlag Opt_DoAnnotationLinting :: 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_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 Opt_SolveConstantDicts :: GeneralFlag Opt_AlignmentSanitisation :: GeneralFlag Opt_CatchBottoms :: GeneralFlag Opt_NumConstantFolding :: 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_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_RPath :: GeneralFlag Opt_RelativeDynlibPaths :: 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 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 -- | Used when outputting warnings: if a reason is given, it is displayed. -- If a warning isn't controlled by a flag, this is made explicit at the -- point of use. data WarnReason NoReason :: WarnReason -- | Warning was enabled with the flag Reason :: !WarningFlag -> WarnReason -- | Warning was made an error because of -Werror or -Werror=WarningFlag ErrReason :: !Maybe WarningFlag -> WarnReason data Language Haskell98 :: Language Haskell2010 :: Language GHC2021 :: Language optimisationFlags :: EnumSet GeneralFlag 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.Show.Show GHC.Driver.Flags.WarnReason 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.Utils.Outputable.Outputable GHC.Driver.Flags.Language instance GHC.Utils.Outputable.Outputable GHC.Driver.Flags.WarnReason instance GHC.Utils.Json.ToJson GHC.Driver.Flags.WarnReason -- | 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 ways is enabled hasWay :: Ways -> Way -> Bool -- | Add a way addWay :: 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.Show.Show GHC.Platform.Ways.Way instance GHC.Classes.Ord GHC.Platform.Ways.Way instance GHC.Classes.Eq GHC.Platform.Ways.Way -- | 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 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 removeDups :: (a -> a -> Ordering) -> [a] -> ([a], [NonEmpty a]) findDupsEq :: (a -> a -> Bool) -> [a] -> [NonEmpty a] equivClasses :: (a -> a -> Ordering) -> [a] -> [NonEmpty a] getNth :: Outputable a => [a] -> Int -> a 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. -- --
-- 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 :: ErrorMessages -> SourceError mkSrcErr :: ErrorMessages -> SourceError srcErrorMessages :: SourceError -> ErrorMessages throwErrors :: MonadIO io => ErrorMessages -> io a throwOneError :: MonadIO io => MsgEnvelope DecoratedSDoc -> 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.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 -- | GHC uses several kinds of name internally: -- --
-- \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: -- --
-- \x. f ~ \y. y ---- -- matching with [f -> y]. So for each expression we -- want to know that set of locally-bound variables. That is precisely -- the domain of the mappings 1. and 2., but we must ensure that we -- always extend the mappings as we go in. -- -- All of this information is bundled up in the RnEnv2 data RnEnv2 mkRnEnv2 :: InScopeSet -> RnEnv2 -- | rnBndr2 env bL bR goes under a binder bL in the Left -- term, and binder bR in the Right term. It finds a new binder, -- new_b, and returns an environment mapping bL -> -- new_b and bR -> new_b rnBndr2 :: RnEnv2 -> Var -> Var -> RnEnv2 -- | Applies rnBndr2 to several variables: the two variable lists -- must be of equal length rnBndrs2 :: RnEnv2 -> [Var] -> [Var] -> RnEnv2 -- | Similar to rnBndr2 but returns the new variable as well as the -- new environment rnBndr2_var :: RnEnv2 -> Var -> Var -> (RnEnv2, Var) -- | Look up the renaming of an occurrence in the left or right term rnOccL :: RnEnv2 -> Var -> Var -- | Look up the renaming of an occurrence in the left or right term rnOccR :: RnEnv2 -> Var -> Var -- | Tells whether a variable is locally bound inRnEnvL :: RnEnv2 -> Var -> Bool -- | Tells whether a variable is locally bound inRnEnvR :: RnEnv2 -> Var -> Bool -- | Look up the renaming of an occurrence in the left or right term rnOccL_maybe :: RnEnv2 -> Var -> Maybe Var -- | Look up the renaming of an occurrence in the left or right term rnOccR_maybe :: RnEnv2 -> Var -> Maybe Var -- | Similar to rnBndr2 but used when there's a binder on the left -- side only. rnBndrL :: RnEnv2 -> Var -> (RnEnv2, Var) -- | Similar to rnBndr2 but used when there's a binder on the right -- side only. rnBndrR :: RnEnv2 -> Var -> (RnEnv2, Var) -- | Wipe the left or right side renaming nukeRnEnvL :: RnEnv2 -> RnEnv2 -- | Wipe the left or right side renaming nukeRnEnvR :: RnEnv2 -> RnEnv2 -- | swap the meaning of left and right rnSwap :: RnEnv2 -> RnEnv2 delBndrL :: RnEnv2 -> Var -> RnEnv2 delBndrR :: RnEnv2 -> Var -> RnEnv2 delBndrsL :: RnEnv2 -> [Var] -> RnEnv2 delBndrsR :: RnEnv2 -> [Var] -> RnEnv2 addRnInScopeSet :: RnEnv2 -> VarSet -> RnEnv2 -- | Similar to rnBndrL but used for eta expansion See Note [Eta -- expansion] rnEtaL :: RnEnv2 -> Var -> (RnEnv2, Var) -- | Similar to rnBndr2 but used for eta expansion See Note [Eta -- expansion] rnEtaR :: RnEnv2 -> Var -> (RnEnv2, Var) rnInScope :: Var -> RnEnv2 -> Bool rnInScopeSet :: RnEnv2 -> InScopeSet lookupRnInScope :: RnEnv2 -> Var -> Var -- | Retrieve the left mapping rnEnvL :: RnEnv2 -> VarEnv Var -- | Retrieve the right mapping rnEnvR :: RnEnv2 -> VarEnv Var -- | Tidy Environment -- -- When tidying up print names, we keep a mapping of in-scope occ-names -- (the TidyOccEnv) and a Var-to-Var of the current renamings type TidyEnv = (TidyOccEnv, VarEnv Var) emptyTidyEnv :: TidyEnv mkEmptyTidyEnv :: TidyOccEnv -> TidyEnv delTidyEnvList :: TidyEnv -> [Var] -> TidyEnv instance GHC.Utils.Outputable.Outputable GHC.Types.Var.Env.InScopeSet 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 nameEnvElts :: NameEnv a -> [a] extendNameEnv_C :: (a -> a -> a) -> NameEnv a -> Name -> a -> NameEnv a extendNameEnv_Acc :: (a -> b -> b) -> (a -> b) -> NameEnv b -> Name -> a -> NameEnv b extendNameEnv :: NameEnv a -> Name -> a -> NameEnv a extendNameEnvList :: NameEnv a -> [(Name, a)] -> NameEnv a extendNameEnvList_C :: (a -> a -> a) -> NameEnv a -> [(Name, a)] -> NameEnv a filterNameEnv :: (elt -> Bool) -> NameEnv elt -> NameEnv elt anyNameEnv :: (elt -> Bool) -> NameEnv elt -> Bool plusNameEnv :: NameEnv a -> NameEnv a -> NameEnv a plusNameEnv_C :: (a -> a -> a) -> NameEnv a -> NameEnv a -> NameEnv a 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 -- | 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 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 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: -- --
-- 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: -- --
-- `bar` -- ( ~ ) ---- --
-- 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 -- | 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: -- --
-- [| 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 -- | 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 (), (##), [] 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 -- | Trailing -> AddRarrowAnn :: EpaLocation -> TrailingAnn -- | Trailing ->, unicode variant AddRarrowAnnU :: EpaLocation -> TrailingAnn -- | Trailing ⊸ AddLollyAnnU :: EpaLocation -> TrailingAnn -- | 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.Ord 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.Ord 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.Ord GHC.Parser.Annotation.EpaLocation instance GHC.Classes.Eq GHC.Parser.Annotation.EpaLocation instance Data.Data.Data GHC.Parser.Annotation.EpaLocation 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.Ord GHC.Parser.Annotation.TrailingAnn 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.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 GHC.Parser.Annotation.AddEpAnn instance GHC.Classes.Ord 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 GHC.Hs.Doc -- | Haskell Documentation String -- -- Internally this is a UTF8-Encoded ByteString. data HsDocString -- | Located Haskell Documentation String type LHsDocString = Located HsDocString mkHsDocString :: String -> HsDocString -- | Create a HsDocString from a UTF8-encoded ByteString. mkHsDocStringUtf8ByteString :: ByteString -> HsDocString isEmptyDocString :: HsDocString -> Bool unpackHDS :: HsDocString -> String -- | Return the contents of a HsDocString as a UTF8-encoded -- ByteString. hsDocStringToByteString :: HsDocString -> ByteString ppr_mbDoc :: Maybe LHsDocString -> SDoc -- | Join two docstrings. -- -- Non-empty docstrings are joined with two newlines in between, -- resulting in separate paragraphs. appendDocs :: HsDocString -> HsDocString -> HsDocString -- | Concat docstrings with two newlines in between. -- -- Empty docstrings are skipped. -- -- If all inputs are empty, Nothing is returned. concatDocs :: [HsDocString] -> Maybe HsDocString -- | Docs for declarations: functions, data types, instances, methods etc. newtype DeclDocMap DeclDocMap :: Map Name HsDocString -> DeclDocMap emptyDeclDocMap :: DeclDocMap -- | Docs for arguments. E.g. function arguments, method arguments. newtype ArgDocMap ArgDocMap :: Map Name (IntMap HsDocString) -> ArgDocMap emptyArgDocMap :: ArgDocMap -- | Maps of docs that were added via Template Haskell's putDoc. data ExtractedTHDocs ExtractedTHDocs :: Maybe HsDocString -> DeclDocMap -> ArgDocMap -> DeclDocMap -> ExtractedTHDocs -- | The added module header documentation, if it exists. [ethd_mod_header] :: ExtractedTHDocs -> Maybe HsDocString -- | The documentation added to declarations. [ethd_decl_docs] :: ExtractedTHDocs -> DeclDocMap -- | The documentation added to function arguments. [ethd_arg_docs] :: ExtractedTHDocs -> ArgDocMap -- | The documentation added to class and family instances. [ethd_inst_docs] :: ExtractedTHDocs -> DeclDocMap instance Data.Data.Data GHC.Hs.Doc.HsDocString instance GHC.Show.Show GHC.Hs.Doc.HsDocString instance GHC.Classes.Eq GHC.Hs.Doc.HsDocString instance GHC.Utils.Binary.Binary GHC.Hs.Doc.ArgDocMap instance GHC.Utils.Outputable.Outputable GHC.Hs.Doc.ArgDocMap instance GHC.Utils.Binary.Binary GHC.Hs.Doc.DeclDocMap instance GHC.Utils.Outputable.Outputable GHC.Hs.Doc.DeclDocMap instance GHC.Utils.Binary.Binary GHC.Hs.Doc.HsDocString instance GHC.Utils.Outputable.Outputable GHC.Hs.Doc.HsDocString -- | 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 regPair :: RegNo -> RegNo -> 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. -- -- RealRegPairs are pairs of real registers that are allocated together -- to hold a larger value, such as with Double regs on SPARC. data RealReg RealRegSingle :: {-# UNPACK #-} !RegNo -> RealReg RealRegPair :: {-# UNPACK #-} !RegNo -> {-# UNPACK #-} !RegNo -> RealReg regNosOfRealReg :: RealReg -> [RegNo] realRegsAlias :: RealReg -> RealReg -> Bool -- | The patch function supplied by the allocator maps VirtualReg to -- RealReg regs, but sometimes we want to apply it to plain old Reg. liftPatchFnToRegReg :: (VirtualReg -> RealReg) -> Reg -> Reg instance GHC.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_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_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 cONTROL_APPLICATIVE :: Module gHC_DESUGAR :: Module rANDOM :: Module gHC_EXTS :: Module cONTROL_EXCEPTION_BASE :: Module gHC_GENERICS :: Module gHC_TYPELITS :: Module gHC_TYPELITS_INTERNAL :: Module gHC_TYPENATS :: Module gHC_TYPENATS_INTERNAL :: Module dATA_TYPE_EQUALITY :: 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 dATA_ARRAY_PARALLEL_NAME :: ModuleName dATA_ARRAY_PARALLEL_PRIM_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 eqString_RDR :: RdrName unpackCString_RDR :: RdrName unpackCStringFoldr_RDR :: RdrName unpackCStringUtf8_RDR :: RdrName unpackCStringFoldrUtf8_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 getTag_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 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 noSelTyConName :: Name repTyConName :: Name rep1TyConName :: Name uRecTyConName :: Name uAddrTyConName :: Name uCharTyConName :: Name uDoubleTyConName :: Name uFloatTyConName :: Name uIntTyConName :: Name uWordTyConName :: Name prefixIDataConName :: Name infixIDataConName :: Name leftAssociativeDataConName :: Name rightAssociativeDataConName :: Name notAssociativeDataConName :: Name sourceUnpackDataConName :: Name sourceNoUnpackDataConName :: Name noSourceUnpackednessDataConName :: Name sourceLazyDataConName :: Name sourceStrictDataConName :: Name noSourceStrictnessDataConName :: Name decidedLazyDataConName :: Name decidedStrictDataConName :: Name decidedUnpackDataConName :: Name metaDataDataConName :: Name metaConsDataConName :: Name metaSelDataConName :: Name divIntName :: Name modIntName :: Name unpackCStringName :: Name unpackCStringFoldrName :: Name unpackCStringUtf8Name :: Name cstringLengthName :: Name eqStringName :: 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 breakpointName :: Name breakpointCondName :: Name opaqueTyConName :: Name fromStringName :: Name fstName :: Name sndName :: Name numClassName :: Name fromIntegerName :: Name minusName :: Name negateName :: Name bnbVarQual :: String -> Unique -> Name bnnVarQual :: String -> Unique -> Name bniVarQual :: String -> Unique -> Name bignatFromWordListName :: Name naturalToWordName :: Name naturalToWordClampName :: Name naturalEqName :: Name naturalNeName :: Name naturalGeName :: Name naturalLeName :: Name naturalGtName :: Name naturalLtName :: Name naturalCompareName :: Name naturalPopCountName :: Name naturalShiftRName :: Name naturalShiftLName :: Name naturalAddName :: Name naturalSubName :: Name naturalSubThrowName :: Name naturalSubUnsafeName :: Name naturalMulName :: Name naturalSignumName :: Name naturalNegateName :: 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 integerEqName :: Name integerNeName :: Name integerLeName :: Name integerGtName :: Name integerLtName :: Name integerGeName :: Name integerAbsName :: Name integerSignumName :: Name integerCompareName :: 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 arrayArrayPrimTyConKey :: Unique mutableArrayArrayPrimTyConKey :: 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 anyBoxConKey :: Unique kindConKey :: Unique boxityConKey :: Unique typeConKey :: Unique threadIdPrimTyConKey :: Unique bcoPrimTyConKey :: Unique ptrTyConKey :: Unique funPtrTyConKey :: Unique tVarPrimTyConKey :: Unique compactPrimTyConKey :: 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 pluginTyConKey :: Unique frontendPluginTyConKey :: Unique unknownTyConKey :: Unique unknown1TyConKey :: Unique unknown2TyConKey :: Unique unknown3TyConKey :: Unique opaqueTyConKey :: Unique v1TyConKey :: Unique u1TyConKey :: Unique par1TyConKey :: Unique rec1TyConKey :: Unique k1TyConKey :: Unique m1TyConKey :: Unique sumTyConKey :: Unique prodTyConKey :: Unique compTyConKey :: Unique rTyConKey :: Unique dTyConKey :: Unique cTyConKey :: Unique sTyConKey :: Unique rec0TyConKey :: Unique d1TyConKey :: Unique c1TyConKey :: Unique s1TyConKey :: Unique noSelTyConKey :: Unique repTyConKey :: Unique rep1TyConKey :: Unique uRecTyConKey :: Unique uAddrTyConKey :: Unique uCharTyConKey :: Unique uDoubleTyConKey :: Unique uFloatTyConKey :: Unique uIntTyConKey :: Unique uWordTyConKey :: Unique 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 trTyConTyConKey :: Unique trTyConDataConKey :: Unique trModuleTyConKey :: Unique trModuleDataConKey :: Unique trNameTyConKey :: Unique trNameSDataConKey :: Unique trNameDDataConKey :: Unique trGhcPrimModuleKey :: Unique kindRepTyConKey :: Unique typeLitSortTyConKey :: Unique typeErrorTextDataConKey :: Unique typeErrorAppendDataConKey :: Unique typeErrorVAppendDataConKey :: Unique typeErrorShowTypeDataConKey :: Unique prefixIDataConKey :: Unique infixIDataConKey :: Unique leftAssociativeDataConKey :: Unique rightAssociativeDataConKey :: Unique notAssociativeDataConKey :: Unique sourceUnpackDataConKey :: Unique sourceNoUnpackDataConKey :: Unique noSourceUnpackednessDataConKey :: Unique sourceLazyDataConKey :: Unique sourceStrictDataConKey :: Unique noSourceStrictnessDataConKey :: Unique decidedLazyDataConKey :: Unique decidedStrictDataConKey :: Unique decidedUnpackDataConKey :: Unique metaDataDataConKey :: Unique metaConsDataConKey :: Unique metaSelDataConKey :: Unique vecRepDataConKey :: Unique tupleRepDataConKey :: Unique sumRepDataConKey :: Unique boxedRepDataConKey :: 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 errorIdKey :: 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 unpackCStringAppendIdKey :: Unique unpackCStringFoldrIdKey :: Unique unpackCStringIdKey :: Unique unpackCStringFoldrUtf8IdKey :: 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 fstIdKey :: Unique sndIdKey :: 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 breakpointIdKey :: Unique breakpointCondIdKey :: 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 magicDictKey :: Unique coerceKey :: Unique unboundKey :: Unique fromIntegerClassOpKey :: Unique minusClassOpKey :: Unique fromRationalClassOpKey :: Unique enumFromClassOpKey :: Unique enumFromThenClassOpKey :: Unique enumFromToClassOpKey :: Unique enumFromThenToClassOpKey :: Unique eqClassOpKey :: Unique geClassOpKey :: Unique negateClassOpKey :: Unique 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 integerEqIdKey :: Unique integerNeIdKey :: Unique integerLeIdKey :: Unique integerGtIdKey :: Unique integerLtIdKey :: Unique integerGeIdKey :: Unique integerAbsIdKey :: Unique integerSignumIdKey :: Unique integerCompareIdKey :: 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 naturalToWordClampIdKey :: Unique naturalEqIdKey :: Unique naturalNeIdKey :: Unique naturalGeIdKey :: Unique naturalLeIdKey :: Unique naturalGtIdKey :: Unique naturalLtIdKey :: Unique naturalCompareIdKey :: Unique naturalPopCountIdKey :: Unique naturalShiftRIdKey :: Unique naturalShiftLIdKey :: Unique naturalAddIdKey :: Unique naturalSubIdKey :: Unique naturalSubThrowIdKey :: Unique naturalSubUnsafeIdKey :: Unique naturalMulIdKey :: Unique naturalSignumIdKey :: Unique naturalNegateIdKey :: 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 mkRationalBase2IdKey :: Unique mkRationalBase10IdKey :: Unique numericClassKeys :: [Unique] fractionalClassKeys :: [Unique] standardClassKeys :: [Unique] derivableClassKeys :: [Unique] interactiveClassNames :: [Name] interactiveClassKeys :: [Unique] 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 -> 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 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 [nt_lev_poly] :: AlgTyConRhs -> Bool -- | Both type classes as well as family instances imply implicit type -- constructors. These implicit type constructors refer to their parent -- structure (ie, the class or family from which they derive) using a -- type of the following form. -- -- Extract those DataCons that we are able to learn about. Note -- that visibility in this sense does not correspond to visibility in the -- context of any particular user program! visibleDataCons :: AlgTyConRhs -> [DataCon] data AlgTyConFlav -- | An ordinary type constructor has no parent. VanillaAlgTyCon :: TyConRepName -> AlgTyConFlav -- | An unboxed type constructor. The TyConRepName is a Maybe since we -- currently don't allow unboxed sums to be Typeable since there are too -- many of them. See #13276. UnboxedAlgTyCon :: Maybe TyConRepName -> AlgTyConFlav -- | Type constructors representing a class dictionary. See Note [ATyCon -- for classes] in 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 -- | 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 unlifted primitive TyCon, such as Int#. mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon -- | Kind constructors mkKindTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Name -> TyCon -- | Create a lifted primitive TyCon such as RealWorld mkLiftedPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon mkDataTyConRhs :: [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 TyCon unlifted (i.e. cannot contain bottom)? Note that -- this can only be true for primitive and unboxed-tuple TyCons isUnliftedTyCon :: TyCon -> Bool -- | Is this an algebraic TyCon declared with the GADT syntax? isGadtSyntaxTyCon :: TyCon -> Bool -- | isInjectiveTyCon is true of TyCons for which this -- property holds (where X is the role passed in): If (T a1 b1 c1) ~X (T -- a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2) (where X1, -- X2, and X3, are the roles given by tyConRolesX tc X) See also Note -- [Decomposing equality] in 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: -- --
-- 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 :: 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
-- | Create a nullary TyConApp. In general you should rather use
-- mkTyConTy. This merely exists to break the import cycle between
-- TyCon and this module.
mkTyConTy_ :: 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)
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:
--
--
-- 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:
--
--
-- >>> 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])
tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind)
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
tidyKind :: TidyEnv -> Kind -> Kind
-- | 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:
--
--
-- 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 arrayArrayPrimTyCon :: TyCon mkArrayArrayPrimTy :: Type smallArrayPrimTyCon :: TyCon mkSmallArrayPrimTy :: Type -> Type mutableArrayPrimTyCon :: TyCon mkMutableArrayPrimTy :: Type -> Type -> Type mutableByteArrayPrimTyCon :: TyCon mkMutableByteArrayPrimTy :: Type -> Type mutableArrayArrayPrimTyCon :: TyCon mkMutableArrayArrayPrimTy :: Type -> Type smallMutableArrayPrimTyCon :: TyCon mkSmallMutableArrayPrimTy :: Type -> Type -> Type mutVarPrimTyCon :: TyCon mkMutVarPrimTy :: Type -> Type -> Type mVarPrimTyCon :: TyCon mkMVarPrimTy :: Type -> Type -> Type 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 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 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: -- --
-- 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
-- | Create the plain type constructor type which has been applied to no
-- type arguments at all.
mkTyConTy :: TyCon -> Type
-- | Given a RuntimeRep, applies TYPE to it. See Note
-- [TYPE and RuntimeRep] in GHC.Builtin.Types.Prim.
tYPE :: 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 :: 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.
--
-- 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
repSplitTyConApp_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)
-- | 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 = 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: -- --
-- 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) -- | 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 -- | Returns Just True if this type is surely lifted, Just False if it is -- surely unlifted, Nothing if we can't be sure (i.e., it is levity -- polymorphic), and panics if the kind does not have the shape TYPE r. isLiftedType_maybe :: HasDebugCallStack => Type -> Maybe Bool -- | 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 levity-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 -- levity-polymorphic kinds, which may be specialized to a kind that -- classifies AddrRep or even unboxed kinds. isBoxedTypeKind :: Kind -> Bool pickyIsLiftedTypeKind :: Kind -> Bool isLiftedRuntimeRep :: Type -> Bool isUnliftedRuntimeRep :: Type -> Bool -- | See isBoxedRuntimeRep_maybe. isBoxedRuntimeRep :: Type -> Bool isLiftedLevity :: Type -> Bool isUnliftedLevity :: Type -> Bool -- | See Type#type_classification for what an unlifted type is. -- Panics on levity polymorphic types; See mightBeUnliftedType for -- a more approximate predicate that behaves better in the presence of -- levity polymorphism. isUnliftedType :: HasDebugCallStack => Type -> Bool -- | See Type#type_classification for what a boxed type is. Panics -- on levity polymorphic types; See mightBeUnliftedType for a more -- approximate predicate that behaves better in the presence of levity -- polymorphism. isBoxedType :: Type -> Bool -- | Returns: -- --
-- -- 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, Int, Word, -- LitInteger and LitNatural. 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 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 a fixed-width literal (e.g. Int16#) to a word-sized -- literal (e.g. Int#). extendIntLit :: Platform -> Literal -> Literal -- | Extend a fixed-width literal (e.g. Int16#) to a word-sized -- literal (e.g. Int#). extendWordLit :: 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 -- | A rubbish literal; see Note [Rubbish literals] rubbishLit :: Bool -> Literal isRubbishLit :: Literal -> Bool 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) -- | 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 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 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 -- | 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 -> Coercion -> Coercion -> Coercion -> Coercion -- | Like downgradeRole_maybe, but panics if the change isn't a -- downgrade. See Note [Role twiddling functions] downgradeRole :: Role -> Role -> Coercion -> Coercion 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 : ty0 ~ ty'. (b) ty' is not a newtype. -- -- The function returns Nothing for non-newtypes, or -- unsaturated applications -- -- This function does *not* look through type families, because it has no -- access to the type family environment. If you do have that at hand, -- consider to use topNormaliseType_maybe, which should be a drop-in -- replacement for topNormaliseNewType_maybe If topNormliseNewType_maybe -- ty = Just (co, ty'), then co : ty ~R ty' topNormaliseNewType_maybe :: Type -> Maybe (Coercion, Type) -- | A general function for normalising the top-level of a type. It -- continues to use the provided NormaliseStepper until that -- function fails, and then this function returns. The roles of the -- coercions produced by the NormaliseStepper must all be the -- same, which is the role returned from the call to -- topNormaliseTypeX. -- -- Typically ev is Coercion. -- -- If topNormaliseTypeX step plus ty = Just (ev, ty') then ty ~ev1~ t1 -- ~ev2~ t2 ... ~evn~ ty' and ev = ev1 plus ev2 plus -- ... plus evn If it returns Nothing then no newtype unwrapping -- could happen topNormaliseTypeX :: NormaliseStepper ev -> (ev -> ev -> ev) -> Type -> Maybe (ev, Type) -- | This breaks a Coercion with type T A B C ~ T D E F -- into a list of Coercions of kinds A ~ D, B ~ -- E and E ~ F. Hence: -- --
-- decomposeCo 3 c [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 -- | Cast a type by an MCoercion mkCastTyMCo :: Type -> MCoercion -> Type -- | Get the reverse of an MCoercion mkSymMCo :: MCoercion -> MCoercion isReflMCo :: MCoercion -> Bool 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 :: HasCallStack => TCvSubst -> Coercion -> Coercion -- | Substitute within several Coercions The substitution has to -- satisfy the invariants described in Note [The substitution invariant]. substCos :: HasCallStack => TCvSubst -> [Coercion] -> [Coercion] substCoVar :: TCvSubst -> CoVar -> Coercion substCoVars :: TCvSubst -> [CoVar] -> [Coercion] -- | Coercion substitution, see zipTvSubst substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion substCoVarBndr :: HasCallStack => 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 :: (LiftingContext -> Type -> (CoercionN, a)) -> LiftingContext -> TyCoVar -> (LiftingContext, TyCoVar, CoercionN, a) -- | Is a var in the domain of a lifting context? isMappedByLC :: TyCoVar -> LiftingContext -> Bool mkSubstLiftingContext :: TCvSubst -> LiftingContext -- | Erase the environments in a lifting context zapLiftingContext :: LiftingContext -> LiftingContext -- | Like substForAllCoBndr, but works on a lifting context 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 simplifyArgsWorker :: [TyCoBinder] -> Kind -> TyCoVarSet -> [Role] -> [(Type, Coercion)] -> ([Type], [Coercion], MCoercionN) -- | Is there a coercion hole in this type? hasCoercionHoleTy :: Type -> Bool -- | Is there a coercion hole in this coercion? hasCoercionHoleCo :: Coercion -> Bool -- | A set of CoercionHoles type HoleSet = UniqSet CoercionHole -- | Extract out all the coercion holes from a given type coercionHolesOfType :: Type -> UniqSet CoercionHole coercionHolesOfCo :: Coercion -> UniqSet 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 ClassPred :: Class -> [Type] -> Pred EqPred :: EqRel -> Type -> Type -> Pred IrredPred :: PredType -> Pred ForAllPred :: [TyVar] -> [PredType] -> PredType -> 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 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 -- | 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.EqRel 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 -- | 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 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 KnownTc :: Name -> RoughMatchTc OtherTc :: RoughMatchTc roughMatchTcs :: [Type] -> [RoughMatchTc] 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 isRoughOtherTc :: 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 [Unificiation result] data UnifyResultM a Unifiable :: a -> UnifyResultM a MaybeApart :: MaybeApartReason -> a -> UnifyResultM a SurelyApart :: UnifyResultM a -- | Why are two types MaybeApart? MARTypeFamily takes -- precedence: This is used (only) in Note [Infinitary substitution in -- lookup] in GHC.Core.InstEnv data MaybeApartReason -- | matching e.g. F Int ~? Bool MARTypeFamily :: MaybeApartReason -- | matching e.g. a ~? Maybe a MARInfinite :: 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 Data.Data.Data GHC.Core.Unify.RoughMatchTc 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) type FamInstEnv = UniqDFM TyCon FamilyInstEnv emptyFamInstEnv :: FamInstEnv emptyFamInstEnvs :: (FamInstEnv, FamInstEnv) extendFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv extendFamInstEnvList :: FamInstEnv -> [FamInst] -> FamInstEnv famInstEnvElts :: FamInstEnv -> [FamInst] famInstEnvSize :: FamInstEnv -> Int familyInstances :: (FamInstEnv, FamInstEnv) -> TyCon -> [FamInst] mkCoAxBranch :: [TyVar] -> [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 -> [FamInstMatch] lookupFamInstEnvByTyCon :: FamInstEnvs -> TyCon -> [FamInst] isDominatedBy :: CoAxBranch -> [CoAxBranch] -> Bool -- | Do an apartness check, as described in the "Closed Type Families" -- paper (POPL '14). This should be used when determining if an equation -- (CoAxBranch) of a closed type family can be used to reduce a -- certain target type family application. apartnessCheck :: [Type] -> CoAxBranch -> Bool -- | Result of testing two type family equations for injectiviy. data InjectivityCheckResult -- | Either RHSs are distinct or unification of RHSs leads to unification -- of LHSs InjectivityAccepted :: InjectivityCheckResult -- | RHSs unify but LHSs don't unify under that substitution. Relevant for -- closed type families where equation after unification might be -- overlpapped (in which case it is OK if they don't unify). Constructor -- stores axioms after unification. InjectivityUnified :: CoAxBranch -> CoAxBranch -> InjectivityCheckResult -- | Check whether an open type family equation can be added to already -- existing instance environment without causing conflicts with supplied -- injectivity annotations. Returns list of conflicting axioms (type -- instance declarations). lookupFamInstEnvInjectivityConflicts :: [Bool] -> FamInstEnvs -> FamInst -> [CoAxBranch] -- | Check whether two type family axioms don't violate injectivity -- annotation. injectiveBranches :: [Bool] -> CoAxBranch -> CoAxBranch -> InjectivityCheckResult topNormaliseType :: FamInstEnvs -> Type -> Type -- | Get rid of *outermost* (or toplevel) * type function redex * data -- family redex * newtypes returning an appropriate Representational -- coercion. Specifically, if topNormaliseType_maybe env ty = Just (co, -- ty') then (a) co :: ty ~R ty' (b) ty' is not a newtype, and is not a -- type-family or data-family redex -- -- However, ty' can be something like (Maybe (F ty)), where (F ty) is a -- redex. -- -- 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 (Coercion, Type) normaliseType :: FamInstEnvs -> Role -> Type -> (Coercion, Type) normaliseTcApp :: FamInstEnvs -> Role -> TyCon -> [Type] -> (Coercion, Type) -- | Try to simplify a type-family application, by *one* step If -- topReduceTyFamApp_maybe env r F tys = Just (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 (Coercion, Type, MCoercion) reduceTyFamApp_maybe :: FamInstEnvs -> Role -> TyCon -> [Type] -> Maybe (Coercion, Type) 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.FamilyInstEnv 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 -- --
-- 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 = ... --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] -- | 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: -- --
-- 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) 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) in all -- free variables and arguments * has exnDiv Divergence -- result 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. See Note [Precise exceptions and strictness -- analysis] 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 -- mkStrictSigForArity. See Note [Understanding DmdType and -- StrictSig] newtype StrictSig StrictSig :: DmdType -> StrictSig -- | Turns a DmdType computed for the particular Arity into a -- StrictSig unleashable at that arity. See Note [Understanding -- DmdType and StrictSig] mkStrictSigForArity :: Arity -> DmdType -> StrictSig mkClosedStrictSig :: [Demand] -> Divergence -> StrictSig splitStrictSig :: StrictSig -> ([Demand], Divergence) strictSigDmdEnv :: StrictSig -> DmdEnv hasDemandEnvSig :: StrictSig -> Bool nopSig :: StrictSig botSig :: StrictSig isTopSig :: StrictSig -> Bool -- | True if the signature diverges or throws an exception in a saturated -- call. See Note [Dead ends]. isDeadEndSig :: StrictSig -> 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 :: StrictSig -> Int -> Bool -- | Add extra (topDmd) arguments to a strictness signature. In -- contrast to etaConvertStrictSig, this prepends -- additional argument demands. This is used by FloatOut. prependArgsStrictSig :: Int -> StrictSig -> StrictSig -- | 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 prependArgsStrictSig, 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. etaConvertStrictSig :: Arity -> StrictSig -> StrictSig -- | 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 StrictSig] and Note [What are -- demand signatures?]. type DmdTransformer = SubDemand -> DmdType -- | Extrapolate a demand signature (StrictSig) into a -- DmdTransformer. -- -- Given a function's StrictSig and a SubDemand for the -- evaluation context, return how the function evaluates its free -- variables and arguments. dmdTransformSig :: StrictSig -> 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). dmdTransformDictSelSig :: StrictSig -> DmdTransformer data TypeShape TsFun :: TypeShape -> TypeShape TsProd :: [TypeShape] -> TypeShape TsUnk :: TypeShape trimToType :: Demand -> TypeShape -> Demand seqDemand :: Demand -> () seqDemandList :: [Demand] -> () seqDmdType :: DmdType -> () seqStrictSig :: StrictSig -> () zapUsageDemand :: Demand -> Demand -- | Remove the demand environment from the signature. zapDmdEnvSig :: StrictSig -> StrictSig -- | 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 :: StrictSig -> StrictSig instance GHC.Classes.Eq GHC.Types.Demand.Card instance GHC.Classes.Eq GHC.Types.Demand.Demand instance GHC.Classes.Eq GHC.Types.Demand.SubDemand instance GHC.Classes.Eq GHC.Types.Demand.Divergence instance GHC.Classes.Eq GHC.Types.Demand.StrictSig instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.TypeShape instance GHC.Utils.Outputable.Outputable GHC.Types.Demand.StrictSig instance GHC.Utils.Binary.Binary GHC.Types.Demand.StrictSig 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.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.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 idCprInfo. 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 StrictSig] 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 StrictSig] 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. -- --
-- data Eq a => T a = ... ---- -- It is empty for PatSynCon as they do not allow such contexts. 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 -- | 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_asm_expanded :: 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_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 -- | Final STG (after stg2stg) 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_vt_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 -- | Enumerates the simple on-or-off dynamic flags data GeneralFlag -- | Append dump output to files instead of stdout. Opt_DumpToFile :: GeneralFlag Opt_D_faststring_stats :: GeneralFlag Opt_D_dump_minimal_imports :: GeneralFlag Opt_DoCoreLinting :: GeneralFlag Opt_DoLinearCoreLinting :: GeneralFlag Opt_DoStgLinting :: GeneralFlag Opt_DoCmmLinting :: GeneralFlag Opt_DoAsmLinting :: GeneralFlag Opt_DoAnnotationLinting :: 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_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 Opt_SolveConstantDicts :: GeneralFlag Opt_AlignmentSanitisation :: GeneralFlag Opt_CatchBottoms :: GeneralFlag Opt_NumConstantFolding :: 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_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_RPath :: GeneralFlag Opt_RelativeDynlibPaths :: 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 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 -- | Used when outputting warnings: if a reason is given, it is displayed. -- If a warning isn't controlled by a flag, this is made explicit at the -- point of use. data WarnReason NoReason :: WarnReason -- | Warning was enabled with the flag Reason :: !WarningFlag -> WarnReason -- | Warning was made an error because of -Werror or -Werror=WarningFlag ErrReason :: !Maybe WarningFlag -> WarnReason data Language Haskell98 :: Language Haskell2010 :: Language GHC2021 :: Language 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 -> 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 type FatalMessager = String -> IO () newtype FlushOut FlushOut :: IO () -> FlushOut newtype FlushErr FlushErr :: IO () -> FlushErr data ProfAuto -- | no SCC annotations added NoProfAuto :: ProfAuto -- | top-level and nested functions are annotated ProfAutoAll :: ProfAuto -- | top-level functions annotated only ProfAutoTop :: ProfAuto -- | exported functions annotated only ProfAutoExports :: ProfAuto -- | annotate call-sites ProfAutoCalls :: ProfAuto glasgowExtsFlags :: [Extension] -- | Warning groups. -- -- As all warnings are in the Weverything set, it is ignored when -- displaying to the user which group a warning is in. warningGroups :: [(String, [WarningFlag])] -- | Warning group hierarchies, where there is an explicit inclusion -- relation. -- -- Each inner list is a hierarchy of warning groups, ordered from -- smallest to largest, where each group is a superset of the one before -- it. -- -- Separating this from warningGroups allows for multiple -- hierarchies with no inherent relation to be defined. -- -- The special-case Weverything group is not included. warningHierarchies :: [[String]] hasPprDebug :: DynFlags -> Bool hasNoDebugOutput :: DynFlags -> Bool hasNoStateHack :: DynFlags -> Bool hasNoOptCoercion :: DynFlags -> Bool -- | Test whether a DumpFlag is set dopt :: DumpFlag -> DynFlags -> Bool -- | Set a DumpFlag dopt_set :: DynFlags -> DumpFlag -> DynFlags -- | Unset a DumpFlag dopt_unset :: DynFlags -> DumpFlag -> DynFlags -- | Test whether a GeneralFlag is set -- -- 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 -- | Won't try to generate dynamic objects for some reason DT_Failed :: DynamicTooState -- | Will still try to generate dynamic objects DT_OK :: DynamicTooState -- | Currently generating dynamic objects (in the backend) DT_Dyn :: DynamicTooState dynamicTooState :: MonadIO m => DynFlags -> m DynamicTooState setDynamicNow :: DynFlags -> DynFlags setDynamicTooFailed :: MonadIO m => DynFlags -> m () -- | Compute the path of the dynamic object corresponding to an object -- file. dynamicOutputFile :: DynFlags -> FilePath -> FilePath dynamicOutputHi :: DynFlags -> FilePath -> FilePath -- | Indicate if cost-centre profiling is enabled sccProfilingEnabled :: 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)] -> LlvmConfig -> Int -> Int -> Int -> Int -> Int -> Maybe String -> Maybe String -> [Int] -> Maybe Int -> Bool -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Int -> Int -> Int -> Maybe Int -> Maybe Int -> Int -> Word -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Bool -> Maybe Int -> Int -> [FilePath] -> ModuleName -> Maybe String -> IntWithInf -> IntWithInf -> UnitId -> Maybe UnitId -> [(ModuleName, Module)] -> Ways -> Maybe (String, Int) -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> String -> String -> String -> String -> IORef Bool -> String -> String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> DynLibLoader -> !Bool -> Maybe 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 -> FlushErr -> Maybe FilePath -> Maybe String -> [String] -> Int -> Int -> Bool -> OverridingBool -> Bool -> Scheme -> ProfAuto -> [CallerCcFilter] -> Maybe String -> IORef (ModuleEnv Int) -> Maybe SseVersion -> Maybe BmiVersion -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> IORef (Maybe LinkerInfo) -> 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: -- --
-- 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 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: -- --
-- -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] -- | Find the FlagSpec for a WarningFlag. wWarningFlagMap :: Map WarningFlag (FlagSpec WarningFlag) -- | Some modules have dependencies on others through the DynFlags rather -- than textual imports dynFlagDependencies :: DynFlags -> [ModuleName] -- | 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 flagSpecOf :: WarningFlag -> Maybe (FlagSpec WarningFlag) -- | Find the smallest group in every hierarchy which a warning belongs to, -- excluding Weverything. smallestGroups :: WarningFlag -> [String] -- | 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 sTmpDir :: Settings -> String 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 sGhcWithSMP :: Settings -> Bool sGhcRTSWays :: Settings -> String sLibFFI :: Settings -> Bool sGhcRtsWithLibdw :: 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 -> String -> FilePath -> FileSettings [fileSettings_ghcUsagePath] :: FileSettings -> FilePath [fileSettings_ghciUsagePath] :: FileSettings -> FilePath [fileSettings_toolDir] :: FileSettings -> Maybe FilePath [fileSettings_topDir] :: FileSettings -> FilePath [fileSettings_tmpDir] :: FileSettings -> String [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 -> Bool -> Bool -> String -> PlatformMisc [platformMisc_targetPlatformString] :: PlatformMisc -> String [platformMisc_ghcWithInterpreter] :: PlatformMisc -> Bool [platformMisc_ghcWithSMP] :: PlatformMisc -> Bool [platformMisc_ghcRTSWays] :: PlatformMisc -> String [platformMisc_libFFI] :: PlatformMisc -> Bool [platformMisc_ghcRtsWithLibdw] :: 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 tmpDir :: DynFlags -> String -- | The directory for this version of ghc in the user's app directory -- (typically something like ~.ghcx86_64-linux-7.6.3) 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 defaultFlushErr :: FlushErr -- | Retrieve the options corresponding to a particular opt_* -- field in the correct order getOpts :: DynFlags -> (DynFlags -> [a]) -> [a] -- | Gets the verbosity flag for the current verbosity level. This is fed -- to other tools, so GHC-specific verbosity flags like -- -ddump-most are not included getVerbFlags :: DynFlags -> [String] -- | Sets the DynFlags to be appropriate to the optimisation level updOptLevel :: Int -> DynFlags -> DynFlags setTmpDir :: FilePath -> DynFlags -> DynFlags setUnitId :: String -> DynFlags -> DynFlags 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] compilerInfo :: DynFlags -> [(String, String)] wordAlignment :: Platform -> Alignment setUnsafeGlobalDynFlags :: DynFlags -> IO () isSseEnabled :: Platform -> Bool isSse2Enabled :: Platform -> Bool 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 -- | Logger module GHC.Utils.Logger data Logger initLogger :: IO Logger class HasLogger m getLogger :: HasLogger m => m Logger class ContainsLogger t extractLogger :: ContainsLogger t => t -> Logger type LogAction = DynFlags -> WarnReason -> Severity -> SrcSpan -> SDoc -> IO () type DumpAction = DynFlags -> PprStyle -> DumpFlag -> String -> DumpFormat -> SDoc -> IO () type TraceAction a = DynFlags -> 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 -- | Log something putLogMsg :: Logger -> LogAction -- | Dump something putDumpMsg :: Logger -> DumpAction -- | Trace something putTraceMsg :: Logger -> TraceAction a -- | 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 jsonLogAction :: LogAction defaultLogAction :: LogAction -- | Like defaultLogActionHPutStrDoc but appends an extra newline. defaultLogActionHPrintDoc :: DynFlags -> 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 :: DynFlags -> Bool -> Handle -> SDoc -> IO () -- | Default action for dumpAction hook defaultDumpAction :: DumpCache -> LogAction -> DumpAction -- | Run an action with the handle of a DumpFlag if we are -- outputting to a file, otherwise Nothing. withDumpFileHandle :: DumpCache -> DynFlags -> DumpFlag -> (Maybe Handle -> IO ()) -> IO () -- | Ensure that a dump file is created even if it stays empty touchDumpFile :: Logger -> DynFlags -> DumpFlag -> IO () dumpIfSet :: Logger -> DynFlags -> Bool -> String -> SDoc -> IO () -- | A wrapper around dumpAction. First check whether the dump -- flag is set Do nothing if it is unset dumpIfSet_dyn :: Logger -> DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO () -- | A wrapper around putDumpMsg. First check whether the dump flag -- is set Do nothing if it is unset -- -- Unlike dumpIfSet_dyn, has a printer argument dumpIfSet_dyn_printer :: PrintUnqualified -> Logger -> DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO () -- | Default action for traceAction hook defaultTraceAction :: TraceAction a instance GHC.Classes.Eq GHC.Utils.Logger.DumpFormat instance GHC.Show.Show GHC.Utils.Logger.DumpFormat module GHC.Utils.Error data Validity -- | Everything is fine IsValid :: Validity -- | A problem, and some indication of why NotValid :: SDoc -> Validity andValid :: Validity -> Validity -> Validity -- | If they aren't all valid, return the first allValid :: [Validity] -> Validity isValid :: Validity -> Bool getInvalids :: [Validity] -> [SDoc] orValid :: Validity -> Validity -> Validity data Severity SevOutput :: Severity SevFatal :: Severity SevInteractive :: Severity -- | Log message intended for compiler developers No file/line/column stuff SevDump :: Severity -- | Log messages intended for end users. No file/line/column stuff. SevInfo :: Severity SevWarning :: Severity -- | SevWarning and SevError are used for warnings and errors o The message -- has a file/line/column heading, plus "warning:" or "error:", added by -- mkLocMessags o Output is intended for end users SevError :: Severity type WarnMsg = MsgEnvelope DecoratedSDoc -- | 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, its -- severity, etc. Finally, multiple MsgEnvelopes are aggregated -- into Messages that are returned to the user. data MsgEnvelope e MsgEnvelope :: SrcSpan -> PrintUnqualified -> e -> Severity -> WarnReason -> 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 [errMsgReason] :: MsgEnvelope e -> WarnReason -- | 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]. data Messages e type ErrorMessages = Bag (MsgEnvelope DecoratedSDoc) type WarningMessages = Bag (MsgEnvelope DecoratedSDoc) -- | Joins two collections of messages together. unionMessages :: Messages e -> Messages e -> Messages e errorsFound :: Messages e -> Bool isEmptyMessages :: Messages e -> Bool pprMessageBag :: Bag SDoc -> SDoc pprMsgEnvelopeBagWithLoc :: Bag (MsgEnvelope DecoratedSDoc) -> [SDoc] pprLocMsgEnvelope :: RenderableDiagnostic e => MsgEnvelope e -> SDoc -- | Formats the input list of structured document, where each element of -- the list gets a bullet. formatBulleted :: SDocContext -> DecoratedSDoc -> SDoc 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 :: Severity -> SrcSpan -> SDoc -> SDoc -- | Make a possibly annotated error message with location info. mkLocMessageAnn :: Maybe String -> Severity -> SrcSpan -> SDoc -> SDoc makeIntoWarning :: WarnReason -> MsgEnvelope e -> MsgEnvelope e -- | A short (one-line) error message mkMsgEnvelope :: SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc -- | Variant that doesn't care about qualified/unqualified names mkPlainMsgEnvelope :: SrcSpan -> SDoc -> MsgEnvelope DecoratedSDoc mkErr :: SrcSpan -> PrintUnqualified -> e -> MsgEnvelope e -- | A long (multi-line) error message mkLongMsgEnvelope :: SrcSpan -> PrintUnqualified -> SDoc -> SDoc -> MsgEnvelope DecoratedSDoc -- | A short (one-line) error message mkWarnMsg :: SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc -- | Variant that doesn't care about qualified/unqualified names mkPlainWarnMsg :: SrcSpan -> SDoc -> MsgEnvelope DecoratedSDoc -- | A long (multi-line) error message mkLongWarnMsg :: SrcSpan -> PrintUnqualified -> SDoc -> SDoc -> MsgEnvelope DecoratedSDoc doIfSet :: Bool -> IO () -> IO () doIfSet_dyn :: DynFlags -> GeneralFlag -> IO () -> IO () getCaretDiagnostic :: Severity -> SrcSpan -> IO SDoc putMsg :: Logger -> DynFlags -> SDoc -> IO () printInfoForUser :: Logger -> DynFlags -> PrintUnqualified -> SDoc -> IO () printOutputForUser :: Logger -> DynFlags -> PrintUnqualified -> SDoc -> IO () logInfo :: Logger -> DynFlags -> SDoc -> IO () -- | Like logInfo but with SevOutput rather then -- SevInfo logOutput :: Logger -> DynFlags -> SDoc -> IO () errorMsg :: Logger -> DynFlags -> SDoc -> IO () warningMsg :: Logger -> DynFlags -> SDoc -> IO () fatalErrorMsg :: Logger -> DynFlags -> SDoc -> IO () fatalErrorMsg'' :: FatalMessager -> String -> IO () compilationProgressMsg :: Logger -> DynFlags -> SDoc -> IO () showPass :: Logger -> DynFlags -> String -> IO () -- | Time a compilation phase. -- -- When timings are enabled (e.g. with the -v2 flag), the -- allocations and CPU time used by the phase will be reported to stderr. -- Consider a typical usage: withTiming getDynFlags (text "simplify") -- force PrintTimings pass. When timings are enabled the following -- costs are included in the produced accounting, -- --
-- 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 -- | Unit manipulation module GHC.Unit.State data UnitState UnitState :: UnitInfoMap -> PreloadUnitClosure -> UniqFM PackageName IndefUnitId -> Map UnitId UnitId -> Map UnitId UnitId -> [UnitId] -> [Unit] -> !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 IndefUnitId. This is used -- when users refer to packages in Backpack includes. [packageNameMap] :: UnitState -> UniqFM PackageName IndefUnitId -- | 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] -- | 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] -> IO ([UnitDatabase UnitId], UnitState, HomeUnit, Maybe PlatformConstants) readUnitDatabases :: (Int -> SDoc -> IO ()) -> UnitConfig -> IO [UnitDatabase UnitId] readUnitDatabase :: (Int -> SDoc -> IO ()) -> 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) lookupPackageName :: UnitState -> PackageName -> Maybe IndefUnitId -- | 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 -> Maybe FastString -> 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 -> Maybe FastString -> Maybe [UnitInfo] lookupPluginModuleWithSuggestions :: UnitState -> ModuleName -> Maybe FastString -> 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 variable]. -- -- 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 variable]. 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 IndefUnitId 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 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 GHC.Unit.State.UnitVisibility instance GHC.Base.Semigroup GHC.Unit.State.UnitVisibility instance GHC.Base.Monoid GHC.Unit.State.UnitVisibility module GHC.Unit.Finder.Types -- | The FinderCache maps modules to the result of searching for -- that module. It records the results of searching for modules along the -- search path. On :load, we flush the entire contents of this -- cache. type FinderCache = InstalledModuleEnv InstalledFindResult -- | The result of searching for an imported module. -- -- NB: FindResult manages both user source-import lookups (which can -- result in Module) as well as direct imports for interfaces -- (which always result in InstalledModule). data FindResult -- | The module was found Found :: ModLocation -> Module -> FindResult -- | The requested 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 module GHC.Unit.Env data UnitEnv UnitEnv :: !UnitState -> !HomeUnit -> !Platform -> !GhcNameVersion -> UnitEnv -- | Units [ue_units] :: UnitEnv -> !UnitState -- | Home unit [ue_home_unit] :: UnitEnv -> !HomeUnit -- | Platform [ue_platform] :: UnitEnv -> !Platform -- | GHC name/version (used for dynamic library suffix) [ue_namever] :: UnitEnv -> !GhcNameVersion -- | 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] 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.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.StgHalfWord instance GHC.Utils.Outputable.Outputable GHC.Runtime.Heap.Layout.StgWord module GHC.Driver.Errors -- | Converts a list of WarningMessages into a tuple where the -- second element contains only error, i.e. warnings that are considered -- fatal by GHC based on the input DynFlags. warningsToMessages :: DynFlags -> WarningMessages -> (WarningMessages, ErrorMessages) -- | Given a bag of warnings, turn them into an exception if -Werror is -- enabled, or print them out otherwise. printOrThrowWarnings :: Logger -> DynFlags -> Bag WarnMsg -> IO () printBagOfErrors :: RenderableDiagnostic a => Logger -> DynFlags -> Bag (MsgEnvelope a) -> IO () -- | Checks if given WarnMsg is a fatal warning. isWarnMsgFatal :: DynFlags -> WarnMsg -> Maybe (Maybe WarningFlag) handleFlagWarnings :: Logger -> DynFlags -> [Warn] -> IO () -- | 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.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) -- | 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 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 NoExtCon, 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 -- | Used in TTG extension constructors that have yet to be extended with -- anything. If an extension constructor has NoExtCon as its -- field, it is not intended to ever be constructed anywhere, and any -- function that consumes the extension constructor can eliminate it by -- way of noExtCon. -- -- This should not be confused with NoExtField, which are found in -- unused extension points (not constructors) and therefore -- can be inhabited. data NoExtCon -- | Eliminate a NoExtCon. Much like absurd. noExtCon :: NoExtCon -> 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 XAbsBinds x x' type family XPatSynBind x x' type family XXHsBindsLR x x' type family XABE x type family XXABExport 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 XConLikeOut x type family XRecFld 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 XBracket x type family XRnBracketOut x type family XTcBracketOut 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 XCHsFieldLabel x type family XXHsFieldLabel 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 XTExpBr x type family XXBracket 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 XHsRecField 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) 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.NoExtCon instance GHC.Classes.Eq Language.Haskell.Syntax.Extension.NoExtCon instance Data.Data.Data Language.Haskell.Syntax.Extension.NoExtCon instance GHC.Utils.Outputable.Outputable Language.Haskell.Syntax.Extension.NoExtCon 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 -- | Governs the kind of expression that the tick gets placed on when -- annotating for example using mkTick. If we find that we want -- to put a tickish on an expression ruled out here, we try to float it -- inwards until we find a suitable expression. data TickishPlacement -- | Place ticks exactly on run-time expressions. We can still move the -- tick through pure compile-time constructs such as other ticks, casts -- or type lambdas. This is the most restrictive placement rule for -- ticks, as all tickishs have in common that they want to track runtime -- processes. The only legal placement rule for counting ticks. PlaceRuntime :: TickishPlacement -- | As PlaceRuntime, but we float the tick through all lambdas. -- This makes sense where there is little difference between annotating -- the lambda and annotating the lambda's code. PlaceNonLam :: TickishPlacement -- | In addition to floating through lambdas, cost-centre style tickishs -- can also be moved from constructors, non-function variables and -- literals. For example: -- -- let x = scc... C (scc... y) (scc... 3) in ... -- -- Neither the constructor application, the variable or the literal are -- likely to have any cost worth mentioning. And even if y names a thunk, -- the call would not care about the evaluation context. Therefore -- removing all annotations in the above example is safe. PlaceCostCentre :: TickishPlacement -- | 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.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) -- | 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: -- --
-- 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. -- --
-- 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
hasCoreUnfolding :: Unfolding -> Bool
-- | Only returns False if there is no unfolding information available at
-- all
hasSomeUnfolding :: Unfolding -> Bool
isBootUnfolding :: Unfolding -> Bool
canUnfold :: Unfolding -> Bool
neverUnfoldGuidance :: UnfoldingGuidance -> Bool
isStableSource :: UnfoldingSource -> Bool
-- | Annotated core: allows annotation at every node in the tree
type AnnExpr bndr annot = (annot, AnnExpr' bndr annot)
-- | A clone of the Expr type but allowing annotation at every tree
-- node
data AnnExpr' bndr annot
AnnVar :: Id -> AnnExpr' bndr annot
AnnLit :: Literal -> AnnExpr' bndr annot
AnnLam :: bndr -> AnnExpr bndr annot -> AnnExpr' bndr annot
AnnApp :: AnnExpr bndr annot -> AnnExpr bndr annot -> AnnExpr' bndr annot
AnnCase :: AnnExpr bndr annot -> bndr -> Type -> [AnnAlt bndr annot] -> AnnExpr' bndr annot
AnnLet :: AnnBind bndr annot -> AnnExpr bndr annot -> AnnExpr' bndr annot
AnnCast :: AnnExpr bndr annot -> (annot, Coercion) -> AnnExpr' bndr annot
AnnTick :: 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:
--
-- -- (\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. 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. strictnessInfo :: IdInfo -> StrictSig setStrictnessInfo :: IdInfo -> StrictSig -> IdInfo infixl 1 `setStrictnessInfo` -- | Information on whether the function will ultimately return a freshly -- allocated constructor. cprInfo :: IdInfo -> CprSig setCprInfo :: IdInfo -> CprSig -> IdInfo infixl 1 `setCprInfo` -- | ID demand information demandInfo :: IdInfo -> Demand setDemandInfo :: IdInfo -> Demand -> IdInfo infixl 1 `setDemandInfo` pprStrictness :: StrictSig -> SDoc -- | The Ids unfolding unfoldingInfo :: IdInfo -> Unfolding setUnfoldingInfo :: IdInfo -> Unfolding -> IdInfo infixl 1 `setUnfoldingInfo` -- | Inline Pragma Information -- -- Tells when the inlining is active. When it is active the thing may be -- inlined, depending on how big it is. -- -- If there was an INLINE pragma, then as a separate matter, the -- RHS will have been made to look small with a Core inline Note -- -- The default InlinePragInfo is AlwaysActive, so the info -- serves entirely as a way to inhibit inlining until we want it type InlinePragInfo = InlinePragma -- | Any inline pragma 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` -- | Constant applicative form Information -- -- Records whether an Id makes Constant Applicative Form -- references data CafInfo -- | Indicates that the Id is for either: -- --
-- type LiftedRep = 'BoxedRep 'Lifted --liftedRepTyCon :: TyCon -- |
-- type UnliftedRep = 'BoxedRep 'Unlifted --unliftedRepTyCon :: TyCon constraintKind :: Kind liftedTypeKind :: Kind unliftedTypeKind :: Kind 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
liftedRepTy :: Type
unliftedRepTy :: 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
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 -> 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
-- | The Name Cache
module GHC.Types.Name.Cache
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache
extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
-- | Return a function to atomically update the name cache.
initNameCache :: UniqSupply -> [Name] -> NameCache
-- | The NameCache makes sure that there is just one Unique assigned for
-- each original name; i.e. (module-name, occ-name) pair and provides
-- something of a lookup mechanism for those names.
data NameCache
NameCache :: !UniqSupply -> !OrigNameCache -> NameCache
-- | Supply of uniques
[nsUniqs] :: NameCache -> !UniqSupply
-- | Ensures that one original name gets one unique
[nsNames] :: NameCache -> !OrigNameCache
-- | Per-module cache of original OccNames given Names
type OrigNameCache = ModuleEnv (OccEnv Name)
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
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
SameMutableArrayOp :: PrimOp
ReadArrayOp :: PrimOp
WriteArrayOp :: PrimOp
SizeofArrayOp :: PrimOp
SizeofMutableArrayOp :: PrimOp
IndexArrayOp :: PrimOp
UnsafeFreezeArrayOp :: PrimOp
UnsafeThawArrayOp :: PrimOp
CopyArrayOp :: PrimOp
CopyMutableArrayOp :: PrimOp
CloneArrayOp :: PrimOp
CloneMutableArrayOp :: PrimOp
FreezeArrayOp :: PrimOp
ThawArrayOp :: PrimOp
CasArrayOp :: PrimOp
NewSmallArrayOp :: PrimOp
SameSmallMutableArrayOp :: PrimOp
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
SameMutableByteArrayOp :: PrimOp
ShrinkMutableByteArrayOp_Char :: PrimOp
ResizeMutableByteArrayOp_Char :: PrimOp
UnsafeFreezeByteArrayOp :: PrimOp
SizeofByteArrayOp :: PrimOp
SizeofMutableByteArrayOp :: PrimOp
GetSizeofMutableByteArrayOp :: PrimOp
IndexByteArrayOp_Char :: PrimOp
IndexByteArrayOp_WideChar :: PrimOp
IndexByteArrayOp_Int :: PrimOp
IndexByteArrayOp_Word :: PrimOp
IndexByteArrayOp_Addr :: PrimOp
IndexByteArrayOp_Float :: PrimOp
IndexByteArrayOp_Double :: PrimOp
IndexByteArrayOp_StablePtr :: PrimOp
IndexByteArrayOp_Int8 :: PrimOp
IndexByteArrayOp_Int16 :: PrimOp
IndexByteArrayOp_Int32 :: PrimOp
IndexByteArrayOp_Int64 :: PrimOp
IndexByteArrayOp_Word8 :: PrimOp
IndexByteArrayOp_Word16 :: PrimOp
IndexByteArrayOp_Word32 :: PrimOp
IndexByteArrayOp_Word64 :: PrimOp
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
FetchAddByteArrayOp_Int :: PrimOp
FetchSubByteArrayOp_Int :: PrimOp
FetchAndByteArrayOp_Int :: PrimOp
FetchNandByteArrayOp_Int :: PrimOp
FetchOrByteArrayOp_Int :: PrimOp
FetchXorByteArrayOp_Int :: PrimOp
NewArrayArrayOp :: PrimOp
SameMutableArrayArrayOp :: PrimOp
UnsafeFreezeArrayArrayOp :: PrimOp
SizeofArrayArrayOp :: PrimOp
SizeofMutableArrayArrayOp :: PrimOp
IndexArrayArrayOp_ByteArray :: PrimOp
IndexArrayArrayOp_ArrayArray :: PrimOp
ReadArrayArrayOp_ByteArray :: PrimOp
ReadArrayArrayOp_MutableByteArray :: PrimOp
ReadArrayArrayOp_ArrayArray :: PrimOp
ReadArrayArrayOp_MutableArrayArray :: PrimOp
WriteArrayArrayOp_ByteArray :: PrimOp
WriteArrayArrayOp_MutableByteArray :: PrimOp
WriteArrayArrayOp_ArrayArray :: PrimOp
WriteArrayArrayOp_MutableArrayArray :: PrimOp
CopyArrayArrayOp :: PrimOp
CopyMutableArrayArrayOp :: PrimOp
AddrAddOp :: PrimOp
AddrSubOp :: PrimOp
AddrRemOp :: PrimOp
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
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
SameMutVarOp :: 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
SameTVarOp :: PrimOp
NewMVarOp :: PrimOp
TakeMVarOp :: PrimOp
TryTakeMVarOp :: PrimOp
PutMVarOp :: PrimOp
TryPutMVarOp :: PrimOp
ReadMVarOp :: PrimOp
TryReadMVarOp :: PrimOp
SameMVarOp :: PrimOp
IsEmptyMVarOp :: PrimOp
NewIOPortrOp :: PrimOp
ReadIOPortOp :: PrimOp
WriteIOPortOp :: PrimOp
SameIOPortOp :: PrimOp
DelayOp :: PrimOp
WaitReadOp :: PrimOp
WaitWriteOp :: PrimOp
ForkOp :: PrimOp
ForkOnOp :: PrimOp
KillThreadOp :: PrimOp
YieldOp :: PrimOp
MyThreadIdOp :: PrimOp
LabelThreadOp :: PrimOp
IsCurrentThreadBoundOp :: PrimOp
NoDuplicateOp :: PrimOp
ThreadStatusOp :: PrimOp
MkWeakOp :: PrimOp
MkWeakNoFinalizerOp :: PrimOp
AddCFinalizerToWeakOp :: PrimOp
DeRefWeakOp :: PrimOp
FinalizeWeakOp :: PrimOp
TouchOp :: PrimOp
MakeStablePtrOp :: PrimOp
DeRefStablePtrOp :: PrimOp
EqStablePtrOp :: PrimOp
MakeStableNameOp :: PrimOp
EqStableNameOp :: PrimOp
StableNameToIntOp :: PrimOp
CompactNewOp :: PrimOp
CompactResizeOp :: PrimOp
CompactContainsOp :: PrimOp
CompactContainsAnyOp :: PrimOp
CompactGetFirstBlockOp :: PrimOp
CompactGetNextBlockOp :: PrimOp
CompactAllocateBlockOp :: PrimOp
CompactFixupPointersOp :: PrimOp
CompactAdd :: PrimOp
CompactAddWithSharing :: PrimOp
CompactSize :: PrimOp
ReallyUnsafePtrEqualityOp :: PrimOp
ParOp :: PrimOp
SparkOp :: PrimOp
SeqOp :: PrimOp
GetSparkOp :: PrimOp
NumSparks :: PrimOp
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 -> ([TyVar], [Type], Type, Arity, StrictSig)
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
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
IfRecSelId :: Either IfaceTyCon IfaceDecl -> Bool -> IfaceIdDetails
IfDFunId :: IfaceIdDetails
data IfaceUnfolding
IfCoreUnfold :: Bool -> IfaceExpr -> IfaceUnfolding
IfCompulsory :: IfaceExpr -> IfaceUnfolding
IfInlineRule :: Arity -> Bool -> Bool -> IfaceExpr -> IfaceUnfolding
IfDFunUnfold :: [IfaceBndr] -> [IfaceExpr] -> IfaceUnfolding
data IfaceInfoItem
HsArity :: Arity -> IfaceInfoItem
HsStrictness :: StrictSig -> IfaceInfoItem
HsCpr :: CprSig -> IfaceInfoItem
HsInline :: InlinePragma -> IfaceInfoItem
HsUnfold :: Bool -> IfaceUnfolding -> IfaceInfoItem
HsNoCafRefs :: IfaceInfoItem
HsLevity :: IfaceInfoItem
HsLFInfo :: IfaceLFInfo -> 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,
--
-- -- 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 promoteSkolem :: TcLevel -> TcTyVar -> TcTyVar -- | Change the TcLevel in a skolem, extending a substitution promoteSkolemX :: TcLevel -> TCvSubst -> TcTyVar -> (TCvSubst, TcTyVar) promoteSkolemsX :: TcLevel -> TCvSubst -> [TcTyVar] -> (TCvSubst, [TcTyVar]) data TcTyVarDetails SkolemTv :: 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 vanillaSkolemTv :: TcTyVarDetails superSkolemTv :: TcTyVarDetails data MetaDetails Flexi :: MetaDetails Indirect :: TcType -> MetaDetails data MetaInfo TauTv :: MetaInfo TyVarTv :: MetaInfo RuntimeUnkTv :: MetaInfo CycleBreakerTv :: MetaInfo 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 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 -- or PredTypes, but it does look through type synonyms. This -- first checks that the kinds of the types are equal and then checks -- whether the types are equal, ignoring casts and coercions. (The kind -- check is a recursive call, but since all kinds have type -- Type, there is no need to check the types of kinds.) See also -- Note [Non-trivial definitional equality] in 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 -- | Does a type represent a floating-point number? isFloatingTy :: Type -> Bool isDoubleTy :: Type -> Bool isFloatTy :: Type -> Bool isIntTy :: Type -> Bool isWordTy :: Type -> Bool -- | Is a type String? isStringTy :: Type -> Bool isIntegerTy :: Type -> Bool isNaturalTy :: Type -> Bool isBoolTy :: Type -> Bool isUnitTy :: Type -> Bool isCharTy :: Type -> Bool -- | Is a type a CallStack? isCallStackTy :: Type -> Bool -- | Is a PredType a CallStack implicit parameter? -- -- If so, return the name of the parameter. isCallStackPred :: Class -> [Type] -> Maybe FastString 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 mkMinimalBySCs :: forall a. (a -> PredType) -> [a] -> [a] transSuperClasses :: PredType -> [PredType] -- | When inferring types, should we quantify over a given predicate? -- Generally true of classes; generally false of equality constraints. -- Equality constraints that mention quantified type variables and -- implicit variables complicate the story. See Notes [Inheriting -- implicit parameters] and [Quantifying over equality constraints] pickQuantifiablePreds :: TyVarSet -> TcThetaType -> TcThetaType pickCapturedPreds :: TyVarSet -> TcThetaType -> TcThetaType immSuperClasses :: Class -> [Type] -> [PredType] 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 :: Bool -> EqRel -> (EqRel -> TcTyVar -> Bool) -> TcType -> Bool anyRewritableTyFamApp :: EqRel -> (EqRel -> TyCon -> [TcType] -> Bool) -> TcType -> Bool anyRewritableCanEqLHS :: EqRel -> (EqRel -> TcTyVar -> Bool) -> (EqRel -> TyCon -> [TcType] -> Bool) -> TcType -> Bool isFFIArgumentTy :: DynFlags -> Safety -> Type -> Validity isFFIImportResultTy :: DynFlags -> Type -> Validity isFFIExportResultTy :: Type -> Validity isFFIExternalTy :: Type -> Validity isFFIDynTy :: Type -> Type -> Validity isFFIPrimArgumentTy :: DynFlags -> Type -> Validity isFFIPrimResultTy :: DynFlags -> Type -> Validity isFFILabelTy :: Type -> Validity isFFITy :: Type -> Bool isFunPtrTy :: Type -> Bool tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type) -- | The key type representing kinds in the compiler. type Kind = Type tcTypeKind :: HasDebugCallStack => Type -> Kind liftedTypeKind :: Kind 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 levity-polymorphic -- kinds, which may be specialized to a kind that classifies unlifted -- types. isUnliftedTypeKind :: Kind -> Bool -- | Does this classify a type allowed to have values? Responds True to -- things like *, #, TYPE Lifted, TYPE v, Constraint. -- -- True of any sub-kind of OpenTypeKind classifiesTypeWithValues :: Kind -> Bool data Type -- | A type of the form p of 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: -- --
-- 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
-- | Create the plain type constructor type which has been applied to no
-- type arguments at all.
mkTyConTy :: TyCon -> Type
mkTyVarTy :: TyVar -> Type
mkTyVarTys :: [TyVar] -> [Type]
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
-- | Tests whether the given kind (which should look like TYPE x)
-- is something other than a constructor tree (that is, constructors at
-- every node). E.g. True of TYPE k, TYPE (F Int) False of TYPE
-- 'LiftedRep
isKindLevPoly :: 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:
--
-- -- 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 :: 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 -- | Is this expression levity polymorphic? This should be the same as -- saying (isKindLevPoly . typeKind . exprType) but much faster. isExprLevPoly :: CoreExpr -> Bool 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: -- --
-- 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:
--
--
-- 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
-- | 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
eqExpr :: InScopeSet -> CoreExpr -> CoreExpr -> Bool
-- | Finds differences between core expressions, modulo alpha and renaming.
-- Setting top means that the IdInfo of bindings will
-- be checked for differences as well.
diffExpr :: Bool -> RnEnv2 -> CoreExpr -> CoreExpr -> [SDoc]
-- | Finds differences between core bindings, see diffExpr.
--
-- The main problem here is that while we expect the binds to have the
-- same order in both lists, this is not guaranteed. To do this properly
-- we'd either have to do some sort of unification or check all possible
-- mappings, which would be seriously expensive. So instead we simply
-- match single bindings as far as we can. This leaves us just with
-- mutually recursive and/or mismatching bindings, which we then
-- speculatively match by ordering them. It's by no means perfect, but
-- gets the job done well enough.
diffBinds :: Bool -> RnEnv2 -> [(Var, CoreExpr)] -> [(Var, CoreExpr)] -> ([SDoc], RnEnv2)
tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr
zapLamBndrs :: FullArgCount -> [Var] -> [Var]
-- | If the expression is a Type, converts. Otherwise, panics. NB:
-- This does not convert Coercion to CoercionTy.
exprToType :: CoreExpr -> Type
-- | If the expression is a Coercion, converts.
exprToCoercion_maybe :: CoreExpr -> Maybe Coercion
-- | A more efficient version of applyTypeToArg when we have several
-- arguments. The first argument is just for debugging, and gives some
-- context
applyTypeToArgs :: CoreExpr -> Type -> [CoreExpr] -> Type
-- | Determines the type resulting from applying an expression with given
-- type to a given argument expression
applyTypeToArg :: Type -> CoreExpr -> Type
dataConRepInstPat :: [Unique] -> 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
-- | 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
isUnsafeEqualityProof :: CoreExpr -> Bool
dumpIdInfoOfProgram :: (IdInfo -> SDoc) -> CoreProgram -> SDoc
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 -> 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
[unfoldingCaseThreshold] :: UnfoldingOpts -> !Int
[unfoldingCaseScaling] :: UnfoldingOpts -> !Int
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
data ArgSummary
TrivArg :: ArgSummary
NonTrivArg :: ArgSummary
ValueArg :: ArgSummary
couldBeSmallEnoughToInline :: UnfoldingOpts -> Int -> CoreExpr -> Bool
inlineBoringOk :: CoreExpr -> Bool
-- | Sees if the unfolding is pretty certain to inline. If so, return a
-- *stable* unfolding for it, that will always inline.
certainlyWillInline :: UnfoldingOpts -> IdInfo -> Maybe Unfolding
smallEnoughToInline :: UnfoldingOpts -> Unfolding -> Bool
callSiteInline :: Logger -> DynFlags -> 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.Core.Subst
-- | A substitution environment, containing Id, TyVar, and
-- CoVar substitutions.
--
-- Some invariants apply to how you use the substitution:
--
-- -- e' = etaExpand n e ---- -- We should have that: -- --
-- ty = exprType e = exprType e' --etaExpand :: Arity -> CoreExpr -> CoreExpr etaExpandAT :: ArityType -> CoreExpr -> CoreExpr exprBotStrictness_maybe :: CoreExpr -> Maybe (Arity, StrictSig) -- | 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 :: 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 occurAnalyseExpr :: CoreExpr -> 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 -> StrictSig -> 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 mkWwInlineRule :: 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 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 -> 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 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.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 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.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 -> Maybe StringLiteral -> 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 -> Maybe StringLiteral -- | 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 -- --
-- (?x :: ty) ---- --
-- (ty :: kind) ---- --
-- 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
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
-- | -- f :: Int -> forall a. a -> a -- f x y = y ---- -- Then the MatchGroup will have type (Int -> a' -> a') (with a -- free type variable a'). The coercion will take a CoreExpr of this type -- and convert it to a CoreExpr of type Int -> forall a'. a' -> a' -- Notice that the coercion captures the free a'. [fun_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 -- | See Note [Bind free vars] [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 -- | Abstraction Bindings AbsBinds :: XAbsBinds idL idR -> [TyVar] -> [EvVar] -> [ABExport idL] -> [TcEvBinds] -> LHsBinds idL -> Bool -> HsBindLR idL idR [abs_ext] :: HsBindLR idL idR -> XAbsBinds idL idR [abs_tvs] :: HsBindLR idL idR -> [TyVar] -- | Includes equality constraints [abs_ev_vars] :: HsBindLR idL idR -> [EvVar] -- | AbsBinds only gets used when idL = idR after renaming, but these need -- to be idL's for the collect... code in HsUtil to have the right type [abs_exports] :: HsBindLR idL idR -> [ABExport idL] -- | Evidence bindings Why a list? See GHC.Tc.TyCl.Instance Note -- [Typechecking plan for instance declarations] [abs_ev_binds] :: HsBindLR idL idR -> [TcEvBinds] -- | Typechecked user bindings [abs_binds] :: HsBindLR idL idR -> LHsBinds idL [abs_sig] :: HsBindLR idL idR -> Bool -- |
-- 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. -- --
-- pattern Single :: () => (Show a) => a -> [a] ---- --
-- infixl 8 *** ---- --
-- {#- INLINE f #-}
--
--
--
-- {-# SPECIALISE f :: Int -> Int #-}
--
--
--
-- {-# SPECIALISE instance Eq [Int] #-}
--
--
-- (Class tys); should be a specialisation of the current instance
-- declaration
--
--
-- {-# MINIMAL a | (b, c | (d | e)) #-}
--
--
--
-- {-# 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
-- | Type checker Specialisation Pragmas
--
-- TcSpecPrags conveys SPECIALISE pragmas from the type
-- checker to the desugarer
data TcSpecPrags
-- | Super-specialised: a default method should be macro-expanded at every
-- call site
IsDefaultMethod :: TcSpecPrags
SpecPrags :: [LTcSpecPrag] -> TcSpecPrags
-- | Located Type checker Specification Pragmas
type LTcSpecPrag = Located TcSpecPrag
-- | Type checker Specification Pragma
data TcSpecPrag
-- | The Id to be specialised, a wrapper that specialises the polymorphic
-- function, and inlining spec for the specialised function
SpecPrag :: Id -> HsWrapper -> InlinePragma -> TcSpecPrag
noSpecPrags :: TcSpecPrags
hasSpecPrags :: TcSpecPrags -> Bool
isDefaultMethod :: TcSpecPrags -> Bool
isFixityLSig :: 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
-- | 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 Data.Data.Data Language.Haskell.Syntax.Binds.TcSpecPrag
instance Data.Data.Data Language.Haskell.Syntax.Binds.TcSpecPrags
instance 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 -> 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 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 :: *->* ---- --
-- 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) -- |
-- -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 -- |
-- 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 ---- --
-- 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) --ParensT :: Type -> Type -- |
-- (,), (,,), etc. --TupleT :: Int -> Type -- |
-- (#,#), (#,,#), etc. --UnboxedTupleT :: Int -> Type -- |
-- (#|#), (#||#), etc. --UnboxedSumT :: SumArity -> Type -- |
-- -> --ArrowT :: Type -- |
-- FUN --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:
--
-- -- data Foo a = forall b. MkFoo a b -- ---- -- In MkFoo, ForallC will quantify b, but not -- a. -- --
-- data Bar a b where -- MkBar :: (a ~ b) => c -> MkBar a b -- ---- -- In MkBar, ForallC will quantify a, -- b, and c. 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
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: -- --
-- -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 Overlappable 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
-- |
-- { {-# 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 Maybe someday: , bytesAlignement :: Word -- ^
-- Alignement constraint , bytesReadOnly :: Bool -- ^ Shall we embed into
-- a read-only -- section or not , bytesInitialized :: Bool -- ^ False:
-- only use bytesSize to allocate -- an uninitialized region
[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:
--
-- -- 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
--
--
-- Levity-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:
--
-- -- >>> 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" ||]) ---- -- Levity-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. -- --
-- 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 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 -- -- Levity-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. -- -- Levity-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 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 -- | 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. -- --
-- 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? 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 -- | 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: -- --
-- {-# LANGUAGE CPP #-}
-- ...
-- addForeignSource LangC $ unlines
-- [ "#line " ++ show (691 + 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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_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 pprUInfixT :: 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 commaSep :: Ppr a => [a] -> Doc commaSepWith :: (a -> Doc) -> [a] -> Doc semiSep :: Ppr a => [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 -- | Levity-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 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 -> 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 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 -- | Levity-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 infixT :: Quote m => m Type -> Name -> m Type -> m Type mulArrowT :: Quote m => m Type uInfixT :: 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 Overlappable 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 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. -- --
-- 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 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 -- | 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: -- --
-- 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: -- --
-- >>> 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" ||]) ---- -- Levity-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): -- --
-- 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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. -- --
-- >>> 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
-- |
-- { {-# 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:
--
-- -- data Foo a = forall b. MkFoo a b -- ---- -- In MkFoo, ForallC will quantify b, but not -- a. -- --
-- data Bar a b where -- MkBar :: (a ~ b) => c -> MkBar a b -- ---- -- In MkBar, ForallC will quantify a, -- b, and c. 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
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) --ParensT :: Type -> Type -- |
-- (,), (,,), etc. --TupleT :: Int -> Type -- |
-- (#,#), (#,,#), etc. --UnboxedTupleT :: Int -> Type -- |
-- (#|#), (#||#), etc. --UnboxedSumT :: SumArity -> Type -- |
-- -> --ArrowT :: Type -- |
-- FUN --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: -- --
-- 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 newtype FieldLabelStrings p FieldLabelStrings :: [Located (HsFieldLabel p)] -> FieldLabelStrings p pprFieldLabelStrings :: FieldLabelStrings p -> SDoc type RecProj p arg = HsRecField' (FieldLabelStrings 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 -- | After typechecker only; must be different HsVar for pretty printing HsConLikeOut :: XConLikeOut p -> ConLike -> HsExpr p -- | Variable pointing to record selector The parser produces HsVars The -- renamer renames record-field selectors to HsRecFld The typechecker -- preserves HsRecFld HsRecFld :: XRecFld p -> AmbiguousFieldOcc 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 -- --
-- (?x :: ty) ---- --
-- (ty :: kind) ---- --
-- 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
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
-- | -- 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: -- --
-- 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 :: *->* ---- --
-- 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) -- |
-- -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 -- |
-- 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 ---- --
-- 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_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 -- | 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) => HsStmtContext any -> [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 pprHsBracket :: OutputableBndrId p => HsBracket (GhcPass p) -> SDoc thBrackets :: SDoc -> SDoc -> SDoc thTyBrackets :: SDoc -> SDoc pp_dotdot :: SDoc matchContextErrString :: OutputableBndrId p => HsMatchContext (GhcPass p) -> SDoc matchArrowContextErrString :: HsArrowMatchContext -> SDoc pprMatchInCtxt :: (OutputableBndrId idR, Outputable body) => Match (GhcPass idR) body -> SDoc pprStmtInCtxt :: (OutputableBndrId idL, OutputableBndrId idR, Outputable body, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA) => HsStmtContext (GhcPass idL) -> 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.AnnsLet 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 a, Data.Data.Data b) => Data.Data.Data (GHC.Hs.Expr.HsExpansion a b) 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 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.HsBracket (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.Parser.Errors -- | A warning that might arise during parsing. data PsWarning -- | Warn when tabulations are found PsWarnTab :: !SrcSpan -> !Word -> PsWarning -- | First occurrence of a tab [tabFirst] :: PsWarning -> !SrcSpan -- | Number of other occurrences [tabCount] :: PsWarning -> !Word -- | Transitional layout warnings PsWarnTransitionalLayout :: !SrcSpan -> !TransLayoutReason -> PsWarning -- | Unrecognised pragma PsWarnUnrecognisedPragma :: !SrcSpan -> PsWarning -- | Invalid Haddock comment position PsWarnHaddockInvalidPos :: !SrcSpan -> PsWarning -- | Multiple Haddock comment for the same entity PsWarnHaddockIgnoreMulti :: !SrcSpan -> PsWarning -- | Found binding occurrence of "*" while StarIsType is enabled PsWarnStarBinder :: !SrcSpan -> PsWarning -- | Using "*" for Type without StarIsType enabled PsWarnStarIsType :: !SrcSpan -> PsWarning -- | Pre qualified import with WarnPrepositiveQualifiedModule -- enabled PsWarnImportPreQualified :: !SrcSpan -> PsWarning PsWarnOperatorWhitespaceExtConflict :: !SrcSpan -> !OperatorWhitespaceSymbol -> PsWarning PsWarnOperatorWhitespace :: !SrcSpan -> !FastString -> !OperatorWhitespaceOccurrence -> PsWarning 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 -- | The operator symbol in the WarnOperatorWhitespaceExtConflict -- warning. data OperatorWhitespaceSymbol OperatorWhitespaceSymbol_PrefixPercent :: OperatorWhitespaceSymbol OperatorWhitespaceSymbol_PrefixDollar :: OperatorWhitespaceSymbol OperatorWhitespaceSymbol_PrefixDollarDollar :: OperatorWhitespaceSymbol -- | The operator occurrence type in the WarnOperatorWhitespace -- warning. data OperatorWhitespaceOccurrence OperatorWhitespaceOccurrence_Prefix :: OperatorWhitespaceOccurrence OperatorWhitespaceOccurrence_Suffix :: OperatorWhitespaceOccurrence OperatorWhitespaceOccurrence_TightInfix :: OperatorWhitespaceOccurrence data NumUnderscoreReason NumUnderscore_Integral :: NumUnderscoreReason NumUnderscore_Float :: NumUnderscoreReason data PsError PsError :: !PsErrorDesc -> ![Hint] -> !SrcSpan -> PsError -- | Error description [errDesc] :: PsError -> !PsErrorDesc -- | Hints [errHints] :: PsError -> ![Hint] -- | Error position [errLoc] :: PsError -> !SrcSpan data PsErrorDesc -- | LambdaCase syntax used without the extension enabled PsErrLambdaCase :: PsErrorDesc -- | Underscores in literals without the extension enabled PsErrNumUnderscores :: !NumUnderscoreReason -> PsErrorDesc -- | Invalid character in primitive string PsErrPrimStringInvalidChar :: PsErrorDesc -- | Missing block PsErrMissingBlock :: PsErrorDesc -- | Lexer error PsErrLexer :: !LexErr -> !LexErrKind -> PsErrorDesc -- | Suffix occurrence of `@` PsErrSuffixAT :: PsErrorDesc -- | Parse errors PsErrParse :: !String -> PsErrorDesc -- | Cmm lexer error PsErrCmmLexer :: PsErrorDesc -- | Unsupported boxed sum in expression PsErrUnsupportedBoxedSumExpr :: !SumOrTuple (HsExpr GhcPs) -> PsErrorDesc -- | Unsupported boxed sum in pattern PsErrUnsupportedBoxedSumPat :: !SumOrTuple (PatBuilder GhcPs) -> PsErrorDesc -- | Unexpected qualified constructor PsErrUnexpectedQualifiedConstructor :: !RdrName -> PsErrorDesc -- | Tuple section in pattern context PsErrTupleSectionInPat :: PsErrorDesc -- | Bang-pattern without BangPattterns enabled PsErrIllegalBangPattern :: !Pat GhcPs -> PsErrorDesc -- | Operator applied to too few arguments PsErrOpFewArgs :: !StarIsType -> !RdrName -> PsErrorDesc -- | Import: multiple occurrences of qualified PsErrImportQualifiedTwice :: PsErrorDesc -- | Post qualified import without ImportQualifiedPost PsErrImportPostQualified :: PsErrorDesc -- | Explicit namespace keyword without ExplicitNamespaces PsErrIllegalExplicitNamespace :: PsErrorDesc -- | Expecting a type constructor but found a variable PsErrVarForTyCon :: !RdrName -> PsErrorDesc -- | Illegal export form allowed by PatternSynonyms PsErrIllegalPatSynExport :: PsErrorDesc -- | Malformed entity string PsErrMalformedEntityString :: PsErrorDesc -- | Dots used in record update PsErrDotsInRecordUpdate :: PsErrorDesc -- | Precedence out of range PsErrPrecedenceOutOfRange :: !Int -> PsErrorDesc -- | Invalid use of record dot syntax . PsErrOverloadedRecordDotInvalid :: PsErrorDesc -- | OverloadedRecordUpdate is not enabled. PsErrOverloadedRecordUpdateNotEnabled :: PsErrorDesc -- | Can't use qualified fields when OverloadedRecordUpdate is enabled. PsErrOverloadedRecordUpdateNoQualifiedFields :: PsErrorDesc -- | Cannot parse data constructor in a data/newtype declaration PsErrInvalidDataCon :: !HsType GhcPs -> PsErrorDesc -- | Cannot parse data constructor in a data/newtype declaration PsErrInvalidInfixDataCon :: !HsType GhcPs -> !RdrName -> !HsType GhcPs -> PsErrorDesc -- | UNPACK applied to a data constructor PsErrUnpackDataCon :: PsErrorDesc -- | Unexpected kind application in data/newtype declaration PsErrUnexpectedKindAppInDataCon :: !DataConBuilder -> !HsType GhcPs -> PsErrorDesc -- | Not a record constructor PsErrInvalidRecordCon :: !PatBuilder GhcPs -> PsErrorDesc -- | Illegal unboxed string literal in pattern PsErrIllegalUnboxedStringInPat :: !HsLit GhcPs -> PsErrorDesc -- | Do-notation in pattern PsErrDoNotationInPat :: PsErrorDesc -- | If-then-else syntax in pattern PsErrIfTheElseInPat :: PsErrorDesc -- | Lambda-case in pattern PsErrLambdaCaseInPat :: PsErrorDesc -- | case..of in pattern PsErrCaseInPat :: PsErrorDesc -- | let-syntax in pattern PsErrLetInPat :: PsErrorDesc -- | Lambda-syntax in pattern PsErrLambdaInPat :: PsErrorDesc -- | Arrow expression-syntax in pattern PsErrArrowExprInPat :: !HsExpr GhcPs -> PsErrorDesc -- | Arrow command-syntax in pattern PsErrArrowCmdInPat :: !HsCmd GhcPs -> PsErrorDesc -- | Arrow command-syntax in expression PsErrArrowCmdInExpr :: !HsCmd GhcPs -> PsErrorDesc -- | View-pattern in expression PsErrViewPatInExpr :: !LHsExpr GhcPs -> !LHsExpr GhcPs -> PsErrorDesc -- | Type-application without space before '@' PsErrTypeAppWithoutSpace :: !RdrName -> !LHsExpr GhcPs -> PsErrorDesc -- | Lazy-pattern ('~') without space after it PsErrLazyPatWithoutSpace :: !LHsExpr GhcPs -> PsErrorDesc -- | Bang-pattern (!) without space after it PsErrBangPatWithoutSpace :: !LHsExpr GhcPs -> PsErrorDesc -- | Pragma not allowed in this position PsErrUnallowedPragma :: !HsPragE GhcPs -> PsErrorDesc -- | Qualified do block in command PsErrQualifiedDoInCmd :: !ModuleName -> PsErrorDesc -- | Invalid infix hole, expected an infix operator PsErrInvalidInfixHole :: PsErrorDesc -- | Unexpected semi-colons in conditional expression PsErrSemiColonsInCondExpr :: !HsExpr GhcPs -> !Bool -> !HsExpr GhcPs -> !Bool -> !HsExpr GhcPs -> PsErrorDesc -- | Unexpected semi-colons in conditional command PsErrSemiColonsInCondCmd :: !HsExpr GhcPs -> !Bool -> !HsCmd GhcPs -> !Bool -> !HsCmd GhcPs -> PsErrorDesc -- | @-operator in a pattern position PsErrAtInPatPos :: PsErrorDesc -- | Unexpected lambda command in function application PsErrLambdaCmdInFunAppCmd :: !LHsCmd GhcPs -> PsErrorDesc -- | Unexpected case command in function application PsErrCaseCmdInFunAppCmd :: !LHsCmd GhcPs -> PsErrorDesc -- | Unexpected if command in function application PsErrIfCmdInFunAppCmd :: !LHsCmd GhcPs -> PsErrorDesc -- | Unexpected let command in function application PsErrLetCmdInFunAppCmd :: !LHsCmd GhcPs -> PsErrorDesc -- | Unexpected do command in function application PsErrDoCmdInFunAppCmd :: !LHsCmd GhcPs -> PsErrorDesc -- | Unexpected do block in function application PsErrDoInFunAppExpr :: !Maybe ModuleName -> !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected mdo block in function application PsErrMDoInFunAppExpr :: !Maybe ModuleName -> !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected lambda expression in function application PsErrLambdaInFunAppExpr :: !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected case expression in function application PsErrCaseInFunAppExpr :: !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected lambda-case expression in function application PsErrLambdaCaseInFunAppExpr :: !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected let expression in function application PsErrLetInFunAppExpr :: !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected if expression in function application PsErrIfInFunAppExpr :: !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected proc expression in function application PsErrProcInFunAppExpr :: !LHsExpr GhcPs -> PsErrorDesc -- | Malformed head of type or class declaration PsErrMalformedTyOrClDecl :: !LHsType GhcPs -> PsErrorDesc -- | Illegal 'where' keyword in data declaration PsErrIllegalWhereInDataDecl :: PsErrorDesc -- | Illegal datatyp context PsErrIllegalDataTypeContext :: !LHsContext GhcPs -> PsErrorDesc -- | Parse error on input PsErrParseErrorOnInput :: !OccName -> PsErrorDesc -- | Malformed ... declaration for ... PsErrMalformedDecl :: !SDoc -> !RdrName -> PsErrorDesc -- | Unexpected type application in a declaration PsErrUnexpectedTypeAppInDecl :: !LHsType GhcPs -> !SDoc -> !RdrName -> PsErrorDesc -- | Not a data constructor PsErrNotADataCon :: !RdrName -> PsErrorDesc -- | Record syntax used in pattern synonym declaration PsErrRecordSyntaxInPatSynDecl :: !LPat GhcPs -> PsErrorDesc -- | Empty 'where' clause in pattern-synonym declaration PsErrEmptyWhereInPatSynDecl :: !RdrName -> PsErrorDesc -- | Invalid binding name in 'where' clause of pattern-synonym declaration PsErrInvalidWhereBindInPatSynDecl :: !RdrName -> !HsDecl GhcPs -> PsErrorDesc -- | Multiple bindings in 'where' clause of pattern-synonym declaration PsErrNoSingleWhereBindInPatSynDecl :: !RdrName -> !HsDecl GhcPs -> PsErrorDesc -- | Declaration splice not a top-level PsErrDeclSpliceNotAtTopLevel :: !SpliceDecl GhcPs -> PsErrorDesc -- | Inferred type variables not allowed here PsErrInferredTypeVarNotAllowed :: PsErrorDesc -- | Multiple names in standalone kind signatures PsErrMultipleNamesInStandaloneKindSignature :: [LIdP GhcPs] -> PsErrorDesc -- | Illegal import bundle form PsErrIllegalImportBundleForm :: PsErrorDesc -- | Illegal role name PsErrIllegalRoleName :: !FastString -> [Role] -> PsErrorDesc -- | Invalid type signature PsErrInvalidTypeSignature :: !LHsExpr GhcPs -> PsErrorDesc -- | Unexpected type in declaration PsErrUnexpectedTypeInDecl :: !LHsType GhcPs -> !SDoc -> !RdrName -> [LHsTypeArg GhcPs] -> !SDoc -> PsErrorDesc -- | Expected a hyphen PsErrExpectedHyphen :: PsErrorDesc -- | Found a space in a SCC PsErrSpaceInSCC :: PsErrorDesc -- | Found two single quotes PsErrEmptyDoubleQuotes :: !Bool -> PsErrorDesc -- | Invalid package name PsErrInvalidPackageName :: !FastString -> PsErrorDesc -- | Invalid rule activation marker PsErrInvalidRuleActivationMarker :: PsErrorDesc -- | Linear function found but LinearTypes not enabled PsErrLinearFunction :: PsErrorDesc -- | Multi-way if-expression found but MultiWayIf not enabled PsErrMultiWayIf :: PsErrorDesc -- | Explicit forall found but no extension allowing it is enabled PsErrExplicitForall :: !Bool -> PsErrorDesc -- | Found qualified-do without QualifiedDo enabled PsErrIllegalQualifiedDo :: !SDoc -> PsErrorDesc -- | Cmm parser error PsErrCmmParser :: !CmmParserError -> PsErrorDesc -- | Illegal traditional record syntax -- -- TODO: distinguish errors without using SDoc PsErrIllegalTraditionalRecordSyntax :: !SDoc -> PsErrorDesc -- | Parse error in command -- -- TODO: distinguish errors without using SDoc PsErrParseErrorInCmd :: !SDoc -> PsErrorDesc -- | Parse error in pattern -- -- TODO: distinguish errors without using SDoc PsErrParseErrorInPat :: !SDoc -> PsErrorDesc data LexErr -- | Lexical error LexError :: LexErr -- | Unknown pragma LexUnknownPragma :: LexErr -- | Lexical error in pragma LexErrorInPragma :: LexErr -- | Numeric escape sequence out of range LexNumEscapeRange :: LexErr -- | Llexical 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 LexErrKind -- | End of input LexErrKind_EOF :: LexErrKind -- | UTF-8 decoding error LexErrKind_UTF8 :: LexErrKind -- | Error at given character LexErrKind_Char :: !Char -> LexErrKind data Hint SuggestTH :: Hint SuggestRecursiveDo :: Hint SuggestDo :: Hint SuggestMissingDo :: Hint SuggestLetInDo :: Hint SuggestPatternSynonyms :: Hint SuggestInfixBindMaybeAtPat :: !RdrName -> Hint -- | Type applications in patterns are only allowed on data constructors TypeApplicationsInPatternsOnlyDataCons :: Hint newtype StarIsType StarIsType :: Bool -> StarIsType instance GHC.Classes.Ord GHC.Parser.Errors.NumUnderscoreReason instance GHC.Classes.Eq GHC.Parser.Errors.NumUnderscoreReason instance GHC.Show.Show GHC.Parser.Errors.NumUnderscoreReason instance GHC.Classes.Ord GHC.Parser.Errors.LexErrKind instance GHC.Classes.Eq GHC.Parser.Errors.LexErrKind instance GHC.Show.Show GHC.Parser.Errors.LexErrKind 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 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 -- | something beginning -- | ITdocCommentNext :: String -> PsSpan -> Token -- | something beginning -- ^ ITdocCommentPrev :: String -> PsSpan -> Token -- | something beginning -- $ ITdocCommentNamed :: String -> PsSpan -> Token -- | a section heading ITdocSection :: Int -> String -> 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 :: EnumSet WarningFlag -> !ExtsBitmap -> ParserOpts -- | enabled warning flags [pWarningFlags] :: ParserOpts -> EnumSet WarningFlag -- | bitmap of permitted extensions [pExtsBitmap] :: ParserOpts -> !ExtsBitmap -- | Given exactly the information needed, set up the ParserOpts mkParserOpts :: EnumSet WarningFlag -> EnumSet Extension -> Bool -> Bool -> Bool -> Bool -> ParserOpts data PState PState :: StringBuffer -> ParserOpts -> Bag PsWarning -> Bag PsError -> 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 (RealSrcSpan, RealSrcSpan) -> Maybe [LEpaComment] -> [LEpaComment] -> OrdList (PsLocated HdkComment) -> PState [buffer] :: PState -> StringBuffer [options] :: PState -> ParserOpts [warnings] :: PState -> Bag PsWarning [errors] :: PState -> Bag PsError [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 (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 getMessages to check for accumulated -- warnings and non-fatal errors. POk :: PState -> a -> ParseResult a -- | The parser has consumed a (possibly empty) prefix of the input and -- failed. 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 => PsError -> m () -- | Add a warning to the accumulator. Use getMessages to get the -- accumulated warnings. addWarning :: MonadP m => WarningFlag -> PsWarning -> 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 => PsError -> 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 -> PsError) -> P a failLocMsgP :: RealSrcLoc -> RealSrcLoc -> (SrcSpan -> PsError) -> P a srcParseFail :: P a -- | Get a bag of the errors that have been accumulated so far. Does not -- take -Werror into account. getErrorMessages :: PState -> Bag PsError -- | Get the warnings and errors accumulated so far. Does not take -Werror -- into account. getMessages :: PState -> (Bag PsWarning, Bag PsError) 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 UnboxedTuplesBit :: ExtBits UnboxedSumsBit :: 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 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 (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. 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 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.Errors.Ppr pprWarning :: PsWarning -> MsgEnvelope DecoratedSDoc pprError :: PsError -> MsgEnvelope DecoratedSDoc -- | 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)))) ~ SrcSpan, 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)))) ~ SrcSpan) => HsMatchContext (NoGhcTc (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)))) ~ SrcSpan => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn -> GRHSs (GhcPass p) (LocatedA (body (GhcPass p))) unguardedRHS :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan => 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 (NoGhcTc (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 -- | Avoid HsWrap co1 (HsWrap co2 _) and -- HsWrap co1 (HsPar _ _) See Note [Detecting -- forced eta expansion] in GHC.HsToCore.Expr 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 :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs mkHsDoAnns :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> EpAnn AnnList -> HsExpr GhcPs mkHsComp :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs mkHsCompAnns :: HsStmtContext GhcRn -> [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 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 :: HsStmtContext GhcRn -> [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 :: Data (HsLocalBinds (GhcPass p)) => 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 :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpAnn [AddEpAnn] -> Pat GhcPs mkNPlusKPat :: LocatedN RdrName -> Located (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) (GhcPass 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 => Proxy p -> CollectFlag p -> XXPat p -> [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 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 sortQuantVars :: [Var] -> [Var] castBottomExpr :: CoreExpr -> Type -> 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 :: Integer -> CoreExpr -- | Create a CoreExpr which will evaluate to the given -- Natural mkNaturalExpr :: 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 :: Monad m => (Name -> m Id) -> FastString -> m CoreExpr 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 :: InScopeEnv -> CoreExpr -> Maybe (Var, CoreExpr, [CoreTickish])
instance GHC.Utils.Outputable.Outputable GHC.Core.SimpleOpt.SimpleOptEnv
-- | Subsystem configuration
module GHC.Driver.Config
-- | Initialise coercion optimiser configuration from DynFlags
initOptCoercionOpts :: DynFlags -> OptCoercionOpts
-- | Initialise Simple optimiser configuration from DynFlags
initSimpleOpts :: DynFlags -> SimpleOpts
-- | Extracts the flag information needed for parsing
initParserOpts :: DynFlags -> ParserOpts
-- | 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.Types.Id.Make
mkDictFunId :: Name -> [TyVar] -> ThetaType -> Class -> [Type] -> Id
mkDictFunTy :: [TyVar] -> ThetaType -> Class -> [Type] -> Type
mkDictSelId :: Name -> Class -> Id
mkDictSelRhs :: Class -> Int -> CoreExpr
mkPrimOpId :: PrimOp -> Id
mkFCallId :: DynFlags -> Unique -> ForeignCall -> Type -> Id
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 :: DynFlags -> FamInstEnvs -> Name -> Maybe [HsImplBang] -> DataCon -> UniqSM DataConRep
mkDataConWorkId :: Name -> DataCon -> Id
wiredInIds :: [Id]
ghcPrimIds :: [Id]
realWorldPrimId :: Id
voidPrimId :: Id
voidArgId :: Id
nullAddrId :: Id
seqId :: Id
lazyId :: Id
lazyIdKey :: Unique
coercionTokenId :: Id
magicDictId :: 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
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 (Language.Haskell.Syntax.Binds.ABExport GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.ABExport GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Binds.ABExport GHC.Hs.Extension.GhcTc)
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.HsFieldLabel GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsFieldLabel GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsFieldLabel 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.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.HsBracket GHC.Hs.Extension.GhcPs)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsBracket GHC.Hs.Extension.GhcRn)
instance Data.Data.Data (Language.Haskell.Syntax.Expr.HsBracket GHC.Hs.Extension.GhcTc)
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 (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.CoPat
instance Data.Data.Data GHC.Hs.Pat.ConPatTc
instance Data.Data.Data GHC.Hs.Pat.ListPatTc
instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Language.Haskell.Syntax.Pat.HsRecField' 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.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.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
--
-- -- 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) 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: -- --
-- (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_hints :: [Hint] -> PV (LocatedA (PatBuilder GhcPs)) -> P (LPat GhcPs) -- | Check for monad comprehensions -- -- If the flag MonadComprehensions is set, return a MonadComp -- context, otherwise use the usual ListComp context checkMonadComp :: PV (HsStmtContext GhcRn) 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 = Located 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 => PsError -> 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 :: IsUnicodeSyntax -> Located Token -> LHsType GhcPs -> HsArrow GhcPs 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 [Located (HsFieldLabel 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 -> HsLocalBinds GhcPs -> LocatedA b -> AnnsLet -> 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 -> LocatedA b -> AnnParen -> 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 => Located (HsOverLit GhcPs) -> PV (Located 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 -- | 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 data BlankSrcSpan BlankSrcSpan :: BlankSrcSpan BlankSrcSpanFile :: BlankSrcSpan NoBlankSrcSpan :: BlankSrcSpan 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 -> IndefUnitId -> HsComponentId [hsPackageName] :: HsComponentId -> PackageName [hsComponentId] :: HsComponentId -> IndefUnitId 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 -> Maybe (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: -- --
-- 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 => WarnReason -> Severity -> 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 warnings. logWarnings :: GhcMonad m => WarningMessages -> m () -- | Print the error message and all warnings. Useful inside exception -- handlers. Clears warnings after printing. printException :: GhcMonad m => SourceError -> m () -- | A function called to log warnings and errors. type WarnErrLogger = forall m. GhcMonad m => Maybe SourceError -> m () defaultWarnErrLogger :: WarnErrLogger instance 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 CoreOccurAnal :: CoreToDo runWhen :: Bool -> CoreToDo -> CoreToDo runMaybe :: Maybe a -> (a -> CoreToDo) -> CoreToDo data SimplMode SimplMode :: [String] -> CompilerPhase -> !UnfoldingOpts -> !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 -- | 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 () warnMsg :: WarnReason -> SDoc -> CoreM () -- | Output a fatal error to the screen. Does not cause the compiler to -- die. fatalErrorMsg :: SDoc -> CoreM () -- | Output a fatal error to the screen. Does not cause the compiler to -- die. fatalErrorMsgS :: String -> CoreM () -- | Outputs a debugging message at verbosity level of -v or -- higher debugTraceMsg :: SDoc -> CoreM () -- | Output a string debugging message at verbosity level of -v or -- higher debugTraceMsgS :: String -> CoreM () -- | Show some labelled SDoc if a particular flag is set or at a -- verbosity level of -v -ddump-most or higher dumpIfSet_dyn :: DumpFlag -> String -> DumpFormat -> SDoc -> 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 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 -> DynFlags -> Bool -> SDoc -> SDoc -> WarnsAndErrs -> IO () dumpPassResult :: Logger -> DynFlags -> PrintUnqualified -> Maybe DumpFlag -> SDoc -> SDoc -> CoreProgram -> [CoreRule] -> IO () dumpIfSet :: Logger -> DynFlags -> Bool -> CoreToDo -> SDoc -> SDoc -> 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 -> !Char -> gbl -> lcl -> Env gbl lcl [env_top] :: Env gbl lcl -> !HscEnv [env_um] :: Env gbl lcl -> !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 -> TcRef TypeEnv -> !InstEnv -> !FamInstEnv -> AnnEnv -> [AvailInfo] -> ImportAvails -> DefUses -> TcRef [GlobalRdrElt] -> TcRef NameSet -> TcRef Bool -> TcRef Bool -> 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 -> [Annotation] -> [TyCon] -> NameSet -> [ClsInst] -> [FamInst] -> [LRuleDecl GhcTc] -> [LForeignDecl GhcTc] -> [PatSyn] -> Maybe LHsDocString -> !AnyHpcUsage -> SelfBootInfo -> Maybe Name -> TcRef (Bool, WarningMessages) -> [TcPluginSolver] -> [HoleFitPlugin] -> RealSrcSpan -> TcRef WantedConstraints -> !CompleteMatches -> TcRef CostCentreState -> 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 -> TcRef 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: -- --