Last active
January 17, 2016 06:36
-
-
Save gouthamve/80605559f03159e0e7d4 to your computer and use it in GitHub Desktop.
Why does this happen?
This file contains 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
-- Doesnt Work | |
module Foo where | |
sumTutorial :: Integer -> Integer | |
sumTutorial 0 = 0 | |
sumTutorial n = n + sumTutorial n-1 | |
module Foo where | |
sumTutorial :: Integer -> Integer | |
sumTutorial n | |
| n == 0 = 0 | |
| otherwise = n + sumTutorial n-1 | |
-- Works | |
module Foo where | |
sumTutorial :: Integer -> Integer | |
sumTutorial 0 = 0 | |
sumTutorial n = n + sumTutorial (n-1) | |
module Foo where | |
sumTutorial :: Integer -> Integer | |
sumTutorial n | |
| n == 0 = 0 | |
| otherwise = n + sumTutorial (n-1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment