From 8efd4b33ff1c4bb79b234103de1c7b3e428aa097 Mon Sep 17 00:00:00 2001 From: Nurul Amin Muhit Date: Sat, 26 Dec 2020 01:49:22 +0100 Subject: [PATCH] Update Functions and Inputs --- 01_-_Inputs.hs | 10 ---------- functions-and-inputs.hs | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) delete mode 100644 01_-_Inputs.hs create mode 100644 functions-and-inputs.hs diff --git a/01_-_Inputs.hs b/01_-_Inputs.hs deleted file mode 100644 index 0169739..0000000 --- a/01_-_Inputs.hs +++ /dev/null @@ -1,10 +0,0 @@ -{- - func1 n - - @takes An integer number - @returns The value of n - @examples func1 3 == 3 - func2 5 == 5 --} -func1 :: Integer -> Integer -func1 = \n -> n \ No newline at end of file diff --git a/functions-and-inputs.hs b/functions-and-inputs.hs new file mode 100644 index 0000000..a19cf1b --- /dev/null +++ b/functions-and-inputs.hs @@ -0,0 +1,29 @@ +{- + displayMe x + + @takes An input of any kind + @returns The value of x + @examples displayMe 3 == 3 + displayMe "Haskell for Great Good!" == "Haskell for Great Good!" +-} +displayMe x = x + +{- + doubleMe x + + @takes A number + @returns Multiplies the number by two + @examples doubleMe 5 == 10 + doubleMe 2.5 == 5.0 +-} +doubleMe x = x + x + +{- + doubleUs x y + + @takes Two numbers + @returns Multiplies the each number by two and then adds them together + @examples doubleUs 4 5 == 18 + doubleUs 2.5 3.0 == 12.0 +-} +doubleUs x y = doubleMe x + doubleMe y