Silly fastfood thingy
This commit is contained in:
commit
767f98f24a
8 changed files with 813 additions and 0 deletions
19
app/Main.hs
Normal file
19
app/Main.hs
Normal file
|
@ -0,0 +1,19 @@
|
|||
module Main where
|
||||
|
||||
import System.Random
|
||||
|
||||
data Fastfood = Friet
|
||||
| Kapsalon
|
||||
| Pizza
|
||||
| Lasagne
|
||||
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)
|
||||
|
||||
|
||||
main :: IO ()
|
||||
main = print =<< (randomIO :: IO Fastfood)
|
Loading…
Add table
Add a link
Reference in a new issue