rosmsg 0.4.3.3 → 0.4.4.0
raw patch · 3 files changed
+14/−4 lines, 3 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- LICENSE +1/−1
- rosmsg.cabal +2/−2
- src/Robotics/ROS/Msg/TH.hs +11/−1
LICENSE view
@@ -13,7 +13,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Author name here nor the names of other+ * Neither the name of Alexander Krupenkin here nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.
rosmsg.cabal view
@@ -1,5 +1,5 @@ name: rosmsg-version: 0.4.3.3+version: 0.4.4.0 synopsis: ROS message parser, render, TH description: Please see README.md homepage: https://github.com/RoboticsHS/rosmsg#readme@@ -27,7 +27,7 @@ , bytestring >= 0.10 && < 1 , lens-family >= 1.2 && < 2 , data-default >= 0.5 && < 1- , template-haskell >= 2.10 && < 2.11+ , template-haskell >= 2.10 && < 2.12 other-modules: Robotics.ROS.Msg.ROSArray default-language: Haskell2010
src/Robotics/ROS/Msg/TH.hs view
@@ -10,6 +10,7 @@ -- Template Haskell driven code generator from ROS message language -- to Haskell native representation. --+{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE KindSignatures #-}@@ -189,6 +190,15 @@ instanceD' name insType insDecs = instanceD (cxt []) (appT insType (conT name)) insDecs +-- | Simple data type declaration with one constructor+dataD' :: Name -> ConQ -> [Name] -> DecQ+dataD' name rec derive =+#if __GLASGOW_HASKELL__ < 800+ dataD (cxt []) name [] [rec] derive+#else+ dataD (cxt []) name [] Nothing [rec] $ cxt (conT <$> derive)+#endif+ -- | Simple function declaration funD' :: String -> [PatQ] -> ExpQ -> DecQ funD' name p f = funD (mkName name) [clause p (normalB f) []]@@ -201,7 +211,7 @@ -- | Data type declaration mkData :: Name -> MsgDefinition -> [DecQ] mkData name msg = pure $- dataD (cxt []) name [] [recs] derivingD+ dataD' name recs derivingD where fields = sanitizeField <$> msg recs = recC name (catMaybes (fieldQ <$> fields))