Skip to content

Running primitive signal functions in Yampa

To test signal functions in Yampa, use the embed function. Enter the following commands in the Haskell command-line to show the header definition:

> :type FRP.Yampa.embed

FRP.Yampa.embed :: FRP.Yampa.SF a b -> (a, [(FRP.Yampa.DTime, Maybe a)]) -> [b]

So the parameters are:

  1. the signal function to run
  2. a tuple of…
    1. the first input value at time=0
    2. and a list of…
      1. (time, Nothing|Just nextValue)

and return a list of values produced by the signal function.

Primitive signal functions include: time, identity and constant

main :: IO ()
main = do
    putStrLn $ show $ embed time (Nothing, [(1.0, Nothing), (0.2, Nothing), (0.03, Nothing)])
    putStrLn $ show $ embed time (123, [(1.0, Just 234), (0.2, Just 345), (0.03, Just 456)])
    -- [0.0,1.0,1.2,1.23]
    -- [0.0,1.0,1.2,1.23]

    putStrLn $ show $ embed identity (123, [(1.0, Just 234), (0.2, Just 345), (0.03, Just 456)])
    putStrLn $ show $ embed identity (537, [(1.0, Nothing), (0.2, Nothing), (0.03, Just 123)])
    -- [123,234,345,456]
    -- [537,537,537,537]

    putStrLn $ show $ embed (constant 537) (Nothing, [(1.0, Nothing), (0.2, Nothing), (0.03, Nothing)])
    putStrLn $ show $ embed (constant 537) (123, [(1.0, Just 234), (0.2, Just 345), (0.03, Just 456)])
    -- putStrLn $ show (embed constant (123, [(1.0, Just 234), (0.2, Just 345), (0.03, Just 456)])) -- ERROR
    -- [537,537,537,537]
    -- [537,537,537,537]

Tagged with , , .

11 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Karol Marcjan says

    Just wondering… Why’s that a `Maybe a` and not just an `a`?

  2. LelaMDYLoed says

    We offer informative audits that tell where you could take the long run and where you are

  3. CelsaKitson says

    Must have insurance sales expertise and computer capabilities. Complete- or part time hours; variable timetable.

  4. waste oil pyrolysis machine says

    tire pyrolysis machine,waste oil pyrolysis machine, Waste tires
    oil refining equipment, waste tire to fuel machine,
    pyrolysis machine, pyrolysis machine buyer, waste rubber recycling to oil machine, Waste tire recycling
    machine, waste plastic refinery to oiil plant, worlds best waste tyre ptrolysis machinery manufacturers, waste tires pyrolysis to oil plant,
    rubber pyrolysis plant, waste oil refinery machine, rubber pyrolysis machines, waste tyre plant,
    waste plastic refining, Wastte Oil Refining Plant, waste tire pyrolysis plant, hi tech waste ooil recycling, trye pyrolysis machine, waste plastic pyrolysis
    machine, Waste tyre pyrolysis plant, complete pyrolysis plant equipment, Waste Plastic Recycling Machine,
    waste tire recyclig plant, tire pyrolysis oil distillation machine to diesel, plastic pyrolysis oil distillation machine
    to diesel, oil from waste tyre machine manufacturer, turn waste tie
    to oil, pyrolysis plant for tiire recycling, tyre pyrolysis plant, waste
    oil distillation equipment, useed oil refinerey machine,
    used oil recycling machine, waste tyre recycling machine, scrap tyres recycling to oil system, use plastiic to
    furnace oil equipment, pyrolysis plant for rubber recycling, Waste
    tyre recycling plant, waste tyre pyrolysis, waste tyre recycling plant, waste pyrolysis plant, pyrolysis plant uk, ueed
    engine oill recyclong machine, tire pyrolysis plant,
    waste tyre oil plant 2014, waste engine oill diesel machine, equipment required for pyrolysis
    plant for plastic waste, waste engine oil recycling too diesel machine,
    waste tyre refining equipment, tire too oil, wste tyre recycling, waste tire processing machine, tyre pyrolysis machine seller,
    waste tyre recycling machine, oil distillation machine,
    pyrolysis plant for plastic recycling, the best off waste tyre
    pyrolysis plant, tyre rrecycling pyrolysis plant, waste
    plastic to oil machine, waste tyre, automatic plastijc pyrolysis plant, pyrolysis thre recycling plant,
    used tires to oil machine, tyre pyrolysis oil, pyrolysis plant, tyre pyrolysis,
    waste tire to diesel machine, tyre recycling to oil,
    waste tyre recycling pyrolysis plant china, tyre to diesel solution, waste plastic pyrolysis plant, tire pyrolysis plant usa, tire recycling to oil supplier, Oil refining
    equipment, plastic pyrolysis plant, waste to oil plant, waste tire
    recycling to diesel, waste oil recycling plant, pyrolysis
    plaqnt in gujarat, used oill recycling equipment, pyrolysis machine manufacturers, pyrolysis machines
    for sale, scrap tires recycling machine, waste plastiic to
    fuel machine, pyrolysis plants, car oil recycle machine, oil refining machine,
    tire pyrolysis plant manufacturers, tyre pyrolisyss plant, rubber recycling machine, other ruvber
    recycling machines, pyrolysis of wastte tyres, waste oil recycling to diesel, chineese tyre recycling plant, tire recycling equipment, distillation machine, rubber recycling
    machines, cheap used plastic recycling machines, europen tyre recycling plasnt manufacturer, how to recycle
    used motor oil, machine for converting of waste plasic into oil, machine which converts waste plastic to oil, plastic film recycling machine,
    plastic recycling equipment south africa, small pirolisys plant, plastic recycling machines manufacturers, waste to energy pyrolysis, pyrolysis plant india, machine for recycling plastic bottles, small
    scale plasfic recycling plant, pyrolysis fuel oil, pyrolysis oil,
    pyrolysis plant for sale, continuous pyrolysis
    plant, car oil recycling, conversion of pyrolysis oill to diesel plant, disposal off waste engine oil, engine oil recycling, equipment for distillation,
    oil recycling plant suppliers, recycle engine oil, reuse of waete
    engine oil, waste oil reclamation equipment, waste oil
    recycling system, waste oil refining, easiest way tto recycle used oil, how to recycle
    used engine oil, recycle used oil, oil refining system, tire to diesel production line, plastic to diesel production line, scrap plastic
    to oil machine, recycling plastic too fuel oil, convert plastic to oil system,
    scrap to oil machine, plastic to oil machine, waste plastic to diesel, waste
    to energy, waste to fuel, tire to fuel, used oil recycling plant, waste oiil to diesel machine, tire
    oil extraction machine, plastic oil extraction plant, get oil from waste, pyrolysis plqnt manufacturer, wastee oil to diesel plant,
    engine oil too diesel system, waste recycling machine, scrap recycling plant,
    tire oil to diesel, plwstic oil to diesel, wasge plastic procesing to oil, crude oill
    refinery machine, used tire recycling plant, paper offcut recycling machine, tyfe recycling machine,
    plastic waste recycling! It’s an excellent project, I came tto know about this
    project through mmy friend. Convert wastes to wealth, renewable alternative resources, come to
    see Huayin aste tyre pyrolysis plant, supply waste tires/plastics pyrolsis plant and used oil distillation plant
    to worldwide clients.
    Focus onn customer success! Head on to find it.

  5. Clit says

    WOW just what I was looking for. Came here by searching for Cannibalism

  6. FeliciaAFQJ says

    I get pleasure from, lead to I found just what I used to be taking a look for. You’ve ended my four day lengthy hunt! God Bless you man. Have a nice day. Bye

  7. AlbertoLanglais says

    I feel that is among the so much important info for me. And i am glad studying your article. However want to remark on some normal issues, The web site taste is perfect, the articles is in reality excellent : D. Just right activity, cheers

  8. PPHShanice says

    Torrent Video Player couldn’t be safer to use due to its user-friendly interface and obvious navigational features. -v -V 0 -b 192 -h accomplishes a similar thing but doesn’t allow the files drop below 192kbps. Torrents certainly are a popular strategy to watch TV, movies, and hear music online.

  9. Backlink Bilgi says

    I simply could not go away yoսr website prior to suggesting tҺɑt I actuallү loved
    the standard іnformation an individua provide on ʏօur guests?

    Is gonna be again ceaselessly in orԁeг to insect neա posts

Continuing the Discussion

  1. Learning Yampa and Functional Reactive Programming | Lambdor Devblog linked to this post on 2011-04-30

    [...] Running primitive signal functions in Yampa Yampa/SDL program stub [...]

  2. Haskell Yampa « Code Contemplation linked to this post on 2012-07-28

    [...] suggested here primitive signal functions can be tested using the embed function. For example: putStrLn $ show $ [...]

Some HTML is OK

or, reply to this post via trackback.