Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop prefix from canonical property #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This project specifies interoperability of common algebraic structures. The main

### How to add compatibility with Fantasy Land to your library

If your library defines a new type make sure that the values of that type have a reference to the canonical [module](specification.md#module) in the `fantasy-land/canonical` property [as described in the specification](specification.md#canonical-module).
If your library defines a new type make sure that the values of that type have a reference to the canonical [module](specification.md#module) in the `canonical` property [as described in the specification](specification.md#canonical-module).

In rare cases when it's impossible to add the property to values, for example when you define a module for a type that you cannot control, it's still useful to expose compatible [module objects](specification.md#module). Simply say in your documentation where the modules are located.

Expand Down
8 changes: 4 additions & 4 deletions specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ All methods' implementations should only use type information about arguments th

## Canonical Module

A value may have a reference to a canonical module that works with values of that value's type. The reference should be in the `fantasy-land/canonical` property. For example:
A value may have a reference to a canonical module that works with values of that value's type. The reference should be in the `canonical` property. For example:

```js
const ListModule = {
of(x) {
return {'fantasy-land/canonical': ListModule, data: [x]}
return {'canonical': ListModule, data: [x]}
},
map(f, v) {
return {'fantasy-land/canonical': ListModule, data: v.data.map(f)}
return {'canonical': ListModule, data: v.data.map(f)}
}
}
```
Expand All @@ -117,7 +117,7 @@ const ListModule2 = {
}
}

const list = {'fantasy-land/canonical': ListModule2, data: [1]}
const list = {'canonical': ListModule2, data: [1]}
```

Note that the `ListModule2` here is correct. Only the `list` value doesn't follow the specification.
Expand Down