[Haskell-cafe] Wincomplete-uni-patterns and bidirectional patterns

Tom Ellis tom-lists-haskell-cafe-2023 at jaguarpaw.co.uk
Tue Jan 16 15:21:19 UTC 2024


On Tue, Jan 16, 2024 at 04:16:26PM +0100, Olaf Klinke wrote:
> > I remember reading somewhere, but I can't find it now, that GHC's 
> > coverage checker does not look inside pattern synonym definitions at 
> > all, and this is by design: namely to ensure abstraction boundaries. 
> > Looking inside the definition would mean that type checking behaviour
> > (in a way -- if you count coverage checks as "type checking") of user
> > code is influenced by invisible implementation details of the 
> > "constructors" they're using.
> 
> Compare that to 'type' versus 'newtype' on the type level: A type is
> just an alias, a synonym. The type checker has access to all
> information on the right hand side of the equality. With extensions
> like TypeSynonymInstances, A type alias is interchangeable with the
> aliased type. 
> If what you report is true, they should not have called pattern
> synonyms a "synonym". 

Ah, they should be newpatterns!


More information about the Haskell-Cafe mailing list