Use clock sets instead of lists#12
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the codebase to use Set instead of lists for clock collections and tag storage, improving type safety and ensuring uniqueness guarantees. The main changes include:
- Replacing
[Clock]withSet Clock(viaClockstype alias) throughout the codebase - Changing tag storage from
[Tag]toSet Tagin theClockdata type - Updating
dayGroupsto returnMap Day Clocksinstead of[NonEmpty Clock] - Removing unused
lastMaybefunction and updating callsites to useS.maxView/S.findMax
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/T4/Data.hs | Changed tags field to Set Tag, introduced Clocks type alias, updated dayGroups to return a Map, modified allCategories and allTags to return Sets |
| lib/T4/Storage.hs | Updated function signatures to use Clocks, changed implementation to work with Sets including dayGroups Map structure |
| lib/T4/Report.hs | Updated categoryDurations and tagDurations to accept Clocks instead of [Clock], adjusted selector functions to use Sets |
| lib/Util.hs | Modified durations function to work with Set a instead of [a], removed unused lastMaybe function |
| lib/Completion.hs | Changed complItems to Set a, updated complete to return Set a |
| exe-t4-commands/Commands.hs | Updated to use Set operations (S.findMax, S.null) and Clocks type |
| exe-t5-interactive/TUI.hs | Replaced lastMaybe usage with findMax helper using S.maxView, updated tag parsing to create Sets |
| test/T4/DataSpec.hs | Updated test cases to work with Sets, including Clock construction and property tests |
| test/T4/StorageSpec.hs | Modified tests to use Sets and updated assertions accordingly |
| test/T4/ReportSpec.hs | Updated example data and property tests to use Sets |
| test/UtilSpec.hs | Modified duration tests to use Sets, removed lastMaybe tests |
| test/CompletionSpec.hs | Updated completion tests to work with Sets |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.