diff options
author | Marius Ghita <ghita.v.marius@gmail.com> | 2022-04-22 16:48:54 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-30 16:53:06 -0400 |
commit | 39edc7b42cf9ad54e19679a3b3494e3a166eaabe (patch) | |
tree | d0d08771364f099e70064c3d26b6a659cab274ab | |
parent | 170da54f8a9100b3f9ef02389af5834180b0cd27 (diff) | |
download | haskell-39edc7b42cf9ad54e19679a3b3494e3a166eaabe.tar.gz |
Update user guide example rewrite rules formatting
Change the rewrite rule examples to include a space between the
composition of `f` and `g` in the map rewrite rule examples.
Without this change, if the user has locally enabled the extension
OverloadedRecordDot the copied example will result in a compile time
error that `g` is not a field of `f`.
```
ā¢ Could not deduce (GHC.Records.HasField "g" (a -> b) (a1 -> b))
arising from selecting the field āgā
```
-rw-r--r-- | docs/users_guide/exts/rewrite_rules.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/users_guide/exts/rewrite_rules.rst b/docs/users_guide/exts/rewrite_rules.rst index 75ee2474a9..7da423f42e 100644 --- a/docs/users_guide/exts/rewrite_rules.rst +++ b/docs/users_guide/exts/rewrite_rules.rst @@ -16,7 +16,7 @@ The programmer can specify rewrite rules as part of the source program (in a pragma). Here is an example: :: {-# RULES - "map/map" forall f g xs. map f (map g xs) = map (f.g) xs + "map/map" forall f g xs. map f (map g xs) = map (f . g) xs #-} Use the debug flag :ghc-flag:`-ddump-simpl-stats` to see what rules fired. If @@ -48,7 +48,7 @@ From a syntactic point of view: the same column as the enclosing definitions. :: {-# RULES - "map/map" forall f g xs. map f (map g xs) = map (f.g) xs + "map/map" forall f g xs. map f (map g xs) = map (f . g) xs "map/append" forall f xs ys. map f (xs ++ ys) = map f xs ++ map f ys #-} @@ -63,7 +63,7 @@ From a syntactic point of view: :ref:`phase-control`), immediately after the name of the rule. Thus: :: {-# RULES - "map/map" [2] forall f g xs. map f (map g xs) = map (f.g) xs + "map/map" [2] forall f g xs. map f (map g xs) = map (f . g) xs #-} The ``[2]`` means that the rule is active in Phase 2 and subsequent |