summaryrefslogtreecommitdiff
path: root/src/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Types.hs')
-rw-r--r--src/Types.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Types.hs b/src/Types.hs
index 10cea7a..a90e5fe 100644
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -8,6 +8,7 @@ module Types
8 , Alteration(..) 8 , Alteration(..)
9 , Sequence 9 , Sequence
10 , History 10 , History
11 , Context(..)
11 , SequenceM 12 , SequenceM
12 ) where 13 ) where
13 14
@@ -15,6 +16,7 @@ import Data.PQueue.Prio.Max (MaxPQueue)
15import qualified Data.PQueue.Prio.Max as MaxPQueue (empty) 16import qualified Data.PQueue.Prio.Max as MaxPQueue (empty)
16 17
17import Data.Sequence (Seq) 18import Data.Sequence (Seq)
19import qualified Data.Sequence as Seq (empty)
18 20
19import Data.Text (Text) 21import Data.Text (Text)
20 22
@@ -46,12 +48,21 @@ type Sequence = MaxPQueue SequenceValue Entity
46 48
47type History = Seq (Alteration, Comment) 49type History = Seq (Alteration, Comment)
48 50
49type SequenceM m = (MonadWriter History m, MonadState Sequence m, MonadIO m) 51data Context = Context
52 { ctxSequence :: Sequence
53 , ctxHistory :: History
54 }
55 deriving (Show)
56
57type SequenceM m = (MonadState Context m, MonadIO m)
50 58
51instance MonadState s m => MonadState s (InputT m) where 59instance MonadState s m => MonadState s (InputT m) where
52 get = lift get 60 get = lift get
53 put = lift . put 61 put = lift . put
54 state = lift . state 62 state = lift . state
55 63
56instance Default (MaxPQueue k v) where 64instance Default Context where
57 def = MaxPQueue.empty 65 def = Context
66 { ctxSequence = MaxPQueue.empty
67 , ctxHistory = Seq.empty
68 }