0

I want to use the following for testing the ReadP Monad Parser. https://hackage.haskell.org/package/tasty-1.4.3/docs/Test-Tasty-Patterns-Parser.html . How can I install it correctly?

When trying to import

I get

Test.hs:7:1: error:
    Could not load module `Test.Tasty.Patterns'
    it is a hidden module in the package `tasty-1.4.3'
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
7 | import Test.Tasty.Patterns
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, two modules loaded.

When trying the :set -v and :set -package tasty-hunit-patterns

I get:

*** initializing unit database:
package flags [-package-id ghc-9.0.1{unit ghc-9.0.1 True ([])},
               -package-id bytestring-0.10.12.1{unit bytestring-0.10.12.1 True ([])},
               -package-id base-4.15.0.0{unit base-4.15.0.0 True ([])},
               -package-id time-1.9.3{unit time-1.9.3 True ([])},
               -package-id hpc-0.6.1.0{unit hpc-0.6.1.0 True ([])},
               -package-id filepath-1.4.2.1{unit filepath-1.4.2.1 True ([])},
               -package-id process-1.6.11.0{unit process-1.6.11.0 True ([])},
               -package-id array-0.5.4.0{unit array-0.5.4.0 True ([])},
               -package-id integer-gmp-1.1{unit integer-gmp-1.1 True ([])},
               -package-id containers-0.6.4.1{unit containers-0.6.4.1 True ([])},
               -package-id ghc-boot-9.0.1{unit ghc-boot-9.0.1 True ([])},
               -package-id binary-0.8.8.0{unit binary-0.8.8.0 True ([])},
               -package-id ghc-prim-0.7.0{unit ghc-prim-0.7.0 True ([])},
               -package-id ghci-9.0.1{unit ghci-9.0.1 True ([])},
               -package-id rts-1.0{unit rts-1.0 True ([])},
               -package-id transformers-0.5.6.2{unit transformers-0.5.6.2 True ([])},
               -package-id deepseq-1.4.5.0{unit deepseq-1.4.5.0 True ([])},
               -package-id ghc-boot-th-9.0.1{unit ghc-boot-th-9.0.1 True ([])},
               -package-id pretty-1.1.3.6{unit pretty-1.1.3.6 True ([])},
               -package-id template-haskell-2.17.0.0{unit template-haskell-2.17.0.0 True ([])},
               -package-id directory-1.3.6.1{unit directory-1.3.6.1 True ([])},
               -package-id text-1.2.4.1{unit text-1.2.4.1 True ([])},
               -package-id random-1.2.1-e1879819ad2512292cbd29842949fd250c449266{unit random-1.2.1 True ([])},
               -package-id QuickCheck-2.14.2-ddd3158346bc1397aa376f2d5b48d0fd800681db{unit QuickCheck-2.14.2 True ([])},
               -package tasty{package tasty True ([])},
               -package tasty-hunit{package tasty-hunit True ([])},
               -package tasty-hunit-patterns{package tasty-hunit-patterns True ([])}]
loading package database C:\tools\ghc-9.0.1\lib\package.conf.d
loading package database C:\Users\tqx98\AppData\Roaming\cabal\store\ghc-9.0.1\package.db
cannot satisfy -package tasty-hunit-patterns
    (use -v for more information)

And on when trying to install, I get:

PS D:\CurrentDir\code> cabal install tasty-hunit-patterns
cabal.exe: Unknown package "tasty-hunit-patterns".

EDIT

I have now tried to add the package with stack as suggested in the comments. I get his output:

PS D:\Redo_haskell_folder\code> stack install Test.Tasty.Patterns.Parser
Error: [S-8506]
Error parsing targets: Directory not found: Test.Tasty.Patterns.Parser
PS D:\Redo_haskell_folder\code> stack install Test.Tasty.Patterns       
Error: [S-8506]
Error parsing targets: Directory not found: Test.Tasty.Patterns
PS D:\Redo_haskell_folder\code> stack exec -- ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.5

This would be the typically procedure of using stack what am I missing?

Piskator
  • 605
  • 1
  • 9
  • As the first error message states, the package name is `tasty`. See e.g. https://stackoverflow.com/q/48854832/126014 – Mark Seemann Dec 22 '22 at 13:38
  • @Mark Seemann Just to be sure I understand what you mean. You suggest that I download `the Test.Tasty.Patterns from https://hackage.haskell.org/package/tasty manually from the browser, since it is in the hackage library where basically every package of Haskell is? Furthermore this will not work when I use cabal or stack since they rely on stackage !? – Piskator Dec 27 '22 at 08:23
  • I don't know about Cabal, but with Stack, can't you add the package `tasty`? – Mark Seemann Dec 27 '22 at 09:55
  • I will try.. but I am expericing some problems with `stack` at the moment, see: https://stackoverflow.com/questions/74927912/haskell-stack-gives-invalidreldir-error-no-matter-the-input so I probably need to solve those before I can proceed as you suggest. – Piskator Dec 27 '22 at 10:00
  • @MarkSeemann , I have now succedded in getting stack setup correctly. However I still have problems with the Test.Tasty.Patterns ... do you know what the problem is based on my edited description? – Piskator Jan 06 '23 at 12:14
  • I can't tell from the post. 1. It seems that you are also trying for some other package. 2. It looks like you are trying to *install* a package with Stack, which (at least in the way that I know to use Stack) is not how you use it. – Mark Seemann Jan 06 '23 at 15:31
  • Yes, I tried to install both `Test.Tasty.Patterns.Parser` and `Test.Tasty.Patterns` to see if it would work with or without `Parser` at the end. Could you tell me how you would install with stack if not by using `stack install package` as suggested here: https://stackoverflow.com/questions/31030438/how-to-install-a-package-using-stack – Piskator Jan 07 '23 at 08:45
  • If you want to experiment with a package in an ad-hoc manner in GHCi, you can do this: https://stackoverflow.com/q/39848576/126014 – Mark Seemann Jan 09 '23 at 06:25
  • If you want to use Stack to compile and run Haskell code, you make a *project* and add the packages as build dependencies. There's a couple of alternatives for that. I currently find Hpack the easiest alternative. See [the Stack documentation](https://docs.haskellstack.org/en/stable/GUIDE/) for details. – Mark Seemann Jan 09 '23 at 06:30

0 Answers0