- 🤯 Oh Boy! You implemented the entire Grep like a based Boi?
Is it Gud?
- 🚨 Did it pass Codecrafters tests
- 📌 Features (We all know its summarized with LLM so...yeah)
- 📋 Kay, how do I run it tho
- 🙌 Thanks for Visiting
No
This is a toy grep functionality implemented for learning Hasal, Haskal, Haskal, Haskal
At the time of writing this code, I only have knowledge upto Higher order functions, not the intimidating stuff (functors and Monads) so the implementation of Grep is pretty basic
Codecrafters link for the challenge.
Even this version constructed with the lack of skilled Haskal, Haskal, Haskal, Haskal is just 128 LOC
(80 akshually) and ik that is not always a indicator of good code but rather a signal that some undreadable clusterfuck has been made,
But truly, with my limited knowledge, this is pretty straightforward and easy to understand and with other languages (okay i expected those numbers to be way more) it would still be a bit...eh....clusterfucked (for the lack of better words or a reflection of my master over other langs)

This passed all the code-crafters tests except the additional ones
grep.mov
Before you throw a Gotcha, Ik it fails, but it fails at the additional tests and passes the basic ones

Here's the regex matcher features in a markdown table:
Feature | Syntax | Description |
---|---|---|
Single wildcards | \d |
Matches any digit (0-9) |
\w |
Matches any word character (alphanumeric + underscore) | |
Character classes | [abc] |
Matches any character in the set (e.g., 'a', 'b', or 'c') |
[^abc] |
Matches any character not in the set | |
Anchors | ^ |
Matches the start of the string |
$ |
Matches the end of the string | |
Quantifiers | + |
Matches one or more of the preceding pattern |
? |
Matches zero or one of the preceding pattern | |
Alternation | (a|b) |
Matches either 'a' or 'b' |
Dot (.) | . |
Matches any single character |
Tbh, easiest way is to install ghc, navigate to /app and run ghci
and run the command :l Main.hs
which will load the file up
LLM summarized instructions below btw
- Install Stack:
- Download and install Stack from the official guide.
- Ensure Git is installed for cloning the repository (Windows users can use Git for Windows, macOS/Linux often have it pre-installed).
- Use git clone https://github.com/wagiejack/grep, replacing the URL with your repository's address.
- Open your terminal or command prompt and navigate to the cloned directory.
- Run stack build to compile the code.
- Execute with stack exec your-package-name -E "" "", replacing your-package-name with the package name from package.yaml.
Alternatively, on Unix-like systems (macOS, Linux), run ./your_program.sh if available. For Windows, use Git Bash or WSL to run the script.