Skip to content

[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

Merged
merged 2 commits into from
Apr 8, 2025
Merged

[HTTP] CC-1693: Upgrade Haskell to 9.8.4 #120

merged 2 commits into from
Apr 8, 2025

Conversation

andy1li
Copy link
Member

@andy1li andy1li commented Apr 8, 2025

Summary by CodeRabbit

  • New Features

    • The server executable has been rebranded to codecrafters-http-server for consistent command usage.
    • A new Docker setup supports Haskell 9.8 deployments.
  • Documentation

    • Installation instructions now specify using Stack (23.18) to ensure proper setup.
  • Chores

    • Configuration and dependency settings have been upgraded to streamline the build process and improve overall project alignment.

andy1li added 2 commits April 9, 2025 07:19
- 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.
@andy1li andy1li self-assigned this Apr 8, 2025
Copy link

linear bot commented Apr 8, 2025

Copy link

coderabbitai bot commented Apr 8, 2025

Walkthrough

The changes update the Haskell server project by renaming and rebranding its executable from hs-http-server-clone to codecrafters-http-server. Several shell scripts, package configurations, and supporting files now reference the new executable and package names. Additionally, dependency version constraints, language pack versions, and Stack resolver configurations have been updated. The modifications also expand the .gitignore entries for comprehensive build artifact exclusion and update installation instructions to require a specific version of stack. A new Dockerfile tailored for Haskell 9.8.4 has been introduced.

Changes

File(s) Change Summary
compiled_starters/haskell/.../compile.sh, solutions/haskell/01-at4/code/.../compile.sh, starter_templates/haskell/.../compile.sh Updated comments to reference the new executable (codecrafters-http-server-exe) instead of hs-http-server-clone-exe.
compiled_starters/haskell/.../run.sh, compiled_starters/haskell/.../your_program.sh, solutions/haskell/01-at4/code/.../run.sh, solutions/haskell/01-at4/code/.../your_program.sh, starter_templates/haskell/.../run.sh Changed commands to invoke codecrafters-http-server-exe in place of hs-http-server-clone-exe.
compiled_starters/haskell/.gitignore, solutions/haskell/01-at4/code/.gitignore, starter_templates/haskell/code/.gitignore Replaced hs-http-server-clone.cabal with codecrafters-http-server.cabal and added numerous entries to ignore common build artifacts.
compiled_starters/haskell/README.md, solutions/haskell/01-at4/code/README.md, starter_templates/haskell/config.yml Modified installation instructions/attributes to specify a required Stack version (23.18).
compiled_starters/haskell/package.yaml, solutions/haskell/01-at4/code/package.yaml, starter_templates/haskell/code/package.yaml Renamed the package and its executable to codecrafters-http-server and updated the base dependency constraint to >= 4.19 && < 5.
compiled_starters/haskell/codecrafters.yml, solutions/haskell/01-at4/code/codecrafters.yml Updated the language pack version from haskell-9.4 to haskell-9.8.
compiled_starters/haskell/stack.yaml, solutions/haskell/01-at4/code/stack.yaml, starter_templates/haskell/code/stack.yaml Changed the resolver from lts-21.11 to lts-23.18.
dockerfiles/haskell-9.8.Dockerfile Added a new Dockerfile for Haskell 9.8.4 with configuration adjustments for the build process, caching, and environment setup.

Poem

I'm a little bunny, hopping with delight,
My code now sings a rebranded tune so bright.
From old clone names to shiny, fresh new lore,
Codecrafters lead our server to explore.
With each change I hop, dancing on the keys,
Celebrating our upgrade with whiskered glee!
🐰🌟

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@andy1li andy1li changed the title [HTTP]CC-1693: Upgrade Haskell to 9.8.4 [HTTP] CC-1693: Upgrade Haskell to 9.8.4 Apr 8, 2025
Copy link

@coderabbitai coderabbitai bot left a 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 Substitution

To 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 Script

It 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 Substitution

To 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 dummy Main.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 for codecrafters-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

📥 Commits

Reviewing files that changed from the base of the PR and between 35becd6 and df7f28a.

⛔ 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 Approved

The resolver field is updated to lts-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 Upgrade

The language_pack field is updated to haskell-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 Update

The resolver is correctly updated to lts-23.18, ensuring consistency for dependency resolution across the codebase.

solutions/haskell/01-at4/code/stack.yaml (1)

8-8: Resolver Update Verified

The 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 Updated

The comment now reflects the updated executable name (codecrafters-http-server-exe), which is consistent with the rebranding across the project. The functionality of running stack build is unaffected.

compiled_starters/haskell/codecrafters.yml (1)

10-11: Verify Haskell Version: Confirm Configuration vs. PR Objectives.
The language_pack has been updated to haskell-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 if haskell-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 install stack (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 name codecrafters-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.
The required_executable attribute is updated to stack (23.18), which clearly communicates the necessary version of stack 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 Instruction

The 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 Compilation

The 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 the exec 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 to codecrafters-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 named codecrafters-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 to codecrafters-http-server as required by the rebranding effort.


24-25: Dependency Constraint Adjustment
The base 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 defines codecrafters-http-server-exe with the proper main file, source directory, and GHC options. Ensure that Main.hs is updated accordingly if necessary.

compiled_starters/haskell/.gitignore (2)

1-1: Updated Cabal File Ignore Entry
The change from hs-http-server-clone.cabal to codecrafters-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
Replacing hs-http-server-clone.cabal with codecrafters-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 to codecrafters-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
The base 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 to codecrafters-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 with codecrafters-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 uses haskell: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 appending allow-different-user: true to its configuration helps avoid permission issues with stack 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
Copying stack.yaml, package.yaml, and stack.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
The STACK_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 invoke stack build. Make sure that the environment variable CODECRAFTERS_REPOSITORY_DIR is appropriately defined at runtime for this script to work correctly.


34-34: Dependency File Paths Environment Variable
Setting CODECRAFTERS_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.

@andy1li andy1li merged commit b4354e3 into main Apr 8, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant