Skip to content

Commit 3e98c72

Browse files
committed
Use a screenshot instead of a code listing in the README
1 parent 2aa830b commit 3e98c72

File tree

4 files changed

+38
-25
lines changed

4 files changed

+38
-25
lines changed

README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,11 @@ It does so by
2323
When type specs are added the program is checked against
2424
these specs statically. The more type specs, the more static typing.
2525

26-
An example is worth more than a thousand words:
26+
A picture is worth more than a thousand words:
2727

28-
```erlang
29-
1 -module(exhaustive_type).
30-
2
31-
3 -export([allergen_score/1]).
32-
4
33-
5 -type allergen() :: eggs
34-
6 | chocolate
35-
7 | pollen
36-
8 | cats.
37-
9
38-
10 -spec allergen_score(allergen()) -> integer().
39-
11 allergen_score(Al) ->
40-
12 case Al of
41-
13 eggs -> 1;
42-
14 chocolate -> 32;
43-
15 pollen -> 64
44-
16 end.
45-
```
28+
[![](screenshots/exhaustive_type.png) ![](doc/screenshots/exhaustive_type.png)][examples]
4629

47-
```
48-
$ gradualizer test/should_fail/exhaustive_type.erl
49-
test/should_fail/exhaustive_type.erl: Nonexhaustive patterns on line 13 at column 9
50-
Example values which are not covered:
51-
cats
52-
```
30+
[examples]: https://github.com/erszcz/Gradualizer/blob/release-0.2.0/doc/examples.md
5331

5432

5533
## Usage

doc/examples.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Some examples of Gradualizer in action
2+
3+
![An example Gradualizer exhaustiveness checking diagnostic](screenshots/exhaustive_type.png)
4+
5+
Here's the same example in text for copy-pasting:
6+
7+
```erlang
8+
1 -module(exhaustive_type).
9+
2
10+
3 -export([allergen_score/1]).
11+
4
12+
5 -type allergen() :: eggs
13+
6 | chocolate
14+
7 | pollen
15+
8 | cats.
16+
9
17+
10 -spec allergen_score(allergen()) -> integer().
18+
11 allergen_score(Al) ->
19+
12 case Al of
20+
13 eggs -> 1;
21+
14 chocolate -> 32;
22+
15 pollen -> 64
23+
16 end.
24+
```
25+
26+
```
27+
$ gradualizer test/should_fail/exhaustive_type.erl
28+
test/should_fail/exhaustive_type.erl: Nonexhaustive patterns on line 13 at column 9
29+
Example values which are not covered:
30+
cats
31+
```
32+
33+
[ErlangLS](https://github.com/erlang-ls/erlang_ls) integration example:
34+
35+
![Gradualizer diagnostics with ErlangLS](screenshots/134913123-4700b299-2714-4227-b7e2-f8c816b138a5.gif)
Loading

doc/screenshots/exhaustive_type.png

216 KB
Loading

0 commit comments

Comments
 (0)