Skip to content

Common Sense for Type Classes

GHC erroneously reports that there is "No instance of C". But, in fact, there is an instance, C Int Char; furthermore, it is the only instance. So GHC should use it!

{-# LANGUAGE MultiParamTypeClasses #-}
module T4921 where

class C a b where
    f :: (a,b)

instance C Int Char where
    f = undefined

x = fst f
y = fst f :: Int
Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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