Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have recently developed two small SpaceSearch tools (a Sudoku solver and a automated Hoare logic tool for Imp). This PR collects some library-level improvements to SpaceSearch that I factored out along the way.
Here are the main changes.
countUp
from the Queens example into the SpaceSearch library, since I needed it in another tool as well. I also refactored it andzCountUp
to use a generic list function.Int
.Ensemble.In
, which I was surprised @konne88 hadn't done yet 😉guard
, which lifts a predicate (A -> bool
) to a monadic arrowA -> Space A
by requiring the predicate to hold (returningempty
otherwise). I refactored Queens to use this in one place, and I also use it in both my new examples.This PR is a bit of a smorgasbord. I'm happy to split it up if people don't like certain parts. Feedback welcome!