packages feed

GuiTV 0.2 → 0.3

raw patch · 5 files changed

+23/−68 lines, 5 filesdep ~phooey

Dependency ranges changed: phooey

Files

CHANGES view
@@ -0,0 +1,3 @@+Version 0.3:
+
+* Small changes to sync with Phooey 1.0
GuiTV.cabal view
@@ -1,5 +1,5 @@ Name:                GuiTV-Version:             0.2+Version:             0.3 Synopsis:	     GUIs for Tangible Values Category:            Interfaces, User Interfaces Description:@@ -29,7 +29,7 @@ License:             BSD3 Stability:	     experimental Hs-Source-Dirs:      src-Build-Depends:       base, DeepArrow, phooey>=0.1, TV+Build-Depends:       base, DeepArrow, phooey>=1.0, TV tested-with:	     GHC==6.6 Extensions:          CPP Exposed-Modules:     
Makefile view
@@ -1,13 +1,11 @@-# See README for Cabal-based building.  Other fancy stuff (like haddock) here.+# For doc-building.  Otherwise see README. -user = conal+build-args=-v -configure_args=--disable-use-packages --haddock-args="\-  --read-interface=http://haskell.org/ghc/docs/latest/html/libraries/base,c:/ghc/ghc-6.6/doc/html/libraries/base/base.haddock \-  --read-interface=http://darcs.haskell.org/packages/DeepArrow/doc/html,c:/Haskell/packages/DeepArrow-0.0.1/doc/html/DeepArrow.haddock \-  --read-interface=http://darcs.haskell.org/packages/phooey/doc/html,c:/Haskell/packages/phooey-0.2.1/doc/html/phooey.haddock \-  --read-interface=http://darcs.haskell.org/packages/TV/doc/html,c:/Haskell/packages/TV-0.2/doc/html/TV.haddock \-  $(source_args)\-  $(comments_args)\-  "+haddock-interfaces=\+  http://haskell.org/ghc/docs/latest/html/libraries/base,c:/ghc/ghc-6.6/doc/html/libraries/base/base.haddock \+  http://darcs.haskell.org/packages/DeepArrow/doc/html,c:/Haskell/packages/DeepArrow-0.0.1/doc/html/DeepArrow.haddock \+  http://darcs.haskell.org/packages/phooey/doc/html,c:/Haskell/packages/phooey-1.0/doc/html/phooey.haddock \+  http://darcs.haskell.org/packages/TV/doc/html,c:/Haskell/packages/TV-0.2/doc/html/TV.haddock+ include ../my-cabal-make.inc
src/Examples.hs view
@@ -1,12 +1,12 @@ {-# OPTIONS -fglasgow-exts #-} -module Examples where+---- Some GuiTV examples.  See also the examples in TV.  import Data.List (sort)  import Interface.TV.UI --- To pick up the FunArr instance for OFun.  GHC bug?+-- To pick up the FunArr instance for OFun.  GHC bug. import Interface.TV.OFun()  main = runBoth shopping@@ -52,8 +52,8 @@   applesU, bananasU :: Input UI Int-applesU  = iTitle "apples"  (islider 3 (0,10))-bananasU = iTitle "bananas" (islider 7 (0,10))+applesU  = iTitle "apples"  (islider (0,10) 3)+bananasU = iTitle "bananas" (islider (0,10) 7)  shoppingUO :: Output UI (Int -> Int -> Int) shoppingUO = oTitle "shopping list" $@@ -95,46 +95,3 @@  sortWordsT :: CTV (String -> String) sortWordsT = wordsT ->| sortT ->| unwordsT------- IO examples--testO :: Output KIO (String -> String)-testO = oLambda (fileIn "test.txt") defaultOut---- Apply a function on the lines or on the words of a string.-onLines, onWords :: ([String] -> [String]) -> (String -> String)-onLines = wrapF unlines lines-onWords = wrapF unwords words--perLine,perWord :: (String -> String) -> (String -> String)-perLine f = onLines (map f)-perWord f = onWords (map f)---- io3, ... :: TV KIO (String -> String)--io3 = tv testO (onLines reverse)            -- reverse the lines-io4 = tv testO (onWords reverse)            -- reverse words-io5 = tv testO (perLine (onWords reverse))  -- reverse words on each line--io3' = tv testO (perLine reverse)           -- reverse each line-io4' = tv testO (perWord reverse)           -- reverse each word-io5' = tv testO (perLine (perWord reverse)) -- reverse each word, leaving lines----- Find lines with 0 < length < n-short :: Int -> [String] -> [String]-short n = filter (tween 1 n . length)-  where tween lo hi i = lo <= i && i < hi---- Extract lines from a file before a function and combine lines after.-shortO :: FilePath -> Output KIO ([String] -> [String])-shortO path = oLambda (fmap lines (fileIn path)) (cofmap unlines defaultOut)---- Nearly equivalent, but retains more Output structure:--- shortO path = cofmap (wrapF unlines lines) (oLambda (fileIn path) defaultOut)--shortT :: FilePath -> Int -> TV KIO ([String] -> [String])-shortT path n = tv (shortO path) (sort . short n)---- Example: runTV (shortT "c:/conal/Misc/quotes.tw" 100)
src/Interface/TV/UI.hs view
@@ -19,10 +19,8 @@    , UI, module Interface.TV            -- re-exports   ) where -import Control.Arrow (pure,(>>>))--import Graphics.UI.Phooey hiding (runUI,islider)-import qualified Graphics.UI.Phooey as Ph (islider)+import Graphics.UI.Phooey.Arrow hiding (runUI,islider)+import qualified Graphics.UI.Phooey.Arrow as Ph (islider)  import Interface.TV @@ -44,15 +42,14 @@  instance CommonInsOuts UI where   putString = stringDisplay-  getString = textEntry+  getString = stringEntry ""   -- | Integer-valued slider, given initial value and bounds-islider :: Int-        -> (Int,Int)+islider :: (Int,Int)+        -> Int         -> Input UI Int-islider initial bounds =-  iPrim (pure (const bounds) >>> Ph.islider initial)+islider bounds initial = iPrim (Ph.islider bounds initial)   -- | Type-disambiguating alias for 'runTV'