[Haskell] [ANNOUNCE] New version of unicode CWString library with extras

2005-01-18 Thread John Meacham
A while ago I wrote a glibc specific implementation of the CWString
library. I have since made several improvements:

* No longer glibc specific, should compile and work on any system with
  iconv (which is unix standard) (but there are still glibc specific
  optimizations)
* general iconv library for conversion to any other supported character
  sets
* LocaleIO, a plug in replacement for many of the standard prelude and
  IO calls which transparently handle locale encoding. 

and best of all, it now has a darcs repository.  

 http://repetae.net/john/recent/out/HsLocale.html

It could still using some fleshing out, LocaleIO is still incomplete, I
add to it as I need a function,  but I figure I should make it available
in case the CWString stuff came in handy for implementing the FFI spec
for ghc.
John

PS. is there a way to replace the top level error handler in ghc? (from
a haskell library) I'd like to be able to print the error messages with
the LocaleIO library as it is the only place where the wrong encoding
still can leak out. 

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


Re: [Haskell] Implicit parallel functional programming

2005-01-18 Thread mgross




On Tue, 18 Jan 2005, Satnam Singh wrote:

> I'm trying to find out about existing work on implicit parallel functional 
> programming. I see that the Glasgow Haskell compiler has a parallel mode 
> which can be used with PVM and there is interesting work with pH at MIT. Does 
> anyone know of any other work on implicitly parallelizing functional programs 
> for fine grain parallel execution?
> 
> The emergence of multi-core processors makes me think that we should look at 
> implicit parallel functional programming in a new light.
> 
At Brooklyn College, we are working on a version of Parallel Haskell that
does not require PVM. Instead, we use Internet protocols and the Mosix
patches to Linux. 

Murray Gross
Brooklyn College, CUNY
Metis Project 


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


Re: [Haskell] Running haskell from within Haskell

2005-01-18 Thread Donald Bruce Stewart
vivian.mcphail:
> 
>Dear All,
>I have a parser which has entries for each word, such as:
> 
>ate  = s \ np / np  : ^x y.did(eat y x);
> 
>so each word has a type (s \ np / np) and a semantics (the
>lambda term ^x y.did(eat y x)).
> 
>Currently I parse the semantics into lambda terms and use my
>own lambda-interpreter to do evaluation.
> 
>"I ate a python programmer" would be evaluated as:
> 
>did(eat I (a python programmer))
> 
>What I would like to be able to do is actually use haskell
>functions in the semantic slot for each word.  This requires
>parsing a fragment of a file into haskell and then making it
>available as code within my program.
> 
>Is this possible?
> 
>for example:
> 
>kicked = s \ np / np : \x y -> case x of
> 
>(the bucket) = did(die
>y)
> 
>_= did(k
>ick y x);
> 
>Thanks in advance.

You may be able to use the eval functions provided by hs-plugins
http://www.cse.unsw.edu.au/~dons/hs-plugins/

A number of mini-edsl-interpreters for Haskell have been written this
way. Where:
eval :: Typeable a => String -> [Import] -> IO (Maybe a)

An example of an interpreter for Haskell, using this mechanism, is at:

http://www.cse.unsw.edu.au/~dons/hs-plugins/hs-plugins-Z-H-14.html#node_chap_B

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


[Haskell] Running haskell from within Haskell

2005-01-18 Thread Vivian McPhail



Dear All,
 
I have a parser which has entries for each word, such 
as:
 
ate  = s \ np / np  : ^x y.did(eat y 
x);
 
so each word has a type (s \ np / np) and a semantics (the 
lambda term ^x y.did(eat y x)).
 
Currently I parse the semantics into lambda terms and use my 
own lambda-interpreter to do evaluation.
 
"I ate a python programmer" would be 
evaluated as:
 
did(eat I (a python programmer))
 
What I would like to be able to do is actually 
use haskell functions in the semantic slot for each word.  This 
requires parsing a fragment of a file into haskell and then making it 
available as code within my program.
 
Is this possible?
 
for example:
 
kicked = s \ np / np : \x y -> 
case x of
(the bucket) = did(die y)
_= did(kick y x);
 
Thanks in advance.
 
Vivian
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: Happy 1.15

2005-01-18 Thread P.C.Callaghan


Hello,

> Does this mean that it is not possible to put multiple entry points
> into a GLR parser?

Correct: the GLR parser doesn't provide this standard Happy functionality.
There is the work-around that you mention.

I decided to leave %name out this time, mainly because of the possibility
of the workaround and because (I think) the issues are slightly different
in the GLR setting (see below). But it's on the list to add next time, and
shouldn't be too hard. The same for %partial.

Note that a GLR parser will handle a top rule which allows any of your
start symbols - ie, S/R and R/R conflicts won't be an issue as they would
be for standard Happy. If you are using Tree-decode mode, the top-level
rule will return values in some union of the separate parser results, and
it's a simple matter to then pick out the ones you want.

It's an open question whether this is better (since you can now do it),
compared to deciding in advance what you expect and then trying to parse
just that. Comments on this point are welcome!  I'm also interested in
examples where people want multiple entry points but want to work with
graphs (rather than decoding them).

Cheers,

Paul


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


[Haskell] Functional and Declarative Programming in Education 2005

2005-01-18 Thread S.J.Thompson



 Functional and Declarative Programming in Education (FDPE05)
 A one day workshop at ICFP05
 Sunday, 25 September 2005, Tallin, Estonia

 http://www.cs.kent.ac.uk/~sjt/fdpe05/

 FIRST CALL FOR SUBMISSIONS

 Overview

 Functional and declarative programming plays an important role in
 computing education at all levels. The aim of this workshop is to bring
 together educators and others who are interested in exchanging ideas on
 how to use a functional or declarative programming style in the classroom.


 Scope

 The workshop will cover a wide spectrum of functional and
 declarative programming techniques:

 - programming courses using traditional functional and declarative
   programming languages (Haskell, Mathematica, ML, Prolog, Scheme, ...);

 - programming courses teaching functional programming in commercial
   languages (e.g. C, C++, or Common LISP);

 - programming courses teaching functional program design in modern
   OO languages like Java, C#, or Eiffel;

 - pedagogic programming environments to support functional and
   declarative programming;

 - teaching tools implemented with functional and declarative languages;

 - declarative programming language extensions and implementations with
   pedagogical relevance;

 - application courses that benefit heavily from functional and
   declarative programming (e.g. theorem proving or hardware design).

 Furthermore, the workshop will also cover all levels of education:
 secondary school; college and university; post-college and continuing
 professional education.


 Submissions

 Submissions will be sought in two forms:

 - 30 minute papers, to be reviewed by the workshop organisers and to be
 published in the proceedings.

 - 10 minute slots for `tips and tricks': these will be made available
 through the workshop web site.

 Submissions will be refereed by the workshop organisers who will
 call upon other members of the functional/declarative programming
 community for expert advice.

 Participants who choose to deliver a standard presentation
 are asked to submit a draft PDF paper of five pages; presenters of
 short talks are asked to submit an abstract of 250 words. These should be
 submitted by June 4, 2005. Comments from the organizers and notice of
 acceptance will be sent to authors by July 15, 2005.

 Proceedings will be published by SIGPLAN. Details of the publication
 procedure will be given on the workshop web site in due course.


 Organisers

 Robby Findler, University of Chicago, USA
 Michael Hanus, University of Kiel, Germany
 Simon Thompson, University of Kent, UK

 FDPE05: http://www.cs.kent.ac.uk/~sjt/fdpe05/
 ICFP05: http://www.brics.dk/~danvy/icfp05/


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


Re: [Haskell] Implicit parallel functional programming

2005-01-18 Thread Sebastian Sylvan
On Tue, 18 Jan 2005 12:53:18 -0800, Satnam Singh <[EMAIL PROTECTED]> wrote:
> I'm trying to find out about existing work on implicit parallel functional 
> programming. I see that the Glasgow Haskell compiler has a parallel mode 
> which can be used with PVM and there is interesting work with pH at MIT. Does 
> anyone know of any other work on implicitly parallelizing functional programs 
> for fine grain parallel execution?
> 
> The emergence of multi-core processors makes me think that we should look at 
> implicit parallel functional programming in a new light.


Indeed. New tech often needs a "killer app", and for FP parallell
execution might just be it...

/S
-- 
Sebastian Sylvan
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Implicit parallel functional programming

2005-01-18 Thread Satnam Singh
I'm trying to find out about existing work on implicit parallel functional 
programming. I see that the Glasgow Haskell compiler has a parallel mode which 
can be used with PVM and there is interesting work with pH at MIT. Does anyone 
know of any other work on implicitly parallelizing functional programs for fine 
grain parallel execution?

The emergence of multi-core processors makes me think that we should look at 
implicit parallel functional programming in a new light.

Cheers,

Satnam

 

 
Satnam Singh
Microsoft
One Microsoft Way
Redmond
Washington 98052-6399
USA
 
Email: [EMAIL PROTECTED]
Telephone: +1 425 705 8208
Cell: +1 408 718 2588
Pager:  [EMAIL PROTECTED] 

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


Re: [Haskell] ANNOUNCE: Happy 1.15

2005-01-18 Thread Brian Smith
> parser name directive
>
>This has no effect at present. It will probably remain this way: if you 
> want to
> control names, you could use qualified import. 
> ...
> The driver file exports a function doParse :: [[UserDefTok]] -> GLRResult

Does this mean that it is not possible to put multiple entry points
into a GLR parser? For example, I have a Happy 1.14 grammar that has
rules "type," "expr," among others. How would I go about generating a
"doParse" that will start at either of these rules? Do I have to do
something like:

allMyStartRules: expr | type |  ;

and then filter the GLRResult based on the "start rule" I wanted?

Does the %partial directive work with GLR parsers too?

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


RE: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Conal Elliott
Oh!  I hope that Haskell language and library semantics are defined
independently from any particular Haskell implementation.

 - Conal

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Ben Rudiak-Gould
Sent: Tuesday, January 18, 2005 8:13 AM
To: Conal Elliott
Cc: 'Jim Apple'; haskell@haskell.org
Subject: Re: [Haskell] Re: Why is getArgs in the IO monad?

Conal Elliott wrote:

 >The meaning of
 >"length getArgs" would then have to be a value whose type is the
meaning
 >of Haskell's "Int", i.e. either bottom or a 32-bit integer.  I'm
 >guessing that none of those 2^32+1 values is what you'd mean by
"length
 >getArgs".  On the other hand, the IO monad is a much roomier type.

I'm not strongly convinced by this argument. I don't think you can tell 
me which particular Char value you mean by the expression (maxBound :: 
Char) either, yet you probably wouldn't argue for changing maxBound's 
type. I think Jim's claim is that there's no clear dividing line between

these cases, and I tend to agree. Even if you want to disallow explicit 
recompilation (and how do you define "compilation" denotationally?), an 
automatic rollout of a new version of Hugs could lead to successive 
invocations of a script using different values of (maxBound :: Char) 
(or, more plausibly, some constant defined in the library) without user 
intervention. How is this different from any other environmental change,

such as a change in the program arguments? I think this is what Jim 
meant when he wrote

 >It seems that, looking out at the world from main, the args passed to
 >main and the compilation happen at the same time (before, long long
 >ago). What motivation would we have for treating them differently?

-- Ben

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


RE: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Conal Elliott
Jim Apple wrote:

> Even if this is denotationally different from a value like zero ::
> Int, I think it is also different from getLine :: IO String. It
> seems to mean something between these.

I think I understand your point better now: Do you want another
denotational distinction, somewhere between the semantic simplicity of
Int or [String] and the semantically intractable kitchen-sink IO?  I'd
like to see more exploration in that in-between space.

Cheers,
 - Conal

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jim Apple
Sent: Tuesday, January 18, 2005 12:15 AM
To: haskell@haskell.org
Subject: [Haskell] Re: Why is getArgs in the IO monad?

I still think I'm missing your point, but let me take a stab at it.

Conal Elliott wrote:

> I'm suggesting you might better understand the
> why of Haskell if you think denotationally (here about the meaning of
> the [String] type), rather than operationally.

The meaning of a type seems to be about what happens operationally. ":: 
[String]" is an operational guarantee, so if we let "getArgs :: 
[String]" that is a promise that there is some list of Strings at
runtime.

 > I'm
> guessing that none of those 2^32+1 values is what you'd mean by
"length
> getArgs".

Well, I suppose I mean something like an existential type: there is some

Int that is length getArgs.

Even if this is denotationally different from a value like zero :: Int, 
I think it is also different from getLine :: IO String. It seems to mean

something between these. I suppose my intuition is that it is closer to 
:: Int

Jim

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

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


RE: [Haskell] Typeable and Data instances for Double, FiniteMap, ...

2005-01-18 Thread Simon Peyton-Jones
| Yes, once you start to use the SYB library you end up wanting it to
| cover almost all your types.
| I will make an effort *now* hoping that all the instance can still
make
| it into GHC 6,4.
| (There are indeed a few more unsupported types that make obviously
sense.)

Yes, anything in the HEAD will get into 6.4

Simon

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


Re: [Haskell] Typeable and Data instances for Double, FiniteMap, ...

2005-01-18 Thread Ralf Laemmel
Georg Martius wrote:
I was playing around with "Scap you Boilerplate" and realised some 
missing instances of Typeable and Data. Is there a particular reason 
why there is no Data Double instance? 
There has been a Double instance under CVS (GHC HEAD) since March 2004.
It will be included in GHC 6.4.
(BTW, this email should go to glasgow-haskell-users perhaps?)
Furthermore I was wondering why no instance for the collection types 
such as FiniteMap, Set and HashTable is provided.
Yes, once you start to use the SYB library you end up wanting it to 
cover almost all your types.
I will make an effort *now* hoping that all the instance can still make 
it into GHC 6,4.
(There are indeed a few more unsupported types that make obviously sense.)

I looked at the library source-code (GHC) and reallised that there is 
really much documenting comments in, but which are not Haddock 
comments. Again I don't understand that. Is the programmer supposed to 
look at the source-code rather the API documentation? 
I wonder how other Haskellers think of that.
I tend to use non-Haddock comments whenever I want to document 
*implementation details*.
Is there an idiom for that; so that people get not confused?

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


[Haskell] PhD Position in Technical University of Valencia (Spain)

2005-01-18 Thread Santiago Escobar
Please, pass on to interested students. Apologies for multiple copies.
--
PhD Position (DEADLINE 4 February 2004! See "How to apply" below.)
  Departamento de Sistemas Informaticos y Computacion
  Technical University of Valencia
  Spain
  http://www.dsic.upv.es/users/elp
The group ELP "Automated Software Engineering, Logic Programming and
Programming Languages" of the Technical University of Valencia (UPV)
has  an  open  position for a PhD student  for 2 years (which can be
extended to 4 years) funded by the Spanish Ministry of Education and
Scientific Research, to work in the project:
"SELF: Software Engineering and Lightweight Formalisms"
Project coordinator: Maria Alpuente
http://www.dsic.upv.es/~alpuente
The goal of the project is to investigate on analysis,  specification,
verification, debugging, testing, learning, certification,
transformation & optimization techniques for (multiparadigm) programs.
The candidate must have an adequate theoretical background in computer
science with some knowledge of mathematical logic.  Knowledge of logic
programming or functional/equational programming is not required but
will be an asset.
Salary for a first year PhD student is around 1100 Euros/month with an
incremental raise for each subsequent year.
Besides the salary, health insurance is provided.
How to apply

First, register your intention to apply immediately using the electronic
application form on the WWW via
http://213.229.161.10/becasfpi
The full application should contain:
1 A signed, printed copy of the Web application form, where
   the project SELF must be explicitly choosed (from the projects list)
2 A passport photocopy
3 Attested copies of degrees and other certificates, including the
   complete list of courses, grades,  and dates. An explanation of the
   corresponding evaluation system (min and max. qualification to pass)
   is also required
4 A certification, granted by an spanish university, that the
   undergraduate degree is valid for admission in its PhD programme.
   This can be obtained from UPV if document 3 above is timely provided.
5. Curriculum Vitae
For further information on how to apply please consult our website:
   http://www.dsic.upv.es/users/elp
Send your application (paper mail), to arrive BEFORE
   * February 4th, 2004 
to:
Salvador Lucas ([EMAIL PROTECTED])
Departamento de Sistemas Informaticos y Computacion
Universidad Politecnica de Valencia
Camino de Vera s/n
E-46022 Valencia (Spain)
Phone +34 96 387 7007 (ext. 73531)
http://www.dsic.upv.es/~slucas
--
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] ANNOUNCE: Happy 1.15

2005-01-18 Thread Simon Marlow
ANNOUNCING  Happy 1.15  - The LALR(1) Parser Generator for Haskell

I'm pleased to announce version 1.15 of Happy, the parser generator
system for Haskell.

Changes from version 1.14 to 1.15

   * New %expect directive
   * the list of tokens passed to happyError now includes the current
 token (not %lexer).
   * added support for ambiguous grammars via Generalized LR parsing
   * added %partial to indicate a parser that can return a result
 before EOF is reached.

NOTE: Happy version 1.15 will be *required* for building newer
versions of GHC, due to use of %partial in GHC's parser.  If you build
GHC from source, get this release, or build it from CVS.

Happy is available in source form, which can be compiled with GHC
version 5.04+, and we also provide binaries for some architectures.
The Happy homepage with links to the various distributions lives at:

http://www.haskell.org/happy/

Please send any bug reports and comments to [EMAIL PROTECTED]
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


RE: [Haskell] Typeable and Data instances for Double, FiniteMap, ...

2005-01-18 Thread Simon Peyton-Jones
| I was playing around with "Scap you Boilerplate" and realised some
missing instances of Typeable and
| Data. Is there a particular reason why there is no Data Double
instance?
| Furthermore I was wondering why no instance for the collection types
such as FiniteMap, Set and
| HashTable is provided. At the end of the mail [1] there is my
implementation of instances for at least
| Double and FiniteMap.

I've asked Ralf if he'll add them.

| Apart from that I looked at the library source-code (GHC) and
reallised that there is really much
| documenting comments in, but which are not Haddock comments. Again I
don't understand that. Is
| the programmer supposed to look at the source-code rather the API
documentation?

It should be Haddock'd.  We'd be delighted if anyone was willing to
transfer code in comments to Haddock comments, where that is
appropriate, and probably add new Haddock comments where necessary.  

Any volunteers?   We'd give CVS access...

Simon


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


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Jules Bean
On 18 Jan 2005, at 16:12, Ben Rudiak-Gould wrote:
I'm not strongly convinced by this argument. I don't think you can 
tell me which particular Char value you mean by the expression 
(maxBound :: Char) either, yet you probably wouldn't argue for 
changing maxBound's type. I think Jim's claim is that there's no clear 
dividing line between these cases, and I tend to agree. Even if you 
want to disallow explicit recompilation (and how do you define 
"compilation" denotationally?), an automatic rollout of a new version 
of Hugs could lead to successive invocations of a script using 
different values of (maxBound :: Char) (or, more plausibly, some 
constant defined in the library) without user intervention. How is 
this different from any other environmental change, such as a change 
in the program arguments? I think this is what Jim meant when he wrote

Library constants which change between runs are evil. As a comparison 
note that the common Java and C and C++ compilers will all happily 
inline library constants at compile time, so they also would suffer 
brokenness if a library constant wasn't constant between runs.

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


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Ketil Malde
Ben Rudiak-Gould <[EMAIL PROTECTED]> writes:

> How is this different from any other environmental change, such as a change
> in the program arguments?

Isn't this really the old (or fairly recent) discussion of "top level
things with identity"?  Should one be able to do something like

   args :: [String]
   args <- getArgs

at the top level?

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants

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


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Keean Schupke
Surely both requirements can be satisfied if the programs arguments are made
parameters of main:
main :: [String] -> IO ()
   Keean.
Ben Rudiak-Gould wrote:
Conal Elliott wrote:
>The meaning of
>"length getArgs" would then have to be a value whose type is the meaning
>of Haskell's "Int", i.e. either bottom or a 32-bit integer.  I'm
>guessing that none of those 2^32+1 values is what you'd mean by "length
>getArgs".  On the other hand, the IO monad is a much roomier type.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Tomasz Zielonka
On Tue, Jan 18, 2005 at 08:12:42AM -0800, Ben Rudiak-Gould wrote:
> Even if you want to disallow explicit recompilation (and how do you define
> "compilation" denotationally?), an automatic rollout of a new version of Hugs
> could lead to successive invocations of a script using different values of
> (maxBound :: Char) (or, more plausibly, some constant defined in the library)
> without user intervention. How is this different from any other environmental
> change, such as a change in the program arguments?

Big difference. The change in program arguments is inevitable, or at least
expected. The change in Haskell implementation can be avoided, by compiling
the program or simply by not switching to a newer version.

The more there are pure values that change from execution to execution,
the more often will smart libraries like WASH/CGI break in mysterious
ways. Please, no!

Best regards,
Tomasz
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Jim Apple
I still think I'm missing your point, but let me take a stab at it.
Conal Elliott wrote:
I'm suggesting you might better understand the
why of Haskell if you think denotationally (here about the meaning of
the [String] type), rather than operationally.
The meaning of a type seems to be about what happens operationally. ":: 
[String]" is an operational guarantee, so if we let "getArgs :: 
[String]" that is a promise that there is some list of Strings at runtime.

> I'm
guessing that none of those 2^32+1 values is what you'd mean by "length
getArgs".
Well, I suppose I mean something like an existential type: there is some 
Int that is length getArgs.

Even if this is denotationally different from a value like zero :: Int, 
I think it is also different from getLine :: IO String. It seems to mean 
something between these. I suppose my intuition is that it is closer to 
:: Int

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


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Ben Rudiak-Gould
Conal Elliott wrote:
>The meaning of
>"length getArgs" would then have to be a value whose type is the meaning
>of Haskell's "Int", i.e. either bottom or a 32-bit integer.  I'm
>guessing that none of those 2^32+1 values is what you'd mean by "length
>getArgs".  On the other hand, the IO monad is a much roomier type.
I'm not strongly convinced by this argument. I don't think you can tell 
me which particular Char value you mean by the expression (maxBound :: 
Char) either, yet you probably wouldn't argue for changing maxBound's 
type. I think Jim's claim is that there's no clear dividing line between 
these cases, and I tend to agree. Even if you want to disallow explicit 
recompilation (and how do you define "compilation" denotationally?), an 
automatic rollout of a new version of Hugs could lead to successive 
invocations of a script using different values of (maxBound :: Char) 
(or, more plausibly, some constant defined in the library) without user 
intervention. How is this different from any other environmental change, 
such as a change in the program arguments? I think this is what Jim 
meant when he wrote

>It seems that, looking out at the world from main, the args passed to
>main and the compilation happen at the same time (before, long long
>ago). What motivation would we have for treating them differently?
-- Ben
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Jules Bean
On 18 Jan 2005, at 06:31, Jim Apple wrote:
Tomasz Zielonka wrote:
I like to think that pure functions don't change between executions.
I'd like to think they wouldn't change within executions. Is there a 
pure haskell way to check the value of a function between exections?

In principle, a haskell compiler might notice that a function is always 
called with a particular argument, and inline the result of the 
function at compile-time.

For example, you might well expect a program containing the subterm 
"3+4" to be compiled into machine code which directly uses the constant 
value 7. Certainly most decent C compilers will perform this 
optimisation.

Such an optimisation, depends on the knowledge that "3+4" is always the 
same value: i.e. that a pure function, given the same arguments, always 
returns the same value (even between executions).

More sophisticated optimisation transforms might also depend on the 
same property.

Whether GHC actually performs an optimisation along these lines I have 
no idea.

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


Re: [Haskell] Re: Why is getArgs in the IO monad?

2005-01-18 Thread Tomasz Zielonka
On Tue, Jan 18, 2005 at 01:31:19AM -0500, Jim Apple wrote:
> Tomasz Zielonka wrote:
> 
> >I like to think that pure functions don't change between executions.
> 
> I'd like to think they wouldn't change within executions. Is there a 
> pure haskell way to check the value of a function between exections?

Perhaps I was unclear. I want pure functions to give the same results every
time they are run for the same arguments, as long as the have the same
definition. This makes like easier. Also, some haskell libraries rely on that
- take WASH/CGI for example.

Best regards,
Tomasz
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell