From 09793bd0bc0bf193490b6e564aafe98daa802028 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Mon, 11 Mar 2024 13:29:22 +0100 Subject: [PATCH] style change --- src/SplittingTree.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/SplittingTree.hs b/src/SplittingTree.hs index 548602b..e662e83 100644 --- a/src/SplittingTree.hs +++ b/src/SplittingTree.hs @@ -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]