From rrt1001@cam.ac.uk Wed Oct 4 16:00:35 2000
Date: Wed, 4 Oct 2000 16:00:35 +0100 (BST)
From: Reuben Thomas rrt1001@cam.ac.uk
Subject: New InstallShield of GHC 4.08.1
I've just put up a new InstallShield of 4.08.1
(http://www.haskell.org/ghc/download.html, as usual). It fixes some
problems with missing symbols when linking dynamically, and is also better
behaved, in that it clears up the temporary files it makes during
installation, so that when uninstalled it really does delete everything.
--
http://sc3d.org/rrt/ | maxim, n. wisdom for fools
From simonpj@microsoft.com Thu Oct 5 16:54:02 2000
Date: Thu, 5 Oct 2000 08:54:02 -0700
From: Simon Peyton-Jones simonpj@microsoft.com
Subject: Generics
Folks,
I've added Hinze/PJ-style generic class definitions to GHC, based
on summer hacking done by Andrei Serjantov. The design is based
very closely on the Haskell workshop 2000 paper
http://www.informatik.uni-bonn.de/~ralf/Derive.ps.gz
For example:
class Bin a where
toBin :: a -> [Int]
fromBin :: [Int] -> (a, [Int])
toBin {| Unit |} Unit = []
toBin {| a :+: b |} (Inl x) = 0 : toBin x
toBin {| a :+: b |} (Inr y) = 1 : toBin y
toBin {| a :*: b |} (x :*: y) = toBin x ++ toBin y
fromBin {| Unit |} bs = (Unit, bs)
fromBin {| a :+: b |} (0:bs) = (Inl x, bs') where (x,bs') = fromBin
bs
fromBin {| a :+: b |} (1:bs) = (Inr y, bs') where (y,bs') = fromBin
bs
fromBin {| a :*: b |} bs = (x :*: y, bs'') where (x,bs' ) =
fromBin bs
(y,bs'') = fromBin bs'
Now we can say simply
instance Bin a => Bin [a]
and the compiler will derive the appropriate code automatically.
This is now implemented and documented in the CVS version of GHC,
and will be in every future version of GHC. (But I'm afraid we don't plan
a binary release for a while.)
At present we don't (alas) support constructor and field names, so you
can't implement Read and Show generically. But I thought it was worth
getting committed what *is* done.
Simon
From rrt1001@cam.ac.uk Fri Oct 6 17:29:50 2000
Date: Fri, 6 Oct 2000 17:29:50 +0100 (BST)
From: Reuben Thomas rrt1001@cam.ac.uk
Subject: Haskell Heaven for Windows Weenies: Pesky Profiling Problems Pulverized
There's a new 4.08.1 InstallShield with what I *think* are working
profiling libraries (static only).
--
http://sc3d.org/rrt/ | free, a. already paid for
From haskell@davidb.org Tue Oct 10 01:04:25 2000
Date: Mon, 9 Oct 2000 17:04:25 -0700
From: David Brown haskell@davidb.org
Subject: Porting to powerpc-linux
I'm considering taking some effort to port GHC to powerpc linux. The task
seems moderately doable, given that GHC once ran on the powerpc
architecture.
I guess as a good first question: should I start with 4.08.1, or should I
venture off with the CVS tree. The driver in CVS seems to have been
written in Haskell, and it seems to be needed to build the runtime. This
sounds like it would preclude building from .hc files.
I've got my x86 linux box ready to build some unregistered .hc files.
Dave (looking forward to debugging RTS) Brown
From fldrsimonmar@microsoft.com Tue Oct 10 11:15:49 2000
Date: Tue, 10 Oct 2000 03:15:49 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: Porting to powerpc-linux
> I'm considering taking some effort to port GHC to powerpc
> linux. The task
> seems moderately doable, given that GHC once ran on the powerpc
> architecture.
Cool! :)
> I guess as a good first question: should I start with 4.08.1,
> or should I
> venture off with the CVS tree. The driver in CVS seems to have been
> written in Haskell, and it seems to be needed to build the
> runtime. This
> sounds like it would preclude building from .hc files.
I would start from 4.08.1, for exactly that reason. We haven't tackled the
issue of bootstrapping with the Haskell driver. The plan was to use a
handwritten Makefile to build an unregisterised driver from .hc sources
using plain gcc, but this isn't done yet. Furthermore, we're about to merge
the driver with the compiler proper as part of the GHCi reorganisation, so
things are going to be broken for a while...
> I've got my x86 linux box ready to build some unregistered .hc files.
You'll need two build trees. In the first tree, build the compiler as
normal, and the libraries/RTS with -unreg -keep-hc-files-too. You should be
able to use these .hc files to try out some simple programs on the PPC.
In the second tree, bootstrap the compiler using the compiler from the first
tree with -unreg -keep-hc-files-too. Take these .hc files to the PPC and
bootstrap them there.
Cheers,
Simon
PS. there may be some difficulties with the -unreg flag: it actually
specifies way 'u', so you may get .u_hc files instead of .hc files. It
might be a better idea to expand -unreg into its component parts:
-optc-DNO_REGS -optc-DUSE_MINIINTERPRETER -fno-asm-mangling
-funregisterised -fvia-C
From haskell@davidb.org Wed Oct 11 19:31:22 2000
Date: Wed, 11 Oct 2000 11:31:22 -0700
From: David Brown haskell@davidb.org
Subject: Porting to powerpc-linux
On Tue, Oct 10, 2000 at 03:15:49AM -0700, Simon Marlow wrote:
> > I've got my x86 linux box ready to build some unregistered .hc files.
>
> You'll need two build trees. In the first tree, build the compiler as
> normal, and the libraries/RTS with -unreg -keep-hc-files-too. You should be
> able to use these .hc files to try out some simple programs on the PPC.
>
> In the second tree, bootstrap the compiler using the compiler from the first
> tree with -unreg -keep-hc-files-too. Take these .hc files to the PPC and
> bootstrap them there.
Ok. Here's what I've done. I've made two trees, b1 and b2, and some
appropriate directories ton install in.
Inside b1, I edited b1/ghc/lib/std/Makefile to add the options
-optc-DNO_REGS... and compiled this compiler.
I then went into b2 and added the unregister options to SRC_HC_OPTS in
b2/mk/config.mk (Configured to use the compiler generated in step b1.
During the build here, the compiler SEGVs when compiling the first haskell
file built with the new built compiler.
...
../../driver/ghc-inplace -keep-hc-file-too -optc-DNO_REGS
-optc-DUSE_MINIINTERPRETER -fno-asm-mangling -funregisterised -fvia-C
-recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing -O -package-name std
-static -split-objs -H12m -c PrelBase.lhs -o PrelBase.o -osuf o
Haskell compiler received signal 11
...
I'm guessing I didn't do the b1 build right. The compiler it generated
builds, but doesn't even run. Do I need to add the unregistered options
throughout the build, or just in the library?
Thanks,
Dave Brown
From bletner@revbiz.com Wed Oct 11 23:12:29 2000
Date: Wed, 11 Oct 2000 17:12:29 -0500
From: Brett Letner bletner@revbiz.com
Subject: C main
Greetings -
Could someone instruct me on (or point me to) the correct ghc command line
for calling haskell from C?
>From the documentation, it seems like "ghc -fglasgow-exts -no-hs-main main.c
foo.hs" should work, but
that still gives me a multiple definition of "main".
I'm running ghc 4.08.1 on Windows NT.
Thanks -
Brett Letner
RBC Incorporated
http://www.revbiz.com
mailto:bletner@revbiz.com
(913) 385-5700 ext.20 Fax (913) 385-5701
From christian.lescher@icn.siemens.de Thu Oct 12 06:47:10 2000
Date: Thu, 12 Oct 2000 07:47:10 +0200
From: Lescher Christian christian.lescher@icn.siemens.de
Subject: Exposing Haskell functions with string arguments in a DLL
How can I convert string arguments (null-terminated strings) to Haskell's [Char]? I saw there is some CString module in package lang of GHC, but I didn't found any documentation about it (e.g. packStringIO...?). How must a function f :: String -> String for usage in a DLL look like in order to convert the string parameter and result?
(From earlier Haskell functions with BSTR arguments, I already know how to build a (static) DLL. I use GHC4.08.1.)
Christian Lescher
From fldrsimonmar@microsoft.com Thu Oct 12 10:07:45 2000
Date: Thu, 12 Oct 2000 02:07:45 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: C main
> Greetings -
>
> Could someone instruct me on (or point me to) the correct ghc
> command line
> for calling haskell from C?
> From the documentation, it seems like "ghc -fglasgow-exts
> -no-hs-main main.c
> foo.hs" should work, but
> that still gives me a multiple definition of "main".
>
> I'm running ghc 4.08.1 on Windows NT.
You can use ghc just like you would use gcc to compile up your C program,
then use ghc again to link the whole program with the Haskell module(s).
The -no-hs-main flag shouldn't be necessary, as far as I can tell. eg.
$ ghc -c main.c
$ ghc -c HaskellStuff.hs
$ ghc main.o HaskellStuff.o
Cheers,
Simon
From fldrsimonmar@microsoft.com Thu Oct 12 10:02:10 2000
Date: Thu, 12 Oct 2000 02:02:10 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: Porting to powerpc-linux
> I'm guessing I didn't do the b1 build right. The compiler it
> generated
> builds, but doesn't even run. Do I need to add the
> unregistered options
> throughout the build, or just in the library?
Just the libraries and the RTS in b1, and the compiler in b2. You can check
that things are working right by compiling up hello world against b1
(remember to add the options when compiling hello world too).
Cheers,
Simon
From sof@microsoft.com Thu Oct 12 18:17:35 2000
Date: Thu, 12 Oct 2000 10:17:35 -0700
From: Sigbjorn Finne sof@microsoft.com
Subject: C main
Simon Marlow writes:
> >
> > Could someone instruct me on (or point me to) the correct ghc
> > command line for calling haskell from C?
> > ...
>
> You can use ghc just like you would use gcc to compile up
> your C program,
> then use ghc again to link the whole program with the Haskell
> module(s). The -no-hs-main flag shouldn't be necessary, as
> far as I can tell. eg.
>
> $ ghc -c main.c
> $ ghc -c HaskellStuff.hs
> $ ghc main.o HaskellStuff.o
>
That will (sort of) work if you also insist that HaskellStuff.hs
implements Main.main. As the name suggests, -no-hs-main takes care
of the case when HaskellStuff.hs doesn't. (Well almost, the 4.08 driver
contains a bug in setupLinkOpts(); __init_PrelMain should be handled
the same way as PrelMain_mainIO_closure. )
In either case, you need to make sure that the RTS is started up,
since you're not using the RTS-supplied main(). The HDirect distribution
contains an example of this in examples/server/, but notice that the
4.08 RTS' startupHaskell() signature has changed to also take an extra
'module root' argument. However, even with that change, 4.08
compiled code crashes when running (4.05 works fine), which leads
me to believe there's something else going on here :-) This is on
the same platform that Brett originally reported the problem on.
--sigbjorn
btw, 4.05 contained a bug in this area which made -no-hs-main only
work when linking with -static. 4.08 seems to have inherited it, i.e.,
in prepareWin32DllLink(), the condition for pushing Main.dll_o and
PrelMain.dll_o onto @Link_file should be ($linking_main && !$NoHaskellMain)
and not just $linking_main
From stolz@I2.Informatik.RWTH-Aachen.DE Fri Oct 13 11:09:33 2000
Date: Fri, 13 Oct 2000 12:09:33 +0200
From: Volker Stolz stolz@I2.Informatik.RWTH-Aachen.DE
Subject: How to get BlockedOnDeadMVar exception?
I didn't succeed in getting (or catching?) this exception through an
obvious example. Is this exception thrown at all or just NYI?
Is this exception thrown at all or just NYI?
Volker
--
Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
From fldrsimonmar@microsoft.com Fri Oct 13 12:01:00 2000
Date: Fri, 13 Oct 2000 04:01:00 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: How to get BlockedOnDeadMVar exception?
> I didn't succeed in getting (or catching?) this exception through an
> obvious example. Is this exception thrown at all or just NYI?
>
> Is this exception thrown at all or just NYI?
Sure it's implemented. However, a main thread will never get this exception
(at the moment). Try this example in 4.08.1:
module Main where
import Exception
import Concurrent
main = do
id <- myThreadId
forkIO (catchAllIO (do m <- newEmptyMVar; takeMVar m)
(\e -> raiseInThread id e))
catchAllIO (print (sum [1..1000000]))
(\e -> print e)
Cheers,
Simon
From stolz@I2.Informatik.RWTH-Aachen.DE Fri Oct 13 13:38:46 2000
Date: Fri, 13 Oct 2000 14:38:46 +0200
From: Volker Stolz stolz@I2.Informatik.RWTH-Aachen.DE
Subject: How to get BlockedOnDeadMVar exception?
On Fri, Oct 13, 2000 at 04:01:00AM -0700, Simon Marlow wrote:
> Sure it's implemented. However, a main thread will never get this exception
> (at the moment). Try this example in 4.08.1:
Funny, it works and almost looks the same like my code. Only {Ee}xception:
I was using a getLine-loop for preventing the main thread from exiting.
Could this be the reason I don't get the exception?
--
Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
From bletner@revbiz.com Fri Oct 13 14:43:26 2000
Date: Fri, 13 Oct 2000 08:43:26 -0500
From: Brett Letner bletner@revbiz.com
Subject: C main
So if I understand this correctly, I'm doing it wrong, but that's o.k.
because even if I wasn't it still wouldn't work :)
This brings up a larger question, should I even be trying to do this?
Here is the situation:
A colleague of mine had a couple of little routines that he needed
(something simple to do in Haskell but a pain in C).
I quickly zipped out the solution in a few lines of Haskell, but now I would
like to give him something usable from C.
My question is:
What format can I (and/or should I) give him the routines in...
C code he can compile? This would be best, but I couldn't figure out how to
make this work.
An object file he can link in? This is what I was attempting.
A dll?
A com object? (I don't have any experience with com)
Something else?
Thanks for your help -
Brett Letner
RBC Incorporated
http://www.revbiz.com
mailto:bletner@revbiz.com
(913) 385-5700 ext.20 Fax (913) 385-5701
-----Original Message-----
From: Sigbjorn Finne [mailto:sof@microsoft.com]
Sent: Thursday, October 12, 2000 12:18 PM
To: glasgow-haskell-users@haskell.org
Cc: 'bletner@revbiz.com'
Subject: RE: C main
Simon Marlow writes:
> >
> > Could someone instruct me on (or point me to) the correct ghc
> > command line for calling haskell from C?
> > ...
>
> You can use ghc just like you would use gcc to compile up
> your C program,
> then use ghc again to link the whole program with the Haskell
> module(s). The -no-hs-main flag shouldn't be necessary, as
> far as I can tell. eg.
>
> $ ghc -c main.c
> $ ghc -c HaskellStuff.hs
> $ ghc main.o HaskellStuff.o
>
That will (sort of) work if you also insist that HaskellStuff.hs
implements Main.main. As the name suggests, -no-hs-main takes care
of the case when HaskellStuff.hs doesn't. (Well almost, the 4.08 driver
contains a bug in setupLinkOpts(); __init_PrelMain should be handled
the same way as PrelMain_mainIO_closure. )
In either case, you need to make sure that the RTS is started up,
since you're not using the RTS-supplied main(). The HDirect distribution
contains an example of this in examples/server/, but notice that the
4.08 RTS' startupHaskell() signature has changed to also take an extra
'module root' argument. However, even with that change, 4.08
compiled code crashes when running (4.05 works fine), which leads
me to believe there's something else going on here :-) This is on
the same platform that Brett originally reported the problem on.
--sigbjorn
btw, 4.05 contained a bug in this area which made -no-hs-main only
work when linking with -static. 4.08 seems to have inherited it, i.e.,
in prepareWin32DllLink(), the condition for pushing Main.dll_o and
PrelMain.dll_o onto @Link_file should be ($linking_main && !$NoHaskellMain)
and not just $linking_main
From fldrsimonmar@microsoft.com Fri Oct 13 13:55:34 2000
Date: Fri, 13 Oct 2000 05:55:34 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: How to get BlockedOnDeadMVar exception?
> On Fri, Oct 13, 2000 at 04:01:00AM -0700, Simon Marlow wrote:
> > Sure it's implemented. However, a main thread will never
> get this exception
> > (at the moment). Try this example in 4.08.1:
>
> Funny, it works and almost looks the same like my code. Only
> {Ee}xception:
> I was using a getLine-loop for preventing the main thread
> from exiting.
> Could this be the reason I don't get the exception?
probably: the exception is generated as a result of the thread being
discovered unreachable during garbage collection. If there's no garbage
collection, eg. because the program is waiting for I/O, then the exception
is never raised.
Which brings up an interesting subject: should the RTS start a GC after it
has been waiting for I/O for a certain length of time? If so, how long?
Cheers,
Simon
From sof@microsoft.com Fri Oct 13 22:35:34 2000
Date: Fri, 13 Oct 2000 14:35:34 -0700
From: Sigbjorn Finne sof@microsoft.com
Subject: C main
Brett Letner <bletner@revbiz.com> writes:
>
> So if I understand this correctly, I'm doing it wrong, but that's o.k.
> because even if I wasn't it still wouldn't work :)
>
> This brings up a larger question, should I even be trying to do this?
>
Yes, linking in Haskell code in the way you tried is the most convenient
way of going about embedding Haskell code into C/C++ apps (well, at
least that's the intention ;-)
You can package up Haskell code in a DLL and call it that way, but that
requires extra steps. I posted some instructions on how to build
ghc-compiled DLLs on this mailing list a couple of weeks ago; you may
find them useful here.
If you're really desperate, what you tried to do works with ghc-4.05. It
depends on using another version of cygwin (gcc, really) than 4.08, so I
wouldn't recommend doing this if you haven't already got it installed.
hth
--sigbjorn
From fldrsimonmar@microsoft.com Mon Oct 16 12:07:14 2000
Date: Mon, 16 Oct 2000 04:07:14 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: Exposing Haskell functions with string arguments in a DLL
> How can I convert string arguments (null-terminated strings)
> to Haskell's [Char]? I saw there is some CString module in
> package lang of GHC, but I didn't found any documentation
> about it (e.g. packStringIO...?).
For converting a static null-terminated C string to a Haskell String, use
CString.unpackCString. If you need to free the memory used by the original
C string afterwards, use CString.unpackCStringIO.
Cheers,
Simon
From christian.lescher@icn.siemens.de Mon Oct 16 12:20:28 2000
Date: Mon, 16 Oct 2000 13:20:28 +0200
From: Lescher Christian christian.lescher@icn.siemens.de
Subject: AW: Exposing Haskell functions with string arguments in a DLL
Thanks!! What about the other direction? (Haskell function with string =
result)
Christian
> -----Urspr> =FCngliche Nachricht-----
> Von: Simon Marlow [SMTP:fldrsimonmar@microsoft.com]
> Gesendet am: Montag, 16. Oktober 2000 13:07
> An: 'Lescher Christian'; 'glasgow-haskell-users@haskell.org'
> Betreff: RE: Exposing Haskell functions with string arguments in a =
DLL
>=20
>=20
> > How can I convert string arguments (null-terminated strings)=20
> > to Haskell's [Char]? I saw there is some CString module in=20
> > package lang of GHC, but I didn't found any documentation=20
> > about it (e.g. packStringIO...?).
>=20
> For converting a static null-terminated C string to a Haskell String, =
use
> CString.unpackCString. If you need to free the memory used by the =
original
> C string afterwards, use CString.unpackCStringIO.
>=20
> Cheers,
> Simon
From fldrsimonmar@microsoft.com Mon Oct 16 12:39:51 2000
Date: Mon, 16 Oct 2000 04:39:51 -0700
From: Simon Marlow fldrsimonmar@microsoft.com
Subject: Exposing Haskell functions with string arguments in a DLL
You can use CString.packString and CString.packStringIO, but be aware that
(a) these functions return ByteArrays, so you need to
adjust your foreign export definitions accordingly
(b) because they use ByteArray, these functions are GHC
specific and any use of them is non-portable.
GHC currently doesn't supply a portable way to marshal strings from Haskell
to C. However, you can quite easily write your own using eg. the functions
from Storable.
Cheers,
Simon
> -----Original Message-----
> From: Lescher Christian [mailto:christian.lescher@icn.siemens.de]
> Sent: Monday, October 16, 2000 12:20 PM
> To: Simon Marlow; 'glasgow-haskell-users@haskell.org'
> Subject: AW: Exposing Haskell functions with string arguments in a DLL
>
>
> Thanks!! What about the other direction? (Haskell function
> with string result)
>
> Christian
>
> > -----Urspr> üngliche Nachricht-----
> > Von: Simon Marlow [SMTP:fldrsimonmar@microsoft.com]
> > Gesendet am: Montag, 16. Oktober 2000 13:07
> > An: 'Lescher Christian'; 'glasgow-haskell-users@haskell.org'
> > Betreff: RE: Exposing Haskell functions with string
> arguments in a DLL
> >
> >
> > > How can I convert string arguments (null-terminated strings)
> > > to Haskell's [Char]? I saw there is some CString module in
> > > package lang of GHC, but I didn't found any documentation
> > > about it (e.g. packStringIO...?).
> >
> > For converting a static null-terminated C string to a
> Haskell String, use
> > CString.unpackCString. If you need to free the memory used
> by the original
> > C string afterwards, use CString.unpackCStringIO.
> >
> > Cheers,
> > Simon
>
From christian@lescher.de Tue Oct 17 20:29:35 2000
Date: Tue, 17 Oct 2000 20:29:35 +0100
From: Christian Lescher christian@lescher.de
Subject: Haskell function with String arguments in DLL
I'm trying to build a DLL with a Haskell function of type String ->
String, that should be called from outside (e.g. VBA), but it still
doesn't work.
I'm afraid I need an example or some kind of 'step by step instruction'.
Who can help me? (I use GHC 4.08.1.)
Christian
From chak@cse.unsw.edu.au Wed Oct 18 10:06:26 2000
Date: Wed, 18 Oct 2000 20:06:26 +1100
From: Manuel M. T. Chakravarty chak@cse.unsw.edu.au
Subject: GHC for RedHat 7.0 (gcc 2.96)
GHC (4.08.1) rpm packages for RedHat 7.0 are available from
ftp://ftp.cse.unsw.edu.au/pub/users/chak/jibunmaki/i386/ghc-4.08.1-2.i386.rpm
ftp://ftp.cse.unsw.edu.au/pub/users/chak/jibunmaki/i386/ghc-prof-4.08.1-2.i386.rpm
[The second package is only required for profiling.]
The corresponding source rpm is at
ftp://ftp.cse.unsw.edu.au/pub/users/chak/jibunmaki/src/ghc-4.08.1-2.src.rpm
** IMPORTANT **
For this to work, you have to additionally install on old
version (2.0) of the GNU Multiprecision Library (GMP). Get
it off your old RedHat 6.2 CD or alternatively from
ftp://ftp.linux.com/mounts/u2/mirrors/redhat/up2date/rhl-6.2/i386/RedHat/RPMS/gmp-2.0.2-13.i386.rpm
ftp://ftp.linux.com/mounts/u2/mirrors/redhat/up2date/rhl-6.2/i386/RedHat/RPMS/gmp-devel-2.0.2-13.i386.rpm
* You have to install *both* packages.
* They can co-exist with the new library (version 3.0)
installed by default with RedHat 7.0.
NOTE: These packages cannot be installed on RedHat 6.2 and
earlier (unless you manually upgrade to the rpm
package manager 4.0).
Happy Hacking,
Manuel
PS: Could these packages be linked from GHC's download page?
And please also add the comment and links re gmp 2.0.
Moreover, please *don't* remove the old links for the
benefit of RH6.2 users.
From martijn@cs.uu.nl Wed Oct 18 18:40:18 2000
Date: Wed, 18 Oct 2000 19:40:18 +0200
From: Martijn martijn@cs.uu.nl
Subject: Socket.hs problem under Windows 2000
Hi,
I'm trying to set up some socket connections with Haskell on a Windows 2000
platform, but I can't seem to get them working.
My program is rather simple:
--
import Socket
main = do { socket <- listenOn (PortNumber 1234)
; return ()
}
--
I know this shouldn't do anything at all, but instead it gives an error
message:
Fail: does not exist
Action: getProtocolByName
Reason: no such protocol entry
I get the same message for any socket operation I try to perform. Also a
basic call like getHostName from module BSD does not work. I've compiled
with ghc version 4.05 with option "-syslib misc"
Should I compile differently, is this a problem with CygWin, or am I
overlooking something?
TIA,
Martijn Schrage
From sof@microsoft.com Wed Oct 18 18:50:26 2000
Date: Wed, 18 Oct 2000 10:50:26 -0700
From: Sigbjorn Finne sof@microsoft.com
Subject: Socket.hs problem under Windows 2000
You need to init WinSock first, i.e.,
main = withSocketsDo $ do {...}
--sigbjorn
Martijn [mailto:martijn@cs.uu.nl] writes:
>
> Hi,
>
> I'm trying to set up some socket connections with Haskell on
> a Windows 2000
> platform, but I can't seem to get them working.
>
> My program is rather simple:
> --
> import Socket
>
> main = do { socket <- listenOn (PortNumber 1234)
> ; return ()
> }
> --
>
> I know this shouldn't do anything at all, but instead it
> gives an error
> message:
>
> Fail: does not exist
> Action: getProtocolByName
> Reason: no such protocol entry
>
> I get the same message for any socket operation I try to
> perform. Also a
> basic call like getHostName from module BSD does not work.
> I've compiled
> with ghc version 4.05 with option "-syslib misc"
>
> Should I compile differently, is this a problem with CygWin, or am I
> overlooking something?
>
> TIA,
> Martijn Schrage
>
From rrt1001@cam.ac.uk Thu Oct 19 16:19:36 2000
Date: Thu, 19 Oct 2000 16:19:36 +0100 (BST)
From: Reuben Thomas rrt1001@cam.ac.uk
Subject: GHC RPMs for RedHat 7
There are now GHC RPMs for RedHat 7 available from the download page
(http://www.haskell.org/ghc/download.html).
Note that (as stated there) you need to install GMP 2 RPMs if you don't
have them already (they're provided). The development version of GHC has
now moved to GMP 3, so we'll have this wrinkle ironed out in the next
release.
--
http://sc3d.org/rrt/ | certain, a. insufficiently analysed
From ger@Informatik.Uni-Bremen.DE Thu Oct 19 16:24:04 2000
Date: Thu, 19 Oct 2000 17:24:04 +0200
From: George Russell ger@Informatik.Uni-Bremen.DE
Subject: GHC RPMs for RedHat 7
On this subject, where am I to get the libgmp2.a required by 4.08.1
(on Linux anyway). I tried compiling the very latest version of GMP
but it only produced a libgmp.a file. Is that the same?
NB that RPMs aren't a lot of good to me unless they come with a hefty
bribe for the hard-nosed system administrators around here.
From michael.weber@post.rwth-aachen.de Thu Oct 19 16:39:54 2000
Date: Thu, 19 Oct 2000 17:39:54 +0200
From: Michael Weber michael.weber@post.rwth-aachen.de
Subject: shared libgmp2 (was: Re: GHC RPMs for RedHat 7)
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
On Thu, Oct 19, 2000 at 17:24:04 +0200, George Russell wrote:
> On this subject, where am I to get the libgmp2.a required by 4.08.1
> (on Linux anyway). I tried compiling the very latest version of GMP
> but it only produced a libgmp.a file. Is that the same?
Everyone and their brothers is patching it. I've no idea, why upstream
didn't incorporate the patch... Maybe, they have done it in the new
version (libgmp3)...
Anyway, I attached a patch for libgmp2-2.0.2, ie. the old version...
Cheers,
Michael
--
/~\ ASCII ribbon | beta test, v: To voluntarily entrust one's data, one's
\ / campaign | livelihood and one's sanity to hardware or software
X against | intended to destroy all three. In earlier days,
/ \ HTML mail | virgins were often selected to beta test volcanos.
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="gmp_i2-2.0.2-1.shared.patch"
diff -ur -x Makefile gmp-2.0.2-orig/Makefile.in gmp-2.0.2/Makefile.in
--- gmp-2.0.2-orig/Makefile.in Thu Jun 6 19:21:19 1996
+++ gmp-2.0.2/Makefile.in Sat May 23 15:55:11 1998
@@ -27,10 +27,13 @@
infodir = $(prefix)/info
includedir = $(prefix)/include
+MV = mv
CC = gcc
LOCAL_CC = $(CC)
CFLAGS = -g -O
XCFLAGS =
+PICFLAGS = -fPIC
+
AR = ar
AR_FLAGS = rc
RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
@@ -51,19 +54,23 @@
extract-double.c insert-double.c
OBJS = memory.o mp_set_fns.o mp_clz_tab.o version.o stack-alloc.o mp_bpl.o \
extract-double.o insert-double.o
+SHOBJS = $(foreach OBJECT, $(OBJS), shared/$(OBJECT))
FILES = gmp.h mp.h gmp-impl.h longlong.h urandom.h move-if-change \
mkinstalldirs INSTALL COPYING.LIB ChangeLog Makefile.in \
NEWS README SPEED TODO config.guess config.sub configure configure.in \
gmp.info* gmp.texi texinfo.tex $(SRCS)
INCLUDES = -I. -Impn -I$(srcdir)
-FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)"
+FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)" "PICFLAGS=$(PICFLAGS)" "MV=$(MV)"
-all: libgmp.a
+all: libgmp.a libgmp.so
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
+%.o : ../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
libgmp.a: mpn/libmpn.a mpz/libmpz.a mpf/libmpf.a mpq/libmpq.a $(OBJS)
rm -rf tmpdir
mkdir tmpdir
@@ -78,6 +85,22 @@
mv tmpdir/$@ .
rm -rf tmpdir
+shared:
+ mkdir shared
+
+libgmp.so: shared mpn/shared mpz/shared mpf/shared mpq/shared $(SHOBJS)
+ rm -rf tmpdir
+ mkdir tmpdir
+ for i in mpn mpz mpf mpq; \
+ do \
+ mkdir tmpdir/$$i; \
+ cp -p $$i/shared/* tmpdir/$$i; \
+ done
+ cp -p shared/* tmpdir/
+ cd tmpdir; $(CC) -shared -Wl,-soname,libgmp.so.2 -o libgmp.so.2.0.2 *.o */*.o
+ mv tmpdir/libgmp.so.2.0.2 .;ln -s libgmp.so.2.0.2 libgmp.so
+ rm -rf tmpdir
+
libmp.a: mpn/libmpn.a mpbsd/libmpbsd.a $(OBJS)
rm -rf tmpdir
mkdir tmpdir
@@ -103,6 +126,15 @@
mpbsd/libmpbsd.a: force
cd mpbsd; $(MAKE) $(FLAGS_TO_PASS) libmpbsd.a
+mpn/shared: force
+ cd mpn; $(MAKE) $(FLAGS_TO_PASS) libmpn.so
+mpz/shared: force
+ cd mpz; $(MAKE) $(FLAGS_TO_PASS) libmpz.so
+mpf/shared: force
+ cd mpf; $(MAKE) $(FLAGS_TO_PASS) libmpf.so
+mpq/shared: force
+ cd mpq; $(MAKE) $(FLAGS_TO_PASS) libmpq.so
+
check: libgmp.a
cd mpz/tests; $(MAKE) $(FLAGS_TO_PASS) check
cd mpq/tests; $(MAKE) $(FLAGS_TO_PASS) check
@@ -142,6 +174,10 @@
-chmod a-x $(libdir)/libgmp.a
$(INSTALL_DATA) $(srcdir)/gmp.h $(includedir)/gmp.h
-chmod a-x $(includedir)/gmp.h
+ $(INSTALL_DATA) libgmp.so.2.0.2 $(libdir)/libgmp.so.2.0.2
+ cd $(libdir);rm -f libgmp.so libgmp.so.2 libgmp.so.2.0
+ cd $(libdir);ln -s libgmp.so.2.0.2 libgmp.so.2
+ cd $(libdir);ln -s libgmp.so.2 libgmp.so
install-bsdmp: installdirs libmp.a gmp.info install-info-files
$(INSTALL_DATA) libmp.a $(libdir)/libmp.a
-chmod a-x $(libdir)/libmp.a
@@ -152,9 +188,10 @@
do $(INSTALL_DATA) $$f $(infodir)/$$f; done
-chmod a-x $(infodir)/gmp.info*
# Attempt to edit the info directory node
- if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
- install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
- else true; fi
+# Do this from the rpm spec file.
+# if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+# install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
+# else true; fi
installdirs: $(srcdir)/mkinstalldirs
$(srcdir)/mkinstalldirs $(includedir) $(libdir) $(infodir)
@@ -168,6 +205,7 @@
clean mostlyclean:
rm -f *.o libgmp.a libmp.a gmp.dvi gmp.ps tmp.* tmp-*
+ rm -rf shared libgmp.so.2.0.2 libgmp.so
rm -f gmp.?? gmp.??s gmp.log gmp.toc gmp.*aux gmp*.html
-cd mpn; $(MAKE) $@
-cd mpz; $(MAKE) $@
diff -ur -x Makefile gmp-2.0.2-orig/mpf/Makefile.in gmp-2.0.2/mpf/Makefile.in
--- gmp-2.0.2-orig/mpf/Makefile.in Fri May 24 14:29:16 1996
+++ gmp-2.0.2/mpf/Makefile.in Sat May 23 15:58:16 1998
@@ -42,7 +42,7 @@
add.o add_ui.o sub.o sub_ui.o ui_sub.o mul.o mul_ui.o div.o div_ui.o \
cmp.o cmp_ui.o cmp_si.o mul_2exp.o div_2exp.o abs.o neg.o set_q.o get_d.o \
set_dfl_prec.o set_prc.o set_prc_raw.o get_prc.o ui_div.o sqrt_ui.o
-
+MPF_SHOBJS = $(foreach OBJECT, $(MPF_OBJS), shared/$(OBJECT))
LATER_OBJS = inp_raw.o out_raw.o random.o pow_ui.o fac_ui.o
INCLUDES = -I. -I.. -I../mpn -I$(srcdir)/..
@@ -51,11 +51,21 @@
rm -f $@
$(AR) $(AR_FLAGS) $@ $(MPF_OBJS)
+shared:
+ mkdir shared
+
+libmpf.so: shared Makefile $(MPF_SHOBJS)
+ touch libmpf.so
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
clean mostlyclean:
rm -f *.o libmpf.a
+ rm -rf shared libmpf.so
-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
rm -f Makefile config.status
diff -ur -x Makefile gmp-2.0.2-orig/mpn/Makefile.in gmp-2.0.2/mpn/Makefile.in
--- gmp-2.0.2-orig/mpn/Makefile.in Fri May 17 04:44:42 1996
+++ gmp-2.0.2/mpn/Makefile.in Sat May 23 16:03:31 1998
@@ -21,6 +21,7 @@
srcdir = .
MPN_OBJECTS = This gets filled in by configure.in.
+MPN_SHOBJS = $(foreach OBJECT,$(MPN_OBJECTS),shared/$(OBJECT))
MPN_LINKS = This gets filled in by configure.in.
CC = gcc
CPP = $(CC) -E
@@ -37,21 +38,39 @@
rm -f $@
$(AR) $(AR_FLAGS) $@ mp_bases.o $(MPN_OBJECTS)
+libmpn.so: shared Makefile shared/mp_bases.o $(MPN_SHOBJS)
+ touch libmpn.so
+
.SUFFIXES: .c .s .S
+shared:
+ mkdir shared
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
+%.o:../%.s
+ $(CC) -c $(CFLAGS) $(PICFLAGS) $< -o $@
+
.s.o:
$(CC) -c $(CFLAGS) $<
+%.o:../%.S
+ $(CPP) $(SFLAGS) $(INCLUDES) $(CFLAGS) $(PICFLAGS) $< | grep -v '^#'>tmp-$(notdir $*).s
+ $(CC) -c tmp-$(notdir $*).s $(CFLAGS) $(PICFLAGS) -o $@
+ rm -f tmp-$(notdir $*).s
+
.S.o:
$(CPP) $(SFLAGS) $(INCLUDES) $(CFLAGS) $< | grep -v '^#' >tmp-$*.s
- $(CC) -c tmp-$*.s -o $@
+ $(CC) $(CFLAGS) -c tmp-$*.s -o $@
rm -f tmp-$*.s
clean mostlyclean:
rm -f *.o tmp-* libmpn.a
+ rm -rf shared libmpn.so
#-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
rm -f asm-syntax.h Makefile config.status $(MPN_LINKS)
diff -ur -x Makefile gmp-2.0.2-orig/mpq/Makefile.in gmp-2.0.2/mpq/Makefile.in
--- gmp-2.0.2-orig/mpq/Makefile.in Fri May 17 05:04:22 1996
+++ gmp-2.0.2/mpq/Makefile.in Sat May 23 16:05:28 1998
@@ -36,17 +36,27 @@
MPQ_OBJS = add.o canonicalize.o clear.o cmp.o cmp_ui.o div.o get_d.o \
get_den.o get_num.o init.o inv.o mul.o neg.o set.o set_den.o set_num.o \
set_si.o set_ui.o sub.o equal.o set_z.o
-
+MPQ_SHOBJS = $(foreach OBJECT,$(MPQ_OBJS),shared/$(OBJECT))
INCLUDES = -I. -I.. -I../mpn -I$(srcdir)/..
libmpq.a: Makefile $(MPQ_OBJS)
rm -f $@
$(AR) $(AR_FLAGS) $@ $(MPQ_OBJS)
+libmpq.so: shared Makefile $(MPQ_SHOBJS)
+ touch libmpq.so
+
+shared:
+ mkdir shared
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
clean mostlyclean:
+ rm -rf shared libmpq.so
rm -f *.o libmpq.a
-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
diff -ur -x Makefile gmp-2.0.2-orig/mpz/Makefile.in gmp-2.0.2/mpz/Makefile.in
--- gmp-2.0.2-orig/mpz/Makefile.in Fri May 24 14:45:46 1996
+++ gmp-2.0.2/mpz/Makefile.in Sat May 23 16:07:33 1998
@@ -65,18 +65,28 @@
tdiv_qr.o tdiv_q.o tdiv_r.o tdiv_qr_ui.o tdiv_q_ui.o tdiv_r_ui.o \
mod.o divexact.o array_init.o scan0.o scan1.o \
jacobi.o legendre.o invert.o
-
+MPZ_SHOBJS = $(foreach OBJECT,$(MPZ_OBJS),shared/$(OBJECT))
INCLUDES = -I. -I.. -I../mpn -I$(srcdir)/..
libmpz.a: Makefile $(MPZ_OBJS)
rm -f $@
$(AR) $(AR_FLAGS) $@ $(MPZ_OBJS)
+libmpz.so: shared Makefile $(MPZ_SHOBJS)
+ touch libmpz.so
+
+shared:
+ mkdir shared
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
clean mostlyclean:
rm -f *.o libmpz.a
+ rm -rf shared libmpz.so
-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
rm -f Makefile config.status
--45Z9DzgjV8m4Oswq--
From Keith.Wansbrough@cl.cam.ac.uk Thu Oct 19 17:13:56 2000
Date: Thu, 19 Oct 2000 17:13:56 +0100
From: Keith Wansbrough Keith.Wansbrough@cl.cam.ac.uk
Subject: GHC RPMs for RedHat 7
> On this subject, where am I to get the libgmp2.a required by 4.08.1
> (on Linux anyway). I tried compiling the very latest version of GMP
> but it only produced a libgmp.a file. Is that the same?
Same happened to me. ln -s libgmp.a libgmp2.a worked for me. I satisfied myself I was doing the right thing by noticing all the 2.x.x version numbers on the libgmp source I'd compiled.
It does link. Haven't tried any fancy math, though, so maybe it's broken.
--KW 8-)
--
Keith Wansbrough <kw217@cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
Cambridge University Computer Laboratory.
From ger@Informatik.Uni-Bremen.DE Thu Oct 19 17:17:41 2000
Date: Thu, 19 Oct 2000 18:17:41 +0200
From: George Russell ger@Informatik.Uni-Bremen.DE
Subject: GHC RPMs for RedHat 7
Keith Wansbrough wrote:
>
> > On this subject, where am I to get the libgmp2.a required by 4.08.1
> > (on Linux anyway). I tried compiling the very latest version of GMP
> > but it only produced a libgmp.a file. Is that the same?
>
> Same happened to me. ln -s libgmp.a libgmp2.a worked for me. I satisfied myself I was doing the right thing by noticing all the 2.x.x version numbers on the libgmp source I'd compiled.
Yes, that's what I did. Probably everyone has . . .
Er, isn't this the sort of thing ./configure scripts are for?
From simonmar@microsoft.com Thu Oct 19 17:58:41 2000
Date: Thu, 19 Oct 2000 09:58:41 -0700
From: Simon Marlow simonmar@microsoft.com
Subject: GHC RPMs for RedHat 7
> Keith Wansbrough wrote:
> >
> > > On this subject, where am I to get the libgmp2.a required
> by 4.08.1
> > > (on Linux anyway). I tried compiling the very latest
> version of GMP
> > > but it only produced a libgmp.a file. Is that the same?
> >
> > Same happened to me. ln -s libgmp.a libgmp2.a worked for
> me. I satisfied myself I was doing the right thing by
> noticing all the 2.x.x version numbers on the libgmp source
> I'd compiled.
> Yes, that's what I did. Probably everyone has . . .
Sorry about that, my fault. I built the binary distribution from a build
linked against libgmp2.a on our box here, and it isn't reasonable to expect
everyone to have that library with the same name.
In the future the binary distributions will come with a static libgmp, but
the RPMs will still have a dependency on the right external gmp package.
Cheers,
Simon
From michael.weber@post.rwth-aachen.de Thu Oct 19 23:40:17 2000
Date: Fri, 20 Oct 2000 00:40:17 +0200
From: Michael Weber michael.weber@post.rwth-aachen.de
Subject: shared libgmp2 (was: Re: GHC RPMs for RedHat 7)
On Thu, Oct 19, 2000 at 17:39:54 +0200, Michael Weber wrote:
> On Thu, Oct 19, 2000 at 17:24:04 +0200, George Russell wrote:
>> On this subject, where am I to get the libgmp2.a required by 4.08.1
>> (on Linux anyway). I tried compiling the very latest version of GMP
>> but it only produced a libgmp.a file. Is that the same?
[snipped my right solution to the wrong problem]
I can't read, shoot me 8-}
My internal pre-parser recognized the words "GHC", "libgmp.a"
and "RedHat" in a single email, therefore bypassed the rest of the
mail, and immediately sent the wrong answer... Sorry!
The patch is obviously for getting a .so library...
Cheers,
Michael
--
() ASCII ribbon campaign | Chair for Computer Science II | GPG: F65C68CD
/\ against HTML mail | RWTH Aachen, Germany | PGP: 1D0DD0B9
The reason computer chips are so small is computers don't eat much.
From christian.lescher@icn.siemens.de Fri Oct 20 12:04:03 2000
Date: Fri, 20 Oct 2000 13:04:03 +0200
From: Lescher Christian christian.lescher@icn.siemens.de
Subject: AW: Using Haskell code in VBA (MS Access)?
I tried to compile this small example with ghc-4.08.1, but it didn't =
work (compiling ok., but DLL does not run), while with ghc-4.05 =
everything is okay. What can be wrong with this?
Christian Lescher
> -----Urspr> =FCngliche Nachricht-----
> Von: Sigbjorn Finne [SMTP:sof@microsoft.com]
> Gesendet am: Donnerstag, 17. August 2000 20:18
> An: 'Christian Lescher'
> Cc: glasgow-haskell-users@haskell.org
> Betreff: RE: Using Haskell code in VBA (MS Access)?
>=20
>=20
> The support libraries for HaskellDirect provide
> functions for converting between BSTRs and Haskell'
> String (Com.marshallBSTR, Com.unmarshallBSTR) --
> http://www.dcs.gla.ac.uk/fp/software/hdirect/user-32.html
>=20
> has the overview. However, the binaries available for
> that library is for ghc-4.045, so you'd have to compile
> them up yourself for ghc-4.08.
>=20
> To build a 'static' DLL, here's what you need to do:
>=20
> - compile up all your Haskell code using -static.
> - write a .def file containing the entry points you
> want to expose. In my example, the .def file would
> just contain:
>=20
> EXPORTS
> adder@8
>=20
> - link the static DLL:
>=20
> ghc-4.05 -static --mk-dll -optdll--def=3Dadder.def \
> -o adder.dll adder.o dllMain.o -lHSrts
>=20
> I heard some rumours that -static might disappear. If that's
> the case, I think that would be unfortunate.
>=20
> --sigbjorn
>=20
> Christian Lescher <christian@lescher.de> writes:
> >=20
> > Thank you for your detailed answer - it's really great, it works! =
:-)
> >=20
> > However, I have got one more problem: the function I want to=20
> > call from VBA is of
> > type String -> String -> String
> > Is there a (simple) method to convert VBA strings (BSTR) to=20
> > Haskell's [Char] and
> > vice versa?
> >=20
> > By the way: Is it possible to build DLLs that do not depend=20
> > on GHC's runtime DLLs?
> > I tried out the "-static" option like for compiling EXEs, but=20
> > it didn't work.
> >=20
> > CL
> >=20
> >=20
>=20
From ingo@ele.kth.se Fri Oct 20 17:09:04 2000
Date: Fri, 20 Oct 2000 18:09:04 +0200 (MET DST)
From: Ingo Sander ingo@ele.kth.se
Subject: Interface Files _ HOWTO?
After working a lot with Hugs I tried to compile my Haskell code with GHC.
But it does not work, I am not able to figure out how to work with the
interface files (.hi). My program is build out of several modules, like
this (much simpler, but facing the same problem...)
File MyList.hs
==============
module MyList(MkList(Empty, (:-))) where
infixr 5 :-
data MkList a = Empty
| a :- (MkList a) deriving (Eq, Show)
File ListFun.hs
===============
module ListFun(mapL) where
import MyList
mapL f Empty = Empty
mapL f (x:-xs) = f x :- mapL f xs
File ListLib
============
module ListLib(module MyList, module ListFun) where
import MyList
import ListFun
File Main.hs
============
module Main(main) where
import ListLib
main = putStr (show (mapL (+1) (1:-2:-Empty)))
As I said the code works with hugs, and I want to have the hierarchy in
the library structure.
So, how do I compile this in GHC? I hoped, that it would be enough to
compile all files with the -c option (generating .hi and .o files) and
then compiling Main.hs to get an executable program. Howeve, I get the
following:
> ghc Main.hs
ghc: module version unchanged at 7
Undefined first referenced
symbol in file
MyList_ZCzm_con_info Main.o
MyList_zdfShowMkList_closure Main.o
ListFun_mapL_closure Main.o
MyList_Empty_static_closure Main.o
ld: fatal: Symbol referencing errors. No output written to a.out
So, what's wrong, and am I totally on the wrong track... (I studied the
GHC User Guide, but could not find the answer to my problem).
Thanks in advance!
Ingo Sander
From michael.weber@post.rwth-aachen.de Fri Oct 20 17:45:27 2000
Date: Fri, 20 Oct 2000 18:45:27 +0200
From: Michael Weber michael.weber@post.rwth-aachen.de
Subject: Interface Files _ HOWTO?
On Fri, Oct 20, 2000 at 18:09:04 +0200, Ingo Sander wrote:
> So, how do I compile this in GHC? I hoped, that it would be enough to
> compile all files with the -c option (generating .hi and .o files) and
> then compiling Main.hs to get an executable program. Howeve, I get the
> following:
>
>> ghc Main.hs
[...]
> ld: fatal: Symbol referencing errors. No output written to a.out
try
$ ghc -c Main.hs
$ ghc -o ThisIsMyExecutable *.o
That is, compile Main.hs also into an .o file, /then/ link the whole
thing into an executable...
> So, what's wrong, and am I totally on the wrong track... (I studied the
> GHC User Guide, but could not find the answer to my problem).
normally, one employs `make' for building programs with more than one
module, because it keeps track of dependencies (ghc -M *hs) etc. There
is a users-guide section on Makefiles for GHC, IIRC.
HTH
Cheers,
Michael
--
/~\ ASCII ribbon | "Never buy anything that mentions Windows on the package.
\ / campaign | Except sheets of glass. Or plastic. And that smelly
X against | blue stuff that removes dirt without leaving a residue."
/ \ HTML mail | -- jhickle<at>pgh.nauticom.net in c.o.l.d.s.
From simonpj@microsoft.com Mon Oct 23 09:26:15 2000
Date: Mon, 23 Oct 2000 01:26:15 -0700
From: Simon Peyton-Jones simonpj@microsoft.com
Subject: Interface Files _ HOWTO?
Compile the module from bottom to top, with -c. Then link. THus
ghc -c MyList.hs
ghc -c ListFun.hs
...etc...
ghc -c Main.hs
ghc -o MyApp MyList.o ListFun.o ... Main.o
Simon
| -----Original Message-----
| From: Ingo Sander [mailto:ingo@ele.kth.se]
| Sent: 20 October 2000 17:09
| To: glasgow-haskell-users@haskell.org
| Subject: Interface Files _ HOWTO?
|
|
| After working a lot with Hugs I tried to compile my Haskell
| code with GHC.
| But it does not work, I am not able to figure out how to work with the
| interface files (.hi). My program is build out of several
| modules, like
| this (much simpler, but facing the same problem...)
|
| File MyList.hs
| ==============
|
| module MyList(MkList(Empty, (:-))) where
|
| infixr 5 :-
|
| data MkList a = Empty
| | a :- (MkList a) deriving (Eq, Show)
|
|
| File ListFun.hs
| ===============
|
| module ListFun(mapL) where
|
| import MyList
|
| mapL f Empty = Empty
| mapL f (x:-xs) = f x :- mapL f xs
|
|
|
| File ListLib
| ============
|
| module ListLib(module MyList, module ListFun) where
|
| import MyList
| import ListFun
|
|
| File Main.hs
| ============
|
| module Main(main) where
|
| import ListLib
|
| main = putStr (show (mapL (+1) (1:-2:-Empty)))
|
|
|
| As I said the code works with hugs, and I want to have the
| hierarchy in
| the library structure.
|
| So, how do I compile this in GHC? I hoped, that it would be enough to
| compile all files with the -c option (generating .hi and .o files) and
| then compiling Main.hs to get an executable program. Howeve, I get the
| following:
|
| > ghc Main.hs
| ghc: module version unchanged at 7
| Undefined first referenced
| symbol in file
| MyList_ZCzm_con_info Main.o
| MyList_zdfShowMkList_closure Main.o
| ListFun_mapL_closure Main.o
| MyList_Empty_static_closure Main.o
| ld: fatal: Symbol referencing errors. No output written to a.out
|
| So, what's wrong, and am I totally on the wrong track... (I
| studied the
| GHC User Guide, but could not find the answer to my problem).
|
| Thanks in advance!
|
| Ingo Sander
|
|
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
|
From romildo@urano.iceb.ufop.br Mon Oct 23 13:22:35 2000
Date: Mon, 23 Oct 2000 10:22:35 -0200
From: =?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?= romildo@urano.iceb.ufop.br
Subject: Overloaded function and implicit parameter passing
Hi.
While experimenting with the implicit parameter
extension to Haskell 98, implemented in GHC 4.08.1
and latest Hugs, I came accross a difference among
those implementations regarding overloading functions
with implicit parameters.
As a test consider the program
------------------------- cut here
module Main where
class C a where
f :: (?env :: Integer) => a -> Integer
instance C Integer where
f x = ?env + x
main = putStrLn (show (f (45::Integer) with ?env = 100))
------------------------- cut here
Hugs accepts this program and outputs 145, as expected.
But GHC 4.08.1 refuses to compile it, emitting the
message
$ ghc -fglasgow-exts Test1.hs -o test1
Test1.hs:7:
Unbound implicit parameter `env_rJX :: Integer'
arising from use of `env_rJX' at Test1.hs:7
In the first argument of `+', namely `env_rJX'
In the right-hand side of an equation for `f': env_rJX + x
Compilation had errors
Would anybody comment on what is going on with GHC?
I am willing to use implicit parameters in the
software I am developing, but I have the need
to overload functions with implicit parameters.
While Hugs is good for development, its performance
may rule it out when the final product is ready.
So I will need a good Haskell compiler to compile
my system.
Any comments?
Romildo
--
Prof. José Romildo Malaquias <romildo@iceb.ufop.br>
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
From fjh@cs.mu.oz.au Mon Oct 23 15:02:14 2000
Date: Tue, 24 Oct 2000 01:02:14 +1100
From: Fergus Henderson fjh@cs.mu.oz.au
Subject: Overloaded function and implicit parameter passing
On 23-Oct-2000, José Romildo Malaquias <romildo@urano.iceb.ufop.br> wrote:
> ------------------------- cut here
> module Main where
>
> class C a where
> f :: (?env :: Integer) => a -> Integer
>
> instance C Integer where
> f x = ?env + x
>
> main = putStrLn (show (f (45::Integer) with ?env = 100))
> ------------------------- cut here
...
> $ ghc -fglasgow-exts Test1.hs -o test1
>
> Test1.hs:7:
> Unbound implicit parameter `env_rJX :: Integer'
> arising from use of `env_rJX' at Test1.hs:7
...
> Would anybody comment on what is going on with GHC?
That sure looks to me like a bug in GHC's support for implicit
parameter passing.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
From romildo@urano.iceb.ufop.br Tue Oct 24 15:59:53 2000
Date: Tue, 24 Oct 2000 12:59:53 -0200
From: =?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?= romildo@urano.iceb.ufop.br
Subject: Compiling mutually recursive modules involving instances
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hello.
I am having difficulties in compiling mutually recursive
modules involving classes and instances in GHC 4.08.1.
Basicaly I am not finding how to write a .hi-boot where
I want to put classes and instances.
Consider a program with 3 modules: M1, M2 and Main. The
sources are attached to the message. What should go
into M2.hi-boot? Would anyone write M2.hi-boot for me
so that I can learn it.
Thanks.
Romildo
--
Prof. José Romildo Malaquias <romildo@iceb.ufop.br>
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="M1.hs"
module M1 where
import {-# SOURCE #-} M2
class C a where
f :: a -> Bool
instance C a => C [a] where
f = or . map f
test = f [ 1 .. 10::Int ]
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="M2.hs"
module M2 where
import M1 ( C )
instance C Int where
f x = mod x 3 == 0
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Main.hs"
module Main where
import M1 (test)
main = putStrLn (show test)
--tThc/1wpZn/ma/RB--
From simonpj@microsoft.com Thu Oct 26 09:50:30 2000
Date: Thu, 26 Oct 2000 01:50:30 -0700
From: Simon Peyton-Jones simonpj@microsoft.com
Subject: Compiling mutually recursive modules involving instances
The best thing to do is never to put an instance
declaration in an hi-boot file. I don't think you ever really
need to. In contrast, mutual recursion of type declarations
is often unavoidable.
The manual should really say this
Simon
| -----Original Message-----
| From: José Romildo Malaquias [mailto:romildo@urano.iceb.ufop.br]
| Sent: 24 October 2000 16:00
| To: glasgow-haskell-users@haskell.org
| Subject: Compiling mutually recursive modules involving instances
|
|
| Hello.
|
| I am having difficulties in compiling mutually recursive
| modules involving classes and instances in GHC 4.08.1.
| Basicaly I am not finding how to write a .hi-boot where
| I want to put classes and instances.
|
| Consider a program with 3 modules: M1, M2 and Main. The
| sources are attached to the message. What should go
| into M2.hi-boot? Would anyone write M2.hi-boot for me
| so that I can learn it.
|
| Thanks.
|
| Romildo
| --
| Prof. José Romildo Malaquias <romildo@iceb.ufop.br>
| Departamento de Computação
| Universidade Federal de Ouro Preto
| Brasil
|
From ger@Informatik.Uni-Bremen.DE Thu Oct 26 11:20:52 2000
Date: Thu, 26 Oct 2000 12:20:52 +0200
From: George Russell ger@Informatik.Uni-Bremen.DE
Subject: getContents
I don't really understand getContents. (Does anyone?) I have some code here
(far too large to submit). If I do (on Linux, ghc4.08.1, both with and without optimisation)
------------------
contents <- hGetContents handle
seq (last contents) (hClose handle)
------------------
the code works. However I looked at the manual and it seems that hClose should
force the whole of contents to be read anyway. So I changed it to
------------------
contents <- hGetContents handle
hClose handle
------------------
and then the code doesn't work. If these are meant to be the same, then we have a GHC
bug. If not, could someone explain in words of one syllable why not?
PS - if you want the source code you'll have to download and compile the whole of UniForM!!
From romildo@urano.iceb.ufop.br Thu Oct 26 11:24:45 2000
Date: Thu, 26 Oct 2000 08:24:45 -0200
From: =?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?= romildo@urano.iceb.ufop.br
Subject: Compiling mutually recursive modules involving instances
On Thu, Oct 26, 2000 at 01:50:30AM -0700, Simon Peyton-Jones wrote:
> The best thing to do is never to put an instance
> declaration in an hi-boot file. I don't think you ever really
> need to. In contrast, mutual recursion of type declarations
> is often unavoidable.
I believe I can redesign the module structures in my project
so that the instances will not need to be put in a hi-boot
file. The body of some methods in these instances uses some
names (type names and function names, possibly with infix
status) defined in a module where the corresponding class
__and__ a relevant set of its instances should be visible.
Logicaly the instances do not belong to the same module as
their class and the user of my library should be able to
add new modules (with new instances of the class) to the
system without the need to modify the source of the module
containing the class definition.
Particularly I am having a great difficult in find a good
module design for my library, which is should be able to be
extended by its user. I am missing some important features
for that, like extensible data types and functions support
in the language. By now I am basing it on the extensible
union types shown in "Monad Transformers and Modular
Interpreters", by Mark Jones and others. When I progress
in that I would make some comments.
> The manual should really say this
The manual also says a new, better, higher level way for
dealing with mutually recursive modules is in the works.
Is there any chance it will be ready for the next release?
> | From: José Romildo Malaquias [mailto:romildo@urano.iceb.ufop.br]
> |
> | I am having difficulties in compiling mutually recursive
> | modules involving classes and instances in GHC 4.08.1.
> | Basicaly I am not finding how to write a .hi-boot where
> | I want to put classes and instances.
> |
> | Consider a program with 3 modules: M1, M2 and Main. The
> | sources are attached to the message. What should go
> | into M2.hi-boot? Would anyone write M2.hi-boot for me
> | so that I can learn it.
Regards,
Romildo
--
Prof. José Romildo Malaquias <romildo@iceb.ufop.br>
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
From simonmar@microsoft.com Thu Oct 26 12:13:58 2000
Date: Thu, 26 Oct 2000 04:13:58 -0700
From: Simon Marlow simonmar@microsoft.com
Subject: getContents
> I don't really understand getContents. (Does anyone?) I
> have some code here
> (far too large to submit). If I do (on Linux, ghc4.08.1,
> both with and without optimisation)
> ------------------
> contents <- hGetContents handle
> seq (last contents) (hClose handle)
> ------------------
> the code works. However I looked at the manual and it seems
> that hClose should
> force the whole of contents to be read anyway. So I changed it to
> ------------------
> contents <- hGetContents handle
> hClose handle
> ------------------
> and then the code doesn't work. If these are meant to be the
> same, then we have a GHC
> bug. If not, could someone explain in words of one syllable why not?
>
> PS - if you want the source code you'll have to download and
> compile the whole of UniForM!!
Using hClose on a semi-closed handle is a Bad Thing. The Haskell Report
says:
"Once a semi-closed handle becomes closed, the contents of
the associated stream becomes fixed, and is the list of those
items which were succesfully read from that handle".
So I take this to mean that when you hClose a semi-closed handle, you get a
random amount of data in the handle which depends on how good your
compiler's strictness analyser is. yesno?
Cheers,
Simon
From Malcolm.Wallace@cs.york.ac.uk Thu Oct 26 12:37:58 2000
Date: Thu, 26 Oct 2000 12:37:58 +0100
From: Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Subject: getContents
> contents <- hGetContents handle
> seq (last contents) (hClose handle)
vs.
> contents <- hGetContents handle
> hClose handle
> However I looked at the manual and it seems that hClose should
> force the whole of contents to be read anyway.
If some manual says this, it is wrong.
The Haskell Report says that 'hGetContents' gives the handle a
special status, called "semi-closed". A semi-closed handle becomes
fully closed when 'hClose' is applied to it. When this occurs, the
contents of the associated stream of characters (i.e. those returned
by 'hGetContents') is truncated, and is the list of characters that
have already been read from that handle.
Regards,
Malcolm
From ger@Informatik.Uni-Bremen.DE Thu Oct 26 13:14:51 2000
Date: Thu, 26 Oct 2000 14:14:51 +0200
From: George Russell ger@Informatik.Uni-Bremen.DE
Subject: getContents
Simon Marlow wrote:
[snip]
> "Once a semi-closed handle becomes closed, the contents of
> the associated stream becomes fixed, and is the list of those
> items which were succesfully read from that handle".
[snip]
Ah, now I see. I had assumed that hClose'ing a semi-closed handle would result in the
entire file being read till EOF, after which the file would be closed.
Thanks.
From simonpj@microsoft.com Thu Oct 26 14:56:17 2000
Date: Thu, 26 Oct 2000 06:56:17 -0700
From: Simon Peyton-Jones simonpj@microsoft.com
Subject: Compiling mutually recursive modules involving instances
| The manual also says a new, better, higher level way for
| dealing with mutually recursive modules is in the works.
| Is there any chance it will be ready for the next release?
I don't think so. The upcoming GHCi will be the next release
and it indeed gives a much better chance of doing this stuff
properly. Making recursive modules possible is a high priority.
But making them easy isn't as high priority as lots of other things,
I'm afraid.
Simon
From christian@lescher.de Thu Oct 26 20:21:59 2000
Date: Thu, 26 Oct 2000 20:21:59 +0100
From: Christian Lescher christian@lescher.de
Subject: Using Haskell code in VBA (MS Access)? - Garbage Collecting doesn't
work in Haskell DLL?!
After adjusting the call of startupHaskell() in dllMain.c to "startupHaskell(1,args,NULL);" (new 3rd argument), the adder example works fine also with GHC 4.08.1.
But I recognized another problem: The Garbage Colletion seems not to work at all when calling functions in a DLL build with GHC:
When calling some more complex Haskell functions, the execution crashes after calling it the 2nd or 3rd time. Another even "bigger" function, that works fine in an EXEcutable, crashes
even while its first execution in the DLL. (In the first case, calling shutdownHaskell() at the end of the function execution helped, but this can't be the right solution, I think. -
What about memory sizes of a DLL? May it help to increase e.g. the heap size, and how to do this?)
What can I do about this?
Regards, Christian
> I tried to compile this small example with ghc-4.08.1, but it didn't work (compiling ok., but DLL does not run), while with ghc-4.05 everything is okay. What can be wrong with this?
>
> Christian Lescher
>
> > -----Urspr> üngliche Nachricht-----
> > Von: Sigbjorn Finne [SMTP:sof@microsoft.com]
> > Gesendet am: Donnerstag, 17. August 2000 20:18
> > An: 'Christian Lescher'
> > Cc: glasgow-haskell-users@haskell.org
> > Betreff: RE: Using Haskell code in VBA (MS Access)?
> >
> >
> > The support libraries for HaskellDirect provide
> > functions for converting between BSTRs and Haskell'
> > String (Com.marshallBSTR, Com.unmarshallBSTR) --
> > http://www.dcs.gla.ac.uk/fp/software/hdirect/user-32.html
> >
> > has the overview. However, the binaries available for
> > that library is for ghc-4.045, so you'd have to compile
> > them up yourself for ghc-4.08.
> >
> > To build a 'static' DLL, here's what you need to do:
> >
> > - compile up all your Haskell code using -static.
> > - write a .def file containing the entry points you
> > want to expose. In my example, the .def file would
> > just contain:
> >
> > EXPORTS
> > adder@8
> >
> > - link the static DLL:
> >
> > ghc-4.05 -static --mk-dll -optdll--def=adder.def \
> > -o adder.dll adder.o dllMain.o -lHSrts
> >
> > I heard some rumours that -static might disappear. If that's
> > the case, I think that would be unfortunate.
> >
> > --sigbjorn
> >
> > Christian Lescher <christian@lescher.de> writes:
> > >
> > > Thank you for your detailed answer - it's really great, it works! :-)
> > >
> > > However, I have got one more problem: the function I want to
> > > call from VBA is of
> > > type String -> String -> String
> > > Is there a (simple) method to convert VBA strings (BSTR) to
> > > Haskell's [Char] and
> > > vice versa?
> > >
> > > By the way: Is it possible to build DLLs that do not depend
> > > on GHC's runtime DLLs?
> > > I tried out the "-static" option like for compiling EXEs, but
> > > it didn't work.
> > >
> > > CL
From kgolder@wellesley.edu Tue Oct 31 21:07:08 2000
Date: Tue, 31 Oct 2000 16:07:08 -0500
From: Kate S. Golder kgolder@wellesley.edu
Subject: ppr for Haskell Abstract Syntax
Hi -
I was wondering if anyone knows if there is a pretty printer for Haskell
Abstract Syntax anywhere? I've been asking around, but haven't located
one yet. If you know of one that I could use, it would be really helpful!
Thanks in advance,
*Kate
**********************
Kate S. Golder
Wellesley College
Class of 2002
Freeman Hall
Wellesley College
Wellesley, Ma 02481
From rrt1001@cam.ac.uk Wed Oct 4 16:00:35 2000
From: rrt1001@cam.ac.uk (Reuben Thomas)
Date: Wed, 4 Oct 2000 16:00:35 +0100 (BST)
Subject: New InstallShield of GHC 4.08.1
Message-ID:
I've just put up a new InstallShield of 4.08.1
(http://www.haskell.org/ghc/download.html, as usual). It fixes some
problems with missing symbols when linking dynamically, and is also better
behaved, in that it clears up the temporary files it makes during
installation, so that when uninstalled it really does delete everything.
--
http://sc3d.org/rrt/ | maxim, n. wisdom for fools
From simonpj@microsoft.com Thu Oct 5 16:54:02 2000
From: simonpj@microsoft.com (Simon Peyton-Jones)
Date: Thu, 5 Oct 2000 08:54:02 -0700
Subject: Generics
Message-ID: <74096918BE6FD94B9068105F877C002DE250B2@red-pt-02.redmond.corp.microsoft.com>
Folks,
I've added Hinze/PJ-style generic class definitions to GHC, based
on summer hacking done by Andrei Serjantov. The design is based
very closely on the Haskell workshop 2000 paper
http://www.informatik.uni-bonn.de/~ralf/Derive.ps.gz
For example:
class Bin a where
toBin :: a -> [Int]
fromBin :: [Int] -> (a, [Int])
toBin {| Unit |} Unit = []
toBin {| a :+: b |} (Inl x) = 0 : toBin x
toBin {| a :+: b |} (Inr y) = 1 : toBin y
toBin {| a :*: b |} (x :*: y) = toBin x ++ toBin y
fromBin {| Unit |} bs = (Unit, bs)
fromBin {| a :+: b |} (0:bs) = (Inl x, bs') where (x,bs') = fromBin
bs
fromBin {| a :+: b |} (1:bs) = (Inr y, bs') where (y,bs') = fromBin
bs
fromBin {| a :*: b |} bs = (x :*: y, bs'') where (x,bs' ) =
fromBin bs
(y,bs'') = fromBin bs'
Now we can say simply
instance Bin a => Bin [a]
and the compiler will derive the appropriate code automatically.
This is now implemented and documented in the CVS version of GHC,
and will be in every future version of GHC. (But I'm afraid we don't plan
a binary release for a while.)
At present we don't (alas) support constructor and field names, so you
can't implement Read and Show generically. But I thought it was worth
getting committed what *is* done.
Simon
From rrt1001@cam.ac.uk Fri Oct 6 17:29:50 2000
From: rrt1001@cam.ac.uk (Reuben Thomas)
Date: Fri, 6 Oct 2000 17:29:50 +0100 (BST)
Subject: Haskell Heaven for Windows Weenies: Pesky Profiling Problems Pulverized
Message-ID:
There's a new 4.08.1 InstallShield with what I *think* are working
profiling libraries (static only).
--
http://sc3d.org/rrt/ | free, a. already paid for
From haskell@davidb.org Tue Oct 10 01:04:25 2000
From: haskell@davidb.org (David Brown)
Date: Mon, 9 Oct 2000 17:04:25 -0700
Subject: Porting to powerpc-linux
Message-ID: <20001009170425.B10931@opus.davidb.org>
I'm considering taking some effort to port GHC to powerpc linux. The task
seems moderately doable, given that GHC once ran on the powerpc
architecture.
I guess as a good first question: should I start with 4.08.1, or should I
venture off with the CVS tree. The driver in CVS seems to have been
written in Haskell, and it seems to be needed to build the runtime. This
sounds like it would preclude building from .hc files.
I've got my x86 linux box ready to build some unregistered .hc files.
Dave (looking forward to debugging RTS) Brown
From fldrsimonmar@microsoft.com Tue Oct 10 11:15:49 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Tue, 10 Oct 2000 03:15:49 -0700
Subject: Porting to powerpc-linux
Message-ID: <9584A4A864BD8548932F2F88EB30D1C611573D@TVP-MSG-01.europe.corp.microsoft.com>
> I'm considering taking some effort to port GHC to powerpc
> linux. The task
> seems moderately doable, given that GHC once ran on the powerpc
> architecture.
Cool! :)
> I guess as a good first question: should I start with 4.08.1,
> or should I
> venture off with the CVS tree. The driver in CVS seems to have been
> written in Haskell, and it seems to be needed to build the
> runtime. This
> sounds like it would preclude building from .hc files.
I would start from 4.08.1, for exactly that reason. We haven't tackled the
issue of bootstrapping with the Haskell driver. The plan was to use a
handwritten Makefile to build an unregisterised driver from .hc sources
using plain gcc, but this isn't done yet. Furthermore, we're about to merge
the driver with the compiler proper as part of the GHCi reorganisation, so
things are going to be broken for a while...
> I've got my x86 linux box ready to build some unregistered .hc files.
You'll need two build trees. In the first tree, build the compiler as
normal, and the libraries/RTS with -unreg -keep-hc-files-too. You should be
able to use these .hc files to try out some simple programs on the PPC.
In the second tree, bootstrap the compiler using the compiler from the first
tree with -unreg -keep-hc-files-too. Take these .hc files to the PPC and
bootstrap them there.
Cheers,
Simon
PS. there may be some difficulties with the -unreg flag: it actually
specifies way 'u', so you may get .u_hc files instead of .hc files. It
might be a better idea to expand -unreg into its component parts:
-optc-DNO_REGS -optc-DUSE_MINIINTERPRETER -fno-asm-mangling
-funregisterised -fvia-C
From haskell@davidb.org Wed Oct 11 19:31:22 2000
From: haskell@davidb.org (David Brown)
Date: Wed, 11 Oct 2000 11:31:22 -0700
Subject: Porting to powerpc-linux
In-Reply-To: <9584A4A864BD8548932F2F88EB30D1C611573D@TVP-MSG-01.europe.corp.microsoft.com>; from fldrsimonmar@microsoft.com on Tue, Oct 10, 2000 at 03:15:49AM -0700
References: <9584A4A864BD8548932F2F88EB30D1C611573D@TVP-MSG-01.europe.corp.microsoft.com>
Message-ID: <20001011113122.A4970@opus.davidb.org>
On Tue, Oct 10, 2000 at 03:15:49AM -0700, Simon Marlow wrote:
> > I've got my x86 linux box ready to build some unregistered .hc files.
>
> You'll need two build trees. In the first tree, build the compiler as
> normal, and the libraries/RTS with -unreg -keep-hc-files-too. You should be
> able to use these .hc files to try out some simple programs on the PPC.
>
> In the second tree, bootstrap the compiler using the compiler from the first
> tree with -unreg -keep-hc-files-too. Take these .hc files to the PPC and
> bootstrap them there.
Ok. Here's what I've done. I've made two trees, b1 and b2, and some
appropriate directories ton install in.
Inside b1, I edited b1/ghc/lib/std/Makefile to add the options
-optc-DNO_REGS... and compiled this compiler.
I then went into b2 and added the unregister options to SRC_HC_OPTS in
b2/mk/config.mk (Configured to use the compiler generated in step b1.
During the build here, the compiler SEGVs when compiling the first haskell
file built with the new built compiler.
...
../../driver/ghc-inplace -keep-hc-file-too -optc-DNO_REGS
-optc-DUSE_MINIINTERPRETER -fno-asm-mangling -funregisterised -fvia-C
-recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing -O -package-name std
-static -split-objs -H12m -c PrelBase.lhs -o PrelBase.o -osuf o
Haskell compiler received signal 11
...
I'm guessing I didn't do the b1 build right. The compiler it generated
builds, but doesn't even run. Do I need to add the unregistered options
throughout the build, or just in the library?
Thanks,
Dave Brown
From bletner@revbiz.com Wed Oct 11 23:12:29 2000
From: bletner@revbiz.com (Brett Letner)
Date: Wed, 11 Oct 2000 17:12:29 -0500
Subject: C main
Message-ID: <000001c033d0$58d397d0$2401a8c0@revbiz.com>
Greetings -
Could someone instruct me on (or point me to) the correct ghc command line
for calling haskell from C?
From the documentation, it seems like "ghc -fglasgow-exts -no-hs-main main.c
foo.hs" should work, but
that still gives me a multiple definition of "main".
I'm running ghc 4.08.1 on Windows NT.
Thanks -
Brett Letner
RBC Incorporated
http://www.revbiz.com
mailto:bletner@revbiz.com
(913) 385-5700 ext.20 Fax (913) 385-5701
From christian.lescher@icn.siemens.de Thu Oct 12 06:47:10 2000
From: christian.lescher@icn.siemens.de (Lescher Christian)
Date: Thu, 12 Oct 2000 07:47:10 +0200
Subject: Exposing Haskell functions with string arguments in a DLL
Message-ID: <353063C297A9D3118F760008C791E269011D05CE@MCHH263E>
How can I convert string arguments (null-terminated strings) to Haskell's [Char]? I saw there is some CString module in package lang of GHC, but I didn't found any documentation about it (e.g. packStringIO...?). How must a function f :: String -> String for usage in a DLL look like in order to convert the string parameter and result?
(From earlier Haskell functions with BSTR arguments, I already know how to build a (static) DLL. I use GHC4.08.1.)
Christian Lescher
From fldrsimonmar@microsoft.com Thu Oct 12 10:07:45 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Thu, 12 Oct 2000 02:07:45 -0700
Subject: C main
Message-ID: <9584A4A864BD8548932F2F88EB30D1C6115740@TVP-MSG-01.europe.corp.microsoft.com>
> Greetings -
>
> Could someone instruct me on (or point me to) the correct ghc
> command line
> for calling haskell from C?
> From the documentation, it seems like "ghc -fglasgow-exts
> -no-hs-main main.c
> foo.hs" should work, but
> that still gives me a multiple definition of "main".
>
> I'm running ghc 4.08.1 on Windows NT.
You can use ghc just like you would use gcc to compile up your C program,
then use ghc again to link the whole program with the Haskell module(s).
The -no-hs-main flag shouldn't be necessary, as far as I can tell. eg.
$ ghc -c main.c
$ ghc -c HaskellStuff.hs
$ ghc main.o HaskellStuff.o
Cheers,
Simon
From fldrsimonmar@microsoft.com Thu Oct 12 10:02:10 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Thu, 12 Oct 2000 02:02:10 -0700
Subject: Porting to powerpc-linux
Message-ID: <9584A4A864BD8548932F2F88EB30D1C610CDF8@TVP-MSG-01.europe.corp.microsoft.com>
> I'm guessing I didn't do the b1 build right. The compiler it
> generated
> builds, but doesn't even run. Do I need to add the
> unregistered options
> throughout the build, or just in the library?
Just the libraries and the RTS in b1, and the compiler in b2. You can check
that things are working right by compiling up hello world against b1
(remember to add the options when compiling hello world too).
Cheers,
Simon
From sof@microsoft.com Thu Oct 12 18:17:35 2000
From: sof@microsoft.com (Sigbjorn Finne)
Date: Thu, 12 Oct 2000 10:17:35 -0700
Subject: C main
Message-ID: <164943583CAE624A868E2EF9A78A795625C353@red-msg-05.redmond.corp.microsoft.com>
Simon Marlow writes:
> >
> > Could someone instruct me on (or point me to) the correct ghc
> > command line for calling haskell from C?
> > ...
>
> You can use ghc just like you would use gcc to compile up
> your C program,
> then use ghc again to link the whole program with the Haskell
> module(s). The -no-hs-main flag shouldn't be necessary, as
> far as I can tell. eg.
>
> $ ghc -c main.c
> $ ghc -c HaskellStuff.hs
> $ ghc main.o HaskellStuff.o
>
That will (sort of) work if you also insist that HaskellStuff.hs
implements Main.main. As the name suggests, -no-hs-main takes care
of the case when HaskellStuff.hs doesn't. (Well almost, the 4.08 driver
contains a bug in setupLinkOpts(); __init_PrelMain should be handled
the same way as PrelMain_mainIO_closure. )
In either case, you need to make sure that the RTS is started up,
since you're not using the RTS-supplied main(). The HDirect distribution
contains an example of this in examples/server/, but notice that the
4.08 RTS' startupHaskell() signature has changed to also take an extra
'module root' argument. However, even with that change, 4.08
compiled code crashes when running (4.05 works fine), which leads
me to believe there's something else going on here :-) This is on
the same platform that Brett originally reported the problem on.
--sigbjorn
btw, 4.05 contained a bug in this area which made -no-hs-main only
work when linking with -static. 4.08 seems to have inherited it, i.e.,
in prepareWin32DllLink(), the condition for pushing Main.dll_o and
PrelMain.dll_o onto @Link_file should be ($linking_main && !$NoHaskellMain)
and not just $linking_main
From stolz@I2.Informatik.RWTH-Aachen.DE Fri Oct 13 11:09:33 2000
From: stolz@I2.Informatik.RWTH-Aachen.DE (Volker Stolz)
Date: Fri, 13 Oct 2000 12:09:33 +0200
Subject: How to get BlockedOnDeadMVar exception?
Message-ID: <20001013120933.A2631@agamemnon.informatik.rwth-aachen.de>
I didn't succeed in getting (or catching?) this exception through an
obvious example. Is this exception thrown at all or just NYI?
Is this exception thrown at all or just NYI?
Volker
--
Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
From fldrsimonmar@microsoft.com Fri Oct 13 12:01:00 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Fri, 13 Oct 2000 04:01:00 -0700
Subject: How to get BlockedOnDeadMVar exception?
Message-ID: <9584A4A864BD8548932F2F88EB30D1C610CE01@TVP-MSG-01.europe.corp.microsoft.com>
> I didn't succeed in getting (or catching?) this exception through an
> obvious example. Is this exception thrown at all or just NYI?
>
> Is this exception thrown at all or just NYI?
Sure it's implemented. However, a main thread will never get this exception
(at the moment). Try this example in 4.08.1:
module Main where
import Exception
import Concurrent
main = do
id <- myThreadId
forkIO (catchAllIO (do m <- newEmptyMVar; takeMVar m)
(\e -> raiseInThread id e))
catchAllIO (print (sum [1..1000000]))
(\e -> print e)
Cheers,
Simon
From stolz@I2.Informatik.RWTH-Aachen.DE Fri Oct 13 13:38:46 2000
From: stolz@I2.Informatik.RWTH-Aachen.DE (Volker Stolz)
Date: Fri, 13 Oct 2000 14:38:46 +0200
Subject: How to get BlockedOnDeadMVar exception?
In-Reply-To: <9584A4A864BD8548932F2F88EB30D1C610CE01@TVP-MSG-01.europe.corp.microsoft.com>; from fldrsimonmar@microsoft.com on Fri, Oct 13, 2000 at 04:01:00AM -0700
References: <9584A4A864BD8548932F2F88EB30D1C610CE01@TVP-MSG-01.europe.corp.microsoft.com>
Message-ID: <20001013143846.A3508@agamemnon.informatik.rwth-aachen.de>
On Fri, Oct 13, 2000 at 04:01:00AM -0700, Simon Marlow wrote:
> Sure it's implemented. However, a main thread will never get this exception
> (at the moment). Try this example in 4.08.1:
Funny, it works and almost looks the same like my code. Only {Ee}xception:
I was using a getLine-loop for preventing the main thread from exiting.
Could this be the reason I don't get the exception?
--
Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
From bletner@revbiz.com Fri Oct 13 14:43:26 2000
From: bletner@revbiz.com (Brett Letner)
Date: Fri, 13 Oct 2000 08:43:26 -0500
Subject: C main
In-Reply-To: <164943583CAE624A868E2EF9A78A795625C353@red-msg-05.redmond.corp.microsoft.com>
Message-ID: <000c01c0351b$90f33160$2401a8c0@revbiz.com>
So if I understand this correctly, I'm doing it wrong, but that's o.k.
because even if I wasn't it still wouldn't work :)
This brings up a larger question, should I even be trying to do this?
Here is the situation:
A colleague of mine had a couple of little routines that he needed
(something simple to do in Haskell but a pain in C).
I quickly zipped out the solution in a few lines of Haskell, but now I would
like to give him something usable from C.
My question is:
What format can I (and/or should I) give him the routines in...
C code he can compile? This would be best, but I couldn't figure out how to
make this work.
An object file he can link in? This is what I was attempting.
A dll?
A com object? (I don't have any experience with com)
Something else?
Thanks for your help -
Brett Letner
RBC Incorporated
http://www.revbiz.com
mailto:bletner@revbiz.com
(913) 385-5700 ext.20 Fax (913) 385-5701
-----Original Message-----
From: Sigbjorn Finne [mailto:sof@microsoft.com]
Sent: Thursday, October 12, 2000 12:18 PM
To: glasgow-haskell-users@haskell.org
Cc: 'bletner@revbiz.com'
Subject: RE: C main
Simon Marlow writes:
> >
> > Could someone instruct me on (or point me to) the correct ghc
> > command line for calling haskell from C?
> > ...
>
> You can use ghc just like you would use gcc to compile up
> your C program,
> then use ghc again to link the whole program with the Haskell
> module(s). The -no-hs-main flag shouldn't be necessary, as
> far as I can tell. eg.
>
> $ ghc -c main.c
> $ ghc -c HaskellStuff.hs
> $ ghc main.o HaskellStuff.o
>
That will (sort of) work if you also insist that HaskellStuff.hs
implements Main.main. As the name suggests, -no-hs-main takes care
of the case when HaskellStuff.hs doesn't. (Well almost, the 4.08 driver
contains a bug in setupLinkOpts(); __init_PrelMain should be handled
the same way as PrelMain_mainIO_closure. )
In either case, you need to make sure that the RTS is started up,
since you're not using the RTS-supplied main(). The HDirect distribution
contains an example of this in examples/server/, but notice that the
4.08 RTS' startupHaskell() signature has changed to also take an extra
'module root' argument. However, even with that change, 4.08
compiled code crashes when running (4.05 works fine), which leads
me to believe there's something else going on here :-) This is on
the same platform that Brett originally reported the problem on.
--sigbjorn
btw, 4.05 contained a bug in this area which made -no-hs-main only
work when linking with -static. 4.08 seems to have inherited it, i.e.,
in prepareWin32DllLink(), the condition for pushing Main.dll_o and
PrelMain.dll_o onto @Link_file should be ($linking_main && !$NoHaskellMain)
and not just $linking_main
From fldrsimonmar@microsoft.com Fri Oct 13 13:55:34 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Fri, 13 Oct 2000 05:55:34 -0700
Subject: How to get BlockedOnDeadMVar exception?
Message-ID: <9584A4A864BD8548932F2F88EB30D1C610CE02@TVP-MSG-01.europe.corp.microsoft.com>
> On Fri, Oct 13, 2000 at 04:01:00AM -0700, Simon Marlow wrote:
> > Sure it's implemented. However, a main thread will never
> get this exception
> > (at the moment). Try this example in 4.08.1:
>
> Funny, it works and almost looks the same like my code. Only
> {Ee}xception:
> I was using a getLine-loop for preventing the main thread
> from exiting.
> Could this be the reason I don't get the exception?
probably: the exception is generated as a result of the thread being
discovered unreachable during garbage collection. If there's no garbage
collection, eg. because the program is waiting for I/O, then the exception
is never raised.
Which brings up an interesting subject: should the RTS start a GC after it
has been waiting for I/O for a certain length of time? If so, how long?
Cheers,
Simon
From sof@microsoft.com Fri Oct 13 22:35:34 2000
From: sof@microsoft.com (Sigbjorn Finne)
Date: Fri, 13 Oct 2000 14:35:34 -0700
Subject: C main
Message-ID: <164943583CAE624A868E2EF9A78A795625C356@red-msg-05.redmond.corp.microsoft.com>
Brett Letner writes:
>
> So if I understand this correctly, I'm doing it wrong, but that's o.k.
> because even if I wasn't it still wouldn't work :)
>
> This brings up a larger question, should I even be trying to do this?
>
Yes, linking in Haskell code in the way you tried is the most convenient
way of going about embedding Haskell code into C/C++ apps (well, at
least that's the intention ;-)
You can package up Haskell code in a DLL and call it that way, but that
requires extra steps. I posted some instructions on how to build
ghc-compiled DLLs on this mailing list a couple of weeks ago; you may
find them useful here.
If you're really desperate, what you tried to do works with ghc-4.05. It
depends on using another version of cygwin (gcc, really) than 4.08, so I
wouldn't recommend doing this if you haven't already got it installed.
hth
--sigbjorn
From fldrsimonmar@microsoft.com Mon Oct 16 12:07:14 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Mon, 16 Oct 2000 04:07:14 -0700
Subject: Exposing Haskell functions with string arguments in a DLL
Message-ID: <9584A4A864BD8548932F2F88EB30D1C610CE07@TVP-MSG-01.europe.corp.microsoft.com>
> How can I convert string arguments (null-terminated strings)
> to Haskell's [Char]? I saw there is some CString module in
> package lang of GHC, but I didn't found any documentation
> about it (e.g. packStringIO...?).
For converting a static null-terminated C string to a Haskell String, use
CString.unpackCString. If you need to free the memory used by the original
C string afterwards, use CString.unpackCStringIO.
Cheers,
Simon
From christian.lescher@icn.siemens.de Mon Oct 16 12:20:28 2000
From: christian.lescher@icn.siemens.de (Lescher Christian)
Date: Mon, 16 Oct 2000 13:20:28 +0200
Subject: AW: Exposing Haskell functions with string arguments in a DLL
Message-ID: <353063C297A9D3118F760008C791E269011D05DB@MCHH263E>
Thanks!! What about the other direction? (Haskell function with string =
result)
Christian
> -----Urspr> =FCngliche Nachricht-----
> Von: Simon Marlow [SMTP:fldrsimonmar@microsoft.com]
> Gesendet am: Montag, 16. Oktober 2000 13:07
> An: 'Lescher Christian'; 'glasgow-haskell-users@haskell.org'
> Betreff: RE: Exposing Haskell functions with string arguments in a =
DLL
>=20
>=20
> > How can I convert string arguments (null-terminated strings)=20
> > to Haskell's [Char]? I saw there is some CString module in=20
> > package lang of GHC, but I didn't found any documentation=20
> > about it (e.g. packStringIO...?).
>=20
> For converting a static null-terminated C string to a Haskell String, =
use
> CString.unpackCString. If you need to free the memory used by the =
original
> C string afterwards, use CString.unpackCStringIO.
>=20
> Cheers,
> Simon
From fldrsimonmar@microsoft.com Mon Oct 16 12:39:51 2000
From: fldrsimonmar@microsoft.com (Simon Marlow)
Date: Mon, 16 Oct 2000 04:39:51 -0700
Subject: Exposing Haskell functions with string arguments in a DLL
Message-ID: <9584A4A864BD8548932F2F88EB30D1C610CE09@TVP-MSG-01.europe.corp.microsoft.com>
You can use CString.packString and CString.packStringIO, but be aware that
(a) these functions return ByteArrays, so you need to
adjust your foreign export definitions accordingly
(b) because they use ByteArray, these functions are GHC
specific and any use of them is non-portable.
GHC currently doesn't supply a portable way to marshal strings from Haskell
to C. However, you can quite easily write your own using eg. the functions
from Storable.
Cheers,
Simon
> -----Original Message-----
> From: Lescher Christian [mailto:christian.lescher@icn.siemens.de]
> Sent: Monday, October 16, 2000 12:20 PM
> To: Simon Marlow; 'glasgow-haskell-users@haskell.org'
> Subject: AW: Exposing Haskell functions with string arguments in a DLL
>
>
> Thanks!! What about the other direction? (Haskell function
> with string result)
>
> Christian
>
> > -----Urspr> üngliche Nachricht-----
> > Von: Simon Marlow [SMTP:fldrsimonmar@microsoft.com]
> > Gesendet am: Montag, 16. Oktober 2000 13:07
> > An: 'Lescher Christian'; 'glasgow-haskell-users@haskell.org'
> > Betreff: RE: Exposing Haskell functions with string
> arguments in a DLL
> >
> >
> > > How can I convert string arguments (null-terminated strings)
> > > to Haskell's [Char]? I saw there is some CString module in
> > > package lang of GHC, but I didn't found any documentation
> > > about it (e.g. packStringIO...?).
> >
> > For converting a static null-terminated C string to a
> Haskell String, use
> > CString.unpackCString. If you need to free the memory used
> by the original
> > C string afterwards, use CString.unpackCStringIO.
> >
> > Cheers,
> > Simon
>
From christian@lescher.de Tue Oct 17 20:29:35 2000
From: christian@lescher.de (Christian Lescher)
Date: Tue, 17 Oct 2000 20:29:35 +0100
Subject: Haskell function with String arguments in DLL
Message-ID: <39ECA89F.B4964EB9@lescher.de>
I'm trying to build a DLL with a Haskell function of type String ->
String, that should be called from outside (e.g. VBA), but it still
doesn't work.
I'm afraid I need an example or some kind of 'step by step instruction'.
Who can help me? (I use GHC 4.08.1.)
Christian
From chak@cse.unsw.edu.au Wed Oct 18 10:06:26 2000
From: chak@cse.unsw.edu.au (Manuel M. T. Chakravarty)
Date: Wed, 18 Oct 2000 20:06:26 +1100
Subject: GHC for RedHat 7.0 (gcc 2.96)
Message-ID: <20001018200626F.chak@cse.unsw.edu.au>
GHC (4.08.1) rpm packages for RedHat 7.0 are available from
ftp://ftp.cse.unsw.edu.au/pub/users/chak/jibunmaki/i386/ghc-4.08.1-2.i386.rpm
ftp://ftp.cse.unsw.edu.au/pub/users/chak/jibunmaki/i386/ghc-prof-4.08.1-2.i386.rpm
[The second package is only required for profiling.]
The corresponding source rpm is at
ftp://ftp.cse.unsw.edu.au/pub/users/chak/jibunmaki/src/ghc-4.08.1-2.src.rpm
** IMPORTANT **
For this to work, you have to additionally install on old
version (2.0) of the GNU Multiprecision Library (GMP). Get
it off your old RedHat 6.2 CD or alternatively from
ftp://ftp.linux.com/mounts/u2/mirrors/redhat/up2date/rhl-6.2/i386/RedHat/RPMS/gmp-2.0.2-13.i386.rpm
ftp://ftp.linux.com/mounts/u2/mirrors/redhat/up2date/rhl-6.2/i386/RedHat/RPMS/gmp-devel-2.0.2-13.i386.rpm
* You have to install *both* packages.
* They can co-exist with the new library (version 3.0)
installed by default with RedHat 7.0.
NOTE: These packages cannot be installed on RedHat 6.2 and
earlier (unless you manually upgrade to the rpm
package manager 4.0).
Happy Hacking,
Manuel
PS: Could these packages be linked from GHC's download page?
And please also add the comment and links re gmp 2.0.
Moreover, please *don't* remove the old links for the
benefit of RH6.2 users.
From martijn@cs.uu.nl Wed Oct 18 18:40:18 2000
From: martijn@cs.uu.nl (Martijn)
Date: Wed, 18 Oct 2000 19:40:18 +0200
Subject: Socket.hs problem under Windows 2000
Message-ID: <4.3.2.7.2.20001018192140.0383a9e8@relay.cs.uu.nl>
Hi,
I'm trying to set up some socket connections with Haskell on a Windows 2000
platform, but I can't seem to get them working.
My program is rather simple:
--
import Socket
main = do { socket <- listenOn (PortNumber 1234)
; return ()
}
--
I know this shouldn't do anything at all, but instead it gives an error
message:
Fail: does not exist
Action: getProtocolByName
Reason: no such protocol entry
I get the same message for any socket operation I try to perform. Also a
basic call like getHostName from module BSD does not work. I've compiled
with ghc version 4.05 with option "-syslib misc"
Should I compile differently, is this a problem with CygWin, or am I
overlooking something?
TIA,
Martijn Schrage
From sof@microsoft.com Wed Oct 18 18:50:26 2000
From: sof@microsoft.com (Sigbjorn Finne)
Date: Wed, 18 Oct 2000 10:50:26 -0700
Subject: Socket.hs problem under Windows 2000
Message-ID: <164943583CAE624A868E2EF9A78A795625C35B@red-msg-05.redmond.corp.microsoft.com>
You need to init WinSock first, i.e.,
main = withSocketsDo $ do {...}
--sigbjorn
Martijn [mailto:martijn@cs.uu.nl] writes:
>
> Hi,
>
> I'm trying to set up some socket connections with Haskell on
> a Windows 2000
> platform, but I can't seem to get them working.
>
> My program is rather simple:
> --
> import Socket
>
> main = do { socket <- listenOn (PortNumber 1234)
> ; return ()
> }
> --
>
> I know this shouldn't do anything at all, but instead it
> gives an error
> message:
>
> Fail: does not exist
> Action: getProtocolByName
> Reason: no such protocol entry
>
> I get the same message for any socket operation I try to
> perform. Also a
> basic call like getHostName from module BSD does not work.
> I've compiled
> with ghc version 4.05 with option "-syslib misc"
>
> Should I compile differently, is this a problem with CygWin, or am I
> overlooking something?
>
> TIA,
> Martijn Schrage
>
From rrt1001@cam.ac.uk Thu Oct 19 16:19:36 2000
From: rrt1001@cam.ac.uk (Reuben Thomas)
Date: Thu, 19 Oct 2000 16:19:36 +0100 (BST)
Subject: GHC RPMs for RedHat 7
Message-ID:
There are now GHC RPMs for RedHat 7 available from the download page
(http://www.haskell.org/ghc/download.html).
Note that (as stated there) you need to install GMP 2 RPMs if you don't
have them already (they're provided). The development version of GHC has
now moved to GMP 3, so we'll have this wrinkle ironed out in the next
release.
--
http://sc3d.org/rrt/ | certain, a. insufficiently analysed
From ger@Informatik.Uni-Bremen.DE Thu Oct 19 16:24:04 2000
From: ger@Informatik.Uni-Bremen.DE (George Russell)
Date: Thu, 19 Oct 2000 17:24:04 +0200
Subject: GHC RPMs for RedHat 7
References:
Message-ID: <39EF1214.A9E5F351@informatik.uni-bremen.de>
On this subject, where am I to get the libgmp2.a required by 4.08.1
(on Linux anyway). I tried compiling the very latest version of GMP
but it only produced a libgmp.a file. Is that the same?
NB that RPMs aren't a lot of good to me unless they come with a hefty
bribe for the hard-nosed system administrators around here.
From michael.weber@post.rwth-aachen.de Thu Oct 19 16:39:54 2000
From: michael.weber@post.rwth-aachen.de (Michael Weber)
Date: Thu, 19 Oct 2000 17:39:54 +0200
Subject: shared libgmp2 (was: Re: GHC RPMs for RedHat 7)
In-Reply-To: <39EF1214.A9E5F351@informatik.uni-bremen.de>; from George Russell on Thu, Oct 19, 2000 at 05:24:04PM +0200
References: <39EF1214.A9E5F351@informatik.uni-bremen.de>
Message-ID: <20001019173954.A8516@jennifer.informatik.rwth-aachen.de>
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
On Thu, Oct 19, 2000 at 17:24:04 +0200, George Russell wrote:
> On this subject, where am I to get the libgmp2.a required by 4.08.1
> (on Linux anyway). I tried compiling the very latest version of GMP
> but it only produced a libgmp.a file. Is that the same?
Everyone and their brothers is patching it. I've no idea, why upstream
didn't incorporate the patch... Maybe, they have done it in the new
version (libgmp3)...
Anyway, I attached a patch for libgmp2-2.0.2, ie. the old version...
Cheers,
Michael
--
/~\ ASCII ribbon | beta test, v: To voluntarily entrust one's data, one's
\ / campaign | livelihood and one's sanity to hardware or software
X against | intended to destroy all three. In earlier days,
/ \ HTML mail | virgins were often selected to beta test volcanos.
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="gmp_i2-2.0.2-1.shared.patch"
diff -ur -x Makefile gmp-2.0.2-orig/Makefile.in gmp-2.0.2/Makefile.in
--- gmp-2.0.2-orig/Makefile.in Thu Jun 6 19:21:19 1996
+++ gmp-2.0.2/Makefile.in Sat May 23 15:55:11 1998
@@ -27,10 +27,13 @@
infodir = $(prefix)/info
includedir = $(prefix)/include
+MV = mv
CC = gcc
LOCAL_CC = $(CC)
CFLAGS = -g -O
XCFLAGS =
+PICFLAGS = -fPIC
+
AR = ar
AR_FLAGS = rc
RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
@@ -51,19 +54,23 @@
extract-double.c insert-double.c
OBJS = memory.o mp_set_fns.o mp_clz_tab.o version.o stack-alloc.o mp_bpl.o \
extract-double.o insert-double.o
+SHOBJS = $(foreach OBJECT, $(OBJS), shared/$(OBJECT))
FILES = gmp.h mp.h gmp-impl.h longlong.h urandom.h move-if-change \
mkinstalldirs INSTALL COPYING.LIB ChangeLog Makefile.in \
NEWS README SPEED TODO config.guess config.sub configure configure.in \
gmp.info* gmp.texi texinfo.tex $(SRCS)
INCLUDES = -I. -Impn -I$(srcdir)
-FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)"
+FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)" "PICFLAGS=$(PICFLAGS)" "MV=$(MV)"
-all: libgmp.a
+all: libgmp.a libgmp.so
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
+%.o : ../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
libgmp.a: mpn/libmpn.a mpz/libmpz.a mpf/libmpf.a mpq/libmpq.a $(OBJS)
rm -rf tmpdir
mkdir tmpdir
@@ -78,6 +85,22 @@
mv tmpdir/$@ .
rm -rf tmpdir
+shared:
+ mkdir shared
+
+libgmp.so: shared mpn/shared mpz/shared mpf/shared mpq/shared $(SHOBJS)
+ rm -rf tmpdir
+ mkdir tmpdir
+ for i in mpn mpz mpf mpq; \
+ do \
+ mkdir tmpdir/$$i; \
+ cp -p $$i/shared/* tmpdir/$$i; \
+ done
+ cp -p shared/* tmpdir/
+ cd tmpdir; $(CC) -shared -Wl,-soname,libgmp.so.2 -o libgmp.so.2.0.2 *.o */*.o
+ mv tmpdir/libgmp.so.2.0.2 .;ln -s libgmp.so.2.0.2 libgmp.so
+ rm -rf tmpdir
+
libmp.a: mpn/libmpn.a mpbsd/libmpbsd.a $(OBJS)
rm -rf tmpdir
mkdir tmpdir
@@ -103,6 +126,15 @@
mpbsd/libmpbsd.a: force
cd mpbsd; $(MAKE) $(FLAGS_TO_PASS) libmpbsd.a
+mpn/shared: force
+ cd mpn; $(MAKE) $(FLAGS_TO_PASS) libmpn.so
+mpz/shared: force
+ cd mpz; $(MAKE) $(FLAGS_TO_PASS) libmpz.so
+mpf/shared: force
+ cd mpf; $(MAKE) $(FLAGS_TO_PASS) libmpf.so
+mpq/shared: force
+ cd mpq; $(MAKE) $(FLAGS_TO_PASS) libmpq.so
+
check: libgmp.a
cd mpz/tests; $(MAKE) $(FLAGS_TO_PASS) check
cd mpq/tests; $(MAKE) $(FLAGS_TO_PASS) check
@@ -142,6 +174,10 @@
-chmod a-x $(libdir)/libgmp.a
$(INSTALL_DATA) $(srcdir)/gmp.h $(includedir)/gmp.h
-chmod a-x $(includedir)/gmp.h
+ $(INSTALL_DATA) libgmp.so.2.0.2 $(libdir)/libgmp.so.2.0.2
+ cd $(libdir);rm -f libgmp.so libgmp.so.2 libgmp.so.2.0
+ cd $(libdir);ln -s libgmp.so.2.0.2 libgmp.so.2
+ cd $(libdir);ln -s libgmp.so.2 libgmp.so
install-bsdmp: installdirs libmp.a gmp.info install-info-files
$(INSTALL_DATA) libmp.a $(libdir)/libmp.a
-chmod a-x $(libdir)/libmp.a
@@ -152,9 +188,10 @@
do $(INSTALL_DATA) $$f $(infodir)/$$f; done
-chmod a-x $(infodir)/gmp.info*
# Attempt to edit the info directory node
- if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
- install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
- else true; fi
+# Do this from the rpm spec file.
+# if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+# install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
+# else true; fi
installdirs: $(srcdir)/mkinstalldirs
$(srcdir)/mkinstalldirs $(includedir) $(libdir) $(infodir)
@@ -168,6 +205,7 @@
clean mostlyclean:
rm -f *.o libgmp.a libmp.a gmp.dvi gmp.ps tmp.* tmp-*
+ rm -rf shared libgmp.so.2.0.2 libgmp.so
rm -f gmp.?? gmp.??s gmp.log gmp.toc gmp.*aux gmp*.html
-cd mpn; $(MAKE) $@
-cd mpz; $(MAKE) $@
diff -ur -x Makefile gmp-2.0.2-orig/mpf/Makefile.in gmp-2.0.2/mpf/Makefile.in
--- gmp-2.0.2-orig/mpf/Makefile.in Fri May 24 14:29:16 1996
+++ gmp-2.0.2/mpf/Makefile.in Sat May 23 15:58:16 1998
@@ -42,7 +42,7 @@
add.o add_ui.o sub.o sub_ui.o ui_sub.o mul.o mul_ui.o div.o div_ui.o \
cmp.o cmp_ui.o cmp_si.o mul_2exp.o div_2exp.o abs.o neg.o set_q.o get_d.o \
set_dfl_prec.o set_prc.o set_prc_raw.o get_prc.o ui_div.o sqrt_ui.o
-
+MPF_SHOBJS = $(foreach OBJECT, $(MPF_OBJS), shared/$(OBJECT))
LATER_OBJS = inp_raw.o out_raw.o random.o pow_ui.o fac_ui.o
INCLUDES = -I. -I.. -I../mpn -I$(srcdir)/..
@@ -51,11 +51,21 @@
rm -f $@
$(AR) $(AR_FLAGS) $@ $(MPF_OBJS)
+shared:
+ mkdir shared
+
+libmpf.so: shared Makefile $(MPF_SHOBJS)
+ touch libmpf.so
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
clean mostlyclean:
rm -f *.o libmpf.a
+ rm -rf shared libmpf.so
-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
rm -f Makefile config.status
diff -ur -x Makefile gmp-2.0.2-orig/mpn/Makefile.in gmp-2.0.2/mpn/Makefile.in
--- gmp-2.0.2-orig/mpn/Makefile.in Fri May 17 04:44:42 1996
+++ gmp-2.0.2/mpn/Makefile.in Sat May 23 16:03:31 1998
@@ -21,6 +21,7 @@
srcdir = .
MPN_OBJECTS = This gets filled in by configure.in.
+MPN_SHOBJS = $(foreach OBJECT,$(MPN_OBJECTS),shared/$(OBJECT))
MPN_LINKS = This gets filled in by configure.in.
CC = gcc
CPP = $(CC) -E
@@ -37,21 +38,39 @@
rm -f $@
$(AR) $(AR_FLAGS) $@ mp_bases.o $(MPN_OBJECTS)
+libmpn.so: shared Makefile shared/mp_bases.o $(MPN_SHOBJS)
+ touch libmpn.so
+
.SUFFIXES: .c .s .S
+shared:
+ mkdir shared
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
+%.o:../%.s
+ $(CC) -c $(CFLAGS) $(PICFLAGS) $< -o $@
+
.s.o:
$(CC) -c $(CFLAGS) $<
+%.o:../%.S
+ $(CPP) $(SFLAGS) $(INCLUDES) $(CFLAGS) $(PICFLAGS) $< | grep -v '^#'>tmp-$(notdir $*).s
+ $(CC) -c tmp-$(notdir $*).s $(CFLAGS) $(PICFLAGS) -o $@
+ rm -f tmp-$(notdir $*).s
+
.S.o:
$(CPP) $(SFLAGS) $(INCLUDES) $(CFLAGS) $< | grep -v '^#' >tmp-$*.s
- $(CC) -c tmp-$*.s -o $@
+ $(CC) $(CFLAGS) -c tmp-$*.s -o $@
rm -f tmp-$*.s
clean mostlyclean:
rm -f *.o tmp-* libmpn.a
+ rm -rf shared libmpn.so
#-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
rm -f asm-syntax.h Makefile config.status $(MPN_LINKS)
diff -ur -x Makefile gmp-2.0.2-orig/mpq/Makefile.in gmp-2.0.2/mpq/Makefile.in
--- gmp-2.0.2-orig/mpq/Makefile.in Fri May 17 05:04:22 1996
+++ gmp-2.0.2/mpq/Makefile.in Sat May 23 16:05:28 1998
@@ -36,17 +36,27 @@
MPQ_OBJS = add.o canonicalize.o clear.o cmp.o cmp_ui.o div.o get_d.o \
get_den.o get_num.o init.o inv.o mul.o neg.o set.o set_den.o set_num.o \
set_si.o set_ui.o sub.o equal.o set_z.o
-
+MPQ_SHOBJS = $(foreach OBJECT,$(MPQ_OBJS),shared/$(OBJECT))
INCLUDES = -I. -I.. -I../mpn -I$(srcdir)/..
libmpq.a: Makefile $(MPQ_OBJS)
rm -f $@
$(AR) $(AR_FLAGS) $@ $(MPQ_OBJS)
+libmpq.so: shared Makefile $(MPQ_SHOBJS)
+ touch libmpq.so
+
+shared:
+ mkdir shared
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
clean mostlyclean:
+ rm -rf shared libmpq.so
rm -f *.o libmpq.a
-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
diff -ur -x Makefile gmp-2.0.2-orig/mpz/Makefile.in gmp-2.0.2/mpz/Makefile.in
--- gmp-2.0.2-orig/mpz/Makefile.in Fri May 24 14:45:46 1996
+++ gmp-2.0.2/mpz/Makefile.in Sat May 23 16:07:33 1998
@@ -65,18 +65,28 @@
tdiv_qr.o tdiv_q.o tdiv_r.o tdiv_qr_ui.o tdiv_q_ui.o tdiv_r_ui.o \
mod.o divexact.o array_init.o scan0.o scan1.o \
jacobi.o legendre.o invert.o
-
+MPZ_SHOBJS = $(foreach OBJECT,$(MPZ_OBJS),shared/$(OBJECT))
INCLUDES = -I. -I.. -I../mpn -I$(srcdir)/..
libmpz.a: Makefile $(MPZ_OBJS)
rm -f $@
$(AR) $(AR_FLAGS) $@ $(MPZ_OBJS)
+libmpz.so: shared Makefile $(MPZ_SHOBJS)
+ touch libmpz.so
+
+shared:
+ mkdir shared
+
+%.o:../%.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $(PICFLAGS) $< -o $@
+
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
clean mostlyclean:
rm -f *.o libmpz.a
+ rm -rf shared libmpz.so
-cd tests; $(MAKE) $@
distclean maintainer-clean: clean
rm -f Makefile config.status
--45Z9DzgjV8m4Oswq--
From Keith.Wansbrough@cl.cam.ac.uk Thu Oct 19 17:13:56 2000
From: Keith.Wansbrough@cl.cam.ac.uk (Keith Wansbrough)
Date: Thu, 19 Oct 2000 17:13:56 +0100
Subject: GHC RPMs for RedHat 7
In-Reply-To: Your message of "Thu, 19 Oct 2000 17:24:04 +0200."
<39EF1214.A9E5F351@informatik.uni-bremen.de>
Message-ID:
> On this subject, where am I to get the libgmp2.a required by 4.08.1
> (on Linux anyway). I tried compiling the very latest version of GMP
> but it only produced a libgmp.a file. Is that the same?
Same happened to me. ln -s libgmp.a libgmp2.a worked for me. I satisfied myself I was doing the right thing by noticing all the 2.x.x version numbers on the libgmp source I'd compiled.
It does link. Haven't tried any fancy math, though, so maybe it's broken.
--KW 8-)
--
Keith Wansbrough
http://www.cl.cam.ac.uk/users/kw217/
Cambridge University Computer Laboratory.
From ger@Informatik.Uni-Bremen.DE Thu Oct 19 17:17:41 2000
From: ger@Informatik.Uni-Bremen.DE (George Russell)
Date: Thu, 19 Oct 2000 18:17:41 +0200
Subject: GHC RPMs for RedHat 7
References:
Message-ID: <39EF1EA5.4C3D99A7@informatik.uni-bremen.de>
Keith Wansbrough wrote:
>
> > On this subject, where am I to get the libgmp2.a required by 4.08.1
> > (on Linux anyway). I tried compiling the very latest version of GMP
> > but it only produced a libgmp.a file. Is that the same?
>
> Same happened to me. ln -s libgmp.a libgmp2.a worked for me. I satisfied myself I was doing the right thing by noticing all the 2.x.x version numbers on the libgmp source I'd compiled.
Yes, that's what I did. Probably everyone has . . .
Er, isn't this the sort of thing ./configure scripts are for?
From simonmar@microsoft.com Thu Oct 19 17:58:41 2000
From: simonmar@microsoft.com (Simon Marlow)
Date: Thu, 19 Oct 2000 09:58:41 -0700
Subject: GHC RPMs for RedHat 7
Message-ID: <9584A4A864BD8548932F2F88EB30D1C610CE15@TVP-MSG-01.europe.corp.microsoft.com>
> Keith Wansbrough wrote:
> >
> > > On this subject, where am I to get the libgmp2.a required
> by 4.08.1
> > > (on Linux anyway). I tried compiling the very latest
> version of GMP
> > > but it only produced a libgmp.a file. Is that the same?
> >
> > Same happened to me. ln -s libgmp.a libgmp2.a worked for
> me. I satisfied myself I was doing the right thing by
> noticing all the 2.x.x version numbers on the libgmp source
> I'd compiled.
> Yes, that's what I did. Probably everyone has . . .
Sorry about that, my fault. I built the binary distribution from a build
linked against libgmp2.a on our box here, and it isn't reasonable to expect
everyone to have that library with the same name.
In the future the binary distributions will come with a static libgmp, but
the RPMs will still have a dependency on the right external gmp package.
Cheers,
Simon
From michael.weber@post.rwth-aachen.de Thu Oct 19 23:40:17 2000
From: michael.weber@post.rwth-aachen.de (Michael Weber)
Date: Fri, 20 Oct 2000 00:40:17 +0200
Subject: shared libgmp2 (was: Re: GHC RPMs for RedHat 7)
References: <39EF1214.A9E5F351@informatik.uni-bremen.de> <20001019173954.A8516@jennifer.informatik.rwth-aachen.de>
Message-ID: <20001020004017.B2288@webnet.de>
On Thu, Oct 19, 2000 at 17:39:54 +0200, Michael Weber wrote:
> On Thu, Oct 19, 2000 at 17:24:04 +0200, George Russell wrote:
>> On this subject, where am I to get the libgmp2.a required by 4.08.1
>> (on Linux anyway). I tried compiling the very latest version of GMP
>> but it only produced a libgmp.a file. Is that the same?
[snipped my right solution to the wrong problem]
I can't read, shoot me 8-}
My internal pre-parser recognized the words "GHC", "libgmp.a"
and "RedHat" in a single email, therefore bypassed the rest of the
mail, and immediately sent the wrong answer... Sorry!
The patch is obviously for getting a .so library...
Cheers,
Michael
--
() ASCII ribbon campaign | Chair for Computer Science II | GPG: F65C68CD
/\ against HTML mail | RWTH Aachen, Germany | PGP: 1D0DD0B9
The reason computer chips are so small is computers don't eat much.
From christian.lescher@icn.siemens.de Fri Oct 20 12:04:03 2000
From: christian.lescher@icn.siemens.de (Lescher Christian)
Date: Fri, 20 Oct 2000 13:04:03 +0200
Subject: AW: Using Haskell code in VBA (MS Access)?
Message-ID: <353063C297A9D3118F760008C791E269011D0600@MCHH263E>
I tried to compile this small example with ghc-4.08.1, but it didn't =
work (compiling ok., but DLL does not run), while with ghc-4.05 =
everything is okay. What can be wrong with this?
Christian Lescher
> -----Urspr> =FCngliche Nachricht-----
> Von: Sigbjorn Finne [SMTP:sof@microsoft.com]
> Gesendet am: Donnerstag, 17. August 2000 20:18
> An: 'Christian Lescher'
> Cc: glasgow-haskell-users@haskell.org
> Betreff: RE: Using Haskell code in VBA (MS Access)?
>=20
>=20
> The support libraries for HaskellDirect provide
> functions for converting between BSTRs and Haskell'
> String (Com.marshallBSTR, Com.unmarshallBSTR) --
> http://www.dcs.gla.ac.uk/fp/software/hdirect/user-32.html
>=20
> has the overview. However, the binaries available for
> that library is for ghc-4.045, so you'd have to compile
> them up yourself for ghc-4.08.
>=20
> To build a 'static' DLL, here's what you need to do:
>=20
> - compile up all your Haskell code using -static.
> - write a .def file containing the entry points you
> want to expose. In my example, the .def file would
> just contain:
>=20
> EXPORTS
> adder@8
>=20
> - link the static DLL:
>=20
> ghc-4.05 -static --mk-dll -optdll--def=3Dadder.def \
> -o adder.dll adder.o dllMain.o -lHSrts
>=20
> I heard some rumours that -static might disappear. If that's
> the case, I think that would be unfortunate.
>=20
> --sigbjorn
>=20
> Christian Lescher writes:
> >=20
> > Thank you for your detailed answer - it's really great, it works! =
:-)
> >=20
> > However, I have got one more problem: the function I want to=20
> > call from VBA is of
> > type String -> String -> String
> > Is there a (simple) method to convert VBA strings (BSTR) to=20
> > Haskell's [Char] and
> > vice versa?
> >=20
> > By the way: Is it possible to build DLLs that do not depend=20
> > on GHC's runtime DLLs?
> > I tried out the "-static" option like for compiling EXEs, but=20
> > it didn't work.
> >=20
> > CL
> >=20
> >=20
>=20
From ingo@ele.kth.se Fri Oct 20 17:09:04 2000
From: ingo@ele.kth.se (Ingo Sander)
Date: Fri, 20 Oct 2000 18:09:04 +0200 (MET DST)
Subject: Interface Files _ HOWTO?
Message-ID:
After working a lot with Hugs I tried to compile my Haskell code with GHC.
But it does not work, I am not able to figure out how to work with the
interface files (.hi). My program is build out of several modules, like
this (much simpler, but facing the same problem...)
File MyList.hs
==============
module MyList(MkList(Empty, (:-))) where
infixr 5 :-
data MkList a = Empty
| a :- (MkList a) deriving (Eq, Show)
File ListFun.hs
===============
module ListFun(mapL) where
import MyList
mapL f Empty = Empty
mapL f (x:-xs) = f x :- mapL f xs
File ListLib
============
module ListLib(module MyList, module ListFun) where
import MyList
import ListFun
File Main.hs
============
module Main(main) where
import ListLib
main = putStr (show (mapL (+1) (1:-2:-Empty)))
As I said the code works with hugs, and I want to have the hierarchy in
the library structure.
So, how do I compile this in GHC? I hoped, that it would be enough to
compile all files with the -c option (generating .hi and .o files) and
then compiling Main.hs to get an executable program. Howeve, I get the
following:
> ghc Main.hs
ghc: module version unchanged at 7
Undefined first referenced
symbol in file
MyList_ZCzm_con_info Main.o
MyList_zdfShowMkList_closure Main.o
ListFun_mapL_closure Main.o
MyList_Empty_static_closure Main.o
ld: fatal: Symbol referencing errors. No output written to a.out
So, what's wrong, and am I totally on the wrong track... (I studied the
GHC User Guide, but could not find the answer to my problem).
Thanks in advance!
Ingo Sander
From michael.weber@post.rwth-aachen.de Fri Oct 20 17:45:27 2000
From: michael.weber@post.rwth-aachen.de (Michael Weber)
Date: Fri, 20 Oct 2000 18:45:27 +0200
Subject: Interface Files _ HOWTO?
In-Reply-To: ; from Ingo Sander on Fri, Oct 20, 2000 at 06:09:04PM +0200
References:
Message-ID: <20001020184527.B21937@jennifer.informatik.rwth-aachen.de>
On Fri, Oct 20, 2000 at 18:09:04 +0200, Ingo Sander wrote:
> So, how do I compile this in GHC? I hoped, that it would be enough to
> compile all files with the -c option (generating .hi and .o files) and
> then compiling Main.hs to get an executable program. Howeve, I get the
> following:
>
>> ghc Main.hs
[...]
> ld: fatal: Symbol referencing errors. No output written to a.out
try
$ ghc -c Main.hs
$ ghc -o ThisIsMyExecutable *.o
That is, compile Main.hs also into an .o file, /then/ link the whole
thing into an executable...
> So, what's wrong, and am I totally on the wrong track... (I studied the
> GHC User Guide, but could not find the answer to my problem).
normally, one employs `make' for building programs with more than one
module, because it keeps track of dependencies (ghc -M *hs) etc. There
is a users-guide section on Makefiles for GHC, IIRC.
HTH
Cheers,
Michael
--
/~\ ASCII ribbon | "Never buy anything that mentions Windows on the package.
\ / campaign | Except sheets of glass. Or plastic. And that smelly
X against | blue stuff that removes dirt without leaving a residue."
/ \ HTML mail | -- jhicklepgh.nauticom.net in c.o.l.d.s.
From simonpj@microsoft.com Mon Oct 23 09:26:15 2000
From: simonpj@microsoft.com (Simon Peyton-Jones)
Date: Mon, 23 Oct 2000 01:26:15 -0700
Subject: Interface Files _ HOWTO?
Message-ID: <74096918BE6FD94B9068105F877C002D0110D387@red-pt-02.redmond.corp.microsoft.com>
Compile the module from bottom to top, with -c. Then link. THus
ghc -c MyList.hs
ghc -c ListFun.hs
...etc...
ghc -c Main.hs
ghc -o MyApp MyList.o ListFun.o ... Main.o
Simon
| -----Original Message-----
| From: Ingo Sander [mailto:ingo@ele.kth.se]
| Sent: 20 October 2000 17:09
| To: glasgow-haskell-users@haskell.org
| Subject: Interface Files _ HOWTO?
|
|
| After working a lot with Hugs I tried to compile my Haskell
| code with GHC.
| But it does not work, I am not able to figure out how to work with the
| interface files (.hi). My program is build out of several
| modules, like
| this (much simpler, but facing the same problem...)
|
| File MyList.hs
| ==============
|
| module MyList(MkList(Empty, (:-))) where
|
| infixr 5 :-
|
| data MkList a = Empty
| | a :- (MkList a) deriving (Eq, Show)
|
|
| File ListFun.hs
| ===============
|
| module ListFun(mapL) where
|
| import MyList
|
| mapL f Empty = Empty
| mapL f (x:-xs) = f x :- mapL f xs
|
|
|
| File ListLib
| ============
|
| module ListLib(module MyList, module ListFun) where
|
| import MyList
| import ListFun
|
|
| File Main.hs
| ============
|
| module Main(main) where
|
| import ListLib
|
| main = putStr (show (mapL (+1) (1:-2:-Empty)))
|
|
|
| As I said the code works with hugs, and I want to have the
| hierarchy in
| the library structure.
|
| So, how do I compile this in GHC? I hoped, that it would be enough to
| compile all files with the -c option (generating .hi and .o files) and
| then compiling Main.hs to get an executable program. Howeve, I get the
| following:
|
| > ghc Main.hs
| ghc: module version unchanged at 7
| Undefined first referenced
| symbol in file
| MyList_ZCzm_con_info Main.o
| MyList_zdfShowMkList_closure Main.o
| ListFun_mapL_closure Main.o
| MyList_Empty_static_closure Main.o
| ld: fatal: Symbol referencing errors. No output written to a.out
|
| So, what's wrong, and am I totally on the wrong track... (I
| studied the
| GHC User Guide, but could not find the answer to my problem).
|
| Thanks in advance!
|
| Ingo Sander
|
|
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
|
From romildo@urano.iceb.ufop.br Mon Oct 23 13:22:35 2000
From: romildo@urano.iceb.ufop.br (=?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?=)
Date: Mon, 23 Oct 2000 10:22:35 -0200
Subject: Overloaded function and implicit parameter passing
Message-ID: <20001023102235.A11238@urano.iceb.ufop.br>
Hi.
While experimenting with the implicit parameter
extension to Haskell 98, implemented in GHC 4.08.1
and latest Hugs, I came accross a difference among
those implementations regarding overloading functions
with implicit parameters.
As a test consider the program
------------------------- cut here
module Main where
class C a where
f :: (?env :: Integer) => a -> Integer
instance C Integer where
f x = ?env + x
main = putStrLn (show (f (45::Integer) with ?env = 100))
------------------------- cut here
Hugs accepts this program and outputs 145, as expected.
But GHC 4.08.1 refuses to compile it, emitting the
message
$ ghc -fglasgow-exts Test1.hs -o test1
Test1.hs:7:
Unbound implicit parameter `env_rJX :: Integer'
arising from use of `env_rJX' at Test1.hs:7
In the first argument of `+', namely `env_rJX'
In the right-hand side of an equation for `f': env_rJX + x
Compilation had errors
Would anybody comment on what is going on with GHC?
I am willing to use implicit parameters in the
software I am developing, but I have the need
to overload functions with implicit parameters.
While Hugs is good for development, its performance
may rule it out when the final product is ready.
So I will need a good Haskell compiler to compile
my system.
Any comments?
Romildo
--
Prof. José Romildo Malaquias
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
From fjh@cs.mu.oz.au Mon Oct 23 15:02:14 2000
From: fjh@cs.mu.oz.au (Fergus Henderson)
Date: Tue, 24 Oct 2000 01:02:14 +1100
Subject: Overloaded function and implicit parameter passing
In-Reply-To: <20001023102235.A11238@urano.iceb.ufop.br>
References: <20001023102235.A11238@urano.iceb.ufop.br>
Message-ID: <20001024010214.A11699@hg.cs.mu.oz.au>
On 23-Oct-2000, José Romildo Malaquias wrote:
> ------------------------- cut here
> module Main where
>
> class C a where
> f :: (?env :: Integer) => a -> Integer
>
> instance C Integer where
> f x = ?env + x
>
> main = putStrLn (show (f (45::Integer) with ?env = 100))
> ------------------------- cut here
...
> $ ghc -fglasgow-exts Test1.hs -o test1
>
> Test1.hs:7:
> Unbound implicit parameter `env_rJX :: Integer'
> arising from use of `env_rJX' at Test1.hs:7
...
> Would anybody comment on what is going on with GHC?
That sure looks to me like a bug in GHC's support for implicit
parameter passing.
--
Fergus Henderson | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: | -- the last words of T. S. Garp.
From romildo@urano.iceb.ufop.br Tue Oct 24 15:59:53 2000
From: romildo@urano.iceb.ufop.br (=?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?=)
Date: Tue, 24 Oct 2000 12:59:53 -0200
Subject: Compiling mutually recursive modules involving instances
Message-ID: <20001024125953.A1700@urano.iceb.ufop.br>
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hello.
I am having difficulties in compiling mutually recursive
modules involving classes and instances in GHC 4.08.1.
Basicaly I am not finding how to write a .hi-boot where
I want to put classes and instances.
Consider a program with 3 modules: M1, M2 and Main. The
sources are attached to the message. What should go
into M2.hi-boot? Would anyone write M2.hi-boot for me
so that I can learn it.
Thanks.
Romildo
--
Prof. José Romildo Malaquias
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="M1.hs"
module M1 where
import {-# SOURCE #-} M2
class C a where
f :: a -> Bool
instance C a => C [a] where
f = or . map f
test = f [ 1 .. 10::Int ]
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="M2.hs"
module M2 where
import M1 ( C )
instance C Int where
f x = mod x 3 == 0
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Main.hs"
module Main where
import M1 (test)
main = putStrLn (show test)
--tThc/1wpZn/ma/RB--
From simonpj@microsoft.com Thu Oct 26 09:50:30 2000
From: simonpj@microsoft.com (Simon Peyton-Jones)
Date: Thu, 26 Oct 2000 01:50:30 -0700
Subject: Compiling mutually recursive modules involving instances
Message-ID: <74096918BE6FD94B9068105F877C002D0110D3E5@red-pt-02.redmond.corp.microsoft.com>
The best thing to do is never to put an instance
declaration in an hi-boot file. I don't think you ever really
need to. In contrast, mutual recursion of type declarations
is often unavoidable.
The manual should really say this
Simon
| -----Original Message-----
| From: José Romildo Malaquias [mailto:romildo@urano.iceb.ufop.br]
| Sent: 24 October 2000 16:00
| To: glasgow-haskell-users@haskell.org
| Subject: Compiling mutually recursive modules involving instances
|
|
| Hello.
|
| I am having difficulties in compiling mutually recursive
| modules involving classes and instances in GHC 4.08.1.
| Basicaly I am not finding how to write a .hi-boot where
| I want to put classes and instances.
|
| Consider a program with 3 modules: M1, M2 and Main. The
| sources are attached to the message. What should go
| into M2.hi-boot? Would anyone write M2.hi-boot for me
| so that I can learn it.
|
| Thanks.
|
| Romildo
| --
| Prof. José Romildo Malaquias
| Departamento de Computação
| Universidade Federal de Ouro Preto
| Brasil
|
From ger@Informatik.Uni-Bremen.DE Thu Oct 26 11:20:52 2000
From: ger@Informatik.Uni-Bremen.DE (George Russell)
Date: Thu, 26 Oct 2000 12:20:52 +0200
Subject: getContents
Message-ID: <39F80584.88B326BA@informatik.uni-bremen.de>
I don't really understand getContents. (Does anyone?) I have some code here
(far too large to submit). If I do (on Linux, ghc4.08.1, both with and without optimisation)
------------------
contents <- hGetContents handle
seq (last contents) (hClose handle)
------------------
the code works. However I looked at the manual and it seems that hClose should
force the whole of contents to be read anyway. So I changed it to
------------------
contents <- hGetContents handle
hClose handle
------------------
and then the code doesn't work. If these are meant to be the same, then we have a GHC
bug. If not, could someone explain in words of one syllable why not?
PS - if you want the source code you'll have to download and compile the whole of UniForM!!
From romildo@urano.iceb.ufop.br Thu Oct 26 11:24:45 2000
From: romildo@urano.iceb.ufop.br (=?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?=)
Date: Thu, 26 Oct 2000 08:24:45 -0200
Subject: Compiling mutually recursive modules involving instances
In-Reply-To: <74096918BE6FD94B9068105F877C002D0110D3E5@red-pt-02.redmond.corp.microsoft.com>; from simonpj@microsoft.com on Thu, Oct 26, 2000 at 01:50:30AM -0700
References: <74096918BE6FD94B9068105F877C002D0110D3E5@red-pt-02.redmond.corp.microsoft.com>
Message-ID: <20001026082445.A18916@urano.iceb.ufop.br>
On Thu, Oct 26, 2000 at 01:50:30AM -0700, Simon Peyton-Jones wrote:
> The best thing to do is never to put an instance
> declaration in an hi-boot file. I don't think you ever really
> need to. In contrast, mutual recursion of type declarations
> is often unavoidable.
I believe I can redesign the module structures in my project
so that the instances will not need to be put in a hi-boot
file. The body of some methods in these instances uses some
names (type names and function names, possibly with infix
status) defined in a module where the corresponding class
__and__ a relevant set of its instances should be visible.
Logicaly the instances do not belong to the same module as
their class and the user of my library should be able to
add new modules (with new instances of the class) to the
system without the need to modify the source of the module
containing the class definition.
Particularly I am having a great difficult in find a good
module design for my library, which is should be able to be
extended by its user. I am missing some important features
for that, like extensible data types and functions support
in the language. By now I am basing it on the extensible
union types shown in "Monad Transformers and Modular
Interpreters", by Mark Jones and others. When I progress
in that I would make some comments.
> The manual should really say this
The manual also says a new, better, higher level way for
dealing with mutually recursive modules is in the works.
Is there any chance it will be ready for the next release?
> | From: José Romildo Malaquias [mailto:romildo@urano.iceb.ufop.br]
> |
> | I am having difficulties in compiling mutually recursive
> | modules involving classes and instances in GHC 4.08.1.
> | Basicaly I am not finding how to write a .hi-boot where
> | I want to put classes and instances.
> |
> | Consider a program with 3 modules: M1, M2 and Main. The
> | sources are attached to the message. What should go
> | into M2.hi-boot? Would anyone write M2.hi-boot for me
> | so that I can learn it.
Regards,
Romildo
--
Prof. José Romildo Malaquias
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
From simonmar@microsoft.com Thu Oct 26 12:13:58 2000
From: simonmar@microsoft.com (Simon Marlow)
Date: Thu, 26 Oct 2000 04:13:58 -0700
Subject: getContents
Message-ID: <9584A4A864BD8548932F2F88EB30D1C611574C@TVP-MSG-01.europe.corp.microsoft.com>
> I don't really understand getContents. (Does anyone?) I
> have some code here
> (far too large to submit). If I do (on Linux, ghc4.08.1,
> both with and without optimisation)
> ------------------
> contents <- hGetContents handle
> seq (last contents) (hClose handle)
> ------------------
> the code works. However I looked at the manual and it seems
> that hClose should
> force the whole of contents to be read anyway. So I changed it to
> ------------------
> contents <- hGetContents handle
> hClose handle
> ------------------
> and then the code doesn't work. If these are meant to be the
> same, then we have a GHC
> bug. If not, could someone explain in words of one syllable why not?
>
> PS - if you want the source code you'll have to download and
> compile the whole of UniForM!!
Using hClose on a semi-closed handle is a Bad Thing. The Haskell Report
says:
"Once a semi-closed handle becomes closed, the contents of
the associated stream becomes fixed, and is the list of those
items which were succesfully read from that handle".
So I take this to mean that when you hClose a semi-closed handle, you get a
random amount of data in the handle which depends on how good your
compiler's strictness analyser is. yesno?
Cheers,
Simon
From Malcolm.Wallace@cs.york.ac.uk Thu Oct 26 12:37:58 2000
From: Malcolm.Wallace@cs.york.ac.uk (Malcolm Wallace)
Date: Thu, 26 Oct 2000 12:37:58 +0100
Subject: getContents
In-Reply-To: <39F80584.88B326BA@informatik.uni-bremen.de>
Message-ID:
> contents <- hGetContents handle
> seq (last contents) (hClose handle)
vs.
> contents <- hGetContents handle
> hClose handle
> However I looked at the manual and it seems that hClose should
> force the whole of contents to be read anyway.
If some manual says this, it is wrong.
The Haskell Report says that 'hGetContents' gives the handle a
special status, called "semi-closed". A semi-closed handle becomes
fully closed when 'hClose' is applied to it. When this occurs, the
contents of the associated stream of characters (i.e. those returned
by 'hGetContents') is truncated, and is the list of characters that
have already been read from that handle.
Regards,
Malcolm
From ger@Informatik.Uni-Bremen.DE Thu Oct 26 13:14:51 2000
From: ger@Informatik.Uni-Bremen.DE (George Russell)
Date: Thu, 26 Oct 2000 14:14:51 +0200
Subject: getContents
References: <9584A4A864BD8548932F2F88EB30D1C611574C@TVP-MSG-01.europe.corp.microsoft.com>
Message-ID: <39F8203B.3EBCF190@informatik.uni-bremen.de>
Simon Marlow wrote:
[snip]
> "Once a semi-closed handle becomes closed, the contents of
> the associated stream becomes fixed, and is the list of those
> items which were succesfully read from that handle".
[snip]
Ah, now I see. I had assumed that hClose'ing a semi-closed handle would result in the
entire file being read till EOF, after which the file would be closed.
Thanks.
From simonpj@microsoft.com Thu Oct 26 14:56:17 2000
From: simonpj@microsoft.com (Simon Peyton-Jones)
Date: Thu, 26 Oct 2000 06:56:17 -0700
Subject: Compiling mutually recursive modules involving instances
Message-ID: <74096918BE6FD94B9068105F877C002D0110D3EE@red-pt-02.redmond.corp.microsoft.com>
| The manual also says a new, better, higher level way for
| dealing with mutually recursive modules is in the works.
| Is there any chance it will be ready for the next release?
I don't think so. The upcoming GHCi will be the next release
and it indeed gives a much better chance of doing this stuff
properly. Making recursive modules possible is a high priority.
But making them easy isn't as high priority as lots of other things,
I'm afraid.
Simon
From christian@lescher.de Thu Oct 26 20:21:59 2000
From: christian@lescher.de (Christian Lescher)
Date: Thu, 26 Oct 2000 20:21:59 +0100
Subject: Using Haskell code in VBA (MS Access)? - Garbage Collecting doesn't
work in Haskell DLL?!
References: <353063C297A9D3118F760008C791E269011D0600@MCHH263E>
Message-ID: <39F88457.4AFACEB0@lescher.de>
After adjusting the call of startupHaskell() in dllMain.c to "startupHaskell(1,args,NULL);" (new 3rd argument), the adder example works fine also with GHC 4.08.1.
But I recognized another problem: The Garbage Colletion seems not to work at all when calling functions in a DLL build with GHC:
When calling some more complex Haskell functions, the execution crashes after calling it the 2nd or 3rd time. Another even "bigger" function, that works fine in an EXEcutable, crashes
even while its first execution in the DLL. (In the first case, calling shutdownHaskell() at the end of the function execution helped, but this can't be the right solution, I think. -
What about memory sizes of a DLL? May it help to increase e.g. the heap size, and how to do this?)
What can I do about this?
Regards, Christian
> I tried to compile this small example with ghc-4.08.1, but it didn't work (compiling ok., but DLL does not run), while with ghc-4.05 everything is okay. What can be wrong with this?
>
> Christian Lescher
>
> > -----Urspr> üngliche Nachricht-----
> > Von: Sigbjorn Finne [SMTP:sof@microsoft.com]
> > Gesendet am: Donnerstag, 17. August 2000 20:18
> > An: 'Christian Lescher'
> > Cc: glasgow-haskell-users@haskell.org
> > Betreff: RE: Using Haskell code in VBA (MS Access)?
> >
> >
> > The support libraries for HaskellDirect provide
> > functions for converting between BSTRs and Haskell'
> > String (Com.marshallBSTR, Com.unmarshallBSTR) --
> > http://www.dcs.gla.ac.uk/fp/software/hdirect/user-32.html
> >
> > has the overview. However, the binaries available for
> > that library is for ghc-4.045, so you'd have to compile
> > them up yourself for ghc-4.08.
> >
> > To build a 'static' DLL, here's what you need to do:
> >
> > - compile up all your Haskell code using -static.
> > - write a .def file containing the entry points you
> > want to expose. In my example, the .def file would
> > just contain:
> >
> > EXPORTS
> > adder@8
> >
> > - link the static DLL:
> >
> > ghc-4.05 -static --mk-dll -optdll--def=adder.def \
> > -o adder.dll adder.o dllMain.o -lHSrts
> >
> > I heard some rumours that -static might disappear. If that's
> > the case, I think that would be unfortunate.
> >
> > --sigbjorn
> >
> > Christian Lescher writes:
> > >
> > > Thank you for your detailed answer - it's really great, it works! :-)
> > >
> > > However, I have got one more problem: the function I want to
> > > call from VBA is of
> > > type String -> String -> String
> > > Is there a (simple) method to convert VBA strings (BSTR) to
> > > Haskell's [Char] and
> > > vice versa?
> > >
> > > By the way: Is it possible to build DLLs that do not depend
> > > on GHC's runtime DLLs?
> > > I tried out the "-static" option like for compiling EXEs, but
> > > it didn't work.
> > >
> > > CL
From kgolder@wellesley.edu Tue Oct 31 21:07:08 2000
From: kgolder@wellesley.edu (Kate S. Golder)
Date: Tue, 31 Oct 2000 16:07:08 -0500
Subject: ppr for Haskell Abstract Syntax
Message-ID:
Hi -
I was wondering if anyone knows if there is a pretty printer for Haskell
Abstract Syntax anywhere? I've been asking around, but haven't located
one yet. If you know of one that I could use, it would be really helpful!
Thanks in advance,
*Kate
**********************
Kate S. Golder
Wellesley College
Class of 2002
Freeman Hall
Wellesley College
Wellesley, Ma 02481