
#8961: Require PatternSynonyms language extension to *use* pattern synonyms -------------------------------------+------------------------------------- Reporter: cactus | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.8.1 Component: Compiler (Type | Version: 7.8.1-rc2 checker) | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: Unknown/Multiple | Difficulty: Easy (less than 1 Type of failure: None/Unknown | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by simonpj): I was sceptical too. GHC's general convention is to require an extension at the ''definition'' site of something, but not its ''use'' site. For example, you can use a kind-polymorphic type constructor without `PolyKinds`; and you can use overlapping instances without `OverlappingInstances`. Really the only justification for not following this convention is if it's going to be hard for the user to understand what's going on. For example, a uni-directional pattern synonym can be used in a pattern but not an expression, and that would be puzzling if you had no idea that `K` is a pattern synonym. Also pattern matching on a pattern synonym might be much more expensive than pattern matching on a data constructor. And that kind of thing was the justification for #2905. FWIW, my own instinct is ''not'' to require `PatternSynonyms` at the use site; but I didn't feel strongly about it to reverse the choice. And it's easier to lift the restriction later than to add it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8961#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler