Opened 17 months ago
Last modified 12 months ago
#15474 new bug
Error message mentions Any
Reported by: | monoidal | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 8.10.1 |
Component: | Compiler | Version: | 8.4.3 |
Keywords: | TypeInType | Cc: | |
Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
Type of failure: | Poor/confusing error message | Test Case: | |
Blocked By: | Blocking: | ||
Related Tickets: | #14198 | Differential Rev(s): | |
Wiki Page: |
Description (last modified by )
I'm not sure if this is a bug. File:
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeInType #-} module T15474 where import Data.Kind (Type) data Proxy a type Forall = forall t. Proxy t f1 :: forall (t :: Type). Proxy t f1 = f1 f2 :: Forall f2 = f1
gives an error message mentioning Any:
• Couldn't match type ‘GHC.Types.Any’ with ‘*’ Expected type: Proxy t Actual type: Proxy t0
The appearance of Any is suspicious to me - I thought it's an implementation detail?
Change History (7)
comment:1 Changed 17 months ago by
Description: | modified (diff) |
---|
comment:2 Changed 16 months ago by
comment:3 Changed 16 months ago by
So why doesn't something like that happen for Forall?
Ah, I think it's because
- The kind of
Forall
's RHS is justType
- And we do kind-generalise that kind; it has no free kind variables, so no kind-generalisation actually happens.
And in any case the decl
type Forall k = forall (t :: k). Proxy @k t
gives Forall
the ambiguous kind Forall :: forall k. Type
, which will do no one any good.
comment:4 Changed 16 months ago by
Related Tickets: | → #14198 |
---|
Another option, discussed in #14198, is to reject the declaration of Forall
entirely after kind-generalizing its RHS, side the kind variable k
is free-floating.
comment:5 Changed 16 months ago by
Yes, rejection is probably best for now -- we can always do something else later.
comment:6 Changed 16 months ago by
Keywords: | TypeInType added |
---|---|
Priority: | low → normal |
comment:7 Changed 12 months ago by
Milestone: | 8.8.1 → 8.10.1 |
---|
Bumping milestones of low-priority tickets.
Yes, this is awkward. What is happening is that we end up with this:
I think that perhaps in this case we should kind-generalise the RHS of
Forall
to getI'm not sure why we don't do this. We certainly do some kind-generalisation; e.g. if you write
we end up with
So why doesn't something like that happen for
Forall
? Interesting.