id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
4185,Deriving higher-arity instances for newtype family instances fails,LouisWasserman,simonpj,"
{{{
{-# LANGUAGE TypeFamilies, GeneralizedNewtypeDeriving #-}
module Baz where

class Bar f where
	bar :: f a -> Int

data family Foo k :: * -> *

instance Bar Maybe where
	bar Nothing = 0
	bar Just{} = 1

newtype instance Foo Int a = FooInt (Maybe a) deriving (Bar)
}}}
fails with


{{{
Baz.hs:13:56:
    Derived instance `Bar (Foo Int)'
      requires illegal partial application of data type family Foo
    In the newtype instance declaration for `Foo'
}}}

Attempting to use StandaloneDeriving:

{{{
{-# LANGUAGE StandaloneDeriving, TypeFamilies, GeneralizedNewtypeDeriving #-}
module Baz where

class Bar f where
	bar :: f a -> Int

data family Foo k :: * -> *

instance Bar Maybe where
	bar Nothing = 0
	bar Just{} = 1

newtype instance Foo Int a = FooInt (Maybe a)

deriving instance Bar (Foo Int)
}}}

gives the super-weird error

{{{

Baz.hs:15:0:
    No family instance for `Foo Int'
    In the stand-alone deriving instance for `Bar (Foo Int)'
}}}

",bug,new,low,7.6.2,Compiler,6.12.3,,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,,,,,
