#4116: Type supplement for constructor specific uses of sum types
---------------------------------+------------------------------------------
    Reporter:  gabrielrf         |       Owner:              
        Type:  proposal          |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.13              |    Keywords:              
          Os:  Unknown/Multiple  |    Testcase:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by gabrielrf):

 Further extension:

 since we try to propagate case analysis
 we can express the type supplement as a set of disjoint patterns, as masks
 for the different branches

 {{{
 hd :: (List2 a) @ { Cons a _ | Cons2 a _ _ } -> a
 hd (Cons x _) = x
 hd (Cons2 x _ _) = x
 }}}

 as reflected by Wren NG Thornton in
 http://article.gmane.org/gmane.comp.lang.haskell.cafe/75669

 making possible nested patterns
 {{{
 headFromJust :: (Maybe a) @ {Just a:_} -> a
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4116#comment:4>
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

Reply via email to