@@ -902,15 +902,33 @@ tagE a = varE noSrcSpan (tagName ?nms) `appE` a
902
902
tagTypeCon :: (p ~ GhcPs , ? nms :: ExternalNames ) => LHsType GhcPs
903
903
tagTypeCon = noLoc (HsTyVar noExt NotPromoted (noLoc (tagTName ? nms)))
904
904
905
+ sigPat :: (p ~ GhcPs ) => SrcSpan -> LHsType GhcPs -> LPat p -> LPat p
906
+ sigPat loc ty a = L loc $
907
+ #if __GLASGOW_HASKELL__ < 810
908
+ SigPat (HsWC noExt (HsIB noExt ty)) a
909
+ #elif __GLASGOW_HASKELL__ < 900
910
+ SigPat noExt a (HsWC noExt (HsIB noExt ty))
911
+ #else
912
+ SigPat noExt a (HsPS noExt ty)
913
+ #endif
914
+
915
+ sigE :: (p ~ GhcPs , ? nms :: ExternalNames ) => SrcSpan -> LHsType GhcPs -> LHsExpr p -> LHsExpr p
916
+ sigE loc ty a = L loc $
917
+ #if __GLASGOW_HASKELL__ < 810
918
+ ExprWithTySig (HsWC noExt (HsIB noExt ty)) a
919
+ #else
920
+ ExprWithTySig noExt a (HsWC noExt (HsIB noExt ty))
921
+ #endif
922
+
905
923
tagTypeP :: (p ~ GhcPs , ? nms :: ExternalNames ) => Direction -> LHsType GhcPs -> LPat p -> LPat p
906
- tagTypeP dir ty a
907
- = noLoc ( SigPat ( HsWC noExt ( HsIB noExt ( tagTypeCon `appTy` ty `appTy` busType))) a )
924
+ tagTypeP dir ty
925
+ = sigPat noSrcSpan ( tagTypeCon `appTy` ty `appTy` busType)
908
926
where
909
927
busType = conT noSrcSpan (fwdAndBwdTypes ? nms dir) `appTy` ty
910
928
911
929
tagTypeE :: (p ~ GhcPs , ? nms :: ExternalNames ) => Direction -> LHsType GhcPs -> LHsExpr p -> LHsExpr p
912
930
tagTypeE dir ty a
913
- = noLoc ( ExprWithTySig ( HsWC noExt ( HsIB noExt ( tagTypeCon `appTy` ty `appTy` busType))) a)
931
+ = sigE noSrcSpan ( tagTypeCon `appTy` ty `appTy` busType) a
914
932
where
915
933
busType = conT noSrcSpan (fwdAndBwdTypes ? nms dir) `appTy` ty
916
934
0 commit comments