3
3
{-# LANGUAGE ViewPatterns #-}
4
4
module Haskell.Ide.Engine.Compat where
5
5
6
-
7
6
import qualified GHC
8
7
import qualified Type
9
8
import qualified TcHsSyn
@@ -37,33 +36,95 @@ isExtensionOf ext = isSuffixOf ('.':ext) . takeExtensions
37
36
#endif
38
37
39
38
39
+ #if MIN_VERSION_ghc(8, 4, 0)
40
+ type GhcTc = GHC. GhcTc
41
+ #else
42
+ type GhcTc = GHC. Id
43
+ #endif
44
+
45
+ pattern HsOverLitType :: Type. Type -> GHC. HsExpr GhcTc
46
+ pattern HsOverLitType t <-
40
47
#if MIN_VERSION_ghc(8, 6, 0)
48
+ GHC. HsOverLit _ (GHC. overLitType -> t)
49
+ #elseif MIN_VERSION_ghc(8, 4, 0)
50
+ GHC. HsOverLit (GHC. overLitType -> t)
51
+ #else
52
+ GHC. HsOverLit (GHC. overLitType -> t)
53
+ #endif
41
54
42
- pattern HsOverLitType :: Type. Type -> GHC. HsExpr GHC. GhcTc
43
- pattern HsOverLitType t <- GHC. HsOverLit _ (GHC. overLitType -> t)
55
+ pattern HsLitType :: Type. Type -> GHC. HsExpr GhcTc
56
+ pattern HsLitType t <-
57
+ #if MIN_VERSION_ghc(8, 6, 0)
58
+ GHC. HsLit _ (TcHsSyn. hsLitType -> t)
59
+ #elseif MIN_VERSION_ghc(8, 4, 0)
60
+ GHC. HsLit (TcHsSyn. hsLitType -> t)
61
+ #else
62
+ GHC. HsLit (TcHsSyn. hsLitType -> t)
63
+ #endif
44
64
45
- pattern HsLitType :: Type. Type -> GHC. HsExpr GHC. GhcTc
46
- pattern HsLitType t <- GHC. HsLit _ (TcHsSyn. hsLitType -> t)
65
+ pattern HsLamType :: Type. Type -> GHC. HsExpr GhcTc
66
+ pattern HsLamType t <-
67
+ #if MIN_VERSION_ghc(8, 6, 0)
68
+ GHC. HsLam _ ((\ (GHC. MG { GHC. mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
69
+ #elseif MIN_VERSION_ghc(8, 4, 0)
70
+ GHC. HsLam (\ GHC. MG { GHC. mg_res_ty = res, GHC. mg_arg_tys = args } -> Type. mkFunTys args res -> t)
71
+ #else
72
+ GHC. HsLam (\ GHC. MG { GHC. mg_res_ty = res, GHC. mg_arg_tys = args } -> Type. mkFunTys args res -> t)
73
+ #endif
47
74
48
- pattern HsLamType :: Type. Type -> GHC. HsExpr GHC. GhcTc
49
- pattern HsLamType t <- GHC. HsLam _ ((\ (GHC. MG { GHC. mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
75
+ pattern HsLamCaseType :: Type. Type -> GHC. HsExpr GhcTc
76
+ pattern HsLamCaseType t <-
77
+ #if MIN_VERSION_ghc(8, 6, 0)
78
+ GHC. HsLamCase _ ((\ (GHC. MG { GHC. mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
79
+ #elseif MIN_VERSION_ghc(8, 4, 0)
80
+ GHC. HsLamCase (\ GHC. MG { GHC. mg_res_ty = res, GHC. mg_arg_tys = args } -> Type. mkFunTys args res -> t)
81
+ #else
82
+ GHC. HsLamCase (\ GHC. MG { GHC. mg_res_ty = res, GHC. mg_arg_tys = args } -> Type. mkFunTys args res -> t)
83
+ #endif
50
84
51
- pattern HsLamCaseType :: Type. Type -> GHC. HsExpr GHC. GhcTc
52
- pattern HsLamCaseType t <- GHC. HsLamCase _ ((\ (GHC. MG { GHC. mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
85
+ pattern HsCaseType :: Type. Type -> GHC. HsExpr GhcTc
86
+ pattern HsCaseType t <-
87
+ #if MIN_VERSION_ghc(8, 6, 0)
88
+ GHC. HsCase _ _ ((\ (GHC. MG { GHC. mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
89
+ #elseif MIN_VERSION_ghc(8, 4, 0)
90
+ GHC. HsCase _ (\ GHC. MG { GHC. mg_res_ty = res, GHC. mg_arg_tys = args } -> Type. mkFunTys args res -> t)
91
+ #else
92
+ GHC. HsCase _ (\ GHC. MG { GHC. mg_res_ty = res, GHC. mg_arg_tys = args } -> Type. mkFunTys args res -> t)
93
+ #endif
53
94
54
- pattern HsCaseType :: Type. Type -> GHC. HsExpr GHC. GhcTc
55
- pattern HsCaseType t <- GHC. HsCase _ _ ((\ (GHC. MG { GHC. mg_ext = groupTy }) -> matchGroupType groupTy) -> t)
95
+ pattern ExplicitListType :: Type. Type -> GHC. HsExpr GhcTc
96
+ pattern ExplicitListType t <-
97
+ #if MIN_VERSION_ghc(8, 6, 0)
98
+ GHC. ExplicitList (TysWiredIn. mkListTy -> t) _ _
99
+ #elseif MIN_VERSION_ghc(8, 4, 0)
100
+ GHC. ExplicitList (TysWiredIn. mkListTy -> t) _ _
101
+ #else
102
+ GHC. ExplicitList (TysWiredIn. mkListTy -> t) _ _
103
+ #endif
56
104
57
- pattern ExplicitListType :: Type. Type -> GHC. HsExpr GHC. GhcTc
58
- pattern ExplicitListType t <- GHC. ExplicitList (TysWiredIn. mkListTy -> t) _ _
105
+ pattern ExplicitSumType :: Type. Type -> GHC. HsExpr GhcTc
106
+ pattern ExplicitSumType t <-
107
+ #if MIN_VERSION_ghc(8, 6, 0)
108
+ GHC. ExplicitSum (TysWiredIn. mkSumTy -> t) _ _ _
109
+ #elseif MIN_VERSION_ghc(8, 4, 0)
110
+ GHC. ExplicitSum _ _ _ (TysWiredIn. mkSumTy -> t)
111
+ #else
112
+ GHC. ExplicitSum _ _ _ (TysWiredIn. mkSumTy -> t)
113
+ #endif
59
114
60
- pattern ExplicitSumType :: Type. Type -> GHC. HsExpr GHC. GhcTc
61
- pattern ExplicitSumType t <- GHC. ExplicitSum (TysWiredIn. mkSumTy -> t) _ _ _
62
115
63
- pattern HsMultiIfType :: Type. Type -> GHC. HsExpr GHC. GhcTc
64
- pattern HsMultiIfType t <- GHC. HsMultiIf t _
116
+ pattern HsMultiIfType :: Type. Type -> GHC. HsExpr GhcTc
117
+ pattern HsMultiIfType t <-
118
+ #if MIN_VERSION_ghc(8, 6, 0)
119
+ GHC. HsMultiIf t _
120
+ #elseif MIN_VERSION_ghc(8, 4, 0)
121
+ GHC. HsMultiIf t _
122
+ #else
123
+ GHC. HsMultiIf t _
124
+ #endif
65
125
126
+ #if MIN_VERSION_ghc(8, 6, 0)
66
127
matchGroupType :: GHC. MatchGroupTc -> GHC. Type
67
128
matchGroupType (GHC. MatchGroupTc args res) = Type. mkFunTys args res
129
+ #endif
68
130
69
- #endif
0 commit comments