diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-01 17:38:23 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-12-01 18:45:23 +0100 |
commit | 1e041b7382b6aa329e4ad9625439f811e0f27232 (patch) | |
tree | 91f4418553a1e6df072f56f43b5697d40c985b5f /testsuite/tests/partial-sigs/should_compile/T10403.stderr | |
parent | b432e2f39c095d8acbb0cfcc63bd08436c7a3e49 (diff) | |
download | haskell-1e041b7382b6aa329e4ad9625439f811e0f27232.tar.gz |
Refactor treatment of wildcards
This patch began as a modest refactoring of HsType and friends, to
clarify and tidy up exactly where quantification takes place in types.
Although initially driven by making the implementation of wildcards more
tidy (and fixing a number of bugs), I gradually got drawn into a pretty
big process, which I've been doing on and off for quite a long time.
There is one compiler performance regression as a result of all
this, in perf/compiler/T3064. I still need to look into that.
* The principal driving change is described in Note [HsType binders]
in HsType. Well worth reading!
* Those data type changes drive almost everything else. In particular
we now statically know where
(a) implicit quantification only (LHsSigType),
e.g. in instance declaratios and SPECIALISE signatures
(b) implicit quantification and wildcards (LHsSigWcType)
can appear, e.g. in function type signatures
* As part of this change, HsForAllTy is (a) simplified (no wildcards)
and (b) split into HsForAllTy and HsQualTy. The two contructors
appear when and only when the correponding user-level construct
appears. Again see Note [HsType binders].
HsExplicitFlag disappears altogether.
* Other simplifications
- ExprWithTySig no longer needs an ExprWithTySigOut variant
- TypeSig no longer needs a PostRn name [name] field
for wildcards
- PatSynSig records a LHsSigType rather than the decomposed
pieces
- The mysterious 'GenericSig' is now 'ClassOpSig'
* Renamed LHsTyVarBndrs to LHsQTyVars
* There are some uninteresting knock-on changes in Haddock,
because of the HsSyn changes
I also did a bunch of loosely-related changes:
* We already had type synonyms CoercionN/CoercionR for nominal and
representational coercions. I've added similar treatment for
TcCoercionN/TcCoercionR
mkWpCastN/mkWpCastN
All just type synonyms but jolly useful.
* I record-ised ForeignImport and ForeignExport
* I improved the (poor) fix to Trac #10896, by making
TcTyClsDecls.checkValidTyCl recover from errors, but adding a
harmless, abstract TyCon to the envt if so.
* I did some significant refactoring in RnEnv.lookupSubBndrOcc,
for reasons that I have (embarrassingly) now totally forgotten.
It had to do with something to do with import and export
Updates haddock submodule.
Diffstat (limited to 'testsuite/tests/partial-sigs/should_compile/T10403.stderr')
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/T10403.stderr | 91 |
1 files changed, 66 insertions, 25 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr index bfd5367bcd..1a71a3c803 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -1,39 +1,80 @@ T10403.hs:15:7: warning: - Found hole ‘_’ with inferred constraints: Functor f - In the type signature for: + Found constraint wildcard ‘_’ standing for ‘Functor f’ + In the type signature: h1 :: _ => _ T10403.hs:15:12: warning: - Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ - Where: ‘b’ is a rigid type variable bound by + • Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ + Where: ‘b’ is a rigid type variable bound by the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f at T10403.hs:17:1 - ‘a’ is a rigid type variable bound by + ‘a’ is a rigid type variable bound by the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f at T10403.hs:17:1 - ‘f’ is a rigid type variable bound by + ‘f’ is a rigid type variable bound by the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f at T10403.hs:17:1 - In the type signature for: - h1 :: _ => _ + • In the type signature: + h1 :: _ => _ + • Relevant bindings include + h1 :: (a -> b) -> f a -> H f (bound at T10403.hs:17:1) T10403.hs:19:7: warning: - Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ - Where: ‘b’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - ‘a’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - ‘f’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - In the type signature for: - h2 :: _ + • Found type wildcard ‘_’ standing for ‘(a -> b) -> f0 a -> H f0’ + Where: ‘b’ is a rigid type variable bound by + the inferred type of h2 :: (a -> b) -> f0 a -> H f0 + at T10403.hs:22:1 + ‘a’ is a rigid type variable bound by + the inferred type of h2 :: (a -> b) -> f0 a -> H f0 + at T10403.hs:22:1 + ‘f0’ is an ambiguous type variable + • In the type signature: + h2 :: _ + • Relevant bindings include + h2 :: (a -> b) -> f0 a -> H f0 (bound at T10403.hs:22:1) + +T10403.hs:22:15: warning: + • Ambiguous type variable ‘f0’ arising from a use of ‘fmap’ + prevents the constraint ‘(Functor f0)’ from being solved. + Relevant bindings include + b :: f0 a (bound at T10403.hs:22:6) + h2 :: (a -> b) -> f0 a -> H f0 (bound at T10403.hs:22:1) + Probable fix: use a type annotation to specify what ‘f0’ should be. + These potential instances exist: + instance Functor IO -- Defined in ‘GHC.Base’ + instance Functor (B t) -- Defined at T10403.hs:10:10 + instance Functor I -- Defined at T10403.hs:6:10 + ...plus four others + (use -fprint-potential-instances to see them all) + • In the second argument of ‘(.)’, namely ‘fmap (const ())’ + In the expression: H . fmap (const ()) + In the expression: (H . fmap (const ())) (fmap f b) + +T10403.hs:28:8: warning: + • Couldn't match type ‘f0’ with ‘B t’ + because type variable ‘t’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + app2 :: H (B t) + at T10403.hs:27:1-15 + Expected type: H (B t) + Actual type: H f0 + • In the expression: h2 (H . I) (B ()) + In an equation for ‘app2’: app2 = h2 (H . I) (B ()) + • Relevant bindings include + app2 :: H (B t) (bound at T10403.hs:28:1) -T10403.hs:21:1: warning: - No instance for (Functor f) - When checking that ‘h2’ has the inferred type - h2 :: forall (f :: * -> *) b a. (a -> b) -> f a -> H f - Probable cause: the inferred type is ambiguous +T10403.hs:28:20: warning: + • Couldn't match type ‘f0’ with ‘B t’ + because type variable ‘t’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + app2 :: H (B t) + at T10403.hs:27:1-15 + Expected type: f0 () + Actual type: B t () + • In the second argument of ‘h2’, namely ‘(B ())’ + In the expression: h2 (H . I) (B ()) + • Relevant bindings include + app2 :: H (B t) (bound at T10403.hs:28:1) |