Re: static evaluation of dynamics thing

2000-05-21 Thread Marcin 'Qrczak' Kowalczyk
Sat, 20 May 2000 13:13:53 -0700, Simon Peyton-Jones [EMAIL PROTECTED] pisze: f x = assert (p x) (...x...) where assert :: Bool - a - a If the boolean is False, you get an error message pinpointing the line in the file. Now, a function with an assert that always fails is indeed a

Re: import List(..) ?

2000-05-21 Thread Marcin 'Qrczak' Kowalczyk
Sat, 20 May 2000 13:13:22 -0700, Simon Peyton-Jones [EMAIL PROTECTED] pisze: Explicit lists [a,b,c] List comprehensions Numeric constants (1 means 'fromInteger 1') do notation Here is an idea for an extension to Haskell 98 to support this. [...] It has small

Re: import List(..) ?

2000-05-21 Thread Fergus Henderson
On 21-May-2000, Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] wrote: Sat, 20 May 2000 13:13:22 -0700, Simon Peyton-Jones [EMAIL PROTECTED] pisze: Explicit lists [a,b,c] List comprehensions Numeric constants (1 means 'fromInteger 1') do notation Here is an idea for an

gcd :: [a] - a

2000-05-21 Thread S.D.Mechveliani
On my proposal for minBy, gcd ... :: [a] - a and remark on +, ... being the exceptions Matt Harden [EMAIL PROTECTED] writes on 19 May 2000 (+), () ... are different. Because they have classical tradition to be applied as binary infix operations. And gcd, min, max, lcm have not

Re: import List(..) ?

2000-05-21 Thread Marcin 'Qrczak' Kowalczyk
Sun, 21 May 2000 17:26:13 +1000, Fergus Henderson [EMAIL PROTECTED] pisze: But being able to import and/or re-export such symbols is necessary if you want to be able to implement an alternative prelude. No: they can be simply always available, just as \ and let. Standard Prelude has to be

Re: gcd :: [a] - a

2000-05-21 Thread Marcin 'Qrczak' Kowalczyk
Sun, 21 May 2000 11:53:39 +0400 (MSD), S.D.Mechveliani [EMAIL PROTECTED] pisze: The economy of names is more important. Convenience of programming is important too. Many Prelude functions are unnecessary, but are convenient. (++) and concat are not needed (you can write flip (foldr (:)) for

static and assert

2000-05-21 Thread S.D.Mechveliani
To my | Here is some strange question: | how to force the compiler to evaluate some things more statically | and to convert some run-time errors into the compile-time ones? Simon Peyton-Jones [EMAIL PROTECTED] writes Not strange at all. It would be quite reasonable to have some way to

Re: import List(..) ?

2000-05-21 Thread Fergus Henderson
On 21-May-2000, Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] wrote: Sun, 21 May 2000 17:26:13 +1000, Fergus Henderson [EMAIL PROTECTED] pisze: But being able to import and/or re-export such symbols is necessary if you want to be able to implement an alternative prelude. No: they can be

Re: import List(..) ?

2000-05-21 Thread Daniel Russell
Sun, 21 May 2000 17:26:13 +1000, Fergus Henderson [EMAIL PROTECTED] pisze: On a related note, Hugs and ghc both allow the following module module Bar(List(..)) where type List = [] without complaint, but according to the Haskell report (5.2) the syntax `typename(..)' should only be

RE: static evaluation of dynamics thing

2000-05-21 Thread Scott Turner
Simon Peyton-Jones wrote: a function with an assert that always fails is indeed a good candidate for a compile-time error message. When I developed compilers for Fortran and C++, from time to time we would get reports from customers that the compiler had failed to diagnose an error in their

RE: static evaluation of dynamics thing

2000-05-21 Thread S.D.Mechveliani
to tell the compiler 'evaluate this to a static value'. I'd suggest doing it via a pseudo-function static :: a - a which behaved like the identity function, except that it evaluated its argument rather eagerly at compile time. AFAIK eagerness isn't addressed by the Haskell language.

Re: gcd :: [a] - a

2000-05-21 Thread Matt Harden
"S.D.Mechveliani" wrote: When processing this tree, it would be natural to write in each node m + b and min [m,b]. The former is "necessary" due to the infix-binary tradition. The latter uses [,] because it is good to have one function min for a list and for

RE: static evaluation of dynamics thing

2000-05-21 Thread Scott Turner
Sergey Mechveliani wrote: For example, the static error report for if {-# static x #-} then error ... else y takes pace only when the compiler proves that `else' never performs, when everything is computed "lazily". If only I

type of minimumBy

2000-05-21 Thread S.D.Mechveliani
To my When processing this tree, it would be natural to write in each node m + b and min [m,b]. The former is "necessary" due to the infix-binary tradition. The latter uses [,] because it is good to have one function min for a list and for the two elements.