game-in-haskell
game-in-haskell copied to clipboard
not working examples after cabal build
hello, i would appreciate some help because now i cannot follow examples in game in haskell book. :-( im @ ubuntu 14.04, ghc 7.10.2.20151102 (current stable release), cabal 1.22.4.0. i installed game-in-haskell in sandbox as it is described in README.md. even cabal build went (almost) ok - it just spilled a lot of warnings concerning GLFW and many others - see below. all examples were built and found in /dist/build but if i try to run e.g. shapes-demo or frp-demo or others where there should be a window created simply nothing is happening. there is no window created.
i searched through issues about g-i-h and found jmillikan's post. but it is not helpful for me and does not work (spills: (conflict: game-in-haskell-book =>base>=4.7 && <4.8))
i guess there is something wrong under hood in GLFW or GLOSS. please any help or suggestions will be very helpful. thnx.
cabal build output with warnings (sorry for length, wanted to attach a file, but there are no permission to this rep.)
Package has never been configured. Configuring with default flags. If this fails, please run configure manually. Resolving dependencies... Configuring game-in-haskell-book-0.1.0.0... Building game-in-haskell-book-0.1.0.0... Preprocessing library game-in-haskell-book-0.1.0.0... [1 of 8] Compiling Testing.GameTypes ( src/Testing/GameTypes.hs, dist/build/Testing/GameTypes.o ) [2 of 8] Compiling Testing.Sound ( src/Testing/Sound.hs, dist/build/Testing/Sound.o ) src/Testing/Sound.hs:16:1: Warning: The import of ‘Control.Monad.IO.Class’ is redundant except perhaps to import instances from ‘Control.Monad.IO.Class’ To import instances alone, use: import Control.Monad.IO.Class() src/Testing/Sound.hs:17:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() [3 of 8] Compiling Testing.Backend ( src/Testing/Backend.hs, dist/build/Testing/Backend.o ) src/Testing/Backend.hs:12:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Testing/Backend.hs:92:13: Warning: Defined but not used: ‘win’ [4 of 8] Compiling Testing.Graphics ( src/Testing/Graphics.hs, dist/build/Testing/Graphics.o ) src/Testing/Graphics.hs:15:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Testing/Graphics.hs:60:40: Warning: This binding for ‘text’ shadows the existing binding imported from ‘Graphics.Gloss’ at src/Testing/Graphics.hs:12:1-35 (and originally defined in ‘Graphics.Gloss.Data.Picture’) src/Testing/Graphics.hs:85:1: Warning: Top-level binding with no type signature: renderFrame :: GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> State -> Textures -> (Int, Int) -> RenderState -> IO () src/Testing/Graphics.hs:138:1: Warning: Top-level binding with no type signature: translateInt :: forall a a1. (Integral a, Integral a1) => a -> a1 -> Picture -> Picture [5 of 8] Compiling Testing.Internals.Game ( src/Testing/Internals/Game.hs, dist/build/Testing/Internals/Game.o ) src/Testing/Internals/Game.hs:23:1: Warning: The import of ‘, pure, ’ from module ‘Control.Applicative’ is redundant src/Testing/Internals/Game.hs:30:1: Warning: The import of ‘Data.Time.Clock’ is redundant except perhaps to import instances from ‘Data.Time.Clock’ To import instances alone, use: import Data.Time.Clock() src/Testing/Internals/Game.hs:98:1: Warning: Top-level binding with no type signature: hunted :: forall t t1. (Show t1, RandomGen t) => GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> Signal (Int, Int) -> Signal (Bool, Bool, Bool, Bool) -> Signal (Bool, Bool, Bool, Bool) -> t -> Testing.Graphics.Textures -> gloss-rendering-1.9.3.1:Graphics.Gloss.Internals.Rendering.State.State -> Sounds -> StartState -> Signal (Int, Bool) -> Signal (t1, Bool, Bool) -> Signal (Maybe Command) -> SignalGen (Signal (IO ())) src/Testing/Internals/Game.hs:153:54: Warning: Defined but not used: ‘l’ src/Testing/Internals/Game.hs:223:25: Warning: This binding for ‘lives’ shadows the existing binding bound at src/Testing/Internals/Game.hs:190:119 src/Testing/Internals/Game.hs:223:25: Warning: Defined but not used: ‘lives’ src/Testing/Internals/Game.hs:482:1: Warning: Top-level binding with no type signature: outputFunction :: GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> gloss-rendering-1.9.3.1:Graphics.Gloss.Internals.Rendering.State.State -> Testing.Graphics.Textures -> Sounds -> GameState -> (Int, Bool) -> (String, Bool) -> (Bool, Bool, Bool, Bool) -> (Bool, Bool, Bool, Bool) -> IO () src/Testing/Internals/Game.hs:482:85: Warning: This binding for ‘snapshot’ shadows the existing binding imported from ‘FRP.Elerea.Simple’ at src/Testing/Internals/Game.hs:21:1-34 [6 of 8] Compiling Testing.Game ( src/Testing/Game.hs, dist/build/Testing/Game.o ) [7 of 8] Compiling Testing.Internals.CommandParser ( src/Testing/Internals/CommandParser.hs, dist/build/Testing/Internals/CommandParser.o ) src/Testing/Internals/CommandParser.hs:7:1: Warning: The import of ‘, , ’ from module ‘Control.Applicative’ is redundant [8 of 8] Compiling Testing.CommandLine ( src/Testing/CommandLine.hs, dist/build/Testing/CommandLine.o ) src/Testing/CommandLine.hs:25:35: Warning: This binding for ‘error’ shadows the existing binding imported from ‘Prelude’ at src/Testing/CommandLine.hs:1:8-26 (and originally defined in ‘GHC.Err’) In-place registering game-in-haskell-book-0.1.0.0... Preprocessing executable 'shapes-demo' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( src/Shapes.hs, dist/build/shapes-demo/shapes-demo-tmp/Main.o ) src/Shapes.hs:27:1: Warning: Top-level binding with no type signature: renderFrame :: Window -> State -> IO () Linking dist/build/shapes-demo/shapes-demo ... Preprocessing executable 'state-demo' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( src/State.hs, dist/build/state-demo/state-demo-tmp/Main.o ) src/State.hs:7:1: Warning: The import of ‘Control.Monad’ is redundant except perhaps to import instances from ‘Control.Monad’ To import instances alone, use: import Control.Monad() src/State.hs:63:1: Warning: Top-level binding with no type signature: renderFrame :: Player -> Window -> RS.State -> IO () Linking dist/build/state-demo/state-demo ... Preprocessing executable 'frp-demo' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( src/StateFRP.hs, dist/build/frp-demo/frp-demo-tmp/Main.o ) src/StateFRP.hs:9:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/StateFRP.hs:11:1: Warning: The import of ‘Foreign.C.Types’ is redundant except perhaps to import instances from ‘Foreign.C.Types’ To import instances alone, use: import Foreign.C.Types() src/StateFRP.hs:16:1: Warning: Defined but not used: type constructor or class ‘Hunting’ src/StateFRP.hs:31:1: Warning: Top-level binding with no type signature: initialPlayer :: Player src/StateFRP.hs:32:1: Warning: Top-level binding with no type signature: initialMonster :: Monster src/StateFRP.hs:33:1: Warning: Top-level binding with no type signature: width :: Int src/StateFRP.hs:34:1: Warning: Top-level binding with no type signature: height :: Int src/StateFRP.hs:35:1: Warning: Top-level binding with no type signature: playerSize :: Float src/StateFRP.hs:36:1: Warning: Top-level binding with no type signature: monsterSize :: Float src/StateFRP.hs:37:1: Warning: Top-level binding with no type signature: monsterSpeed :: Float src/StateFRP.hs:54:1: Warning: Top-level binding with no type signature: hunted :: forall t. RandomGen t => Window -> Signal (Bool, Bool, Bool, Bool) -> t -> State -> SignalGen (Signal (IO ())) src/StateFRP.hs:61:69: Warning: Defaulting the following constraint(s) to type ‘Integer’ (Integral b0) arising from a use of ‘^’ at src/StateFRP.hs:61:69 (Num b0) arising from the literal ‘2’ at src/StateFRP.hs:61:70 In the second argument of ‘( ((Bool, Bool, Bool, Bool) -> IO b) -> IO b src/StateFRP.hs:84:1: Warning: Top-level binding with no type signature: move :: (Bool, Bool, Bool, Bool) -> Player -> Float -> Player src/StateFRP.hs:90:1: Warning: Top-level binding with no type signature: wanderDist :: Int src/StateFRP.hs:91:1: Warning: Top-level binding with no type signature: huntingDist :: Float src/StateFRP.hs:93:1: Warning: Top-level binding with no type signature: wanderOrHunt :: forall t. Player -> (Direction, t) -> Bool -> Monster -> Monster src/StateFRP.hs:98:1: Warning: Top-level binding with no type signature: close :: Player -> Monster -> Bool src/StateFRP.hs:98:61: Warning: Defaulting the following constraint(s) to type ‘Integer’ (Integral b0) arising from a use of ‘^’ at src/StateFRP.hs:98:61 (Num b0) arising from the literal ‘2’ at src/StateFRP.hs:98:62 In the second argument of ‘( Monster -> Float src/StateFRP.hs:100:72: Warning: Defaulting the following constraint(s) to type ‘Integer’ (Integral b0) arising from a use of ‘^’ at src/StateFRP.hs:100:72 (Num b0) arising from the literal ‘2’ at src/StateFRP.hs:100:73 In the first argument of ‘(+)’, namely ‘(xpos - xmon) ^ 2’ In the expression: (xpos - xmon) ^ 2 + (ypos - ymon) ^ 2 In an equation for ‘distance’: distance (Player (xpos, ypos)) (Monster (xmon, ymon) _) = (xpos - xmon) ^ 2 + (ypos - ymon) ^ 2 src/StateFRP.hs:100:90: Warning: Defaulting the following constraint(s) to type ‘Integer’ (Integral b0) arising from a use of ‘^’ at src/StateFRP.hs:100:90 (Num b0) arising from the literal ‘2’ at src/StateFRP.hs:100:91 In the second argument of ‘(+)’, namely ‘(ypos - ymon) ^ 2’ In the expression: (xpos - xmon) ^ 2 + (ypos - ymon) ^ 2 In an equation for ‘distance’: distance (Player (xpos, ypos)) (Monster (xmon, ymon) _) = (xpos - xmon) ^ 2 + (ypos - ymon) ^ 2 src/StateFRP.hs:125:1: Warning: Top-level binding with no type signature: stepInCurrentDirection :: forall t. Num t => Direction -> (t, t) -> t -> (t, t) src/StateFRP.hs:130:1: Warning: Top-level binding with no type signature: renderFrame :: Window -> State -> Player -> Monster -> Bool -> IO () src/StateFRP.hs:151:12: Warning: This binding for ‘width’ shadows the existing binding defined at src/StateFRP.hs:33:1 src/StateFRP.hs:151:18: Warning: This binding for ‘height’ shadows the existing binding defined at src/StateFRP.hs:34:1 Linking dist/build/frp-demo/frp-demo ... Preprocessing executable 'animated' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( src/Animated.hs, dist/build/animated/animated-tmp/Main.o ) src/Animated.hs:11:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Animated.hs:16:41: Warning: Defined but not used: ‘movement’ src/Animated.hs:18:40: Warning: Defined but not used: ‘dir’ src/Animated.hs:18:58: Warning: Defined but not used: ‘step’ src/Animated.hs:120:1: Warning: Top-level binding with no type signature: hunted :: forall t. RandomGen t => Window -> Signal (Bool, Bool, Bool, Bool) -> t -> Textures -> State -> SignalGen (Signal (IO ())) src/Animated.hs:146:54: Warning: Defined but not used: ‘xpos’ src/Animated.hs:146:60: Warning: Defined but not used: ‘ypos’ src/Animated.hs:226:1: Warning: Top-level binding with no type signature: renderFrame :: Window -> State -> Textures -> Player -> Monster -> Bool -> ViewPort -> IO () Linking dist/build/animated/animated ... Preprocessing executable 'music' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( src/Music.hs, dist/build/music/music-tmp/Main.o ) src/Music.hs:11:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Music.hs:19:41: Warning: Defined but not used: ‘movement’ src/Music.hs:22:40: Warning: Defined but not used: ‘dir’ src/Music.hs:22:58: Warning: Defined but not used: ‘step’ src/Music.hs:62:24: Warning: Defined but not used: ‘shriek’ src/Music.hs:63:24: Warning: Defined but not used: ‘bite’ src/Music.hs:148:1: Warning: Top-level binding with no type signature: hunted :: forall t. RandomGen t => Window -> Signal (Bool, Bool, Bool, Bool) -> t -> Textures -> State -> Sounds -> SignalGen (Signal (IO ())) src/Music.hs:272:1: Warning: Top-level binding with no type signature: outputFunction :: Window -> State -> Textures -> Sounds -> RenderState -> SoundState -> IO () src/Music.hs:274:1: Warning: Top-level binding with no type signature: renderFrame :: Window -> State -> Textures -> RenderState -> IO () Linking dist/build/music/music ... Preprocessing executable 'extended' for game-in-haskell-book-0.1.0.0... [1 of 6] Compiling Hunted.GameTypes ( src/Hunted/GameTypes.hs, dist/build/extended/extended-tmp/Hunted/GameTypes.o ) [2 of 6] Compiling Hunted.Backend ( src/Hunted/Backend.hs, dist/build/extended/extended-tmp/Hunted/Backend.o ) src/Hunted/Backend.hs:11:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Hunted/Backend.hs:14:1: Warning: Top-level binding with no type signature: withWindow :: forall a. Int -> Int -> ((Int, Int) -> IO ()) -> String -> (Window -> IO a) -> IO () src/Hunted/Backend.hs:23:15: Warning: A do-notation statement discarded a result of type ‘a’ Suppress this warning by saying ‘_ State -> Textures -> (Float, Float) -> RenderState -> IO () [4 of 6] Compiling Hunted.Sound ( src/Hunted/Sound.hs, dist/build/extended/extended-tmp/Hunted/Sound.o ) src/Hunted/Sound.hs:16:1: Warning: The import of ‘Control.Monad.IO.Class’ is redundant except perhaps to import instances from ‘Control.Monad.IO.Class’ To import instances alone, use: import Control.Monad.IO.Class() src/Hunted/Sound.hs:17:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() [5 of 6] Compiling Hunted.Game ( src/Hunted/Game.hs, dist/build/extended/extended-tmp/Hunted/Game.o ) src/Hunted/Game.hs:13:1: Warning: The import of ‘, pure, ’ from module ‘Control.Applicative’ is redundant src/Hunted/Game.hs:71:1: Warning: Top-level binding with no type signature: hunted :: forall t. RandomGen t => GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> Signal (Int, Int) -> Signal (Bool, Bool, Bool, Bool) -> Signal (Bool, Bool, Bool, Bool) -> t -> Hunted.Graphics.Textures -> gloss-rendering-1.9.3.1:Graphics.Gloss.Internals.Rendering.State.State -> Sounds -> SignalGen (Signal (IO ())) src/Hunted/Game.hs:144:1: Warning: Top-level binding with no type signature: playLevel :: forall g. RandomGen g => Signal (Int, Int) -> Signal (Bool, Bool, Bool, Bool) -> Signal (Bool, Bool, Bool, Bool) -> g -> LevelStatus -> Float -> Int -> SignalGen (Signal GameState, Signal Bool) src/Hunted/Game.hs:423:1: Warning: Top-level binding with no type signature: outputFunction :: GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> gloss-rendering-1.9.3.1:Graphics.Gloss.Internals.Rendering.State.State -> Hunted.Graphics.Textures -> Sounds -> GameState -> IO () [6 of 6] Compiling Main ( src/Hunted/Main.hs, dist/build/extended/extended-tmp/Main.o ) Linking dist/build/extended/extended ... Preprocessing executable 'testing' for game-in-haskell-book-0.1.0.0... [1 of 9] Compiling Testing.GameTypes ( src/Testing/GameTypes.hs, dist/build/testing/testing-tmp/Testing/GameTypes.o ) [2 of 9] Compiling Testing.Internals.CommandParser ( src/Testing/Internals/CommandParser.hs, dist/build/testing/testing-tmp/Testing/Internals/CommandParser.o ) src/Testing/Internals/CommandParser.hs:7:1: Warning: The import of ‘, , ’ from module ‘Control.Applicative’ is redundant [3 of 9] Compiling Testing.CommandLine ( src/Testing/CommandLine.hs, dist/build/testing/testing-tmp/Testing/CommandLine.o ) src/Testing/CommandLine.hs:25:35: Warning: This binding for ‘error’ shadows the existing binding imported from ‘Prelude’ at src/Testing/CommandLine.hs:1:8-26 (and originally defined in ‘GHC.Err’) [4 of 9] Compiling Testing.Backend ( src/Testing/Backend.hs, dist/build/testing/testing-tmp/Testing/Backend.o ) src/Testing/Backend.hs:12:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Testing/Backend.hs:92:13: Warning: Defined but not used: ‘win’ [5 of 9] Compiling Testing.Graphics ( src/Testing/Graphics.hs, dist/build/testing/testing-tmp/Testing/Graphics.o ) src/Testing/Graphics.hs:15:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Testing/Graphics.hs:60:40: Warning: This binding for ‘text’ shadows the existing binding imported from ‘Graphics.Gloss’ at src/Testing/Graphics.hs:12:1-35 (and originally defined in ‘Graphics.Gloss.Data.Picture’) src/Testing/Graphics.hs:85:1: Warning: Top-level binding with no type signature: renderFrame :: GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> State -> Textures -> (Int, Int) -> RenderState -> IO () src/Testing/Graphics.hs:138:1: Warning: Top-level binding with no type signature: translateInt :: forall a a1. (Integral a, Integral a1) => a -> a1 -> Picture -> Picture [6 of 9] Compiling Testing.Sound ( src/Testing/Sound.hs, dist/build/testing/testing-tmp/Testing/Sound.o ) src/Testing/Sound.hs:16:1: Warning: The import of ‘Control.Monad.IO.Class’ is redundant except perhaps to import instances from ‘Control.Monad.IO.Class’ To import instances alone, use: import Control.Monad.IO.Class() src/Testing/Sound.hs:17:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() [7 of 9] Compiling Testing.Internals.Game ( src/Testing/Internals/Game.hs, dist/build/testing/testing-tmp/Testing/Internals/Game.o ) src/Testing/Internals/Game.hs:23:1: Warning: The import of ‘, pure, ’ from module ‘Control.Applicative’ is redundant src/Testing/Internals/Game.hs:30:1: Warning: The import of ‘Data.Time.Clock’ is redundant except perhaps to import instances from ‘Data.Time.Clock’ To import instances alone, use: import Data.Time.Clock() src/Testing/Internals/Game.hs:98:1: Warning: Top-level binding with no type signature: hunted :: forall t t1. (Show t1, RandomGen t) => GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> Signal (Int, Int) -> Signal (Bool, Bool, Bool, Bool) -> Signal (Bool, Bool, Bool, Bool) -> t -> Testing.Graphics.Textures -> gloss-rendering-1.9.3.1:Graphics.Gloss.Internals.Rendering.State.State -> Sounds -> StartState -> Signal (Int, Bool) -> Signal (t1, Bool, Bool) -> Signal (Maybe Command) -> SignalGen (Signal (IO ())) src/Testing/Internals/Game.hs:153:54: Warning: Defined but not used: ‘l’ src/Testing/Internals/Game.hs:223:25: Warning: This binding for ‘lives’ shadows the existing binding bound at src/Testing/Internals/Game.hs:190:119 src/Testing/Internals/Game.hs:223:25: Warning: Defined but not used: ‘lives’ src/Testing/Internals/Game.hs:482:1: Warning: Top-level binding with no type signature: outputFunction :: GLFW-b-1.4.7.2:Graphics.UI.GLFW.Types.Window -> gloss-rendering-1.9.3.1:Graphics.Gloss.Internals.Rendering.State.State -> Testing.Graphics.Textures -> Sounds -> GameState -> (Int, Bool) -> (String, Bool) -> (Bool, Bool, Bool, Bool) -> (Bool, Bool, Bool, Bool) -> IO () src/Testing/Internals/Game.hs:482:85: Warning: This binding for ‘snapshot’ shadows the existing binding imported from ‘FRP.Elerea.Simple’ at src/Testing/Internals/Game.hs:21:1-34 [8 of 9] Compiling Testing.Game ( src/Testing/Game.hs, dist/build/testing/testing-tmp/Testing/Game.o ) [9 of 9] Compiling Main ( src/Testing/Main.hs, dist/build/testing/testing-tmp/Main.o ) src/Testing/Main.hs:15:1: Warning: The import of ‘Control.Applicative’ is redundant except perhaps to import instances from ‘Control.Applicative’ To import instances alone, use: import Control.Applicative() src/Testing/Main.hs:56:6: Warning: This binding for ‘snapshot’ shadows the existing binding imported from ‘FRP.Elerea.Simple’ at src/Testing/Main.hs:12:1-34 Linking dist/build/testing/testing ... Preprocessing test suite 'hunit' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( test/HUnit.hs, dist/build/hunit/hunit-tmp/Main.o ) Linking dist/build/hunit/hunit ... Preprocessing test suite 'properties' for game-in-haskell-book-0.1.0.0... [1 of 1] Compiling Main ( test/Properties.hs, dist/build/properties/properties-tmp/Main.o ) Linking dist/build/properties/properties ...
So unfortunate that the book or code can't be updated to newer versions. It seems so young. What is up with the Cabal maintainers?