GetOpt is broken

2005-04-12 Thread Volker Wysk
Hello.

In GHC 6.4, GetOpt no longer recognizes the -- argument, which terminates 
interpretation of arguments beginning with - as switches:


import System.Console.GetOpt
import System

main = do
   args - getArgs
   let (_,_,f) = getOpt Permute [Option a [] (OptArg (const ()) xxx) ]
args
   print f


/tmp $ ./getopt -- -1
[unrecognized option `-1'\n]


It works okay with GHC 6.2.2.

Bye,
V.W.
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1178851 ] double-panic with GADTs

2005-04-12 Thread SourceForge.net
Bugs item #1178851, was opened at 2005-04-07 13:39
Message generated for change (Comment added) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1178851group_id=8032

Category: Compiler (Type checker)
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: double-panic with GADTs

Initial Comment:
ghc-6.4: panic! (the `impossible' happened, GHC version
6.4):
cgPanic
deref{v a1yz}
static binds for:
local binds for:
SRT labelghc-6.4: panic! (the `impossible'
happened, GHC version 6.4):
initC: srt

Please report it as a compiler bug to
glasgow-haskell-bugs@haskell.org,
or http://sourceforge.net/projects/ghc/.

I've attached a test driver that can reproduce the problem.

-- Esa Pulkkinen [EMAIL PROTECTED]


--

Comment By: Nobody/Anonymous (nobody)
Date: 2005-04-12 03:39

Message:
Logged In: NO 

The short version is a great help.

I think this program should yield a type error. The value of foo
here is a component of the local variable x, and therefore
should
be unavailable to the left of -.  I've no idea how to
implement it,
though -- presumably a constraint on the free type vars on the
left of -.

-- Ross

--

Comment By: Nobody/Anonymous (nobody)
Date: 2005-04-07 16:00

Message:
Logged In: NO 

Fwiw, here's a trimmed-down version of the above program.

{-# OPTIONS -farrows -fglasgow-exts #-}
class Foo a where foo :: a - ()
data Bar = forall a. Foo a = Bar a

get :: Bar - ()
get = proc x - case x of Bar a - do foo - a

-- Thomas Jäger [EMAIL PROTECTED]


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1178851group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1178851 ] double-panic with GADTs

2005-04-12 Thread SourceForge.net
Bugs item #1178851, was opened at 2005-04-07 13:39
Message generated for change (Comment added) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1178851group_id=8032

Category: Compiler (Type checker)
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: double-panic with GADTs

Initial Comment:
ghc-6.4: panic! (the `impossible' happened, GHC version
6.4):
cgPanic
deref{v a1yz}
static binds for:
local binds for:
SRT labelghc-6.4: panic! (the `impossible'
happened, GHC version 6.4):
initC: srt

Please report it as a compiler bug to
glasgow-haskell-bugs@haskell.org,
or http://sourceforge.net/projects/ghc/.

I've attached a test driver that can reproduce the problem.

-- Esa Pulkkinen [EMAIL PROTECTED]


--

Comment By: Nobody/Anonymous (nobody)
Date: 2005-04-12 09:22

Message:
Logged In: NO 

Thank you, this information allowed me to find a workaround.
I need to just use - instead of - for this, and the
problem disappears.

-- Esa Pulkkinen [EMAIL PROTECTED]

--

Comment By: Nobody/Anonymous (nobody)
Date: 2005-04-12 03:39

Message:
Logged In: NO 

The short version is a great help.

I think this program should yield a type error. The value of foo
here is a component of the local variable x, and therefore
should
be unavailable to the left of -.  I've no idea how to
implement it,
though -- presumably a constraint on the free type vars on the
left of -.

-- Ross

--

Comment By: Nobody/Anonymous (nobody)
Date: 2005-04-07 16:00

Message:
Logged In: NO 

Fwiw, here's a trimmed-down version of the above program.

{-# OPTIONS -farrows -fglasgow-exts #-}
class Foo a where foo :: a - ()
data Bar = forall a. Foo a = Bar a

get :: Bar - ()
get = proc x - case x of Bar a - do foo - a

-- Thomas Jäger [EMAIL PROTECTED]


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1178851group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[ ghc-Bugs-1162969 ] Over-zealous dup-import warning

2005-04-12 Thread SourceForge.net
Bugs item #1162969, was opened at 2005-03-14 23:56
Message generated for change (Comment added) made by fergus
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1162969group_id=8032

Category: Compiler
Group: None
Status: Open
Resolution: None
Priority: 4
Submitted By: Simon Peyton Jones (simonpj)
Assigned to: Simon Peyton Jones (simonpj)
Summary: Over-zealous dup-import warning

Initial Comment:
Pointed out by John Meacham [EMAIL PROTECTED]

In 6.4 the duplicate import warning seems to be 
triggered overzealously, even
when one import is qualified and the other isn't.


import qualified Data.Map 
import Data.Map(Map)

foo :: Map Int Int
foo = Data.Map.empty
 
main = do
print foo

produces:
 Foo.hs:1:0:
Warning: `Map' is imported more than once:
   imported from Data.Map at Foo.hs:3:16-18
   imported from Data.Map at Foo.hs:2:0-24

--

Comment By: Fergus Henderson (fergus)
Date: 2005-04-13 09:06

Message:
Logged In: YES 
user_id=135331

Yes, this one is a pain -- it would be great if someone
would fix this.
The only work-around I have at the moment is to use -Wall
-fno-warn-unused-imports instead of -Wall.
   - Fergus Henderson.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=108032aid=1162969group_id=8032
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: GetOpt is broken

2005-04-12 Thread Wolfgang Thaller
Volker Wysk wrote:
Hello.
In GHC 6.4, GetOpt no longer recognizes the -- argument, which 
terminates
interpretation of arguments beginning with - as switches:
Thanks for the report. This bug is already fixed in CVS.
Cheers,
Wolfgang
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


RE: installing ghc without already having ghc

2005-04-12 Thread Simon Marlow
On 11 April 2005 16:44, Jessica Brennan wrote:

 cd H/ghc  make boot  make
 in section 10.2.1 of the build guide.
 
 Actually I just double checked and I don't get those lines of the
 error when doing cross-compiling.
 Sorry grabbed the first set of errors I saw. It is the same minus
 those test messages for the cross-compiling:
 


 ==fptools== gmake all -r;
   in /devel/build/NetBSD/ghc/ghc-6.4-host/ghc/compiler


 
 /usr/local/bin/ghc -H16m -O -H32m  -istage1/utils  -istage1/basicTypes
 -istage1/types  -istage1/hsSyn  -istage1/prelude  -istage1/rename
 -istage1/typecheck  -istage1/deSugar  -istage1/coreSyn
 -istage1/specialise  -istage1/simplCore  -istage1/stranal 
 -istage1/stgSyn 
 -istage1/simplStg  -istage1/codeGen  -istage1/main  -istage1/profiling
 -istage1/parser  -istage1/cprAnalysis  -istage1/compMan
 -istage1/ndpFlatten  -istage1/iface  -istage1/cmm -Istage1
 -DOMIT_NATIVE_CODEGEN -cpp -fglasgow-exts -fno-generics -Rghc-timing
 -I. 
 -IcodeGen -InativeGen -Iparser -package unix -recomp -Rghc-timing -O
 -fasm 
 -H16M '-#include hschooks.h' -i../lib/compat-c
 utils/PrimPacked.lhs 
 -o stage1/utils/PrimPacked.o  -ohi stage1/utils/PrimPacked.hi
 
 utils/PrimPacked.lhs:244:
  Warning: foreign declaration uses deprecated non-standard syntax
 
 utils/PrimPacked.lhs:248:
  Warning: foreign declaration uses deprecated non-standard syntax
 
 utils/PrimPacked.lhs:251:
  Warning: foreign declaration uses deprecated non-standard syntax
 
 utils/PrimPacked.lhs:254:
  Warning: foreign declaration uses deprecated non-standard syntax
 
 utils/PrimPacked.lhs:257:
  Warning: foreign declaration uses deprecated non-standard syntax
 ghc-6.2.1: panic! (the `impossible' happened, GHC version 6.2.1):
  This compiler was built without a native code generator
  Use -fvia-C instead
 
 Please report it as a compiler bug to
 glasgow-haskell-bugs@haskell.org, or
 http://sourceforge.net/projects/ghc/. 

Ok, the instructions have a slight mistake, we shouldn't be using the
-fasm flag to build stage 1.  I'm not sure how that crept in, sorry.

Just remove -fasm from GhcStage1HcOpts in mk/build.mk, that should fix
it.

By the way, I'm guessing you're on a Sparc box, is that right?  If so,
others have reported problems on Sparc with 6.4, so you might run into
difficulties.  We're lacking a Sparc guru at the moment.

Cheers,
Simon
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell] Formal Methods 2005: Call for Participation

2005-04-12 Thread events-admin
(With apologies for multiple copies)

Formal Methods 2005 (FM'05)
18-22 July 2005
Newcastle upon Tyne, UK

First Call for Participation

www.csr.ncl.ac.uk/fm05

It is our pleasure to invite you to attend FM'05, the leading
international conference for  researchers and practitioners in formal
methods for the development of computing systems. This  year, the
conference is being held at the University of Newcastle upon Tyne, UK on
18-22 July.

Formal methods continue to have a major impact on systems and software
engineering, especially in  areas where dependability, security and trust
matter. FM'05 aims to publish the latest  developments of interest to
researchers and practitioners alike. The outstanding programme of 
tutorials and workshops (listed overleaf) covers the range from circuit
design, through high  integrity programming to fault tolerance,
architectures and automated reasoning. Wednesday 20th  July is a special
Industry Day, with a series of invited talks on experiences of formal
methods  going mainstream.  The programme of around 30 research papers,
announced in mid-April, will  provide an opportunity to get up to date in
all these areas and more.  Alongside the tutorials,  workshops and
research symposium, there will be displays of tools, products, research
projects  and publishers.

FM'05 is being held in one of England's most dynamic cities, famous for
its captivating welcome,  and situated at the heart of an historic and
beautiful region. There will be plenty of  opportunity for informal
discussion: social activities include a reception at the Hatton  Gallery
and conference dinner in Alnwick Castle and Gardens.

We look forward to welcoming you to Newcastle in July!

John Fitzgerald, General Chair
Ian Hayes, Andrzej Tarlecki, Programme Chairs


TO REGISTER
download a registration form from www.csr.ncl.ac.uk/fm05 or
contact the Organiser:  Claire Smith,
Tel: +44 (0) 191 222 7999
Fax: +44 (0) 191 222 8788
Email:[EMAIL PROTECTED]

---  ---  ---  ---  ---  ---  ---  ---

OUTLINE OF EVENTS

Full Scientific Programme 20-22 July
Invited Speakers:
Mathai Joseph (Tata Research  Development, Pune, India)
Marie-Claude Gaudel (Université de Paris-Sud, France)
Chris Johnson (University of Glasgow, UK)


Industry Day 20 July:
Formal Methods Going Mainstream - Costs, Benefits and Experiences
contributions from Microsoft, Intel, Embedded Systems Institute, ETH
Zürich and Verum Consultants. Industry Day is sponsored by SAP Research.


Co-located Conferences (18-19 July):
Calculemus 2005
Formal Aspects of Security and Trust (FAST) 2005


Workshops (18-19 July):
Grand Challenge Workshop on Dependable Systems Evolution
Web Languages and Formal Methods (WLFM 2005)
Overture - the future of VDM and VDM++
Practical Applications of Stochastic Modelling (PASM 2005)
Workshop on Rigorous Engineering of Fault Tolerant Systems (REFT 2005) The
Railway Domain (TRain 2005)


Tutorials (18-19 July):
The Spec# Programming System: an Overview
Formal Aspects of Software Architecture
Increasing Dependability of Smart Card Based Systems
Perfect Developer
SPARK
Petri-nets and Role Models as Intermediate Level Tools for Asynchronous
Circuit  Systems Design Verifying Industrial Control System Software
Formal Engineering Methods for Industrial Software Development
Modelling Languages Spectrum
Formal Methods as a Unifying Basis for Electrical and Computer Engineering
Design by Contract and Automatic Verification for Java with JML and
ESC/Java 2 Introduction to CSP and FDR

TO REGISTER
download a registration form from www.csr.ncl.ac.uk/fm05 or
contact the Organiser:  Claire Smith,
Tel: +44 (0) 191 222 7999
Fax: +44 (0) 191 222 8788
Email:[EMAIL PROTECTED]


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


[Haskell] GTTSE Summer School: Early registration deadline April 15

2005-04-12 Thread Joost Visser
This is a reminder that the deadline for early registration for the 
Summer School on Generative and Transformational Techniques in Software 
Engineering (GTTSE 2005), to be held in Braga, Portugal, from July 4 to 
8, 2005, is:

 *** Early Registration Deadline: April 15, 2005 ***
Online registration can be done via the GTTSE website at:
 http://www.di.uminho.pt/GTTSE2005
For more details, please consult the website or the call for 
participation below.

--
Dr. ir. Joost Visser   | Departamento de Informática
phone  +351-253-604461 | Universidade do Minho
fax+351-253-604471 | mailto:[EMAIL PROTECTED]
mobile +351-91-6253618 | http://www.di.uminho.pt/~joost.visser
-
Summer School on
Generative and Transformational Techniques
in Software Engineering
4 - 8 July, 2005, Braga, Portugal
http://www.di.uminho.pt/GTTSE2005
SCOPE AND FORMAT
The summer school brings together PhD students, lecturers, technology
presenters, as well as other researchers and practitioners who are
interested in the generation and the transformation of programs, data,
models, meta-models, and documentation. This concerns many areas of
software engineering: software reverse and re-engineering,
model-driven approaches, automated software engineering, generic
language technology, to name a few. These areas differ with regard to
the specific sorts of meta-models (or grammars, schemas, formats etc.)
that underly the involved artifacts, and with regard to the specific
techniques that are employed for the generation and the transformation
of the artifacts. The tutorials are given by renowned representatives
of complementary approaches and problem domains. Each tutorial
combines foundations, methods, examples, and tool support. The program
of the summer school also features invited technology presentations,
which present setups for generative and transformational
techniques. These presentations complement each other in terms of the
chosen application domains, case studies, and the underlying
concepts. Furthermore, the program of the school also features a
participants workshop. All students of the summer school will be
invited to give a presentation about their ongoing work. They will be
asked to submit a title and an abstract beforehand. The senior
researchers present at the summer school will provide the students
with feedback on their presentations. All summer school material will
be collected in proceedings that are handed out to the
participants. Formal proceedings will be compiled after the summer
school, where all contributions are subjected to additional
reviewing. The formal proceedings will be published in the Lecture
Notes in Computer Science series of Springer.
TUTORIALS
* Don Batory (The University of Texas at Austin):
  Feature Oriented Programming
* Ira Baxter (Semantic Designs Inc.):
  Compiling Fast XML reader/writers from DTDs using Program 
Transformations

* Jean Bezivin (INRIA, LINA, University of Nantes):
  Metamodelling and Model Driven Software Development
* Shigeru Chiba (Tokyo Institute of Technology):
  Program Transformation With Reflective and Aspect-Oriented Programming
* Jean-Luc Hainaut (University of Namur):
  The Transformational Approach to Database Engineering
* Zhenjiang Hu (University of Tokyo):
  Program Optimization and Transformation in Calculational Forms
* Erik Meijer (Microsoft, Redmond):
  Object, relational, and XML mapping
* Tom Mens (University of Mons-Hainaut):
  On the Use of Graph Transformations for Model Refactoring
TECHNOLOGY PRESENTATIONS
The purpose of the technology presentations is to supplement the
theoretical knowledge acquired in the tutorials with practical
knowledge of how generative and transformational tool support can be
instrumental in solving software engineering problems. Technology
presentations can include, but are not limited to demonstration of the
features of a single tool. Rather, they include:
* Reference to the concepts behind the technology
* Application of the technology to a case study of non-trivial scale
* Clear statement of benefits and limitations of the technology
The participants will have ample opportunity to interact in informal
manner with the technology presenters.
Confirmed technology presentations:
(Note: titles and authors abbreviated)
* Mark van den Brand (CWI  HvA, The Netherlands) et al.:
  Applications of the ASF+SDF Meta-Environment
* Martin Bravenboer (Utrecht University, The Netherlands) et al.:
  Domain-specific Language Embedding using Stratego/XT and MetaBorg
* Thomas R. Dean (Queen's University, Canada):
  Applications of Agile Parsing To Web Services
* Helena Galhardas (IST Tagus Park, Portugal):
  Data cleaning and transformation using te AJAX framework
* Dirk Heuzeroth (sdm AG, Germany) et al.:
  A Tool Suite for Invasive Software Composition
* Frederic Jouault (UniversitÈ de Nantes, France):
  Model Transformation and Weaving Tools in the AMMA Platform
* Guenter Kniesel (University of Bonn):
  Refactoring based on 

[Haskell] Post-doc position in Martin Odersky's group, EPFL, Switzerland

2005-04-12 Thread Martin Odersky

EPFL Lausanne
  Programming Methods Group
 Prof. Martin Odersky

We have an open position for a postdoctoral researcher in the
Programming Methods Group at EPFL. The research of our group is
centered on Scala, a new programming language which fuses functional
and object-oriented programming and which interoperates at the same
time with Java and .NET. Scala pushes the state of the art in type
systems for component abstractions and composition. It also provides
many new concepts for web programming.

Here are some of our current research directions:

 - Further developments in the Scala language design
 - High-level optimizations
 - Type systems for object-oriented and functional languages
 - Programming language support for XML
 - Component technology.
 - Reliable software, verification, testability.

If you work in some of these research areas and are interested in both
system building and theory, you will find an active and friendly
research environment at Lausanne.

The appointment is for one year initially with renewals possible up to
three years. The position is open from June, 2005, but later starting
dates can also be considered. Compensation is competitive at CHF 80K+
(1 CHF ~~ 0.83 U.S$), depending on age and experience.

Informal inquiries about the position may be addressed to
[EMAIL PROTECTED] Formal applications should be sent by e-mail
to the following address:

  Mme Yvette Dubuis
  [EMAIL PROTECTED]
  Tel. +41 21 693 5202
  Fax  +41 21 693 6660

To be guaranteed full consideration, applications should be received
by May 15th, 2000. Applications should consist of a curriculum vitae,
a publication list, and the names of three personal references. Please
ask your references to send their letters directly to
[EMAIL PROTECTED]

EPFL Lausanne is one of two federal universities in Switzerland. It
has one of the most nationally diverse research, teaching and learning
communities in Europe.  Lausanne is situated in very attractive
surroundings in the French-speaking part of Switzerland, on the shore
of Lake Geneva, in close proximity to the Alps.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


RE: [Haskell] pretty printing Haskell code with auto parens?

2005-04-12 Thread Conal Elliott








No reply yet.



Alternatively, does anyone happen to have a
HsExp-HsExp (for Language.Haskell.Syntax) pass that inserts disambiguating parentheses
as needed, to be applied just before pretty-printing?



Cheers,



- Conal



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Conal Elliott
Sent: Friday, April 08, 2005 3:54 PM
To: haskell@haskell.org
Subject: [Haskell] pretty printing
Haskell code with auto parens?



What pretty printers are available
for Haskell code (not necessarily complete) that handle automatic insertion of
minimally required parentheses? I
assumed that Language.Haskell.Pretty did that, but apparently it relies on
manual insertion of parentheses in the abstract syntax.



Thanks, - Conal






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


Re: [Haskell] pretty printing Haskell code with auto parens?

2005-04-12 Thread John Meacham
On Tue, Apr 12, 2005 at 06:33:13PM -0700, Conal Elliott wrote:
 No reply yet.
  
 Alternatively, does anyone happen to have a HsExp-HsExp (for
 Language.Haskell.Syntax) pass that inserts disambiguating parentheses as
 needed, to be applied just before pretty-printing?

There is one included in 'hatchet' which I have succescfully reused in
other projects. A bug is that it doesn't refix infix patterns, but that
should be easy to fix.

 http://www.cs.mu.oz.au/~bjpop/hatchet.html

You will probably have to write something to collect fixities from
imported modules.


-- 
John Meacham - repetae.netjohn 
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Control.Monad.Writer as Python generator

2005-04-12 Thread ChrisK
Hi,
I was thinking to myself:
What in Haskell would give me a yield command like a Python generator?
And the answer was tell in Control.Monad.Writer -- and I wrote some  
simple examples (see below).

Most Python code using yield would be translated to something much more  
idiomatic in Haskell than using Writer, or to something more  
complicated if it needed IO.

I thought this interesting enough to put on the haskell mailing list  
and wiki since it seemed to be in neither place (I searched, but your  
searching may be better than mine).

If there are no objections then I'll put this example on the wiki; any  
suggestions where on wiki to place it (e.g. MonadWriter)?

=== CUT HERE ===
import Control.Monad.Writer
-- Some type signatures would need -fglasgow-exts to compile
-- We only care about the Writer output, not the function return value
asGenerator :: Writer [a] v - [a]
asGenerator writer = values where (_,values) = runWriter writer
--yield :: (MonadWriter [a] m) = a - m ()
yield x = tell [x]
-- This allows several items to be yielded with one command
--yieldMany :: (MonadWriter [a] m) = [a] - m ()
yieldMany = tell
zeros :: [Integer]
zeros = asGenerator (do yield 0
yield 0
yield 0)
zerosInf :: [Integer]
zerosInf = asGenerator zeros'
where zeros' = (yield 0 zeros')
-- The Collatz sequence function
foo :: (Integral a) = a - a
foo x = case (x `mod` 2) of
 0 - x `div` 2
 1 - (3*x+1)
-- Uses return () to end the list when 1 is reached
--collatzW :: (MonadWriter [a] m, Integral a) = a - m ()
collatzW x = do
   yield x
   case x of
 1 - return ()
 _ - collatzW (foo x)
-- Keeps going, will repeat 1,4,2,1,.. if 1 is reached
--collatzInfW :: (MonadWriter [a] m, Integral a) = a - m t
collatzInfW x = do
  yield x
  collatzInfW (foo x)
--collatzGen :: (MonadWriter [a] (Writer [a]), Integral a) = a - [a]
collatzGen x = asGenerator (collatzW x)
--collatzInfGen :: (MonadWriter [a] (Writer [a]), Integral a) = a -  
[a]
collatzInfGen x = asGenerator (collatzInfW x)

-- And these can be combined
collatz1 x = asGenerator (collatzW x  yield 0  collatzW (x+1))
=== CUT HERE ===
*Main zeros
[0,0,0]
*Main take 10 zerosInf
[0,0,0,0,0,0,0,0,0,0]
*Main collatzGen 13
[13,40,20,10,5,16,8,4,2,1]
*Main take 100 $ collatzInfGen 13
[13,40,20,10,5,16,8,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2, 
1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2, 
1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1]

*Main collatz1 12
[12,6,3,10,5,16,8,4,2,1,0,13,40,20,10,5,16,8,4,2,1]
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell-cafe] Installing and running QuickCheck

2005-04-12 Thread Daniel Fischer
Hm,

no instance Arbitrary Char is provided in the QuickCheck modules that came 
with my hugs or ghc. Probably the author just forgot to import Data.Char. Try 
inserting that in QuickCheck.hs.

Hope that works,
Daniel

Am Samstag, 9. April 2005 21:10 schrieb Adam Wyner:
 Hi,

 I'd like to use QuickCheck for testing Haskell programs.  I'm using Hugs
 in Windows.  I'm a newbie to Haskell.

 Just running QuickCheck.hs itself, which comes with the Hugs98
 libraries, I get an error message and the Monad command line, which
 indicates that quickcheck didn't load.

 ERROR C:\Program Files\Hugs98/libraries\QuickCheck.hs:147 - Undefined
 variable  chr
 Monad

 Here is the line in QuickCheck.hs which leads to the error.

 instance Arbitrary Char where
arbitrary = choose (32,255) = \n - return (chr n)
coarbitrary n = variant (ord n)

 This code is from the website:

 http://www.cs.chalmers.se/~rjmh/QuickCheck/QuickCheck.hs

 I tested it with the following module, as per the instructions in on
 QuickCheck's manual page:
 
 module TestQuickCheck

 where

 import QuickCheck

 prop_RevRev xs = reverse (reverse xs) == xs
where types = xs::[Int]
 
 Loading just this, I get the same error:

 Prelude :l TestQuickCheck
 ERROR C:\Program Files\Hugs98/libraries\QuickCheck.hs:147 - Undefined
 variable
   chr
 Monad

 I know others report using QuickCheck, so this problem must have been
 resolved.

 Also, I guess the quickcheck script is for Linux alone?  Any scripts for
 Hugs in Windows?

 Cheers,
 Adam

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


[Haskell-cafe] predicates in XML toolboxes

2005-04-12 Thread Henning Thielemann
The XML toolboxes HaXml, HXML and the XML toolbox uses one function type 
(called filter) for different purposes.

The functions of types
predicates   a - Bool
selectors, transformatorsa - a
list-valued functionsa - [a]
are all implemented with the one type (a - [a]). In this design 
predicates don't return False or True, but an empty list or a one-element 
list containing the input value. Transformators return single element 
lists.
 In my opinion this means a significant loss of type safety and quality of 
documentation. Are there more type safe XML/HTML processor libraries in 
Haskell?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] predicates in XML toolboxes

2005-04-12 Thread Malcolm Wallace
Henning Thielemann [EMAIL PROTECTED] writes:

  predicates   a - Bool
  selectors, transformatorsa - a
  list-valued functionsa - [a]
 
 What about providing combinators for the most common cases and provide 
 lifting functions for the uncommon cases, such as
 
 liftPred :: (a - Bool) - (a - [a])
 liftPred p x = if p x then [x] else []
 
 liftTrans :: (a - b) - (a - [b])
 liftTrans f x = [f x]

Looks good.  If you want to come up with a concrete design for an fuller
set of alternative combinators, I'd be happy to include it into HaXml as
a further choice of facility.

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