[GHC] #4116: Type supplement for constructor specific uses of sum types

GHC cvs-ghc at haskell.org
Wed Jun 9 16:30:30 EDT 2010


#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):

 Final considerations:

 Narrowing types with value patterns makes programming cleaner and safer.

 Avoids the treatment of out-of-domain values in partially defined
 functions
 (like constructor-specific functions on sum types) with the corresponding
 use of calls to ''error'', exception throwing or ''Maybe'' results.

 The value patterns can be gathered at the caller through case analysis
 and assigned to as-pattern variables or as refinements of the case
 variable,
 and checked at compile time when used as actual parameters.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4116#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list