I defined a function called findPathsin a Haskell module called BinaryTree, and I'm trying to call this function in the main module that I created. Type of function call
findPaths :: Tree -> [Path]
Where Treeis the data type defined as:
data Tree = Leaf | Node Tree Tree
and is Pathdefined as:
data Path = LeftTurn Path | RightTurn Path | This
In the main function, I do this and only this:
module Main where
import BinaryTree
findPaths (Node Leaf Leaf)
But when I try to compile it with the following command:
ghc -o --make Main Main.hs BinaryTree.hs
I get this error:
Couldn't match expected type `Language.Haskell.TH.Syntax.Q
[Language.Haskell.TH.Syntax.Dec] '
against inferred type `[Path] '
In the expression: findPaths (Node Leaf Leaf)I get the same error if I try to export data types in the BinaryTree module:
module BinaryTree (Tree(..), Path(..), allPaths) where...
... , . , , , . .
UPDATE
, , .
@Travis , , , :
import BinaryTree
main = do
print (findPaths (Node Leaf Leaf))
, . , .
2
, , , , . , , . , .