lude

Haskell prelude alternative
git clone git://git.rr3.xyz/lude | git clone gits://git.rr3.xyz/lude
Log | Files | Refs | README | LICENSE

commit fbda0ed45df1d814ffa27e1cdd0cbf94cfd5b039
parent 5f4d78ab7400b020beea411d7d1cc3144a93c736
Author: Robert Russell <robert@rr3.xyz>
Date:   Tue,  6 Oct 2026 16:25:08 -0700

Pair: add Unicode alias

Diffstat:
Msrc/Lude/Pair.hs | 30+++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/Lude/Pair.hs b/src/Lude/Pair.hs @@ -1,8 +1,9 @@ module Lude.Pair ( Pair, + type (*), + type (×), MkPair, pattern MkPair, - type (*), outl, outr, dup, @@ -31,45 +32,44 @@ import Lude.Haskell -------------------------------------------------------------------------------- -infixl 7 * +infixl 7 *, × -------------------------------------------------------------------------------- -type Pair :: Type -> Type -> Type type Pair = Tuple2 +type (*) = Tuple2 +type (×) = Tuple2 -- For consistency -type MkPair :: a -> b -> Pair a b +type MkPair :: a -> b -> a × b type MkPair = (,) -pattern MkPair :: a -> b -> Pair a b +pattern MkPair :: a -> b -> a × b pattern MkPair a b = (a, b) {-# COMPLETE MkPair #-} -type (*) = Pair - -outl :: forall a b. Pair a b -> a +outl :: forall a b. a × b -> a outl = Base.fst -outr :: forall a b. Pair a b -> b +outr :: forall a b. a × b -> b outr = Base.snd -dup :: forall a. a -> Pair a a +dup :: forall a. a -> a × a dup x = (x, x) -swap :: forall a b. Pair a b -> Pair b a +swap :: forall a b. a × b -> b × a swap = Base.swap -curry :: forall a b c. (Pair a b -> c) -> (a -> b -> c) +curry :: forall a b c. (a × b -> c) -> (a -> b -> c) curry = Base.curry -uncurry :: forall a b c. (a -> b -> c) -> (Pair a b -> c) +uncurry :: forall a b c. (a -> b -> c) -> (a × b -> c) uncurry = Base.uncurry -type Outl :: forall {a} {b}. Pair a b -> a +type Outl :: forall {a} {b}. a × b -> a type family Outl _ where Outl (a, b) = a -type Outr :: forall {a} {b}. Pair a b -> b +type Outr :: forall {a} {b}. a × b -> b type family Outr _ where Outr (a, b) = b