Can't deduce implicit parameter
I tried running a gist
{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-}
data Rec fields where
Rec :: fields => Rec fields
infixr 1 ?
(?) :: Rec fields -> (fields => r) -> r
Rec ? e = e
record :: Rec (?a :: Int, ?b :: String)
record = Rec where ?a=42
?b="hey"
access :: Int
access = record ? ?a
and got
$ ghci -ignore-dot-ghci tCHB.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( tCHB.hs, interpreted )
tCHB.hs:15:19: error:
• Could not deduce: ?a::Int
arising from a use of implicit parameter ‘?a’
from the context: (?a::Int, ?b::String)
bound by a type expected by the context:
(?a::Int, ?b::String) => Int
at tCHB.hs:15:10-20
• In the second argument of ‘(?)’, namely ‘?a’
In the expression: record ? ?a
In an equation for ‘access’: access = record ? ?a
Failed, modules loaded: none.
Prelude>
I would certainly expect the context (?a::Int, ?b::String)
to imply ?a::Int
?
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |