Skip to content

Instantly share code, notes, and snippets.

@bitumin
Last active August 24, 2021 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitumin/186fec6faffffc32b5b169d03b6a6cfa to your computer and use it in GitHub Desktop.
Save bitumin/186fec6faffffc32b5b169d03b6a6cfa to your computer and use it in GitHub Desktop.
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