Skip to content

Instantly share code, notes, and snippets.

@funrep
Created November 27, 2013 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funrep/7676158 to your computer and use it in GitHub Desktop.
Save funrep/7676158 to your computer and use it in GitHub Desktop.
right :: Event t Bool
left :: Event t Bool
ship = accumB 100 move
move n = whenMove left (fmap ($ n) add)
`union` whenMove right (fmap ($ n) sub)
add = once (+ 1) <@ tick
sub = once (flip (-) 1) <@ tick
whenMove e = whenE (stepper False e)
once = flip accumE never
@funrep
Copy link
Author

funrep commented Nov 27, 2013

frp.hs:6:
    Couldn't match expected type `Event t0 (a0 -> a0)'
                with actual type `c0 -> Event t c0'
    In the second argument of `accumB', namely `move'
    In the expression: accumB 100 move
    In an equation for `ship': ship = accumB 100 move

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment