Skip to content

Commit

Permalink
update readme for active patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
thautwarm committed Jan 22, 2019
1 parent ccdd059 commit 5297155
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ end
```

A simple intepreter implementation using GADTs could be found at `test/untyped_lam.jl`.


### Active Patterns

Currently, in MLStyle it's not a [full featured](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/active-patterns) one, but even a subset with parametric active pattern could be super useful.

```julia
@active Re{r :: Regex}(x) begin
match(r, x)
end

@match "123" begin
Re{r"\d+"}(x) => x
_ => @error ""
end # RegexMatch("123")
```

0 comments on commit 5297155

Please sign in to comment.