mirror of
https://git.cs.ou.nl/joshua.moerman/mealy-decompose.git
synced 2025-04-30 02:07:44 +02:00
style change
This commit is contained in:
parent
fe21bc794c
commit
09793bd0bc
1 changed files with 7 additions and 7 deletions
|
@ -64,32 +64,32 @@ data PRState s i o = PRState
|
|||
|
||||
updatePartition :: (Monad m, Ord s) => s -> Block -> StateT (PRState s i o) m ()
|
||||
updatePartition s b = modify foo where
|
||||
foo prs@PRState{..} = prs { partition = coerce (Map.insert s b) partition }
|
||||
foo prs = prs { partition = coerce (Map.insert s b) (partition prs) }
|
||||
|
||||
updateSize :: Monad m => Block -> Int -> StateT (PRState s i o) m Int
|
||||
updateSize b n =
|
||||
modify (\prs@PRState{..} -> prs { splittingTree = splittingTree { size = Map.insert b n (size splittingTree) }})
|
||||
modify (\prs -> prs { splittingTree = (splittingTree prs) { size = Map.insert b n (size (splittingTree prs)) }})
|
||||
>> return n
|
||||
|
||||
genNextBlockId :: Monad m => StateT (PRState s i o) m Block
|
||||
genNextBlockId = do
|
||||
idx <- gets nextBlockId
|
||||
modify (\prs@PRState{..} -> prs { nextBlockId = succ nextBlockId })
|
||||
modify (\prs -> prs { nextBlockId = succ (nextBlockId prs) })
|
||||
return idx
|
||||
|
||||
updateParent :: Monad m => Either Block InnerNode -> InnerNode -> o -> StateT (PRState s i o) m ()
|
||||
updateParent (Left block) target output = modify foo where
|
||||
foo prs@PRState{..} = prs { splittingTree = splittingTree { blockParent = Map.insert block (target, output) (blockParent splittingTree) }}
|
||||
foo prs = prs { splittingTree = (splittingTree prs) { blockParent = Map.insert block (target, output) (blockParent (splittingTree prs)) }}
|
||||
updateParent (Right node) target output = modify foo where
|
||||
foo prs@PRState{..} = prs { splittingTree = splittingTree { innerParent = Map.insert node (target, output) (innerParent splittingTree) }}
|
||||
foo prs = prs { splittingTree = (splittingTree prs) { innerParent = Map.insert node (target, output) (innerParent (splittingTree prs)) }}
|
||||
|
||||
updateLabel :: Monad m => InnerNode -> [i] -> StateT (PRState s i o) m ()
|
||||
updateLabel node witness = modify (\prs@PRState{..} -> prs { splittingTree = splittingTree { label = Map.insert node witness (label splittingTree) }})
|
||||
updateLabel node witness = modify (\prs -> prs { splittingTree = (splittingTree prs) { label = Map.insert node witness (label (splittingTree prs)) }})
|
||||
|
||||
genNextNodeId :: Monad m => StateT (PRState s i o) m InnerNode
|
||||
genNextNodeId = do
|
||||
idx <- gets nextNodeId
|
||||
modify (\prs@PRState{..} -> prs { nextNodeId = succ nextNodeId })
|
||||
modify (\prs -> prs { nextNodeId = succ (nextNodeId prs) })
|
||||
return idx
|
||||
|
||||
refineWithSplitter :: (Monad m, Ord o, Ord s) => i -> (s -> [s]) -> Splitter s i o -> StateT (PRState s i o) m [Splitter s i o]
|
||||
|
|
Loading…
Add table
Reference in a new issue