Questions tagged [yampa]

Questions about Yampa, an FRP library for Haskell.

19 questions
269
votes
1 answer

How fundamentally different are push-pull and arrowized FRP?

I want to study FRP in Haskell, but it's a bit difficult to decide on a library to use. Many seem to be dead attempts, some seem to have been resurrected (such as recent activity on Yampa). From what I read, it seems that there are two "kinds" of…
Guillaume Ponce
  • 2,503
  • 2
  • 12
  • 9
10
votes
1 answer

Simulating a spring/damper system in Yampa

I'm trying to use Yampa for some basic system simulation like I'd do in Simulink. In this case I want to simulate a spring and damper system, introduced by this simulink tutorial. I've written the following signal functions to represent the…
Daniel Buckmaster
  • 7,108
  • 6
  • 39
  • 57
7
votes
3 answers

How to work around the first-order constraint on arrows?

What I mean by first-order constraint First, I'll explain what I mean by first-order constraint on arrows: Due to the way arrows desugar, you cannot use a locally bound name where an arrow command is expected in the arrow do-notation. Here is an…
Jason Dagit
  • 13,684
  • 8
  • 33
  • 56
7
votes
1 answer

Time difference in the reactimate (sense) function in Yampa

I am learning Haskell and Yampa at the moment and have a question about the reactimate function. reactimate :: IO a -- init -> (Bool -> IO (DTime, Maybe a)) -- sense -> (Bool -> b -> IO Bool) -- actuate -> SF a b -- signal…
6
votes
2 answers

Preventing endless loops in Yampa/Animas with SF's depending on each other

I'm trying to understand how this functional reactive programming works, and I have run into a problem. I am trying to create a boid simulation, but I'm starting out slowly, and I have for now defined a boid as a function taking a starting position…
Andreas Vinter-Hviid
  • 1,482
  • 1
  • 11
  • 27
3
votes
1 answer

Getting " parse error on input ‘<-’ " within a Yampa program

I got stuck on coding the main SF for a Mario like game I am writing for fun. Here is the code that does not parse: master_combine = proc pi -> do -- rec cgg <- player_update >>> (initial_game --> bounds_updater) >>>…
3
votes
2 answers

debug output of game objects in Haskell/Yampa and HOOD

I'm stuck with generating debug output for my game objects using Haskell/Yampa (=Arrows) (with HOOD). My engine basically runs a list of game objects which produce Output states (line, circle) which are then rendered. data Output = Circle Position2…
Gerold Meisinger
  • 4,500
  • 5
  • 26
  • 33
3
votes
1 answer

Confused about diagrams of Yampa switches

There is some diagrams of Yampa switches at: http://www.haskell.org/haskellwiki/Yampa/switch http://www.haskell.org/haskellwiki/Yampa/rSwitch http://www.haskell.org/haskellwiki/Yampa/kSwitch (and so on). I've found that the switch, the only one…
snowmantw
  • 1,611
  • 1
  • 13
  • 25
2
votes
0 answers

I had installed Yampa but I failed to imported FRP.Yampa (Mac OS Catalina)

I recently read about FRP and became interested in Yampa. Because I have already installed it, here I just check its installation. When I follow the instructions $ cabal sandbox init # Optional, but recommended $ cabal update $ cabal…
2
votes
2 answers

Continual signal switching in arrowized FRP

I've been playing around with Arrowized FRP libraries in Haskell (Yampa, in particular), but I can't quite figure out how to do "continual" switching. By that I mean that a signal passes through a signal function (sf below) which is itself a signal…
user2141650
  • 2,827
  • 1
  • 15
  • 23
2
votes
1 answer

Yampa Particle Field

I want to have a particle field in Yampa. The single particle should just move in a straight line, but depending on an angle given. That angle and movement speed changes depending on the player's speed and angle. I don't know how better to explain,…
Lanbo
  • 15,118
  • 16
  • 70
  • 147
1
vote
1 answer

Does Yampa have support for memoizing signal functions?

I have written a basic signal function in Yampa as follows: sf :: SF Int Int sf = arr $ \x -> trace "1 * 2 = 2" (x * 2) This function doubles its input and prints "1 * 2 = 2" to the console to indicate that it has been called. I then tested sf with…
12412316
  • 725
  • 7
  • 17
1
vote
1 answer

Is there a way to create a Signal Function out of getLine in Yampa using reactimate

I'm trying to write a simple command line based reflex game which will prompt the user to hit enter after a random amount of time and then output the reaction time. I'm using reactimate based on this example:…
1
vote
1 answer

N-body with Yampa FRP, haskell

I am trying to make an n-body solver (a bunch of objects gravitationally attracted to each-other). The problem is that it looks like the gravity1 function does not feed back the return objects, resulting in linear motion of the objects: The code…
madjestic
  • 59
  • 8
1
vote
1 answer

Define signal function like "integral" in terms of Yampa's public API

I'm trying to get to grips with Yampa, but from the definition of the higher-level signal functions like integral it's not obvious to me how I would define such signal functions myself with Yampa's exported combinators with idiomatic Haskell (I…
Johannes Riecken
  • 2,301
  • 16
  • 17
1
2