Changes between Version 20 and Version 21 of ViewPatterns


Ignore:
Timestamp:
Jan 26, 2007 12:37:49 PM (8 years ago)
Author:
malcolm.wallace@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ViewPatterns

    v20 v21  
    326326}}} 
    327327 
    328 Projection to multiple alternatives requires a new data type for every group of alternatives introduced. 
     328Projection to multiple alternatives requires a new (or existing) data type for every group of alternatives introduced. 
    329329{{{ 
    330330    data Dimensions = Small | Medium | Big      -- View type 
     
    356356repeated every time. More importantly, there is *no way* for the compiler to optimize this because that would mean common subexpression elimination across 
    357357functions. 
     358 
     359Some would argue that implicit the 'Maybe a' is ''less'' compositional than the explicit version.  If no 'Maybe' is required, then the result of the view function can be any type at all, which can be pattern-matched in the ordinary way.  Some examples of cute programming of well-known combinators: 
     360{{{ 
     361map f [] = [] 
     362map f (x: map f -> xs) = x:xs 
     363 
     364foldr f z [] = z 
     365foldr f z (x: foldr f z -> xs) =  x `f` xs 
     366}}} 
    358367 
    359368=== Transparent ordinary Patterns ===