How to get a Language reference in a test
Gauteab opened this issue · comments
If I try to import TreeSitter.Haskell
in Example.hs
I get
test/TreeSitter/Example.hs:15:1: error:
Could not load module ‘TreeSitter.Haskell’
It is a member of the hidden package ‘tree-sitter-haskell-0.3.0.1’.
Perhaps you need to add ‘tree-sitter-haskell’ to the build-depends in your .cabal file.
It is a member of the hidden package ‘tree-sitter-haskell-0.3.0.1’.
Perhaps you need to add ‘tree-sitter-haskell’ to the build-depends in your .cabal file.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
Adding tree-sitter-haskell
to build-depends
in test-suite: test
I get
cabal: Could not resolve dependencies:
[__0] trying: tree-sitter-0.9.0.2 (user goal)
[__1] trying: tree-sitter-haskell-0.3.0.1 (user goal)
[__2] trying: tree-sitter-haskell:+build-examples
[__3] rejecting: tree-sitter:*test (cyclic dependencies; conflict set:
tree-sitter, tree-sitter-haskell)
[__1] rejecting: tree-sitter-haskell-0.3.0.0, tree-sitter-haskell-0.2.0.1,
tree-sitter-haskell-0.2.0.0, tree-sitter-haskell-0.1.0.0 (constraint from user
target requires ==0.3.0.1)
[__1] fail (backjumping, conflict set: tree-sitter, tree-sitter-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: tree-sitter, tree-sitter-haskell
Trying to get something running so I can try implementing Queries.
I'm not very experienced with cabal.
Have you added the tree-sitter-haskell
package as a dependency in the test suite stanza?
Yes, that's when I got the second error.
Ah, I see. The problem is here?
[__2] trying: tree-sitter-haskell:+build-examples
[__3] rejecting: tree-sitter:*test (cyclic dependencies; conflict set:
tree-sitter, tree-sitter-haskell)
You’re attempting to import tree-sitter-haskell
from the tree-sitter
package itself, which is a problem in that tree-sitter-haskell
depends on tree-sitter
. You can either move your examples to the tree-sitter-haskell
package (which has an example; check Demo.hs
) or you can start a whole new package and import from there.
By the way, please be aware that the tree-sitter-haskell
grammar is in flux, and though it parses a lot of GHC Haskell it doesn’t handle everything correctly and doesn’t implement all language extensions (we need BlockArguments support, for one). Feel free to file bugs here should you find them.
Thank you!
I have made some progress with queries. Hopefully I'll be able to finish it
Awesome. I’m going to close this for now, but feel free to leave comments in the thread should the need arise.