Skip to content

Commit e5fbc57

Browse files
committed
Better docs
1 parent 247db90 commit e5fbc57

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/chip/)
55

66

7-
////Chip is a gleam process registry that plays along the [Gleam Erlang](https://hexdocs.pm/gleam_erlang/) `Subject` type.
8-
////
9-
////It lets tag subjects under a name or group to later reference them. Will also automatically delist dead processes.
7+
Chip is a gleam process registry that plays along the [Gleam Erlang](https://hexdocs.pm/gleam_erlang/) `Subject` type.
8+
9+
It lets tag subjects under a name or group to later reference them. Will also automatically delist dead processes.
1010

1111
### Example
1212

gleam.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "chip"
2-
version = "0.5.0"
2+
version = "0.5.1"
33
description = "A Gleam registry library"
44
licences = ["Apache-2.0"]
55

src/chip.gleam

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,24 @@ type Registry(name, group, message) =
1717

1818
/// This is the message type used internally by Chip.
1919
///
20-
/// Its generics `name`, `group`, and `msg` correspond to whatever types we do want to assign to the
21-
/// registry when initializing. A Chip instance only accepts `Subject's of the same type so it is
22-
/// sometimes useful to state the types on startup. For example:
20+
/// `Message(name, group, msg)` generics correspond to the types that the registry will use to manage
21+
/// unique names, group names and Subject messages. When building your system it is useful to state
22+
/// these on startup. For example:
2323
///
2424
/// ```gleam
2525
/// type Group {
26-
/// GroupA
27-
/// GroupB
28-
/// GroupC
26+
/// A
27+
/// B
28+
/// C
2929
/// }
3030
///
31-
/// > let assert Ok(registry) = chip.start()
32-
/// > let registry: process.Subject(chip.Message(String, Group, Chat))
31+
/// let assert Ok(registry) = chip.start()
32+
/// let registry: process.Subject(chip.Message(String, Group, Chat))
3333
/// ```
3434
///
3535
/// By specifying the types we can document the kind of registry we are working with. For example the
3636
/// registry above lets us tag subjects that use the `Subject(Chat)` type; it lets us tag individual
37-
/// subjects through stringified names; finally lets us group subjects into a group A, B or C.
38-
///
39-
/// Of course we can always rely on gleam's type inference to do the typing for us.
37+
/// subjects through stringified names; finally lets us group subjects into a groups A, B or C.
4038
pub opaque type Message(name, group, msg) {
4139
NamedSubject(client: Subject(Result(Subject(msg), Nil)), name: name)
4240
NamedRegistrant(subject: Subject(msg), name: name)
@@ -135,7 +133,7 @@ pub fn group(
135133
///
136134
/// ```gleam
137135
/// > chip.find(registry, "group-a")
138-
/// [subject]
136+
/// [subject_1, subject_2, subject_3]
139137
/// ```
140138
pub fn members(registry, group) -> List(Subject(msg)) {
141139
process.call(registry, GroupedSubjects(_, group), 10)
@@ -149,6 +147,8 @@ pub fn members(registry, group) -> List(Subject(msg)) {
149147
/// > chip.broadcast(registry, "group-a", fn(subject) {
150148
/// > process.send(subject, Message(data))
151149
/// > })
150+
/// Nil
151+
/// ```
152152
pub fn broadcast(
153153
registry: Subject(Message(name, group, message)),
154154
group: group,

0 commit comments

Comments
 (0)