BasicTypes

ghc-7.8.3: The GHC API

Safe Haskell | None
Language | Haskell98

BasicTypes

Contents

- The OneShotInfo type

Synopsis

- type Version = Int
- bumpVersion :: Version -> Version
- initialVersion :: Version
- type ConTag = Int
- fIRST_TAG :: ConTag
- type Arity = Int
- type RepArity = Int
- type Alignment = Int
- data FunctionOrData
  - = IsFunction
  - | IsData
- data WarningTxt
  - = WarningTxt [FastString]
  - | DeprecatedTxt [FastString]
- data Fixity = Fixity Int FixityDirection
- data FixityDirection
  - = InfixL
  - | InfixR
  - | InfixN
- defaultFixity :: Fixity
- maxPrecedence :: Int
- minPrecedence :: Int
- negateFixity :: Fixity
- funTyFixity :: Fixity
- compareFixity :: Fixity -> Fixity -> (Bool, Bool)
- data RecFlag
  - = Recursive
  - | NonRecursive
- isRec :: RecFlag -> Bool
- isNonRec :: RecFlag -> Bool
- boolToRecFlag :: Bool -> RecFlag
- data Origin
  - = FromSource
  - | Generated
- isGenerated :: Origin -> Bool
- type RuleName = FastString
- data TopLevelFlag
  - = TopLevel
  - | NotTopLevel
- isTopLevel :: TopLevelFlag -> Bool
- isNotTopLevel :: TopLevelFlag -> Bool
- data OverlapFlag
  - = NoOverlap {
    - isSafeOverlap :: Bool
    }
  - | OverlapOk {
    - isSafeOverlap :: Bool
    }
  - | Incoherent {
    - isSafeOverlap :: Bool
    }
- data Boxity
  - = Boxed
  - | Unboxed
- isBoxed :: Boxity -> Bool
- data TupleSort
  - = BoxedTuple
  - | UnboxedTuple
  - | ConstraintTuple
- tupleSortBoxity :: TupleSort -> Boxity
- boxityNormalTupleSort :: Boxity -> TupleSort
- tupleParens :: TupleSort -> SDoc -> SDoc
- data OneShotInfo
  - = NoOneShotInfo
  - | ProbOneShot
  - | OneShotLam
- noOneShotInfo :: OneShotInfo
- hasNoOneShotInfo :: OneShotInfo -> Bool
- isOneShotInfo :: OneShotInfo -> Bool
- bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo
- worstOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo
- data OccInfo
  - = NoOccInfo
  - | IAmDead
  - | OneOcc !InsideLam !OneBranch !InterestingCxt
  - | IAmALoopBreaker !RulesOnly
- seqOccInfo :: OccInfo -> ()
- zapFragileOcc :: OccInfo -> OccInfo
- isOneOcc :: OccInfo -> Bool
- isDeadOcc :: OccInfo -> Bool
- isStrongLoopBreaker :: OccInfo -> Bool
- isWeakLoopBreaker :: OccInfo -> Bool
- isNoOcc :: OccInfo -> Bool
- strongLoopBreaker :: OccInfo
- weakLoopBreaker :: OccInfo
- type InsideLam = Bool
- insideLam :: InsideLam
- notInsideLam :: InsideLam
- type OneBranch = Bool
- oneBranch :: OneBranch
- notOneBranch :: OneBranch
- type InterestingCxt = Bool
- data EP a = EP {
  - fromEP :: a
  - toEP :: a
  }
- data DefMethSpec
  - = NoDM
  - | VanillaDM
  - | GenericDM
- data SwapFlag
  - = NotSwapped
  - | IsSwapped
- flipSwap :: SwapFlag -> SwapFlag
- unSwap :: SwapFlag -> (a -> a -> b) -> a -> a -> b
- isSwapped :: SwapFlag -> Bool
- data CompilerPhase
  - = Phase PhaseNum
  - | InitialPhase
- type PhaseNum = Int
- data Activation
  - = NeverActive
  - | AlwaysActive
  - | ActiveBefore PhaseNum
  - | ActiveAfter PhaseNum
- isActive :: CompilerPhase -> Activation -> Bool
- isActiveIn :: PhaseNum -> Activation -> Bool
- isNeverActive :: Activation -> Bool
- isAlwaysActive :: Activation -> Bool
- isEarlyActive :: Activation -> Bool
- data RuleMatchInfo
  - = ConLike
  - | FunLike
- isConLike :: RuleMatchInfo -> Bool
- isFunLike :: RuleMatchInfo -> Bool
- data InlineSpec
  - = Inline
  - | Inlinable
  - | NoInline
  - | EmptyInlineSpec
- isEmptyInlineSpec :: InlineSpec -> Bool
- data InlinePragma = InlinePragma {
  - inl_inline :: InlineSpec
  - inl_sat :: Maybe Arity
  - inl_act :: Activation
  - inl_rule :: RuleMatchInfo
  }
- defaultInlinePragma :: InlinePragma
- alwaysInlinePragma :: InlinePragma
- neverInlinePragma :: InlinePragma
- dfunInlinePragma :: InlinePragma
- isDefaultInlinePragma :: InlinePragma -> Bool
- isInlinePragma :: InlinePragma -> Bool
- isInlinablePragma :: InlinePragma -> Bool
- isAnyInlinePragma :: InlinePragma -> Bool
- inlinePragmaSpec :: InlinePragma -> InlineSpec
- inlinePragmaSat :: InlinePragma -> Maybe Arity
- inlinePragmaActivation :: InlinePragma -> Activation
- inlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo
- setInlinePragmaActivation :: InlinePragma -> Activation -> InlinePragma
- setInlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo -> InlinePragma
- data SuccessFlag
  - = Succeeded
  - | Failed
- succeeded :: SuccessFlag -> Bool
- failed :: SuccessFlag -> Bool
- successIf :: Bool -> SuccessFlag
- data FractionalLit = FL {
  - fl_text :: String
  - fl_value :: Rational
  }
- negateFractionalLit :: FractionalLit -> FractionalLit
- integralFractionalLit :: Integer -> FractionalLit
- newtype HValue = HValue Any

# Documentation

type Version = Int Source

bumpVersion :: Version -> Version Source

initialVersion :: Version Source

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

type Alignment = Int Source

data FunctionOrData Source

Constructors

IsFunction |
IsData |

Instances

Eq FunctionOrData |
Data FunctionOrData |
Ord FunctionOrData |
Outputable FunctionOrData |
Binary FunctionOrData |
Typeable * FunctionOrData |

data WarningTxt Source

Constructors

WarningTxt [FastString] |
DeprecatedTxt [FastString] |

Instances

Eq WarningTxt |
Data WarningTxt |
Outputable WarningTxt |
Binary WarningTxt |
Typeable * WarningTxt |

data Fixity Source

Constructors

Fixity Int FixityDirection |

Instances

Eq Fixity |
Data Fixity |
Outputable Fixity |
Binary Fixity |
Typeable * Fixity |

data FixityDirection Source

Constructors

InfixL |
InfixR |
InfixN |

Instances

Eq FixityDirection |
Data FixityDirection |
Outputable FixityDirection |
Binary FixityDirection |
Typeable * FixityDirection |

defaultFixity :: Fixity Source

maxPrecedence :: Int Source

minPrecedence :: Int Source

negateFixity :: Fixity Source

funTyFixity :: Fixity Source

compareFixity :: Fixity -> Fixity -> (Bool, Bool) Source

data RecFlag Source

Constructors

Recursive |
NonRecursive |

Instances

Eq RecFlag |
Data RecFlag |
Outputable RecFlag |
Binary RecFlag |
Typeable * RecFlag |

isRec :: RecFlag -> Bool Source

isNonRec :: RecFlag -> Bool Source

boolToRecFlag :: Bool -> RecFlag Source

data Origin Source

Constructors

FromSource |
Generated |

Instances

Eq Origin |
Data Origin |
Outputable Origin |
Typeable * Origin |

isGenerated :: Origin -> Bool Source

type RuleName = FastString Source

data TopLevelFlag Source

Constructors

TopLevel |
NotTopLevel |

Instances

Outputable TopLevelFlag |

isTopLevel :: TopLevelFlag -> Bool Source

isNotTopLevel :: TopLevelFlag -> Bool Source

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.

Constructors

NoOverlap | This instance must not overlap another
Fields isSafeOverlap :: Bool
OverlapOk | Silently ignore this instance if you find a more specific one that matches the constraint you are trying to resolve Example: constraint (Foo [Int]) instances (Foo [Int]) (Foo [a]) OverlapOk Since the second instance has the OverlapOk flag, the first instance will be chosen (otherwise its ambiguous which to choose)
Fields isSafeOverlap :: Bool
Incoherent | Silently ignore this instance if you find any other that matches the constraing you are trying to resolve, including when checking if there are instances that do not match, but unify. Example: constraint (Foo [b]) instances (Foo [Int]) Incoherent (Foo [a]) Without the Incoherent flag, we'd complain that instantiating `b` would change which instance was chosen. See also note [Incoherent instances]
Fields isSafeOverlap :: Bool

Instances

Eq OverlapFlag |
Data OverlapFlag |
Outputable OverlapFlag |
Binary OverlapFlag |
Typeable * OverlapFlag |

data Boxity Source

Constructors

Boxed |
Unboxed |

Instances

Eq Boxity |
Data Boxity |
Typeable * Boxity |

isBoxed :: Boxity -> Bool Source

data TupleSort Source

Constructors

BoxedTuple |
UnboxedTuple |
ConstraintTuple |

Instances

Eq TupleSort |
Data TupleSort |
Binary TupleSort |
Typeable * TupleSort |

tupleSortBoxity :: TupleSort -> Boxity Source

boxityNormalTupleSort :: Boxity -> TupleSort Source

tupleParens :: TupleSort -> SDoc -> SDoc 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.

Constructors

NoOneShotInfo | No information
ProbOneShot | The lambda is probably applied at most once
OneShotLam | The lambda is applied at most once.

Instances

Outputable OneShotInfo |

noOneShotInfo :: OneShotInfo Source

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

hasNoOneShotInfo :: OneShotInfo -> Bool Source

isOneShotInfo :: OneShotInfo -> Bool Source

bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo Source

worstOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo Source

data OccInfo Source

Identifier occurrence information

Constructors

NoOccInfo | There are many occurrences, or unknown occurrences
IAmDead | 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

Instances

Outputable OccInfo |

seqOccInfo :: OccInfo -> () Source

zapFragileOcc :: OccInfo -> OccInfo Source

isOneOcc :: OccInfo -> Bool Source

isDeadOcc :: OccInfo -> Bool Source

isStrongLoopBreaker :: OccInfo -> Bool Source

isWeakLoopBreaker :: OccInfo -> Bool Source

isNoOcc :: OccInfo -> Bool Source

strongLoopBreaker :: OccInfo Source

weakLoopBreaker :: OccInfo Source

type InsideLam = Bool Source

insideLam :: InsideLam Source

notInsideLam :: InsideLam Source

type OneBranch = Bool Source

oneBranch :: OneBranch Source

notOneBranch :: OneBranch Source

type InterestingCxt = Bool Source

data EP a Source

Constructors

EP |
Fields fromEP :: a toEP :: a

data DefMethSpec Source

Constructors

NoDM |
VanillaDM |
GenericDM |

Instances

Outputable DefMethSpec |
Binary DefMethSpec |

data SwapFlag Source

Constructors

NotSwapped |
IsSwapped |

Instances

Outputable SwapFlag |

flipSwap :: SwapFlag -> SwapFlag Source

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

isSwapped :: SwapFlag -> Bool Source

data CompilerPhase Source

Constructors

Phase PhaseNum |
InitialPhase |

Instances

Outputable CompilerPhase |

type PhaseNum = Int Source

data Activation Source

Constructors

NeverActive |
AlwaysActive |
ActiveBefore PhaseNum |
ActiveAfter PhaseNum |

Instances

Eq Activation |
Data Activation |
Outputable Activation |
Binary Activation |
Typeable * Activation |

isActive :: CompilerPhase -> Activation -> Bool Source

isActiveIn :: PhaseNum -> Activation -> Bool Source

isNeverActive :: Activation -> Bool Source

isAlwaysActive :: Activation -> Bool Source

isEarlyActive :: Activation -> Bool Source

data RuleMatchInfo Source

Constructors

ConLike |
FunLike |

Instances

Eq RuleMatchInfo |
Data RuleMatchInfo |
Show RuleMatchInfo |
Outputable RuleMatchInfo |
Binary RuleMatchInfo |
Typeable * RuleMatchInfo |

isConLike :: RuleMatchInfo -> Bool Source

isFunLike :: RuleMatchInfo -> Bool Source

data InlineSpec Source

Constructors

Inline |
Inlinable |
NoInline |
EmptyInlineSpec |

Instances

Eq InlineSpec |
Data InlineSpec |
Show InlineSpec |
Outputable InlineSpec |
Binary InlineSpec |
Typeable * InlineSpec |

isEmptyInlineSpec :: InlineSpec -> Bool Source

data InlinePragma Source

Constructors

InlinePragma |
Fields inl_inline :: InlineSpec inl_sat :: Maybe Arity inl_act :: Activation inl_rule :: RuleMatchInfo

Instances

Eq InlinePragma |
Data InlinePragma |
Outputable InlinePragma |
Binary InlinePragma |
Typeable * InlinePragma |

defaultInlinePragma :: InlinePragma Source

alwaysInlinePragma :: InlinePragma Source

neverInlinePragma :: InlinePragma Source

dfunInlinePragma :: InlinePragma Source

isDefaultInlinePragma :: InlinePragma -> Bool Source

isInlinePragma :: InlinePragma -> Bool Source

isInlinablePragma :: InlinePragma -> Bool Source

isAnyInlinePragma :: InlinePragma -> Bool Source

inlinePragmaSpec :: InlinePragma -> InlineSpec Source

inlinePragmaSat :: InlinePragma -> Maybe Arity Source

inlinePragmaActivation :: InlinePragma -> Activation Source

inlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo Source

setInlinePragmaActivation :: InlinePragma -> Activation -> InlinePragma Source

setInlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo -> InlinePragma Source

data SuccessFlag Source

Constructors

Succeeded |
Failed |

Instances

Outputable SuccessFlag |

succeeded :: SuccessFlag -> Bool Source

failed :: SuccessFlag -> Bool Source

successIf :: Bool -> SuccessFlag Source

data FractionalLit Source

Constructors

FL |
Fields fl_text :: String fl_value :: Rational

Instances

Eq FractionalLit |
Data FractionalLit |
Ord FractionalLit |
Show FractionalLit |
Outputable FractionalLit |
Typeable * FractionalLit |

negateFractionalLit :: FractionalLit -> FractionalLit Source

integralFractionalLit :: Integer -> FractionalLit Source

newtype HValue Source

Constructors

HValue Any |