Last active
August 24, 2021 18:18
-
-
Save bitumin/186fec6faffffc32b5b169d03b6a6cfa to your computer and use it in GitHub Desktop.
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 System.Environment | |
import Data.List | |
-- takes first string element of given list of strings | |
first :: [String] -> String | |
first args | |
| null args = error "You must provide a radius" | |
| otherwise = head args | |
-- casts string to double | |
str2int :: String -> Double | |
str2int str = read str :: Double | |
-- TODO write the area function | |
main = do | |
args <- getArgs | |
print (area (str2int (first args))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment