Re: [Haskell-cafe] CGI module almost useless

2005-06-11 Thread Sven Panne

[ Moving this thread slowly to the libraries list... ]

Bjorn Bringert wrote:

John Goerzen wrote:


My apologies if this sounds like a bit of a rant; I know people put good
effort into this, but

The Network.CGI module in fptools (and GHC) is not very useful.  I think
that it should be removed or re-tooled.  Here are the main problems with
it:

1. It does not permit custom generation of output headers.  Thus the CGI
script cannot do things like set cookies, manage HTTP auth, etc.

2. It does not permit generation of anything other than text/html
documents.  Many CGI scripts are used to manage other types of
documents.  Notably this makes it incompatible with serving up even
basic things like stylesheets and JPEGs.

3. It does not permit the use of any custom design to serve up HTML,
forcing *everything* to go through Text.Html.  This makes it impossible
to do things like serving up HTML files from disk.

4. There is documentation in the code, but it is as comments only, and
doesn't show up in the Haddock-generated GHC library reference.  (Should
be an easy fix)

5. It does not appear to support file uploads in any sane fashion

Is there a better CGI module out there somewhere that I'm missing, or
should I just set about writing my own?



I wrote this module (based on the Network.CGI code) a while ago:

http://www.dtek.chalmers.se/~d00bring/darcs/blob/lib/Network/SimpleCGI.hs

I don't remember what it does really, but I think it solves issues 1,2,3 
and some of 4.


Although (among other people) I did some hacking in this module in the remote
past, I don't have the time and energy to maintain and/or extend this module
anymore. It would be really great if somebody more actively working in this
area could take the spec lead here and push the development via discussions
here on this library list. John? Björn? A few general design thoughts:

 * To keep people's mind sane, backwards compatibility with the existing
   Network.CGI would be a very worthy goal.

 * Don't use any Haskell language extension available. :-) Currently the
   module can be used e.g. by Hugs in H98 mode, and keeping it that way
   would again be something very desirable.

Cheers,
   S.

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


[Haskell-cafe] Combining Haskell and Software Verification

2005-06-11 Thread Gerd M

Hello,
I have to do a larger project about Software Verification for university.
The methods and systems I've seen so far only concern imperative/OOP 
languages while there seems to be little concerning functional languages.


Since the exact topic can be choosen freely and I've already spent too many 
years messing around with OOP languages, I would like to do a project 
related to (or using a) functional language, especially Haskell. The problem 
is, up to now I wasn't successful in finding it.


Suggestions are _very_ welcome!

regards,
Gerd

_
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/


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


[Haskell-cafe] Using type classes for polymorphism of data constructors

2005-06-11 Thread Thomas Sutton

Hi all,

I've just started working on a theorem prover (labelled tableaux in  
case anyone cares) in Haskell. In preparation, I've been attempting  
to define some data types to represent logical formulae. As one of  
the requirements of my project is generality (i.e. it must be easily  
extendible to support additional logics), I've been attempting to  
build these data types modularly.


The end goal in all of this is that the user (perhaps a logician  
rather than a computer scientist) will describe the calculus they  
wish to use in a simple DSL. This DSL will then be translated into  
Haskell and linked against some infrastructure implementing general  
tableaux bits and pieces. These logic implementations ought to be  
composable such that we can define modal logic to be propositional  
calculus with the addition of [] and .


In Java (C#, Python, etc) I'd do this by writing an interface Formula  
and have a bunch of abstract classes (PropositionalFormula,  
ModalFormula, PredicateFormula, etc) implement this interface, then  
extend them into the connective classes Conjunction, Disjunction,  
etc. The constructors for these connective classes would take a  
number of Formula values (as appropriate for their arity).


I've tried to implement this sort of polymorphism in Haskell using a  
type class, but I have not been able to get it to work and have begun  
to work on implementing this composition of logics in the DSL  
compiler, rather than the generated Haskell code. As solutions go,  
this is far from optimal.


Can anyone set me on the right path to getting this type of  
polymorphism working in Haskell? Ought I be looking at dependant types?


Thanks in advance,
Thomas Sutton
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] [Newbie] Quest for inheritance

2005-06-11 Thread Ralf Lammel
 On 6/6/05, Gracjan Polak [EMAIL PROTECTED] wrote:
  If you stick to single inheritance there is other way to simulate OO in
  Haskell. Look for phantom types. Whole wxHaskell (for example) is
  based on this concept.
 
 I heard about them indeed but barely found clear explanations of it.
 Any useful pointer you're aware of maybe ?
 
 Cédric

Hi Cedric,

See Section 7.3 of the latest revision of Haskell's overlooked object system. 
There are pointers and explanations. This discussion also
clarifies that the phantom approach is tailored for foreign library
and component import (but it can be generalized and has been indeed,
by Burton in a paper from 1990). 

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


[Haskell-cafe] Generalized version of `words'?

2005-06-11 Thread Dimitry Golubovsky

Does there exist a generalized version of the `words' function i. e.
one that breaks an arbitrary list into parts by an arbitrary predicate?

splitAt is not what I need.

I had to write my own:

-- A version of words, but works with any lists on any predicate.

parts pred s = case dropWhile pred s of
 [] - []
 s' - w : parts pred s''
 where (w, s'') = break pred s'

(just by parameterizing `words' found in Data.List with a predicate 
passed as a parameter).


In case such a function already exists, what is its name?

In the opposite case, can such a function be added to the standard 
library? (or why didn't it exist?)


Dimitry Golubovsky
Middletown, CT

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