yav / pretty-show

Tools for working with derived Show instances in Haskell.
MIT License
57 stars 15 forks source link

Failed to load interface for ‘Text.Show.Pretty’ #46

Closed zhangysh1995 closed 4 years ago

zhangysh1995 commented 4 years ago

Hi I have a file which uses this lib, but it gives the following error:

zhangys@xxx:~/parser$ ghc -c -O parser.hs

parser.hs:2:1: error:
    Failed to load interface for ‘Text.Show.Pretty’
    Perhaps you meant
      Text.JSON.Pretty (needs flag -package-key json-0.10)
    Use -v to see a list of the files searched for.

zhangys@xxx:~/parser$ ghc -c -O parser.hs -v
Glasgow Haskell Compiler, Version 8.0.2, stage 2 booted by GHC version 8.0.2
Using binary package database: /usr/lib/ghc/package.conf.d/package.cache
Using binary package database: /home/zhangys/.cabal/store/ghc-8.0.2/package.db/package.cache
loading package database /usr/lib/ghc/package.conf.d
loading package database /home/zhangys/.cabal/store/ghc-8.0.2/package.db
wired-in package ghc-prim mapped to ghc-prim-0.5.0.0
wired-in package integer-gmp mapped to integer-gmp-1.0.0.1
wired-in package base mapped to base-4.9.1.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.11.1.0
wired-in package ghc mapped to ghc-8.0.2
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: 
*** Checking old interface for Main:
*** Parser [Main]:
!!! Parser [Main]: finished in 0.88 milliseconds, allocated 0.986 megabytes
*** Renamer/typechecker [Main]:
!!! Renamer/typechecker [Main]: finished in 108.23 milliseconds, allocated 69.577 megabytes

parser.hs:2:1: error:
    Failed to load interface for ‘Text.Show.Pretty’
    Perhaps you meant
      Text.JSON.Pretty (needs flag -package-key json-0.10)
    Locations searched:
      Text/Show/Pretty.hi
      Text/Show/Pretty.hi-boot
*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 

My environment;

zhangys@xxx:~/parser$ cabal info pretty-show
* pretty-show      (program and library)
    Synopsis:      Tools for working with derived `Show` instances and generic
                   inspection of values.
    Versions available: 1.7, 1.8, 1.8.1, 1.8.2, 1.9.2, 1.9.3, 1.9.4, 1.9.5,
                        1.10 (and 29 others)
    Versions installed: 1.10
    Homepage:      http://wiki.github.com/yav/pretty-show
    Bug reports:   [ Not specified ]
    Description:   We provide a library and an executable for working with
                   derived 'Show' instances. By using the library, we can parse
                   derived 'Show' instances into a generic data structure. The
                   @ppsh@ tool uses the library to produce human-readable
                   versions of 'Show' instances, which can be quite handy for
                   debugging Haskell programs. We can also render complex
                   generic values into an interactive Html page, for easier
                   examination.
    Category:      Text
    License:       MIT
    Author:        Iavor S. Diatchki
    Maintainer:    iavor.diatchki@gmail.com
    Source repo:   https://github.com/yav/pretty-show.git
    Executables:   ppsh
    Dependencies:  array >=0.2 && <2, base >=4.5 && <5,
                   haskell-lexer >=1.1 && <2, pretty ==1.*, text -any,
                   filepath -any, ghc-prim -any, pretty-show -any,
                   base >=4.5 && <5
    Documentation: [ Not installed ]
    Cached:        Yes
    Modules:
        Text.Show.Pretty

zhangys@xxx:~/parser$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library 

zhangys@xxx:~/parser$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
zhangysh1995 commented 4 years ago

How I import the lib:

import Text.Show.Pretty (ppShow)

or

import Text.Show.Pretty

Neither of these works.

yav commented 4 years ago

Hi there! To use the library you'll have to declare it as a dependency in your cabal file. You can find out more about cabal here: https://www.haskell.org/cabal/

Once you've done that you should be able to import any of the modules from the library. Which ones you import, and how you do it, depends on what you are trying to do. A quick introduction to Haskell's module system is here: https://www.haskell.org/tutorial/modules.html