Skip to content

Core lint INLINE loopbreaker warnings for binary

When building with the devel flavour I keep seeing warnings like these:

*** Core Lint warnings : in result of Specialise ***
libraries/binary/src/Data/Binary/Get/Internal.hs:280:3: warning:
    INLINE binder is (non-rule) loop breaker: $cmany_a2mw

*** Core Lint warnings : in result of Float out(FOS {Lam = Just 0,
                                                     Consts = True,
                                                     OverSatApps = False}) ***
libraries/binary/src/Data/Binary/Get/Internal.hs:280:3: warning:
    INLINE binder is (non-rule) loop breaker: $cmany_a2mw

*** Core Lint warnings : in result of Simplifier ***
<no location info>: warning:
    INLINE binder is (non-rule) loop breaker: $cmany_s36J

This seems to be a result of this definition:

-- | @since 0.7.0.0
instance Alternative Get where
  empty = C $ \inp _ks -> Fail inp "Data.Binary.Get(Alternative).empty"
  {-# INLINE empty #-}
  (<|>) f g = do
    (decoder, bs) <- runAndKeepTrack f
    case decoder of
      Done inp x -> C $ \_ ks -> ks inp x
      Fail _ _ -> pushBack bs >> g
      _ -> error "Binary: impossible"
  {-# INLINE (<|>) #-}
  some p = (:) <$> p <*> many p
  {-# INLINE some #-}
  many p = do
    v <- (Just <$> p) <|> pure Nothing
    case v of
      Nothing -> pure []
      Just x -> (:) x <$> many p
  {-# INLINE many #-}

Clearly many is recursive so can't be inlined. Resulting in the INLINE pragma not doing much. (I think we still retain the unfolding for specializations though?).

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