From 88d2a4a6eb85beaf007ef544e7be8c9b901b1974 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Fri, 24 Nov 2017 14:00:50 +0200 Subject: [PATCH] Functions mapFst and mapSnd refs #7644 Change-Id: Id95dca0a0d48d864c745e65b597fe91a9c92bb83 --- bundles/org.simantics.scl.runtime/scl/Prelude.scl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index c04cc8625..a926ae40e 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -1484,6 +1484,14 @@ fst (x,y) = x snd :: (a,b) -> b snd (x,y) = y +@inline +mapFst :: (a -> b) -> (a,c) -> (b,c) +mapFst f (x,y) = (f x, y) + +@inline +mapSnd :: (a -> b) -> (c,a) -> (c,b) +mapSnd f (x,y) = (x, f y) + instance (Ord a, Ord b) => Ord (a, b) where compare (a0, b0) (a1, b1) = compare a0 a1 &<& compare b0 b1 -- 2.43.2