Skip to content

Core Lint error with term-level matchable arrows

The following code will produce an error when compiled with -dcore-lint:

{-# LANGUAGE DataKinds #-}
module Bug where

import GHC.Exts (Matchability(..))

f :: (->>) Matchable a a
f x = x
$ ghc-stage2 Bug.hs -dcore-lint
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Desugar (before optimization) ***
Bug.hs:7:1: warning:
    [RHS of f :: forall a. a -> a]
    The type of this binder doesn't match the type of its RHS: f
    Binder's type: forall a. a -> a
    Rhs type: forall a. a ~> a
*** Offending Program ***
Rec {
$trModule :: Module
[LclIdX]
$trModule = Module (TrNameS "main"#) (TrNameS "Bug"#)

f :: forall a. a -> a
[LclIdX]
f = \ (@ a_a101) (x_aZQ :: a_a101) -> x_aZQ
end Rec }

*** End of Offense ***


<no location info>: error: 
Compilation had errors