2024-03-11 23:37:53 +01:00
|
|
|
module Main where
|
|
|
|
|
|
|
|
import System.Random
|
2024-03-21 02:49:38 +01:00
|
|
|
import Data.Time
|
2024-03-11 23:37:53 +01:00
|
|
|
|
2024-03-12 20:55:47 +01:00
|
|
|
data Fastfood = Kapsalon
|
2024-03-11 23:37:53 +01:00
|
|
|
| Pizza
|
|
|
|
| Lasagne
|
2024-03-12 20:55:47 +01:00
|
|
|
| Nachos
|
2024-03-21 02:49:38 +01:00
|
|
|
| Friet
|
2024-03-12 20:55:47 +01:00
|
|
|
| Durum
|
2024-03-11 23:37:53 +01:00
|
|
|
deriving (Show, Eq, Ord, Enum, Read, Bounded)
|
|
|
|
|
|
|
|
instance Random Fastfood where
|
|
|
|
randomR (a, b) g =
|
|
|
|
case randomR (fromEnum a, fromEnum b) g of
|
|
|
|
(x, g') -> (toEnum x, g')
|
|
|
|
random = randomR (minBound, maxBound)
|
|
|
|
|
2024-03-21 02:49:38 +01:00
|
|
|
getCurrentWeekDay :: IO DayOfWeek
|
|
|
|
getCurrentWeekDay = dayOfWeek . utctDay <$> getCurrentTime
|
2024-03-11 23:37:53 +01:00
|
|
|
|
|
|
|
main :: IO ()
|
2024-03-21 02:49:38 +01:00
|
|
|
main = do
|
|
|
|
day <- getCurrentWeekDay
|
|
|
|
if day == Tuesday
|
|
|
|
then print Friet
|
|
|
|
else print =<< (randomIO :: IO Fastfood)
|