twentefp-eventloop-trees 0.1.0.1 → 0.1.1.0
raw patch · 2 files changed
+20/−9 lines, 2 filesdep ~eventloopPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: eventloop
API changes (from Hackage documentation)
+ FPPrac.Trees: showTree :: GeneralizeTree a => a -> IO ()
+ FPPrac.Trees: showTreeList :: GeneralizeTree a => [a] -> IO ()
Files
- src/FPPrac/Trees.hs +18/−7
- twentefp-eventloop-trees.cabal +2/−2
src/FPPrac/Trees.hs view
@@ -8,6 +8,8 @@ , showRBTreeList , showRoseTree , showRoseTreeList + , showTree + , showTreeList ) where @@ -17,8 +19,9 @@ import Eventloop.Types.EventTypes import Eventloop.DefaultConfiguration import qualified Eventloop.Module.Websocket.Canvas as C -import Eventloop.Module.BasicShapes import Eventloop.Module.DrawTrees +import Eventloop.Module.BasicShapes +import Eventloop.Utility.Trees.GeneralTree data ProgramState = ProgramState deriving (Eq, Show) @@ -34,25 +37,33 @@ -eventloop :: [Tree] -> ProgramState -> In -> (ProgramState, [Out]) -eventloop trees state Start = (state, [ OutCanvas $ C.SetupCanvas 1 1 (1024, 1024) (C.CSSPercentage 0, C.CSSPercentage 0) +eventloop :: [GeneralTree] -> ProgramState -> In -> (ProgramState, [Out]) +eventloop trees state Start = (state, [ OutCanvas $ C.SetupCanvas 1 1 (round width, round height) (C.CSSPosition C.CSSFromCenter (C.CSSPercentage 50, C.CSSPercentage 50)) , OutDrawTrees $ DrawTrees 1 trees , Stop ] ) + where + (_, width, height) = showGeneralTreeList trees + + showRBTree :: RBTree -> IO() -showRBTree tree = showRBTreeList [tree] +showRBTree tree = showTree tree showRBTreeList :: [RBTree] -> IO () -showRBTreeList trees = startMainloop (eventloopConfig (map TRBTree trees)) +showRBTreeList trees = showTreeList trees showRoseTree :: RoseTree -> IO() -showRoseTree tree = showRoseTreeList [tree] +showRoseTree tree = showTree tree showRoseTreeList :: [RoseTree] -> IO () -showRoseTreeList trees = startMainloop (eventloopConfig (map TRoseTree trees)) +showRoseTreeList trees = showTreeList trees +showTree :: (GeneralizeTree a) => a -> IO () +showTree tree = showTreeList [tree] +showTreeList :: (GeneralizeTree a) => [a] -> IO () +showTreeList trees = startMainloop (eventloopConfig $ map generalizeTree trees)
twentefp-eventloop-trees.cabal view
@@ -1,5 +1,5 @@ name: twentefp-eventloop-trees -version: 0.1.0.1 +version: 0.1.1.0 synopsis: Tree type and show functions for lab assignment of University of Twente. Contains RoseTree and RedBlackTree license: BSD3 license-file: LICENSE @@ -14,7 +14,7 @@ build-depends: base >=4.6 && <5, - eventloop >= 0.3.0.0 && < 0.4.0.0 + eventloop >= 0.4.0.0 && < 0.5.0.0 hs-source-dirs: src default-language: Haskell2010