From 39edc7b42cf9ad54e19679a3b3494e3a166eaabe Mon Sep 17 00:00:00 2001 From: Marius Ghita Date: Fri, 22 Apr 2022 16:48:54 +0300 Subject: Update user guide example rewrite rules formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ā€™ ``` --- docs/users_guide/exts/rewrite_rules.rst | 6 +++--- 1 file 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 -- cgit v1.2.1