[GHC] #10116: Closed type families: Warn if it doesn't handle all cases
GHC
ghc-devs at haskell.org
Thu Feb 26 08:37:50 UTC 2015
#10116: Closed type families: Warn if it doesn't handle all cases
-------------------------------------+-------------------------------------
Reporter: andrewthad | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.4
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by jstolarek):
* cc: jan.stolarek@… (added)
* type: task => feature request
Old description:
> Right now, I can do the following:
>
> data Foo = A | B
> type family Bar (n :: 'Foo) where
> Bar 'A = Int
>
> I would like to be warned if I write a partial type function like this
> because partial functions are almost always a mistake.
New description:
Right now, I can do the following:
{{{#!hs
data Foo = A | B
type family Bar (n :: 'Foo) where
Bar 'A = Int
}}}
I would like to be warned if I write a partial type function like this
because partial functions are almost always a mistake.
--
Comment:
Checking pattern exhaustiveness for closed type families could also allow
us to detect unreachable equations:
{{{#!hs
data Foo = A | B
type family Bar (n :: Foo) where
Bar 'A = Int
Bar 'B = Char
Bar a = Double
}}}
Here the last equation is unreachable but GHC does not discover this.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10116#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list