ZXS: Add base Spectrum monad
authorLucian Mogosanu <lucian.mogosanu@gmail.com>
Sat, 13 Dec 2014 16:09:44 +0000 (18:09 +0200)
committerLucian Mogosanu <lucian.mogosanu@gmail.com>
Sat, 13 Dec 2014 16:09:44 +0000 (18:09 +0200)
src/ZXS/Machine.hs

index bc8b583..7237ebf 100644 (file)
@@ -1,4 +1,22 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 module ZXS.Machine where
 
+import Control.Monad.State
+import Control.Applicative (Applicative)
+
 import Z80.CPU
+import ZXS.Memory
+
+data Spectrum = Spectrum
+  { zxCPU     :: CPU
+  , zxMemory  :: Memory
+  -- TODO: there's other stuff to add, but this will be done after
+  -- the scaffolding is in place.
+  } deriving (Show, Eq)
+
+-- the ZXS transformer
+newtype ZXST m a = ZXST { unZXST :: StateT Spectrum m a }
+  deriving (Monad, Functor, Applicative, MonadIO)
 
+-- for now we "fall back" to IO as the default inner monad
+type ZXS a = ZXST IO a