Permalink
Browse files

Change ANormalisation not to use value-supply

  • Loading branch information...
1 parent ad43480 commit 392a44239877f45059092347cfd0f54775b8a0b2 @batterseapower committed Jun 29, 2010
Showing with 4 additions and 6 deletions.
  1. +4 −6 ANormalisation.hs
View
@@ -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":

0 comments on commit 392a442

Please sign in to comment.