From: Ian Lynagh Date: Thu, 21 Oct 2010 11:58:22 +0000 (+0000) Subject: Define takeUniqFromSupply X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a50e111f46a16529fe5f8d481919044c8aceea05;p=ghc-hetmet.git Define takeUniqFromSupply --- diff --git a/compiler/basicTypes/UniqSupply.lhs b/compiler/basicTypes/UniqSupply.lhs index 43ccbe3..a4c16fd 100644 --- a/compiler/basicTypes/UniqSupply.lhs +++ b/compiler/basicTypes/UniqSupply.lhs @@ -10,6 +10,7 @@ module UniqSupply ( -- ** Operations on supplies uniqFromSupply, uniqsFromSupply, -- basic ops + takeUniqFromSupply, mkSplitUniqSupply, splitUniqSupply, listSplitUniqSupply, @@ -70,6 +71,8 @@ uniqFromSupply :: UniqSupply -> Unique -- ^ Obtain the 'Unique' from this particular 'UniqSupply' uniqsFromSupply :: UniqSupply -> [Unique] -- Infinite -- ^ Obtain an infinite list of 'Unique' that can be generated by constant splitting of the supply +takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply) +-- ^ Obtain the 'Unique' from this particular 'UniqSupply', and a new supply \end{code} \begin{code} @@ -98,6 +101,7 @@ listSplitUniqSupply (MkSplitUniqSupply _ s1 s2) = s1 : listSplitUniqSupply s2 \begin{code} uniqFromSupply (MkSplitUniqSupply n _ _) = mkUniqueGrimily (iBox n) uniqsFromSupply (MkSplitUniqSupply n _ s2) = mkUniqueGrimily (iBox n) : uniqsFromSupply s2 +takeUniqFromSupply (MkSplitUniqSupply n s1 _) = (mkUniqueGrimily (iBox n), s1) \end{code} %************************************************************************