diff --git a/specification.md b/specification.md index bf96f57..8d76b95 100644 --- a/specification.md +++ b/specification.md @@ -90,15 +90,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. Such a value should have a method named `fantasy-land/canonical` that returns the module. For example: ```js const ListModule = { of(x) { - return {'fantasy-land/canonical': ListModule, data: [x]} + return {'fantasy-land/canonical': () => ListModule, data: [x]} }, map(f, v) { - return {'fantasy-land/canonical': ListModule, data: v.data.map(f)} + return {'fantasy-land/canonical': () => ListModule, data: v.data.map(f)} } } ``` @@ -115,11 +115,13 @@ const ListModule2 = { } } -const list = {'fantasy-land/canonical': ListModule2, data: [1]} +const list = {'fantasy-land/canonical': () => ListModule2, data: [1]} ``` Note that the `ListModule2` here is correct. Only the `list` value doesn't follow the specification. +The `fantasy-land/canonical` method must always return equivalent modules when called multiple times. + ## Algebra