commit ce628048588dd86f51337dd39b73ec99f5b9e2fe
parent 30e2a05ed2f7075551fd0811a5e3a1126ad1bbcd
Author: Robert Russell <robert@rr3.xyz>
Date: Tue, 10 Mar 2026 23:40:57 -0700
Tidy Pair and Either
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/Lude/Either.hs b/src/Lude/Either.hs
@@ -3,10 +3,13 @@ module Lude.Either (
type (+),
) where
+import Data.Kind
+
-- TODO: It's probably not worth defining our own type here.
--------------------------------------------------------------------------------
+type Either :: Type -> Type -> Type
data Either a b = L a | R b
type (+) = Either
diff --git a/src/Lude/Pair.hs b/src/Lude/Pair.hs
@@ -1,14 +1,22 @@
module Lude.Pair (
Pair,
+ pattern Pair,
type (×),
Fst,
Snd,
) where
+import Data.Kind
+
--------------------------------------------------------------------------------
+type Pair :: Type -> Type -> Type
type Pair = (,)
+-- For consistency with Either
+pattern Pair :: a -> b -> Pair a b
+pattern Pair a b = (a, b)
+
type (×) = Pair
infixl 7 ×