Skip to content

Allow disjunctions in COMPLETE pragmas

Motivation

!11200 (comment 525994) lays out a limitation of COMPLETE pragmas. One might want to have a data type with N sets of M interchangeable patterns, but currently this would require N * M COMPLETE pragmas.

I was surprised by this since MINIMAL pragmas for typeclasses allow having disjunctions, eg, we can say:

{-# MINIMAL foo, (bar | baz) #-}

In my mind these two constructs are analogous so I was surprised that they differed in this way.

Proposal

COMPLETE pragmas should support both conjunction and disjunction (with , and | respectively) just like MINIMAL pragmas.

I think this would require a GHC proposal. I don't currently have the time to write one up but I hope I will in the future. But I thought I'd make a ticket in case someone else wanted to and if not so I don't forget about it

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information