Skip to main content
added 5 characters in body
Source Link
Petr
  • 5.6k
  • 3
  • 32
  • 46

Why does Haskell have a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

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

Why does Haskell have a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

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

Why does Haskell have a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

if :: Bool -> a -> a -> a
if True  x _ = x
if False _ y = y
Tweeted twitter.com/#!/StackProgrammer/status/326334768096612353
fix grammar
Source Link
Kilian Foth
  • 111k
  • 45
  • 301
  • 323

Why does Haskell hashave a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

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

Why Haskell has built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

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

Why does Haskell have a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

if :: Bool -> a -> a
if True  x _ = x
if False _ y = y
Source Link
Petr
  • 5.6k
  • 3
  • 32
  • 46

Why does Haskell have built-in "if/then/else" instead of defining it as a simple library function?

Why Haskell has built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as

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