From 9281536677c56b8ada1a79b10613a959e0fda971 Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Sat, 13 Dec 2014 18:09:44 +0200 Subject: [PATCH] ZXS: Add base Spectrum monad --- src/ZXS/Machine.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ZXS/Machine.hs b/src/ZXS/Machine.hs index bc8b583..7237ebf 100644 --- a/src/ZXS/Machine.hs +++ b/src/ZXS/Machine.hs @@ -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 -- 1.7.10.4