Created
December 15, 2014 18:15
-
-
Save soc/2e69912dab2040b43797 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
| -- A.hs | |
| module A where | |
| data U = X | Y deriving (Eq, Show) | |
| -- B.hs | |
| module B where | |
| import Data.Set | |
| import A | |
| instance Ord U where | |
| compare X X = EQ | |
| compare X Y = LT | |
| compare Y X = GT | |
| compare Y Y = EQ | |
| ins :: U -> Set U -> Set U | |
| ins = insert | |
| -- C.hs | |
| module C where | |
| import Data.Set | |
| import A | |
| instance Ord U where | |
| compare X X = EQ | |
| compare X Y = GT | |
| compare Y X = LT | |
| compare Y Y = EQ | |
| ins' :: U -> Set U -> Set U | |
| ins' = insert | |
| -- D.hs | |
| module Main where | |
| import Data.Set | |
| import A | |
| import B | |
| import C | |
| test :: Set U | |
| test = ins' X $ ins X $ ins Y $ empty | |
| main :: IO () | |
| main = print test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment