Skip to content

Lint error in forall type

This is an odd bug

{-# Language StaticPointers #-}

import Data.Kind

type Cat ob = ob -> ob -> Type

type Alg cls ob = ob

newtype Frí (cls::Type -> Constraint) :: (Type -> Alg cls Type) where
  Frí :: { with :: forall x. cls x => (a -> x) -> x } 
      -> Frí cls a

data AlgCat (cls::Type -> Constraint) :: Cat (Alg cls Type) where
  AlgCat :: (cls a, cls b) => (a -> b) -> AlgCat cls a b

leftAdj :: AlgCat cls (Frí cls a) b -> (a -> b)
leftAdj (AlgCat f) a = undefined 

causes a

$ ./ghc-stage2 --interactive -ignore-dot-ghci -dcore-lint 222-bug.hs
GHCi, version 8.5.20180128: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 222-bug.hs, interpreted )
*** Core Lint errors : in result of Float out(FOS {Lam = Just 0,
                                                   Consts = True,
                                                   OverSatApps = False}) ***
<no location info>: warning:
    In the type ‘forall (cls :: * -> Constraint) (b :: Alg cls *). b’
    Variable escape in forall: forall (cls :: *
                                              -> Constraint) (b :: Alg cls *).
                               b
*** Offending Program ***
with
  :: forall (cls :: * -> Constraint) a.
     Frí cls a -> forall x. cls x => (a -> x) -> x
[LclIdX[[RecSel]], Arity=2]
with

 ..  . --->8------->8------->8--- ..
Trac metadata
Trac field Value
Version 8.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
8------->8------->8--- ..\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information