I/O multiplexing

2003-10-28 Thread Peter Simons
Hi,

I have a question concerning "manual" I/O multiplexing in Haskell, or
specifically with GHC. I have written an interface to the C library
ADNS, which performs asynchronous DNS queries. Everything is fine and
dandy, but now comes the hard part:

The function

foreign import ccall adns_beforepoll
:: State-- ADNS context
-> Ptr Pollfd   -- space for 'n' Pollfd
-> Ptr CInt -- n
-> Ptr CInt -- max timeout
-> Ptr (Timeval)-- current time
-> IO CInt

generates an array of file descriptors, suitable for calling poll(2).
The function

foreign import ccall adns_afterpoll
:: State
-> Ptr Pollfd
-> CInt
-> Ptr (Timeval)
-> IO CInt

scans this array (after poll has been called), performs I/O on all
readable/writable sockets, and processes any packets that have been
received.

Obviously, the library wants me to call poll myself, though. But since
poll is not supported by Haskell's run-time system, the call would
block _all_ running threads in my process, not just the thread doing
the DNS resolving.

I have considered the following options to solve this:

 1. Run the DNS resolver in a forkOS thread.

 2. Declare all imported functions to be thread-safe (what they are)
and use forkIO.

 3. Call poll(2) without blocking, then conjure some magic to decide
when to call it again without busy polling.

 4. Register the file descriptors with GHC's internal poll event loop.

Option (1) seems to be straight-forward, but I don't want to rely on
the non-standard forkOS function unless I really have to. The same
goes for (4): This is probably a good solution, but it's not portable
among compilers. (3) works fine, but is unsatisfactory because the
resolver will have comparably large latency times. (I have been
processing DNS queries every, say, second.)

So option (2) seems quite attractive compared to the others ... But
the question is: Would that even work?

Any ideas, thoughts, recommendations?

Peter

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Call for papers: Fourth International Workshop on Reduction Strategies in Rewriting and Programming (WRS'04)

2003-10-28 Thread Sergio Antoy
===
We apologize for multiple copies of this call for participation
===


*  *
*  WRS'04 CALL FOR PAPERS  *
*  *


http://www-i2.informatik.rwth-aachen.de/WRS04/

The Fourth International Workshop on Reduction Strategies in
Rewriting and Programming (WRS'04) will be held on June, 2, 2003,
in Aachen, Germany, as a part of the Federated Conference on
Rewriting, Deduction, and Programming (RDP'04).

IMPORTANT DATES:

March 17, 2004  Deadline for electronic submission of papers
April 14, 2004  Notification of acceptance of papers
May2, 2004  Deadline for final versions of accepted papers
June   2, 2004  Workshop

TOPICS include, but are not restricted to:

* theoretical foundations for the definition 
  and semantic description of reduction strategies
* strategies in different frameworks (term rewriting, graph
  rewriting, infinitary rewriting, lambda calculi, higher
  order rewriting, conditional rewriting, rewriting with
  built-ins, narrowing, constraint solving, etc.)  and their
  application in (equational, functional, functional-logic)
  programming (languages)
* properties of reduction strategies / computations under
  strategies (e.g., completeness, computability, decidability,
  complexity, optimality, (hyper-)normalization, cofinality,
  fairness, perpetuality, context-freeness, neededness,
  laziness, eagerness, strictness)
* interrelations, combinations and applications of reduction
  under different strategies (e.g., evaluation mechanisms in
  programming languages, equivalence conditions for
  fundamental properties like termination and confluence,
  applications in modularity analysis, connections between
  strategies of different frameworks, etc.)
* program analysis and other semantics-based optimization
  techniques dealing with reduction strategies
* rewrite systems / tools / implementations with flexible /
  programmable strategies as essential concept / ingredient
* specification of reduction strategies in (real) languages
* tutorials and systems related to evaluation strategies

INVITED TALKS will be given by:

*  Olivier Danvy (University of Aarhus, Denmark),
   Normalization by Evaluation
*  Jan Willem Klop (Vrije Universiteit Amsterdam, The Netherlands),
   Reduction Cycles

PROGRAM COMMITTEE:

Sergio Antoy  Portland (USA) (co-chair)
Roberto Di Cosmo  Paris VII (France)
Juergen Giesl Aachen (Germany)
Bernhard Gramlich Wien (Austria)
Salvador LucasValencia (Spain)
Aart Middeldorp   Innsbruck (Austria)
Jaco van de Pol   Amsterdam (The Netherlands)
Pierre Rety   Orleans (France)
Amr Sabry Bloomington (USA)
Yoshihito Toyama  Sendai (Japan) (co-chair)

SUBMISSIONS:

We solicit papers on all aspects of reduction strategies in
rewriting and programming. Submissions should describe unpublished
work, except for survey papers which are explicitly welcome,
too. Submissions should not exceed 10 pages (however, survey
papers may be longer) and be sent in PostScript or PDF format to
the PC co-chairs at [EMAIL PROTECTED] by March 17,
2004. The use of the style file available from the RDP workshop
style page is encouraged. The call-for papers is also available in
PDF format.

Submissions should include the title, authors' names,
affiliations, addresses, and e-mail. Selection of papers by
the PC will be based on originality, significance, and
correctness. Final versions will be due by May 2, 2004.

PUBLICATION:

Accepted papers will be included in the preliminary workshop
proceedings that will be available at the workshop. The final
workshop proceedings will be published in Elsevier's
Electronic Notes in Theoretical Computer Science (ENTCS)
series.

For further questions please contact the program co-chairs:
Sergio Antoy and Yoshihito Toyama at [EMAIL PROTECTED]
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: literate comments

2003-10-28 Thread Sean L. Palmer
You could make a utility that just strips code out of XML, using the XML
nesting as indentation for the Haskell code.  Run it as a preprocessor.

It's hard to get stuff like that standardized though.  I imagine any kind of
development environment is free to pretty up or package the source however
it wants, so long as the compiler gets what it needs.  The easiest way to
make a standard is to make a tool that uses it.  Personally I would prefer
the kind of all-in-one package of code editor and XML packager/unpackager.
That way it all gets done transparently, behind the scenes, and I never have
to look at the mess.

Personally, not a big fan of LaTeX.  I don't understand the bias towards it.

Sean

- Original Message - 
From: "Steffen Mazanek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 27, 2003 1:08 PM
Subject: Re: literate comments


> Hello,
>
> I have thought again about the relationship of Haskell
> and XML. Finally I come up with the following idea. Why
> not introduce a Haskell DTD? Not to gain better literate
> programming facilities, but to represent _real_ Haskell
> code in XML. Of course, no person would like to "program"
> Haskell in XML, but a uniform representation has its
> advantages nevertheless (cf. openmath [1]):
>
> * approved tools for further processing
> * separation of the presentation layer, pretty printing
> * interoperability
> * cross-linking (e.g., generating library summaries or
>   in the manner of funnelweb [2], but xml-style)
> * objects are often serializable as xml, too
>
> The following questions are still open for me:
>
> * would the literate programming facilities really be
>   improved? for now, Haskell plays nice with LaTeX, but
>   not at all with XML
> * possible advantages of xml schema?
>
> What do you think about this? Do you see even more
> advantages of this approach or would it be senseless
> work?
>
> Regards,
> Steffen Mazanek

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell