From cae2ea64b74e54379392e219824a74e6fc4319a7 Mon Sep 17 00:00:00 2001 From: Jonathan Daugherty Date: Sat, 9 Dec 2017 16:12:50 -0800 Subject: [PATCH] Brick.Main: parameterize simpleApp on drawn widget --- src/Brick/Main.hs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Brick/Main.hs b/src/Brick/Main.hs index 35776d7..c6a29ee 100644 --- a/src/Brick/Main.hs +++ b/src/Brick/Main.hs @@ -131,21 +131,19 @@ simpleMain :: (Ord n) => Widget n -- ^ The widget to draw. -> IO () -simpleMain w = - let app = simpleApp { appDraw = const [w] } - in defaultMain app () +simpleMain w = defaultMain (simpleApp w) () -- | A simple application with reasonable defaults to be overridden as -- desired: -- --- * Draws nothing +-- * Draws only the specified widget -- * Quits on any event other than resizes -- * Has no start event handler -- * Provides no attribute map -- * Never shows any cursors -simpleApp :: App s e n -simpleApp = - App { appDraw = const [C.emptyWidget] +simpleApp :: Widget n -> App s e n +simpleApp w = + App { appDraw = const [w] , appHandleEvent = resizeOrQuit , appStartEvent = return , appAttrMap = const $ attrMap defAttr []