All Projects → ivanperez-keera → Yampa

ivanperez-keera / Yampa

Licence: bsd-3-clause
Functional Reactive Programming domain-specific language embedded in Haskell, for programming efficient hybrid (mixed discrete-time and continuous-time) systems.

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Yampa

Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+1168.03%)
Mutual labels:  game, opengl, sdl
Glportal
🎮 Open Source teleportation based first person puzzle-platformer
Stars: ✭ 297 (+1.02%)
Mutual labels:  game, opengl, sdl
Open Source Xamarin Apps
📱 Collaborative List of Open Source Xamarin Apps
Stars: ✭ 318 (+8.16%)
Mutual labels:  iphone, ipad, mobile
Hs Quake 3
Quake 3 map viewer written in Haskell
Stars: ✭ 33 (-88.78%)
Mutual labels:  frp, game, opengl
Frag.exe
Multiplayer First-Person Shooter written in C++ using my own engine, Qor
Stars: ✭ 8 (-97.28%)
Mutual labels:  game, opengl, sdl
Taisei
A free and open-source Touhou Project fangame
Stars: ✭ 428 (+45.58%)
Mutual labels:  game, opengl, sdl
Gmimagepicker.xamarin
Port of the original GMImagePicker component to Xamarin.iOS
Stars: ✭ 65 (-77.89%)
Mutual labels:  iphone, ipad, mobile
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+9704.76%)
Mutual labels:  game, iphone, ipad
Supertux
SuperTux source code
Stars: ✭ 1,120 (+280.95%)
Mutual labels:  game, opengl, sdl
Dunai
Classic and Arrowized Functional Reactive Programming, Reactive Programming, and Stream programming, all via Monadic Stream Functions
Stars: ✭ 115 (-60.88%)
Mutual labels:  frp, functional-reactive-programming, game
Deviice
Swift library to easily check the current device and some more info about it.
Stars: ✭ 51 (-82.65%)
Mutual labels:  iphone, ipad
reflex-dom-ace
Reflex wrapper for the ACE editor
Stars: ✭ 12 (-95.92%)
Mutual labels:  functional-reactive-programming, frp
blobile
Blases Loaded - Unofficial Live Blaseball Game Viewer for iOS, Android, and Web
Stars: ✭ 16 (-94.56%)
Mutual labels:  iphone, ipad
recurrent
A library for building functional-reactive (FRP) GUIs in Clojurescript
Stars: ✭ 49 (-83.33%)
Mutual labels:  functional-reactive-programming, frp
S25client
Return To The Roots (Settlers II(R) Clone)
Stars: ✭ 288 (-2.04%)
Mutual labels:  game, sdl
SpecTools
Write less test code with this set of spec tools. Swift, iOS, testing framework independent (but works well with Quick/Nimble or directly).
Stars: ✭ 38 (-87.07%)
Mutual labels:  iphone, ipad
Hareactive
Purely functional reactive programming library
Stars: ✭ 293 (-0.34%)
Mutual labels:  frp, functional-reactive-programming
Urde
Data interchange and engine re-implementation for games by Retro Studios | Mirror
Stars: ✭ 253 (-13.95%)
Mutual labels:  game, opengl
Pushok
PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
Stars: ✭ 260 (-11.56%)
Mutual labels:  iphone, ipad
iOS interviews
iOS Interviews - 史上最贴心 iOS 面试知识点分享!不只是 iOS !只为技术的执拗 !👍 全网火速更新中 🔥 期待你的讨论,期待你的 issue ! 🌟
Stars: ✭ 25 (-91.5%)
Mutual labels:  iphone, ipad

Yampa

Build Status Version on Hackage Flattr this

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.

Installation

Yampa is available on hackage: http://hackage.haskell.org/package/Yampa.

$ cabal sandbox init         # Optional. Useful to isolate projects.
$ cabal update
$ cabal install Yampa

Examples

Getting Yampa to run is trivial. FRP is about values that change over time. In Yampa, a system is defined by a signal function (SF), which determines how the varying input and the varying output relate. For example:

{-# LANGUAGE Arrows #-}
import FRP.Yampa

signalFunction :: SF Double Double
signalFunction = proc x -> do
  y <- integral -< x
  t <- time     -< ()
  returnA -< y / t

This signal function says that the output signal is the integral y of the input signal x, divided by the time t. The above syntax uses a Haskell extension called Arrows. If you are unhappy using arrow syntax, you can also write that code using applicative style and/or arrow combinators:

signalFunction1 :: SF Double Double
signalFunction1 = (/) <$> integral <*> time

signalFunction2 :: SF Double Double
signalFunction2 = (integral &&& time) >>^ (/)

All three are equivalent, and it's a matter of which one you like best. To run this example, we need to provide the inputs, the times, and consume the output:

firstSample :: IO Double   -- sample at time zero
firstSample =
  return 1.0  -- time == 0, input == 1.0

nextSamples :: Bool -> IO (Double, Maybe Double)
nextSamples _ =
  return (0.1, Just 1.0) -- time delta == 0.1s, input == 1.0

output :: Bool -> Double -> IO Bool
output _ x = do
  print x     -- print the output
  return False -- just continue forever

This is a trivial example, since the integral of the constant function 1.0 over time, divided by the time, is always 1.0! Nevertheless, we are now ready to run!

ghci> reactimate firstSample nextSamples output signalFunction
1.0
1.0
1.0
1.0
1.0
1.0
...

There is a directory with examples, which includes two basic SDL examples and one with using a Nintendo Wii Remote. You can install them with:

$ cabal sandbox init         # Optional, but recommended
$ cabal update
$ cabal install Yampa -fexamples

There are many programs written in Yampa:

  • Haskanoid: a game that uses SDL multimedia, wiimote and kinect. It's cross platform and works in desktop, mobile, and web (compiled with GHCJS).
  • Space invaders.
  • Frag: a 3D first person shooting game.
  • Peoplemon: a role playing game.
  • Yampa-2048: an implementation of the game 2048 using Yampa and Gloss.
  • MandelbrotYampa: a "hello world" using SDL2, Yampa and OpenGL.
  • Haskelloids: a reproduction of the Atari 1979 classic "Asteroids"

A more comprehensive list can be obtained using the reverse dependency finder (http://packdeps.haskellers.com/reverse/Yampa), but only programs uploaded to hackage are listed.

Haskanoid Video Peoplemon by Alex Stuart Space Invaders
Haskanoid, SDL cross-platform arkanoid. Peoplemon, a role playing game Yampa2048, a gloss board game

Use in production

Backends

Yampa is backend agnostic, you can ultimately connect it to any backend you want. Existing backends include:

Testing

Yampa comes with a sophisticated testing library that allows you to use QuickCheck to test your games, and use a time-travel debugger. These features are described in the paper Testing and Debugging Functional Reactive Programming.

You can find the additional projects at:

Documentation and tutorials

The distribution of Yampa comes with substantial haddock documentation, which you can build using haddock or just read online. To build a local copy, do:

$ cabal unpack Yampa ## Or git clone this-repo
$ cd Yampa-*
$ cabal init
$ cabal install --only-dependencies
$ cabal configure && cabal haddock --internal

Documentation is also available online: https://wiki.haskell.org/Yampa

Papers and technical reports

Related projects

  • yampa-sdl2: Yampa and SDL2 made easy.
  • Haskell-OpenGL-Tutorial same as here: Visually attractive mandelbrot implementation.
  • graphui: Attempt to implement Graphui.
  • hamball: 3D, LAN FPS game of hamster balls flying around and shooting lasers written in Haskell.
  • yampa-glfw: GLFW backend.
  • Spaceinvaders: Re-write of the classic space invaders.
  • Haskanoid: Arkanoid clone in SDL with wiimote and kinect support that works on windows, linux, Mac, Android, and Web.
  • Magic Cookies: iOS/Android haskell puzzle game.
  • Pang-a-lambda: 2D arcade game inspired by the classic super-pang.
  • yampa-canvas: Backend to blank-canvas / HTML5 Canvas.
  • yampa-gloss: Gloss backend.
  • diagrams example: Demonstration of Yampa with Diagrams.
  • Keera Hails: Backend for reactive framework with GTK, WX, Qt, Android, iOS and HTML support.
  • YampaSynth: Software synthesizer.
  • Frag: 3D first person shooter.
  • cuboid: 3D puzzle game with GLUT.
  • Haskelloids: Reproduction of the Atari 1979 classic "Asteroids".
  • YFrob: Yampa-based library for programming robots.
  • YampaShooter: Top-down team based networked tank game.
  • LaneWars: Top-down MOBA game with online multiplayer.
  • Functional Reactive Virtual Reality: a fork of Yampa with extensions for VR.
  • Dunai: An FRP implementation inspired by Yampa that extends SFs with a monad.
  • Bearriver: API-compatible Yampa replacement built on top of dunai using Monadic Stream Functions.
  • The Bearriver Arcade: A couple of arcade games made using bearriver.

Help and collaboration

You can collaborate at least in three ways:

  • File an issue (https://github.com/ivanperez-keera/Yampa/issues).

  • Write documentation (send a link and/or a pull request).

  • Research: we are constantly trying to improve Yampa. We'd be glad to have collaborators. If you are working on this, please, let us know.

    (Interactivity and FRP is the main topic of my (ongoing) work and research, so I'll keep working on this for some time. -- Ivan Perez)

Authors

  • Henrik Nilsson
  • Antony Courtney

Maintainer

  • Ivan Perez
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].