[GHC] #14484: GHC rejects use of mulit-param type class.

#14484: GHC rejects use of mulit-param type class. -------------------------------------+------------------------------------- Reporter: trinithis | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 (Type checker) | Keywords: | Operating System: Windows Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In the following example, I instantiate a few small typeclasses. The last instantiation provided does not compile, despite it being virtually identical the prior instantiation. {{{#!hs {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} -------------------------------------------------------------------------------- class Collection collection handle | collection -> handle, handle -> collection where getHandles :: collection -> [handle] -------------------------------------------------------------------------------- data HandleX = HandleX Int data CollectionX = CollectionX [HandleX] instance Collection CollectionX HandleX where getHandles (CollectionX handles) = handles -------------------------------------------------------------------------------- newtype HandleY = HandleY HandleX newtype CollectionY = CollectionY CollectionX instance Collection CollectionY HandleY where getHandles (CollectionY collectionX) = map HandleY $ getHandles collectionX -- Good, this compiles! -------------------------------------------------------------------------------- newtype HandleZ = HandleZ HandleY newtype CollectionZ = CollectionZ CollectionY instance Collection CollectionZ HandleZ where getHandle (CollectionZ collectionY) = map HandleZ $ getHandles collectionY -- Error: `getHandle' is not a (visible) method of class `Collection' }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14484 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14484: GHC rejects use of mulit-param type class. -------------------------------------+------------------------------------- Reporter: trinithis | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.2 checker) | Resolution: invalid | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => invalid Comment: Well, yes. This is to be expected—in the last `Collection` instance, you mispelled `getHandles` as `getHandle` in: {{{#!hs getHandle (CollectionZ collectionY) = ... }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14484#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC