literature

Haskell: Love life

Deviation Actions

Omorashi's avatar
By
Published:
1.7K Views

Literature Text

love = True
sex = True

cuddleMe love sex =
    if love && sex
        then putStrLn "Awww, that's so cute <3"
    else if love && (not sex)
        then putStrLn "Wow, are you a nun or monk?"
    else if (not love) && sex
        then putStrLn "You like bed-hopping, do you?"
    else
        putStrLn "Uh... you sure you want this relationship?"
:bulletblue:What is this about?
A little program written in Haskell that judges your love life depending on your input ;D

:bulletblue:How do I run it?
Copy the code into a file, give it some name (doesn't matter) and append ".hs"(for Haskell, obviously).
Go to the official Haskell site and download the GHC (Glasgow Haskell Compiler). Follow the instructions for your operating system on how to install it (it's cross-platform, available for Windows, Linux, and Mac) and run GHC.

Type ":cd" and the path to the folder where the hs-file lies. Type ":load" (or simply ":l") and the name of the file including the ".hs". The Prelude prompt should now change to "Main". Type "cuddleMe love sex" or (for negations) "cuddleMe (not love) sex" or variations and behold the result! ^^
Comments2
Join the community to add your comment. Already a deviant? Log In
YoOcik's avatar
Functional, Y U NO EASY! >: |