commit 104ce6fc751b56d8859745e83a15e6a650a075af
parent a1a564cdf8ef2e9df59cbe9bc2f308695481e95b
Author: Robert Russell <robert@rr3.xyz>
Date: Mon, 14 Sep 2026 16:05:23 -0700
Pair: add type-level Fst and Snd
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/Lude/Pair.hs b/src/Lude/Pair.hs
@@ -4,6 +4,8 @@ module Lude.Pair (
type (*),
fst,
snd,
+ Fst,
+ Snd,
) where
import Lude.Haskell
@@ -30,3 +32,11 @@ fst (MkPair x _) = x
snd :: Pair a b -> b
snd (MkPair _ y) = y
+
+type Fst :: forall {a} {b}. Pair a b -> a
+type family Fst _ where
+ Fst (a, b) = a
+
+type Snd :: forall {a} {b}. Pair a b -> b
+type family Snd _ where
+ Snd (a, b) = b