Core Lint error with RequiredTypeArguments
File:
{-# LANGUAGE RequiredTypeArguments, ExplicitNamespaces #-}
module M where
visId :: forall a -> a -> a
visId (type a) x = x
f :: forall a -> a -> a
f (type x) = visId (type x)
$ ./stage1/bin/ghc -dcore-lint M
[1 of 1] Compiling M ( M.hs, M.o )
*** Core Lint errors : in result of Desugar (after optimization) ***
M.hs:8:1: warning:
From-type of Cast differs from type of enclosed expression
From-type: forall a. a -> a
Type of enclosed expression: forall a -> a -> a
Actual enclosed expression: visId
Coercion used in cast: forall (a[spec]~[req] :: <*>_N). <a -> a>_R
In the RHS of f :: forall a -> a -> a
Substitution: <InScope = {}
IdSubst = []
TvSubst = []
CvSubst = []>
Using an invisible forall:
{-# LANGUAGE RequiredTypeArguments, ExplicitNamespaces #-}
module M where
visId :: forall a -> a -> a
visId (type a) x = x
g :: forall a. a -> a
g = visId (type a)
$ ./stage1/bin/ghc -dcore-lint M
[1 of 1] Compiling M ( M.hs, M.o )
*** Core Lint errors : in result of Desugar (after optimization) ***
M.hs:8:1: warning:
The type of this binder doesn't match the type of its RHS: g
Binder's type: forall a. a -> a
Rhs type: forall a -> a -> a
In the RHS of g :: forall a. a -> a
Substitution: <InScope = {}
IdSubst = []
TvSubst = []
CvSubst = []>