Skip to content

Commit aa6c57b

Browse files
nicuveoandreasabel
andauthored
Fix #269 and rewrite DFAMin (#270)
* add test that demonstrates the issue * remove incorrect extra-source-files entries * rewrite DFAMin * add test for older versions of the code * improve comments * fix call of `restrictKeys` for older GHC versions * Revert "remove incorrect extra-source-files entries" This reverts commit e0126a8. * rename tests * add new tests to extra-source-files * make use of `fold` * revert formatter changes * improve comments, fix typos * fix typos in tests * Optimize 'number' by removing already assigned start states A start state cannot belong to several equivalence classes (they are disjoint), so we can remove already assigned start states from the list of start states we want to assign. * Optimize the construction of new states from old states Since all old states in an equivalence class are equivalent, we only need the data from one of them to construct the new state. * Cosmetics: use OldSNum / NewSNum instead of Int; etc. * Suggestion: Use a plain filter instead of restrictKeys * remove `restrictKeys` in favour of filter * use folds to avoid concat * add `-XDeriveFunctor` to emulated workflow --------- Co-authored-by: Andreas Abel <[email protected]>
1 parent bf6f8bb commit aa6c57b

File tree

7 files changed

+323
-203
lines changed

7 files changed

+323
-203
lines changed

.github/workflows/emulated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# interpret the forward slashes. You're welcome.
4545
sed -i "s/getDataDir/\(return \"$(pwd | sed 's/\//\\\//g')\\/data\"\)/g" src/Main.hs
4646
sed -i "s/version/undefined/g" src/Main.hs
47-
ghc -XHaskell2010 -XPatternSynonyms -XFlexibleContexts -XMagicHash -XCPP -XNondecreasingIndentation -XScopedTypeVariables -XTupleSections \
47+
ghc -XHaskell2010 -XPatternSynonyms -XFlexibleContexts -XMagicHash -XCPP -XNondecreasingIndentation -XScopedTypeVariables -XTupleSections -XDeriveFunctor \
4848
-package array -package containers -package directory \
4949
-isrc src/Main.hs \
5050
-o alex

alex.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ extra-source-files:
9191
tests/issue_141.x
9292
tests/issue_197.x
9393
tests/issue_262.x
94+
tests/issue_269_part1.x
95+
tests/issue_269_part2.x
9496
tests/strict_text_typeclass.x
9597
tests/posn_typeclass_strict_text.x
9698
tests/tokens_monadUserState_strict_text.x
@@ -113,6 +115,7 @@ executable alex
113115
default-language:
114116
Haskell2010
115117
default-extensions:
118+
DeriveFunctor
116119
PatternSynonyms
117120
ScopedTypeVariables
118121
TupleSections

src/AbsSyn.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ data RightContext r
123123
= NoRightContext
124124
| RightContextRExp r
125125
| RightContextCode Code
126-
deriving (Eq,Ord)
126+
deriving (Eq, Ord, Functor)
127127

128128
instance Show RECtx where
129129
showsPrec _ (RECtx scs _ r rctx code) =

0 commit comments

Comments
 (0)