Skip to content

Instantly share code, notes, and snippets.

@eborden
Last active January 16, 2017 06:45
Show Gist options
  • Save eborden/b5395d3510ac32e0e80c8a99d03250ad to your computer and use it in GitHub Desktop.
Save eborden/b5395d3510ac32e0e80c8a99d03250ad to your computer and use it in GitHub Desktop.
Coupling code
function accountAdd (foo, x) {
return foo.account + x
}
// accountAdd exhibits stamp coupling and data coupling.
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