{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

module Test.Tasty.AutoCollect.GHC.Shim_8_10 (
  -- * Re-exports
  module X,

  -- * Compat

  -- ** Plugin
  setKeepRawTokenStream,

  -- ** Annotations
  getExportComments,
  generatedSrcAnn,
  toSrcAnnA,

  -- ** SrcSpan
  srcSpanStart,

  -- ** OccName
  mkOccNameVar,
  mkOccNameTC,

  -- ** Decl
  parseDecl,

  -- ** Type
  parseSigWcType,
  parseType,

  -- ** Expr
  mkExplicitList,
  mkExplicitTuple,
  xAppTypeE,

  -- * Backports
  SrcAnn,
  SrcSpanAnn',
  LocatedN,
  unLoc,
  getLoc,
  getLocA,
  mkHsApps,
  mkMatch,
  noAnn,
  hsTypeToHsSigType,
  hsTypeToHsSigWcType,
) where

-- Re-exports
import ApiAnnotation as X (AnnotationComment (..))
import GHC.Hs as X hiding (mkHsAppType, mkHsAppTypes, mkMatch)
import GhcPlugins as X hiding (getHscEnv, getLoc, showPpr, srcSpanStart, unLoc)
import HscMain as X (getHscEnv)
import NameCache as X (NameCache)

import ApiAnnotation (getAnnotationComments)
import Data.Foldable (foldl')
import Data.Maybe (mapMaybe)
import qualified Data.Text as Text
import qualified GHC.Hs.Utils as GHC (mkMatch)
import qualified OccName as NameSpace (tcName, varName)
import qualified SrcLoc as GHC (srcSpanStart)

import Test.Tasty.AutoCollect.GHC.Shim_Common
import Test.Tasty.AutoCollect.Utils.Text

{----- Compat / Plugin -----}

setKeepRawTokenStream :: Plugin -> Plugin
setKeepRawTokenStream :: Plugin -> Plugin
setKeepRawTokenStream Plugin
plugin =
  Plugin
plugin
    { dynflagsPlugin :: [CommandLineOption] -> DynFlags -> IO DynFlags
dynflagsPlugin = \[CommandLineOption]
_ DynFlags
df ->
        DynFlags -> IO DynFlags
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DynFlags -> IO DynFlags) -> DynFlags -> IO DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
df DynFlags -> GeneralFlag -> DynFlags
`gopt_set` GeneralFlag
Opt_KeepRawTokenStream
    }

{----- Compat / Annotations -----}

-- | Get the contents of all comments in the given hsmodExports list.
getExportComments :: HsParsedModule -> Located [LIE GhcPs] -> [RealLocated String]
getExportComments :: HsParsedModule
-> Located [LIE GhcPs] -> [RealLocated CommandLineOption]
getExportComments HsParsedModule
parsedModl = (GenLocated RealSrcSpan AnnotationComment
 -> RealLocated CommandLineOption)
-> [GenLocated RealSrcSpan AnnotationComment]
-> [RealLocated CommandLineOption]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated RealSrcSpan AnnotationComment
-> RealLocated CommandLineOption
forall l.
GenLocated l AnnotationComment -> GenLocated l CommandLineOption
fromRLAnnotationComment ([GenLocated RealSrcSpan AnnotationComment]
 -> [RealLocated CommandLineOption])
-> (Located [LIE GhcPs]
    -> [GenLocated RealSrcSpan AnnotationComment])
-> Located [LIE GhcPs]
-> [RealLocated CommandLineOption]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SrcSpan -> [GenLocated RealSrcSpan AnnotationComment]
getCommentsAt (SrcSpan -> [GenLocated RealSrcSpan AnnotationComment])
-> (Located [LIE GhcPs] -> SrcSpan)
-> Located [LIE GhcPs]
-> [GenLocated RealSrcSpan AnnotationComment]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Located [LIE GhcPs] -> SrcSpan
forall l e. GenLocated l e -> l
getLoc
  where
    getCommentsAt :: SrcSpan -> [GenLocated RealSrcSpan AnnotationComment]
getCommentsAt = (GenLocated SrcSpan AnnotationComment
 -> Maybe (GenLocated RealSrcSpan AnnotationComment))
-> [GenLocated SrcSpan AnnotationComment]
-> [GenLocated RealSrcSpan AnnotationComment]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe GenLocated SrcSpan AnnotationComment
-> Maybe (GenLocated RealSrcSpan AnnotationComment)
forall e. GenLocated SrcSpan e -> Maybe (GenLocated RealSrcSpan e)
toRealLocated ([GenLocated SrcSpan AnnotationComment]
 -> [GenLocated RealSrcSpan AnnotationComment])
-> (SrcSpan -> [GenLocated SrcSpan AnnotationComment])
-> SrcSpan
-> [GenLocated RealSrcSpan AnnotationComment]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ApiAnns -> SrcSpan -> [GenLocated SrcSpan AnnotationComment]
getAnnotationComments (HsParsedModule -> ApiAnns
hpm_annotations HsParsedModule
parsedModl)
    toRealLocated :: GenLocated SrcSpan e -> Maybe (GenLocated RealSrcSpan e)
toRealLocated = \case
      L (RealSrcSpan RealSrcSpan
l) e
e -> GenLocated RealSrcSpan e -> Maybe (GenLocated RealSrcSpan e)
forall a. a -> Maybe a
Just (RealSrcSpan -> e -> GenLocated RealSrcSpan e
forall l e. l -> e -> GenLocated l e
L RealSrcSpan
l e
e)
      L (UnhelpfulSpan FastString
_) e
_ -> Maybe (GenLocated RealSrcSpan e)
forall a. Maybe a
Nothing
    fromRLAnnotationComment :: GenLocated l AnnotationComment -> GenLocated l CommandLineOption
fromRLAnnotationComment (L l
rss AnnotationComment
comment) =
      l -> CommandLineOption -> GenLocated l CommandLineOption
forall l e. l -> e -> GenLocated l e
L l
rss (CommandLineOption -> GenLocated l CommandLineOption)
-> CommandLineOption -> GenLocated l CommandLineOption
forall a b. (a -> b) -> a -> b
$ (Text -> CommandLineOption
Text.unpack (Text -> CommandLineOption)
-> (AnnotationComment -> Text)
-> AnnotationComment
-> CommandLineOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text
Text.strip (Text -> Text)
-> (AnnotationComment -> Text) -> AnnotationComment -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AnnotationComment -> Text
unwrap) AnnotationComment
comment
    unwrap :: AnnotationComment -> Text
unwrap = \case
      AnnDocCommentNext CommandLineOption
s -> Text -> Text -> Text
withoutPrefix Text
"-- |" (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ CommandLineOption -> Text
Text.pack CommandLineOption
s
      AnnDocCommentPrev CommandLineOption
s -> Text -> Text -> Text
withoutPrefix Text
"-- ^" (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ CommandLineOption -> Text
Text.pack CommandLineOption
s
      AnnDocCommentNamed CommandLineOption
s -> Text -> Text -> Text
withoutPrefix Text
"-- $" (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ CommandLineOption -> Text
Text.pack CommandLineOption
s
      AnnDocSection Int
_ CommandLineOption
s -> CommandLineOption -> Text
Text.pack CommandLineOption
s
      AnnDocOptions CommandLineOption
s -> CommandLineOption -> Text
Text.pack CommandLineOption
s
      AnnLineComment CommandLineOption
s -> Text -> Text -> Text
withoutPrefix Text
"--" (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ CommandLineOption -> Text
Text.pack CommandLineOption
s
      AnnBlockComment CommandLineOption
s -> Text -> Text -> Text
withoutPrefix Text
"{-" (Text -> Text) -> (Text -> Text) -> Text -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> Text
withoutSuffix Text
"-}" (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ CommandLineOption -> Text
Text.pack CommandLineOption
s

generatedSrcAnn :: SrcSpan
generatedSrcAnn :: SrcSpan
generatedSrcAnn = FastString -> SrcSpan
UnhelpfulSpan (CommandLineOption -> FastString
fsLit CommandLineOption
"<generated>")

toSrcAnnA :: RealSrcSpan -> SrcSpan
toSrcAnnA :: RealSrcSpan -> SrcSpan
toSrcAnnA = RealSrcSpan -> SrcSpan
RealSrcSpan

{----- Compat / SrcSpan -----}

srcSpanStart :: SrcSpan -> Either String RealSrcLoc
srcSpanStart :: SrcSpan -> Either CommandLineOption RealSrcLoc
srcSpanStart SrcSpan
ss =
  case SrcSpan -> SrcLoc
GHC.srcSpanStart SrcSpan
ss of
    RealSrcLoc RealSrcLoc
srcLoc -> RealSrcLoc -> Either CommandLineOption RealSrcLoc
forall a b. b -> Either a b
Right RealSrcLoc
srcLoc
    UnhelpfulLoc FastString
s -> CommandLineOption -> Either CommandLineOption RealSrcLoc
forall a b. a -> Either a b
Left (CommandLineOption -> Either CommandLineOption RealSrcLoc)
-> CommandLineOption -> Either CommandLineOption RealSrcLoc
forall a b. (a -> b) -> a -> b
$ FastString -> CommandLineOption
unpackFS FastString
s

{----- Compat / OccName -----}

mkOccNameVar :: String -> OccName
mkOccNameVar :: CommandLineOption -> OccName
mkOccNameVar = NameSpace -> CommandLineOption -> OccName
mkOccName NameSpace
NameSpace.varName

mkOccNameTC :: String -> OccName
mkOccNameTC :: CommandLineOption -> OccName
mkOccNameTC = NameSpace -> CommandLineOption -> OccName
mkOccName NameSpace
NameSpace.tcName

{----- Compat / Decl -----}

parseDecl :: LHsDecl GhcPs -> Maybe ParsedDecl
parseDecl :: LHsDecl GhcPs -> Maybe ParsedDecl
parseDecl (L SrcSpan
_ HsDecl GhcPs
decl) =
  case HsDecl GhcPs
decl of
    SigD XSigD GhcPs
_ (TypeSig XTypeSig GhcPs
_ [Located (IdP GhcPs)]
names LHsSigWcType GhcPs
ty) -> ParsedDecl -> Maybe ParsedDecl
forall a. a -> Maybe a
Just (ParsedDecl -> Maybe ParsedDecl) -> ParsedDecl -> Maybe ParsedDecl
forall a b. (a -> b) -> a -> b
$ [LocatedN RdrName] -> LHsSigWcType GhcPs -> ParsedDecl
FuncSig [Located (IdP GhcPs)]
[LocatedN RdrName]
names LHsSigWcType GhcPs
ty
    ValD XValD GhcPs
_ (FunBind XFunBind GhcPs GhcPs
_ Located (IdP GhcPs)
name MatchGroup GhcPs (LHsExpr GhcPs)
matchGroup HsWrapper
_ [Tickish Id]
_) ->
      ParsedDecl -> Maybe ParsedDecl
forall a. a -> Maybe a
Just (ParsedDecl -> Maybe ParsedDecl)
-> ([LocatedA FuncSingleDef] -> ParsedDecl)
-> [LocatedA FuncSingleDef]
-> Maybe ParsedDecl
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LocatedN RdrName -> [LocatedA FuncSingleDef] -> ParsedDecl
FuncDef Located (IdP GhcPs)
LocatedN RdrName
name ([LocatedA FuncSingleDef] -> Maybe ParsedDecl)
-> [LocatedA FuncSingleDef] -> Maybe ParsedDecl
forall a b. (a -> b) -> a -> b
$
        case MatchGroup GhcPs (LHsExpr GhcPs)
matchGroup of
          MG{mg_alts :: forall p body. MatchGroup p body -> Located [LMatch p body]
mg_alts = L SrcSpan
_ [LMatch GhcPs (LHsExpr GhcPs)]
matches} -> (LMatch GhcPs (LHsExpr GhcPs) -> LocatedA FuncSingleDef)
-> [LMatch GhcPs (LHsExpr GhcPs)] -> [LocatedA FuncSingleDef]
forall a b. (a -> b) -> [a] -> [b]
map ((Match GhcPs (LHsExpr GhcPs) -> FuncSingleDef)
-> LMatch GhcPs (LHsExpr GhcPs) -> LocatedA FuncSingleDef
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Match GhcPs (LHsExpr GhcPs) -> FuncSingleDef
parseFuncSingleDef) [LMatch GhcPs (LHsExpr GhcPs)]
matches
          XMatchGroup XXMatchGroup GhcPs (LHsExpr GhcPs)
x -> NoExtCon -> [LocatedA FuncSingleDef]
forall a. NoExtCon -> a
noExtCon NoExtCon
XXMatchGroup GhcPs (LHsExpr GhcPs)
x
    HsDecl GhcPs
_ -> Maybe ParsedDecl
forall a. Maybe a
Nothing
  where
    parseFuncSingleDef :: Match GhcPs (LHsExpr GhcPs) -> FuncSingleDef
parseFuncSingleDef = \case
      Match{[LPat GhcPs]
m_pats :: forall p body. Match p body -> [LPat p]
m_pats :: [LPat GhcPs]
m_pats, m_grhss :: forall p body. Match p body -> GRHSs p body
m_grhss = GRHSs XCGRHSs GhcPs (LHsExpr GhcPs)
_ [LGRHS GhcPs (LHsExpr GhcPs)]
bodys LHsLocalBinds GhcPs
whereClause} ->
        FuncSingleDef :: [LPat GhcPs]
-> [FuncGuardedBody] -> HsLocalBinds GhcPs -> FuncSingleDef
FuncSingleDef
          { funcDefArgs :: [LPat GhcPs]
funcDefArgs = [LPat GhcPs]
m_pats
          , funcDefGuards :: [FuncGuardedBody]
funcDefGuards = (LGRHS GhcPs (LHsExpr GhcPs) -> FuncGuardedBody)
-> [LGRHS GhcPs (LHsExpr GhcPs)] -> [FuncGuardedBody]
forall a b. (a -> b) -> [a] -> [b]
map (GRHS GhcPs (LHsExpr GhcPs) -> FuncGuardedBody
parseFuncGuardedBody (GRHS GhcPs (LHsExpr GhcPs) -> FuncGuardedBody)
-> (LGRHS GhcPs (LHsExpr GhcPs) -> GRHS GhcPs (LHsExpr GhcPs))
-> LGRHS GhcPs (LHsExpr GhcPs)
-> FuncGuardedBody
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LGRHS GhcPs (LHsExpr GhcPs) -> GRHS GhcPs (LHsExpr GhcPs)
forall l e. GenLocated l e -> e
unLoc) [LGRHS GhcPs (LHsExpr GhcPs)]
bodys
          , funcDefWhereClause :: HsLocalBinds GhcPs
funcDefWhereClause = LHsLocalBinds GhcPs -> HsLocalBinds GhcPs
forall l e. GenLocated l e -> e
unLoc LHsLocalBinds GhcPs
whereClause
          }
      Match{m_grhss :: forall p body. Match p body -> GRHSs p body
m_grhss = XGRHSs XXGRHSs GhcPs (LHsExpr GhcPs)
x} -> NoExtCon -> FuncSingleDef
forall a. NoExtCon -> a
noExtCon NoExtCon
XXGRHSs GhcPs (LHsExpr GhcPs)
x
      XMatch XXMatch GhcPs (LHsExpr GhcPs)
x -> NoExtCon -> FuncSingleDef
forall a. NoExtCon -> a
noExtCon NoExtCon
XXMatch GhcPs (LHsExpr GhcPs)
x
    parseFuncGuardedBody :: GRHS GhcPs (LHsExpr GhcPs) -> FuncGuardedBody
parseFuncGuardedBody = \case
      GRHS XCGRHS GhcPs (LHsExpr GhcPs)
_ [GuardLStmt GhcPs]
guards LHsExpr GhcPs
body -> [GuardLStmt GhcPs] -> LHsExpr GhcPs -> FuncGuardedBody
FuncGuardedBody [GuardLStmt GhcPs]
guards LHsExpr GhcPs
body
      XGRHS XXGRHS GhcPs (LHsExpr GhcPs)
x -> NoExtCon -> FuncGuardedBody
forall a. NoExtCon -> a
noExtCon NoExtCon
XXGRHS GhcPs (LHsExpr GhcPs)
x

{----- Compat / Type -----}

parseSigWcType :: LHsSigWcType GhcPs -> Maybe ParsedType
parseSigWcType :: LHsSigWcType GhcPs -> Maybe ParsedType
parseSigWcType = \case
  HsWC XHsWC GhcPs (LHsSigType GhcPs)
_ (HsIB XHsIB GhcPs (LHsType GhcPs)
_ LHsType GhcPs
ltype) -> LHsType GhcPs -> Maybe ParsedType
parseType LHsType GhcPs
ltype
  HsWC XHsWC GhcPs (LHsSigType GhcPs)
_ (XHsImplicitBndrs XXHsImplicitBndrs GhcPs (LHsType GhcPs)
x) -> NoExtCon -> Maybe ParsedType
forall a. NoExtCon -> a
noExtCon NoExtCon
XXHsImplicitBndrs GhcPs (LHsType GhcPs)
x
  XHsWildCardBndrs XXHsWildCardBndrs GhcPs (LHsSigType GhcPs)
x -> NoExtCon -> Maybe ParsedType
forall a. NoExtCon -> a
noExtCon NoExtCon
XXHsWildCardBndrs GhcPs (LHsSigType GhcPs)
x

parseType :: LHsType GhcPs -> Maybe ParsedType
parseType :: LHsType GhcPs -> Maybe ParsedType
parseType (L SrcSpan
_ HsType GhcPs
ty) =
  case HsType GhcPs
ty of
    HsTyVar XTyVar GhcPs
_ PromotionFlag
flag Located (IdP GhcPs)
name -> ParsedType -> Maybe ParsedType
forall a. a -> Maybe a
Just (ParsedType -> Maybe ParsedType) -> ParsedType -> Maybe ParsedType
forall a b. (a -> b) -> a -> b
$ PromotionFlag -> LocatedN RdrName -> ParsedType
TypeVar PromotionFlag
flag Located (IdP GhcPs)
LocatedN RdrName
name
    HsListTy XListTy GhcPs
_ LHsType GhcPs
t -> ParsedType -> ParsedType
TypeList (ParsedType -> ParsedType) -> Maybe ParsedType -> Maybe ParsedType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LHsType GhcPs -> Maybe ParsedType
parseType LHsType GhcPs
t
    HsType GhcPs
_ -> Maybe ParsedType
forall a. Maybe a
Nothing

{----- Compat / Expr -----}

mkExplicitList :: [LHsExpr GhcPs] -> HsExpr GhcPs
mkExplicitList :: [LHsExpr GhcPs] -> HsExpr GhcPs
mkExplicitList = XExplicitList GhcPs
-> Maybe (SyntaxExpr GhcPs) -> [LHsExpr GhcPs] -> HsExpr GhcPs
forall p.
XExplicitList p -> Maybe (SyntaxExpr p) -> [LHsExpr p] -> HsExpr p
ExplicitList NoExtField
XExplicitList GhcPs
noExtField Maybe (SyntaxExpr GhcPs)
forall a. Maybe a
Nothing

mkExplicitTuple :: [HsTupArg GhcPs] -> Boxity -> HsExpr GhcPs
mkExplicitTuple :: [HsTupArg GhcPs] -> Boxity -> HsExpr GhcPs
mkExplicitTuple = XExplicitTuple GhcPs -> [LHsTupArg GhcPs] -> Boxity -> HsExpr GhcPs
forall p. XExplicitTuple p -> [LHsTupArg p] -> Boxity -> HsExpr p
ExplicitTuple NoExtField
XExplicitTuple GhcPs
noAnn ([LHsTupArg GhcPs] -> Boxity -> HsExpr GhcPs)
-> ([HsTupArg GhcPs] -> [LHsTupArg GhcPs])
-> [HsTupArg GhcPs]
-> Boxity
-> HsExpr GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (HsTupArg GhcPs -> LHsTupArg GhcPs)
-> [HsTupArg GhcPs] -> [LHsTupArg GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map (SrcSpan -> HsTupArg GhcPs -> LHsTupArg GhcPs
forall l e. l -> e -> GenLocated l e
L SrcSpan
generatedSrcAnn)

xAppTypeE :: XAppTypeE GhcPs
xAppTypeE :: XAppTypeE GhcPs
xAppTypeE = NoExtField
XAppTypeE GhcPs
noExtField

{----- Backports -----}

type SrcAnn ann = SrcSpan
type SrcSpanAnn' a = SrcSpan
type LocatedN = Located

unLoc :: GenLocated l e -> e
unLoc :: GenLocated l e -> e
unLoc (L l
_ e
e) = e
e

getLoc :: GenLocated l e -> l
getLoc :: GenLocated l e -> l
getLoc (L l
l e
_) = l
l

getLocA :: Located e -> SrcSpan
getLocA :: Located e -> SrcSpan
getLocA = Located e -> SrcSpan
forall l e. GenLocated l e -> l
getLoc

mkHsApps :: LHsExpr GhcPs -> [LHsExpr GhcPs] -> LHsExpr GhcPs
mkHsApps :: LHsExpr GhcPs -> [LHsExpr GhcPs] -> LHsExpr GhcPs
mkHsApps = (LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs)
-> LHsExpr GhcPs -> [LHsExpr GhcPs] -> LHsExpr GhcPs
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
forall (id :: Pass).
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp

mkMatch :: HsMatchContext RdrName -> [LPat GhcPs] -> LHsExpr GhcPs -> HsLocalBinds GhcPs -> LMatch GhcPs (LHsExpr GhcPs)
mkMatch :: HsMatchContext RdrName
-> [LPat GhcPs]
-> LHsExpr GhcPs
-> HsLocalBinds GhcPs
-> LMatch GhcPs (LHsExpr GhcPs)
mkMatch HsMatchContext RdrName
ctxt [LPat GhcPs]
pats LHsExpr GhcPs
expr HsLocalBinds GhcPs
lbinds = HsMatchContext (NameOrRdrName (IdP GhcPs))
-> [LPat GhcPs]
-> LHsExpr GhcPs
-> LHsLocalBinds GhcPs
-> LMatch GhcPs (LHsExpr GhcPs)
forall (p :: Pass).
HsMatchContext (NameOrRdrName (IdP (GhcPass p)))
-> [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> Located (HsLocalBinds (GhcPass p))
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
GHC.mkMatch HsMatchContext (NameOrRdrName (IdP GhcPs))
HsMatchContext RdrName
ctxt [LPat GhcPs]
pats LHsExpr GhcPs
expr (SrcSpan -> HsLocalBinds GhcPs -> LHsLocalBinds GhcPs
forall l e. l -> e -> GenLocated l e
L SrcSpan
generatedSrcAnn HsLocalBinds GhcPs
lbinds)

noAnn :: NoExtField
noAnn :: NoExtField
noAnn = NoExtField
NoExtField

hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
hsTypeToHsSigType = LHsType GhcPs -> LHsSigType GhcPs
mkLHsSigType

hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
hsTypeToHsSigWcType = LHsType GhcPs -> LHsSigWcType GhcPs
mkLHsSigWcType