Cache the number of data cons in DataTyCon and SumTyCon

Authored by niteria on Dec 26 2017, 6:54 AM.

Description

Cache the number of data cons in DataTyCon and SumTyCon

This is a follow-up after faf60e85 - Make tagForCon non-linear.
On the mailing list @simonpj suggested to solve the
linear behavior by caching the sizes.

Test Plan: ./validate

Reviewers: simonpj, simonmar, bgamari, austin

Reviewed By: simonpj

Subscribers: carter, goldfire, rwbarton, thomie, simonpj

Differential Revision: https://phabricator.haskell.org/D4131