Skip to content

Commit

Permalink
Reorganize README
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Mar 11, 2022
1 parent c41d589 commit 771ca2d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Transformation for view patterns in OCaml.
_Attempts to_ imitate [Haskell view patterns](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/view_patterns.html).

See [`example/`](example/) for example usage.


## Usage
In dune:
Expand All @@ -18,6 +16,8 @@ In dune:
Use `[%view? pat when exp]` as a pattern to apply `exp` to whatever the pattern is matching and match the result of the `exp` application against `pat`.
Analogous to the Haskell view pattern `exp -> pat`.

See [`example/`](example/) for example usage.

Supported in:
* `match ... with ...` cases,
* `function ...` cases,
Expand All @@ -26,7 +26,8 @@ Supported in:
* `try ... with ...` cases,
* nested inside the `pat` and `exp` parts of a view pattern itself.

_A view pattern disables `redundant-case` and `partial-match` warnings for the corresponding `match`/`function`._
### Caveats
A view pattern disables `redundant-case` and `partial-match` warnings for the corresponding `match`/`function`.

Currently unsupported in:
- [ ] `let ...` definition left-hand sides (at top level or in modules).
- `let ...` definition left-hand sides (at top level or in modules).

0 comments on commit 771ca2d

Please sign in to comment.