Re: [Haskell-cafe] why is ghci trying to load hsc file ??

2011-02-26 Thread Chris Smith
On Sat, 2011-02-26 at 21:36 -0800, bri...@aracnet.com wrote:
> [1 of 2] Compiling Bindings.HDF5( dist/build/Bindings/HDF5.hs,
> interpreted ) *** Parser:
> 
> src/Bindings/HDF5.hsc:49:8: parse error on input `import'

So it's in HDF5.hs ultimately, but LINE directives are telling it to
report a different location.

> HDF5.hs file has LINE scattered throughout, but they are in comments:
> 
> {-# LINE 15 "src/Bindings/HDF5.hsc" #-}

Those {-# ... #-} things are pragmas.  As far as the language spec goes
they are comments, but actually, compilers read them and interpret their
contents.  In this case, it causes the compiler to report a different
location for errors.

> regardless, there is NO "LINE 49" directive, and the HDF5.hs file is
> blank on line 49.

Line 49 of HDF5.hs doesn't matter.  What's on line 49 of the hsc file?

If you don't want to debug using the hsc file (which is the way this is
designed), you'll have to find the LINE directive in the .hs file
nearest to (but before) 49, and count lines from there.

-- 
Chris Smith


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why is ghci trying to load hsc file ??

2011-02-26 Thread briand
On Sat, 26 Feb 2011 18:18:27 -0800 (PST)
Brandon Moore  wrote:

> I assume there's a LINE directive in the file it's actually reading.
> Run ghci with -v to see what file it's actually trying to read.
> 
> 
>   

Here's the relevant output with -v flag:


compile: input file dist/build/Bindings/HDF5.hs
*** Checking old interface for main:Bindings.HDF5:
[1 of 2] Compiling Bindings.HDF5( dist/build/Bindings/HDF5.hs,
interpreted ) *** Parser:

src/Bindings/HDF5.hsc:49:8: parse error on input `import'


This is very weird.

HDF5.hs file has LINE scattered throughout, but they are in comments:

{-# LINE 15 "src/Bindings/HDF5.hsc" #-}

or are they ?  I assumed the purpose of this was line # annotation to
let you know where the line in the .hs file comes from in the .hsc
file.

regardless, there is NO "LINE 49" directive, and the HDF5.hs file is
blank on line 49.

The first line with import (@ 165) is this :

foreign import ccall "H5Dcreate2" c'H5Dcreate2
  :: CInt -> CString -> CInt -> CInt -> CInt -> CInt -> CInt -> IO

I'm trying to figure out if that's legal syntax.

Very strange.  Reporting errors on lines that don't exist makes it
harder to debug :-(

Brian

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] why is ghci trying to load hsc file ??

2011-02-26 Thread Brandon Moore
I assume there's a LINE directive in the file it's actually reading.
Run ghci with -v to see what file it's actually trying to read.


  

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] why is ghci trying to load hsc file ??

2011-02-26 Thread briand
Howdy,

I worked out a small hdf5 binding using cabal and bindings-DSL and
sqlite3 as my example.

Time to try it !

ghci -idist/build/ dist/build/Bindings/HDF5.o -lhdf5 -lhdf5_hl
hdf5_pkg_test.hs


GHCi, version 6.12.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.
Loading object (static) dist/build/Bindings/HDF5.o ... done
Loading object (dynamic) hdf5 ... done
Loading object (dynamic) hdf5_hl ... done
final link ... done
[1 of 2] Compiling Bindings.HDF5( dist/build/Bindings/HDF5.hs,
interpreted )

src/Bindings/HDF5.hsc:49:8: parse error on input `import'
Failed, modules loaded: none.


Huh ?  Why is it trying to read HDF5.hsc ??  What's even more
interesting is that line 49 of that file doesn't have an import on it,
so something is fubar.

No idea how this could be happening.  I've included a copy of my cabal
file.

BTW. I have to specify the hdf5 libraries, i.e. libhdf5 and libhdf5_hl
on the command line. It seems like the build process should have taken
care of that in some way, maybe... ?  Certainly when I use something
like sqlite3, I'm not specifying libsqlite3 on the command line.

Thanks,

Brian


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe