Skip to content

Defer type errors does not work with LinearTypes

I am trying to compile the following program with linear types using -fdefer-type-errors to disable compile-time checking:

{-# LANGUAGE LinearTypes #-}
module Bug where

f1 :: (a %1 -> b) -> a %1 -> b
f1 use x = let y = use x in y

(running with)

ghc Bug.hs -fdefer-type-errors

Unfortunately, it seems -fdefer-type-errors doesn't work when the type errors are regarding multiplicities/linearity.

Expected behavior: The program should compile successfully with a warning about the linearity error

Help appreciated! I am very much looking forward to fixing this and am willing to do it myself if time permits...

@aspiwack @monoidal @mpickering

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