Yampa 0.9.2.3 → 0.9.3
raw patch · 15 files changed
+42/−157 lines, 15 filesdep ~basedep ~randomsetup-changedPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, random
API changes (from Hackage documentation)
- FRP.Yampa.Internals: instance Show a => Show (Event a)
- FRP.Yampa.Point2: instance RealFloat a => Show (Point2 a)
- FRP.Yampa.Vector2: instance RealFloat a => Show (Vector2 a)
- FRP.Yampa.Vector3: instance RealFloat a => Show (Vector3 a)
- FRP.Yampa.VectorSpace: instance Floating a => VectorSpace (a, a) a
- FRP.Yampa.VectorSpace: instance Floating a => VectorSpace (a, a, a) a
- FRP.Yampa.VectorSpace: instance Floating a => VectorSpace (a, a, a, a) a
- FRP.Yampa.VectorSpace: instance Floating a => VectorSpace (a, a, a, a, a) a
+ FRP.Yampa.Event: instance Show a => Show (Event a)
+ FRP.Yampa.Point2: instance (RealFloat a, Show a) => Show (Point2 a)
+ FRP.Yampa.Vector2: instance (RealFloat a, Show a) => Show (Vector2 a)
+ FRP.Yampa.Vector3: instance (RealFloat a, Show a) => Show (Vector3 a)
+ FRP.Yampa.VectorSpace: instance (Eq a, Floating a) => VectorSpace (a, a) a
+ FRP.Yampa.VectorSpace: instance (Eq a, Floating a) => VectorSpace (a, a, a) a
+ FRP.Yampa.VectorSpace: instance (Eq a, Floating a) => VectorSpace (a, a, a, a) a
+ FRP.Yampa.VectorSpace: instance (Eq a, Floating a) => VectorSpace (a, a, a, a, a) a
- FRP.Yampa.AffineSpace: class (Floating a, VectorSpace v a) => AffineSpace p v a | p -> v, v -> a
+ FRP.Yampa.AffineSpace: class (Floating a, VectorSpace v a) => AffineSpace p v a | p -> v, v -> a where p .-^ v = p .+^ (negateVector v) distance p1 p2 = norm (p1 .-. p2)
- FRP.Yampa.VectorSpace: class Floating a => VectorSpace v a | v -> a
+ FRP.Yampa.VectorSpace: class (Eq a, Floating a) => VectorSpace v a | v -> a where v ^/ a = (1 / a) *^ v negateVector v = (- 1) *^ v v1 ^-^ v2 = v1 ^+^ negateVector v2 norm v = sqrt (v `dot` v) normalize v = if nv /= 0 then v ^/ nv else error "normalize: zero vector" where nv = norm v
Files
- README-1ST.txt +0/−23
- Setup.hs +2/−0
- Setup.lhs +0/−3
- Yampa.cabal +17/−14
- examples/Elevator/Elevator.hs +2/−0
- examples/Setup.lhs +0/−3
- examples/TailgatingDetector/TailgatingDetector.hs +2/−0
- examples/TailgatingDetector/TestTGMain.hs +9/−8
- examples/examples.cabal +0/−26
- src/FRP/Yampa.hs +3/−7
- src/FRP/Yampa/Event.hs +1/−4
- src/FRP/Yampa/Internals.hs +1/−13
- src/FRP/Yampa/VectorSpace.hs +5/−8
- tests/Setup.lhs +0/−3
- tests/testAFRP.cabal +0/−45
− README-1ST.txt
@@ -1,23 +0,0 @@-This is an "inofficial release" of the version of Yampa that uses GADT-enabled-dynamic optimization as described in the ICFP'05 paper "Dynamic Optimization-for Functional Reactive Programming using Generalized Algebraic Data Types".--The code is being made available only because a number of people have asked-for it. It is not supposed to be useful in any way as it stands. If it happens-to be useful to you, great, it's your lucky day!--The code is very messy at least at two levels:-- * Work in progress: lots of code fragments from trying out various- approaches around; the code for the most successful approaches never got- tidied up; the GADT optimizations have not been implemented throughout;- lots of notes and comments around, some of which may still be relevant,- others which are not, and others which only ever were of interest to me;- etc.-- * The fundamental approach taken does not really scale that well- as one gets a (small) combinatorial explosion of cases to- consider for optimization. Thus there is way more code here than- one would hope, some of it quite repetitive.--Use at your own risk! ;-)
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
− Setup.lhs
@@ -1,3 +0,0 @@-#!/usr/bin/env runhaskell-> import Distribution.Simple-> main = defaultMain
Yampa.cabal view
@@ -1,20 +1,21 @@ name: Yampa-version: 0.9.2.3-cabal-Version: >= 1.2+version: 0.9.3+cabal-version: >= 1.6 license: BSD3 license-file: LICENSE author: Henrik Nilsson, Antony Courtney-maintainer: George Giorgidze (GGG at CS dot NOTT dot AC dot UK)-homepage: http://www.haskell.org/yampa/+maintainer: George Giorgidze (giorgidze@gmail.com)+homepage: http://www.haskell.org/haskellwiki/Yampa category: Reactivity, FRP synopsis: Library for programming hybrid systems.-description: Domain-specific language embedded in Haskell for programming hybrid (mixed discrete-time and continuous-time) systems.- Yampa is based on the concepts of Functional Reactive Programming (FRP) and is structured using arrow combinators.-build-type: Simple-Tested-With: GHC-Extra-Source-Files:- README-1ST.txt +description: Domain-specific language embedded in Haskell for programming+ hybrid (mixed discrete-time and continuous-time) systems. Yampa is based on+ the concepts of Functional Reactive Programming (FRP) and is structured using+ arrow combinators.++build-type: Simple+extra-source-files: tests/AFRPTests.hs, tests/AFRPTestsCommon.hs, tests/AFRPTestsArr.hs, tests/AFRPTestsComp.hs, tests/AFRPTestsFirstSecond.hs, tests/AFRPTestsLaws.hs, tests/AFRPTestsLoop.hs, tests/AFRPTestsLoopLaws.hs, tests/AFRPTestsBasicSF.hs,@@ -25,9 +26,7 @@ tests/AFRPTestsDer.hs, tests/AFRPTestsLoopPre.hs, tests/AFRPTestsLoopIntegral.hs, tests/AFRPTestsReact.hs, tests/AFRPTestsEmbed.hs, tests/AFRPTestsUtils.hs, tests/AFRPTestsTask.hs, tests/testAFRPMain.hs,- tests/Setup.lhs, tests/testAFRP.cabal, - examples/Setup.lhs, examples/examples.cabal, examples/Elevator/Elevator.hs, examples/Elevator/TestElevatorMain.hs, examples/TailgatingDetector/TailgatingDetector.hs,@@ -35,8 +34,8 @@ library hs-source-dirs: src- ghc-options : -O2 -Wall -fno-warn-name-shadowing- build-Depends: base, random+ ghc-options : -O3 -Wall -fno-warn-name-shadowing+ build-Depends: base < 5, random exposed-modules: FRP.Yampa FRP.Yampa.AffineSpace@@ -55,3 +54,7 @@ FRP.Yampa.Internals other-modules: FRP.Yampa.Diagnostics++source-repository head+ type: git+ location: git://github.com/giorgidze/Yampa.git
examples/Elevator/Elevator.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Arrows #-}+ {- ****************************************************************************** * A F R P *
− examples/Setup.lhs
@@ -1,3 +0,0 @@-#!/usr/bin/env runhaskell-> import Distribution.Simple-> main = defaultMain
examples/TailgatingDetector/TailgatingDetector.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Arrows #-}+ {- ****************************************************************************** * A F R P *
examples/TailgatingDetector/TestTGMain.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE Arrows #-}+ {- ****************************************************************************** * A F R P *@@ -86,14 +88,13 @@ testMTGD t_max = filter (isEvent . fst . snd) $ takeWhile (\(t, _) -> t <= t_max) $ embed (localTime- &&& (proc _ -> do- s <- uavStatus -< ()- h <- highway -< ()- (v, ect) <- mkVideoAndTrackers -< (h, s)- (ics, etgs) <- findTailgaters -< (v,s,ect) - etgs <- mtgd -< ics- returnA -< (etgs, ics)))- (deltaEncode smplPer (repeat ()))+ &&& (proc _ -> do s <- uavStatus -< ()+ h <- highway -< ()+ (v, ect) <- mkVideoAndTrackers -< (h, s)+ (ics, etgs) <- findTailgaters -< (v,s,ect) + etgs <- mtgd -< ics+ returnA -< (etgs, ics)))+ (deltaEncode smplPer (repeat ())) ppTestMTGD t = mapM_ (putStrLn . show) (testMTGD t)
− examples/examples.cabal
@@ -1,26 +0,0 @@-Name: examples-Version: 0.0-Description: Yampa examples-License: BSD3-License-File: ../LICENSE.txt-Copyright: Henrik Nilsson, Antony Courtney and Yale University, (c) 2003-Author: Antony Courtney, Paul Hudak, Henrik Nilsson, John Peterson-Maintainer: George Giorgidze (GGG at CS dot NOTT dot AC dot UK)-Stability: provisional-Homepage: http://www.haskell.org/yampa/-Category: Reactivity, FRP-Synopsis: Yampa examples-Build-Depends: base, haskell98, Yampa >= 0.9.2--Executable: Elevator-Main-is: testElevatorMain.hs-ghc-options: -O -fglasgow-exts -farrows-Hs-Source-Dirs: Elevator-Other-modules: Elevator--Executable: TailgatingDetector-Main-is: TestTGMain.hs-ghc-options: -O -fglasgow-exts -farrows-Hs-Source-Dirs: TailgatingDetector-Other-modules: TailgatingDetector-
src/FRP/Yampa.hs view
@@ -3169,9 +3169,8 @@ let (sf,b0) = tf0 a0 -- TODO: really need to fix this interface, since right now we -- just ignore termination at time 0:- r <- newIORef (ReactState {rsActuate = actuate, rsSF = sf,- rsA = a0, rsB = b0 })- done <- actuate r True b0+ r <- newIORef (ReactState {rsActuate = actuate, rsSF = sf, rsA = a0, rsB = b0 })+ _ <- actuate r True b0 return r -- process a single input sample:@@ -3179,10 +3178,7 @@ -> (DTime,Maybe a) -> IO Bool react rh (dt,ma') = - do rs@(ReactState {rsActuate = actuate,- rsSF = sf,- rsA = a,- rsB = b }) <- readIORef rh+ do rs@(ReactState {rsActuate = actuate, rsSF = sf, rsA = a, rsB = _b }) <- readIORef rh let a' = maybe a id ma' (sf',b') = (sfTF' sf) dt a' writeIORef rh (rs {rsSF = sf',rsA = a',rsB = b'})
src/FRP/Yampa/Event.hs view
@@ -94,10 +94,7 @@ -- Also note that it unfortunately is possible to partially break the -- abstractions through judicious use of e.g. snap and switching. -data Event a = NoEvent- | Event a--- deriving Show-+data Event a = NoEvent | Event a deriving (Show) -- Make the NoEvent constructor available. Useful e.g. for initialization, -- ((-->) & friends), and it's easily available anyway (e.g. mergeEvents []).
src/FRP/Yampa/Internals.hs view
@@ -19,19 +19,7 @@ ----------------------------------------------------------------------------------------- module FRP.Yampa.Internals (- Event(..) -- The event type, its constructors, and instances.+ Event(..) ) where import FRP.Yampa.Event------------------------------------------------------------------------------------ Extra Event instances---------------------------------------------------------------------------------instance Show a => Show (Event a) where- showsPrec d NoEvent = showString "NoEvent"- showsPrec d (Event a) = showParen (d >= 10)- (showString "Event " . showsPrec 10 a)--
src/FRP/Yampa/VectorSpace.hs view
@@ -29,7 +29,7 @@ -- be Fractional (roughly a Field) rather than Floating. -- Minimal instance: zeroVector, (*^), (^+^), dot-class Floating a => VectorSpace v a | v -> a where+class (Eq a, Floating a) => VectorSpace v a | v -> a where zeroVector :: v (*^) :: a -> v -> v (^/) :: v -> a -> v@@ -92,7 +92,7 @@ -- Vector space instances for small tuples of Floating ------------------------------------------------------------------------------ -instance Floating a => VectorSpace (a,a) a where+instance (Eq a, Floating a) => VectorSpace (a,a) a where zeroVector = (0,0) a *^ (x,y) = (a * x, a * y)@@ -108,7 +108,7 @@ (x1,y1) `dot` (x2,y2) = x1 * x2 + y1 * y2 -instance Floating a => VectorSpace (a,a,a) a where+instance (Eq a, Floating a) => VectorSpace (a,a,a) a where zeroVector = (0,0,0) a *^ (x,y,z) = (a * x, a * y, a * z)@@ -124,7 +124,7 @@ (x1,y1,z1) `dot` (x2,y2,z2) = x1 * x2 + y1 * y2 + z1 * z2 -instance Floating a => VectorSpace (a,a,a,a) a where+instance (Eq a, Floating a) => VectorSpace (a,a,a,a) a where zeroVector = (0,0,0,0) a *^ (x,y,z,u) = (a * x, a * y, a * z, a * u)@@ -140,7 +140,7 @@ (x1,y1,z1,u1) `dot` (x2,y2,z2,u2) = x1 * x2 + y1 * y2 + z1 * z2 + u1 * u2 -instance Floating a => VectorSpace (a,a,a,a,a) a where+instance (Eq a, Floating a) => VectorSpace (a,a,a,a,a) a where zeroVector = (0,0,0,0,0) a *^ (x,y,z,u,v) = (a * x, a * y, a * z, a * u, a * v)@@ -155,6 +155,3 @@ (x1,y1,z1,u1,v1) `dot` (x2,y2,z2,u2,v2) = x1 * x2 + y1 * y2 + z1 * z2 + u1 * u2 + v1 * v2---
− tests/Setup.lhs
@@ -1,3 +0,0 @@-#!/usr/bin/env runhaskell-> import Distribution.Simple-> main = defaultMain
− tests/testAFRP.cabal
@@ -1,45 +0,0 @@-Name: testAFRP-Version: 0.0-Description: Tests for Yampa functions.-License: BSD3-License-File: ../LICENSE-Copyright: Henrik Nilsson, Antony Courtney and Yale University, (c) 2003-Author: Antony Courtney, Paul Hudak, Henrik Nilsson, John Peterson-Maintainer: Antony Courtney <antony@apocalypse.org>, Paul Hudak <paul.hudak@yale.edu>, Henrik Nilsson <nilsson@cs.yale.edu>, John Peterson <peterson-john@cs.yale.edu>-Stability: provisional-Homepage: http://www.haskell.org/yampa/-Category: Reactivity, FRP-Synopsis: Tests for Yampa functions.-Build-Depends: base, Yampa >= 0.9.2--Executable: testAFRP-Main-is: testAFRPMain.hs-ghc-options: -O2 -fglasgow-exts -Other-modules: AFRPTests,- AFRPTestsCommon,- AFRPTestsArr,- AFRPTestsComp,- AFRPTestsFirstSecond,- AFRPTestsLaws,- AFRPTestsLoop,- AFRPTestsLoopLaws,- AFRPTestsBasicSF,- AFRPTestsSscan,- AFRPTestsEvSrc,- AFRPTestsCOC,- AFRPTestsSwitch,- AFRPTestsKSwitch,- AFRPTestsRSwitch,- AFRPTestsPSwitch,- AFRPTestsRPSwitch,- AFRPTestsWFG,- AFRPTestsAccum,- AFRPTestsPre,- AFRPTestsDelay,- AFRPTestsDer,- AFRPTestsLoopPre,- AFRPTestsLoopIntegral,- AFRPTestsReact,- AFRPTestsEmbed,- AFRPTestsUtils,- AFRPTestsTask