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
|
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)
|
||||||
|
|
Loading…
Reference in a new issue