diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2016-07-01 01:15:01 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-07-01 14:12:37 +0200 |
commit | b412d8230b20223beff797d6207868aea9fd2085 (patch) | |
tree | e04b5e55debdeba41e0b641b74763d278a331bc1 /docs | |
parent | 81b437bcc680745d5d50d731b978a1764f40ab36 (diff) | |
download | haskell-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.rst | 11 |
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 |