alex-prelude- Collection of useful functions for writing console applications

Safe HaskellSafe



This is a collection of really useful functions. They are mostly aimed towards writing console applications.

For example:

import AlexPrelude

main :: IO ()
main = do
    print "Hello my name is Alex"
    name <- prompt "What is your name? "
    print ("Hello, " ++ name)
    print "Let me ponder on what I think about your name..."
    sleep 10
    print "It is ridiculous! Why would your parents do that to you!"

As you can see, these functions try to fill in the missing gaps for when you want to write a real application in haskell.



prompt :: String -> IO String Source #

Asks a user for some input

sleep :: Int -> IO () Source #

Wait for a given number of seconds

clear_screen :: IO () Source #

This clears the screen. Unfortunately, this only works if the terminal has less than 80 rows. If the terminal has more rows, you can just call this a couple of times until the entire screen is cleared.

print_banner :: IO () Source #

This prints a banner to show that your application was created using AlexPrelude. You are not obliged to use this, but I would be thankful.