packages feed

vty-menu 0.0.1 → 0.0.3

raw patch · 3 files changed

+27/−5 lines, 3 filesdep ~vtynew-component:exe:vty-menu

Dependency ranges changed: vty

Files

Graphics/Vty/Menu.hs view
@@ -36,7 +36,7 @@  -} -module Graphics.Vty.Menu(displayMenu) where+module Graphics.Vty.Menu(displayMenu,displayMenuOfValues) where import qualified Graphics.Vty as Vty  getName :: String -> String@@ -117,11 +117,15 @@  displayMenu :: [String] -> IO (Maybe String) displayMenu items = do+ displayMenuOfValues $ zip items items++displayMenuOfValues :: [(String,a)] -> IO (Maybe a)+displayMenuOfValues items = do  vty <- allocate- (vty',maybePos) <- work 0 0 items vty+ (vty',maybePos) <- work 0 0 (map fst items) vty  deallocate vty'  case maybePos of-  Just pos -> return $ Just $ items !! pos+  Just pos -> return $ Just $ snd $ items !! pos   Nothing -> return Nothing  --main = do
vty-menu.cabal view
@@ -1,5 +1,5 @@ Name: vty-menu-Version: 0.0.1+Version: 0.0.3 Synopsis: A lib for displaying a menu and getting a selection using VTY Category:Graphics @@ -12,9 +12,13 @@ cabal-version: >= 1.6  library- build-depends:base<5,vty <= 4.7.0.14+ build-depends:base<5,vty <= 4.8  exposed-modules:Graphics.Vty.Menu +Executable vty-menu+ Main-is: vty-menu.hs+ source-repository head   type:     git   location: git://github.com/timthelion/vty-menu.git+
+ vty-menu.hs view
@@ -0,0 +1,14 @@+{- This executables sole purpose is getting arround  http://hackage.haskell.org/trac/ghc/ticket/7789 -}+import Graphics.Vty.Menu+import System.Environment+import System.IO++main = do+ { args <- getArgs+ ; ansM <- displayMenu args+ ; let+    ans =+     case ansM of+      Nothing -> ""+      Just ans' -> ans'+ ; hPutStrLn stderr ans }