to be evaluating f on an argument before f
can force the argument. If you evaluate id x, you
necessarily evaluate x. I don't think (2) is a very good
definition, since I don't know what forces means here.
--
Jón Fairbairn [EMAIL PROTECTED
Duncan Coutts [EMAIL PROTECTED] writes:
On Sun, 2006-07-30 at 10:56 +0100, Jón Fairbairn wrote:
David House [EMAIL PROTECTED] writes:
1) f is strict iff f _|_ = _|_.
2) f is strict iff it forces evaluation of its arguments.
In (2), you have to be evaluating f on an argument before f
-- especially if there's a large concern on your
case (we want to use your patented idea. Oh, it looks like
your code uses one of our patented ideas; you'll be hearing
from our lawyers).
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont
'show' as the second hit, and
that's the function you want.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
0x002d for unary minus, 0x2010 in
identifiers and 0x2212 for infix minus... and spend many a
happy hour trying to tell which of the three was intended by
some short horizontal line.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont
-minuses preceded by a minus. Or have I lost the plot
somewhere?
Aside:
Is there already name for `chThen`? ie (liftM2 (:)); I had a
feeling we were avoiding liftM friends for some reason.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont
understand.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-07-14)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
is that if you proceed by debugging
rather than rewriting, you are likely to end up with this
sort of mess. Personally, I don't mind too much if that kind
of programmer finds Haskell too hard. Elitist? Certainly!
Immorally so? No.
--
Jón Fairbairn [EMAIL PROTECTED]
http
“+”
And there's always Hoogle (and the documentation it links
to) if you want to find something of a particular
type. Kudos to Neil for producing this, by the way (though I
do hope his remarks about the readability of his code were a
more self deprecating than accurate).
--
Jón Fairbairn
of “head” in my code seem to be
applied to infinite lists, or commented out, or rebindings
of head to something else, sloppy bits of nonce programming
or references in comments to the top of my own noddle.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf
be empty, but I can't prove it.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
that steps through the execution of the code. Such
a debugger is inappropriate for Haskell programmers, and
doubly so for beginners.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
):
we define a C preprocessor macro fromJust.
Curiously, the only bug in darcs that has bitten me so far
was a use of fromJust. Perhaps that indicates a weakness in
the style, rather than the tools?
--
Jón Fairbairn [EMAIL PROTECTED
at the
opposite tack of making “-” solely infix and using something
else for negate (as in ML), although finding a different
token (such as “__”) for don't care and using “_” for
unary minus doesn't seem too bad to me.
--
Jón Fairbairn [EMAIL PROTECTED
of syntax, and formerly valid
programmes break. So why not just say that varsym varid is
in general reserved for future special syntaxes, and require
varsym whitespace varid everywhere?
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html
for them.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-07)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
, as this fails in ghc at
the type-checking stage.)
I don't think it would complicate mechanical parsing
unreasonably. I do think (if done without the parentheses)
it might complicate /human/ parsing unreasonably.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf
Aaron Denney [EMAIL PROTECTED] writes:
Jón Fairbairn [EMAIL PROTECTED] wrote:
I think the present design is wrong because we don't have a
type for naturals.
Meh. Naturals are reasonably useful sometimes, but not often enough, in
my opinion. Any sort of numeric hierarchy designed
is a nice and
reasonable algebraic property that Float and Double don't
obey. In fact Float and Double have lots of /un/reasonable
algebraic properties, but we still have them in the
language. (I think they should be turfed out into a
numerical library).
--
Jón Fairbairn
Brian Hulley [EMAIL PROTECTED] writes:
Jón Fairbairn wrote:
[1] “-” is a varsym. The logical way of achieving what you
suggest (ie -1 -2... as constructors for Integer) would be
to make it introduce a consym the way “:” does, but then it
couldn't be an infix operator anymore.
I don't
where subst_elem x
| x == e = l'
| otherwise = [x]
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
Andrea Rossato [EMAIL PROTECTED] writes:
On Mon, Sep 18, 2006 at 12:42:59PM +0100, Jón Fairbairn wrote:
And if you do that, you can write it like this:
subst e l'
= concat . map subst_elem
where subst_elem x
| x == e = l
to use to
indicate failure... but judicious use of catMaybes
. concat. maybeToList might help with that.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
something about it. See
http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13)
___
Haskell-Cafe mailing list
, if it doesn't get mended for long enough,
Haskell' might accept the present layout.
http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13
David Curran [EMAIL PROTECTED] writes:
Hi
I have been trying to learn haskell (tip over the vending machine)
Tipping over a vending machine is a real world effect, so
you'll have to use the IO Monad.
--
Jón Fairbairn [EMAIL PROTECTED
Bulat Ziganshin [EMAIL PROTECTED] writes:
Hello David,
Tuesday, October 3, 2006, 2:17:33 PM, you wrote:
Does anyone know of a Haskell compiler that will run from a USB stick?
i'm ôäüùûå sure
Блым?
--
Jón Fairbairn [EMAIL PROTECTED
that the compiler can convert cases on LT, EQ and
GT into something sensible -- after all, wasn't that the
purpose of compare?)?
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13
)
Is it? Is there equivalent code to “my_sqrt :: Float -
Float”? (that might be pertinent).
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13)
___
Haskell-Cafe
without due
consideration of the implications).
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
effect... I
made a more concrete proposal later and Phil Wadler tidied
it up. I think It even got as far as a draft of the
language, but I think it was decided that it was just too
difficult (both for human and computer) to parse.
--
Jón Fairbairn [EMAIL PROTECTED
Nils Anders Danielsson [EMAIL PROTECTED] writes:
On Mon, 16 Oct 2006, Jón Fairbairn [EMAIL PROTECTED] wrote:
I made a more concrete proposal later and Phil Wadler tidied it up.
I think It even got as far as a draft of the language, [...]
Do you know where this proposal/draft can
, but at least they
illustrate the use of unfoldr. [aside: One might argue that
the prelude ought to provide splitAtMb rather than splitAt.]
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
(splitAtMb n) ...
in_fives = groups_of 5
:-)
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
) -- in Data.Graph.Inductive.Query.Monad
which is a little bit inefficient, but less clunky than
checking for the end of list in order to apply padwith just
once.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
top = fst splt
bot = snd splt
you can write
where (top,bot) = splitAt ... But how about List.break?
And if you know that bot is going to have enough elements
where (top, card1:card2:rest) = break ...
--
Jón Fairbairn
is what you said, but I think this highlights the
source of confusion better.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
. So there's no need to have a
representation of it beyond the source code.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
out there? Could we get
drawings of these monsters? I'd love to see the 'mysterious and
awesome IO' in pictorial form.
For that, an image has already (after considerable effort
and expense in tracking down the beast) been created:
http://tinyurl.com/yddv4z
--
Jón Fairbairn
Simon Marlow [EMAIL PROTECTED] writes:
Nicolas Frisby wrote:
Let's remember that if something is broke, it's only _right_ to _fix_
it. I patiently waited for someone else to make that pun.
Understanding the language won't be much harder, but understanding
fixity declarations will
an
imposition.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
.
Your headNote is a good approach, but it strikes me that
it's a bit redundant. Instead of “headNote foo” just use
“headDef (error foo)”. It's a wee bit longer, but having
the “error” out there in the open seems more honest somehow,
and there would be fewer function names to remember.
--
Jón
Robert Dockins [EMAIL PROTECTED] writes:
On Nov 15, 2006, at 9:48 AM, Jón Fairbairn wrote:
But instead of “blah (head [ v | (n,v) - env, n==target ])
blah”, you could write
blah the_v_in_scope blah
where (the_v_in_scope:_) = [ v | (n,v) - env, n==target ]
Or how about
and extend_infinitely might be more
generally userful. I've probably missed something better,
too.
A point free reduction might look like the following and probably
isn't worth it:
isPrefixOf = (and .) . flip flip False . flip flip True . zipWith'' (==)
probably?
--
Jón Fairbairn
Jón Fairbairn [EMAIL PROTECTED] writes:
Jason Dagit [EMAIL PROTECTED] writes:
Well, this is basically just a zip with a special base case. But you
[...]
I wonder if there is mileage to be had from persuing
something like this, rather different (off top of head, very
provisional, EOE c
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
statement:
T _ a y b = ins s
Here it's a pattern match. So if ins s returns (T x a' y'
b'), then a = a'; y = y'; b = b' are used in the expresion
covered by the where clause.
--
Jón Fairbairn [EMAIL PROTECTED
into ghc enlighten you at all?
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
and hijack the phrase
functional programming
I think we should call it Abstraction Oriented
Programming. It's got the oriented buzzword in it, and we
don't need to tell folk that abstraction means more than
one thing to us until we're sure they're OK.
--
Jón Fairbairn
= localhost, port = 25}
which would save having a defaultFoo for every Foo (at the
possible expense of occasional explicit types).
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
,
Sure, but it's not obvious to me that we're looking at one
of the warts here, unless the problem is that my Furniture
above isn't extensible in the appropriate sense or someone
wants the different coulour fields to have different types
(confusing, surely?).
--
Jón Fairbairn
at that same
1987 meeting.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Paul Johnson [EMAIL PROTECTED] writes:
I'd read Eric Raymond's piece about being a hacker, where
he said to learn Lisp for the side effects.
Much better to learn Haskell for the side effects! ;-)
--
Jón Fairbairn [EMAIL PROTECTED
advantage of the pseudo O(n)
lookup time of arrays, you could use a NaturalTree of arrays
of some fixed size -- but arrays are O(log n) really...
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell
different names for the same
concept on different types.
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
the other day and didn't find it.
I'm glad it's there in 6.6
--
Jón Fairbairn [EMAIL PROTECTED]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2006-09-13)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
the different types
of the Ops in different types in their representations.
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
CUP to make them
freely accessible after a year or two?
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
for a constant¹), to avoid the
problems caused by global variables is one of the reasons
for using a functional language.
[1] as in
e = exp 1
--
Jón Fairbairn [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe
59 matches
Mail list logo