X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;fp=compiler%2Futils%2FUtil.lhs;h=69b8c7ed3220ad53dff7f15ade246e69594a57e4;hp=16a1628d3520864d047eb28e7f4f50ecb3c890d3;hb=b06d623b2e367a572de5daf06d6a0b12c2740471;hpb=3029576129e31d23e749be21c6a5a6f376ba28cd diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 16a1628..69b8c7e 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -30,6 +30,9 @@ module Util ( isIn, isn'tIn, + -- * Tuples + fstOf3, sndOf3, thirdOf3, + -- * List operations controlled by another list takeList, dropList, splitAtList, split, dropTail, @@ -181,6 +184,15 @@ nTimes 1 f = f nTimes n f = f . nTimes (n-1) f \end{code} +\begin{code} +fstOf3 :: (a,b,c) -> a +sndOf3 :: (a,b,c) -> b +thirdOf3 :: (a,b,c) -> c +fstOf3 (a,_,_) = a +sndOf3 (_,b,_) = b +thirdOf3 (_,_,c) = c +\end{code} + %************************************************************************ %* * \subsection[Utils-lists]{General list processing}