085c0b62

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

ical-recurrence: express recurrence over a parameterised component

Nothing here is red.  This is a pure refactor: every .occ and .res golden
file is byte-identical, and the only new tests are genValidSpecs for the
new types.

This is the groundwork for handling RECURRENCE-ID.  A component with a
RECURRENCE-ID replaces the instance it names rather than adding an
occurrence beside it, so the occurrences of one component depend on the
other components sharing its UID.  No function that takes a single
component can be correct about that, which is why the old
single-component entry points go away rather than gaining a fix:

  recur :: Day -> event -> R (Set event)

took one component and rewrote its DTSTART, and

  recurEvents :: Day -> RecurringEvent -> R (Set EventOccurrence)

computed one component's own expansion under a name that claimed to
compute a recurrence set.  The expansion itself is still needed, so it
survives as 'expandRecurring', which says what it does.

Recurrence also applies to VTODO and VJOURNAL, not only VEVENT.  RFC 5545
gives all three the same recurrence properties, and section 3.8.4.4 says
RECURRENCE-ID identifies an instance of a "VEVENT, VTODO, or VJOURNAL".
The only thing that differs is how the end of an instance is spelled:
DTEND for VEVENT, DUE for VTODO, and VJOURNAL has none.  'RecurrenceEnd'
is that shared spelling, so a VTODO's DUE is not typed as a DTEND, and
the three projections 'eventRecurring', 'todoRecurring' and
'journalRecurring' are where the difference lives.

'Recurring', 'Occurrence' and 'Resolved' are parameterised over the
component so that one recurrence implementation serves all three, and so
that a caller which has already narrowed a VEVENT down to what it cares
about can still recur it.  The Functor instances are how it swaps its own
type in.  'HasRecurrence' is gone: a class over three known types buys
nothing that three functions do not, and 'makeOccurrence' existed only to
hand back a component the calendar never contained.

ICal.Recurrence.Class held the class, so it is renamed to
ICal.Recurrence.Types, which is what it now holds.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 0s 1s 1s 1s 0s
Eval 1s 11s 11s 13s 0s
Build 12s 1m07s 1m08s 1m20s 0s
Suite 0s 1m21s 1m20s 1m20s 0s

Timeline

0s10s20s30s40s50s1m1m10s1m20s