statebox / cql

CQL: Categorical Query Language implementation in Haskell
GNU Affero General Public License v3.0
162 stars 14 forks source link

Abbreviate repeated qualifiers in instance declarations #121

Open wisnesky opened 5 years ago

wisnesky commented 5 years ago

I'd like to write 'TyMap f `[a,b,c]' instead of (f a, f b, f c) in instance declarations a la Marco's trick for regular function type declarations, but it doesn't quite work.

instance (Show var, Show ty, Show sym, Show en, Show fk, Show att, Show gen, Show sk,
          Show x, Show y, Show gen', Show sk', Show x', Show y')
  => Show (Transform var ty sym en fk att gen sk x y gen' sk' x' y') where

~~>

instance (Show `[var, ty sym, ...]) =>
wisnesky commented 5 years ago

This one is especially important if we want to avoid unnecessary qualifiers while also keeping lists of qualifiers textually short.