Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Import errors from a very simple program (John Sturdy) 2. Re: Import errors from a very simple program (Francesco Ariis) 3. Re: Import errors from a very simple program (Daniel Trstenjak) 4. Re: Import errors from a very simple program (John Sturdy) ---------------------------------------------------------------------- Message: 1 Date: Thu, 26 Sep 2019 14:53:23 +0100 From: John Sturdy <jcg.stu...@gmail.com> To: Beginners@haskell.org Subject: [Haskell-beginners] Import errors from a very simple program Message-ID: <cafjf9knhvy5qpyyhm0xtnokqzozeoshfkcetmtr_khqkcqq...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi, I'm right at the start of learning Haskell, and I decided to jump from reading LYAH to writing a simple real-world program. It's based very closely on https://github.com/haskell-hvr/cassava/blob/master/examples/NamedBasedGeneric.hs (I removed the bit that constructs the test file, as I already have a file), and I've done "cabal install cassava", first as root, and then when I first go the error, as myself using the sandbox (which didn't change the output). I first tried this with running ghc directly, and then followed the instructions on https://wiki.haskell.org/How_to_write_a_Haskell_program, and all these get the same errors: Main.hs:4:1: error: Could not find module ‘Data.Csv’ Locations searched: Data/Csv.hs Data/Csv.lhs Data/Csv.hsig Data/Csv.lhsig | 4 | import Data.Csv | ^^^^^^^^^^^^^^^ Main.hs:6:1: error: Could not find module ‘Data.Vector’ Perhaps you meant Data.Functor (from base-4.11.1.0) Locations searched: Data/Vector.hs Data/Vector.lhs Data/Vector.hsig Data/Vector.lhsig | 6 | import qualified Data.Vector as V | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I don't understand the connection between the name "cassava" and "Data/Csv", although looking around in the directories that have been produced, I see that Data/Csv is within the cassava directories. I'd like not only to know how to fix this, but also a pointer for what I should look at to understand what is going on. This is on a Debian system. thanks, __John (completely new to Haskell, experienced in C, Lisp, Python and others, if that helps to pitch the level of answers) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190926/3d83cc31/attachment-0001.html> ------------------------------ Message: 2 Date: Thu, 26 Sep 2019 16:15:40 +0200 From: Francesco Ariis <fa...@ariis.it> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Import errors from a very simple program Message-ID: <20190926141540.lajv5celof4jh...@x60s.casa> Content-Type: text/plain; charset=utf-8 Hello John, On Thu, Sep 26, 2019 at 02:53:23PM +0100, John Sturdy wrote: > Hi, > > I'm right at the start of learning Haskell, and I decided to jump from > reading LYAH to writing a simple real-world program. > > It's based very closely on > https://github.com/haskell-hvr/cassava/blob/master/examples/NamedBasedGeneric.hs Cabalising a small project is one way to do it (and a useful skill to learn, too): cd ~/somefolder wget -O Main.hs https://raw.githubusercontent.com/haskell-hvr/cassava/master/examples/NamedBasedGeneric.hs cabal init --is-executable --dependency=base --dependency=bytestring --dependency=vector --dependency=text --dependency=cassava # many questions! There is a non-interactive option. cabal new-repl # ghci repl for your project λ> main Bingo! Read the generated .cabal file to learn more on how it works Does this help? -F ------------------------------ Message: 3 Date: Thu, 26 Sep 2019 16:18:14 +0200 From: Daniel Trstenjak <daniel.trsten...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Import errors from a very simple program Message-ID: <20190926141814.GA24606@octa> Content-Type: text/plain; charset=us-ascii Hi John, if I'm understanding you correctly, you're installing packages by hand with 'cabal install' and then calling 'ghc' by hand for your source file. 'ghc' won't automatically use the packages you've installed with 'cabal install', but you've to add them to the 'ghc' call. Your compile error seems to indicate, that the 'cassava' and 'vector' packages haven't been given to the 'ghc' call. But most likely it isn't worth the hassle doing this and it is a lot easier to just create a default cabal file with 'cabal init'. Then you can add the 'cassava' and 'vector' packages as dependencies and build the packages and your source file with 'cabal new-build'. Greetings, Daniel ------------------------------ Message: 4 Date: Thu, 26 Sep 2019 15:26:22 +0100 From: John Sturdy <jcg.stu...@gmail.com> To: Beginners@haskell.org Subject: Re: [Haskell-beginners] Import errors from a very simple program Message-ID: <CAFJf9KPvYdNgK0bBd2UKbBkDHjdkbusk9oGN+t=jkatctmz...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Thu, Sep 26, 2019 at 3:18 PM Daniel Trstenjak <daniel.trsten...@gmail.com> wrote: > Hi John, > > 'ghc' won't automatically use the packages you've installed with 'cabal > install', > but you've to add them to the 'ghc' call. > Thanks, that'll be the key to what's going on. I had assumed that installed packages would be automatically available for "import", as they are in Python. (The program I'm writing has the same functionality as a Python program I had written earlier, which probably biased me to thinking that way.) __John -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190926/b0c38517/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 135, Issue 2 *****************************************