X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;h=c5a826a4829a9353edc423f3952ba9e0291be861;hb=e9f9ec1e57d53b9302a395ce0d02c0fa59e28341;hp=16a1628d3520864d047eb28e7f4f50ecb3c890d3;hpb=3b03f47bbeb96c12351ebd11f6565e1f8cec4241;p=ghc-hetmet.git diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 16a1628..c5a826a 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, @@ -85,7 +88,6 @@ import Data.List hiding (group) import Control.Concurrent.MVar ( MVar, newMVar, newEmptyMVar ) #ifdef DEBUG -import qualified Data.List as List ( elem, notElem ) import FastTypes #endif @@ -138,11 +140,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 +183,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}