-- #hide, prune module Main where import TDisplay import qualified TDisplay.Output.Raw import qualified TDisplay.Output.Tags import qualified TDisplay.Output.Simple import Debug.Trace import Test.HUnit ---------------------------------------------------------------------- -- Generic part: the Model in the Model/View/Controller paradigm itemlist :: [TDOutput] itemlist = [ TDString tdTag_MiscText "One" , TDString tdTag_MiscErr "Two" , TDGroup tdTag_MiscGroup $ Left [ TDString tdTag_MiscText "Three" , TDGroup tdTag_MiscGroup $ Left [ TDGroup tdTag_MiscGroup $ Left [ TDString tdTag_MiscDebug "Four" , TDString tdTag_MiscError "Five" ] , TDString tdTag_MiscDebug "Six" ] ] , TDString tdTag_MiscText "Seven" ] newtype WatchShow a = WS { str::a } instance (Show a) => Show (WatchShow a) where show x = trace "shown" $ show (str x) instance (TDShow a) => TDShow (WatchShow a) where tdshow i x = trace "tdshown" $ tdshow i (show x) -- tdIdLocal :: TD_Id -- base for local TD_Id values -- tdIdLocal = 100 tblank :: TDTag tblank = TDTag "tblank" ["text"] tdebug :: TDTag tdebug = tdTag_MiscDebug tvalue :: TDTag tvalue = TDTag "tvalue" ["value"] twshow :: TDTag twshow = TDTag "watchshow" ["text"] terror :: TDTag terror = tdTag_MiscErr ws9 :: WatchShow Int ws9 = WS 9 tdtest :: [TDOutput] tdtest = tdshowsLn tblank "Hello, World!" $ tdshows tdebug "Debug1" $ tdshows tvalue (Just 5) $ tdshows twshow ws9 $ tdshows terror "some error" $ tdshows tdebug "Debug2" $ tdshows tblank "bye" $ tdEOL main :: IO () main = do putStrLn "Start" putStrLn "===========================" putStrLn "----Tags itemlist----" TDisplay.Output.Tags.runTDisplayIO itemlist putStrLn "----Raw itemlist----" TDisplay.Output.Raw.runTDisplayIO itemlist putStrLn "----Simple itemlist----" TDisplay.Output.Simple.runTDisplayIO itemlist putStrLn "===========================" putStrLn "----Tags tdtest----" TDisplay.Output.Tags.runTDisplayIO tdtest putStrLn "----Raw tdtest----" TDisplay.Output.Raw.runTDisplayIO tdtest putStrLn "----Simple tdtest----" TDisplay.Output.Simple.runTDisplayIO tdtest putStrLn "===========================" putStrLn "Finish"