I am attempting to pass back a Node type from this function, but I get the error that empty is out of scope:
import Data.Set (Set)
import qualified Data.Set as Set
data Node = Vertex String (Set Node)
deriving Show
toNode :: String -> Node
toNode x = Vertex x empty
What am I doing wrong?
import qualified Data.Set as Set means that when you want to use something from Data.Set, you have to qualify it with Set.. So to use empty write Set.empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With