I'm new to Haskell and my problem is to create a graph whose height is a number I give it. The nodes must go from 1 to (2 ^ h) -1
For example.
treeFC 0 - > GVacio
treeFC 3 - > Arc 3 6 (Arc 3 7 (Node 6 (Node 7 (Arc 2 4 (Arc 2 5
(Node 4 (Node 5 (Arc 1 2 (Arc 1 3 (Node 2 (Node 3 (Node 1 GVacio))))))))))))
My code is the following but I can not check if it works because of the error of the title of the post. Any help is very welcome.
module Main where
import Text.Show.Functions
data Grafo1 a = GVacio | Nodo a (Grafo1 a) | Arco a a (Grafo1 a) deriving Show
data Grafo2 a= G2 [a] [(a,a)] deriving Show
-- union:: Grafo1 a -> Grafo2 a -> Grafo1 a
main :: IO ()
main = return ()
treeFC :: Int -> Grafo1 Int
treeFC 0 = GVacio
treeFC n = auxtreeFC 1 (2^n-1) (Nodo 1 GVacio)
auxtreeFC:: Int -> Int -> Grafo1 Int -> Grafo1 Int
auxtreeFC x y g = if (2*x>y) then g
else auxtreeFC x (y-1) (Arco x y(Nodo y g))