#4116: Type supplement for constructor specific uses of sum types
---------------------------------+------------------------------------------
Reporter: gabrielrf | Owner:
Type: proposal | Status: new
Priority: normal | Component: Compiler
Version: | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by gabrielrf):
sorry for the layout.
Possible extension with "Negative patterns" to avoid out-of-domain
function parameters :
as introduced by Wren NG Northon in
http://article.gmane.org/gmane.comp.lang.haskell.cafe/75669
given
{{{
case x of
v @ patt1 -> f v --
v @ patt2 -> f v -- pattern of v == patt2 \\ patt1
v @ _ -> f v -- pattern of v == _ \\ patt2 \\ patt1
inverse :: (Fractional a) => a @ { _ \\ 0.0} -> a
inverse v = 1 / v
}}}
The type supplement @{ _ \\ 0.0} would permit the compiler to check that
the caller's case analysis should have evaluated the case for 0.0 in a
previous case branch before calling to inverse
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4116#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs