Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 461
    • Merge requests 461
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9981
Closed
Open
Created Jan 13, 2015 by Herbert Valerio Riedel@hvr🕺Maintainer

Potential typechecker regression in GHC 7.10.1RC

The following snippet (extracted from hackage:index-core) is accepted by GHCs prior to GHC 7.10:

{-# LANGUAGE Rank2Types, TypeOperators #-}

module Foo where

type a :-> b = forall i . a i -> b i

class IFunctor f where
    fmapI :: (a :-> b) -> (f a :-> f b)

class (IFunctor m) => IMonad m where
    returnI ::  a :-> m a
    bindI   :: (a :-> m b) -> (m a :-> m b)

(?>=) :: (IMonad m) => m a i -> (a :-> m b) -> m b i
(?>=) = flip bindI
$ ghci-7.8.4 -Wall Foo.hs 
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Control.IMonad.Core ( Foo.hs, interpreted )
Ok, modules loaded: Control.IMonad.Core.
λ:2> :browse
type (:->) (a :: * -> *) (b :: * -> *) = forall i. a i -> b i
class IFunctor (f :: (* -> *) -> * -> *) where
  fmapI :: (a :-> b) -> f a :-> f b
class IFunctor m => IMonad (m :: (* -> *) -> * -> *) where
  returnI :: a i -> m a i
  bindI :: (a :-> m b) -> m a :-> m b
(?>=) :: IMonad m => m a i -> (a :-> m b) -> m b i

vs.

$ ghci-7.10.0.20141227 -Wall Foo.hs 
GHCi, version 7.10.0.20141227: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Control.IMonad.Core ( Foo.hs, interpreted )

Foo.hs:15:14:
    Couldn't match type ‘a i0 -> m b i0’ with ‘forall i1. a i1 -> m b i1’
    Expected type: (a i0 -> m b i0) -> m a i -> m b i
      Actual type: a :-> m b -> m a i -> m b i
    Relevant bindings include (?>=) :: m a i -> a :-> m b -> m b i (bound at Foo.hs:15:1)
    In the first argument of ‘flip’, namely ‘bindI’
    In the expression: flip bindI
Failed, modules loaded: none.
λ:2> 

I'm not sure though whether that module was valid to begin with...

Trac metadata
Trac field Value
Version 7.10.1-rc1
Type Bug
TypeOfFailure ValidProgramRejected
Priority highest
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking