[GHC] #7785: Module-local function not specialized with ConstraintKinds

#7785: Module-local function not specialized with ConstraintKinds ------------------------------------+--------------------------------------- Reporter: akio | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: specialisation Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime performance bug | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- In the attached program, 'shared' is not exported and only used with f = [], but it doesn't get specialized in the core. On the other hand, shared', which does not involve !ConstraintKinds, gets correctly specialized. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7785 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7785: Module-local function not specialized with ConstraintKinds ------------------------------------+--------------------------------------- Reporter: akio | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: specialisation Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime performance bug | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- Comment(by akio): This can be worked around by defining a wrapper class such that the constraint kind no longer directly shows up in the type signatures. {{{ --- spec.hs 2013-03-22 15:41:23.000000000 +0900 +++ spec2.hs 2013-03-22 15:38:30.000000000 +0900 @@ -1,10 +1,12 @@ -{-# LANGUAGE TypeFamilies, ConstraintKinds #-} +{-# LANGUAGE TypeFamilies, ConstraintKinds, MultiParamTypeClasses, UndecidableInstances, FlexibleContexts, FlexibleInstances #-} module Foo(foo, bar, foo', bar') where import GHC.Exts type family Domain (f :: * -> *) a :: Constraint +class Domain f a => Domain' (f :: * -> *) a +instance Domain f a => Domain' f a type instance Domain [] a = () @@ -12,9 +14,9 @@ myfmap = map class MyFunctor f where - myfmap :: (Domain f a, Domain f b) => (a -> b) -> f a -> f b + myfmap :: (Domain' f a, Domain' f b) => (a -> b) -> f a -> f b -shared :: (MyFunctor f, Domain f Int) => f Int -> f Int +shared :: (MyFunctor f, Domain' f Int) => f Int -> f Int shared = let f = myfmap negate in }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7785#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7785: Module-local function not specialized with ConstraintKinds ------------------------------------+--------------------------------------- Reporter: akio | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: specialisation Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime performance bug | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- Changes (by liyang): * cc: hackage.haskell.org@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7785#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7785: Module-local function not specialized with ConstraintKinds ---------------------------------+------------------------------------------ Reporter: akio | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.2 Keywords: specialisation | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Runtime performance bug Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * difficulty: => Unknown * milestone: => 7.8.1 Comment: Thanks for the report. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7785#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC