Add ifThenElse and (?) to Data.Bool

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Add ifThenElse and (?) to Data.Bool

winter
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

David Feuer

If ifThenElse is good for RebindableSyntax, then I'm +1 on that (but I've never played with that extension, so I don't really know). I'm -1 on (?). We already have bool, which tends to be rather more useful when partially applied.


On Nov 16, 2016 9:43 PM, "winter" <[hidden email]> wrote:
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

M Farkas-Dyck-2
In reply to this post by winter
Could we use `bool` rather than add a new term for RebindableSyntax?
i.e. define if-then-else in terms of `bool`.
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

winter
In reply to this post by David Feuer
I’m totally aware of the existence of bool, i suppose (?) is mainly used in fully application to get a different style than if-then-else syntax, say,

...
    isGoo <- checkGoo
    isGoo ? goo
          $ woo
...


But like what the wiki suggested, (?) can be used in some high-order situations. I like this operator because the mnemonic of questioning meaning.



On 17 Nov 2016, at 11:03, David Feuer <[hidden email]> wrote:

If ifThenElse is good for RebindableSyntax, then I'm +1 on that (but I've never played with that extension, so I don't really know). I'm -1 on (?). We already have bool, which tends to be rather more useful when partially applied.


On Nov 16, 2016 9:43 PM, "winter" <[hidden email]> wrote:
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

David Feuer
In reply to this post by M Farkas-Dyck-2

If this rebindable syntax is about what I think it is, that would seem strange. bool is the Bool eliminator. It would seem weird to give it a type like, say,

bool :: Monad m => m a -> m a -> m Bool -> m a


On Nov 16, 2016 10:06 PM, "M Farkas-Dyck" <[hidden email]> wrote:
Could we use `bool` rather than add a new term for RebindableSyntax?
i.e. define if-then-else in terms of `bool`.
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Ivan Lazar Miljenovic
In reply to this post by winter
I'm -0.5 on ifThenElse (if it can be used with RebindableSyntax then
someone may want to use it, though I personally find the bool function
to be more than sufficient as I tend to find the "which branch do I
choose" argument to be the last when constructing function pipelines),
and -1 for the operator.

On 17 November 2016 at 13:43, winter <[hidden email]> wrote:

> It seems this’s a very old request, see
> https://wiki.haskell.org/If-then-else. I’d like to see following:
>
>
> ifThenElse :: Bool -> a -> a -> a
> ifThenElse True  x _ = x
> ifThenElse False _ y = y
>
>
> infixr 1 ?
> (?) :: Bool -> a -> a -> a
> (?) = ifThenElse
>
>
> in Date.Bool module, it will have advantages that:
>
>
> + It’s more composable than syntax.
>
> + Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more
> consistent with (f . g $ x) style, and save key strokes.
>
> + In module with RebindableSyntax enabled, you can import ifThenElse to get
> default behavior.
>
>
> Whether or not to be exported by Prelude is another question, but Data.Bool
> seems a good place to start with.
>
>
> Cheers~
>
> Winter
>
>
> _______________________________________________
> Libraries mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>



--
Ivan Lazar Miljenovic
[hidden email]
http://IvanMiljenovic.wordpress.com
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

winter
In reply to this post by winter
And here’s some other stuff i can came up with it(without obscured readability IMHO):

...
   -- replacement for ifM in various package, similar to (>>= when)
   
   (mFlag >>= (?)) flagEnabled        -- mFlag :: Monad m => m Bool
                 $ flagDisabled
  
   -- nicer if-then-else in applicative style
   (?) <$> fFlag <$> flagEnabled
                 <*> flagDisabled

   -- compose with predicates to define your own if
   ifLower =  (?) . isLower
   ifLower ‘X’ lower
               upper 
...


Basically it's a good if-then-else replacement if you’re comfortable with point-free style.


On 17 Nov 2016, at 11:16, winter <[hidden email]> wrote:

I’m totally aware of the existence of bool, i suppose (?) is mainly used in fully application to get a different style than if-then-else syntax, say,

...
    isGoo <- checkGoo
    isGoo ? goo
          $ woo
...


But like what the wiki suggested, (?) can be used in some high-order situations. I like this operator because the mnemonic of questioning meaning.



On 17 Nov 2016, at 11:03, David Feuer <[hidden email]> wrote:

If ifThenElse is good for RebindableSyntax, then I'm +1 on that (but I've never played with that extension, so I don't really know). I'm -1 on (?). We already have bool, which tends to be rather more useful when partially applied.


On Nov 16, 2016 9:43 PM, "winter" <[hidden email]> wrote:
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries




_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Edward Kmett-2
In reply to this post by winter
I'm pretty strongly -1 on adding (?). It is one of the few single character operators available to the average user out of the box and this is a space where we already have established combinators. It is a valuable portion of the namespace to spend and each approach we offer means more inessential complexity to newcomers to the language.

Given the existence of bool today I'm weakly -1 on ifThenElse. That said, if we were to add RebindableSyntax support for it, I think that I'd personally flip around to being in favor. It is a much more clear thing for RebindableSyntax to call out to than something called "bool" that comes with a different argument order.

These are just my personal feelings on the matter, and not any sort of "cast in stone" CLC judgments.

-Edward

On Wed, Nov 16, 2016 at 9:43 PM, winter <[hidden email]> wrote:
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Edward Kmett-2
In reply to this post by winter
(?) <$> fFlag <$> flagEnabled <*> flagDisabled

You probably don't want this. This performs both effects (!), regardless of the flag, but only keeps one result.

-Edward


On Wed, Nov 16, 2016 at 11:01 PM, winter <[hidden email]> wrote:
And here’s some other stuff i can came up with it(without obscured readability IMHO):

...
   -- replacement for ifM in various package, similar to (>>= when)
   
   (mFlag >>= (?)) flagEnabled        -- mFlag :: Monad m => m Bool
                 $ flagDisabled
  
   -- nicer if-then-else in applicative style
   (?) <$> fFlag <$> flagEnabled
                 <*> flagDisabled

   -- compose with predicates to define your own if
   ifLower =  (?) . isLower
   ifLower ‘X’ lower
               upper 
...


Basically it's a good if-then-else replacement if you’re comfortable with point-free style.


On 17 Nov 2016, at 11:16, winter <[hidden email]> wrote:

I’m totally aware of the existence of bool, i suppose (?) is mainly used in fully application to get a different style than if-then-else syntax, say,

...
    isGoo <- checkGoo
    isGoo ? goo
          $ woo
...


But like what the wiki suggested, (?) can be used in some high-order situations. I like this operator because the mnemonic of questioning meaning.



On 17 Nov 2016, at 11:03, David Feuer <[hidden email]> wrote:

If ifThenElse is good for RebindableSyntax, then I'm +1 on that (but I've never played with that extension, so I don't really know). I'm -1 on (?). We already have bool, which tends to be rather more useful when partially applied.


On Nov 16, 2016 9:43 PM, "winter" <[hidden email]> wrote:
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries




_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

winter
Ah Yeah, i see. It’s indeed a rare use case.

From all your feedback, I guess i will make a package with (?) for someone who want to save keystrokes like me ;)



Cheers~
Winter


On 17 Nov 2016, at 12:03, Edward Kmett <[hidden email]> wrote:

(?) <$> fFlag <$> flagEnabled <*> flagDisabled

You probably don't want this. This performs both effects (!), regardless of the flag, but only keeps one result.

-Edward


On Wed, Nov 16, 2016 at 11:01 PM, winter <[hidden email]> wrote:
And here’s some other stuff i can came up with it(without obscured readability IMHO):

...
   -- replacement for ifM in various package, similar to (>>= when)
   
   (mFlag >>= (?)) flagEnabled        -- mFlag :: Monad m => m Bool
                 $ flagDisabled
  
   -- nicer if-then-else in applicative style
   (?) <$> fFlag <$> flagEnabled
                 <*> flagDisabled

   -- compose with predicates to define your own if
   ifLower =  (?) . isLower
   ifLower ‘X’ lower
               upper 
...


Basically it's a good if-then-else replacement if you’re comfortable with point-free style.


On 17 Nov 2016, at 11:16, winter <[hidden email]> wrote:

I’m totally aware of the existence of bool, i suppose (?) is mainly used in fully application to get a different style than if-then-else syntax, say,

...
    isGoo <- checkGoo
    isGoo ? goo
          $ woo
...


But like what the wiki suggested, (?) can be used in some high-order situations. I like this operator because the mnemonic of questioning meaning.



On 17 Nov 2016, at 11:03, David Feuer <[hidden email]> wrote:

If ifThenElse is good for RebindableSyntax, then I'm +1 on that (but I've never played with that extension, so I don't really know). I'm -1 on (?). We already have bool, which tends to be rather more useful when partially applied.


On Nov 16, 2016 9:43 PM, "winter" <[hidden email]> wrote:
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

infixr 1 ?
(?) :: Bool -> a -> a -> a
(?) = ifThenElse

in Date.Bool module, it will have advantages that:

+ It’s more composable than syntax.  
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.

Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.

Cheers~
Winter

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries




_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries




_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Henning Thielemann

On Thu, 17 Nov 2016, winter wrote:

> Ah Yeah, i see. It’s indeed a rare use case.
> From all your feedback, I guess i will make a package with (?) for someone who want to save keystrokes like me ;)

I use if' and (?:) from
    https://hackage.haskell.org/package/utility-ht-0.0.12/docs/Data-Bool-HT.html

E.g. this is very handy:
    if' (even n) "even" $
    if' (isPrime n) "prime" $
    "boring"

(?:) is the uncurried variant of (?). I do not see value in curried (?)
because I can just use `if'` then (which I never did).
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Yitzchak Gale
In reply to this post by Edward Kmett-2
Edward Kmett wrote:
> I'm pretty strongly -1 on adding (?)...
> we already have established combinators...
> more inessential
> complexity to newcomers to the language.

I'm not so worried about that if it's not in the Prelude.
I doubt that this would get wide usage. And if it does,
then maybe that is better use of the namespace
real estate.

I am 0 on (?). I probably would never use it.

I am -1 on ifThenElse. We already have bool. Some
of our developers use it all the time and it's fine.
It's not like "map" and "for" which have common
idioms where parameter order really matters. Other
than that, we shouldn't litter the libraries with flipped
versions of everything.

Anyway, bool is the natural parameter order in Haskell.
I'll make more explicit what others have already said, with
this analogy:

maybe (if it fails) (if it succeeds) (input data)
either (if it fails) (if it succeeds) (input data)
foldl (if it's null) (if it's not null) (input data)
foldr (if it's null) (if it's not null) (input data)

Whereas Haskell's if-then-else syntax is awkward. Some
people (not me) even say it should never be used at all.

And so

bool (if it fails) (if it succeeds) (input data)

makes the most sense.

-Yitz
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Henning Thielemann

On Thu, 17 Nov 2016, Yitzchak Gale wrote:

> Anyway, bool is the natural parameter order in Haskell.
> I'll make more explicit what others have already said, with
> this analogy:
>
> maybe (if it fails) (if it succeeds) (input data)
> either (if it fails) (if it succeeds) (input data)

> foldl (if it's null) (if it's not null) (input data)
> foldr (if it's null) (if it's not null) (input data)

Unfortunately, it is the other way round:

foldl (if it's not null) (if it's null) (input data)
foldr (if it's not null) (if it's null) (input data)
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

winter
I decide to make a standalone package: http://hackage.haskell.org/package/if

Cheers!
Winter

On 17 Nov 2016, at 18:19, Henning Thielemann <[hidden email]> wrote:


On Thu, 17 Nov 2016, Yitzchak Gale wrote:

Anyway, bool is the natural parameter order in Haskell.
I'll make more explicit what others have already said, with
this analogy:

maybe (if it fails) (if it succeeds) (input data)
either (if it fails) (if it succeeds) (input data)

foldl (if it's null) (if it's not null) (input data)
foldr (if it's null) (if it's not null) (input data)

Unfortunately, it is the other way round:

foldl (if it's not null) (if it's null) (input data)
foldr (if it's not null) (if it's null) (input data)
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Elliot Cameron-2
FWIW, Winter, I sorta like that operator and it is even readable to people who use C, JS, etc. Thanks for the library. :)

On Thu, Nov 17, 2016 at 7:19 AM, winter <[hidden email]> wrote:
I decide to make a standalone package: http://hackage.haskell.org/package/if

Cheers!
Winter

On 17 Nov 2016, at 18:19, Henning Thielemann <[hidden email]> wrote:


On Thu, 17 Nov 2016, Yitzchak Gale wrote:

Anyway, bool is the natural parameter order in Haskell.
I'll make more explicit what others have already said, with
this analogy:

maybe (if it fails) (if it succeeds) (input data)
either (if it fails) (if it succeeds) (input data)

foldl (if it's null) (if it's not null) (input data)
foldr (if it's null) (if it's not null) (input data)

Unfortunately, it is the other way round:

foldl (if it's not null) (if it's null) (input data)
foldr (if it's not null) (if it's null) (input data)
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries



_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Joachim Breitner-2
In reply to this post by winter
Hi,

Am Donnerstag, den 17.11.2016, 10:43 +0800 schrieb winter:
> It seems this’s a very old request, see https://wiki.haskell.org/If-t
> hen-else. I’d like to see following:
>
> ifThenElse :: Bool -> a -> a -> a
> ifThenElse True  x _ = x
> ifThenElse False _ y = y

+1 on that. It is strange that GHC desugars to ifThenElse¹ without this
function being available anywhere.

Most (all?) of the other rebindable syntax elements work out of the box
as before with Prelude imported but this one. Therefore, I’d support a
proposal to add ifThenElse to the prelude.

It would also make teaching nicer, by pointing students to this
function and saying „if then else is just syntactic sugar for it“.
Slightly better than „if then else is just syntactic sugar for a
hypothetical function that you can define, but that is not there.“

> infixr 1 ?
> (?) :: Bool -> a -> a -> a
> (?) = ifThenElse

-1. Operators are just too scarce.

Greetings,
Joachim

¹ http://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow
_exts.html#rebindable-syntax-and-the-implicit-prelude-import
--
Joachim “nomeata” Breitner
  [hidden email]https://www.joachim-breitner.de/
  XMPP: [hidden email] • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: [hidden email]
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Add ifThenElse and (?) to Data.Bool

Henning Thielemann

On Mon, 21 Nov 2016, Joachim Breitner wrote:

> It would also make teaching nicer, by pointing students to this
> function and saying „if then else is just syntactic sugar for it“.
> Slightly better than „if then else is just syntactic sugar for a
> hypothetical function that you can define, but that is not there.“

One implementation is there:
    http://hackage.haskell.org/package/utility-ht-0.0.12/docs/Data-Bool-HT.html#v:ifThenElse

if you want to point the students somewhere. :-)
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries