From 392a44239877f45059092347cfd0f54775b8a0b2 Mon Sep 17 00:00:00 2001 From: Max Bolingbroke Date: Tue, 29 Jun 2010 17:16:29 +0100 Subject: [PATCH] Change ANormalisation not to use value-supply --- ANormalisation.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ANormalisation.hs b/ANormalisation.hs index d8a301b..5e85b51 100644 --- a/ANormalisation.hs +++ b/ANormalisation.hs @@ -1,23 +1,21 @@ {-# LANGUAGE RankNTypes #-} import Text.PrettyPrint.HughesPJClass -import Data.Supply - import System.IO.Unsafe import Control.Monad.State -type UniqM = State (Supply Int) +type UniqM = State [Int] -uniqSupply :: Supply Int -uniqSupply = unsafePerformIO $ newSupply 0 (+1) +uniqSupply :: [Int] +uniqSupply = [0..] runUniq :: UniqM a -> a runUniq = flip evalState uniqSupply unique :: UniqM Int -unique = get >>= \s -> let (s1, s2) = split2 s in put s2 >> return (supplyValue s1) +unique = get >>= \(x:ss) -> put ss >> return x -- -- Codensity is the "mother of all monads":