summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2016-07-01 01:15:01 +0200
committerBen Gamari <ben@smart-cactus.org>2016-07-01 14:12:37 +0200
commitb412d8230b20223beff797d6207868aea9fd2085 (patch)
treee04b5e55debdeba41e0b641b74763d278a331bc1 /docs
parent81b437bcc680745d5d50d731b978a1764f40ab36 (diff)
downloadhaskell-b412d8230b20223beff797d6207868aea9fd2085.tar.gz
Allow one type signature for multiple pattern synonyms
This makes pattern synonym signatures more consistent with normal type signatures. Updates haddock submodule. Differential Revision: https://phabricator.haskell.org/D2083
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/glasgow_exts.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index 45b0d1c256..6cf98830ba 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -4315,14 +4315,19 @@ Note also the following points
- You may specify an explicit *pattern signature*, as we did for
``ExNumPat`` above, to specify the type of a pattern, just as you can
for a function. As usual, the type signature can be less polymorphic
- than the inferred type. For example
-
- ::
+ than the inferred type. For example ::
-- Inferred type would be 'a -> [a]'
pattern SinglePair :: (a, a) -> [(a, a)]
pattern SinglePair x = [x]
+ Just like signatures on value-level bindings, pattern synonym signatures can
+ apply to more than one pattern. For instance, ::
+
+ pattern Left', Right' :: a -> Either a a
+ pattern Left' x = Left x
+ pattern Right' x = Right x
+
- The GHCi :ghci-cmd:`:info` command shows pattern types in this format.
- For a bidirectional pattern synonym, a use of the pattern synonym as