Tradition

This commit is contained in:
Nox Sluijtman 2024-03-21 02:49:38 +01:00
parent d6fd426d31
commit 112bdf4847

View file

@ -1,11 +1,13 @@
module Main where module Main where
import System.Random import System.Random
import Data.Time
data Fastfood = Kapsalon data Fastfood = Kapsalon
| Pizza | Pizza
| Lasagne | Lasagne
| Nachos | Nachos
| Friet
| Durum | Durum
deriving (Show, Eq, Ord, Enum, Read, Bounded) deriving (Show, Eq, Ord, Enum, Read, Bounded)
@ -15,6 +17,12 @@ instance Random Fastfood where
(x, g') -> (toEnum x, g') (x, g') -> (toEnum x, g')
random = randomR (minBound, maxBound) random = randomR (minBound, maxBound)
getCurrentWeekDay :: IO DayOfWeek
getCurrentWeekDay = dayOfWeek . utctDay <$> getCurrentTime
main :: IO () main :: IO ()
main = print =<< (randomIO :: IO Fastfood) main = do
day <- getCurrentWeekDay
if day == Tuesday
then print Friet
else print =<< (randomIO :: IO Fastfood)