-
Notifications
You must be signed in to change notification settings - Fork 3
Inline generateFusableConnections and generateValidConnection in Deadlock.try, and subsequent optimizations #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…lock.try Co-authored-by: jvoigtlaender <5853832+jvoigtlaender@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR inlines two helper functions (generateFusableConnections and generateValidConnection) from Roll.hs directly into the Deadlock.try function, removing them from the Roll module since they were only used in one location.
Changes:
- Inlined fusable connection generation logic directly into
Deadlock.tryfunction'sdoblock - Inlined connection validation logic with retry mechanism into a lambda and helper functions
- Updated imports: added
BM.fromList,BM.member,BM.memberR,BM.null, andshuffleMto Deadlock.hs; removed unused Bimap imports from Roll.hs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Modelling/PetriNet/Reach/Roll.hs | Removed generateFusableConnections and generateValidConnection function definitions and exports; removed unused Bimap imports |
| src/Modelling/PetriNet/Reach/Deadlock.hs | Inlined the two removed functions directly into the try function with proper helper functions and added necessary imports |
|
Pull the Then, replace the Also, replace the |
… directly Co-authored-by: jvoigtlaender <5853832+jvoigtlaender@users.noreply.github.com>
Done in commit 4c4d654. The |
Description
Inlines
generateFusableConnectionsandgenerateValidConnectiondirectly into theDeadlock.tryfunction, removing them fromRoll.hs. Optimizes the inlined code by hoisting lookups and eliminating redundant checks.Changes
generateFusableConnections: Shuffling and bimap construction now occurs directly in thetryfunction'sdoblockgenerateValidConnection: Validation logic with retry moved into the lambda passed tonetLimitsFiltered, with helper functions (isValidInputPlaceUsage,isValidOutputPlaceUsage) defined inletclauseBM.lookupcalls hoisted into let-block wheregois defined, creating shareable bindings (consumingLookup,producingLookup) that eliminate redundant lookupsBM.memberchecks replaced with pattern matching on lookup results (Just _vsNothing)BM.fromList,BM.lookup,BM.memberR, andshuffleMtoDeadlock.hs; removed unusedBM.*imports fromRoll.hsRoll.hsThe inlining preserves the partial application structure where bimaps are bound once in the outer
doblock and captured by the connection generator lambda. The optimization ensures lookups happen once and are reused throughout the validation logic.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.