Commit 938d0bd9 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢
Browse files

Merge branch 'furthercleanup' [#42]

parents 9571a0b3 39268753
......@@ -101,11 +101,9 @@ anonymizeSymbols :: SymbolTable -> SymbolTable
anonymizeSymbols symTbl = SymbolTable $ M.fromList (map anonymize
(zip [(0 :: Int)..] (List.sortOn snd $ M.toList table)))
where
anonymize (idx, (k, _)) =
( k
, T.pack (printf "s%0*d" ((+1) . (integerLogBase 10) . toInteger $ M.size table) idx)
)
table = fromSymbolTable symTbl
padding = (+1) . (integerLogBase 10) . toInteger $ M.size table
anonymize (idx, (k, _)) = (k, T.pack (printf "s%0*d" padding idx))
finalizeState :: forall f.
Maybe State
......
......@@ -267,7 +267,7 @@ instance MinimizationInterface f => MinimizationInterface (AbsorbingPolynomial f
updateInner ((PolyLabel i (Just inner)):|ll) = map (\v -> PolyLabel i (Just v)) $ merge (innerFunctor i) (inner:|(innerLbls ll))
updateInner ((PolyLabel i Nothing):|ll) = (PolyLabel i Nothing):ll
innerLbls l = map (\(PolyLabel _ lbl) -> fromJust lbl) l
innerLbls = map $ \(PolyLabel _ lbl) -> fromJust lbl
innerFunctors = V.fromList $ toList poly
innerFunctor :: Int -> f ()
......
......@@ -210,7 +210,6 @@ instance MinimizationInterface SomeFunctor where
where
isSameType :: SomeLabel -> Label f'
isSameType (SomeLabel f2 l) = case eqTypeRep f2 $ typeRep @f' of
-- this case should not happen.
Nothing -> error "Inconsistent internal state: Labels for different functors in SomeFunctor"
Just HRefl -> l
#endif
......
......@@ -106,7 +106,8 @@ minimizeSymbolTable :: SymbolTable -> [[State]] -> SymbolTable
minimizeSymbolTable symbols part =
SymbolTable { fromSymbolTable = HM.fromList partitions }
where
partitions = map (\(v, (i, n)) -> (i, T.pack (printf "s%0*d" ((+1) . (integerLogBase 10) . toInteger $ length blocks) v) <> "_" <> n))
padding = (+1) . (integerLogBase 10) . toInteger $ length blocks
partitions = map (\(v, (i, n)) -> (i, T.pack (printf "s%0*d" padding v) <> "_" <> n))
$ zip [(0 :: Int)..] blocks
blocks = (filter ((/=mempty) . snd) (List.sortOn snd (zip [0..] (map nameBlock part))))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment