Haskell - Boolean Blindness == True

Posted on April 16, 2020

What does the title even mean? True? for what? Good? Bad? Useful? If it was False, would we see any meaning?

Even the state of a light bulb cannot be properly represented by booleans. Would True mean the light is on? or would it mean off?

What if the decision on whether Boolean Blindess is bad or good is represented with a sum type

data Decision 
  = Bad
  | Good
  deriving Show

makeDecision :: Decision -> Text
makeDecision decision = case decision of
  Bad -> "Boolean blindness is " <> ( show Bad ) <> "!"
  Good -> "Boolean blindess is " <> ( show Good ) <> "!"

I think using the sum type gives it meaning. Now we can make a decision about Boolean Blindess.

I lessen confusion in my code by using booleans conservatively.