fastfood-hs/app/Main.hs

29 lines
686 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
case day of
Tuesday -> print Friet
_ -> print =<< (randomIO :: IO Fastfood)