Last active
October 13, 2015 19:36
-
-
Save dimitri-xyz/81a56b0ce0929e8513e9 to your computer and use it in GitHub Desktop.
Merging 2 branches - function definition depends on constant definition
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
-- base | |
------- | |
c :: Int | |
c = 5 | |
plusc :: Int -> Int | |
plusc x = x + c | |
main = putStrLn $ "the total is: " ++ show (plusc 1) | |
-- branch A | |
----------- | |
c :: Int | |
c = 6 -- New Value | |
plusc :: Int -> Int | |
plusc x = x + c | |
main = putStrLn $ "the total is: " ++ show (plusc 1) | |
-- branch B | |
----------- | |
c :: Int | |
c = 5 | |
plusc :: Int -> Int | |
plusc x = case c of -- New Definition | |
6 -> -3 | |
_ -> x + c | |
main = putStrLn $ "the total is: " ++ show (plusc 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment