X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;h=81fc0fe873ec2bdc2cb4c5161b0a7f4ed53050f2;hb=9e7567632bc6af06d3e874d1675479e7b1991f63;hp=16a1628d3520864d047eb28e7f4f50ecb3c890d3;hpb=3b03f47bbeb96c12351ebd11f6565e1f8cec4241;p=ghc-hetmet.git diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 16a1628..81fc0fe 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -7,7 +7,7 @@ -- | Highly random utility functions module Util ( -- * Flags dependent on the compiler build - ghciSupported, debugIsOn, ghciTablesNextToCode, picIsOn, + ghciSupported, debugIsOn, ghciTablesNextToCode, isDynamicGhcLib, isWindowsHost, isWindowsTarget, isDarwinTarget, -- * General list processing @@ -30,6 +30,9 @@ module Util ( isIn, isn'tIn, + -- * Tuples + fstOf3, sndOf3, thirdOf3, + -- * List operations controlled by another list takeList, dropList, splitAtList, split, dropTail, @@ -138,11 +141,11 @@ ghciTablesNextToCode = True ghciTablesNextToCode = False #endif -picIsOn :: Bool -#ifdef __PIC__ -picIsOn = True +isDynamicGhcLib :: Bool +#ifdef DYNAMIC +isDynamicGhcLib = True #else -picIsOn = False +isDynamicGhcLib = False #endif isWindowsHost :: Bool @@ -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}