-
Notifications
You must be signed in to change notification settings - Fork 26
[HTTP] CC-1693: Upgrade Haskell to 9.8.4 #120
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
Conversation
- Renamed project from "hs-http-server-clone" to "codecrafters-http-server" in configuration files. - Updated required base version in package.yaml to support GHC 4.19. - Changed stack resolver to lts-23.18 for compatibility with the latest dependencies. - Enhanced .gitignore to include additional build artifacts and temporary files. - Updated compile and run scripts to reflect the new executable name.
…late - Changed project name from "hs-http-server-clone" to "codecrafters-http-server" across all relevant files. - Updated Haskell version in codecrafters.yml to 9.8 and adjusted base version in package.yaml to >= 4.19. - Modified stack resolver to lts-23.18 for compatibility with updated dependencies. - Enhanced .gitignore to include additional build artifacts. - Updated scripts to reflect the new executable name.
WalkthroughThe changes update the Haskell server project by renaming and rebranding its executable from Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (6)
solutions/haskell/01-at4/code/.codecrafters/run.sh (1)
11-11
: Quote Command Substitution for Robustness.
Shellcheck has flagged that the command substitution should be quoted to prevent word splitting. Consider updating the line as follows:- exec $(stack path --local-install-root)/bin/codecrafters-http-server-exe "$@" + exec "$(stack path --local-install-root)/bin/codecrafters-http-server-exe" "$@"This refactor ensures robustness without altering functionality.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
starter_templates/haskell/code/.codecrafters/run.sh (1)
9-11
: Shellcheck: Quote Command SubstitutionTo prevent potential word splitting issues, consider quoting the result of the command substitution. For example, update the command as follows:
- exec $(stack path --local-install-root)/bin/codecrafters-http-server-exe "$@" + exec "$(stack path --local-install-root)/bin/codecrafters-http-server-exe" "$@"🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
solutions/haskell/01-at4/code/your_program.sh (1)
24-24
: Shellcheck: Quote Command Substitution in Run ScriptIt is advisable to quote the command substitution to avoid unexpected word splitting. For example:
- exec $(stack path --local-install-root)/bin/codecrafters-http-server-exe "$@" + exec "$(stack path --local-install-root)/bin/codecrafters-http-server-exe" "$@"🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 24-24: Quote this to prevent word splitting.
(SC2046)
compiled_starters/haskell/.codecrafters/run.sh (1)
11-11
: Shellcheck: Quote Command SubstitutionTo mitigate potential word splitting issues flagged by Shellcheck (SC2046), please consider quoting the command substitution. For example:
- exec $(stack path --local-install-root)/bin/codecrafters-http-server-exe "$@" + exec "$(stack path --local-install-root)/bin/codecrafters-http-server-exe" "$@"🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
dockerfiles/haskell-9.8.Dockerfile (2)
16-19
: Dummy Application Files Addition
A temporary directory and dummyMain.hs
are created to bypass warnings regarding the absence of/app/app
. This is a clever workaround; however, make sure these dummy files are removed or do not affect production builds.
23-27
: Build Process and Caching Build Artifacts
- The build is initiated with
stack build
and then specifically cleaned forcodecrafters-http-server
.- Directories
.stack-work
and.stack
are moved into/app-cached
for caching purposes.This approach can significantly speed up subsequent builds. Consider adding error-checks to ensure that the move operations succeed only when the directories exist.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
compiled_starters/haskell/stack.yaml.lock
is excluded by!**/*.lock
solutions/haskell/01-at4/code/stack.yaml.lock
is excluded by!**/*.lock
starter_templates/haskell/code/stack.yaml.lock
is excluded by!**/*.lock
📒 Files selected for processing (23)
compiled_starters/haskell/.codecrafters/compile.sh
(1 hunks)compiled_starters/haskell/.codecrafters/run.sh
(1 hunks)compiled_starters/haskell/.gitignore
(1 hunks)compiled_starters/haskell/README.md
(1 hunks)compiled_starters/haskell/codecrafters.yml
(1 hunks)compiled_starters/haskell/package.yaml
(2 hunks)compiled_starters/haskell/stack.yaml
(1 hunks)compiled_starters/haskell/your_program.sh
(1 hunks)dockerfiles/haskell-9.8.Dockerfile
(1 hunks)solutions/haskell/01-at4/code/.codecrafters/compile.sh
(1 hunks)solutions/haskell/01-at4/code/.codecrafters/run.sh
(1 hunks)solutions/haskell/01-at4/code/.gitignore
(1 hunks)solutions/haskell/01-at4/code/README.md
(1 hunks)solutions/haskell/01-at4/code/codecrafters.yml
(1 hunks)solutions/haskell/01-at4/code/package.yaml
(2 hunks)solutions/haskell/01-at4/code/stack.yaml
(1 hunks)solutions/haskell/01-at4/code/your_program.sh
(1 hunks)starter_templates/haskell/code/.codecrafters/compile.sh
(1 hunks)starter_templates/haskell/code/.codecrafters/run.sh
(1 hunks)starter_templates/haskell/code/.gitignore
(1 hunks)starter_templates/haskell/code/package.yaml
(2 hunks)starter_templates/haskell/code/stack.yaml
(1 hunks)starter_templates/haskell/config.yml
(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
solutions/haskell/01-at4/code/.codecrafters/run.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
starter_templates/haskell/code/.codecrafters/run.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
compiled_starters/haskell/.codecrafters/run.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
compiled_starters/haskell/your_program.sh
[warning] 24-24: Quote this to prevent word splitting.
(SC2046)
solutions/haskell/01-at4/code/your_program.sh
[warning] 24-24: Quote this to prevent word splitting.
(SC2046)
🔇 Additional comments (35)
starter_templates/haskell/code/stack.yaml (1)
8-8
: Resolver Update ApprovedThe
resolver
field is updated tolts-23.18
, which is consistent with the upgrade to Haskell 9.8.4 and aligns with similar changes in other configuration files.solutions/haskell/01-at4/code/codecrafters.yml (1)
10-11
: Language Pack UpgradeThe
language_pack
field is updated tohaskell-9.8
, ensuring that the project uses the updated Haskell version. This change is in line with the overall upgrade objective.compiled_starters/haskell/stack.yaml (1)
8-8
: Stack Resolver UpdateThe
resolver
is correctly updated tolts-23.18
, ensuring consistency for dependency resolution across the codebase.solutions/haskell/01-at4/code/stack.yaml (1)
8-8
: Resolver Update VerifiedThe update to
lts-23.18
is consistent with other similar configuration files and standardizes the project's dependency management.compiled_starters/haskell/.codecrafters/compile.sh (1)
11-11
: Executable Name UpdatedThe comment now reflects the updated executable name (
codecrafters-http-server-exe
), which is consistent with the rebranding across the project. The functionality of runningstack build
is unaffected.compiled_starters/haskell/codecrafters.yml (1)
10-11
: Verify Haskell Version: Confirm Configuration vs. PR Objectives.
Thelanguage_pack
has been updated tohaskell-9.8
. However, the PR title specifies upgrading to Haskell 9.8.4. Please verify whether this configuration should include the patch level (i.e.haskell-9.8.4
) or ifhaskell-9.8
is sufficient for your purposes.compiled_starters/haskell/README.md (1)
33-33
: Ensure Stack Version Specification is Clear.
The instruction now specifies to installstack (23.18)
, which aligns with the updated configuration and documentation. This change helps ensure users have the correct tool version for compatibility.solutions/haskell/01-at4/code/.codecrafters/compile.sh (1)
11-12
: Update Executable Rebranding in Comment.
The comment now reflects the updated executable namecodecrafters-http-server-exe
, ensuring consistency with the rebranding across the project. This update does not affect functionality and aligns with related modifications.starter_templates/haskell/config.yml (1)
1-4
: Clarify Required Stack Executable Version.
Therequired_executable
attribute is updated tostack (23.18)
, which clearly communicates the necessary version ofstack
for this project. This change aligns with the documentation and other configuration files.solutions/haskell/01-at4/code/README.md (1)
33-37
: Updated Stack Installation InstructionThe README now specifies that
stack (23.18)
must be installed locally. This explicit version requirement helps ensure that users have the correct environment. Please verify that this version is consistent with your project's Stack resolver and other configuration files (e.g.,starter_templates/haskell/config.yml
).starter_templates/haskell/code/.codecrafters/compile.sh (1)
11-12
: Updated Executable Name in CompilationThe comment has been updated to reflect that the program compiles into
codecrafters-http-server-exe
, which is now in line with the new naming convention being applied across the project.compiled_starters/haskell/your_program.sh (1)
24-24
:✅ Verification successful
ShellCheck Warning: Quote Command Substitution Output
The current command substitution in theexec
call is unquoted, which can lead to word-splitting issues if the local install root path contains spaces. Please wrap the substitution in quotes.- exec $(stack path --local-install-root)/bin/codecrafters-http-server-exe "$@" + exec "$(stack path --local-install-root)"/bin/codecrafters-http-server-exe "$@"
Action: Quote the command substitution output to prevent word splitting
The change is necessary because if the local install root contains spaces, not quoting the substitution can lead to unexpected word splitting. The recommended update wraps the command substitution in quotes to ensure that any spaces in the path don’t break the command.
- File:
compiled_starters/haskell/your_program.sh
(line 24)- Issue: Unquoted command substitution can lead to word splitting if the install root path contains spaces.
- Fix: Wrap the command substitution in quotes as shown in the diff below.
- exec $(stack path --local-install-root)/bin/codecrafters-http-server-exe "$@" + exec "$(stack path --local-install-root)"/bin/codecrafters-http-server-exe "$@"This update complies with ShellCheck's warning and ensures that the script handles paths with spaces correctly.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 24-24: Quote this to prevent word splitting.
(SC2046)
solutions/haskell/01-at4/code/package.yaml (3)
9-9
: Rebranding Package Name Update
The package name is now updated tocodecrafters-http-server
, which correctly reflects the project's rebranding objective.
24-25
: Updated Dependency Constraint
The base dependency constraint has been modified to>= 4.19 && < 5
. Ensure that this change aligns with the requirements for Haskell 9.8.4 and that all tests pass under this constraint.
29-36
: Executable Configuration Updated
The executable is now namedcodecrafters-http-server-exe
and the configuration within the executables section is consistent with the rebranding changes.starter_templates/haskell/code/package.yaml (3)
9-9
: Rebranding Package Name Confirmation
The package name has been updated tocodecrafters-http-server
as required by the rebranding effort.
24-25
: Dependency Constraint Adjustment
Thebase
dependency version is now constrained to>= 4.19 && < 5
, which meets the updated requirement. Verify that this change is compatible with your codebase.
29-37
: Executable Section Consistency
The executable block now correctly definescodecrafters-http-server-exe
with the proper main file, source directory, and GHC options. Ensure thatMain.hs
is updated accordingly if necessary.compiled_starters/haskell/.gitignore (2)
1-1
: Updated Cabal File Ignore Entry
The change fromhs-http-server-clone.cabal
tocodecrafters-http-server.cabal
is correctly implemented and aligns with the rebranding updates.
3-26
: Comprehensive .gitignore Enhancements
The added patterns in this.gitignore
file cover a wide range of common Haskell build artifacts (e.g.,dist
,.stack-work/
, various object files, etc.), which will help maintain a clean repository.starter_templates/haskell/code/.gitignore (2)
1-1
: Updated Cabal File Ignore Entry
Replacinghs-http-server-clone.cabal
withcodecrafters-http-server.cabal
is correct and ensures that the new build file is ignored.
3-26
: Expanded .gitignore Patterns
The comprehensive list of ignore patterns for build artifacts and temporary files is beneficial for a Haskell project. This will help avoid polluting the repository with generated files.compiled_starters/haskell/package.yaml (3)
8-9
: Rebranding Update: Package Name Changed
The package name has been updated from the old name tocodecrafters-http-server
, which aligns with the new branding. Please ensure that all related documentation and build scripts reference the updated name.
25-25
: Dependency Version Constraint Update
Thebase
version constraint has been updated to>= 4.19 && < 5
. This update is likely required for compatibility with GHC 9.8.4. Verify that all other dependencies in the project support this change.
30-30
: Executable Name Update
The executable name has been updated tocodecrafters-http-server-exe
, which is consistent with the new project branding. Double-check that all build scripts, run scripts, and documentation are updated accordingly.solutions/haskell/01-at4/code/.gitignore (1)
1-26
: Comprehensive .gitignore Update
The.gitignore
has been extensively updated:
- The reference to the old cabal file (
hs-http-server-clone.cabal
) is replaced withcodecrafters-http-server.cabal
.- A wide range of build artifacts and configuration files typical for Haskell projects (e.g.,
dist
,*.o
,.stack/
, etc.) have been added.These changes help prevent build artifacts and temporary files from being committed. Ensure that none of these patterns interfere with any intentional file inclusions in deployment or source distributions.
dockerfiles/haskell-9.8.Dockerfile (9)
1-1
: Base Image Upgrade
The Dockerfile now useshaskell:9.8.4-bullseye
as its base image, fulfilling the PR objective of upgrading to Haskell 9.8.4. Confirm that this image version meets your performance and compatibility requirements.
3-3
: Working Directory Configuration
WORKDIR /app
is appropriately set, creating a predictable working context for subsequent commands.
5-8
: Stack Configuration Directory Setup and Permissions Fix
The creation of/etc/stack
and appendingallow-different-user: true
to its configuration helps avoid permission issues withstack run
. This is a practical solution to potential container user mismatches.
10-12
: Enforcing System GHC Usage
The commands to disable GHC installation (install-ghc: false
) and enforce the use of the system GHC (system-ghc: true
) are clearly laid out. This ensures that the container uses the pre-installed GHC, which is desirable for performance and predictability.
14-14
: Stack Configuration Files Copied
Copyingstack.yaml
,package.yaml
, andstack.yaml.lock
into/app/
ensures the build process has the necessary configuration. This change is straightforward and appropriate.
21-21
: STACK_ROOT Environment Variable Set
TheSTACK_ROOT
environment variable is set to/app/.stack
, ensuring that Stack uses a dedicated directory within the container.
29-29
: Cleanup of Dummy Application Files
Removing the dummy application directory (/app/app
) post-build prevents unintended file inclusion.
31-32
: Precompile Script Setup
A precompile script (/codecrafters-precompile.sh
) is created to navigate to the repository directory and invokestack build
. Make sure that the environment variableCODECRAFTERS_REPOSITORY_DIR
is appropriately defined at runtime for this script to work correctly.
34-34
: Dependency File Paths Environment Variable
SettingCODECRAFTERS_DEPENDENCY_FILE_PATHS
to list key configuration files is a good practice for dependency tracking and caching. Confirm that downstream tools correctly utilize this variable.
Summary by CodeRabbit
New Features
Documentation
Chores