How do I import a package I have installed from stackage?

244 views Asked by At

I am trying to import and use the prettyprinter package. I have installed the package via stack with the following command:

stack install prettyprinter

However, I have trouble trying to import this package once I load ghci to try it. I have been taking shots in the dark, such as:

import prettyprinter

import Prettyprint

import Data.Text.Prettyprint

... and so on. Can anyone tell me the right command? Since this is just the latest of many similar experiences, I'd also like to know how I can figure out this command for myself using the information on the stackage page.

2

There are 2 answers

0
Kevin Bradner On

Thanks to Willem Van Onsem for pointing out that I need to be importing modules, not packages. In this case, import Data.Text.Prettyprint.Doc was the appropriate choice.

0
segment-tree On

How do you start ghci?

You shouldn't start it directly.

You may try stack exec ghci.