RE: can't derive Monad

2003-07-30 Thread Simon Peyton-Jones
|  You'd get
| 
|  instance Eq [T] = Eq T
| 
|  which will make the type checker loop for sure.
| 
| Actually not.
| 
| swan(102)% cat Deriving.hs
| newtype N = N [N] deriving Eq

What it's doing is *first* trying the new newtype-deriving stuff,
failing (because recursive) and then trying old vanilla deriving,
getting
instance Eq N where
   (==) (N a) (N b) = a == b

You can't do that when the class isn't a standard class that GHC knows
about. The point about the new newtype-deriving stuff is that it works
for ANY class. From
newtype Foo = Foo T deriving( C )
we generate
instance C T = C Foo
and use the (C T) dictionary for (C Foo).  But there has to be some way
to stop instance deduction looping.  Usually that's by making instance
decls have only type vars to the left of the =, but here it's by making
sure the newtype is non-recursive.

Simon

| 
| n1 = N []
| n2 = N []
| n3 = N [n1]
| n4 = N [n1,n2]
| 
| main = mapM_ print [ n1 == n2, n2 == n3, n3 == n4 ]
| swan(103)% ghci Deriving
|___ ___ _
|   / _ \ /\  /\/ __(_)
|  / /_\// /_/ / /  | |  GHC Interactive, version 5.04.3, for
Haskell 98.
| 
| / /_\\/ __  / /___| |  http://www.haskell.org/ghc/
| \/\/ /_/\/|_|  Type :? for help.
| 
| Loading package base ... linking ... done.
| Loading package haskell98 ... linking ... done.
| Compiling Main ( Deriving.hs, interpreted )
| Ok, modules loaded: Main.
| *Main main
| True
| False
| False
| *Main
| 
|   I'm not sure what a
|  safe approximation might be.
| 
| Would one need to approximate?  Could one try to type check and bail
out if
| that fails?
| 
|   But I'll put your example in a comment in
|  the source code as an example of a safe one that's rejected!
| 
|  Simon
| 
|  | -Original Message-
|  | From: [EMAIL PROTECTED]
|  [mailto:[EMAIL PROTECTED] On
|  | Behalf Of Dean Herington
|  | Sent: 28 July 2003 23:01
|  | To: [EMAIL PROTECTED]
|  | Subject: can't derive Monad
|  |
|  | The following may not be a bug, but it surprised me.  Why does the
|  | circularity cause GHC fits?
|  |
|  |
|  | swan(106)% cat NestStateT.hs
|  | {-# OPTIONS -fglasgow-exts #-}
|  |
|  | import Control.Monad.State
|  |
|  | newtype S1 = S1 [T1 ()]
|  | newtype T1 a = T1 (StateT S1 IO a )
|  |   deriving Monad
|  |
|  | main = undefined
|  | swan(105)% ghci NestStateT.hs
|  |___ ___ _
|  |   / _ \ /\  /\/ __(_)
|  |  / /_\// /_/ / /  | |  GHC Interactive, version 5.04.3, for
|  Haskell
|  | 98.
|  | / /_\\/ __  / /___| |  http://www.haskell.org/ghc/
|  | \/\/ /_/\/|_|  Type :? for help.
|  |
|  | Loading package base ... linking ... done.
|  | Loading package haskell98 ... linking ... done.
|  | Compiling Main ( NestStateT.hs, interpreted )
|  |
|  | NestStateT.hs:6:
|  | Can't make a derived instance of `Monad T1'
|  | (too hard for cunning newtype deriving)
|  | When deriving instances for type `T1'
|  | Failed, modules loaded: none.
|  | Prelude
| 


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


RE: hp2ps: MARKs wrongly placed unless x-axis starts at zero

2003-07-30 Thread Simon Peyton-Jones
Interesting.  We're clueless about hp2ps here at GHC home base.  Would
you (or any else) like to fix this?  We'd be happy to apply a patch,
needless to say!

Simon

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
| Behalf Of Nicholas Nethercote
| Sent: 26 July 2003 14:20
| To: GHC bugs
| Subject: BUG: hp2ps: MARKs wrongly placed unless x-axis starts at zero
| 
| Hi,
| 
| I found a bug in hp2ps:  if you use MARKs, it seems to assume the
x-axis
| starts at zero.  So if your x-axis starts at, say, 5, then all the
marks
| get shifted to the right by 5 x-units.  See attached file for an
example.
| 
| This is with GHC 5.04.2, but judging from CVS most of hp2ps hasn't
been
| touched in 7 years, so I imagine it hasn't been fixed since :)
| 
| Thanks.
| 
| --
| Nick Nethercote
| [EMAIL PROTECTED]


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


RE: hp2ps: MARKs wrongly placed unless x-axis starts at zero

2003-07-30 Thread Nicholas Nethercote
On Wed, 30 Jul 2003, Simon Peyton-Jones wrote:

 Interesting.  We're clueless about hp2ps here at GHC home base.  Would
 you (or any else) like to fix this?  We'd be happy to apply a patch,
 needless to say!

The following seems to do the trick.

N


*** Marks.bad.c 2003-07-30 18:00:12.0 +0100
--- Marks.c 2003-07-30 18:00:15.0 +0100
***
*** 16,22 
  floatish m;

  for (i = 0; i  nmarks; i++) {
!   m = (markmap[i] / xrange) * graphwidth;
Caret(xpage(m), ypage(0.0), 4.0);
  }
  }
--- 16,22 
  floatish m;

  for (i = 0; i  nmarks; i++) {
!   m = ((markmap[i] - samplemap[0]) / xrange) * graphwidth;
Caret(xpage(m), ypage(0.0), 4.0);
  }
  }



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


RE: hp2ps: MARKs wrongly placed unless x-axis starts at zero

2003-07-30 Thread Simon Marlow
 
 The following seems to do the trick.
 
 N
 
 
 *** Marks.bad.c 2003-07-30 18:00:12.0 +0100
 --- Marks.c 2003-07-30 18:00:15.0 +0100
 ***
 *** 16,22 
   floatish m;
 
   for (i = 0; i  nmarks; i++) {
 !   m = (markmap[i] / xrange) * graphwidth;
 Caret(xpage(m), ypage(0.0), 4.0);
   }
   }
 --- 16,22 
   floatish m;
 
   for (i = 0; i  nmarks; i++) {
 !   m = ((markmap[i] - samplemap[0]) / xrange) * graphwidth;
 Caret(xpage(m), ypage(0.0), 4.0);
   }
   }

Committed; thanks.

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


RE: GHC and Mingw32 (cont.)

2003-07-30 Thread Simon Marlow
 
 Ok, I got GHC compiled but running it is a tricky.  It
 has trouble finding package.conf.

It looks like you've done 'make install'.  On Windows, we don't support
doing that, because it conflicts with the way we layout binary
distributions.  If you build GHC from source, just run it from the
source tree, as ghc/compiler/stage2/ghc-inplace.

Cheers,
Simon

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


Strange Building problem...

2003-07-30 Thread Mark Green
Hi folks,

I am presently trying to build GHC on an i386 Linux box running
debian/sid.  (Yea, I know there's a .deb - in fact, I have it
installed - but I need to be able to compile my own.)

I've run configure and make, and stage 1 went quite well although
there were a few syntax problems (usually due to #ifdef's in the
source .hs files apparantly overrunning or underrunning; easily fixed
by just deleting the problematic #ifdef chunks for other
architectures).  

Stage 2, however, seems to have a problem:  make runs make -C
ghc/compiler stage=2, which then runs
../../ghc/compiler/stage1/ghc-inplace -o stage2/ghc-6.0 -H16m -O
-ilots of stage2/ paths -DGHCI -package haskell-src -package unix
-package readline -cpp -fglasgow-exts -Rghc-timing -I. -IcodeGen
-IativeGen -Iparser -recomp -Rghc-timingn -H16m `#include
hschooks.h` -no-link-chk lots of .o files

This then produces:
stage2/utils/Util.o(.text+0xb8): In funtion r4c8_entry: undefined
reference to GHCziBase_True_Closure
 
... and roughly 40,000 errors of the same form.

Can anyone let me know what I'm doing wrong here?  Any help greatly
appreciated.

Mark

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


ANNOUNCE: GHC version 6.0.1

2003-07-30 Thread Simon Marlow

   =
The (Interactive) Glasgow Haskell Compiler -- version 6.0.1
   =

We are pleased to announce a new patchlevel release of the Glasgow
Haskell Compiler (GHC), version 6.0.1.

This is a bug-fix release relative to 6.0.  The most important bugfixes
are:

   * Fixes to make GHC work with GCC 3.3

   * Fix for the GHC deletes source files bug

   * :cd now unloads any loaded modules in GHCi.

   * -mk-dll should work better on Windows.

in addition to various other bugfixes.

The release notes lists the changes in the 6.0 line relative to 5.04:

 
http://www.haskell.org/ghc/docs/latest/html/users_guide/release-6-0.html


How to get it
~
The easy way is to go to the WWW page, which should be self-explanatory:

http://www.haskell.org/ghc/

We supply binary builds in the native package format for various
flavours of Linux and BSD, and in Windows Installer (MSI) form
for Windows folks.  Binary builds for other platforms are available
as a .tar.gz which can be installed wherever you want.  The source
distribution is also available from the same place.

Packages will appear as they are built - if the package for your
system isn't available yet, please try again later.

Background
~~
Haskell is a standard lazy functional programming language; the
current language version is Haskell 98, agreed in December 1998, and
revised in December 2002.

GHC is a state-of-the-art programming suite for Haskell.  Included is
an optimising compiler generating good code for a variety of
platforms, together with an interactive system for convenient, quick
development.  The distribution includes space and time profiling
facilities, a large collection of libraries, and support for various
language extensions, including concurrency, exceptions, and foreign
language interfaces (C, whatever).  GHC is distributed under a
BSD-style open source license.

A wide variety of Haskell related resources (tutorials, libraries,
specifications, documentation, compilers, interpreters, references,
contact information, links to research groups) are available from the
Haskell home page (see below).


On-line GHC-related resources
~~

Relevant URLs on the World-Wide Web:

GHC home page http://www.haskell.org/ghc/
Haskell home page http://www.haskell.org/
comp.lang.functional FAQ  http://www.cs.nott.ac.uk/~gmh/faq.html



System requirements
~~~
To compile programs with GHC, you need a machine with 64+MB memory, GCC
and perl. This release is known to work on the following platforms:

  * i386-unknown-{linux,*bsd,mingw32}
  * sparc-sun-solaris2
  * alpha-dec-osf3
  * powerpc-apple-darwin (Mac OS X)

Ports to the following platforms should be relatively easy (for a
wunderhacker), but haven't been tested due to lack of time/hardware:

  * hppa1.1-hp-hpux{9,10}
  * i386-unknown-solaris2
  * mips-sgi-irix{5,6}
  * {rs6000,powerpc}-ibm-aix

The builder's guide on the web site gives a complete run-down of what
ports work; it can be found at

 
http://www.haskell.org/ghc/docs/latest/html/building/building-guide.html


Mailing lists
~
We run mailing lists for GHC users and bug reports; to subscribe, use
the web interfaces at

http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

There are several other haskell and ghc-related mailing lists on
www.haskell.org; for the full list, see

http://www.haskell.org/mailman/listinfo/

Please report bugs using our SourceForge page at

http://sourceforge.net/projects/ghc/

or send them to [EMAIL PROTECTED]

GHC users hang out on [EMAIL PROTECTED]  Bleeding
edge CVS users party on [EMAIL PROTECTED]

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


Re: ANNOUNCE: GHC version 6.0.1

2003-07-30 Thread Jens Petersen
On Wed, Jul 30, 2003 at 01:06:02PM +0100, Simon Marlow wrote:

 We are pleased to announce a new patchlevel release of the Glasgow
 Haskell Compiler (GHC), version 6.0.1.

Thanks :)

I just uploaded a ghc-6.0.1-1 rpm package for Linux/i386 to

http://haskell.org/~petersen/rpms/ghc/

built with ghc-6.0 and linked against glibc 2.3.

Please let me know if you have any problems with this package.

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


RE: Strange Building problem...

2003-07-30 Thread Simon Marlow
 
 I am presently trying to build GHC on an i386 Linux box running
 debian/sid.  (Yea, I know there's a .deb - in fact, I have it
 installed - but I need to be able to compile my own.)
 
 I've run configure and make, and stage 1 went quite well although
 there were a few syntax problems (usually due to #ifdef's in the
 source .hs files apparantly overrunning or underrunning; easily fixed
 by just deleting the problematic #ifdef chunks for other
 architectures).  
 
 Stage 2, however, seems to have a problem:  make runs make -C
 ghc/compiler stage=2, which then runs
 ../../ghc/compiler/stage1/ghc-inplace -o stage2/ghc-6.0 -H16m -O
 -ilots of stage2/ paths -DGHCI -package haskell-src -package unix
 -package readline -cpp -fglasgow-exts -Rghc-timing -I. -IcodeGen
 -IativeGen -Iparser -recomp -Rghc-timingn -H16m `#include
 hschooks.h` -no-link-chk lots of .o files
 
 This then produces:
 stage2/utils/Util.o(.text+0xb8): In funtion r4c8_entry: undefined
 reference to GHCziBase_True_Closure
  
 ... and roughly 40,000 errors of the same form.

Something has gone wrong :-)

GHCziBase_True_closure is a symbol that should be coming from the base
package, the GHC.Base module in particular.  You could check that
libraries/base/libHSbase.a looks reasonable: it should be on the order
of 17Mb.  Try 'nm' on it, look for some of the missing symbols.

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


Re: Strange Building problem...

2003-07-30 Thread Ian Lynagh
On Wed, Jul 30, 2003 at 06:01:22PM +0100, Simon Marlow wrote:
  
  stage2/utils/Util.o(.text+0xb8): In funtion r4c8_entry: undefined
  reference to GHCziBase_True_Closure
   
  ... and roughly 40,000 errors of the same form.
 
 GHCziBase_True_closure is a symbol that should be coming from the base

Note that the case of the 'C' of the missing symbol is different, and nm
shows only the lower case 'c' on my (6.0.1) stage2/utils/Util.o.
I don't know what that means, though.

I have sometimes found it worth checking that ghc-inplace can compile
simple hello-world programs and that they run OK.


Ian

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


NICE TO MEET YOU.

2003-07-30 Thread TAFIQ MOHAMMED.
FROM: TAFIQ MOHAMMED.
AMMAN JORDAN

DEAR:Sir,

My Name is TAFIQ MOHAMMED, an Iraqis National from the Kurds an
Accountant
in Oil refinery in Durra. I am presently in Amman, Jordan Capital since
U.S.strike Iraqi, few days to the expiration of the 48 hours Ultimatum
before the strike.

I moved $45.5M dollars call-deposit to Security Company in Iran for
safe-keeping.In my capacity as the accountant to the oil refinery in
durra,
I was the only person aware of this financial transaction call-deposit
with
the security company in Iran to be released to whom I will introduce to
the
security company as the beneficiary of the call- deposit of $45.5M, whom
the oil installation company is been owed since I can not be able to go
to
Iran because of the war.

Now that the situation is not condusive for me to go to Iran, I am
appealing to you if i can present you as the beneficiary of the call-
deposit to the security company for the release of the deposit to your
Account or any of your destination as part of the money being owed to
you
by Durra oil Refinery Company Iraq.

As soon as this deposit is released to your Account by the security
company in Iran or any of your destination,I will come over to meet you
for
disbursement 30%-70%. On your acceptance on this transaction I will send
to
you the deposit slip Certificate for the call deposit to you as the
beneficiary to be release to you as part of the refunds owed to you by
Durra Oil Refinery company Iraq.Or contact me through my alternative
E-mailaddress:[EMAIL PROTECTED]

Awaiting your quick response,
Best Regards,
TAFIQ MOHAMMED,











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


Pure functional TypeRep [Was: Existentials...]

2003-07-30 Thread oleg

This message shows how to map _types_ to integers at compile time --
and then extend this facility to run-time so it can be used with
existentially-quantified types. It is statically guaranteed that
different types receive different integer labels. Unlike TyCons of
Dynamics, our mapping does NOT rely on unsafePerformIO. We use the
typechecker itself to compare types. It seems our typemap can also be
used for _safe_ casts, in particular, for casting away the existential
blemish.

This message was inspired by Amr Sabry's problem on
existentials. Unlike Hal Daume's solution posted here earlier, we do
not use Dynamics nor GMap -- therefore, we completely avoid
unsafePerformIO and unsafeCoerce. Our solution is purely functional
and assuredly type-safe (to the extent the typechecker can be
trusted). Extensions used:
  -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances

First, the compile-time mapping from types to integers.

Polytypic list:

 data Nil t r  = Nil
 data Cons t r = Cons t r

 class PList ntype vtype cdrtype where
 cdr::   ntype vtype cdrtype - cdrtype
 empty:: ntype vtype cdrtype - Bool
 value:: ntype vtype cdrtype - vtype

 instance PList Nil vtype cdrtype where
 empty = const True

 instance (PList n v r) = PList Cons v' (n v r) where
  empty = const False
  value (Cons v r) = v
  cdr   (Cons v r) = r

and the finite map from types to integers

 class TypeSeq t s where
 type_index:: t - s - Int

 instance (PList Cons t r) = TypeSeq t (Cons t r) where
 type_index _ _ = 0

 instance (PList Cons t' r', TypeSeq t r') = TypeSeq t (Cons t' r') where
 type_index v s = 1 + (type_index v $ cdr s)

Let us build some finite map

 init_typeseq = Cons (undefined::Char) $
Cons (undefined::Int) $
Cons (undefined::Bool) $
Cons (undefined::String) $
Cons (undefined::Maybe Char) $
Nil

A typeseq maps a type to an integer -- which is the type's position in
the polytypic list. We are satisfied with the first occurrence of the
type in the list. It is plain that a typeseq maps different types to
different integers. Let us see how it works:

-- *Main type_index True  init_typeseq
-- 2
-- *Main type_index 'a'  init_typeseq
-- 0
-- *Main type_index a  init_typeseq
-- 3
-- *Main type_index (1::Int)  init_typeseq
-- 1
-- *Main type_index (Just 'a')  init_typeseq
-- 4
-- *Main type_index (Just True)  init_typeseq

-- interactive:1:
-- No instance for (TypeSeq (Maybe Bool) (Nil t r))
-- arising from use of `type_index' at interactive:1
-- In the definition of `it': type_index (Just True) init_typeseq

We call this mapping compile-time because the translation from a type
to the corresponding encoding (1+1+...1) is done at compile time, when
the appropriate instance of the TypeSeq class is chosen. A
sufficiently smart compiler can just as well fold the constant
expression (1+1...+1) down to a single integer. Also, errors in the
translation are reported at compile-time.

However, to apply the mapping to existential types, we need to extend
the former to run-time.

 class TypeRep t where
 tr_index:: t - Int

 -- All of the following are almost the same.
 -- The Template Haskell can really help us here
 instance TypeRep Char where
 tr_index x = type_index x init_typeseq

 instance TypeRep Int where
 tr_index x = type_index x init_typeseq

 instance TypeRep Bool where
 tr_index x = type_index x init_typeseq

 instance TypeRep String where
 tr_index x = type_index x init_typeseq

 instance TypeRep (Maybe Char) where
 tr_index x = type_index x init_typeseq

Now, Amr Sabry's Problem

 data F a b = 
   forall c. (TypeRep c) = PushF (a - c) (F c b) 
 | Bottom (a - b)

 f1 :: Char - Bool
 f1 'a' = True
 f1 _ = False

 f2 :: Bool - String
 f2 True = true
 f2 False = false

 f3 :: String - Int
 f3 = length

 fs = PushF f1 (PushF f2 (PushF f3 (Bottom id)))

First, we make fs an instance of class Show. It is jolly convenient.

 data HF = forall a b. (TypeRep a,TypeRep b) = HF (F a b)
 show_fn_type (g::(a-b)) 
   = ( ++ (show (tr_index (undefined::a))) ++ 
 -++(show (tr_index (undefined::b))) ++ )
   
 instance (TypeRep a, TypeRep b) = Show (F a b) where
 show = show . hsf_to_lst . HF
   where
hsf_to_lst (HF (Bottom g)) = [show_fn_type g]
hsf_to_lst (HF (PushF g next)) = (show_fn_type g):(hsf_to_lst$HF next)

Now, Amr Sabry's question:

] Is it possible to write a function 
]   f :: F a b - T c - F c b
] where (T c) is some type for values of type 'c' or values representing
] the type 'c' or whatever is appropriate. Thus if given the
] representation of Bool, the function should return:
]  PushF f2 (PushF f3 (Bottom id))
] and if given the representation of String the function should return
]  PushF f3 (Bottom id)
] and so on. 

First, we prepend to the given F a b structure the identity

FW: [IcfpSC] Call for spam -- one more time-sensitive round

2003-07-30 Thread Simon Peyton-Jones
Gentle Haskellfolk

ICFP is nearly upon us.  Early registration ends today!  So this would be a good 
moment to click.

Simon

---
Call for Participation
ICFP 2003: ACM International Conference on Functional Programming
August 25-29, 2003
Uppsala, Sweden

* About ICFP

The goal of ICFP is to
  - stimulate and promote international research on functional programming, and
  - act as focal point to bring together the functional-programming
community for intellectual cross-pollination and collaboration.

The scope of the conference includes all languages that encourage programming
with functions, including both purely applicative and imperative languages, as
well as languages that support objects and concurrency. The topics covered
range from principles to practice, from foundations to features, and from
abstractions to applications.

The conference is affiliated with PLI, a confederation of international
meetings sponsored by ACM SIGPLAN, which this year will also include
  - PPDP (International Conference on Principles and Practice of 
Declarative Programming)
  - LOPSTR (International Symposium on Logic-based Program Synthesis 
and Transformation)
  - Haskell Workshop
  - Erlang Workshop
  - MERLIN (Mechanised Reasoning About Languages with Variable Binding)
  - DPCOOL (Declarative Programming in the Context of Object-oriented 
Languages) 

* Useful URLs
-
  - Main web page for the entire PLI meeting; contains information on accepted
papers, registration, accomodation, and social events:
http://www.it.uu.se/pli03/

  - Main web page for ICFP:
http://www-users.cs.york.ac.uk/~colin/icfp2003.html

  - ICFP programme:
http://www.cc.gatech.edu/~shivers/icfp03/schedule.html

* Registration now open
---
Registration is now open and the early registration deadline is July 30th.
NOTE: The cut-off date for guaranteed hotel reservations varies
with the hotel and is typically *before* July 30th. It is advisable to
make your hotel reservations soon.

---
* Conference programme
--

Monday 25 August 2003

Invited talk: 9:00-10:00

  Conservation of information: Applications in functional, 
  reversible, and quantum computing
Thomas Knight, Jr. (MIT Artificial Intelligence Laboratory) 

Session I: 10:30-12:30
--
  Scripting the type-inference process
Bastiaan Heeren, Jurriaan Hage, Doaitse Swierstra (Universiteit Utrecht) 
  Discriminative sum types locate the source of type errors
Matthias Neubauer, Peter Thiemann (Universität Freiburg) 
  MLF: Raising ML to the power of system F
Didier Le Botlan, Didier Remy (INRIA Rocquencourt) 
  An extension of HM(X) with bounded existential and universal data-types
Vincent Simonet (INRIA Rocquencourt) 

Session II: 2:15-3:45
-
  CDuce: an XML-centric general-purpose language
Véronique Benzaken (LRI, Université Paris Sud, Orsay), 
Giuseppe Castagna (CNRS, LIENS, École Normale Supérieure), 
Alain Frisch (LIENS, École Normale Supérieure, Paris) 
  Compiling regular patterns
Michael Levin (University of Pennsylvania) 
  Software is discrete mathematics
Rex Page (University of Oklahoma) 

Session III: 4:15-6:00
--
  Global abstraction-safe marshalling with hash types
James Leifer (INRIA Rocquencourt), Gilles Peskine(INRIA Rocquencourt),
Peter Sewell (University of Cambridge), Keith Wansbrough 
(University of Cambridge) 
  Dynamic rebinding for marshalling and update, with destruct-time lambda
Gavin Bierman (University of Cambridge), Michael Hicks (University of 
Maryland, College Park), Peter Sewell (University of Cambridge), Gareth 
Stoyle (University of Cambridge), Keith Wansbrough (University of 
Cambridge) 
  Iterative-free program analysis
Mizuhito Ogawa (Japan Advanced Institute of Science and Technology), 
Zhenjiang Hu (University of Tokyo), Isao Sasano (Japan Advanced
Institute of Technology and Science) 
  Report on ICFP 2003  2004
Olin Shivers  Kathleen Fisher 

===
Tuesday 26 August 2003

Invited talk: 9:00-10:00

  From Hilbert space to Dilbert space: Context semantics as a language for 
  games and flow analysis
Harry Mairson (Brandeis University) 

Session IV: 10:30-12:30
---
  A theory of aspects
David Walker (Princeton University), Steve Zdancewic (University of 
Pennsylvania), Jay Ligatti (Princeton University) 
  Dependency-style Generic Haskell
Andres Löh, Dave Clarke, Johan Jeuring (Universiteit Utrecht) 
  Functional automatic differentiation with Dirac impulses
Henrik Nilsson (Yale University) 
  A user-centred approach 

Compositional Verification of UML Models

2003-07-30 Thread M.M. Bonsangue
(We apologize for the reception of multiple copies)

 CALL FOR PAPER *

   Call for Papers

  Compositional Verification of UML Models
Workshop of the UML 2003 Conference


The definition  of UML has been  motivated by the need  for a standard
notation  for   modelling  system  architectures   and  behaviours  at
functional  and  implementation  level.   The  main  fqocus  has  been
essentially  on terminology,  notation and  syntax  without addressing
semantic, validation  and methodology  issues which are  important for
formal design and verification techniques. This workshop addresses the
application  of  formal  methods   and  techniques  that  exploit  the
architectural  structure  of UML  models  in  a compositional  manner.

TOPICS  
The  workshop topics  include  (but  are  not limited  to):  
* semantic  foundations  of  architectural  and  
  component-based  design within UML  
* compositional techniques  for the analysis  embedded and
  real-time  systems  in  UML  
* compositional model  checking  of  UML behavioural models  
* compositional deductive  methods based on  OCL 
* methodologies based on compositional formal techniques

FORMAT OF THE WORKSHOP
The  workshop will consist  of presentations  of the  accepted papers,
which will  be the basis for  an intensive discussion  on the workshop
topics.   Extended abstracts  of the  presentations will  be published
after the workshop  by Elsevier Science as a  volume of the Electronic
Notes in Theoretical Computer Science.

For an up-to-date program and  invited talks see the workshop web-site
http://fmco.liacs.nl/compuml.html

SUBMISSIONS
Authors are invited to submit  by August 25th an extended abstract not
exceeding 20  pages electronically to  [EMAIL PROTECTED] Submissions
must be either  in Postscript or PDF format  and prepared for USLetter
or A4 page sizes.

Submissions will  be evaluated by the program  committee for inclusion
in the  proceedings, which  will be published  by Electronic  Notes in
Theoretical  Computer  Science series.  Papers  must contain  original
contributions, be  clearly written, and  include appropriate reference
to and comparison with related work. Simultaneous submissions to other
conferences are not allowed.

IMPORTANT DATES
25 August   Submission deadline
10 SeptemberNotification to authors 
1 October   Deadline for preliminary version
21 October  Workshop date
21 November Deadline for final version

PROGRAM COMMITTEE
Frank de Boer (CWI, NL)
Marcello Bonsangue (LIACS, NL)
Werner Damm (OFFIS, DE) 
Susanne Graf (Verimag, France)
David Harel (Weizmann Institute, Israel)
Jozef Hooman (University of Nijmegen, NL)
Bernhard Josko (OFFIS, DE)
Amir Pnueli (Weizmann Institute, ISR)
Willem-Paul de Roever (Kiel University, DE)
Joseph Sifakis (Verimag, FR)

ORGANIZERS
Frank de Boer (CWI, NL)
Marcello Bonsangue (LIACS, NL)
Bernhard Josko (OFFIS, DE)


SPONSORS 
This workshop is sponsored by the European RD project OMEGA - Correct
Development of  Real-time Embedded Systems (http://www-omega.imag.fr),
and   the  German-Dutch   project  Mobi-J   (main  sponsor   of  FMCO,
http://fmco.liacs.nl).

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


LOPSTR 2003 (Call for registration + program)

2003-07-30 Thread Wim Vanhoof

Call for Participation


LOPSTR (International Symposium on  Logic-based Program Synthesis and 
Transformation)  August 25-27, in Uppsala, Sweden.

Early registration deadline is July 30

More info (also the other events of PLI'03) 
at http://www.it.uu.se/pli03/index.shtml


The program:



Monday August 25

  9h00-10h00 ICFP invited talk

  10h30-12h30 Specification and Synthesis
Predicate synthesis from inductive proof attempt of faulty conjectures.
Moussa Demba, Khaled Bsa\{\i}es and Francis Alexandre.

Specification and Synthesis of Hybrid Automata for Physics-Based Animation.
Thomas Ellman.

Adding Concrete Syntax to a Prolog-Based Program Synthesis System.
Bernd Fischer and Eelco Visser.

Specifying Object-Oriented Systems in Computational Logic.
Kung-Kiu Lau and Mario Ornaghi.

  14h15-15h45 Verification
Building Satisfiability Procedures for Verification: The Case Study of 
Sorting Algorithmsm.
Abdessamad Imine and Silvio Ranise. 

Formal Development and Verification of Approximation Algorithms
using Auxiliary Variables.
Rudolf Berghammer and Markus M\uller-Olm.

Formal Reasoning About Efficient Data Structures: A Case Study in ACL2.
José-Luis Ruiz-Reina, José-Antonio Alonso, María-José Hidalgo 
and  Francisco-Jesús Martín Mateos. 

  16h15-17h45 Analysis
A Program Transformation for Backwards Analysis of Logic Programs.
John P. Gallagher.

An Efficient Staging Algorithm for Binding-Time Analysis.
Takuma Murakami, Zhenjiang Hu, Kazuhiko Kakehi and Masato Takeichi. 

Proving termination with adornments.
Alexander Serebrenik and Danny De Schreye. 


Tuesday August 26
  
  9h00-10h00 ICFP Invited Talk

  10h30-12h30 Transformation

Constructively Characterizing Fold and Unfold
Tjark Weber and James Caldwell. 

Deterministic Second-order Patterns
Tetsuo Yokoyama, Zhenjiang Hu, and Masato Takeichi.

From Interpreter to Logic Engine: A Functional Derivation.
Dariusz Biernacki and Olivier Danvy.

Linearization by Program Transformation.
Sandra Alves and  Mário Florido. 

  14h15-15h15 Invited Talk
Inductive Theorem Proving by Program Specialisation: Generating proofs
for Isabelle using Ecce 
Michael Leuschel (work with Helko Lehmann)

  15h15-15h45  Specialisation
Provably Correct Code Generation for High Assurance Systems via Partial 
Evaluation: A Case Study.
Qian Wang and Gopal Gupta.
 
Wednesday August 27

  9h00-10h30 Constraints

Simplification of database integrity constraints revisited: 
A transformational approach.
Henning Christiansen and  Davide Martinenghi. 

Integration and Optimization of Rule-based Constraint Solvers.
Slim Abdennadher and Thom Fr\uhwirth. 

Introducing ESRA, a Relational Language for Modelling 
Combinatorial Problems.
Pierre Flener, Justin Pearson, and Magnus {\AA}gren. 

  11h30-12h30 PLI Invited Talk
Understanding aspects 
Mitchell Wand


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


RE: exceptions

2003-07-30 Thread Simon Marlow
 
 just out of curiosity, which is the proper idiom?
 
 trace a  = r - catch a (\e - putStr exceptional\n  throw e)
 trace a  = r - catch a (\e - putStr exceptional\n  ioError e)
 
 I am worried that one might subtly change the semantics of an 
 execption
 depending on how it was originally thrown... but i am uncertain how.
 probably some obscure case involving bottoms. But to be on the safe
 side, thought I'd ask.

The second is more correct, if you're using Prelude.catch.  If you're
using Control.Exception.catch, then you want throwIO instead of ioError.

The difference between throw and ioError is this:

  seq (throw e)   E  ==  throw e
  seq (ioError e) E  ==  E

Cheers,
Simon

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


ANNOUNCE: GHC version 6.0.1

2003-07-30 Thread Simon Marlow

   =
The (Interactive) Glasgow Haskell Compiler -- version 6.0.1
   =

We are pleased to announce a new patchlevel release of the Glasgow
Haskell Compiler (GHC), version 6.0.1.

This is a bug-fix release relative to 6.0.  The most important bugfixes
are:

   * Fixes to make GHC work with GCC 3.3

   * Fix for the GHC deletes source files bug

   * :cd now unloads any loaded modules in GHCi.

   * -mk-dll should work better on Windows.

in addition to various other bugfixes.

The release notes lists the changes in the 6.0 line relative to 5.04:

 
http://www.haskell.org/ghc/docs/latest/html/users_guide/release-6-0.html


How to get it
~
The easy way is to go to the WWW page, which should be self-explanatory:

http://www.haskell.org/ghc/

We supply binary builds in the native package format for various
flavours of Linux and BSD, and in Windows Installer (MSI) form
for Windows folks.  Binary builds for other platforms are available
as a .tar.gz which can be installed wherever you want.  The source
distribution is also available from the same place.

Packages will appear as they are built - if the package for your
system isn't available yet, please try again later.

Background
~~
Haskell is a standard lazy functional programming language; the
current language version is Haskell 98, agreed in December 1998, and
revised in December 2002.

GHC is a state-of-the-art programming suite for Haskell.  Included is
an optimising compiler generating good code for a variety of
platforms, together with an interactive system for convenient, quick
development.  The distribution includes space and time profiling
facilities, a large collection of libraries, and support for various
language extensions, including concurrency, exceptions, and foreign
language interfaces (C, whatever).  GHC is distributed under a
BSD-style open source license.

A wide variety of Haskell related resources (tutorials, libraries,
specifications, documentation, compilers, interpreters, references,
contact information, links to research groups) are available from the
Haskell home page (see below).


On-line GHC-related resources
~~

Relevant URLs on the World-Wide Web:

GHC home page http://www.haskell.org/ghc/
Haskell home page http://www.haskell.org/
comp.lang.functional FAQ  http://www.cs.nott.ac.uk/~gmh/faq.html



System requirements
~~~
To compile programs with GHC, you need a machine with 64+MB memory, GCC
and perl. This release is known to work on the following platforms:

  * i386-unknown-{linux,*bsd,mingw32}
  * sparc-sun-solaris2
  * alpha-dec-osf3
  * powerpc-apple-darwin (Mac OS X)

Ports to the following platforms should be relatively easy (for a
wunderhacker), but haven't been tested due to lack of time/hardware:

  * hppa1.1-hp-hpux{9,10}
  * i386-unknown-solaris2
  * mips-sgi-irix{5,6}
  * {rs6000,powerpc}-ibm-aix

The builder's guide on the web site gives a complete run-down of what
ports work; it can be found at

 
http://www.haskell.org/ghc/docs/latest/html/building/building-guide.html


Mailing lists
~
We run mailing lists for GHC users and bug reports; to subscribe, use
the web interfaces at

http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

There are several other haskell and ghc-related mailing lists on
www.haskell.org; for the full list, see

http://www.haskell.org/mailman/listinfo/

Please report bugs using our SourceForge page at

http://sourceforge.net/projects/ghc/

or send them to [EMAIL PROTECTED]

GHC users hang out on [EMAIL PROTECTED]  Bleeding
edge CVS users party on [EMAIL PROTECTED]

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


Re: ANNOUNCE: GHC version 6.0.1

2003-07-30 Thread Jens Petersen
On Wed, Jul 30, 2003 at 01:06:02PM +0100, Simon Marlow wrote:

 We are pleased to announce a new patchlevel release of the Glasgow
 Haskell Compiler (GHC), version 6.0.1.

Thanks :)

I just uploaded a ghc-6.0.1-1 rpm package for Linux/i386 to

http://haskell.org/~petersen/rpms/ghc/

built with ghc-6.0 and linked against glibc 2.3.

Please let me know if you have any problems with this package.

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


Ann: HAllInOne bug fix release

2003-07-30 Thread Hal Daume III
Hi Fellow Haskellers,

I normally wouldn't send out bug fix notifications, but there has been an
update to HAllInOne (http://www.isi.edu/~hdaume/HAllInOne/), which fixes 
two major bugs:

  - recursive modules now work correctly
  - proper separation of type and value environments

The reason I'm posting is because these fixes have enabled me to
All-In-One-ify the NHC Haskell Compiler.  This results is about 44k lines
of code in a single, 1.6mb module, which can then be compiled with your
favorite Haskell compiler (provided you have a lot of RAM).

A few people have asked me for speed-up results from All-In-One-ifying
code, so here's a good one.  We take two versions of NHC.  One is the
original binary distribution and the other is the All-In-One-ified
version, compiled by GHC.

We then ask each of these compilers to compile a large program (I didn't
bother making it link it -- that seemed too tangential).  The large
program I asked these two compilers to compile was, not surprisingly, the
All-In-One NHC source code :).

The timing results are:

Normal NHC:
real3m14.295s
user3m9.879s
sys 0m2.143s

All-In-One NHC:
real1m11.380s
user0m10.102s
sys 0m1.711s

So there's definitely a speedup.

I will make further speedup posts directly to the web page instead of the
mailing list.

 - Hal

p.s., for extra fun, google for Haskell Modules and look to the right
:).


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


Re: Ann: HAllInOne bug fix release

2003-07-30 Thread Wolfgang Jeltsch
On Wednesday, 2003-07-30, 23:36, CEST, Hal Daume III wrote:
 [...]

 A few people have asked me for speed-up results from All-In-One-ifying code,
 so here's a good one.  We take two versions of NHC.  One is the original
 binary distribution and the other is the All-In-One-ified version, compiled
 by GHC.

Hi,

is the original binary distribution compiled with GHC? If not, the speed-up 
may also be the result of using a different compiler (i.e., GHC).

 [...]

Wolfgang

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


RE: Ann: HAllInOne bug fix release

2003-07-30 Thread Hal Daume
Ah, apparently it is not (at least not the Cygwin version).

I recompiled NHC with GHC -O2, both the separate compilation version and
the all-in-over version.  Averaged over five runs, we see that the
separate compilation version is actually *faster* than the ai1 version:

standard nhc compiled with ghc:

real0m27.167s
user0m9.991s
sys 0m1.304s

nhc all-in-one:

real0m31.411s
user0m10.007s
sys 0m1.299s



i am completely unable to explain this.  someone want to hazard a guess?

 - hal, who is a bit disappointed now :(

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


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Wolfgang Jeltsch
 Sent: Wednesday, July 30, 2003 2:59 PM
 To: The Haskell Mailing List
 Subject: Re: Ann: HAllInOne bug fix release
 
 
 On Wednesday, 2003-07-30, 23:36, CEST, Hal Daume III wrote:
  [...]
 
  A few people have asked me for speed-up results from 
 All-In-One-ifying code,
  so here's a good one.  We take two versions of NHC.  One is 
 the original
  binary distribution and the other is the All-In-One-ified 
 version, compiled
  by GHC.
 
 Hi,
 
 is the original binary distribution compiled with GHC? If 
 not, the speed-up 
 may also be the result of using a different compiler (i.e., GHC).
 
  [...]
 
 Wolfgang
 
 ___
 Haskell mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/haskell
 
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Ann: HAllInOne bug fix release

2003-07-30 Thread John Meacham
Another useful thing would be the striped binary sizes of the two
versions. I am curious how much AllInOneing affects the resultant
binary. Memory usage would also be interesting.
John

On Wed, Jul 30, 2003 at 04:22:58PM -0700, Hal Daume wrote:
 Ah, apparently it is not (at least not the Cygwin version).
 
 I recompiled NHC with GHC -O2, both the separate compilation version and
 the all-in-over version.  Averaged over five runs, we see that the
 separate compilation version is actually *faster* than the ai1 version:
 
 standard nhc compiled with ghc:
 
 real0m27.167s
 user0m9.991s
 sys 0m1.304s
 
 nhc all-in-one:
 
 real0m31.411s
 user0m10.007s
 sys 0m1.299s
 
 
 
 i am completely unable to explain this.  someone want to hazard a guess?
 
  - hal, who is a bit disappointed now :(
 
  --
  Hal Daume III   | [EMAIL PROTECTED]
  Arrest this man, he talks in maths.   | www.isi.edu/~hdaume
 
 
  -Original Message-
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of Wolfgang Jeltsch
  Sent: Wednesday, July 30, 2003 2:59 PM
  To: The Haskell Mailing List
  Subject: Re: Ann: HAllInOne bug fix release
  
  
  On Wednesday, 2003-07-30, 23:36, CEST, Hal Daume III wrote:
   [...]
  
   A few people have asked me for speed-up results from 
  All-In-One-ifying code,
   so here's a good one.  We take two versions of NHC.  One is 
  the original
   binary distribution and the other is the All-In-One-ified 
  version, compiled
   by GHC.
  
  Hi,
  
  is the original binary distribution compiled with GHC? If 
  not, the speed-up 
  may also be the result of using a different compiler (i.e., GHC).
  
   [...]
  
  Wolfgang
  
  ___
  Haskell mailing list
  [EMAIL PROTECTED]
  http://www.haskell.org/mailman/listinfo/haskell
  
 -- 
 Haskell mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/haskell
 

-- 
---
John Meacham - California Institute of Technology, Alum. - [EMAIL PROTECTED]
---
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Type design question

2003-07-30 Thread Ross Paterson
On Wed, Jul 30, 2003 at 02:04:22PM +1000, Andrew J Bromage wrote:
 On Tue, Jul 29, 2003 at 12:11:29PM +0200, Konrad Hinsen wrote:
  I think that C++ was a lot worse, even the accepted features (e.g. templates) 
  didn't work the same with all compilers. All non-trivial code came with a 
  list of supported compilers.
 
 True.  If we had more Haskell implementations, we might be in the
 same boat.
 
 Our situation is much simpler.  Code is either written for Haskell 98,
 or for Glasgow extensions.

Almost.  There's Haskell 98, H98 plus common extensions (the baseline
for the hierarchical libraries), a larger language accepted by both GHC
and Hugs, and then there's GHC.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Useful list output function

2003-07-30 Thread Shawn P. Garbett
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I've got a little function which I derived from Bird's book Intro to 
Functional Programming using Haskell.

Basically I had several instances of lists that needed outputing with all 
kinds of text decoration. This function was used repeatedly throughout the 
code, by removing all the cut and paste instances, this was the common 
function:

output  :: (a - IO b) - [a] - IO ()
output f = (foldr () (return ())).(map f)

So given a function that transforms a value of type 'a' into an output of 'IO' 
and a list of 'a', all IO is performed across the list. 

Example usage:
output f [1,2,3] where f a = putStr (List contains ++(show a)++\n))
- --
List contains 1
List contains 2
List contains 3

Probably not very exciting for the old hats at Haskell, but pretty handy to 
have around at my level of expertise.


Shawn

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (GNU/Linux)

iEYEARECAAYFAj8oIdAACgkQDtpPjAQxZ6AC0ACaA8boOZc8Hjmp9rTAyZ00lPLX
QwkAniPsBPHUvBfUcsZlU6TvF1pzkTox
=3aEG
-END PGP SIGNATURE-

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


CSV parser, quotes?

2003-07-30 Thread Shawn P. Garbett
In attempting to improve the CSV parser based on comments, I have the 
following code that's attached. I'm having a heck of a time getting the 
double quotes = an escaped quote thing to work. There is some commented out 
code which was my last attempt. As it stands the code works, minus the 
escaped quotes. Remove the comments and it just hangs.

module CSV (contents, csv) where

import Parsec

--
-- CSV Module 
--

-- Useful common parsers
comma :: Parser Char
comma  = char ','

quote :: Parser Char
quote  = char '\'

-- How to handle these buggers
--esc_quote :: Parser Char
--esc_quote  = do {char '\'; char '\';}

--text  :: Parser String
--text   = do {esc_quote; t-text; return ('\':t)}
-- | do {c - noneOf \; t-text; return (c:t) } 
-- | return 

-- A cell can be a quoted value, a number or empty
-- Quotes can be embedded by using double quotes 
cell  :: Parser String
cell   = between quote quote (many (noneOf \)) -- quoted values
--cell   = between quote quote text -- quoted values
 | many1 (noneOf \,\n)   -- unquoted values
 | return -- give up, Empty cell   

-- Group of cells with a newline
cells :: Parser [String]
cells  = do c - sepBy cell comma
newline
return c

-- Comma Separated Values, set of rows followed by eof
csv   :: Parser [[String]]
csv= manyTill cells eof

-- Useful For extracting comma delimited values of a cell
contents  :: Parser [String]
contents   = sepBy1 (many (noneOf ,)) comma

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


RE: Useful list output function

2003-07-30 Thread Kevin S. Millikin
On Wednesday, July 30, 2003 1:52 PM, Shawn P. Garbett 
[SMTP:[EMAIL PROTECTED] wrote:

 output  :: (a - IO b) - [a] - IO ()
 output f = (foldr () (return ())).(map f)

Study the Prelude :)

 output :: (a - IO b) - [a] - IO ()
 output = mapM_


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


Re: CSV parser, quotes?

2003-07-30 Thread Graham Klyne
The Parsec library code contains string-parsing (with escapes) that you 
might be able to use or canibalize.  See 'StringLiteral' et seq in 
ParsecToken.hs.  The escape handling there is a fair amount of code, bit it 
covers a lot of escape options.

#g
--
At 14:54 30/07/03 -0500, Shawn P. Garbett wrote:
In attempting to improve the CSV parser based on comments, I have the
following code that's attached. I'm having a heck of a time getting the
double quotes = an escaped quote thing to work. There is some commented out
code which was my last attempt. As it stands the code works, minus the
escaped quotes. Remove the comments and it just hangs.
module CSV (contents, csv) where

import Parsec

--
-- CSV Module
--
-- Useful common parsers
comma :: Parser Char
comma  = char ','
quote :: Parser Char
quote  = char '\'
-- How to handle these buggers
--esc_quote :: Parser Char
--esc_quote  = do {char '\'; char '\';}
--text  :: Parser String
--text   = do {esc_quote; t-text; return ('\':t)}
-- | do {c - noneOf \; t-text; return (c:t) }
-- | return 
-- A cell can be a quoted value, a number or empty
-- Quotes can be embedded by using double quotes 
cell  :: Parser String
cell   = between quote quote (many (noneOf \)) -- quoted values
--cell   = between quote quote text -- quoted values
 | many1 (noneOf \,\n)   -- unquoted values
 | return -- give up, Empty 
cell

-- Group of cells with a newline
cells :: Parser [String]
cells  = do c - sepBy cell comma
newline
return c
-- Comma Separated Values, set of rows followed by eof
csv   :: Parser [[String]]
csv= manyTill cells eof
-- Useful For extracting comma delimited values of a cell
contents  :: Parser [String]
contents   = sepBy1 (many (noneOf ,)) comma
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
---
Graham Klyne
[EMAIL PROTECTED]
PGP: 0FAA 69FF C083 000B A2E9  A131 01B9 1C7A DBCA CB5E
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: synchronizing MVar ( was compiling concurrent haskell with ghc )

2003-07-30 Thread Dennis Sidharta
Hi again,

I have tried to play around with MVar today, but
still... I did not see how to synchronize MVar without
the help of forkIO, and then explicitly call yield ::
IO (). But then, if I use forkIO I will create daemon
threads that will cause my program to terminates
immediately (back to the original problem).

I attached the source code to this email.

ps: If you can tell the depth of my understanding of
concurrent Haskell from my code, please do not
hesitate to evaluate it (Eg. am I using MVar
correctly? Any better method? etc.), since I am really
new to concurrent Haskell. Thanks.

Again, thank you for the help.


Sincerely,

Dennis Sidharta



--- Sven Panne [EMAIL PROTECTED]
wrote:
 Dennis Sidharta wrote:
  [ problems with concurrent Haskell ]
 
 I can see two problems in your code:
 
 * forkIO creates daemon threads, so the program
 terminates immediately.
 
 * Chan is an unbounded channel, so you won't get a
 ping pong, which
is probably what you expected. MVar is your
 friend here.
 
 See

http://haskell.org/ghc/docs/latest/html/base/Control.Concurrent.html
 
 Cheers,
 S.
 
 

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

mySource.hs
Description: mySource.hs


Linking to exported GHC functions.

2003-07-30 Thread Thomas L. Bevan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Could someone give me a command line example of how to link a C programme 
using functions exported via GHC FFI?

I've compile C object files using an FFI function but can't for the life 
of me work out what arguments to pass to the compiler to make it link 
correctly. 


Thanks,

Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/KTyZYha8TWXIQwoRAlAwAKDu/gh3/TVvrVo8Damrr5K8YvbGgACgsz17
2MZqp/GG0K51O+6Gn829I0A=
=mIS3
-END PGP SIGNATURE-

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