Skip to content

Instantly share code, notes, and snippets.

@hiroshi-maybe
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save hiroshi-maybe/25b84a1879b0a0776ab8 to your computer and use it in GitHub Desktop.

Select an option

Save hiroshi-maybe/25b84a1879b0a0776ab8 to your computer and use it in GitHub Desktop.
Type class default implementation
class MyEq a where
equalsTo :: a -> a -> Bool
equalsTo x y = not (notEqualsTo x y)
notEqualsTo :: a -> a -> Bool
notEqualsTo x y = not (equalsTo x y)
instance MyEq Integer where
equalsTo x y = x == y
main = do putStrLn (show $ notEqualsTo (1::Integer) (2::Integer))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment