Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- newtype Rule = Rule String deriving (Show)
- class RuleSet a where
- getRules :: a -> [Rule]
- data Bus = Bus [Rule] deriving (Show)
- instance RuleSet Bus where
- getRules (Bus rules) = rules
- data Net = Net Bus [Rule] deriving (Show)
- instance RuleSet Net where
- getRules (Net bus rules) = getRules(bus) ++ rules
- bus = Bus [Rule "Rule 1", Rule "Rule 2"]
- net = Net bus [Rule "Own net rule"]
- main = putStrLn(show $ getRules(net))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement