[GHC] #11390: GHC does not warn about redundant equations

GHC ghc-devs at haskell.org
Sat Jan 9 16:54:07 UTC 2016


#11390: GHC does not warn about redundant equations
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:  warnings       |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Given the Phab:D1535 effort in GHC 8.0 I was curious how an example from
 Richard's post [https://typesandkinds.wordpress.com/2015/09/09/what-are-
 type-families/ What are type families?] would fare:

 {{{
 % ghci -Wall -XTypeFamilies -ignore-dot-ghci
 GHCi, version 8.1.20160105: http://www.haskell.org/ghc/  :? for help
 Prelude> :set +m
 Prelude> type family F1 a where
 Prelude|   F1 Int = Bool
 Prelude|
 Prelude> let
 Prelude|   sillyId :: F1 Char -> F1 Char
 Prelude|   sillyId x = x
 Prelude|
 Prelude>
 }}}

 This seems to fly, even though as the blog post noted, ”[...] sillyId
 can’t ever be called on a value.” Isn't the clause redundant and should be
 defined using `EmptyCase` (#2431) as `sillyId x = case x of {}`?

 It seems GHC doesn't care that the pattern match in the equation `absurd2
 _ = ...` is redundant either:
 {{{#!hs
 data Void

 absurd1 :: Void -> a;
 absurd1 = \case

 absurd2 :: Void -> a
 absurd2 _ = undefined
 }}}

 Is this intended or known behaviour?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11390>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list