State.hs revision 3f69b6948966979163bdfe8331c38833d5d90ecd
ca44fe49bec16436cd95ace0af2e244f2096b284Brian WellingtonModule : $Header$
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark AndrewsDescription : State type from Control.Monad.State but no class MonadState
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark AndrewsCopyright : C. Maeder and Uni Bremen 2002-2005
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark AndrewsLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic UpdaterMaintainer : Christian.Maeder@dfki.de
ca44fe49bec16436cd95ace0af2e244f2096b284Brian WellingtonStability : experimental
ca44fe49bec16436cd95ace0af2e244f2096b284Brian WellingtonPortability : portable
ca44fe49bec16436cd95ace0af2e244f2096b284Brian WellingtonState type from Control.Monad.State but no class MonadState
ca44fe49bec16436cd95ace0af2e244f2096b284Brian WellingtonThis module may be replaced by the (non-nhc98 module) Control.Monad.State
ca44fe49bec16436cd95ace0af2e244f2096b284Brian Wellington-- ---------------------------------------------------------------------------
ca44fe49bec16436cd95ace0af2e244f2096b284Brian Wellington-- Our fixed state monad
ca44fe49bec16436cd95ace0af2e244f2096b284Brian Wellingtonnewtype State s a = State { runState :: s -> (a, s) }
ca44fe49bec16436cd95ace0af2e244f2096b284Brian Wellingtoninstance Functor (State s) where
ca44fe49bec16436cd95ace0af2e244f2096b284Brian Wellington fmap f m = State $ \s -> let
ca44fe49bec16436cd95ace0af2e244f2096b284Brian Wellington (a, s') = runState m s