Kritzefitz
Kritzefitz

Reputation: 2754

No instance for (Typeable PackageName)

I try to compile this code:

import Data.Typeable
import Distribution.Package

name :: PackageName
name = PackageName "Foo"

main = do
  print $ typeOf name

But this fails with this error:

No instance for (Typeable PackageName)
  arising from a use of `typeOf'
Possible fix:
  add an instance declaration for (Typeable PackageName)
In the second argument of `($)', namely `typeOf name'
In a stmt of a 'do' block: print $ typeOf name
In the expression: do { print $ typeOf name }

However, both the documentation for Cabal and the source code say that PackageName has an derived instance for Typeable. What am I missing?

ghc version: 7.6.3
cabal version: 1.16.0

Upvotes: 2

Views: 228

Answers (1)

user2407038
user2407038

Reputation: 14578

The documentation for Cabal-1.16.0.1 actually shows there is no instance Typeable PackageName. The documentation indicates the this instance first appears in version 1.18.0, so you should install a version later than that one (preferably the latest). (Note that cabal-install and the Haskell package Cabal are not the same thing and that cabal-install is a standalone program not dependent on the package Cabal).

Upvotes: 1

Related Questions