Created
July 27, 2026 14:30
-
-
Save loloof64/b6056decc3e76aaab5b3bdcd22d47b10 to your computer and use it in GitHub Desktop.
Haskell : asking for user identity from terminal (small haskell experimentation)
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
| import Data.List (intercalate) | |
| main = getIdentity | |
| getIdentity :: IO () | |
| getIdentity = do | |
| putStrLn "About to get your identity..." | |
| putStrLn "" | |
| nameParts <- traverse id $ map getName ["first", "last"] | |
| putStrLn $ "You entered: " ++ (intercalate " " nameParts) | |
| getName :: String -> IO String | |
| getName argType = do | |
| putStrLn $ "Enter " ++ argType ++ "name : " | |
| name <- getLine | |
| putStrLn "" | |
| return name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment