Ticket #3476 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

Compiler warning about non-exhaustive pattern match with GADT and type-signature

Reported by: Ashley Yakeley Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.10.4
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

This program:

{-# OPTIONS -Wall #-}
{-# LANGUAGE GADTs #-}
module Bug where

    data T n where
        BoolT :: T Bool
        IntT :: T Int
 
    f :: T Bool -> Int
    f BoolT = 3

...gives this warning

$ ghc -c Bug.hs 

Bug.hs:10:4:
    Warning: Pattern match(es) are non-exhaustive
             In the definition of `f': Patterns not matched: IntT

The pattern match is, in fact, exhaustive, given the type signature.

Change History

Changed 4 years ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to fixed

Happily this already works in the HEAD (and hence in the upcoming 6.12 release)

Simon

Note: See TracTickets for help on using tickets.