• Ryan Scott's avatar
    Introduce `hsExprType :: HsExpr GhcTc -> Type` in the new module · 7ea3b7eb
    Ryan Scott authored and Zubin's avatar Zubin committed
    `GHC.Hs.Syn.Type`
    
    The existing `hsPatType`, `hsLPatType` and `hsLitType` functions have also been
    moved to this module
    
    This is a less ambitious take on the same problem that !2182 and !3866
    attempt to solve. Rather than have the `hsExprType` function attempt to
    efficiently compute the `Type` of every subexpression in an `HsExpr`, this
    simply computes the overall `Type` of a single `HsExpr`.
    
    - Explicitly forbids the `SplicePat` `HsIPVar`, `HsBracket`, `HsRnBracketOut`
      and `HsTcBracketOut` constructors during the typechecking phase by using
      `Void` as the TTG extension field
    - Also introduces `dataConCantHappen` as a domain specific alternative to `absurd`
      to handle cases where the TTG extension points forbid a constructor.
    - Turns HIE file generation into a pure function that doesn't need access to the
      `DsM` monad to compute types, but uses `hsExprType` instead.
    - Computes a few more types during HIE file generation
    - Makes GHCi's `:...
    7ea3b7eb
Code owners : Ben Gamari
Info.hs 14.4 KB