Linearity Core Lint failure with optimisations
The LinearListComprehension test fails Core Lint when compiled with optimisations:
{-# LANGUAGE LinearTypes #-}
{-# OPTIONS_GHC -O -dcore-lint #-}
module LinearListComprehension_opt where
guard :: a %1 -> (a %1 -> Bool) %1 -> [Int]
guard x g = [ y | g x, y <- [0,1] ]
*** Core Lint errors : in result of Desugar (before optimization) ***
LinearListComprehension_opt.hs:11:9: warning:
Linearity failure in lambda: g_awP
'Many ⊈ 'One