Posix.getFileStatus

2003-02-28 Thread George Russell
(1) I think Posix.getFileStatus should respond to a file which isn't there with 
something rather more helpful than
system error.   For example, a No such file or directory message.
(2) The logical way of spotting whether a file is actually there is the
queryFile function, documented for example here:
   http://haskell.cs.yale.edu/ghc/docs/latest/html/hslibs/files-and-directories.html
But sadly the queryFile function does not appear to be in the Posix module!  At least 
not for
ghc5.04.2.
Good thing there's a Directory.doesFileExist function!  Of course that's not quite the 
same, since it
only checks if there is a normal file of that name (it returns False for a directory).
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: Posix.getFileStatus

2003-02-28 Thread Simon Marlow

 (1) I think Posix.getFileStatus should respond to a file 
 which isn't there with something rather more helpful than
 system error.   For example, a No such file or directory message.

With today's CVS sources:

Prelude System.Posix.getFileStatus /tmp/foo
Loading package unix ... linking ... done.
*** Exception: does not exist
Action: getFileStatus
Reason: No such file or directory

The posix library is undergoing a rewrite, which is about 80-90% done so
far.  I'd appreciate any testing you can subject the new System.Posix
library to, though.

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


Re: Posix.getFileStatus

2003-02-28 Thread Dean Herington
George Russell wrote:

 (2) The logical way of spotting whether a file is actually there is the
 queryFile function, documented for example here:
 http://haskell.cs.yale.edu/ghc/docs/latest/html/hslibs/files-and-directories.html
 But sadly the queryFile function does not appear to be in the Posix module!  At 
 least not for
 ghc5.04.2.

Apparently, `queryAccess` and `queryFile` are called `fileAccess` and `fileExist`.

Dean

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


unknown architecture bug

2003-02-28 Thread Hal Daume III
Any idea what would cause this:

ch --make Train.hs -fglasgow-exts -osuf sun4.o -hisuf sun4.hi
ghc-5.04.2: chasing modules from: Train.hs
Compiling NLP.PTBDefs2 ( /nfs/isd/hdaume/projects/NLP/PTBDefs2.lhs,
/nfs/isd/hdaume/projects/NLP/PTBDefs2.sun4.o )

/nfs/isd/hdaume/projects/NLP/PTBDefs2.lhs:221: Warning: Pattern
match(es) are overlapped
In the definition of `fixLex': fixLex (TDash : (TRP : xs)) = ...
Compiling NLP.PTBParser2   ( /nfs/isd/hdaume/projects/NLP/PTBParser2.hs,
/nfs/isd/hdaume/projects/NLP/PTBParser2.sun4.o )
Compiling Train( Train.hs, ./Train.sun4.o )
8:55am moussor:Paraphrases/ touch Train.hs
DING! moussor:Paraphrases/ ghci Train.hs
   ___ ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |  GHC Interactive, version 5.04.2, for Haskell
98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package lang ... linking ... done.
Skipping  NLP.PTBDefs2 ( /nfs/isd/hdaume/projects/NLP/PTBDefs2.lhs,
/nfs/isd/hdaume/projects/NLP/PTBDefs2.sun4.o )
Skipping  NLP.PTBParser2   ( /nfs/isd/hdaume/projects/NLP/PTBParser2.hs,
/nfs/isd/hdaume/projects/NLP/PTBParser2.sun4.o )
Compiling Train( Train.hs, interpreted )
/nfs/isd/hdaume/projects/NLP/PTBDefs2.sun4.o: unknown architecture
ghc-5.04.2: panic! (the `impossible' happened, GHC version 5.04.2):
loadObj: failed

Please report it as a compiler bug to [EMAIL PROTECTED],
or http://sourceforge.net/projects/ghc/.



This has happened to me a few times and by removing the offending .o file
and rebuilding, everything works (sometimes).

--
 Hal Daume III   | [EMAIL PROTECTED]
 Arrest this man, he talks in maths.   | www.isi.edu/~hdaume

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


Re: child process statistics

2003-02-28 Thread Sigbjorn Finne
Dean Herington [EMAIL PROTECTED] writes:

 On Wed, 26 Feb 2003, Sigbjorn Finne wrote:

  wait3() or getrusage()? (Neither of which are supported
  by the posix library.)
 
  --sigbjorn

 Thanks, Sigbjorn.  I drafted a Haskell wrapping of wait4(), modeled on
 code I found in CVS.  See attached. I'd like a bit of help in two
 respects:

 1. I found it difficult to satisfy the code requirements because I'm
 building the module outside the RTS build environment.  Some issues:

  a. I don't know how to make a .hsc file, which would be the appropriate
 form for the file, I think.  This meant I couldn't use #const, and may
 also explain why I couldn't find the __hsunix_* routines.


The HsUnix.h contain these helper routines, which you'll find in the
include/ subdir of the unix package.

  c. I'm not sure how to define `struct timeval` and `struct rusage` so I
 can avoid the kludgy code in `makeProcessResourceUsage`.


hsc2hs does let you access fields of a struct without having to know
offsets nor struct sizes (cf. getProcessTimes in Process.hsc)

 It seems that maybe I should be building in the RTS environment (and
 maybe even extending the System.Posix.Process module itself) to clean
 up all of the above problems.  That seems a bit daunting to me, however.


That makes good sense. If you're over the hurdle of setting up and building
the fptools tree, there's really not much to it. Modify
libraries/unix/System/Posix/Process.hsc followed by a 'make' in
libraries/unix.
It uses the in-tree version of hsc2hs, so you don't have to worry about
setting it up.

 2. Having gotten my module to compile cleanly, it--not surprisingly--fails
 at runtime:

 invalid argument
 Action: reapChildProcess
 Reason: Invalid argument


I can't see anything obviously wrong with the parameters, I'm assuming the
pid and the options settings are correct. Tracing the system calls will
probably
give you some useful info.

--sigbjorn

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


RE: fundeps known beforehand (was RE: fundeps for extended Monad definition)

2003-02-28 Thread Simon Peyton-Jones
| since this claims that it will take a Bool and produce a value of type
b
| for all types b.  However, would it be all right to say (in
| pseudo-Haskell):
| 
|  f :: exists b . Bool - b
|  f x = x

But this is a singularly useless function, because it produces a result
of utterly unknown type, so you can't actually use it.  For example you
could not say
f x + 4

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


Happy Alex

2003-02-28 Thread Per Larsson
I have successfully used the the excellent haskell tools Happy and Alex in a 
couple of parsing projects, but I have failed when trying to  combine a 
monadic Happy grammar (using the %monad and %lexer directives) together with 
an Alex generated okenizer, nor are there any such examples in the Happy and 
Alex distributions. Have anyone tried this combination and can give me some 
advice or a simple example?

-- 
Per 


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


RE: Happy Alex

2003-02-28 Thread Simon Marlow

 I have successfully used the the excellent haskell tools 
 Happy and Alex in a 
 couple of parsing projects, but I have failed when trying to  
 combine a 
 monadic Happy grammar (using the %monad and %lexer 
 directives) together with 
 an Alex generated okenizer, nor are there any such examples 
 in the Happy and 
 Alex distributions. Have anyone tried this combination and 
 can give me some 
 advice or a simple example?

I've been doing some work on Alex recently, and getting it to work
smoothly with Happy's monadic scheme is one of the goals.  I'll post
something when it's done, but if you want to have a look at the
work-in-progress look in the CVS tree, under fptools/happy/alex on the
branch simonm-hackery-branch.

The other things I'm doing include making Alex's syntax more lex-like
and Happy-like (mostly done), making the generated code more efficient
in terms of both space and time (mostly done), and adding support for
Unicode (not done, I'm still thinking about how best to do this - I have
some ideas but suggestions are welcome).

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


Anyone calculating Nash or Wardrop equilibria in Haskell?

2003-02-28 Thread Steffen Mazanek
Hello.

Haskells declarativity is really useful to transform
mathematical models into data types and algorithms.
In the context of a seminary I have dealt with
equilibria concepts (especially Nash and Wardrop equilibrium) 
in loss networks.
(based on Non-cooperative routing in loss networks by Altman et al.)
Thereby I have noticed that some algorithms
are very easy to implement in Haskell, e.g. the state space
or the blocking probability. Surely these algorithms are not
efficient, they should just do their jobs.
On the other hand there are algorithms, too, which appear
to be really hard and long winded to implement, e.g. the
equilibria by itself. 

My question:
Is there an elegant way of programming a numerical solver of
problems like given the conditions ... find a solution which
minimizes/maximizes the following function 

Presumably there is no such way in general, but maybe 
someone can give a hint, how to tackle these kinds of problems.
Or maybe there are some libraries doing this job.

Thanks in advance and best greetings.
Steffen Mazanek
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


RE: fundeps for extended Monad definition

2003-02-28 Thread Hal Daume III
 The reason, which is thoroughly explained in Simon Peyton-Jones'
 message, is that the given type signature is wrong: it should read
   f1 :: (exists b. (C Int b) = Int - b)

Right.  Simon pointed out that this is a pretty useless function, but not
entirely so, since the result of it is not of type 'forall b. b', but
rather of 'forall b. C Int b = b'.  Thus, if the C class has a function
which takes a 'b' as an argument, then this value does have use.

 Hal Daume's original example works as well:
 
  newtype MM2 m a = MM2 (forall mb.(Monad2 m a mb) = mb)

 
  class Monad2 m a ma | m a - ma, ma - m a where
return2 :: a - ma
bind2   :: ma - (a - (MM2 m a)) - (MM2 m a)
unused :: m a - ()
unused  = \_  - ()

This wasn't quite my original example.  The type of bind2 needs to be:

   bind2   :: ma - (a - (MM2 m b)) - (MM2 m b)

Which does typecheck.  However, you cannot seem to write instances of it:

instance Monad2 [] a [a] where
  return2 x = [x]
  bind2 l f = MM2 (concatMap (unmm2 . f) l)
where unmm2 (MM2 mb) = mb

yields our friend cannot unify mb with [b], both in hugs and ghc.

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


One-month alert to ICFP submission deadline

2003-02-28 Thread Olin Shivers
The submission deadline for ICFP -- the International Conference on Functional
Programming -- is coming up soon: Saturday, March 29, which is four weeks away.

The 2003 ICFP will be in Uppsala, Sweden on August 25-29, in conjunction with
PPDP (Principles and Practice of Declarative Programming). Please take a
moment to read the call for papers I've appended below, and see if you have
a topic or result you would like to submit to the program committee.

Please forward this notice to any relevant internal mailing lists, as well.

See you in Sweden.
-Olin Shivers
 program chairman

===
Eighth Annual ACM SIGPLAN International Conference on Functional Programming
ICFP 2003
Call for Papers 
(Revised 2003/2/5)

Affiliated with PLI 2003 
August 25-29, 2003 
Uppsala, Sweden 

http://www-users.cs.york.ac.uk/~colin/icfp2003.html
http://www.cc.gatech.edu/icfp03/cfp.html

---
* Important dates
-
Submission deadline 18:00 EST 29 March, 2003 (Saturday)
Notification of acceptance  rejection   19 May, 2003
Final paper due 16 June, 2003
Conference  25-29 August, 2003


* Scope
---
ICFP 2003 seeks original papers on the full spectrum of the art, science, and
practice of functional programming. The conference invites submissions on all
topics ranging from principles to practice, from foundations to features, and
from abstraction to application. The scope covers all languages that encourage
programming with functions, including both purely applicative and imperative
languages, as well as languages that support objects and concurrency. Topics
of interest include, but are not limited to, the following:

Foundations 
  formal semantics, lambda calculus, type theory, monads, continuations,
  control, state, effects.
Design 
  Algorithms and data structures, modules and type systems, concurrency
  and distribution, components and composition, relations to
  object-oriented and logic programming, multiparadigm programming.
Implementation 
  abstract machines, compile-time and run-time optimization, just-in-time
  compilers, memory management. Interfaces to foreign functions, services,
  components and low-level machine resources.
Transformation and analysis 
  abstract interpretation, partial evaluation, program transformation,
  theorem proving, specification and verification.
Software development techniques for functional programming 
  design patterns, specification, verification and validation, debugging,
  test generation, tracing and profiling.
Applications and domain-specific languages 
  systems programming, scientific and numerical computing, symbolic
  computing and artificial intelligence, systems programming, databases,
  graphical user interfaces, multimedia programming, application
  scripting, system administration, distributed-systems construction, web
  programming.
Practice and experience 
  functional programming in education and industry, ramifications on other
  paradigms and computing disciplines.
Functional pearls 
  elegant, instructive examples of functional programming. 

Papers in the latter three categories need not necessarily report original
research results; they may instead, for example, report practical experience
that will be useful to others, re-usable programming idioms, or elegant new
ways of approaching a problem. The key criterion for such a paper is that it
makes a contribution from which other practitioners can benefit. It is not
enough simply to describe a program!


* Submission guidelines
---
Due date  time: Submissions must be filed at the web site by 18:00 EST on
Saturday 29 March. Some convenient equivalents to 18:00 EST are 
  New York: 6:00 PM = 18h00 
  San Francisco: 3:00 PM = 15h00 
  Chicago: 5:00 PM = 17h00 
  Paris: Midnight 
  Hong Kong: 7:00 AM (30 March) 
  UTC: 2300 
For other time-zones/locations, see
  http://www.timeanddate.com/worldclock/fixedtime.html 

Submission URL: http://www.cc.gatech.edu/icfp03/submit 

Authors should submit a 100-200 word abstract and a full paper by 23:00
Universal Coordinated Time on Saturday, 29 March, 2003. Submissions should be
no more than 12 pages (including bibliography and appendices) in standard ACM
conference format: two columns, nine-point font on a ten-point baseline, with
pages 20pc (3.33in) wide and 54pc (9in) tall, with a column gutter of 2pc
(0.33in). Detailed formatting guidelines are available at
http://www.acm.org/sigs/pubs/proceed/template.html, along with formatting
templates or style files for LaTeX, Word Perfect, and Word. You don't need to
include categories, keywords, etc., though you are welcome to do so. Also,
note that the ACM copyright notice 

RE: fundeps for extended Monad definition

2003-02-28 Thread oleg

Hello!

It seems we can truly implement Monad2 without pushing the
envelope too far. The solution and a few tests are given below. In
contrast to the previous approach, here we lift the type variables
rather than bury them. The principle is to bring the type logic
programming at the level of classes and instances but avoid putting
them at the level of their members.


 class TwoMonadific m a ma | m a - ma, ma - m a where
   unused :: m a - ()
   unused = undefined
  
 instance TwoMonadific [] a [a]

 instance TwoMonadific Maybe a (Maybe a)

 class (TwoMonadific m a ma, TwoMonadific m b mb) = Monad2 m a b ma mb 
  where
   return2 :: a - ma
   bind2   :: ma - (a - mb) - mb  

 instance Monad2 [] a b [a] [b] where
   return2 x = [x]
   bind2 l f = concatMap f l

 instance Monad2 Maybe a b (Maybe a) (Maybe b) where
   return2 x = Just x
   bind2 Nothing f = Nothing
   bind2 (Just x) f = f x
  
 test1 = (return2 5) `bind2` (\n - [1..n]) `bind2` (\n - [1..n])

 test2 = (return2 5) `bind2` Just `bind2` Just

 *Main test1
 [1,1,2,1,2,3,1,2,3,4,1,2,3,4,5]
 *Main test2
 Just 5

It all works in GHC. Hugs complaints about return2:

  ERROR /tmp/b.hs:11 - Ambiguous type signature in class declaration
  *** ambiguous type : Monad2 a b c d e = b - d
  *** assigned to: return2

My version of Hugs isn't up-to-date though.

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


Re:

2003-02-28 Thread wr
http://www.chinahtm.com 

1,

2.CN   
   

3ASP+ACCESS10

4

5
A 
B  
C  
D3721 


0592-239101819   0592-2391098
 [EMAIL PROTECTED]
http://www.chinahtm.com

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