Skip to content

Commit bc0cb88

Browse files
committed
Use MonadIO. Bumped version to 2.4.0.0.
1 parent 8e03a4c commit bc0cb88

File tree

5 files changed

+12227
-9148
lines changed

5 files changed

+12227
-9148
lines changed

OpenGLRaw.cabal

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: OpenGLRaw
2-
version: 2.3.0.1
2+
version: 2.4.0.0
33
synopsis: A raw binding for the OpenGL graphics system
44
description:
55
OpenGLRaw is a raw Haskell binding for the OpenGL 4.5 graphics system and
@@ -20,6 +20,7 @@ description:
2020
and <http://www.opengl.org/registry/>.
2121
homepage: http://www.haskell.org/haskellwiki/Opengl
2222
bug-reports: https://github.com/haskell-opengl/OpenGLRaw/issues
23+
copyright: Copyright (C) 2009-2015 Sven Panne
2324
license: BSD3
2425
license-file: LICENSE
2526
author: Sven Panne
@@ -574,7 +575,9 @@ library
574575
cbits/HsOpenGLRaw.c
575576
hs-source-dirs: src
576577
include-dirs: include
577-
build-depends: base >= 3 && < 5
578+
build-depends:
579+
base >= 4 && < 5,
580+
transformers >= 0.2 && < 0.5
578581
default-language: Haskell2010
579582
ghc-options: -Wall
580583
other-extensions: CPP

RegistryProcessor/RegistryProcessor.cabal

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ cabal-version: >=1.10
2121
executable RegistryProcessor
2222
main-is: Main.hs
2323
other-modules: DeclarationParser ManPages MangledRegistry Registry
24-
build-depends: base >= 3 && < 5, containers >= 0.5 && < 0.6, hxt >= 9.3, directory, filepath
24+
build-depends:
25+
base >= 4 && < 5,
26+
containers >= 0.3 && < 0.6,
27+
hxt >= 9.3 && < 9.4,
28+
directory >= 1.0 && < 1.3,
29+
filepath >= 1.0 && < 1.4
2530
hs-source-dirs: src
2631
default-language: Haskell2010
2732
ghc-options: -Wall

RegistryProcessor/src/Main.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ printFunctions api registry = do
6565
SI.hPutStrLn h "-- Make the foreign imports happy."
6666
SI.hPutStrLn h "import Foreign.C.Types"
6767
SI.hPutStrLn h ""
68+
SI.hPutStrLn h "import Control.Monad.IO.Class ( MonadIO(..) )"
6869
SI.hPutStrLn h "import Foreign.Marshal.Error ( throwIf )"
6970
SI.hPutStrLn h "import Foreign.Ptr ( Ptr, FunPtr, nullFunPtr )"
7071
SI.hPutStrLn h "import System.IO.Unsafe ( unsafePerformIO )"
@@ -312,8 +313,9 @@ showCommand api c =
312313
showString man .
313314

314315
showString (name ++ "\n") .
315-
showString (" :: " ++ signature True) .
316-
showString (name ++ " = " ++ dyn_name ++ " " ++ ptr_name ++ "\n\n") .
316+
showString (" :: MonadIO m\n") .
317+
showString (" => " ++ signature True) .
318+
showString (name ++ args ++ " = liftIO $ " ++ dyn_name ++ " " ++ ptr_name ++ args ++ "\n\n") .
317319

318320
showString ("foreign import CALLCONV \"dynamic\" " ++ dyn_name ++ "\n" ++
319321
" :: FunPtr (" ++ compactSignature ++ ")\n" ++
@@ -341,11 +343,14 @@ showCommand api c =
341343
[_] -> "-- | Manual page for " ++ links
342344
_ -> "-- | Manual pages for " ++ links
343345
renderURL (u, l) = "<" ++ u ++ " " ++ l ++ ">"
346+
args = concat [" v" ++ show i | i <- [1 .. length (paramTypes c)]]
344347

345348
showSignatureElement :: Bool -> Bool -> SignatureElement -> String
346349
showSignatureElement withComment isResult sigElem = el ++ comment
347-
where el | isResult = "IO " ++ showsPrec 11 sigElem ""
350+
where el | isResult = monad ++ " " ++ showsPrec 11 sigElem ""
348351
| otherwise = show sigElem
352+
monad | withComment = "m"
353+
| otherwise = "IO"
349354
comment | withComment = showComment name sigElem
350355
| otherwise = ""
351356
name | isResult = ""

0 commit comments

Comments
 (0)