Warning about “INLINE binder is (non-rule) loop breaker” with `-dcore-lint`
Using lens
{-# Language TemplateHaskell #-}
import Control.Lens
data Config = Config { _companyName :: String }
data AppState = AppState { _asConfig :: Config }
makeClassy ''Config
instance HasConfig AppState where
config = undefined
gives
$ ghci -ignore-dot-ghci -dcore-lint /tmp/tvQq.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /tmp/tvQq.hs, interpreted )
*** Core Lint warnings : in result of Simplifier ***
/tmp/tvQq.hs:10:10: warning:
[RHS of $ccompanyName_a7EP :: Lens' AppState String]
INLINE binder is (non-rule) loop breaker: $ccompanyName_a7EP
*** Core Lint warnings : in result of Simplifier ***
/tmp/tvQq.hs:10:10: warning:
[RHS of $ccompanyName_a7EP :: Lens' AppState String]
INLINE binder is (non-rule) loop breaker: $ccompanyName_a7EP
Ok, modules loaded: Main.
*Main>
makeClass
actually dumps
<interactive>:64:54-72: Splicing declarations
makeClassy ''Config
======>
class HasConfig c_axo7 where
config :: Lens' c_axo7 Config
companyName :: Lens' c_axo7 String
{-# INLINE companyName #-}
companyName = (.) config companyName
instance HasConfig Config where
{-# INLINE companyName #-}
config = id
companyName = iso (\ (Config x_axo8) -> x_axo8) Config
Using that to create a small example
data Config = Config { name :: String }
class HasConfig a where
config :: a -> Config
companyName :: a -> String
{-# INLINE companyName #-}
companyName a = name (config a)
instance HasConfig Config where
{-# INLINE companyName #-}
config = id
companyName = name . config
which works perfectly fine without -dcore-lint
but gives a warning with
$ ghci -ignore-dot-ghci -dcore-lint /tmp/tvQq.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /tmp/tvQq.hs, interpreted )
*** Core Lint warnings : in result of Simplifier ***
/tmp/tvQq.hs:11:3: warning:
[RHS of $ccompanyName_a18Q :: Config -> String]
INLINE binder is (non-rule) loop breaker: $ccompanyName_a18Q
*** Core Lint warnings : in result of Simplifier ***
/tmp/tvQq.hs:11:3: warning:
[RHS of $ccompanyName_a18Q :: Config -> String]
INLINE binder is (non-rule) loop breaker: $ccompanyName_a18Q
Ok, modules loaded: Main.