
#10434: SPECIALISE instance does not specialize as far as SPECIALISE for type
signatures
-------------------------------------+-------------------------------------
Reporter: | Owner:
andreas.abel | Status: new
Type: bug | Milestone:
Priority: normal | Version: 7.8.3
Component: Compiler | Operating System: Unknown/Multiple
Keywords: | Type of failure: None/Unknown
Architecture: | Blocked By:
Unknown/Multiple | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
{{{#!hs
type FreeM c = Reader (FreeEnv c) c
class Free' a c where
freeVars' :: (Monoid c) => a -> FreeM c
instance (Free' a c, Free' b c) => Free' (a,b) c where
{-# SPECIALIZE instance (Free' a All, Free' b All) => Free' (a,b) All
#-}
{-# SPECIALIZE freeVars' :: (Free' a Any, Free' b Any) => (a,b) -> FreeM
Any #-}
freeVars' (x,y) = freeVars' x `mappend` freeVars' y
}}}
I would expect these two specialize pragmas to work similarily. However,
the interface file shows that the mappend for Any has been inlined, but
not the one for All.
If you look at the .hi file dump below, you see
{{{
Data.Monoid.mappend
@ Data.Monoid.All
$dMonoid
}}}
generated by the SPECIALIZE instance, and
{{{
case (...) of wild1 {
GHC.Types.False
-> eta1
`cast`
(Control.Monad.Trans.Reader.NTCo:ReaderT[0]
,
Unfolding: InlineRule (4, True, False)
(\ @ a
@ b
$dFree' :: Agda.TypeChecking.Free.Lazy.Free' a
Data.Monoid.All
$dFree'1 :: Agda.TypeChecking.Free.Lazy.Free' b
Data.Monoid.All
$dMonoid :: Data.Monoid.Monoid Data.Monoid.All
ds :: (a, b) ->
case ds of wild { (,) x y ->
let {
eta :: Control.Monad.Trans.Reader.ReaderT
(Agda.TypeChecking.Free.Lazy.FreeEnv
Data.Monoid.All)
Data.Functor.Identity.Identity
Data.Monoid.All
= $dFree'
`cast`
(Agda.TypeChecking.Free.Lazy.NTCo:Free'[0]
<a>_N ,
Unfolding: InlineRule (3, True, False)
(\ $dFree' :: Agda.TypeChecking.Free.Lazy.Free' a
Data.Monoid.Any
$dFree'1 :: Agda.TypeChecking.Free.Lazy.Free' b
Data.Monoid.Any
ds :: (a, b) ->
case ds of wild { (,) x y ->
let {
eta :: Control.Monad.Trans.Reader.ReaderT
(Agda.TypeChecking.Free.Lazy.FreeEnv
Data.Monoid.Any)
Data.Functor.Identity.Identity
Data.Monoid.Any
= $dFree'
`cast`
(Agda.TypeChecking.Free.Lazy.NTCo:Free'[0]
<a>_N