Skip to content

Instantly share code, notes, and snippets.

@dimitri-xyz
Last active October 13, 2015 19:36
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 dimitri-xyz/81a56b0ce0929e8513e9 to your computer and use it in GitHub Desktop.
Save dimitri-xyz/81a56b0ce0929e8513e9 to your computer and use it in GitHub Desktop.
Merging 2 branches - function definition depends on constant definition
-- 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