Created
July 18, 2016 08:26
-
-
Save CarstenKoenig/d487a68b325d7f43f053c6df6cbcffde to your computer and use it in GitHub Desktop.
just to show some simple things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Unsafe where | |
| import System.Random | |
| import System.IO.Unsafe(unsafePerformIO) | |
| generateUUID :: () -> String | |
| generateUUID () = show $ unsafePerformIO (randomIO :: IO Int) | |
| wuiPanel :: () -> IO String | |
| wuiPanel () = do | |
| return $ "Hey " ++ uuid | |
| where | |
| uuid = generateUUID () | |
| generateUUID' :: String | |
| generateUUID' = show $ unsafePerformIO (randomIO :: IO Int) | |
| wuiPanel' :: IO String | |
| wuiPanel' = do | |
| return $ "Hey " ++ uuid | |
| where | |
| uuid = generateUUID' | |
| ---------------------------------- | |
| -- Example run in GHCi | |
| > wuiPanel' | |
| "Hey 8392539819302952191" | |
| > wuiPanel' | |
| "Hey 8392539819302952191" | |
| > wuiPanel' | |
| "Hey 8392539819302952191" | |
| > wuiPanel() | |
| "Hey 5880651860501659846" | |
| > wuiPanel() | |
| "Hey 3355626182084962896" | |
| > wuiPanel() | |
| "Hey 6303352265620553643" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment