Skip to content

Commit 2dc850d

Browse files
committed
fixup! Turn Coercible into a symmetric and transitive relation
1 parent 551b513 commit 2dc850d

File tree

1 file changed

+9
-5
lines changed
  • src/Language/PureScript/Docs

1 file changed

+9
-5
lines changed

src/Language/PureScript/Docs/Prim.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,17 @@ coercible = primClassOf (P.primSubName "Coerce") "Coercible" $ T.unlines
380380
, "This class does not have regular instances; instead they are created"
381381
, "on-the-fly during type-checking according to a set of rules."
382382
, ""
383-
, "First, Coercible obeys reflexivity, any type has the same representation"
384-
, "as itself and symmetry, pairs of types can be coerced both ways:"
383+
, "First, Coercible obeys reflexivity - any type has the same representation"
384+
, "as itself:"
385385
, ""
386386
, " instance coercibleReflexive :: Coercible a a"
387+
, ""
388+
, "Second, Coercible obeys symmetry - if a type `a` can be coerced to some"
389+
, "other type `b`, then `b` can also be coerced back to `a`:
390+
, ""
387391
, " instance coercibleSymmetric :: Coercible a b => Coercible b a"
388392
, ""
389-
, "Second, for every type constructor there is an instance that allows one"
393+
, "Third, for every type constructor there is an instance that allows one"
390394
, "to coerce under the type constructor (`data` or `newtype`). For example,"
391395
, "given a definition:"
392396
, ""
@@ -402,7 +406,7 @@ coercible = primClassOf (P.primSubName "Coerce") "Coercible" $ T.unlines
402406
, "such as `b` is thus typically referred to as a \"phantom\" type), `b` and `b'`"
403407
, "can differ arbitrarily."
404408
, ""
405-
, "Third, for every `newtype NT = MkNT T`, there is a pair of instances which"
409+
, "Fourth, for every `newtype NT = MkNT T`, there is a pair of instances which"
406410
, "permit coercion in and out of the `newtype`:"
407411
, ""
408412
, " instance coercibleNewtypeLeft :: Coercible a T => Coercible a NT"
@@ -411,7 +415,7 @@ coercible = primClassOf (P.primSubName "Coerce") "Coercible" $ T.unlines
411415
, "To prevent breaking abstractions, these instances are only usable if the"
412416
, "constructor `MkNT` is exported."
413417
, ""
414-
, "Fourth, every pair of unsaturated type constructors can be coerced if"
418+
, "Fifth, every pair of unsaturated type constructors can be coerced if"
415419
, "there is an instance for the fully saturated types. For example,"
416420
, "given the definitions:"
417421
, ""

0 commit comments

Comments
 (0)