Skip to content

No dead code warning for `if (x:: Word) < 0 then putStrLn "dead" else putStrLn "live"

Following code is optimized and dead branch doesn't end up in an elf file, but compiler doesn't complain about anything with -Wall.

f :: Word -> IO Word
f x | x < 0 = putStrLn "DDDDDDDDDDDDDDDDDDDDDDDDDD" >> pure 1
    | otherwise = pure $ x + 2
{-# NOINLINE f #-}

GHC 9.2.4

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