packages feed

TV 0.1.1 → 0.2

raw patch · 13 files changed

+87/−174 lines, 13 filesdep −phooey

Dependencies removed: phooey

Files

CHANGES view
@@ -1,3 +1,10 @@+Version 0.2:+* Simplified exports in src/Interface/TV.hs.  Now just exports by module+  rather than by entity.  Also re-export DeepArrow modules.+* Moved GUI functionality out to a new package "GuiTV".  Removed+  dependency on Phooey and (indirectly) wxHaskell, as the latter can be+  difficult to install.+ Version 0.1.1: * Changed all files to *nix-style line endings. 
Makefile view
@@ -1,12 +1,10 @@ # See README for Cabal-based building.  Other fancy stuff (like haddock) here.  user = conal-package = TV  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://haskell.org/ghc/docs/latest/html/libraries/mtl,c:/ghc/ghc-6.6/doc/html/libraries/mtl/mtl.haddock \-  --read-interface=http://darcs.haskell.org/packages/phooey/doc/html,c:/Haskell/packages/phooey-0.1/doc/html/phooey.haddock \   --read-interface=http://darcs.haskell.org/packages/DeepArrow/doc/html,c:/Haskell/packages/DeepArrow-0.0/doc/html/DeepArrow.haddock \   $(source_args)\   $(comments_args)\
README view
@@ -1,23 +1,15 @@-TV is a library for visualizing functional values.  It can also be viewed-as an approach to functional user interfaces.  It is implemented very-simply on top of Phooey (http://conal.net/phooey).  The name "TV" comes-"tangible values", which is the central idea of the library.--TV is an intermediate stage between Phooey and Eros-(http://conal.net/papers/Eros).+TV is a library for interfacing to functional values.  It can also be+viewed as an approach to functional interfaces.  The name "TV" comes+"tangible values", which is the central idea of the library.  For a fuller+description and link to documentation, please see the project wiki page: -See tv.cabal for more info, including home page and license.+  http://haskell.org/haskellwiki/TV -You can configure, build, generate haddock docs, and install all in the usual-way with Cabal commands.+You can configure, build, generate haddock docs, and install all in the+usual way with Cabal commands.    runhaskell Setup.lhs configure   runhaskell Setup.lhs build   runhaskell Setup.lhs install -You can find the Haddock-generated documentation at --  http://darcs.haskell.org/packages/TV/doc/html--Or you can generate them locally with "make colourPrep hscolour haddock".-There are a few other tricky bits in the Makefile you probably won't need.+See src/Examples.hs for examples.
TV.cabal view
@@ -1,5 +1,5 @@ Name:                TV-Version:             0.1.1+Version:             0.2 Synopsis:	     Tangible Values -- composable interfaces Category:            Interfaces Description:@@ -7,10 +7,6 @@   that carry along external interfaces.  Values and interfaces are   /combined and separable/, which makes TVs ready to use and to reuse.   .-  If you just want to /use/ TV, see the main module below-  ("Interface.TV").  The other modules (@UI.Graphics.TV.*@) are useful-  for understanding the implementation and adding new features.-  .   Try out the examples in @src\/Examples.hs@.   .   For more information, including examples, please see the project wiki@@ -29,7 +25,7 @@ License:             BSD3 Stability:	     experimental Hs-Source-Dirs:      src-Build-Depends:       base, mtl, phooey>=0.1, DeepArrow+Build-Depends:       base, mtl, DeepArrow tested-with:	     GHC==6.6 Extensions:          CPP Exposed-Modules:     @@ -41,7 +37,6 @@                      Interface.TV.OFun                      Interface.TV.Common                      Interface.TV.Defaults-                     Interface.TV.UI                      Interface.TV.Kleisli                      Interface.TV.IO                      Interface.TV.Misc
src/Examples.hs view
@@ -4,22 +4,12 @@  import Data.List (sort) -import Control.Arrow.DeepArrow-import Data.FunArr+-- import Control.Arrow.DeepArrow+-- import Data.FunArr import Interface.TV -main = runBoth shopping----- Run both UI and IO flavors-runBoth :: CTV a -> IO ()-runBoth tv = runUI tv >> runIO tv--tv0 :: CTV String-tv0 = tv (oTitle "message" stringOut) "Hello World!"--tv1 :: CTV Int-tv1 = tv (oTitle "answer" showOut) (42 :: Int)+-- Try out these the examples with runIO.  For the explicitly IO-typed examples, you+-- can use runIO or runTV.  reverseT :: DefaultOut ([a] -> [a]) => CTV ([a] -> [a]) reverseT = tv (oTitle "reverse" defaultOut) reverse@@ -27,75 +17,6 @@ --  This one reverses twice revTwice :: CTV (String -> String) revTwice = reverseT ->| reverseT--apples, bananas :: CInput Int-apples  = iTitle "apples"  defaultIn-bananas = iTitle "bananas" defaultIn--total :: Show a => COutput a-total = oTitle "total" showOut--shoppingO :: COutput (Int -> Int -> Int)-shoppingO = oTitle "shopping list" $-            oLambda apples (oLambda bananas total)--shopping :: CTV (Int -> Int -> Int)-shopping = tv shoppingO (+)--shoppingPr :: CTV ((Int,Int) -> Int)-shoppingPr = tv ( oTitle "shopping list -- curried" $ -                  oLambda (iPair apples bananas) total )-                (uncurry (+))--shoppingPr' :: CTV ((Int,Int) -> Int)-shoppingPr' = uncurryA $$ shopping---applesU, bananasU :: Input UI Int-applesU  = iTitle "apples"  (islider 3 (0,10))-bananasU = iTitle "bananas" (islider 7 (0,10))--shoppingUO :: Output UI (Int -> Int -> Int)-shoppingUO = oTitle "shopping list" $-             oLambda applesU (oLambda bananasU total)--shoppingU :: TV UI (Int -> Int -> Int)-shoppingU = tv shoppingUO (+)--shoppingPrU :: TV UI ((Int,Int) -> Int)-shoppingPrU = uncurryA $$ shoppingU----- This one is polymorphic in value, so say something like--- "runBoth (sortT :: CTV ([String] -> [String]))".  If you leave out the type--- annotation, a will default to Int.-sortT :: (Read a, Show a, Ord a) => CTV ([a] -> [a])-sortT = tv (oTitle "sort" $ interactLineRS []) sort------- Composition.---- Idea: unwords, sort, words--instance DefaultOut [String] where defaultOut = showOut-instance DefaultIn  [String] where defaultIn  = readIn []---wordsT :: CTV (String -> [String]) -wordsT = tv ( oTitle "function: words" $-              oLambda (iTitle "sentence in" defaultIn)-                      (oTitle "words out"   defaultOut))-            words--unwordsT :: CTV ([String] -> String) -unwordsT = tv ( oTitle "function: unwords" $-                oLambda (iTitle "words in"     defaultIn)-                        (oTitle "sentence out" defaultOut))-              unwords--sortWordsT :: CTV (String -> String)-sortWordsT = wordsT ->| sortT ->| unwordsT-  ---- IO examples 
src/Grading.lhs view
@@ -12,8 +12,7 @@ import Data.Map (Map,empty,keys,insertWith,findWithDefault) import Text.Printf -import Control.Arrow.DeepArrow-import Interface.TV -- 0.1+import Interface.TV -- 0.1 or later \end{code} ===  
src/Interface/TV.hs view
@@ -1,51 +1,59 @@ {-# OPTIONS -fglasgow-exts #-} -{- |-   Module      :  Interface.TV-   Copyright   :  (c) Conal Elliott 2006-   License     :  LGPL--   Maintainer  :  conal@conal.net-   Stability   :  experimental-   Portability :  portable---}+----------------------------------------------------------------------+-- |+-- Module      :  Interface.TV+-- Copyright   :  (c) Conal Elliott 2006+-- License     :  LGPL+-- +-- Maintainer  :  conal@conal.net+-- Stability   :  experimental+-- Portability :  portable+-- +-- Package up the various TV modules into one.  Also re-exports+-- DeepArrow modules.+----------------------------------------------------------------------  module Interface.TV   (-  -- * Tangible values-   TV, CTV, tv, unTv, runTV-  -- * 'Input'-  , Input{-, iEmpty-}, iPrim, iPair, iTitle-  -- * 'Output'-  , Output{-, oEmpty-}, oPrim, oLambda, oPair, oCompose, oTitle-  -- * 'Output' transformers-  , OX, OFun, wrapO, wrapAO-  -- * Common ins & outs-  , Common, CInput, COutput-  , stringIn, readIn{-, intIn-}, stringOut, showOut, interactLine-  , readShow, interactLineRS-  -- * Default ins & outs-  , DefaultIn(..), DefaultOut(..)-  -- * Kleisli arrows-  , kIn, kOut-  -- ** IO-based-  , KIO, contentsIn, fileIn, interactOut, fileOut, fromFile, toFile, runIO-  -- * UI-  , UI, islider, runUI-  -- * Misc-  , wrapF, Cofunctor(..)+  -- | Inputs -- means of obtaining values+    module Interface.TV.Input+  -- | Outputs (interfaces) -- means of presenting values.+  , module Interface.TV.Output+  -- | Tangible values -- interface (output) and value, combined & separable+  , module Interface.TV.Tangible+  -- | Convert inputs and outputs to arrow values+  , module Interface.TV.Present+  -- | Output transformations, as a deep arrow.+  , module Interface.TV.OFun+  -- | Some common interaction vocabulary +  , module Interface.TV.Common+  -- | Default inputs & outputs+  , module Interface.TV.Defaults+  -- | Monadic TVs, via Kleisli arrows+  , module Interface.TV.Kleisli+  -- | IO-based instances of TV classes+  , module Interface.TV.IO+  -- | Miscellaneous helpers+  , module Interface.TV.Misc+  -- | Re-exports from DeepArrow+  , module Control.Arrow.DeepArrow+  , module Data.FunArr+   ) where -import Graphics.UI.Phooey (UI)+-- import Graphics.UI.Phooey (UI)  import Interface.TV.Input import Interface.TV.Output+import Interface.TV.Tangible+import Interface.TV.Present import Interface.TV.OFun import Interface.TV.Common import Interface.TV.Defaults-import Interface.TV.UI import Interface.TV.Kleisli import Interface.TV.IO import Interface.TV.Misc-import Interface.TV.Tangible++import Control.Arrow.DeepArrow+import Data.FunArr
src/Interface/TV/IO.hs view
@@ -115,7 +115,6 @@     Disambiguator ----------------------------------------------------------} --- | Many TVs work for all 'CommonInsOuts' arrows.  Applying 'runTV' is--- then ambiguous.  This type specialization disambiguates.+-- | Type-disambiguating alias for 'runTV' runIO :: RunTV KIO runIO = runTV
src/Interface/TV/Input.hs view
@@ -10,8 +10,7 @@ -- Stability   :  experimental -- Portability :  portable -- --- This module defines an 'Input' type constructor, for obtaining typed--- values from a user.+-- Inputs -- means of obtaining values ----------------------------------------------------------------------  module Interface.TV.Input
src/Interface/TV/Misc.hs view
@@ -10,10 +10,13 @@ -- Stability   :  experimental -- Portability :  portable -- --- Misc helpers+-- Miscellaneous helpers ---------------------------------------------------------------------- -module Interface.TV.Misc where+module Interface.TV.Misc+  (+   readD, Cofunctor(..), ToIO(..), wrapF+  ) where  import Control.Arrow (Arrow) @@ -37,12 +40,3 @@ -- string function into value function. wrapF :: (c->d) -> (a->b) -> ((b->c) -> (a->d)) wrapF after before f = after . f . before----- Just a haddock test.  I added this infix support.---- foodle :: Arrow (~>) => a~>b -> b~>c -> a~>c--- foodle = undefined---- doodle :: Arrow arr => a `arr` b--- doodle = undefined
src/Interface/TV/OFun.hs view
@@ -10,7 +10,7 @@ -- Stability   :  experimental -- Portability :  portable -- --- 'Output' transformations, as a "deep arrow".+-- 'Output' transformations, as a deep arrow. ----------------------------------------------------------------------  module Interface.TV.OFun (OX,OFun,wrapO,wrapAO) where
src/Interface/TV/Output.hs view
@@ -10,8 +10,7 @@ -- Stability   :  experimental -- Portability :  portable -- --- This module defines an 'Output' type constructor, for presenting--- typed values to a user.+-- Outputs (interfaces) -- means of presenting values ----------------------------------------------------------------------  module Interface.TV.Output
src/Interface/TV/Tangible.hs view
@@ -1,15 +1,17 @@ {-# OPTIONS -fglasgow-exts #-} -{- |-   Module      :  Interface.TV.Tangible-   Copyright   :  (c) Conal Elliott 2006-   License     :  LGPL--   Maintainer  :  conal@conal.net-   Stability   :  experimental-   Portability :  portable---}+----------------------------------------------------------------------+-- |+-- Module      :  Interface.TV.Tangible+-- Copyright   :  (c) Conal Elliott 2006+-- License     :  LGPL+-- +-- Maintainer  :  conal@conal.net+-- Stability   :  experimental+-- Portability :  portable+-- +-- Tangible values -- interface (output) and value, combined & separable+----------------------------------------------------------------------  module Interface.TV.Tangible   (@@ -49,7 +51,7 @@ unTv :: TV (~>) a -> (Output (~>) a, a) unTv (Pair1 (o, ida)) = (o, runIdentity ida) --- | To define disambiguating type-specializations+-- | Useful to define disambiguating type-specializations of 'runTV' type RunTV (~>) = forall a. TV (~>) a -> IO ()  -- | Run a 'TV'