Skip to content

Commit

Permalink
Merge branch 'release-0.14.9'. Refs #299.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanperez-keera committed Jun 9, 2024
2 parents 26a0655 + 0e3c255 commit 41ae0e8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
3 changes: 3 additions & 0 deletions yampa-test/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2024-06-08 Ivan Perez <[email protected]>
* Version bump (0.14.9) (#299).

2024-04-07 Ivan Perez <[email protected]>
* Version bump (0.14.8) (#294).
* Move definitions to separate line (#292).
Expand Down
4 changes: 2 additions & 2 deletions yampa-test/yampa-test.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cabal-version: >= 1.10
build-type: Simple

name: yampa-test
version: 0.14.8
version: 0.14.9
author: Ivan Perez
maintainer: [email protected]
homepage: http://github.com/ivanperez-keera/Yampa
Expand Down Expand Up @@ -84,7 +84,7 @@ library
base >= 4 && < 5
, normaldistribution >= 1.1.0.1 && < 1.2
, QuickCheck >= 2.12 && < 2.15
, Yampa >= 0.14.8 && < 0.15
, Yampa >= 0.14.9 && < 0.15

default-language:
Haskell2010
Expand Down
7 changes: 7 additions & 0 deletions yampa/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2024-06-08 Ivan Perez <[email protected]>
* Version bump (0.14.9) (#299).
* Document FRP.Yampa.Random.streamToSF (#296).
* Document FRP.Yampa.Switches.safeZip (#297).
* Simplify FRP.Yampa.Switches.safeZip (#298).
* Fix date in CHANGELOG (#300).

2024-04-07 Ivan Perez <[email protected]>
* Version bump (0.14.8) (#294).

Expand Down
2 changes: 1 addition & 1 deletion yampa/Yampa.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cabal-version: >= 1.10
build-type: Simple

name: Yampa
version: 0.14.8
version: 0.14.9
author: Henrik Nilsson, Antony Courtney
maintainer: Ivan Perez ([email protected])
homepage: https://github.com/ivanperez-keera/Yampa/
Expand Down
2 changes: 2 additions & 0 deletions yampa/src/FRP/Yampa/Random.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ noise g0 = streamToSF (randoms g0)
noiseR :: (RandomGen g, Random b) => (b, b) -> g -> SF a b
noiseR range g0 = streamToSF (randomRs range g0)

-- | Turn an infinite list of elements into an SF producing those elements. The
-- SF ignores its input.
streamToSF :: [b] -> SF a b
streamToSF [] = intErr "Yampa" "streamToSF" "Empty list!"
streamToSF (b:bs) = SF {sfTF = tf0}
Expand Down
22 changes: 8 additions & 14 deletions yampa/src/FRP/Yampa/Switches.hs
Original file line number Diff line number Diff line change
Expand Up @@ -681,23 +681,17 @@ rpSwitchZ = rpSwitch (safeZip "rpSwitchZ")
drpSwitchZ :: [SF a b] -> SF ([a], Event ([SF a b] -> [SF a b])) [b]
drpSwitchZ = drpSwitch (safeZip "drpSwitchZ")

-- | Zip two lists.
--
-- PRE: The first list is not shorter than the second.
safeZip :: String -> [a] -> [b] -> [(a, b)]
safeZip fn l1 l2 = safeZip' l1 l2
safeZip fn = safeZip'
where
safeZip' :: [a] -> [b] -> [(a, b)]
safeZip' _ [] = []
safeZip' as (b:bs) = (head' as, b) : safeZip' (tail' as) bs

head' :: [a] -> a
head' [] = err
head' (a:_) = a

tail' :: [a] -> [a]
tail' [] = err
tail' (_:as) = as

err :: a
err = usrErr "FRP.Yampa.Switches" fn "Input list too short."
safeZip' _ [] = []
safeZip' (a:as) (b:bs) = (a, b) : safeZip' as bs
safeZip' _ _ =
usrErr "FRP.Yampa.Switches" fn "Input list too short."

-- Freezes a "running" signal function, i.e., turns it into a continuation in
-- the form of a plain signal function.
Expand Down

0 comments on commit 41ae0e8

Please sign in to comment.