RE: fast IO in ghc

2002-04-03 Thread Koen Claessen

"Simon Peyton-Jones" <[EMAIL PROTECTED]> writes:

 | And, with a lot of help from Koen, I'm about to fold
 | in a much more efficient implementation of Read, which
 | may help.

On Thu, 4 Apr 2002, Jan-Willem Maessen wrote:

 | Any of the guilty parties want to give a quick
 | overview of how it's going to work?

The basic idea is as follows. We have an efficient
(abstract) parser type 'ReadP', which supports the following
operations:

  readP_to_S :: ReadP a -> ReadS a
  readS_to_P :: ReadS a -> ReadP a  -- might be slow

(The reason for ReadP to be abstract is so that it can be
changed to a more efficient implementation if one comes
along.)

Remember that ReadS is defined as:

  type ReadS a = String -> [(a,String)]

Now, suppose the definition of the Read class were as
follows:

  class Read a where
reads :: ReadS a

What we did, we just added an extra method to the Read
class:

  class Read a where
reads :: ReadS a
readp :: ReadP a

-- default definitions
reads = readP_to_S readp
readp = readS_to_P reads

Whenever GHC does a "deriving Read", it will define the
readp parser (which is efficient) rather than the reads
parser. The reads parser will just be defined in terms of
the readp parser.

Whenever an ignorant user comes along and makes an old-style
instance of the Read class:

  instance Read MyType where
reads s = ...

The readp parser will still be there, but it might possibly
be slow.

Of course up-to-date users can make efficient instances by
actually defining readp rather than reads.

This is the basic idea. Unfortunately, the Read class does
not look like this, and we have to take care of precedences
(rather easy) and the readList method (tricky).

We will probably submit a paper to the Haskell workshop
about this.

/Koen.

--
Koen Claessen
http://www.cs.chalmers.se/~koen
Chalmers University, Gothenburg, Sweden.

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: fast IO in ghc

2002-04-03 Thread Jan-Willem Maessen

"Simon Peyton-Jones" <[EMAIL PROTECTED]> writes:
> And, with a lot of help from Koen, I'm about to fold in a
> much more efficient implementation of Read, which may help.

Any of the guilty parties want to give a quick overview of how it's
going to work?

-Jan-Willem Maessen
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: installing ghc on Solaris without gcc

2002-04-03 Thread Simon Marlow


> after having used ghc on linux and win32 for quite a while now
> I am stuck with installing the binary distribution on Solaris.
> 
> The Solaris machine does not have a gcc installed. This is correctly
> detected by ./configure.

You really need gcc, sorry.

I don't know what might have caused the link errors you saw, but it may
be an artifact of doing linking through Solaris's cc rather gcc
(actually I'm surprised it got that far). 

Cheers,
Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



installing ghc on Solaris without gcc

2002-04-03 Thread Sven Eric Panitz

after having used ghc on linux and win32 for quite a while now
I am stuck with installing the binary distribution on Solaris.

The Solaris machine does not have a gcc installed. This is correctly
detected by ./configure.

However the eventually installed ghc still calls gcc instead of
just cc.

Eventually I made a symbolic link 
  ln -s cc gcc
just to see if this might work. 

Unfortunately  this gives linker errors:

bash-2.04$ ghc Main.hs
compilation IS NOT required
Undefined   first referenced
 symbol in file
PrelIOBase_heapOverflow_closure (command line)
PrelInt_I16zh_static_info   (command line)
PrelPack_unpackCString_closure  /usr/local/lib/ghc-5.02.2/libHSrts.a(RtsAPI.o)
PrelFloat_Dzh_con_info  /usr/local/lib/ghc-5.02.2/libHSrts.a(RtsAPI.o)
PrelWord_W64zh_con_info /usr/local/lib/ghc-5.02.2/libHSrts.a(RtsAPI.o)
PrelStable_StablePtr_static_info/usr/local/lib/ghc-5.02.2/libHSrts.a(RtsAPI.o)
...


Is ghc supposed to work with cc instead of gcc? If this is so,
what am I doing wrongly?

thanks

Sven Eric

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: fast IO in ghc

2002-04-03 Thread Wolfram Kahl

 > 
 > I tend to deal a lot with very very large data files in Haskell and my
 > current approach to dealing with getting data out of one program an into
 > another is writing it to a file using 'show' and then reading it in using
 > 'read'.  Unfortunately, this is very slow and produces very large files
 > which are very slow to read and write.

Be careful with your choice of Read and Show instances.

Standard reading of lists is ``strict in the closing bracket'',
so the first element is only returned after the end of the list
has been read.

I tend to define my own instances, using a fairly standard set
of parser combinators working on the ReadS type ---
this speeds up things considerably (and runs in less memory).

This can, of course, also be used to get file size down,
but in my circumstances this was not a major problem
(rarely had files of more than a few tens of megabytes),
and human-readability was useful to have.


Wolfram




___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: fast IO in ghc

2002-04-03 Thread Simon Peyton-Jones

And, with a lot of help from Koen, I'm about to fold in a
much more efficient implementation of Read, which may help.

Simon

| -Original Message-
| From: Hal Daume III [mailto:[EMAIL PROTECTED]] 
| Sent: 03 April 2002 05:36
| To: GHC Users Mailing List
| Subject: fast IO in ghc
| 
| 
| I tend to deal a lot with very very large data files in 
| Haskell and my current approach to dealing with getting data 
| out of one program an into another is writing it to a file 
| using 'show' and then reading it in using 'read'.  
| Unfortunately, this is very slow and produces very large 
| files which are very slow to read and write.  Is there 
| another option?  I don't care about H98 compatibility, so if 
| there's a way to somehow just dump ghc's internal 
| representation (I also don't care about x-platformness) to a 
| file and read it back, that would be excellent.  Other 
| suggestions are welcome too :).
| 
| --
| Hal Daume III
| 
|  "Computer science is no more about computers| [EMAIL PROTECTED]
|   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
| 
| ___
| Glasgow-haskell-users mailing list 
| [EMAIL PROTECTED] 
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-users
| 
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: fast IO in ghc

2002-04-03 Thread Simon Marlow

> I tend to deal a lot with very very large data files in Haskell and my
> current approach to dealing with getting data out of one 
> program an into
> another is writing it to a file using 'show' and then reading 
> it in using
> 'read'.  Unfortunately, this is very slow and produces very 
> large files
> which are very slow to read and write.  Is there another 
> option?  I don't
> care about H98 compatibility, so if there's a way to somehow just dump
> ghc's internal representation (I also don't care about 
> x-platformness) to
> a file and read it back, that would be excellent.  Other 
> suggestions are
> welcome too :).

I wrote a binary I/O library recently for GHC, which we're using to
speed up interface file reading and writing.  The library is similar to
nhc98's Binary library, execept that it works in terms of bytes rather
than bits, and we don't do lazy binary I/O in the same way.

It currently has some GHC-specific stuff in it, but I plan to make a
generic version for the libraries at some point.  For the time being,
you can pull it out of CVS and take a look - it's in
ghc/utils/Binary.hs.  It should work if you remove the GHC-specific
bits.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Haskell/Erlang Research Position

2002-04-03 Thread Phil Trinder

Research Associate in Haskell/Erlang for Distributed Telecommunications 
£17,278-£26,229 p.a.

Applications are invited for a three year Research Associate position at 
Heriot-Watt University to work with Dr Phil Trinder on an EPSRC 
funded project entitled "High-Level Techniques for Distributed 
Telecommunications Software". The project is a collaboration with Motorola UK 
Research Labs and aims to evaluate high-level distributed programming 
techniques for constructing realistic telecommunications software. 

Applications are welcomed from candidates with a doctorate or a very good first 
degree in Computing or cognate discipline; a successful candidate without a PhD 
will have the opportunity of registering for one. Applicants should have good 
written and verbal communication skills and be able to demonstrate a strong 
programming ability: experience with distribution and the Haskell or Erlang 
programming languages is desirable. Likewise a research background, and 
familiarity with the telecommunications sector are desirable.

For application details please contact the Personnel Office, Heriot-Watt University, 
Edinburgh, EH14 4AS, tel/fax: 0131 451 3475 (24 hours) quoting Ref 66/02/J. The 
closing date is Friday 19th April 2002. Informal enquires can be directed to Phil 
Trinder tel:  +44 131 451 3435, or e-mail: [EMAIL PROTECTED] More details of 
the project and further particulars for the position can be found at: 
http://www.cee.hw.ac.uk/~dsg/telecoms/


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users