-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b3a1be
commit 6afcae8
Showing
2 changed files
with
14 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
Kaleidoscope is a small library which provides pattern matching using regular | ||
expressions, and extraction of capturing groups into values, which are typed | ||
according to the repetition of the group. Patterns can be written inline, | ||
directly in a `case` pattern, and do not need to be predefined. | ||
Kaleidoscope is a small library to make pattern matching against strings more pleasant. Regular | ||
expressions can be written directly in patterns, and capturing groups bound directly to variables, | ||
typed according to the group's repetition. Here is an example: | ||
```amok scala | ||
case class Email(user: Text, domain: Text) | ||
email match | ||
case r"$user([^@]+)@$domain(.*)" => Email(name, domain) | ||
``` |
This file contains 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