final project - import problem

62 views
Skip to first unread message

icrnoma...@gmail.com

unread,
Jan 13, 2018, 12:04:14 PM1/13/18
to Haskell-FER
In my main file I imported:

import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Expr
import Text.ParserCombinators.Parsec.Language
import qualified Text.ParserCombinators.Parsec.Token as Token

which I need for my parser and run command cabal install parsec.
But when i compile it a get error message "failed to load interface Text.ParserCombinator.Parser, Text.ParserCombinators....".
I updated cabal and stack, install again parsec but nothing helps.
Can someone help?

Jasmin Zukić

unread,
Jan 14, 2018, 3:40:37 AM1/14/18
to Haskell-FER
You can try adding " - parsec  " into the package.yaml file
There was a recent change in ghc that uses that file instead of stack.yaml (only on some templates)

Luka Hadžiegrić

unread,
Jan 14, 2018, 4:26:35 AM1/14/18
to Haskell-FER
Hm... try to create a new project by running `stack new project_name` (and make sure you have stack installed). Than put your code in the `lib` folder, and add that source file (actually, module name) to `exposed-modules` under `library` section in `project_name.cabal` file. Also, add `parsec` as a dependency in `build-depends` section of the `.cabal` file and delete `package.yaml` file (don't delete `stack.yaml`).

Also, here it says `.Parser` instead of `.Parsec` so maybe check your code for typos :

Text.ParserCombinator.Parser

On Saturday, January 13, 2018 at 6:04:14 PM UTC+1, icrnoma...@gmail.com wrote:

Luka Hadžiegrić

unread,
Jan 14, 2018, 4:28:13 AM1/14/18
to Haskell-FER
After you've done all that run `stack build`, this might take a while if you are doing it for the first time. And after that you can load your code in the repl by running `stack repl`.

Luka Hadžiegrić

unread,
Jan 14, 2018, 4:33:01 AM1/14/18
to haske...@googlegroups.com
And run that within the project folder of course :D

--
You received this message because you are subscribed to a topic in the Google Groups "Haskell-FER" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/haskell-fer/vjiFa8wtevA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to haskell-fer+unsubscribe@googlegroups.com.
To post to this group, send email to haske...@googlegroups.com.
Visit this group at https://groups.google.com/group/haskell-fer.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages