On Jul 26, 2006, at 6:44 PM, Sebastian Sylvan wrote:
For example ...
if :: Bool - a - a - a
if True t _ = t
if False _ e = e
-- example usage
myAbs x = if (x 0) (negate x) x
I suppose there might also be a case for flipping the arguments about
like this:
if :: a - a - Bool - a
I often find myself at odds with this choice. The reason is that I use
Haskell as a host for embedded languages, and these often come with
their own control flows. So I find myself wanting to write my own
definition of the if-then-else construct that works on terms of some
other type, e.g. tests
I often find myself at odds with this choice. The reason is that I use
Haskell as a host for embedded languages, and these often come with
their own control flows. So I find myself wanting to write my own
definition of the if-then-else construct that works on terms of some
other type, e.g. tests
Niklas Broberg wrote:
I often find myself at odds with this choice. The reason is that I use
Haskell as a host for embedded languages, and these often come with
their own control flows. So I find myself wanting to write my own
definition of the if-then-else construct that works on terms of some
On Wed, 26 Jul 2006, Fritz Ruehr wrote:
On Jul 26, 2006, at 6:44 PM, Sebastian Sylvan wrote:
For example ...
if :: Bool - a - a - a
if True t _ = t
if False _ e = e
-- example usage
myAbs x = if (x 0) (negate x) x
I suppose there might also be a case for flipping the
On 2006-07-27 at 01:33EDT Paul Hudak wrote:
Thanks for asking about this -- it probably should be in the paper. Dan
Doel's answer is closest to the truth:
I imagine the answer is that having the syntax for it looks nicer/is
clearer. if a b c could be more cryptic than if a then b
to put a feature request in Trac?
Simon
| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Niklas
| Broberg
| Sent: 27 July 2006 09:01
| To: Haskell-cafe
| Subject: Re: [Haskell-cafe] Why does Haskell have the if-then-else
syntax?
|
| I often find myself
On Thu, Jul 27, 2006 at 10:22:31AM +0100, Jon Fairbairn wrote:
On 2006-07-27 at 01:33EDT Paul Hudak wrote:
Thanks for asking about this -- it probably should be in the paper. Dan
Doel's answer is closest to the truth:
I imagine the answer is that having the syntax for it looks
On 2006-07-27 at 13:01+0200 Tomasz Zielonka wrote:
But because if-then-else is an expression, there is another
problem.
That was exactly my point when I made the muttering about
self-bracketing (if ... fi, like everything else, is an
expression in Algol68) all those years ago. I really regret
Jon Fairbairn wrote:
On 2006-07-27 at 13:01+0200 Tomasz Zielonka wrote:
Also, after a few years of Haskell programming, I am still not
sure how to indent if-then-else.
what I was alluding to in my footnote...
I think there's really only one way when it needs to occupy more than one
line:
On 27/07/06, Brian Hulley [EMAIL PROTECTED] wrote:
I think there's really only one way when it needs to occupy more than one
line:
if c
then t
else f
Confusingly,
if c
then t
else f
Also works, although no-one really knows why.
--
-David House, [EMAIL
David House wrote:
On 27/07/06, Brian Hulley [EMAIL PROTECTED] wrote:
I think there's really only one way when it needs to occupy more
than one line:
if c
then t
else f
Confusingly,
if c
then t
else f
Also works, although no-one really knows why.
Only if
On 27/07/06, Brian Hulley [EMAIL PROTECTED] wrote:
I'd be in favour of /if /case /let /\ etc instead of fi esac tel because it
looks more systematic and follows the usual XML conventions for end tags.
I'd suggest that floating point division should just be written `divide` -
it's just a very
Thanks for the answer. (And doubly thanks for giving the answer I
hoped for!)
I propose that ifThenElse and thenElseIf be added to the Prelude for
Haskell'. While these names are a bit long, I think we want both
functions and these names make the behaviors clear (to me, at least).
Comments?
I had hoped the History of Haskell paper would answer a question
I've pondered for some time: why does Haskell have the if-then-else
syntax? The paper doesn't address this. What's the story?
thanks,
-m
___
Haskell-Cafe mailing list
As opposed to what?
Mike
Mike Gunter wrote:
I had hoped the History of Haskell paper would answer a question
I've pondered for some time: why does Haskell have the if-then-else
syntax? The paper doesn't address this. What's the story?
thanks,
-m
On 7/27/06, mvanier [EMAIL PROTECTED] wrote:
As opposed to what?
For example case-of, guards (in combination with let or where), or
just a function:
if :: Bool - a - a - a
if True t _ = t
if False _ e = e
-- example usage
myAbs x = if (x 0) (negate x) x
/S
--
Sebastian Sylvan
Quoth Sebastian Sylvan [EMAIL PROTECTED]:
| On 7/27/06, mvanier [EMAIL PROTECTED] wrote:
| As opposed to what?
|
| For example case-of, guards (in combination with let or where), or
| just a function:
|
| if :: Bool - a - a - a
| if True t _ = t
| if False _ e = e
|
| -- example usage
| myAbs x =
Mike Gunter wrote:
I had hoped the History of Haskell paper would answer a question
I've pondered for some time: why does Haskell have the if-then-else
syntax? The paper doesn't address this. What's the story?
thanks,
-m
Thanks for asking about this -- it probably should be in the paper.
19 matches
Mail list logo