
Hi! I have a small file Test.hs alone in a directory: {-# LANGUAGE DeriveGeneric #-} module Test where import Data.Hashable import Data.Scientific import GHC.Generics data Sc = Sc Scientific deriving (Generic) instance Hashable Sc To be able to load this file, I set up a Cabal sandbox: $ ghc --numeric-version 8.0.2 $ cabal --numeric-version 1.24.0.2 $ cabal sandbox init ... $ cabal install hashable-1.2.6.0 scientific ... (Note: not the latest version of hashable.) Now, if I try to run GHCi and point it to the sandbox' package database I get this error: $ ghci -package-db=.cabal-sandbox/x86_64-linux-ghc-8.0.2-packages.conf.d Test.hs GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Test ( Test.hs, interpreted ) Test.hs:12:14: error: • No instance for (Hashable Scientific) arising from a use of ‘hashable-1.2.6.1:Data.Hashable.Class.$dmhashWithSalt’ • In the expression: hashable-1.2.6.1:Data.Hashable.Class.$dmhashWithSalt @Sc In an equation for ‘hashWithSalt’: hashWithSalt = hashable-1.2.6.1:Data.Hashable.Class.$dmhashWithSalt @Sc In the instance declaration for ‘Hashable Sc’ Somehow it mixes in version 1.2.6.1 of hashable, even though this package isn't installed (neither in the sandbox nor the global database). It turns out that wrapping the command in `cabal exec` fixes the problem: $ cabal exec -- ghci -package-db=.cabal-sandbox/x86_64-linux-ghc-8.0.2-packages.conf.d Test.hs GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Test ( Test.hs, interpreted ) Ok, modules loaded: Test. *Test> Any idea what's going on? / Emil
participants (1)
-
Emil Axelsson