Apologies for responding to messages in reverse order . . .
* My reluctance to change the draft H98 report is rising sharply.
Understood!
* I don't think the H98 report has ever had laws about mzero etc.
No, they went on the transition from 1.4, I think.
* And the whole laws business is
Paul Graham is collecting canonical accumulator generators at
http://www.paulgraham.com/accgen.html , and has Dylan, E, JavaScript,
various dialects Lisp, Lua, Rebol, Ruby, Perl, Python and Smalltalk.
As others have implied, the only correct answer to this is
it's the wrong question. One of
The documentation URL:
http://www.haskell.org/ghc/docs/latest/set/finitemap.html
doesn't say whether fmToList et al are /defined/ to return a
list in Ord order of the keys.
I think it should.
Jón
--
Jón Fairbairn [EMAIL PROTECTED]
31 Chalmers Road
Anyway, a new 5.02.3 installer which I _believe_ works around
the problem is available as:
http://galois.com/~sof/ghc-5-02-3-1.msi
It's a big download (~21M), but if you could try it out let me
know if it improves matters, I'd appreciate it.
As far as I can tell it installs without
In doc/user-guide/finitemap.html, paragraph 2 Out code
should read Our code.
Is this the right forum for reporting such trivia?
Cheers,
Jón
--
Jón Fairbairn [EMAIL PROTECTED]
___
Glasgow-haskell-bugs mailing
Hey Simon et al at Micro$oft, when will there be an H#?
But H# is C! we don't want that, surely? :-)
Jón
--
Jón Fairbairn [EMAIL PROTECTED]
31 Chalmers Road [EMAIL PROTECTED]
Cambridge CB1 3SZ+44 1223
I like layout but I think the existing rules are too
complicated. Unfortunat ely it's difficult to do anything
with them without breaking vast swathes of existing code,
so we'll just have to put up with them.
Well, there's two things to consider: Haskell 98, which
probably shouldn't change,
Yes you can define it,
And you can, as well.
Man sollte sich nicht darauf verlassen, daß ein Englander
man verwendet, wenn es angebraucht wäre¹.
That's how common idioms come into being;
there's no special magic about the folds already in existence.
Well, my point is that there is --
I wrote:
Can someone remind me why the A close brace is also inserted whenever
the syntactic category containing the layout list ends part
of the rule is there?
Lennart wrote:
It's so you can write
let x = 2+2 in x*x
(and similar things)
and Arjan van IJzendoorn wrote:
x = (3,
Suppose I have a task I want to do to each line of a file,
accumulate a result and output it, I can write
main = do stuff - getContents
print $ foldl process_line initial_value (lines stuff)
ie, it's obviously a fold
I can't see a way of doing the same thing directly on the
foldr, foldM, etc. derive a recursive computation from the
recursive structure of an input list, so you have to feed
one in. If you want to bypass the list, you could use
IO-observations (getLine, isEOF) instead of list
observations (head/tail, null):
Yes you can define it, I should have
Dominic Steinitz [EMAIL PROTECTED] wrote:
I've managed to crack something that always annoyed me when I used to do
network programming.
[. . .]
Suppose I want to send an ICMP packet. The first byte is the type and the
second byte is the code. Furthermore, the code depends on the type. Now
On Tue, 2 Apr 2002 10:00:37 +0200 (MET DST), John Hughes
[EMAIL PROTECTED] wrote:
If (as a human reader of a programme) I see
do a - thing1
expression
and I notice (perhaps after some modifications) that a is
not present in expression, then I
Wolfgang Jeltsch [EMAIL PROTECTED] wrote:
It shouldn't be syntactic suger but at most an operator which does not belong
to the monad class. One could define () just as an ordinary function
instead of a class member.
That sounds to me like the best idea so far.
If (as a human reader of a
Could someone post an example of the creation of a
temporary file where race conditions are important?
/any/ programme that does this on a multi-process system.
Between the test for existence and the creation, some other
process could have created a file of the same name. Then
the create
Thanks for all the advice. In the end, I couldn't make $! work for me
(it always seems to be harder than I think it will be to use it, and $!
and deepSeq makes my code run slowly).
:-(
But a continuation passing style foldl worked wonderfully.
As Jay Cox pointed out by email, my answer
On Wed, Mar 20, 2002, Jon Fairbairn wrote:
Could someone post an example of the creation of a
temporary file where race conditions are important?
/any/ programme that does this on a multi-process system.
Occasionally, the presence or absence of a file (usually empty) of a
certain
Apologies for the typo: that should have been 5 elements, not 500.
Amanda Clare wrote:
I have stack problems: my program uses too much stack. I suspect, from
removing bits of code, that it's due to a foldr in my program. If I use
foldr or foldl on a long list (eg 500 bulky
There's a remark at the beginning of 7.2 that says:
delete, (\\), union and intersect preserve the invariant=20
that lists don't contain duplicates, provided that=20
their first argument contains no duplicates.
The same applies to unionBy etc. This design is one
you might reasonably
Rijk J. C. van Haaften [EMAIL PROTECTED]
wrote:
Recently, I wrote a function similar to
x :: a
x = x 42
which is type-correct (Hugs, Ghc, THIH).
Still, from the expression it is clear
that the type shoud have a function type.
The definition
x :: a - b
x = x 42
is equally well
The current library report defines unionBy like this:
unionBy eq xs ys = xs ++ deleteFirstsBy eq (nubBy eq ys) xs
why does it take the nub of ys, but not xs? I'd have expected
unionBy eq xs ys = (nubBy eq xs) ++ deleteFirstsBy eq (nubBy eq ys) xs
Jón
--
Jón Fairbairn
All this taken together, I mean, _really_, is the lexical structure of
Haskell a botch, or what?
No. Innovative. All the problems described in this thread
reflect unwarranted assumptions inherited in emacs. It's
plainly possible to parse Haskell, and not hard either.
Jón
--
Jón
I argued that (Num a, Ord a) makes most sense to me.
You argued that (Integral a) was a conscious choice (something I
don't remember but I'm sure you're right), and is the right one anyway.
I'd be interested to know what others think. If there's any doubt,
we'll stay with Integral.
I was tempted to answer your original question with Because
Haskell is not an object oriented language and type classes
are not object classes, but I thought that would be
churlish. Now you write:
Well can you give examples of some useful functions? I can
live without id, and (.)
and I
I see a lot of literature that says that monads simulate the effects of
imperative programming concepts.
I think that's just bad wording. To take a rather trite
point of view, in a language such as C /everything/ is done
within a monad, and all types, even int, are really IO
something (IO
At 2001-11-01 22:10, raul sierra alcocer wrote:
What mechanism of transmiting parameters does Haskell implement?
By value.
Yes, though one might equally say that they are passed by
reference, since in
g = let f x = x+x
z = factorial 1000
in f z * z
the 'first' instance of x
Eray Ozkural wrote:
I
have difficulty using GHCi because I can't define functions interactively.
Would it be possible to introduce a mode to do that?
You can do this:
Loading package std ... linking ... done.
Prelude let f x = 1+x
Prelude f 2
3
Prelude let {g 1 = 1; g n = n-1}
Prelude g 1
If xs is finite, your version of zipWith would evaluate the infinite
list [1..] one place beyond that which was really needed.
Sure, there is a single extra amount of evaluation needed to work out if
there is a following list item (I guess this could be quite high in more
complex cases -
On Tuesday 16 October 2001 07:29, Fergus Henderson wrote:
[...]
The whole idea of letting you omit method definitions for methods with
no default and having calls to such methods be run-time errors is IMHO
exceedingly odd in a supposedly strongly typed language, and IMHO ought
to be
In general, this is why LIA-2 (Language Independent Arithmetic, part
2, Elementary numerical functions, ISO/IEC 10967-2:2001) [. . .]
This sounds like a very interesting standard. I am constantly annoyed
by ISO's attempts to hide their standards; one might wonder what the
purpose is of
The lexical syntax says that
10e3
means
10 e3
(i.e. two lexemes). I don't like this choice, and it could be fixed
in the Revised H98 report.
What is the likelihood of anyone *intentionally* writing an integer
abutted directly with a varid, followed directly by another
I've updated the 5.02 Windows InstallShield, getting rid of one or two
teething problems, and improving the availability of the docs.
I've also added links to the RedHat 7.1 RPMs and FreeBSD/x86 binary
dist.
http://www.haskell.org/ghc/download_ghc_502.html
I'm not sure who to mention
Sounds to me like your describing Sittampalam's and de Moor's MAG system.
http://web.comlab.ox.ac.uk/oucl/research/areas/progtools/mag.htm
Yes! That's very close to what I was thinking of. The only
difference is that they focus on source to source
transformations, where I was thinking of
hello, i just want to ask a simple question: does
somebody have or knowwhere to find a haskell program that
calculates the number e, that is the list of infinite
digits?
It's a nice problem, which I encountered many years
ago as one of the first examples I saw of lazy
Unless I'm mistaken, foldl' (the strict version of foldl)
doesn't appear in (the export list of) the standard prelude
or the list library.
Is there a good reason for this? New users quite quickly
find that they need it.
Jón
--
Jón Fairbairn [EMAIL PROTECTED]
and not just type systems but also other aspects of operational
semantics. What we have here is a single rule from a rule-based
inductive definition of a certain relation G |- s :: S between typing
environments G, expressions s and types S.
It's probably worth mentioning here that this
On 12 Feb 2001, Ketil Malde wrote:
[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) writes:
Why do you stop at allowing addition on Dollars and not include
multiplication by a scalar?
Perhaps because there is no good universal type for (*).
Sorry, it would have to have a different
On Sun, 21 Jan 2001, David Bakin wrote:
This article is very good, and having read the conference paper earlier
in the year I finished it with only one question: What's a 'quant' ...
and is it good or bad to be one?
"Ten years ago, Jean-Marc Eber, then a quant at Socit
Gnrale,
On Fri, 1 Dec 2000, Zhanyong Wan wrote:
Ronald Kuwawi wrote:
open text editor, type
hash :: [Char] - Int
hash = (foldl (+) 0) . (map ord)
hash "HASKELL%98"
hash "Haskell Ninety Eight !!"
surely?
--
Jón Fairbairn [EMAIL PROTECTED]
If you define `p' as a syntactic function, e.g.
p x y = x + y
or
p x = (+) x
rather than via
p = (+)
then the monomorphism restriction does not apply, and so the type inferred
for `p' will be the correct polymorphic type `Num a = a - a - a'.
May I just take
Lennart Augustsson wrote:
Frank Atanassow wrote:
2) The Prelude doesn't use it.
Well, it doesn't for historical reasons.
Am I alone in thinking that the prelude is desperately in
need of restructuring? Has anyone got any proposals for
nested modules (so we could have
I'm reluctant to get involved in this discussion, cheifly
because it seems to me that Jan is attacking a position that
has quite a long history with (inter alia) the argument that
a different position has a longer history, which doesn't
strike me as terribly likely to lead to insight.
Also my
Then, the question is why we write
result = function operand1 operand2
instead of
operand1 operand2 function = result
I actually think the latter is cooler. :)
I think there may be cultural influences about word order and/
or writing direction creeping in here :-)
--
Jón Fairbairn
At the time of writing, I am waiting for yet another long Haskell re-make of
lots of modules to complete. The frustrating thing is, that at least 90% of
these
remakes are actually completely unnecessary.
I'm afraid I've not gone through your detailed suggestions, but in the
short term,
Is not deleteBy :: (a-Bool) - [a] - [a]
more natural for the library than
deleteBy :: (a-a-Bool) - a - [a] - [a]
?
I'd say so. In general the prelude seems rather weak on
functions to manipulate predicates.
Jón
--
Jón Fairbairn
On 9 Oct, Heribert Schuetz wrote:
[(f | g) x = f (g x); (f | g) x = g (f x)]
"Use symmetric glyphs for commutative operations and asymmetric glyphs
for non-commutative operations. Reflect glyphs for flipped operations."
That would make me happy.
which I would suggest as a general
Some time ago there was a discussion about what to call reverse
composition (I can't find it in the archive - needs a search option?)
Just now I thought of .~ from . for composition and ~ (tilde, but
commonly called twiddle) for twiddling the order about.
Maybe we could adopt that as normal
On 8 Oct, Christopher Jeris wrote:
Personal taste in infix operators seems to be another good argument for a
camlp4-style preprocessor for Haskell.
Please no! I want to be able to read other folks programmes and vice
versa. The whole point of suggesting a particular glyph on this foram
On 8 Oct, Jonathan King wrote:
I think you might see the point. (No pun back there, I promise...) I
understand where using "." to mean composition came from, and I know that
it's a long-standing tradition in at least the Haskell community, but I
don't think the visual correspondence of
On 8 Oct, Joe English wrote:
[I wrote]:
Just now I thought of .~ from . for composition and ~ (tilde, but
commonly called twiddle) for twiddling the order about.
I've also seen .| and |. used for this purpose (by
analogy with Unix pipes.)
John Hughes' Arrow library spells it "",
On 5 Oct, Manuel M. T. Chakravarty wrote:
I currently use (# and #) [...]
Any opinions?
Definitely use the pragma syntax suggested by Simon PJ
--
Jón Fairbairn [EMAIL PROTECTED]
On 27 Sep, Manuel M. T. Chakravarty wrote:
Antti-Juhani Kaijanaho [EMAIL PROTECTED] wrote,
Please don't define lists by who'll use them. Define them by the topic
of discussion.
Good point. `haskell-help' or some such is definitely
better.
'haskell-questions'? Maybe this list
On 16 Sep, Keith Wansbrough wrote:
I suggest calling them "pi13" or "prj13" rather than "tuple31", though.
pi1_3 or proj1_3 or select_1_3 or sel_1_3, even s_1_3 -- omitting the
"_" means sel is ambiguous (!). We should choose a scheme that can
cope with such things even if they are
On 9 Sep, George Russell wrote:
Here is my revised version of the documentation.
my :-) (which incorporates some of the other suggestions.)
I've given reasons at the bottom.
Type:
unzip :: [(a,b)] - ([a],[b])
unzip takes a list of pairs and returns a pair of lists.
Definition:
On 8 Sep, George Russell wrote:
Don't add more functions like concatSep to the standard library or prelude.
Certainly not to the prelude, but I think there is a strong case for
evolving the standard library based on what people use. I use
((concat .) intersperse) quite a lot, and having a
On 19 Aug, Mark P Jones wrote:
[...] note that the error messages that prompted
Jon's comment didn't have anything to do with sophisticated type systems.
Dealing with those kinds of things requires some hard work, but it isn't
research, and so it's hard to justify, at least in an academic
On 20 Aug, Bob Howard wrote:
data BTree Integer = Leaf Integer | Node Integer (BTree Integer) (BTree Integer)
^
this ought to be a type variable name, but you've put the
name of a type.
mkTree :: Integer - BTree
^
On 11 Jul, Wolfram Kahl wrote:
Koen Claessen [EMAIL PROTECTED]
proposes the following diagonalisation function:
[ (a,b) | (a,b) - [1..] // [1..] ]
For a suitable definition of (//), for example:
(//) :: [a] - [b] - [(a,b)]
xs // ys = diagonalize 1
On 13 Jul, Wolfram Kahl wrote:
I confess guilty to have diverged from this simpler problem
(//) :: [a] - [b] - [(a,b)]
to the more general problem
???
like
diagonalise:: [[a]] - [a]
diagonalise l = d [] l
d [] [] = []
d acc [] = -- d [] acc would do, but
On 8 Jun, Paul Hudak wrote:
show x should be a string that when printed looks like the value that
you would have to type to generate it directly. This example is most
instructive:
[...]
and this is just cute:
main = putStr (quine q)
quine s = s ++ show s
q = "main = putStr (quine
On 20 May, Kevin Atkinson wrote:
Sorry typo. That should be optional.
Is this a job for overloading? I think it would be better to provide
some syntactig sugar and compile-time checks for something like this:
data Argtype = Arg {a::Int, b::Bool, c::Char}
arg = Arg {a = 1, b = True, c =
On 20 May, Frank A. Christoph wrote:
I would welcome either. However, there is a huge body of code that
assumes strings are lists of chars.
Yes, obviously... this is for new programs (which people aren't writing
because of Haskell's inefficiency in dealing with strings).
or write
foo :: Int - [Char]
foo 0 = []
foo x = ['1'] ++ foo (x - 1)
to declare it yourself.
Note that type casting in the C sense is not available in Haskell,
the only thing you can do is to restrict something to have fewer types
than it otherwise would have.
Jon
--
Jon
confusing.
Apologies if this is dragging up old arguments.
Likewise!
--
Jon Fairbairn [EMAIL PROTECTED]
of anything better than these monsters.
um, monadZero, monadFail? People who can't type can always add their
own renamings.
--
Jon Fairbairn [EMAIL PROTECTED]
think there is a strong case of providing most of
those operations on Integer too (perhaps at a different type).
--
Jon Fairbairn [EMAIL PROTECTED]
that too!
Given that the report already mentions the 'specialize' pragma, I
don't see any reason why the newly overloaded functions shouldn't be
accompanied by specialisations for both Integer and Int, which should
remove the efficiency drawback of making this change.
Jon
--
Jon Fairbairn
it also possible to
reduce the number of checks for sequences of operations?
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
the
fact that you call a good library isn't relevant; what's important is
what you do when you don't _need_ to use GMP to get the answer. My
guess is that most of the real cost of doing Int sized arithmetic in
Integers is the cost of detecting overflow.
--
Jon Fairbairn
that it's easier to learn to
write
-- ---
than to learn not to try to define --, |--, --| and so on. Oh, and what is
{-- comment --}
under the present rules?
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
a citizen
of the world of existing numbers.
Right, but it should be done via a class hierarchy, not by squishing
all the numbers into one type.
--
Jon Fairbairn [EMAIL PROTECTED]
is
meaningful it doesn't usually give an int result. What you get back
should depend on what you use it for.
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm
of computing at Integer and converting at the
end, an option that is not necessarily available.
Incidentally, length :: Integral a = [b] - a, I think.
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
Haskell
ought to be easier if less is in the Prelude and more in libraries.
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
Haskell 2 to happen
swiftly too!
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
with some extra exceptions for things such as connexion timed out and
so on).
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
+1
|
pati+1 varop(r,i) rpati
ie no () and no extra arguments, but given that one may want to define
higher order functions this way, we ought to make the language allow it.
Can anyone argue against it?
--
Jon Fairbairn [EMAIL PROTECTED
and toEnum to their
overloaded types:
toEnum :: Integral i = i - a
fromEnum :: Integral i = a - i
would that suit?
--
Jon Fairbairn [EMAIL PROTECTED]
Haskell committe - let's hope some of them
are listening.
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
that
way indefinitely. I think 'indefinitely' here means 'until something
goes wrong with nerdscaphe'.
I suppose John could implement something using cookies, but why should
he put in so much effort?
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
myself.
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
obviously won't give the behaviour Carsten
intended and which I think is the more natural. ie groupBy op ought
to return a list of lists where each member is in order under `op`.
Is there some good technical reason why we want the present groupBy?
Jon
--
Jon Fairbairn
rompted me to write it in the first
place.
[1] Fredman, Sedgewick, Sleator, and Tarjan.
"The pairing heap: A new form of self-adjusting heap"
Algorithmica 1(1):111-129, 1986.
Many thanks for this reference, of which I was unaware.
Jon
--
Jon Fairbairn
originally, mergesort is somewhat faster in the average case.
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
On 19 Sep, Nicholas Bleakly wrote:
Does any body have a heap sort algorithm (i.e. takes a single unsorted
list and applies a heap sort to it)?
If you mean a functional one, I have. I could email it to you. Or
post it here if wanted. Does anyone else have one?
--
Jon Fairbairn
coding.
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
if this has been
discussed and rejected already.
Jon
--
Jon Fairbairn [EMAIL PROTECTED]
to think before using the Int
version.
PS. Hi Jon!
Hej Lennart!
--
Jon Fairbairn [EMAIL PROTECTED]
18 Kimberley Road[EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)
or example)
Haskell 1.4
And then compilers could always say "Not interested in compiling
Haskell 1.4 programmes"...
I don't think I like this though: it's an extra feature, and the whole
point of the standardisation effort is to replace features by
orthogonality (I hope).
Jo
301 - 389 of 389 matches
Mail list logo