# Difference between revisions of "Talk:If-then-else"

From HaskellWiki

ConorMcBride (talk | contribs) (liftM3 if' considered harmful) |
TomLokhorst (talk | contribs) (bool-extras package on Hackage) |
||

Line 3: | Line 3: | ||

liftM3 if' (return False) deleteHardDrive (return ()) |
liftM3 if' (return False) deleteHardDrive (return ()) |
||

− | executes deleteHardDrive, then decides to return the value of (return ()). |
+ | executes deleteHardDrive, then decides to return the value of (return ()). --[[User:ConorMcBride|Conor McBride]] 14:41, 4 March 2008 (UTC) |

+ | |||

+ | == bool-extras == |
||

+ | |||

+ | I've just uploaded a package to Hackage that contains a similar function to the proposed <hask>if'</hask>. |
||

+ | |||

+ | It's called <hask>bool</hask> after the data type, similarly to <hask>maybe</hask> and <hask>either</hask>. Its arguments are in the exact opposite order of the <hask>if'</hask> function, since I think this makes partial application easier (everywhere I've used it, I either provide the first or the first two arguments). |
||

+ | |||

+ | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bool-extras |
||

+ | --[[User:TomLokhorst|TomLokhorst]] 09:09, 13 May 2009 (UTC) |

## Latest revision as of 09:09, 13 May 2009

Just to remark that

liftM3 if' (return False) deleteHardDrive (return ())

executes deleteHardDrive, then decides to return the value of (return ()). --Conor McBride 14:41, 4 March 2008 (UTC)

## bool-extras

I've just uploaded a package to Hackage that contains a similar function to the proposed `if'`

.

It's called `bool`

after the data type, similarly to `maybe`

and `either`

. Its arguments are in the exact opposite order of the `if'`

function, since I think this makes partial application easier (everywhere I've used it, I either provide the first or the first two arguments).

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bool-extras --TomLokhorst 09:09, 13 May 2009 (UTC)