ghc-7.10.3: The GHC API

Safe HaskellNone





type ConTag = Int Source

Type of the tags associated with each constructor possibility

fIRST_TAG :: ConTag Source

Tags are allocated from here for real constructors

type Arity = Int Source

The number of value arguments that can be applied to a value before it does "real work". So: fib 100 has arity 0 x -> fib x has arity 1

type RepArity = Int Source

The number of represented arguments that can be applied to a value before it does "real work". So: fib 100 has representation arity 0 x -> fib x has representation arity 1 () -> fib (x + y) has representation arity 2

data OverlapFlag Source

The semantics allowed for overlapping instances for a particular instance. See Note [Safe Haskell isSafeOverlap] (in lhs) for a explanation of the isSafeOverlap field.

data OverlapMode Source


NoOverlap SourceText

This instance must not overlap another NoOverlap instance. However, it may be overlapped by Overlapping instances, and it may overlap Overlappable instances.

Overlappable SourceText

Silently ignore this instance if you find a more specific one that matches the constraint you are trying to resolve

Example: constraint (Foo [Int]) instance Foo [Int] instance {--} Foo [a]

Since the second instance has the Overlappable flag, the first instance will be chosen (otherwise its ambiguous which to choose)

Overlapping SourceText

Silently ignore any more general instances that may be used to solve the constraint.

Example: constraint (Foo [Int]) instance {--} Foo [Int] instance Foo [a]

Since the first instance has the Overlapping flag, the second---more general---instance will be ignored (otherwise it is ambiguous which to choose)

Overlaps SourceText

Equivalent to having both Overlapping and Overlappable flags.

Incoherent SourceText

Behave like Overlappable and Overlapping, and in addition pick an an arbitrary one if there are multiple matching candidates, and don't worry about later instantiation

Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int] instance Foo [a] Without the Incoherent flag, we'd complain that instantiating b would change which instance was chosen. See also note [Incoherent instances] in InstEnv

data Boxity Source




The OneShotInfo type

data OneShotInfo Source

If the Id is a lambda-bound variable then it may have lambda-bound variable info. Sometimes we know whether the lambda binding this variable is a "one-shot" lambda; that is, whether it is applied at most once.

This information may be useful in optimisation, as computations may safely be floated inside such a lambda without risk of duplicating work.



No information


The lambda is probably applied at most once See Note [Computing one-shot info, and ProbOneShot] in OccurAnl


The lambda is applied at most once.

noOneShotInfo :: OneShotInfo Source

It is always safe to assume that an Id has no lambda-bound variable information

data OccInfo Source

Identifier occurrence information



There are many occurrences, or unknown occurrences


Marks unused variables. Sometimes useful for lambda and case-bound variables.

OneOcc !InsideLam !OneBranch !InterestingCxt

Occurs exactly once, not inside a rule

IAmALoopBreaker !RulesOnly

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

data EP a Source




fromEP :: a
toEP :: a

data SwapFlag Source




unSwap :: SwapFlag -> (a -> a -> b) -> a -> a -> b Source

newtype HValue Source


HValue Any