packages feed

dbus-qq 0.0.1 → 0.0.2

raw patch · 3 files changed

+24/−12 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

DBus/QuasiQuoter.hs view
@@ -18,8 +18,8 @@  data DBusFunction = DBusFunction [Type] [Type] --- |A quasi-quoter to convert a function of type @[Variant] -> [Variant]@ into a--- function of a specified static type.+-- |A quasi-quoter to convert a function of type @['DT.Variant'] ->+-- ['DT.Variant']@ into a function of a specified static type. -- -- This quasi-quoter takes a signature of the form: --@@ -30,20 +30,20 @@ -- Types on the left of the arrow correspond to argument types, while those on -- the right are return types. ----- The result is a combinator which takes any function of type [Variant] ->--- [Variant], assumes that its arguments and results are of the specified+-- The result is a combinator which takes any function of type ['DT.Variant'] ->+-- ['DT.Variant'], assumes that its arguments and results are of the specified -- number and types, and returns a function of the corresponding static type. ----- For example, if @f :: [Variant] -> [Variant]@,+-- For example, if @f :: ['DT.Variant'] -> ['DT.Variant']@, -- -- @---   [dbus| i s -> s a{uv} |] f+--   ['dbus'| i s -> s a{uv} |] f -- @ -- -- has type -- -- @---   Int -> String -> (String, Map Word32 Variant)+--   Int -> String -> (String, 'Map.Map' 'Word32' 'DT.Variant') -- @ dbus :: QuasiQuoter dbus = QuasiQuoter@@ -53,8 +53,8 @@   , quoteDec = undefined   } --- |A generalized version of the dbus quasi-quoter which works on functions of--- type @[Variant] -> f [Variant]@, for any functor @f@.+-- |A generalized version of the 'dbus' quasi-quoter which works on functions of+-- type @['DT.Variant'] -> f ['DT.Variant']@, for any 'Functor' @f@. dbusF :: QuasiQuoter dbusF = QuasiQuoter   { quoteExp = expQuoter True@@ -81,7 +81,7 @@  dbusFunction :: GenParser Char s DBusFunction dbusFunction = DBusFunction-  <$> (space *> dbusTypes <* string "->" <* spaces)+  <$> (spaces *> dbusTypes <* string "->" <* spaces)   <*> dbusTypes  dbusTypes :: GenParser Char s [Type]
Tests.hs view
@@ -17,6 +17,16 @@     f :: [Variant] -> [Variant]     f xs = [toVariant . show . sum $ (map (fromJust . fromVariant) xs :: [Int32])] +prop_nospaces x y = show (x + y) == [dbus|ii->s|] f x y+  where+    f :: [Variant] -> [Variant]+    f xs = [toVariant . show . sum $ (map (fromJust . fromVariant) xs :: [Int32])]++prop_spaces x y = show (x + y) == [dbus|     ii->   s      |] f x y+  where+    f :: [Variant] -> [Variant]+    f xs = [toVariant . show . sum $ (map (fromJust . fromVariant) xs :: [Int32])]+ prop_functor x y = Just (show (x + y)) == [dbusF| i i -> s |] f x y   where     f :: [Variant] -> Maybe [Variant]@@ -55,4 +65,6 @@         ,("tuples", quickCheck prop_tuples)         ,("retvals", quickCheck prop_retvals)         ,("values", quickCheck prop_values)-        ,("unit", quickCheck prop_unit)]+        ,("unit", quickCheck prop_unit)+        ,("no spaces", quickCheck prop_nospaces)+        ,("spaces", quickCheck prop_spaces)]
dbus-qq.cabal view
@@ -1,5 +1,5 @@ Name: dbus-qq-Version: 0.0.1+Version: 0.0.2 Synopsis: Quasi-quoter for DBus functions Description: This package contains a quasi-quoter to automatically convert functions of the form @[Variant] -> [Variant]@ to functions of the actual types, returning a tuple of the results. License: BSD3