Skip to content

base: export default ifThenElse implementation for RebindableSyntax

Motivation

People making use of RebindableSyntax not seeking to rebind the if statement are forced to either explicitly define it or avoid using such statements. Considering many (citation needed) uses of RebindableSyntax only use it to rebind a handful of items, and leave the rest to the default interpretation, this is especially annoying. Besides which, it seems reasonable that

{-# LANGUAGE RebindableSyntax #-}
import Prelude

should be a nop at the top level (at the local level, bindings might shadow Prelude bindings, but that behaviour again looks reasonable).

As for taking up name space, users of RebindableSyntax already need to fiddle with Prelude's import list, adding one name to hide/expose shouldn't be a problem.

Proposal

Export

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

from Prelude

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information