Help!, was Re: Trouble with "import qualified"

Hi. I've had this up for over a week, and haven't received any response. Any help would be greatly appreciated. On 5/16/12 10:04 PM, Dudley Brooks wrote:
Almost complete beginner.
I just downloaded Haskell 32-bit for Mac from Haskell.org and am going through Learn You a Haskell. I tried to follow the instructions on
http://learnyouahaskell.com/modules#loading-modules
in particular
import qualified Data.Map as Map
which, following the instructions, I put in a .hs file which I attempted to load into GHCi with :l. I got
parse error on input `import'
I have no idea what the problem might be or what to do about it. Other imports have been successful, but after getting the above message I tried to "import qualified" other modules, always with the same error.

On 05/24/12 12:34, Dudley Brooks wrote:
Hi. I've had this up for over a week, and haven't received any response. Any help would be greatly appreciated.
On 5/16/12 10:04 PM, Dudley Brooks wrote:
Almost complete beginner.
I just downloaded Haskell 32-bit for Mac from Haskell.org and am going through Learn You a Haskell. I tried to follow the instructions on
http://learnyouahaskell.com/modules#loading-modules
in particular
import qualified Data.Map as Map
which, following the instructions, I put in a .hs file which I attempted to load into GHCi with :l. I got
parse error on input `import'
I have no idea what the problem might be or what to do about it. Other imports have been successful, but after getting the above message I tried to "import qualified" other modules, always with the same error.
Try starting from a fresh file? I just tried the simplest thing I could think of to reproduce this, but it worked: jumba ~ $ echo "import qualified Data.Map as Map" >> test.hs jumba ~ $ echo "main = print \"Hello, World\"" >> test.hs jumba ~ $ runhaskell test.hs "Hello, World" jumba ~ $ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :l test.hs [1 of 1] Compiling Main ( test.hs, interpreted ) Ok, modules loaded: Main. *Main> main Loading package array-0.4.0.0 ... linking ... done. Loading package deepseq-1.3.0.0 ... linking ... done. Loading package containers-0.4.2.1 ... linking ... done. "Hello, World" *Main>

Michael Orlitzky
jumba ~ $ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
I doubt this really matters when it comes to import statements, but note that the Haskell platform's latest release is using GHC/GHCi version 7.0.4. (hi mjo :) ) -Keshav

It sounds mostly likely that there were spaces or tabs in the wrong place.
Good luck....
On Thu, May 24, 2012 at 9:58 AM, Keshav Kini
Michael Orlitzky
writes: jumba ~ $ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
I doubt this really matters when it comes to import statements, but note that the Haskell platform's latest release is using GHC/GHCi version 7.0.4.
(hi mjo :) )
-Keshav
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On 05/24/12 12:58, Keshav Kini wrote:
Michael Orlitzky
writes: jumba ~ $ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
I doubt this really matters when it comes to import statements, but note that the Haskell platform's latest release is using GHC/GHCi version 7.0.4.
(hi mjo :) )
-Keshav
For a second I was sure I sent this to the wrong list =) If the OP doesn't see any misplaced whitespace at the beginning of the file, I'd also check that there's isn't any unicode junk there.

On Thu, May 24, 2012 at 1:35 PM, Michael Orlitzky
If the OP doesn't see any misplaced whitespace at the beginning of the file, I'd also check that there's isn't any unicode junk there.
In particular, it was recently found that GHC doesn't ignore the byte order marks that some versions of Notepad and friends prepend to text files even in UTF8 mode. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

On Thu, May 24, 2012 at 09:34:22AM -0700, Dudley Brooks wrote:
Hi. I've had this up for over a week, and haven't received any response. Any help would be greatly appreciated.
When you say "had this up", what do you mean? I don't see any other messages from you to the haskell-beginners list.
in particular
import qualified Data.Map as Map
which, following the instructions, I put in a .hs file which I attempted to load into GHCi with :l. I got
parse error on input `import'
It's impossible to tell what's wrong only from this description. If you upload an *exact* copy of your file somewhere (e.g. hpaste.org) I'm sure someone could take a look. Some general things to watch out for: * the real error could be in the previous line to the one being reported * all the imports have to come at the very beginning of a module * don't put any spaces or tabs before "import" -Brent
participants (6)
-
Brandon Allbery
-
Brent Yorgey
-
Dudley Brooks
-
Keshav Kini
-
Michael Orlitzky
-
Tim Perry