mhwombat
mhwombat

Reputation: 8136

No instance for (Convertible Int Double)

Can anyone explain this error message? According to Hackage, Data.Convertible.Base, version 1.0.11.1 has an instance declaration for Convertible Int Double.

λ> :set -package=convertible-1.0.11.1
package flags have changed, resetting and loading new packages...                                                                    
λ> import Data.Convertible.Base
λ> let b = 3 :: Int
λ> convert b :: Double

<interactive>:18:1:
    No instance for (Convertible Int Double)
      arising from a use of `convert'
    Possible fix:
      add an instance declaration for (Convertible Int Double)
    In the expression: convert b :: Double
    In an equation for `it': it = convert b :: Double

Upvotes: 1

Views: 100

Answers (1)

kosmikus
kosmikus

Reputation: 19657

The Haddock documentation displays the instances defined in the package. It doesn't necessarily mean that they're defined in the same module as the datatype. You should

import Data.Convertible

or at least

import Data.Convertible.Instances

Upvotes: 3

Related Questions