Skip to content

Support Haskell language#1484

Merged
j178 merged 28 commits intoj178:masterfrom
fllesser:haskell
Jan 31, 2026
Merged

Support Haskell language#1484
j178 merged 28 commits intoj178:masterfrom
fllesser:haskell

Conversation

@fllesser
Copy link
Contributor

@fllesser fllesser commented Jan 27, 2026

resolve #1445

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 87.96296% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.97%. Comparing base (f3d26b6) to head (52bc32b).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/languages/haskell.rs 87.73% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1484      +/-   ##
==========================================
- Coverage   91.99%   91.97%   -0.02%     
==========================================
  Files          87       88       +1     
  Lines       18268    18376     +108     
==========================================
+ Hits        16805    16902      +97     
- Misses       1463     1474      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@j178 j178 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Overall looks good. I added a few comments, and we’ll need to update the docs/languages.md file.

@prek-ci-bot
Copy link

prek-ci-bot bot commented Jan 27, 2026

📦 Cargo Bloat Comparison

Binary size change: +0.44% (22.5 MiB → 22.6 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text    Size           Crate Name
 0.3%   0.8% 71.2KiB           prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 63.4KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6% 58.7KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 46.0KiB            prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5% 43.2KiB            prek prek::run::{{closure}}
 0.2%   0.5% 43.1KiB            prek prek::identify::by_extension::{{closure}}
 0.2%   0.4% 41.5KiB            prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3% 32.0KiB           prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2% 22.1KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 22.1KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.0KiB    clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.6KiB            prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 20.0KiB cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.5KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB            prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
 0.1%   0.2% 19.1KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.0KiB             std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 18.6KiB            ring ring_core_0_17_14__x25519_ge_frombytes_vartime
 0.1%   0.2% 18.1KiB       [Unknown] fe_loose_invert
 0.1%   0.2% 18.1KiB      hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
36.8%  91.5%  8.3MiB                 And 20080 smaller methods. Use -n N to show more.
40.2% 100.0%  9.1MiB                 .text section size, the file size is 22.6MiB

Base Branch Results

 File  .text    Size           Crate Name
 0.3%   0.8% 77.0KiB           prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.6% 59.1KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.6% 56.6KiB            prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 43.2KiB            prek prek::run::{{closure}}
 0.2%   0.5% 43.1KiB            prek prek::identify::by_extension::{{closure}}
 0.2%   0.4% 41.5KiB            prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 41.0KiB            prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.1%   0.3% 32.0KiB           prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2% 21.7KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.7KiB            prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.0KiB    clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.8KiB            prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 20.0KiB cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.5KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB            prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
 0.1%   0.2% 19.1KiB            prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 18.6KiB            ring ring_core_0_17_14__x25519_ge_frombytes_vartime
 0.1%   0.2% 18.2KiB             std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 18.1KiB       [Unknown] fe_loose_invert
 0.1%   0.2% 18.1KiB      hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
36.8%  91.6%  8.3MiB                 And 20097 smaller methods. Use -n N to show more.
40.2% 100.0%  9.1MiB                 .text section size, the file size is 22.5MiB

@j178 j178 added the enhancement New feature or request label Jan 28, 2026
@fllesser fllesser marked this pull request as draft January 28, 2026 04:21
@fllesser
Copy link
Contributor Author

fllesser commented Jan 28, 2026

cabal update and cabal install seem to be very slow.

To mitigate the race condition issue with cabal update, I switched to serialized testing, which now takes over 180 seconds in CI. Are there any solutions to this?

@j178
Copy link
Owner

j178 commented Jan 28, 2026

Can we skip cabal update in CI via a special env var (e.g PREK_INTERNAL__SKIP_CABAL_UPDATE)?

@fllesser
Copy link
Contributor Author

Ok

@fllesser fllesser marked this pull request as ready for review January 28, 2026 11:35
@fllesser
Copy link
Contributor Author

fllesser commented Jan 29, 2026

The haskell-actions/setup is excessively slow,especially macOS

@fllesser fllesser marked this pull request as draft January 30, 2026 07:15
# Conflicts:
#	.github/workflows/ci.yml
@j178 j178 marked this pull request as ready for review January 31, 2026 12:06
Copilot AI review requested due to automatic review settings January 31, 2026 12:06
Copy link
Contributor

Copilot AI left a 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 pull request adds support for the Haskell language to prek, resolving issue #1445. The implementation installs Haskell hooks via Cabal and runs configured entries using the system's cabal and ghc installations.

Changes:

  • Implemented Haskell language support with cabal v2-install for dependency management
  • Added comprehensive test coverage including local hooks, additional dependencies, and remote hooks
  • Updated CI/CD pipeline to run Haskell tests with GHC 9.8.2 and Cabal 3.16.1.0

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
docs/languages.md Updated documentation to mark Haskell as supported with usage instructions
crates/prek/src/languages/haskell.rs New implementation of Haskell language support using Cabal for installation and execution
crates/prek/src/languages/mod.rs Integrated Haskell language into the language registry
crates/prek/tests/languages/haskell.rs Added comprehensive tests for local hooks, additional dependencies, and remote hooks
crates/prek/tests/languages/main.rs Added haskell module to test suite
crates/prek/tests/languages/unimplemented.rs Updated to use R language as example of unimplemented language
crates/prek-consts/src/env_vars.rs Added PREK_INTERNAL__SKIP_CABAL_UPDATE environment variable for testing
.github/workflows/ci.yml Added Haskell to CI matrix with GHC/Cabal installation and caching on macOS
.config/nextest.toml Added lang-haskell test profile configuration

@j178
Copy link
Owner

j178 commented Jan 31, 2026

Thank you!

@j178 j178 merged commit d12e0be into j178:master Jan 31, 2026
45 checks passed
@fllesser fllesser deleted the haskell branch January 31, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support haskell language

3 participants