Skip to content

Default signature check can be quite onerous

The bytes library currently doesn't compile with GHC master due to the new check of default signatures (7363d538, #12918 (closed)). Consider this example,

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DefaultSignatures #-}
module Hi where
import Control.Monad.Trans.Class

class MonadGet m where
  type Remaining m :: *

  remaining :: m (Remaining m)
  default remaining :: (MonadTrans t, MonadGet n, m ~ t n) => m (Remaining (t n))
  remaining = lift remaining

Patching this up requires a fair amount of hand-holding,

  default remaining :: (MonadTrans t, MonadGet n, m ~ t n, Remaining m ~ Remaining n, Monad n) => m (Remaining m)

Yuck.

I suppose this is just how the world works, but I thought I'd leave this here in case anyone had a clever idea for improvement.

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