If I declare data constructors such as
data City = Baltimore | Chicago | Seattle | Miami | Toronto
deriving (Bounded, Enum, Eq, Ord, Show)
data Name = Orioles | Cubs | Mariners | Marlins | BlueJays
deriving (Bounded, Enum, Eq, Ord, Show)
How can I make a function
checkPermutation :: (City -> Name) -> Bool
to verify that two cities are not given the same team name. For example, the following will return True, but if any "Name" is assigned to more than one city, it will return False.
test1 :: City -> Name
test1 c = case c of
Baltimore -> Orioles
Chicago -> Cubs
Seattle -> Mariners
Miami -> Marlins
Toronto -> Blue Jays
source
share