Well, C stdio has this nice thing that if you read from stdin then
stdout is automagically flushed first (maybe only if both are ttys).
I think Haskell should have that too.
-- Lennart
On Mar 3, 2007, at 07:10 , Bryan O'Sullivan wrote:
Joe Olivas wrote:
However, changing
Why would there be an extra function?
The type
data Dynamic = forall a . Dynamic TypeRep a
is simply a pair. And so is
data Dynamic = forall a . (Typeable a) = Dynamic a
I think the latter is the most natural representation for Dynamic.
-- Lennart
On Mar 2, 2007, at 23:55 , Stefan
= unsafeCoerce# v
| otherwise = def
-- Lennart
On Mar 3, 2007, at 09:29 , Stefan O'Rear wrote:
On Sat, Mar 03, 2007 at 09:18:00AM +, Lennart Augustsson wrote:
Why would there be an extra function?
The type
data Dynamic = forall a . Dynamic TypeRep a
is simply a pair. And so
Those both look roughly like what I would do.
-- Lennart
On Mar 3, 2007, at 21:35 , Jared Jennings wrote:
-- Sort the [a]'s by the [b]'s.
sortByKeys :: (Ord b) = [b] - [a] - [a]
sortByKeys keys values = map snd $ sortBy compareFst (zip keys values)
where compareFst x y = compare
Yes, as far as I can tell, C would be limited to Z and S.
Nice trick!
-- Lennart
On Mar 4, 2007, at 00:03 , Roberto Zunino wrote:
What is the effect of declaring a class in a module and not exporting
it? Would that prevent to add more instances to that class other than
those already
OK.
Another weird thing is that much of the Haskell code seems to work
with Integer whereas the C code uses int. That doesn't seem fair.
-- Lennart
On Feb 25, 2007, at 02:40 , Melissa O'Neill wrote:
Someone asked if I'd include a classic C version of the Sieve in
my comparisons.
100
different, and one that gets worse for larger n.
Lennart Augustsson wrote:
Another weird thing is that much of the Haskell code seems to work
with Integer whereas the C code uses int.
Originally, I was comparing Haskell with Haskell, and for that
purpose I wanted to have a level playing
Using printf doesn't need Haskell'. I wrote to require only Haskell98.
-- Lennart
On Feb 14, 2007, at 11:36 , Neil Mitchell wrote:
Hi
Eeek, a solution that does monadic maps and require's rank 2 types!
arr = [('a',1), ('b',2), ('c',3)]
showAll = lines (map showItem arr)
showItem
The tricky part to get efficient is multiply and divide.
Say you pick Int32 as the underlying type, when multiplying
you really want the 64 bit result and then scale that.
AFAIK, there are no such primitives exposed to the user.
What you can do is cast to 64 bit, multiply, shift, and cast
back
Many architectures gives both the quotient and remainder when you use
the division instruction, so divMod (quotRem) shouldn't cost more
than a div or mod. But if the code generator takes advantage of that
is another matter.
On Feb 12, 2007, at 02:32 , Matthew Brecknell wrote:
I wrote:
, with or without seq.
I'm a fan of eta, it makes reasoning easier. It also means
the compiler can do more transformations.
-- Lennart
On Feb 12, 2007, at 10:22 , Yitzchak Gale wrote:
Lennart Augustsson wrote:
I'm not sure what you're asking. The (untyped) lambda calculus is
Turing
Sure, but we also have
para f e xs = snd $ foldr (\ x ~(xs, y) - (x:xs, f x xs y)) ([], e) xs
So I think using para is fine.
-- Lennart
On Feb 12, 2007, at 18:40 , Bernie Pope wrote:
Nicolas Frisby wrote:
Guess this is a tricky choice for a foldr intro, since it requires a
I thought solution one was missing the ~ ?
On Feb 12, 2007, at 22:07 , [EMAIL PROTECTED] wrote:
Bernie Pope wrote:
Lennart Augustsson wrote:
Sure, but we also have
para f e xs = snd $ foldr (\ x ~(xs, y) - (x:xs, f x xs y)) ([],
e) xs
Nice one.
Nice one is an euphemism, it's exactly
No, I can't say off hand if seq-hnf would keep eta valid, either.
Neither do I know how to implement seq-hnf efficiently. :)
As far as eta for other types, yes, I'll take it if I can get it's
easily.
But I'm also pretty happy with encoding all the other data types within
the lambda calculus
Yes, and that's pretty much what my version does (and what the
original tried to do?).
On Feb 11, 2007, at 20:14 , DavidA wrote:
If you want it fast, don't use a sieve method at all (or a wheel
method) - use
trial division:
primes = 2 : [p | p - [3,5..], trialDivision primes p]
I'm not sure what you're asking. The (untyped) lambda calculus is
Turing complete.
How could seq improve that?
On Feb 8, 2007, at 11:18 , Yitzchak Gale wrote:
Lennart Augustsson wrote:
I think seq is funny because it is not lambda definable.
Does the set of computable functions
GCC 4.x gets a pass on this test. :)
You can do (much) better than that, of course.
But it's what I'd expect without going over board.
-- Lennart
On Feb 10, 2007, at 16:45 , Donald Bruce Stewart wrote:
dons:
The following C program was described on #haskell
#include stdio.h
Yes! That's the code I like.
On Feb 10, 2007, at 17:46 , Felipe Almeida Lessa wrote:
On 2/10/07, Rafael Almeida [EMAIL PROTECTED] wrote:
While the haskell program took so long, the C program went really
faster
than the haskell version:
$ gcc -O3 -ffast-math -mfpmath=sse -msse2 -std=c99
There are many things that makes your code slow.
* The default for Haskell is to compute with Integer, not Int. So
that makes from Integral and floor very slow.
* foldl' is a bad choice, because it is too strict, you want to abort
the loop as soon as possible.
* your take is really wrong.
Hbc implements the IO type by request/response IO. I.e., the original
Haskell I/O system. People who assume IO involves some RealWorld being
passed around are just making unwarranted assumptions. The Haskell
definition leaves the IO type abstract.
-- Lennart
On Feb 10, 2007, at 19:16
Yeah, the 1 first primes takes about 0.1 seconds in Haskell too
using the code I posted.
On Feb 10, 2007, at 21:49 , Creighton Hogg wrote:
On 2/10/07, Peter Berry [EMAIL PROTECTED] wrote: Gah! Gmail has
really broken defaults for posting to lists.
On 10/02/07, Creighton Hogg [EMAIL
This is actually a pretty good algorithm. And also a rather subtle
one when it comes to termination. :)
-- Lennart
On Feb 10, 2007, at 22:00 , [EMAIL PROTECTED] wrote:
Creighton Hogg wrote:
Hello Haskell-ers,
So a friend and I were thinking about making code faster in
Haskell,
I think seq is funny because it is not lambda definable.
All other constructs in H98 are (except for ! on data types which is
defined in terms of seq).
-- Lennart
On Feb 8, 2007, at 01:12 , Yitzchak Gale wrote:
Haskell is a non-strict language, so non-strict
values are legitimate,
It would be better to produce a triple (as was suggested)
loop = [(x, y, xy) | x - [True, False], y - [True, False]]
The you can map a function that prints over that. Or even better
map a function that generates the strings, and the use one big
putStr at the end. Always try to separate IO
Not much better. You could define shiftl such that is does a single
traversal and
returns both the last element and all but the last. That will save
you one traversal.
On Feb 4, 2007, at 18:44 , Eric Olander wrote:
Hi,
I'm still somewhat new to Haskell, so I'm wondering if there are
I agree. If performance is important enough to worry about is shiftl
traverses the list once or twice then it's time to switch to a better
data type.
On Feb 4, 2007, at 19:27 , Yitzchak Gale wrote:
Nicolas Frisby wrote:
I've always thought that when certain operations are of particular
On Jan 29, 2007, at 03:01 , Alexy Khrabrov wrote:
How do people stumble on Haskell?
Well, I didn't really stumble on it. I was at the 1987 meeting
when we decided to define Haskell.
But I stumbled on functional programming in the first place.
I had to learn it because it was part of a
is this? Is it available
for download anywhere?
Mike
Lennart Augustsson wrote:
On Jan 29, 2007, at 03:01 , Alexy Khrabrov wrote:
How do people stumble on Haskell?
Well, I didn't really stumble on it. I was at the 1987 meeting
when we decided to define Haskell.
But I stumbled on functional
:
On 1/30/07, Lennart Augustsson [EMAIL PROTECTED] wrote:
Excel is what I like to call a 0:th order functional language,
i.e., you can't even define functions, just values. :)
Every cell with an expression in Excel is a function. The problem is
that the domains and codomains of these functions don't
Excel is what I like to call a 0:th order functional language,
i.e., you can't even define functions, just values. :)
-- Lennart
On Jan 30, 2007, at 21:58 , Neil Mitchell wrote:
Hi Alexy,
Heard that statement recently -- that Excel is a functional
programming language, and the most
OOHaskell is ingenious, but it's a terrible way to use Haskell.
It's very unidiomatic Haskell, and it makes you do things in the
same old OO way. Presumably people are using Haskell to do things
differently?
But as I said, I consider OOHaskell itself a work of genius. :)
-- Lennart
On
it completely, just enough to ruin the properties
used by, e.g., foldr/build.
The problem with the current seq can also be seen by the fact that
it doesn't work properly with the IO type.
-- Lennart
On Jan 24, 2007, at 04:11 , Janis Voigtlaender wrote:
Lennart Augustsson wrote:
I don't think
There is no good solution to your problem. But one way to have
both the type A and the type B as you define them is to put them
in separate modules and then use qualified names for the `test'
function.
-- Lennart
On Jan 24, 2007, at 06:12 , jamin1001 wrote:
Hi, I am new at Haskell
Limiting the value recursion is not enough, of course. You'd have to
limit the type recursion as well.
-- Lennart
On Jan 24, 2007, at 10:41 , Robert Dockins wrote:
On Jan 24, 2007, at 8:27 AM, Lennart Augustsson wrote:
Well, I think fix destroys parametricity too, and it would
Could you explain why would a class Seq not be sufficient?
If there were a class Seq, I'd not want functions to be in
that class.
-- Lennart
On Jan 23, 2007, at 08:57 , Yitzchak Gale wrote:
I wrote:
Prelude let f .! g = ((.) $! f) $! g
Prelude let f = undefined :: Int - IO Int
there. :)
-- Lennart
On Jan 23, 2007, at 11:06 , Yitzchak Gale wrote:
Hi,
Lennart Augustsson wrote:
Could you explain why would a class Seq not be sufficient?
If there were a class Seq, I'd not want functions to be in
that class.
Oh, I see. Well that is pretty much the same
as ignoring seq
No, it was not 6.6, it was HEAD.
So at a minimum, I think that the summary of a log from the nightly
run should be checked in together with the source of the tests.
The fact that there are 0 failures for a release is of very little
interest. If you are going to do any GHC development you are
If it's arbitrary precision floating point that you want then sqrt
should where it already is, as a member of Floating. (I find
arbitrary precision real to be an oxymoron, the real numbers are
the real numbers, they already have arbitrary precision.)
For a real number module, you can use,
And this is why some of us think that adding polymorphic seq to
Haskell was a mistake. :(
-- Lennart
On Jan 19, 2007, at 08:05 , [EMAIL PROTECTED] wrote:
Ulf Norell wrote:
In the section on the category laws you say that the identity
morphism
should satisfy
f . idA = idB . f
a context on anything that uses seq and you can tell
that there is some funny business going on.
-- Lennart
On Jan 19, 2007, at 13:07 , Brian Hulley wrote:
Lennart Augustsson wrote:
On Jan 19, 2007, at 08:05 , [EMAIL PROTECTED] wrote:
Thus, Hask is not a category, at least not as defined
This solution was used in the first place. But then some people were
too lazy
to actually use the Eval (as Seq was called) class, so they wanted
a polymorphic seq. And so we're in this mess. And it is a mess,
e.g., the foldr/build transformation ghc uses to fuse list processing
isn't really
I don't see a much better way than using something like Newton-
Raphson and testing for some kind of convergence. The Fractional
class can contain many things; for instance it contains rational
numbers. So your mysqrt function would have to be able to cope with
returning arbitrary
So Terminating contains all the terminating terms in the untyped lambda
calculus and none of the non-terminating ones. And the type checker
checks
this. So it sounds to me like the (terminating) type checker solves the
halting problem. Can you please explain which part of this I have
at 08:02:36AM -0500, Lennart Augustsson wrote:
So it sounds to me like the (terminating) type
checker solves the halting problem. Can you please explain
which part
of this I have misunderstood?
Perhaps you, the user, have to encode the proof of halting in the way
you construct the term
Oh, I have other arguments against pragmas. :)
But I think the best one is that optimization applied in the wrong
place is just poor software engineering.
As Michael A. Jackson said:
The First Rule of Program Optimization: Don't do it.
The Second Rule of Program Optimization (for experts
What Kirsten said.
I think you can be much more productive in optimizing your code
if you actually understand what's going on. I usually don't go as
far as looking at compiler intermediate code; I usually stick with
profiling (or look at assembly code if it's a really performance
critical inner
Maybe it's simpler to add a lot of INLINE, but that can make a program
slower as well as faster. It's much better to profile and add them
where they are needed.
-- Lennart
On Dec 30, 2006, at 08:42 , Bulat Ziganshin wrote:
Hello Kirsten,
Friday, December 29, 2006, 6:30:22 PM, you
What would the Comprehensible class have? And how would it
be different from Monad(Zero)?
-- Lennart
On Dec 30, 2006, at 10:05 , Diego Navarro wrote:
I was solving some programming puzzles today[1], and found myself
pining for Map comprehensions.
Maybe there should be a
Before you start adding pragmas, try compiling with -O, it does a lot
of the specialization automatically.
-- Lennart
On Dec 29, 2006, at 15:00 , Grady Lemoine wrote:
I've performed some experiments in GHCi, and it looks like even for a
simple function (+) (which should be the worst
Yes, Bluespec has efficient type level naturals. But it only has
arithmetic and some trivial decision procedures. The slogan is the
type checker knows arithmetic, not algebra.
It worked pretty well. But you soon get into situations where you
need polymorphic recursion of functions with
I would not advocate using the fail operation in a monad. It doesn't
belong there, and hopefully it will go away some day. :)
-- Lennart
On Dec 23, 2006, at 02:21 , Stefan O'Rear wrote:
On Fri, Dec 22, 2006 at 08:05:08PM -0500, Steve Downey wrote:
Although terse, the subject
On Dec 21, 2006, at 15:53 , Neil Mitchell wrote:
Hi
there are really no choices for real development. many libraries,
language
extensions and techniques are for ghc only
I develop everything in Hugs, including the Yhc compiler itself. Hugs
is great. There are lots of extensions in GHC,
It's possible to augment Haskell type system to be the one in
Epigram. But it would no longer be Haskell. :) And to meet the
goals of Epigram you'd also have to remove (unrestricted) recursion
from Haskell.
-- Lennart
On Dec 21, 2006, at 23:46 , Brian Hulley wrote:
Jacques
I'm allergic to hex constants. Surely, they are not necessary.
-- Lennart
On Dec 18, 2006, at 18:14 , Chris Kuklewicz wrote:
Hi all (and Don!),
I have some rewritten versions of readInt below...
Bulat Ziganshin wrote:
Hello Donald,
Monday, December 18, 2006, 3:51:48 AM, you
If the type checker really deduces the type 'forall a b . C a b = a -
a' then an inference algorithm that works seems easy. Do type
inference for f, then check that the signature the user has given is
alpha-convertible with the deduced type (well, in general it's more
complicated than
would still not be able to use the
signature inferred by GHCi, but it would now be clear why
that is the case (and why the signature above does not work).
Claus
- Original Message - From: Simon Peyton-Jones
[EMAIL PROTECTED]
To: Lennart Augustsson [EMAIL PROTECTED]
Cc: GHC users glasgow
, but (b) it affects only very few
programs and ones that are almost certainly ambiguous anyway, and
(c) I can't see an easy way to fix it. So my current plan is: let
it lie.
I'll open a low-priority bug report for it though.
Simon
| -Original Message-
| From: Lennart Augustsson [mailto
On Dec 11, 2006, at 03:50 , Johannes Waldmann wrote:
let data Bar = ... in ...
If you allow this you need to be very careful about type equality.
When is Bar equal to Bar?
If it's inside a recursive function, does each invocation get its own
Bar? (In SML the answer is yes.) If you
Your two examples are different, the second one is rejected by the
type checker, with or without a signature. The first one isn't.
Tell me how this make sense:
1. I enter the definition for f.
2. I ask ghc for the type of f and get an answer.
3. I take the answer and tell ghc this is
Oh, come on. It's not that bad. Just start every module with
import Prelude()
import MyPrelude
that's what I do. There's nothing sacred about the Prelude (except a
few things used for special syntax). It just happens to be in scope.
-- Lennart
On Dec 8, 2006, at 15:04 , Dan
And why isn't C a b equivalent to C a b1?
forall a b . C a b = a - a
and
forall a b1 . C a b1 = a - a
look alpha convertible to me. Or is the inferred type
forall a . C a b1 = a - a
Btw, this reminds me again that I'd like to be able to use _ in type
signatures.
With the meaning of _
altogether (but only a few people
advocate this (hello John!)).
-- Lennart
On Dec 7, 2006, at 07:20 , Johannes Waldmann wrote:
Lennart Augustsson wrote:
Btw, this reminds me again that I'd like to be able to use _ in type
signatures.
With the meaning of _ being, there's a type here, but I
I should have said that the situation in H98 is quite bad.
There you can't make default instances.
On Dec 7, 2006, at 07:49 , Johannes Waldmann wrote:
Lennart Augustsson wrote:
Speaking of wishlist, I'd also like to see context synonyms, e.g.,
context C a = (Ord a, Num a)
The current
My (off-the-top-of-my-head) suggestion was much more modest.
A context synonym would only allow you to shorten contexts, it would
not be a new class.
On Dec 7, 2006, at 10:53 , J. Garrett Morris wrote:
On 12/7/06, Lennart Augustsson [EMAIL PROTECTED] wrote:
Speaking of wishlist, I'd also
That's great! Thanks for the hard work, Krasimir.
One question, where can I find the source? I didn't see anything
about that on the download page.
-- Lennart
On Nov 28, 2006, at 02:30 , Krasimir Angelov wrote:
Hello Haskellers,
I am happy to announce that there is a prerelease
.
-- Lennart
On Nov 28, 2006, at 09:50 , Bertram Felgenhauer wrote:
Dinko Tenev wrote:
On 11/27/06, Lennart Augustsson [EMAIL PROTECTED] wrote:
GHC doesn't normally do CSE. CSE can cause space leaks, so you
can't
do it willy-nilly.
I'm sure there are some strict contexts where it could
GHC doesn't normally do CSE. CSE can cause space leaks, so you can't
do it willy-nilly.
I'm sure there are some strict contexts where it could be done
safely, but I don't think ghc uses that information (yet).
-- Lennart
On Nov 27, 2006, at 08:34 , Christian Maeder wrote:
the
It's not a bug. It's what the type of ($) forces.
On Nov 24, 2006, at 12:37 , Seth Gordon wrote:
Taral wrote:
Ah, the dreaded $ with existential types problem. $ is not quite
equivalent to application -- the type checker does something funny
with forall types. Just take out the $ and you'll
Exactly!
On Nov 17, 2006, at 07:30 , Henning Thielemann wrote:
It seems to me like the discussion about static typesafety vs. no
or weak
typesafety. (Which still exists with respect to several Haskell
libraries.) Of course, all type errors can be catched also by a
debugger.
So was the
Should Haskell also provide unrestricted side effects, setjmp/
longjmp, missile launching functions, etc? After all, people who
don't want to use them can just avoid them. :)
On Nov 15, 2006, at 05:07 , Neil Mitchell wrote:
Hi
Yes, these techniques are fairly well known now, and
To follow up on my own post. I implemented the overloaded strings
last night and it seems to work pretty well. I've not done anything
about defaulting yet. I don't know how much of a problem this will
be in practice.
On Nov 10, 2006, at 22:49 , Lennart Augustsson wrote:
I think it's
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:haskell-prime-
[EMAIL PROTECTED] On Behalf Of
| Lennart Augustsson
| Sent: 11 November 2006 03:49
| To: Haskell Prime
| Subject: String literals
|
| I think it's time that string literals got overloaded just like
| numeric literals
Some time ago I made a little experiment and implemented an
interpreter for the lambda-calculus in Haskell. The only reason was
that I wanted to try different ways of doing it. So I did it using
simple substitution (i.e., as the textbooks describe it), unique
identifiers, deBruijn
I think it's time that string literals got overloaded just like
numeric literals. There are several reasons for this. One reason is
the new fast string libraries. They are great, but string literals
don't work; you need to pack them first. Another reason is the
increasing use of
at 10:49:15PM -0500, Lennart Augustsson wrote:
Any thoughts?
what about pattern matching?
Yes, pattern matching is the issue that occurs to me too.
While string literals :: ByteString would be nice (and other magic
encoded in string literals, I guess), what is the story for pattern
matching
But DEC's language FOCAL had fractional line numbers. :)
On Nov 7, 2006, at 06:00 , Henning Thielemann wrote:
On Mon, 6 Nov 2006, Bulat Ziganshin wrote:
Hello Henning,
Monday, November 6, 2006, 1:27:54 PM, you wrote:
print msg `on` mode==debug
but failed because my code frequently
On Nov 7, 2006, at 11:47 , [EMAIL PROTECTED] wrote:
Henning Thielemann wrote:
On Tue, 7 Nov 2006, Simon Marlow wrote:
I'd support fractional and negative fixity. It's a simple change to
make, but we also have to adopt
http://hackage.haskell.org/cgi-bin/haskell-prime/trac.cgi/wiki/
But DEC's language FOCAL had fractional line numbers. :)
On Nov 7, 2006, at 06:00 , Henning Thielemann wrote:
On Mon, 6 Nov 2006, Bulat Ziganshin wrote:
Hello Henning,
Monday, November 6, 2006, 1:27:54 PM, you wrote:
print msg `on` mode==debug
but failed because my code frequently
On Nov 7, 2006, at 11:47 , [EMAIL PROTECTED] wrote:
Henning Thielemann wrote:
On Tue, 7 Nov 2006, Simon Marlow wrote:
I'd support fractional and negative fixity. It's a simple change to
make, but we also have to adopt
http://hackage.haskell.org/cgi-bin/haskell-prime/trac.cgi/wiki/
kello 22:04 -0500, Lennart Augustsson kirjoitti:
The whole point of writing the Mersenne Twister was that I wanted to
show how a stateful computation could be encapsulated in the ST monad
and none of it showing up outside. This aspect of the code is
totally gone now when everything is in the IO
:
Hi all,
On HaWiki was an announcement of MersenneTwister made by Lennart
Augustsson. On a typical run to find out 1000th rnd num the
output
is (code shown below):
$ time ./testMTla
Testing Mersenne Twister.
Result is [3063349438]
real0m4.925s
user0m4.856s
I was exercising
it in the IO monad?
-- Lennart
On Nov 1, 2006, at 20:51 , Lemmih wrote:
On 11/1/06, isto [EMAIL PROTECTED] wrote:
Hi all,
On HaWiki was an announcement of MersenneTwister made by Lennart
Augustsson. On a typical run to find out 1000th rnd num the
output
is (code shown below
If we allow C{..} in patterns we should absolutely have it in
expressions too. Both for symmetry and usefulness.
-- Lennart
On Oct 31, 2006, at 14:06 , Iavor Diatchki wrote:
Hello,
I think the it may be confusing to novices argument tends to be
over-used and we should be careful
Funny that you should mention this idea. I spent last night and this
morning implementing it in ghc. But I use '..' instead of '*'.
The punning is available both for expressions and patterns.
I am of two minds about this extension. It introduces bound
variables without mentioning the
Look in http://darcs.augustsson.net/Darcs/, it's in the CReal
repository.
-- Lennart
On Oct 20, 2006, at 06:19 , Henning Thielemann wrote:
On
http://www.haskell.org/hawiki/ExactRealArithmetic
there is a module by David Lester mentioned, with a link to
You don't mean checking kind, but checking type.
The same argument that can be made for the monomorphism restriction
at base type can be used for function types too.
There is nothing impossible about prefixpostfix operator. Haskell
just happens not to have them. They could be added.
On Oct 11, 2006, at 03:58 , Bulat Ziganshin wrote:
Hello oleg,
Wednesday, October 11, 2006, 6:12:23 AM, you wrote:
Annotate the data type using a GADT:
data MyData a where
MyCon :: MyData a
It helps to reduce confusion about the merits of various features and
additions to Haskell if we
Well, Kent Petersson and I proposed them as an addition to Haskell in
1994, so they are not that new. :)
-- Lennart
http://web.cecs.pdx.edu/~sheard/papers/silly.pdf
On Oct 11, 2006, at 09:47 , Paul Hudak wrote:
Lennart Augustsson wrote:
Well, I think the GADT type definition
On Oct 10, 2006, at 08:49 , Matthias Fischmann wrote:
On Tue, Oct 10, 2006 at 08:10:44PM +0800, [EMAIL PROTECTED] wrote:
To: haskell-cafe@haskell.org
From: [EMAIL PROTECTED]
Date: Tue, 10 Oct 2006 20:10:44 +0800
Subject: [Haskell-cafe] beginner's problem about lists
Hi all,
I'm trying to
On Oct 10, 2006, at 14:58 , Jón Fairbairn wrote:
Bulat Ziganshin [EMAIL PROTECTED] writes:
Hello Jon,
Tuesday, October 10, 2006, 1:18:52 PM, you wrote:
Surely all but one of the comparisons is unnecessary? If you
use `compare` instead of (==) and friends, won't one do (I'm
assuming that
I think your first try looks good. The only thing to worry about
would be the + being too lazy. But that's easy to fix at the same
time as improving your code in another respect.
It's usually good to use real types instead of synonyms, so let's do
that.
data Nom = Nom Int Int
type
On Oct 3, 2006, at 03:49 , Ross Paterson wrote:
On Tue, Oct 03, 2006 at 10:44:49AM +1000, Thomas Conway wrote:
I've been [trying to] grapple with the various monads and
transformers, and it occurs to me that the standard instance for
Either as a monadic type is unnecessarily restrictive. Is
wrote:
On Tue, Oct 03, 2006 at 07:52:54AM -0400, Lennart Augustsson wrote:
Yes, having fail in the Monad is a horrible wart.
And like some other warts in Haskell it was added to cure the symptom
rather than the disease. :(
Switching metaphors, what do you see as the disease in this case
Hang on, hang on, now I'm getting confused.
First you asked for the smallest (positive) x such that
1+x /= x
which is around x=4.5e15.
Then Joachim wondered if you wanted
1+x /= 1
which is around x=2.2e-16.
But not you claim to be looking for the smallest positive number that
a Double
Haskell doesn't provide such a value, but you could easily compute it
from from the values given in the RealFloat class. It tells you the
base, number of digits in mantissa, etc.
As for using such an eps in a convergence test I'd be very careful.
How do you know that your iteration
The library works when Int has at least 32 bits. So 64 should be fine.
I guess it should be rewritten with Int32.
-- Lennart
On Sep 28, 2006, at 08:05 , GHC wrote:
#801: random list from randomseed ... amd64 differs
---
I don't think GHC is to blame in this case. If you follow all the
API (ABI) guidelines for building XLLs things work fine.
But there's a lot of things to get right.
-- Lennart
On Sep 25, 2006, at 05:16 , Simon Peyton-Jones wrote:
Andreas, Nikunj, and others
I don't have any
And what would rotating an Integer mean? The only sensible
interpretation I can think of is to make it behave like shift.
On Sep 18, 2006, at 23:46 , Peter Tanski wrote:
Welcome back! Since Data.Bits is not defined in the Haskell 1998
standard, are we free to change the implementation of
Or even shorter:
subst e l = concatMap $ \x-if x==e then l else [x]
I kinda like the list comprehension version too
subst e l1 l2 = [ r | x - l2, r - if x==e then l1 else [x] ]
On Sep 18, 2006, at 10:54 , Jón Fairbairn wrote:
Andrea Rossato [EMAIL PROTECTED] writes:
On Mon, Sep 18, 2006
Well, you can do it with the existing recursion in Haskell
let yc f = f (yc f)
Or you can encode it with type level recursion and no value recursion
by using a recursive data type.
-- Lennart
On Sep 15, 2006, at 08:11 , Haihua Lin wrote:
Hi,
Writing
yc = \f - (\x - f(x
501 - 600 of 1011 matches
Mail list logo