Tradition
This commit is contained in:
parent
d6fd426d31
commit
112bdf4847
10
app/Main.hs
10
app/Main.hs
|
@ -1,11 +1,13 @@
|
|||
module Main where
|
||||
|
||||
import System.Random
|
||||
import Data.Time
|
||||
|
||||
data Fastfood = Kapsalon
|
||||
| Pizza
|
||||
| Lasagne
|
||||
| Nachos
|
||||
| Friet
|
||||
| Durum
|
||||
deriving (Show, Eq, Ord, Enum, Read, Bounded)
|
||||
|
||||
|
@ -15,6 +17,12 @@ instance Random Fastfood where
|
|||
(x, g') -> (toEnum x, g')
|
||||
random = randomR (minBound, maxBound)
|
||||
|
||||
getCurrentWeekDay :: IO DayOfWeek
|
||||
getCurrentWeekDay = dayOfWeek . utctDay <$> getCurrentTime
|
||||
|
||||
main :: IO ()
|
||||
main = print =<< (randomIO :: IO Fastfood)
|
||||
main = do
|
||||
day <- getCurrentWeekDay
|
||||
if day == Tuesday
|
||||
then print Friet
|
||||
else print =<< (randomIO :: IO Fastfood)
|
||||
|
|
Loading…
Reference in a new issue