Below I give data constructors for list and trees.
data List a = NilL | Cons a (List a) deriving Show
data Tree a = NilT | Branch a [Tree a] deriving Show
With these definitions I can create infinite structures easily as shown below:
list = Cons 1 list
tree = Branch 1 lt
where
lt = tree : lt
I want to create infinite graphs (both directed and undirected) in this manner. How to declare a data constructor for it and how to create an infinite graph using that data constructor in Haskell?