Can't use libraries in haskell

Hello, I'm new in haskell. I want to use xml library (http://hackage.haskell.org/package/xml) in my project. I downloaded it.then try to build and install: runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs install All ok. There are no errors. When i try import modules from this lib to my project, for example: import Text.XML.Light.Cursor I get error: /home/shk/dev/src/XMPP.hs:8:8: Could not find module `Text.XML.Light.Cursor': Use -v to see a list of the files searched for. Failed, modules loaded: none. if i try:
cabal install xml Resolving dependencies... No packages to be installed. All the requested packages are already installed. If you want to reinstall anyway then use the --reinstall flag. What's wrong? How can i install and use library in haskell? Thank you.

What's wrong? How can i install and use library in haskell?
First thing is to do 'ghc-pkg list'. If your package doesn't show up then it's not installed, according to the package registry. 'cabal install' should have registered it. If it is in the list, then it depends how you're building. If you use ghc manually, then you have to give '-package xyz'. If you use 'ghc --make', ghc will automatically add the -package for you. If you use cabal, you put the package in the dependencies, and 'cabal build' will add -package for you. If the package has parens, then someone hid it, and you'll have to do 'ghc-pkg expose' on it. If you're doing everything else right and it still doesn't find the package, then you can run ghc -v and it'll print lots of details. It might have something about 'hiding xyz because of <some version thing>', which means you're depending on libraries that expect different versions of the underlying library. You can sometimes get out of this by carefully upgrading or downgrading certain libraries.

Thank you, for reply. Yes i use ghc.
First thing is to do 'ghc-pkg list'. If your package doesn't show up then it's not installed, according to the package registry. 'cabal install' should have registered it. If it is in the list, then it depends how you're building. If you use ghc manually, then you have to give '-package xyz'. If you use 'ghc --make', ghc will automatically add the -package for you. If you use cabal, you put the package in the dependencies, and 'cabal build' will add -package for you.
If i want to use ghci to test any function from my project. How can i import lib then? Thank you.

2011/6/26 Александр
Thank you, for reply.
Yes i use ghc.
First thing is to do 'ghc-pkg list'. If your package doesn't show up then it's not installed, according to the package registry. 'cabal install' should have registered it. If it is in the list, then it depends how you're building. If you use ghc manually, then you have to give '-package xyz'. If you use 'ghc --make', ghc will automatically add the -package for you. If you use cabal, you put the package in the dependencies, and 'cabal build' will add -package for you.
If i want to use ghci to test any function from my project. How can i import lib then?
I find this is easiest with cabal-dev. Here is a guide to using cabal-dev: http://www.reddit.com/r/haskell/comments/f3ykj/psa_use_cabaldev_to_solve_dep... When I want to test out a library in ghci I do the following: mkdir -p ~/tmp/test-foo cd ~/tmp/test-foo cabal-dev install foo cabal-dev ghci That puts me in ghci with the newly installed foo available so then you just type, :m + Data.Foo, or in recent ghci you can even type import Data.Foo. I hope that helps, Jason
participants (3)
-
Evan Laforge
-
Jason Dagit
-
Александр