Created
January 22, 2018 22:06
-
-
Save josejuan/f5e2c9761e3d58094fd1ca20c0790b31 to your computer and use it in GitHub Desktop.
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
> :set -XGeneralizedNewtypeDeriving | |
> instance (Num a, Num b) => Num (a, b) where (a, b) + (c, d) = (a+c,b+d) | |
> newtype Z = Z (Int, Int) deriving (Eq, Ord, Show, Num) | |
> Z (3, 4) + Z (5, 6) | |
Z (8,10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment