class - importing haskell module says "not in scope" -


i created tree structure in file called tree2.hs

module tree2 (  tree )  data tree = emptytree | node (tree a) (tree a) deriving (show) 

then imported , tried use instance of class

import qualified tree2  class yesno   yesno :: -> bool  instance yesno (tree2.tree a)   yesno emptytree = false   yesno _ = true 

but i'm getting error when loading in ghci:

not in scope: data constructor ‘emptytree’ failed, modules loaded: tree2. 

anyone know why?

first,

module tree2 (  tree ) 

only exports tree data type, not constructors; should use

module tree2 (   tree(..) ) 

instead.

second, you're doing qualified import, need use tree2.emptytree instead of emptytree.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -