Display example node
This commit is contained in:
parent
ff2dc3e783
commit
8fb3ab19c8
2 changed files with 14 additions and 4 deletions
|
|
@ -42,9 +42,9 @@ data ClientState = ClientState
|
|||
, csEditor :: Maybe NodeEditor
|
||||
}
|
||||
|
||||
newClientState :: ClientState
|
||||
newClientState = ClientState
|
||||
{ csTree = newTree $ emptyNode "Connecting..." False False False False
|
||||
newClientState :: Node -> ClientState
|
||||
newClientState node = ClientState
|
||||
{ csTree = newTree node
|
||||
, csEditor = Nothing
|
||||
}
|
||||
|
||||
|
|
@ -65,4 +65,4 @@ clientApp = App
|
|||
}
|
||||
|
||||
main :: IO ()
|
||||
main = void $ defaultMain clientApp newClientState
|
||||
main = void $ defaultMain clientApp $ newClientState exampleNode
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ module Forest.Node
|
|||
, isValidPath
|
||||
, narrowPath
|
||||
, narrowSet
|
||||
-- * Example values
|
||||
, exampleNode
|
||||
) where
|
||||
|
||||
import Control.Monad
|
||||
|
|
@ -86,3 +88,11 @@ narrowPath _ _ = Nothing
|
|||
|
||||
narrowSet :: NodeId -> Set.Set Path -> Set.Set Path
|
||||
narrowSet x s = Set.fromList [Path ys | Path (y:ys) <- Set.toList s, x == y]
|
||||
|
||||
{- For testing -}
|
||||
|
||||
exampleNode :: Node
|
||||
exampleNode = Node "Tool box" False False True False $ Map.fromList
|
||||
[ ("hammer", Node "Hammer" False True False True Map.empty)
|
||||
, ("nail", Node "Nail" False True False False Map.empty)
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue