Changes between Version 19 and Version 20 of Commentary/Compiler/DeriveFunctor


Ignore:
Timestamp:
Jul 14, 2016 2:38:47 PM (3 years ago)
Author:
RyanGlScott
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/DeriveFunctor

    v19 v20  
    551551There's one part of the `bifoldMap` algorithm that deserves futher discussion: the overlapping cases for `T c1 c1 c3`. Whenever an argument to a constructor has a type  where each of the last two type variables mention `a` or `b`, we opt to generate `bifoldMap` instead of `foldMap`. We //could// go the other way, though. For instance, the following is a valid implementation of `Bifoldable` for `newtype T a b = T (Either a b)`:
    552552
    553 {{{!#hs
     553{{{#!hs
    554554instance Bifoldable T where
    555555  bifoldMap _ g (T e) = foldMap g e