Commit 3d0d8d02 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Do not do an ambiguity check on the type in a GHCi ":kind" command

Otherwise we get errors for polykinded type families;
   type family F a :: *
Then :k F
would give an ambiguity check trying to unify (F k1) with (F k2),
which is all a bit stupid.

I found this when investigating Trac #7939
parent cf7e2fa4
...@@ -61,6 +61,12 @@ import Data.List ( (\\) ) ...@@ -61,6 +61,12 @@ import Data.List ( (\\) )
\begin{code} \begin{code}
checkAmbiguity :: UserTypeCtxt -> Type -> TcM () checkAmbiguity :: UserTypeCtxt -> Type -> TcM ()
checkAmbiguity ctxt ty checkAmbiguity ctxt ty
| GhciCtxt <- ctxt -- Allow ambiguous types in GHCi's :kind command
= return () -- E.g. type family T a :: * -- T :: forall k. k -> *
-- Then :k T should work in GHCi, not complain that
-- (T k) is ambiguous!
| otherwise
= do { allow_ambiguous <- xoptM Opt_AllowAmbiguousTypes = do { allow_ambiguous <- xoptM Opt_AllowAmbiguousTypes
; unless allow_ambiguous $ ; unless allow_ambiguous $
do {(subst, _tvs) <- tcInstSkolTyVars (varSetElems (tyVarsOfType ty)) do {(subst, _tvs) <- tcInstSkolTyVars (varSetElems (tyVarsOfType ty))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment