summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2019-01-18 15:24:21 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2019-01-18 15:24:21 +0000
commit391f3ccea45fe6f72a1d041a306fed7ee3a96db9 (patch)
tree9d0f3ca15b481b675a3c3e19bea107d148c4aae5
parent07e58c7d5b2186954987578abc0889cfe0fd9625 (diff)
downloadhaskell-wip/T16185.tar.gz
Improvements to the AnonArgFlag stuffwip/T16185
One step forward is using CPP for FunTy See Note [Function types] in TyCoRep
-rw-r--r--compiler/HsVersions.h8
-rw-r--r--compiler/codeGen/StgCmmClosure.hs2
-rw-r--r--compiler/coreSyn/CoreMap.hs10
-rw-r--r--compiler/typecheck/TcCanonical.hs14
-rw-r--r--compiler/typecheck/TcErrors.hs5
-rw-r--r--compiler/typecheck/TcMType.hs2
-rw-r--r--compiler/typecheck/TcTyDecls.hs3
-rw-r--r--compiler/typecheck/TcType.hs27
-rw-r--r--compiler/typecheck/TcTypeable.hs7
-rw-r--r--compiler/typecheck/TcUnify.hs3
-rw-r--r--compiler/typecheck/TcValidity.hs5
-rw-r--r--compiler/types/OptCoercion.hs8
-rw-r--r--compiler/types/TyCoRep.hs32
-rw-r--r--compiler/types/Type.hs44
-rw-r--r--compiler/types/Unify.hs5
15 files changed, 72 insertions, 103 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index a4ec3e4c40..cb9f47f67e 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -63,3 +63,11 @@ foreign import ccall unsafe saccessor \
#define ASSERTM(e) do { bool <- e; MASSERT(bool) }
#define ASSERTM2(e,msg) do { bool <- e; MASSERT2(bool,msg) }
#define WARNM2(e,msg) do { bool <- e; WARN(bool, msg) return () }
+
+
+/* ------------------------------------ */
+/* Egregions hack for FunTy */
+/* See Note [Function types] in TyCoRep */
+/* ------------------------------------ */
+
+#define FunTy FFunTy _
diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs
index caf5c427e9..425cc3eeef 100644
--- a/compiler/codeGen/StgCmmClosure.hs
+++ b/compiler/codeGen/StgCmmClosure.hs
@@ -928,7 +928,7 @@ getTyDescription ty
TyVarTy _ -> "*"
AppTy fun _ -> getTyDescription fun
TyConApp tycon _ -> getOccString tycon
- FunTy {} -> '-' : fun_result tau_ty
+ FFunTy {} -> '-' : fun_result tau_ty
ForAllTy _ ty -> getTyDescription ty
LitTy n -> getTyLitDescription n
CastTy ty _ -> getTyDescription ty
diff --git a/compiler/coreSyn/CoreMap.hs b/compiler/coreSyn/CoreMap.hs
index 5ab4ae1d4d..10ca8f040c 100644
--- a/compiler/coreSyn/CoreMap.hs
+++ b/compiler/coreSyn/CoreMap.hs
@@ -3,6 +3,7 @@
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
@@ -10,9 +11,6 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
- -- Yuk! Suppresses bogus warnings
-
module CoreMap(
-- * Maps over Core expressions
CoreMap, emptyCoreMap, extendCoreMap, lookupCoreMap, foldCoreMap,
@@ -37,6 +35,8 @@ module CoreMap(
(>.>), (|>), (|>>),
) where
+#include "HsVersions.h"
+
import GhcPrelude
import TrieMap
@@ -569,7 +569,7 @@ lkT (D env ty) m = go ty m
go (LitTy l) = tm_tylit >.> lkTyLit l
go (ForAllTy (Bndr tv _) ty) = tm_forall >.> lkG (D (extendCME env tv) ty)
>=> lkBndr env tv
- go ty@(FunTy {}) = pprPanic "lkT FunTy" (ppr ty)
+ go ty@(FFunTy {}) = pprPanic "lkT FunTy" (ppr ty)
go (CastTy t _) = go t
go (CoercionTy {}) = tm_coerce
@@ -588,7 +588,7 @@ xtT (D env (ForAllTy (Bndr tv _) ty)) f m
= m { tm_forall = tm_forall m |> xtG (D (extendCME env tv) ty)
|>> xtBndr env tv f }
xtT (D _ ty@(TyConApp _ (_:_))) _ _ = pprPanic "xtT TyConApp" (ppr ty)
-xtT (D _ ty@(FunTy {})) _ _ = pprPanic "xtT FunTy" (ppr ty)
+xtT (D _ ty@(FFunTy {})) _ _ = pprPanic "xtT FunTy" (ppr ty)
fdT :: (a -> b -> b) -> TypeMapX a -> b -> b
fdT k m = foldTM k (tm_var m)
diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs
index c346f5d2b1..154eca441e 100644
--- a/compiler/typecheck/TcCanonical.hs
+++ b/compiler/typecheck/TcCanonical.hs
@@ -1,10 +1,5 @@
{-# LANGUAGE CPP #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns -Wno-incomplete-patterns #-}
- -- Yuk! Suppresses bogus warnings
- -- The -Wno-incomplete-patterns suppresses
- -- a pattern-checker iteration limit error
-
module TcCanonical(
canonicalize,
unifyDerived,
@@ -829,7 +824,6 @@ is flattened, but this is left as future work. (Mar '15)
Note [FunTy and decomposing tycon applications]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
When can_eq_nc' attempts to decompose a tycon application we haven't yet zonked.
This means that we may very well have a FunTy containing a type of some unknown
kind. For instance, we may have,
@@ -928,8 +922,8 @@ can_eq_nc' _flat _rdr_env _envs ev eq_rel ty1@(LitTy l1) _ (LitTy l2) _
-- Including FunTy (s -> t)
can_eq_nc' _flat _rdr_env _envs ev eq_rel ty1 _ ty2 _
--- See Note [FunTy and decomposing type constructor applications].
- | Just (tc1, tys1) <- tcRepSplitTyConApp_maybe' ty1
- , Just (tc2, tys2) <- tcRepSplitTyConApp_maybe' ty2
+ | Just (tc1, tys1) <- repSplitTyConApp_maybe ty1
+ , Just (tc2, tys2) <- repSplitTyConApp_maybe ty2
, not (isTypeFamilyTyCon tc1)
, not (isTypeFamilyTyCon tc2)
= canTyConApp ev eq_rel tc1 tys1 tc2 tys2
@@ -1094,8 +1088,8 @@ zonk_eq_types = go
split2 = tcSplitFunTy_maybe ty2
go ty1 ty2
- | Just (tc1, tys1) <- tcRepSplitTyConApp_maybe ty1
- , Just (tc2, tys2) <- tcRepSplitTyConApp_maybe ty2
+ | Just (tc1, tys1) <- repSplitTyConApp_maybe ty1
+ , Just (tc2, tys2) <- repSplitTyConApp_maybe ty2
= if tc1 == tc2 && tys1 `equalLength` tys2
-- Crucial to check for equal-length args, because
-- we cannot assume that the two args to 'go' have
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index c3f6d6860d..9275a98d32 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -2,9 +2,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
- -- Yuk! Suppresses bogus warnings
-
module TcErrors(
reportUnsolved, reportAllUnsolved, warnAllUnsolved,
warnDefaulting,
@@ -2270,7 +2267,7 @@ expandSynonymsToMatch ty1 ty2 = (ty1_ret, ty2_ret)
sameShapes :: Type -> Type -> Bool
sameShapes AppTy{} AppTy{} = True
sameShapes (TyConApp tc1 _) (TyConApp tc2 _) = tc1 == tc2
- sameShapes (FunTy {}) (FunTy {}) = True
+ sameShapes (FFunTy {}) (FFunTy {}) = True
sameShapes (ForAllTy {}) (ForAllTy {}) = True
sameShapes (CastTy ty1 _) ty2 = sameShapes ty1 ty2
sameShapes ty1 (CastTy ty2 _) = sameShapes ty1 ty2
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index 2248e0a25a..f0f6391d8a 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -1201,11 +1201,11 @@ collect_cand_qtvs is_dep bound dvs ty
-- Uses accumulating-parameter style
go dv (AppTy t1 t2) = foldlM go dv [t1, t2]
go dv (TyConApp _ tys) = foldlM go dv tys
+ go dv (FunTy arg res) = foldlM go dv [arg, res]
go dv (LitTy {}) = return dv
go dv (CastTy ty co) = do dv1 <- go dv ty
collect_cand_qtvs_co bound dv1 co
go dv (CoercionTy co) = collect_cand_qtvs_co bound dv co
- go dv (FunTy arg res) = foldlM go dv [arg, res]
go dv (TyVarTy tv)
| is_bound tv = return dv
diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs
index db1923f98b..4a6f77820e 100644
--- a/compiler/typecheck/TcTyDecls.hs
+++ b/compiler/typecheck/TcTyDecls.hs
@@ -33,8 +33,7 @@ import GhcPrelude
import TcRnMonad
import TcEnv
import TcBinds( tcValBinds, addTypecheckedBinds )
-import TyCoRep( Type(..), Type( FunTy )
- , Coercion(..), MCoercion(..), UnivCoProvenance(..) )
+import TyCoRep( Type(..), Coercion(..), MCoercion(..), UnivCoProvenance(..) )
import TcType
import TysWiredIn( unitTy )
import MkCore( rEC_SEL_ERROR_ID )
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index 54e4308ec9..39cf15efec 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -64,7 +64,6 @@ module TcType (
tcSplitFunTy_maybe, tcSplitFunTys, tcFunArgTy, tcFunResultTy, tcFunResultTyN,
tcSplitFunTysN,
tcSplitTyConApp, tcSplitTyConApp_maybe,
- tcRepSplitTyConApp, tcRepSplitTyConApp_maybe, tcRepSplitTyConApp_maybe',
tcTyConAppTyCon, tcTyConAppTyCon_maybe, tcTyConAppArgs,
tcSplitAppTy_maybe, tcSplitAppTy, tcSplitAppTys, tcRepSplitAppTy_maybe,
tcRepGetNumAppTys,
@@ -1520,8 +1519,9 @@ tcTyConAppTyCon_maybe ty
| Just ty' <- tcView ty = tcTyConAppTyCon_maybe ty'
tcTyConAppTyCon_maybe (TyConApp tc _)
= Just tc
-tcTyConAppTyCon_maybe (FFunTy {})
- = Just funTyCon
+tcTyConAppTyCon_maybe (FFunTy { ft_af = VisArg })
+ = Just funTyCon -- (=>) is /not/ a TyCon in its own right
+ -- C.f. tcRepSplitAppTy_maybe
tcTyConAppTyCon_maybe _
= Nothing
@@ -1535,27 +1535,6 @@ tcSplitTyConApp ty = case tcSplitTyConApp_maybe ty of
Just stuff -> stuff
Nothing -> pprPanic "tcSplitTyConApp" (pprType ty)
--- | Like 'tcRepSplitTyConApp_maybe', but returns 'Nothing' if,
---
--- 1. the type is structurally not a type constructor application, or
---
--- 2. the type is a function type (e.g. application of 'funTyCon'), but we
--- currently don't even enough information to fully determine its RuntimeRep
--- variables. For instance, @FunTy (a :: k) Int@.
---
--- By contrast 'tcRepSplitTyConApp_maybe' panics in the second case.
---
--- The behavior here is needed during canonicalization; see Note [FunTy and
--- decomposing tycon applications] in TcCanonical for details.
-tcRepSplitTyConApp_maybe' :: HasCallStack => Type -> Maybe (TyCon, [Type])
-tcRepSplitTyConApp_maybe' (TyConApp tc tys) = Just (tc, tys)
-tcRepSplitTyConApp_maybe' (FunTy arg res)
- | Just arg_rep <- getRuntimeRep_maybe arg
- , Just res_rep <- getRuntimeRep_maybe res
- = Just (funTyCon, [arg_rep, res_rep, arg, res])
-tcRepSplitTyConApp_maybe' _ = Nothing
-
-
-----------------------
tcSplitFunTys :: Type -> ([Type], Type)
tcSplitFunTys ty = case tcSplitFunTy_maybe ty of
diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs
index f952cfba3e..9ce4f8a84d 100644
--- a/compiler/typecheck/TcTypeable.hs
+++ b/compiler/typecheck/TcTypeable.hs
@@ -3,12 +3,14 @@
(c) The GRASP/AQUA Project, Glasgow University, 1992-1999
-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeFamilies #-}
module TcTypeable(mkTypeableBinds) where
+#include "HsVersions.h"
import GhcPrelude
@@ -551,8 +553,9 @@ mkKindRepRhs stuff@(Stuff {..}) in_scope = new_kind_rep
-- We handle (TYPE LiftedRep) etc separately to make it
-- clear to consumers (e.g. serializers) that there is
-- a loop here (as TYPE :: RuntimeRep -> TYPE 'LiftedRep)
- | not (tcIsConstraintKind k) -- Typeable respects the Constraint/* distinction
- -- so do not follow the special case here
+ | not (tcIsConstraintKind k)
+ -- Typeable respects the Constraint/Type distinction
+ -- so do not follow the special case here
, Just arg <- kindRep_maybe k
, Just (tc, []) <- splitTyConApp_maybe arg
, Just dc <- isPromotedDataCon_maybe tc
diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs
index aaf459bde9..b4357dbd22 100644
--- a/compiler/typecheck/TcUnify.hs
+++ b/compiler/typecheck/TcUnify.hs
@@ -8,9 +8,6 @@ Type subsumption and unification
{-# LANGUAGE CPP, MultiWayIf, TupleSections, ScopedTypeVariables #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
- -- Yuk! Suppresses bogus warnings
-
module TcUnify (
-- Full-blown subsumption
tcWrapResult, tcWrapResultO, tcSkolemise, tcSkolemiseET,
diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs
index 0ffcf71e6f..a9f65fa16d 100644
--- a/compiler/typecheck/TcValidity.hs
+++ b/compiler/typecheck/TcValidity.hs
@@ -5,9 +5,6 @@
{-# LANGUAGE CPP, TupleSections, ViewPatterns #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
- -- Yuk! Suppresses bogus warnings
-
module TcValidity (
Rank, UserTypeCtxt(..), checkValidType, checkValidMonoType,
checkValidTheta, checkValidFamPats,
@@ -544,7 +541,7 @@ check_syn_tc_app env ctxt rank ty tc tys
else -- In the liberal case (only for closed syns), expand then check
case tcView ty of
- Just ty' -> let syn_tc = fst $ tcRepSplitTyConApp ty
+ Just ty' -> let syn_tc = tcTyConAppTyCon ty
err_ctxt = text "In the expansion of type synonym"
<+> quotes (ppr syn_tc)
in addErrCtxt err_ctxt $ check_type env ctxt rank ty'
diff --git a/compiler/types/OptCoercion.hs b/compiler/types/OptCoercion.hs
index 385a4b3740..e7192fe799 100644
--- a/compiler/types/OptCoercion.hs
+++ b/compiler/types/OptCoercion.hs
@@ -2,14 +2,6 @@
{-# LANGUAGE CPP #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns -Wno-incomplete-patterns #-}
- -- Yuk! Suppresses bogus warnings
- -- The -Wno-incomplete-patterns suppresses
- -- a pattern-checker iteration limit error
- -- I have not idea why the iteration limit had suddenly blown up
- -- This happened when I added FFunTy, and a COMPLETE pragma for
- -- Type; but there is no pattern matching on Type here!
-
module OptCoercion ( optCoercion, checkAxInstCo ) where
#include "HsVersions.h"
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index d8eac95812..0a3c1c24ca 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -26,7 +26,7 @@ module TyCoRep (
Type( TyVarTy, AppTy, TyConApp, ForAllTy
, LitTy, CastTy, CoercionTy
, FFunTy, ft_arg, ft_res, ft_af
- , FunTy ), -- Export the type synonym FunTy too
+ ), -- Export the type synonym FunTy too
AnonArgFlag,
TyLit(..),
@@ -315,10 +315,10 @@ data Type
Type -- ^ A Π type.
| FFunTy -- ^ t1 -> t2 Very common, so an important special case
- -- FFunTy for "full function type"; see pattern synonym for FunTy
+ -- See Note [Function types]
{ ft_af :: AnonArgFlag -- Is this (->) or (=>)?
, ft_arg :: Type -- Argument type
- , ft_res :: Type } -- Resuult type
+ , ft_res :: Type } -- Result type
| LitTy TyLit -- ^ Type literals are similar to type constructors.
@@ -337,6 +337,24 @@ data Type
deriving Data.Data
+{- Note [Function types]
+~~~~~~~~~~~~~~~~~~~~~~~~
+(to be completed...)
+
+* FFunTy is the data constructor, meaning "full function type".
+
+* FunTy is a (unidirectional) pattern synonym that allows
+ positional pattern matching (FunTy arg res), ignoring the
+ ArgFlag.
+
+* We use #define FunTy FFunTy _, to allow pattern matching on
+ a (positional) FunTy constructor.
+-}
+
+{- -----------------------
+ Commented out until the pattern match
+ checker can handle it; see Trac #16185
+
{-# COMPLETE FunTy, TyVarTy, AppTy, TyConApp
, ForAllTy, LitTy, CastTy, CoercionTy :: Type #-}
@@ -346,6 +364,10 @@ data Type
pattern FunTy :: Type -> Type -> Type
pattern FunTy arg res <- FFunTy { ft_arg = arg, ft_res = res }
+ End of commented out block
+---------------------------------- -}
+
+
-- NOTE: Other parts of the code assume that type literals do not contain
-- types or type variables.
data TyLit
@@ -3539,8 +3561,8 @@ tidyType env (TyVarTy tv) = TyVarTy (tidyTyCoVarOcc env tv)
tidyType env (TyConApp tycon tys) = let args = tidyTypes env tys
in args `seqList` TyConApp tycon args
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
-tidyType env ty@(FunTy arg res) = let !arg' = tidyType env arg
- !res' = tidyType env res
+tidyType env ty@(FunTy arg res) = let { !arg' = tidyType env arg
+ ; !res' = tidyType env res }
in ty { ft_arg = arg', ft_res = res' }
tidyType env (ty@(ForAllTy{})) = mkForAllTys' (zip tvs' vis) $! tidyType env' body_ty
where
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index 2042451ae5..02666fe6f6 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -33,7 +33,7 @@ module Type (
tyConAppTyCon_maybe, tyConAppTyConPicky_maybe,
tyConAppArgs_maybe, tyConAppTyCon, tyConAppArgs,
splitTyConApp_maybe, splitTyConApp, tyConAppArgN, nextRole,
- tcRepSplitTyConApp_maybe, tcRepSplitTyConApp, tcSplitTyConApp_maybe,
+ tcSplitTyConApp_maybe,
splitListTyConApp_maybe,
repSplitTyConApp_maybe,
@@ -788,29 +788,6 @@ tcRepSplitAppTy_maybe (TyConApp tc tys)
= Just (TyConApp tc tys', ty') -- Never create unsaturated type family apps!
tcRepSplitAppTy_maybe _other = Nothing
--- | Like 'tcSplitTyConApp_maybe' but doesn't look through type synonyms.
-tcRepSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
--- Defined here to avoid module loops between Unify and TcType.
-tcRepSplitTyConApp_maybe (TyConApp tc tys)
- = Just (tc, tys)
-
-tcRepSplitTyConApp_maybe (FunTy arg res)
- = Just (funTyCon, [arg_rep, res_rep, arg, res])
- where
- arg_rep = getRuntimeRep arg
- res_rep = getRuntimeRep res
-
-tcRepSplitTyConApp_maybe _
- = Nothing
-
--- | Like 'tcSplitTyConApp' but doesn't look through type synonyms.
-tcRepSplitTyConApp :: HasCallStack => Type -> (TyCon, [Type])
--- Defined here to avoid module loops between Unify and TcType.
-tcRepSplitTyConApp ty =
- case tcRepSplitTyConApp_maybe ty of
- Just stuff -> stuff
- Nothing -> pprPanic "tcRepSplitTyConApp" (ppr ty)
-
-------------
splitAppTy :: Type -> (Type, Type)
-- ^ Attempts to take a type application apart, as in 'splitAppTy_maybe',
@@ -1204,9 +1181,17 @@ splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
splitTyConApp_maybe ty | Just ty' <- coreView ty = splitTyConApp_maybe ty'
splitTyConApp_maybe ty = repSplitTyConApp_maybe ty
--- | Like 'splitTyConApp_maybe', but doesn't look through synonyms. This
--- assumes the synonyms have already been dealt with.
+-------------------
repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
+-- ^ Like 'splitTyConApp_maybe', but doesn't look through synonyms. This
+-- assumes the synonyms have already been dealt with.
+--
+-- Moreover, for a FunTy, it only succeeds if the argument types
+-- have enough info to extract the runtime-rep arguments that
+-- the funTyCon requires. This will usually be true;
+-- but may be temporarily false during canonicalization:
+-- see Note [FunTy and decomposing tycon applications] in TcCanonical
+--
repSplitTyConApp_maybe (TyConApp tc tys) = Just (tc, tys)
repSplitTyConApp_maybe (FunTy arg res)
| Just arg_rep <- getRuntimeRep_maybe arg
@@ -1214,6 +1199,7 @@ repSplitTyConApp_maybe (FunTy arg res)
= Just (funTyCon, [arg_rep, res_rep, arg, res])
repSplitTyConApp_maybe _ = Nothing
+-------------------
-- | Attempts to tease a list type apart and gives the type of the elements if
-- successful (looks through type synonyms)
splitListTyConApp_maybe :: Type -> Maybe Type
@@ -1773,7 +1759,7 @@ in TcCanonical.
tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
-- Defined here to avoid module loops between Unify and TcType.
tcSplitTyConApp_maybe ty | Just ty' <- tcView ty = tcSplitTyConApp_maybe ty'
-tcSplitTyConApp_maybe ty = tcRepSplitTyConApp_maybe ty
+tcSplitTyConApp_maybe ty = repSplitTyConApp_maybe ty
-- tcIsConstraintKind stuf only makes sense in the typechecker
-- After that Constraint = Type
@@ -2600,7 +2586,7 @@ nonDetCmpTypeX env orig_t1 orig_t2 =
get_rank (AppTy {}) = 3
get_rank (LitTy {}) = 4
get_rank (TyConApp {}) = 5
- get_rank (FunTy {}) = 6
+ get_rank (FFunTy {}) = 6
get_rank (ForAllTy {}) = 7
gos :: RnEnv2 -> [Type] -> [Type] -> TypeOrdering
@@ -2701,7 +2687,7 @@ Note that:
typeKind :: HasDebugCallStack => Type -> Kind
typeKind (TyConApp tc tys) = piResultTys (tyConKind tc) tys
typeKind (LitTy l) = typeLiteralKind l
-typeKind (FunTy {}) = liftedTypeKind
+typeKind (FFunTy {}) = liftedTypeKind
typeKind (TyVarTy tyvar) = tyVarKind tyvar
typeKind (CastTy _ty co) = pSnd $ coercionKind co
typeKind (CoercionTy co) = coercionType co
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index bb6d0f4919..1e5406db2e 100644
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -4,11 +4,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
-{-# OPTIONS_GHC -Wno-overlapping-patterns -Wno-incomplete-patterns #-}
- -- Yuk! Suppresses bogus warnings
- -- The -Wno-incomplete-patterns suppresses
- -- a pattern-checker iteration limit error
-
module Unify (
tcMatchTy, tcMatchTyKi,
tcMatchTys, tcMatchTyKis,