dbus-th 0.1.0.0 → 0.1.1.0
raw patch · 2 files changed
+20/−14 lines, 2 filesdep +dbusdep −dbus-coredep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: dbus
Dependencies removed: dbus-core
Dependency ranges changed: containers
API changes (from Hackage documentation)
- DBus.TH: data Proxy :: *
- DBus.TH: proxy :: Client -> BusName -> ObjectPath -> IO Proxy
- DBus.TH: interface :: String -> Maybe String -> [Function] -> Q [Dec]
+ DBus.TH: interface :: String -> String -> String -> Maybe String -> [Function] -> Q [Dec]
Files
- DBus/TH.hs +17/−11
- dbus-th.cabal +3/−3
DBus/TH.hs view
@@ -3,12 +3,10 @@ module DBus.TH (module Data.Int, module Data.Word,- Proxy, Client, BusName, ObjectPath, InterfaceName, MemberName, Variant, connectSession, connectSystem,- proxy, Signature (..), Function (..), (=::), as,@@ -23,7 +21,8 @@ import Data.Char import Data.List import Data.Generics-import DBus.Client.Simple hiding (Type, Signature)+import DBus hiding (Type, Signature)+import DBus.Client hiding (Type, Signature) -- | Function signature data Signature = Return Name@@ -65,11 +64,13 @@ -- If second argument is (Just prefix), then prefix will be -- added to the beginning of all DBus names and removed from all -- Haskell names.-interface :: String -- ^ Interface name+interface :: String -- ^ Bus name+ -> String -- ^ Interface name+ -> String -- ^ Object name -> Maybe String -- ^ Prefix -> [Function] -- ^ List of functions -> Q [Dec]-interface ifaceName mbPrefix fns = concat `fmap` mapM iface fns+interface busName objectName ifaceName mbPrefix fns = concat `fmap` mapM iface fns where iface :: Function -> Q [Dec] iface (Function name dbusName sig) =@@ -98,7 +99,7 @@ return $ SigD (mkName $ firstLower name) dbt dbusType :: Type -> Q Type- dbusType t = [t| Proxy -> $(return t) |]+ dbusType t = [t| Client -> $(return t) |] transformType :: Signature -> Type transformType (Return t) = AppT (ConT ''IO) (AppT (ConT ''Maybe) (ConT t))@@ -114,11 +115,16 @@ generateBody :: String -> Signature -> [Name] -> Q Exp generateBody name sig names = do [| do- res <- call $(varE $ mkName "bus")- (interfaceName_ $ Text.pack ifaceName)- (memberName_ $ Text.pack name)- $(variant names) - return $ fromVariant (res !! 0)+ let baseMethod = methodCall (objectPath_ objectName)+ (interfaceName_ ifaceName)+ (memberName_ name)+ method = baseMethod {+ methodCallDestination = Just (busName_ busName),+ methodCallBody = $(variant names)+ }+ + res <- call_ $(varE $ mkName "bus") method+ return $ fromVariant (methodReturnBody res !! 0) |] variant :: [Name] -> Q Exp
dbus-th.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dbus-th-version: 0.1.0.0+version: 0.1.1.0 synopsis: TemplateHaskell generator of DBus bindings description: This package provides functions to easily generate bindings for DBus functions. See Test.hs for examples.@@ -19,9 +19,9 @@ library exposed-modules: DBus.TH -- other-modules: - build-depends: base > 4 && < 5, containers ==0.4.*,+ build-depends: base > 4 && < 5, containers >= 0.4, syb >= 0.3.6,- dbus-core ==0.9.*,+ dbus, template-haskell >=2.6, text ==0.11.* Source-repository head