From 7ae0afbc4b57a68f79457dd881bc98efda95eda1 Mon Sep 17 00:00:00 2001 From: Tretter Date: Tue, 7 Feb 2017 20:06:59 +0000 Subject: [PATCH] initial checkin from subversion --- examineWhereTheIssueIs.hs | 5 +++++ exs.hs | 7 +++++++ io1.hs | 4 ++++ numGuess1.hs | 12 ++++++++++++ recurs1.hs | 2 ++ rettest1.hs | 11 +++++++++++ stringManip.hs | 18 ++++++++++++++++++ 7 files changed, 59 insertions(+) create mode 100644 examineWhereTheIssueIs.hs create mode 100644 exs.hs create mode 100644 io1.hs create mode 100644 numGuess1.hs create mode 100644 recurs1.hs create mode 100644 rettest1.hs create mode 100644 stringManip.hs diff --git a/examineWhereTheIssueIs.hs b/examineWhereTheIssueIs.hs new file mode 100644 index 0000000..ab50ec0 --- /dev/null +++ b/examineWhereTheIssueIs.hs @@ -0,0 +1,5 @@ +ifa = do + putStr "Name: " + name <- getLine + if (name == "Koen") + then putStrLn "I think Debugging haskell is simple" diff --git a/exs.hs b/exs.hs new file mode 100644 index 0000000..59484a2 --- /dev/null +++ b/exs.hs @@ -0,0 +1,7 @@ +ifa = do + putStr "Name: " + name <- getLine + if name == "Koen" + then putStrLn "I know you" + else return () + diff --git a/io1.hs b/io1.hs new file mode 100644 index 0000000..fa2baaa --- /dev/null +++ b/io1.hs @@ -0,0 +1,4 @@ +main = do + putStrLn "Please enter your name: " + name <- getLine + putStrLn ("Hello, " ++ name ++ ", how are you?") diff --git a/numGuess1.hs b/numGuess1.hs new file mode 100644 index 0000000..5c56aa0 --- /dev/null +++ b/numGuess1.hs @@ -0,0 +1,12 @@ +doGuessing num = do + putStrLn "Enter your guess:" + guess <- getLine + if (read guess) < num + then do putStrLn "Too low!" + doGuessing num + else if (read guess) > num + then do putStrLn "Too high!" + doGuessing num + else do putStrLn "You Win!" + + diff --git a/recurs1.hs b/recurs1.hs new file mode 100644 index 0000000..168840d --- /dev/null +++ b/recurs1.hs @@ -0,0 +1,2 @@ +factorial 0 = 1 +factorial n = n * factorial (n-1) diff --git a/rettest1.hs b/rettest1.hs new file mode 100644 index 0000000..20d71fd --- /dev/null +++ b/rettest1.hs @@ -0,0 +1,11 @@ +main = + do x <- getX + putStrLn x + +getX = + do return "hello" + return "aren't" + return "these" + return "returns" + return "rather" + return "pointless?" diff --git a/stringManip.hs b/stringManip.hs new file mode 100644 index 0000000..8e031bc --- /dev/null +++ b/stringManip.hs @@ -0,0 +1,18 @@ +module StringManip where + +import Data.Char + +uppercase, lowercase :: String -> String +uppercase = map toUpper +lowercase = map toLower + +capitalise :: String -> String +capitalise x = + let capWord (x:xs) = toUpper x : xs + in unwords (map capWord (words x)) + +yy :: String -> String +yy a = + let capWord (a:b) = toUpper a : b + in a +