/usr/lib/hugs/packages/time/Data/Time/Calendar/Easter.hs is in libhugs-time-bundled 98.200609.21-5.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | {-# OPTIONS -Wall -Werror #-}
module Data.Time.Calendar.Easter
(
sundayAfter,
orthodoxPaschalMoon,orthodoxEaster,
gregorianPaschalMoon,gregorianEaster
) where
-- formulae from Reingold & Dershowitz, _Calendrical Calculations_, ch. 8.
import Data.Time.Calendar
import Data.Time.Calendar.Julian
-- | The next Sunday strictly after a given day.
sundayAfter :: Day -> Day
sundayAfter day = addDays (7 - (mod (toModifiedJulianDay day + 3) 7)) day
-- | Given a year, find the Paschal full moon according to Orthodox Christian tradition
orthodoxPaschalMoon :: Integer -> Day
orthodoxPaschalMoon year = addDays (- shiftedEpact) (fromJulian jyear 4 19) where
shiftedEpact = mod (14 + 11 * (mod year 19)) 30
jyear = if year > 0 then year else year - 1
-- | Given a year, find Easter according to Orthodox Christian tradition
orthodoxEaster :: Integer -> Day
orthodoxEaster = sundayAfter . orthodoxPaschalMoon
-- | Given a year, find the Paschal full moon according to the Gregorian method
gregorianPaschalMoon :: Integer -> Day
gregorianPaschalMoon year = addDays (- adjustedEpact) (fromGregorian year 4 19) where
century = (div year 100) + 1
shiftedEpact = mod (14 + 11 * (mod year 19) - (div (3 * century) 4) + (div (5 + 8 * century) 25)) 30
adjustedEpact = if shiftedEpact == 0 || ((shiftedEpact == 1) && (mod year 19 < 10)) then shiftedEpact + 1 else shiftedEpact
-- | Given a year, find Easter according to the Gregorian method
gregorianEaster :: Integer -> Day
gregorianEaster = sundayAfter . gregorianPaschalMoon
|