commit 166e07f464488e79fc091bd642aed744e39fe8b6
parent 3cd23ca31e78d63bd546da77b2ef3c8c35e45361
Author: Robert Russell <robert@rr3.xyz>
Date: Wed, 14 Oct 2026 21:16:49 -0700
Haskell.Bool: init
Diffstat:
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/Lude/Haskell.hs b/src/Lude/Haskell.hs
@@ -6,6 +6,7 @@ module Lude.Haskell (
import GHC.Exts as X (IsList (..), IsString (..), Symbol)
import Lude.Haskell.BaseInterop as X
+import Lude.Haskell.Bool as X (ifThenElse)
import Lude.Haskell.Category as X -- TODO: Probably hide some stuff from here.
import Lude.Haskell.Constraint as X
import Lude.Haskell.Core as X
diff --git a/src/Lude/Haskell/Bool.hs b/src/Lude/Haskell/Bool.hs
@@ -0,0 +1,17 @@
+module Lude.Haskell.Bool (
+ Bool (..),
+ ifThenElse,
+) where
+
+import Data.Bool (Bool (..))
+
+import Lude.Haskell.Core
+import Lude.Haskell.Functional
+import Lude.Haskell.Type
+
+--------------------------------------------------------------------------------
+
+ifThenElse :: forall {r :: Repr} (a :: Type# r). (Functional# r) => Bool -> a -> a -> a
+ifThenElse True = lam2# \t _ -> t
+ifThenElse False = lam2# \_ f -> f
+{-# INLINE ifThenElse #-}