Skip to content

Template Haskell should warn about non-exhaustive pattern matches

When using Typed Template Haskell, There are no warings for non-exhaustive patterns inside the quote.

{-# LANGUAGE TemplateHaskell #-}

module Foo where

import Language.Haskell.TH.Lib

foo :: Maybe Int -> TExpQ Bool
foo x = [||case x of
            Nothing -> False||]

Instead the warnings appear where the code is spliced.

{-# LANGUAGE TemplateHaskell #-}

module Bar where

import Foo

x = $$(foo (Just 1))
Trac metadata
Trac field Value
Version 7.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information