Skip to content

Impredicative implicit parameters

There doesn't seem to be a way to make impredicative implicit parameters work in 7.4.2:

{-# LANGUAGE ImplicitParams, ImpredicativeTypes #-}
module Bug where

    f1 :: Maybe ((?a :: Bool) => Char)
    f1 = Just 'C'

    f2 :: Maybe ((?a :: Bool) => Bool)
    f2 = Just ?a
$ ghc -c Bug.hs 

Bug.hs:5:15:
    Couldn't match expected type `(?a::Bool) => Char'
                with actual type `Char'
    In the first argument of `Just', namely 'C'
    In the expression: Just 'C'
    In an equation for `f1': f1 = Just 'C'

Bug.hs:8:15:
    Unbound implicit parameter (?a::(?a::Bool) => Bool)
      arising from a use of implicit parameter `?a'
    In the first argument of `Just', namely `?a'
    In the expression: Just ?a
    In an equation for `f2': f2 = Just ?a

I believe this used to work?

Trac metadata
Trac field Value
Version 7.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
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