It's Friday, Friday! Gotta get down on Friday!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import Locale                         -- or: import System.Locale
import Data.Time.LocalTime
import Data.Time.Calendar
import Data.Time.Format
import Data.Time.Calendar.MonthDay
import Data.Set (Set)
import qualified Data.Set as Set

{--

The description of the problem is ripped nearly verbatim from 
http://www.cadaeic.net/calendar.htm

"
New York Minutes

Suppose an hour, minute, day, month, and year are written down on five 
pieces of paper and mixed. Define a New York Minute as an instant in time 
for which it is possible to reconstruct, by logical argument, the original 
order of the five fields. (This nomenclature is a reference to the song 
"New York Minute" by Don Henley, in which "everything can change". In a 
New York Minute, everything can change and yet it is still possible to 
reconstruct the original order.)

Do New York Minutes exist? The answer is "yes": for example, 
9:47 on 12/31/90. The 90 must be the year, as it is too large for any other 
field, and similarly 47 must be the minute and 31 must be the day. The 
remaining two (9 and 12) are uniquely determined because September has only 
30 days, so 9/31 would be illegal. Now for the puzzle: How many minutes 
elapse between the last New York Minute in 1999 and the first New York Minute 
in 2000?

Since the calendar repeats exactly every 400 years (proof: there are 97 
leap days every 400 years, and 365*400+97 is a multiple of 7), it is 
possible to calculate exactly how many New York Minutes there are. This 
number is 3,782,800 out of the 210,379,680 minutes in 400 years. In other 
words, about 1.8% of all minutes. But note that these are very irregularly 
spaced relative to the years. The years 1998 and 1999 each have 23,256 
New York Minutes, but the year 2000 only has 622! (In fact, not until the 
year 2060 are New York Minutes as plentiful as they are in 1999.)
"
Mike Kieth

1. For a given time, t, determine whether this time is a New York Minute:

 --}

isNYminute :: LocalTime -> Bool
isNYminute time = undefined

{--

2. From a set of input numbers, construct a New York Minute, if possible:

 --}

mkNYminute :: Set Int -> Maybe LocalTime
mkNYminute numbers = undefined

{--

3. Does today have any New York Minutes? If so, what are they, specifically?

 --}

todaysNYminutes :: IO [LocalTime] -- Today comes from the ... RealWorld .. EEK!
todaysNYminutes = undefined

{--

4. More generally, for any given day, d, what, if any, are the New York Minutes?

 --}

daysNYminutes :: Day -> [LocalTime]
daysNYminutes day = undefined

{--

'Now, for something completely different' than 'In a New York Minute' ...

Explanatory note on the title of this exercise:

"It's Friday, Friday! Gotta get down on Friday!" are the opening lyrics to
Rebecca Black's famous (infamous?) song popularized on youtube.com.

 --}

-- a rather ... 'comprehensive' solution is provided at http://lpaste.net/107370