Last active
January 16, 2017 06:45
-
-
Save eborden/b5395d3510ac32e0e80c8a99d03250ad to your computer and use it in GitHub Desktop.
Coupling code
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
function accountAdd (foo, x) { | |
return foo.account + x | |
} | |
// accountAdd exhibits stamp coupling and data coupling. |
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
module Main where | |
import Prelude | |
accountAdd foo x = foo.account + x | |
-- Infered type of accountAdd: forall a r. Semiring a => {account :: a | r} -> a -> a | |
-- The inferred type represents structural typing with adhoc polymorphism. | |
-- These forms of typing allow us to be explicit about stamp and data coupling. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment