Hello, I've been tyring to modify the Haskell SDL bindings from hackage to get it to work on jhc (people should not use Haskell extensions in binding libraries!!!) and I had a problem with a piece of code that was using bracket_ but I did find a solution, the error message was: [1 of 1] Graphics.UI.SDL.General(.......................................jhc: user error ( What: failure Why: boxyMatch failure: (Jhc.Prim.IO Jhc.Basics.()) (s629 -> Jhc.Prim.IO s630) Where: on line 148 in General.hs in the application Control.Exception.bracket_ (Graphics.UI.SDL.General.init Graphics.UI.SDL.General.20_flags) Graphics.UI.SDL.General.quit Graphics.UI.SDL.General.21_action in Graphics.UI.SDL.General.withInit {- on line 148 -} in the function binding Graphics.UI.SDL.General.withInit Graphics.UI.SDL.General.20_flags Graphics.UI.SDL.General.21_action = Control.Exception.bracket_ (Graphics.UI.SDL.General.init Graphics.UI.SDL.General.20_flags) Graphics.UI.SDL.General.quit Graphics.UI.SDL.General.21_action {- on line 148 -}) My suspicion was that the type signature for bracket_ wasn't exactly the same as defined in Haskell98 so I copied from haddoc docs the defintion and made bracket2_ function: bracket2_ :: IO a -> IO b -> IO c -> IO c bracket2_ before after thing = bracket before (const after) (const thing) Then it all works fine, when I was googling the problem I think someone else had it too so hopefully if another person gets it they can find this :)
On Wed, Jul 28, 2010 at 06:53:58AM +0000, Korcan Hussein wrote:
Hello, I've been tyring to modify the Haskell SDL bindings from hackage to get it to work on jhc (people should not use Haskell extensions in binding libraries!!!) and I had a problem with a piece of code that was using bracket_ but I did find a solution, the error message was:
Cool! Yeah, it is quite annoying when people use extensions when they have no reason too, many packages need only depend on haskell98 but for wanting to use dots in the module names. Unfortunately, there was a misguided push a bit back to 'de-portablize' much of hackage replacing haskell98 dependencies with base to work around some dependency issue hackage or cabal or something was dealing with. Control.Exception is a common offender. once I have full haskell 2010 support, I plan on disabling much of the ghc-base extensions by default, providing them as an independent ghc-base-compat library that won't be incuded by default. So, people can still compile their non-portable stuff, they would just have to be explicit about it. It would also allow me to separate out the stuff I added because I think it is a good idea and needed for a compiler, and things I added simply for ghc compatibility. John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
participants (2)
-
John Meacham -
Korcan Hussein