Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 6th, 2012  |  syntax: None  |  size: 1.78 KB  |  views: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. let bGameState :: Behavior t GameState
  2.     bGameState = accumB initialGS $ updateGS <$ eInput
  3.  
  4. yields the error
  5.  
  6.  Couldn't match expected type `GameState'
  7.              with actual type `PlayerCommand'
  8.  Expected type: GameState -> GameState
  9.    Actual type: PlayerCommand -> GameState -> GameState
  10.  In the first argument of `(<$)', namely `updateGS'
  11.  In the second argument of `($)', namely `updateGS <$ eInput'
  12.        
  13. Could not deduce (t ~ t1)
  14. from the context (Frameworks t)
  15.   bound by a type expected by the context:
  16.              Frameworks t => Moment t ()
  17.   at outline.hs:(153,42)-(159,93)
  18.   `t' is a rigid type variable bound by
  19.       a type expected by the context: Frameworks t => Moment t ()
  20.       at outline.hs:153:42
  21.   `t1' is a rigid type variable bound by
  22.        the type signature for bGameState :: Behavior t1 GameState
  23.        at outline.hs:158:8
  24. Expected type: Behavior t1 GameState
  25.   Actual type: Behavior t GameState
  26. In the expression: accumB initialGS $ updateGS <$> eInput
  27. In an equation for `bGameState':
  28.     bGameState = accumB initialGS $ updateGS <$> eInput
  29.        
  30. makeNetworkDescription :: AddHandler PlayerCommand -> IO EventNetwork
  31. makeNetworkDescription addCommandEvent = compile $ do
  32.    eInput <- fromAddHandler addCommandEvent
  33.    let bCommand = stepper Null eInput
  34.    eCommandChanged <- changes bCommand
  35.    let bGameState :: Behavior t GameState
  36.        bGameState = accumB initialGS $ updateGS <$> eInput
  37.    reactimate $ (n -> appendFile "output.txt" ("Command is " ++ show n)) <$>    
  38.    eCommandChanged
  39.        
  40. (<$)     :: a -> f b -> f a
  41. updateGS :: PlayerCommand -> GameState -> GameState
  42. eInput   :: Event t PlayerCommand
  43.        
  44. a ~ PlayerCommand -> GameState -> GameState
  45.        
  46. f b ~ Event t PlayerCommand
  47.        
  48. f ~ Event t
  49. b ~ PlayerCommand
  50.        
  51. f a ~ Event t (PlayerCommand -> GameState -> GameState)