[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] 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.netâjohnâ 
___
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


[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


[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 (sd&m 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 Co

[Haskell] Second Call for Papers for International Workshop on Foundations of Software Engineering (FSEN'05)

2005-04-12 Thread fsen05
Our apologies if you have received multiple copies.
-
  Second Call for Papers
IPM International Workshop on Foundations of Software Engineering
   (FSEN 2005)
   1-3 October 2005, Tehran, Iran.
  http://cs.ipm.ac.ir/FSEN05


FSEN 2005 is an international workshop organized by the Institute for
Studies in Theoretical Physics and Mathematics (IPM) in Iran
(http://www.ipm.ac.ir).

Workshop goals
--

The aim of the workshop is to bring together researchers and
practitioners working on different aspects of formal methods in software
engineering. The specific goal is to facilitate transfer of experience,
adaptation of methods, and where possible, collaboration between
different groups.  The topics may cover any aspect in formal methods,
especially those related to advancing the application of formal methods
in software industry and promoting their integration with practical
engineering techniques.

Topics of interest
--

The topics of this workshop include, but are not restricted to, the
following:

* Models of programs and systems
* Software specification, validation and verification
* Software architectures and their description languages
* Object and multi-agent systems
* Coordination and feature interaction
* Integration of formal and informal methods
* Integration of different formal methods
* Component-based development
* Service-oriented development
* Model checking and theorem proving
* Software and hardware verification
* CASE tools and tool integration
* Application to industrial cases

Proceedings
---

Accepted papers will be available at the workshop in a pre-proceedings
published by IPM. A post-proceedings will be published in the Elsevier's
ENTCS conference series.  Selected papers will also be published in a
special issue of a journal (to be confirmed).


Best Paper Award


There will be an award for the best paper.


Important Dates
---

* June 1, 2005: Submissions deadline
* July 15, 2005: Notification of authors
* August 1, 2005: Camera ready copies deadline
* October 1-3, 2005: FSEN workshop


Submissions
---

The length of each paper including figures and references must not
exceed the maximum size of 15 ENTCS style pages. All papers must be
submitted in PDF or postscript format. Papers are to be sent to the
following email address: [EMAIL PROTECTED]

Submissions should explicitly state their contribution and their
relevance to the theme of the workshop. Other criteria for selection
will be originality, significance, correctness, and clarity.

Simultaneous or similar submissions to other conferences or journals are
not allowed.


Workshop Chair
--

Ali Movaghar
Sharif University of Technology, Iran
IPM, Iran

PC Chairs
-

Farhad Arbab
CWI, Netherlands
Leiden University, Netherlands
University of Waterloo, Canada

Marjan Sirjani
Tehran University, Iran
IPM, Iran

Local Organization Chair

Marjan Sirjani
Tehran University, Iran
IPM, Iran

Program committee
-

* Farhad Arbab - CWI, Netherlands;  Leiden University, Netherlands; 
University of Waterloo, Canada
* Mohammad Ardeshir - Sharif University of Technology, Iran
* Christel Baier - University of Bonn, Germany
* Frank de Boer - CWI, Netherlands; Leiden University, Netherlands
* Marcello Bonsangue - Leiden University, Netherlands
* Franck van Breugel - York University, Canada
* James C. Browne - Texas University, USA
* Michael Butler - University of Southampton, UK
* Marsha Chechik - University of Toronto, Canada
* Dennis Dams - Bell Labs, USA
* Nancy Day - University of Waterloo, Canada
* Maurizio Gabbrielli - University of Bologna, Italy
* Yuri Gurevich - Microsoft Research, USA
* Joost Kok  - Leiden University, Netherlands
* Marta Kwiatkawska, University of Birmingham, UK
* Mohammad Reza Meybodi - AmirKabir University of Technology, Iran
* Seyyed Hassan Mirian - Sharif University of Technology, Iran
* Ali Movaghar - Sharif University of Technology, Iran; IPM, Iran
* Andrea Omicini - University of Bologna, Italy
* George Papadopoulos - University of Cyprus, Cyprus
* Willem-Paul de Roever - University of Kiel, Germany
* Jan Rutten - CWI, Netherlands; Vrije University Amsterdam, Netherlands
* Mohsen Sharifi, Iran University of Science and Technology, Iran
* Sandeep Shukla- Virginia Tech, USA
* Marjan Sirjani - Tehran University, Iran; IPM, Iran
* Alan Wassyng - McMaster University, Canada

Invited Speakers


(to be confirmed)


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

[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