Last active
June 23, 2016 08:44
-
-
Save melrief/c195eac6faf9ca7388563b3670531d2d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class HasN a where | |
n :: a -> Int | |
data JobOne = JobOne Int | |
data JobTwo = JobTwo | |
data JobThree = JobThree Int | |
data JobDescriptionWithN = JobDescriptionWithNOne JobOne | JobDescriptionWithNThree JobThree | |
data JobDescription = JobDescriptionTwo JobTwo | JobWithN JobDescriptionWithN | |
instance HasN JobOne where | |
n (JobOne x) = x | |
instance HasN JobThree where | |
n (JobThree x) = x | |
instance HasN JobDescriptionWithN where | |
n (JobDescriptionWithNOne j) = n j | |
n (JobDescriptionWithNThree j) = n j | |
main = print . n $ JobOne 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment