• Simon Peyton Jones's avatar
    Add AnonArgFlag to FunTy · 6cce36f8
    Simon Peyton Jones authored
    The big payload of this patch is:
      Add an AnonArgFlag to the FunTy constructor
      of Type, so that
        (FunTy VisArg   t1 t2) means (t1 -> t2)
        (FunTy InvisArg t1 t2) means (t1 => t2)
    The big payoff is that we have a simple, local test to make
    when decomposing a type, leading to many fewer calls to
    isPredTy. To me the code seems a lot tidier, and probably
    more efficient (isPredTy has to take the kind of the type).
    See Note [Function types] in TyCoRep.
    There are lots of consequences
    * I made FunTy into a record, so that it'll be easier
      when we add a linearity field, something that is coming
      down the road.
    * Lots of code gets touched in a routine way, simply because it
      pattern matches on FunTy.
    * I wanted to make a pattern synonym for (FunTy2 arg res), which
      picks out just the argument and result type from the record. But
      alas the pattern-match overlap checker has a heart attack, and
      either reports false positives, or takes too long.  In the end
      I gave up on ...
RtClosureInspect.hs 53.5 KB