Skip to content

Don't require parentheses for via type

GHC requires parentheses around via types in -XDerivingVia. This restriction should be lifted.

-XDerivingVia naturally splits up into via types of different kinds:

{-# Language DerivingVia    #-}
{-# Language KindSignatures #-}

import Data.Bifunctor
import Data.Functor.Classes
import Data.Kind

newtype Par a b = Par (a, b)
 deriving Eq
 via (a, b)
  :: Type

 deriving Eq1
 via (,) a
  :: Type -> Type

 deriving Eq2
 via (,)
  :: Type -> Type -> Type

Without parentheses we get in a way, a novel syntax.

newtype Par a b = Par (a, b)
 deriving Eq  via (,) a b :: Type
 deriving Eq1 via (,) a   :: Type -> Type
 deriving Eq2 via (,)     :: Type -> Type -> Type
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information