Add Boolean type families to 'base' package
Sometimes you want type families to perform type level computation with booleans. Specifically:
type family If (p :: Bool) (ifTrue :: k) (ifFalse :: k) :: k where ...
type family (a :: Bool) && (b :: Bool) :: Bool where ...
type family (a :: Bool) || (b :: Bool) :: Bool where ...
type family Not (a :: Bool) :: Bool where
Similar to existing module Data.Bool in base
package for boolean expressions.
There's not a single package with such type families for type-level boolean computations. Even if it exists it probably would very small. And as a library author you probably don't wan extra dependencies for your package because cost of adding new dependency for your project is much bigger than cost of adding module to existing dependencies (if it's possible of course).
It seems to me that such operations are kinda basic. And they just promote behavior of already existed expression-level functions to type level. And we already have type families for Integer
, Natural
and String
(aka Symbol
) and several type families returning Bool
(==
, <=?
) in base
. So I propose to add couple useful utilities to operate with Bool
explicitly.
If this proposal approved I'm willing to contribute to ghc
!