Guest User

Untitled

a guest
Apr 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Module ----------------------------------------------------------------------
  2.  
  3. module Aufgabe7 where
  4.  
  5. -- Import ----------------------------------------------------------------------
  6. import Data.List
  7. import Data.Maybe
  8.  
  9.  
  10. -- Deklarationen ---------------------------------------------------------------
  11.  
  12. type Vertex = Integer
  13. type Origin = Vertex
  14. type Destination = Vertex
  15. type Key = Integer
  16. type Name = Integer
  17. data BTree a = BLeaf Key a | BNode Key a (BTree a) (BTree a) deriving Show
  18. data LTree a = LNode Key a [(LTree a)] deriving Show
  19. data ALgraph = ALg [(Origin,[Destination])] deriving (Eq,Show)
  20.  
  21.  
  22. class Structure s where
  23. noOfSources :: s -> Integer
  24. noOfSources (BNode k s l r) = 1
  25. noOfSources _ = 1
  26. noOfSources  s = 1
  27.  
  28. -- noOfSinks :: s -> Integer
  29. -- notSourceConnected  :: s -> [Name]
  30. -- notSinkConnected :: s -> [Name]
  31.  
  32. -- instance Eq a => Eq (LTree a) where
  33.  
  34. instance Eq a => Eq (BTree a) where
  35.     (==) a (BNode k v l r)  =  True
  36.     (==) _ _                = False
Add Comment
Please, Sign In to add comment