From: Lucian Mogosanu Date: Sat, 13 Dec 2014 16:09:44 +0000 (+0200) Subject: ZXS: Add base Spectrum monad X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=9281536677c56b8ada1a79b10613a959e0fda971;p=z80.git ZXS: Add base Spectrum monad --- 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