fastfood-hs/app/Main.hs
2024-03-21 02:49:38 +01:00

29 lines
678 B
Haskell

module Main where
import System.Random
import Data.Time
data Fastfood = Kapsalon
| Pizza
| Lasagne
| Nachos
| Friet
| Durum
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)
getCurrentWeekDay :: IO DayOfWeek
getCurrentWeekDay = dayOfWeek . utctDay <$> getCurrentTime
main :: IO ()
main = do
day <- getCurrentWeekDay
if day == Tuesday
then print Friet
else print =<< (randomIO :: IO Fastfood)