wxFruit 0.1.1 → 0.1.2
raw patch · 4 files changed
+85/−72 lines, 4 filesdep ~Yampanew-uploader
Dependency ranges changed: Yampa
Files
- LICENSE +27/−27
- WXFruit.hs +19/−8
- paddle.hs +7/−5
- wxFruit.cabal +32/−32
LICENSE view
@@ -1,27 +1,27 @@-Copyright (c) 2004, Antony Courtney, Bart Robinson, Paul Hudak --All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.- * Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.- * Neither the name of the Maybench developers nor the names of its- contributors may be used to endorse or promote products derived from this- software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+Copyright (c) 2004, Antony Courtney, Bart Robinson, Paul Hudak + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the wxFruit developers nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
WXFruit.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Arrows #-} + ----------------------------------------------------------- -- WXFruit: an implementation of Fruit using wxHaskell. -- Version 0.1, May 2004 @@ -11,14 +13,17 @@ import qualified Graphics.UI.WX as WX import qualified Graphics.UI.WXCore as WXCore -import AFRP -import AFRPUtilities +import FRP.Yampa +import FRP.Yampa.Utilities import Control.Arrow import Data.IORef import System.Time - +import Control.Category +import Prelude hiding (id, (.)) +import qualified Prelude (id, (.)) + ----------------------------------------------------------- -- Data types for communication between widgets and the -- system. (These are likely to change dramatically.) @@ -33,7 +38,7 @@ -- widgets would have to add their own alternatives to -- these sums. A way to do more dynamic run-time typing -- could help with this problem. -data WXWidgetResp = WXWInit -- currently not used +data WXWidgetResp = WXWInit | WXWButtonCreateResp (WX.Button ()) | WXWTextCreateResp (WX.StaticText ()) | WXWPictureCreateResp (WX.Panel ()) @@ -118,10 +123,13 @@ returnA -< (req,(c,d)) instance Arrow WXGUI where - arr = wxArr - (>>>) = wxComp + arr = wxArr first = wxFirst +instance Category WXGUI where + (.) = flip wxComp + id = arr Prelude.id + wxLoop :: WXGUI (b,d) (c,d) -> WXGUI b c wxLoop (WXGUI w) = WXGUI $ proc (inp,resp,b) -> do rec (req,(c,d)) <- w -< (inp,resp,(b,d)) @@ -150,9 +158,12 @@ wxFirstBox (WXBox bf) = WXBox $ \orient -> first (bf orient) instance Arrow WXBox where - arr = wxBox . arr - (>>>) = wxCompBox + arr = wxBox . arr first = wxFirstBox + +instance Category WXBox where + (.) = flip wxCompBox + id = arr Prelude.id wxLoopBox :: WXBox (b,d) (c,d) -> WXBox b c wxLoopBox (WXBox bf) = WXBox $ \orient -> loop (bf orient)
paddle.hs view
@@ -5,12 +5,13 @@ -- and a restart button. ----------------------------------------------------------- +{-# LANGUAGE Arrows #-} + module Main where import WXFruit -import AFRP -import AFRPUtilities -import Control.Arrow +import FRP.Yampa hiding (left, right, next) +import Control.Arrow hiding (left, right) import qualified Graphics.UI.WX as WX -- Elements of the game. @@ -19,14 +20,15 @@ bg = wxWithColor WX.white wxfill walls :: WXPicture -walls = let upper = wxPicFill (wxrect (WX.rect (WX.point 10 10) (WX.sz 200 10))) - left = wxPicFill (wxrect (WX.rect (WX.point 10 10) (WX.sz 10 200))) +walls = let upper = wxPicFill (wxrect (WX.rect (WX.point 10 10) (WX.sz 200 10))) + left = wxPicFill (wxrect (WX.rect (WX.point 10 10) (WX.sz 10 200))) right = wxPicFill (wxrect (WX.rect (WX.point 200 10) (WX.sz 10 200))) in wxWithColor WX.red (upper `wxPicOver` left `wxPicOver` right) paddle :: Int -> WX.Rect paddle xpos = WX.rect (WX.Point (xpos - 25) 200) (WX.sz 50 10) +gameBox :: (Num t) => WX.Size2D t gameBox = WX.sz 215 215 -- The game screen: takes signals for the velocity of the
wxFruit.cabal view
@@ -1,32 +1,32 @@-name: wxFruit-version: 0.1.1-Cabal-Version: >= 1.2-License: BSD3-License-file: LICENSE-Author: Antony Courtney, Bart Robinson, Paul Hudak-homepage: http://zoo.cs.yale.edu/classes/cs490/03-04b/bartholomew.robinson/-category: Reactivity, FRP, GUI-synopsis: An implementation of Fruit using wxHaskell.-description:- This is an original version of wxFruit.- .- wxFruit isn't maintained by original authors, and Haskell.org. So, there is a few forked version of wxFruit now. One extension is shelarcy's YaPan ( http://sourceforge.net/project/showfiles.php?group_id=168626&package_id=199138 ). It added Menu and OpenGL support. And another one is Remi Turk's Juicy Fruit ( http://www.cs.uu.nl/wiki/pub/Afp0607/DomainSpecificLanguages/fruit.pdf ). So, I uploaded this original version first.--build-type: Simple-Flag splitBase- Description: Choose the new smaller, split-up base package.-Library- if flag(splitBase)- build-depends: base >= 3, old-time, wx, wxcore, Yampa >= 0.9.1 && < 0.9.2- else- build-depends: base < 3, wx, wxcore, Yampa >= 0.9.1 && < 0.9.2- Exposed-modules: WXFruit- Extensions: Arrows--Executable paddle- if flag(splitBase)- build-depends: base, wx, wxcore, Yampa >= 0.9.1 && < 0.9.2- else- build-depends: base, wx, wxcore, Yampa >= 0.9.1 && < 0.9.2- Main-is: paddle.hs- Extensions: Arrows+name: wxFruit +version: 0.1.2 +Cabal-Version: >= 1.2 +License: BSD3 +License-file: LICENSE +Author: Antony Courtney, Bart Robinson, Paul Hudak +homepage: http://www.haskell.org/haskellwiki/WxFruit +category: Reactivity, FRP, GUI +synopsis: An implementation of Fruit using wxHaskell. +description: + This is an updated version of the original wxFruit. + . + wxFruit isn't maintained by original authors, and Haskell.org. There are a few forked versions of wxFruit now. One extension is shelarcy's YaPan ( http://sourceforge.net/project/showfiles.php?group_id=168626&package_id=199138 ). It added Menu and OpenGL support. And another one is Remi Turk's Juicy Fruit ( http://www.cs.uu.nl/wiki/pub/Afp0607/DomainSpecificLanguages/fruit.pdf ). + +build-type: Simple +Flag splitBase + Description: Choose the new smaller, split-up base package. +Library + if flag(splitBase) + build-depends: base >= 3, old-time, wx, wxcore, Yampa >= 0.9.2 + else + build-depends: base < 3, wx, wxcore, Yampa >= 0.9.2 + Exposed-modules: WXFruit + Extensions: Arrows + +Executable paddle + if flag(splitBase) + build-depends: base, wx, wxcore, Yampa >= 0.9.2 + else + build-depends: base, wx, wxcore, Yampa >= 0.9.2 + Main-is: paddle.hs + Extensions: Arrows