stan icon indicating copy to clipboard operation
stan copied to clipboard

Inspection on too restrictive SPECIALIZE

Open chshersh opened this issue 5 years ago • 0 comments

If you have a function of type:

foo :: MonadIO m => m a

then the following specializations are either useless or too restrictive:

{-# SPECIALIZE foo :: MonadIO m => m () #-}
{-# SPECIALIZE foo :: IO () #-}

The only correct one is:

{-# SPECIALIZE foo :: IO a #-}

But since GHC doesn't warn on such cases, it's useful for Stan to provide such type of analysis.

chshersh avatar Jul 28 '20 14:07 chshersh