packages feed

kafka-device 0.2.1.2 → 1.0.0.0

raw patch · 8 files changed

+116/−85 lines, 8 filesdep ~aesondep ~basedep ~binaryPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson, base, binary, bytestring, cereal, linear, milena, mtl

API changes (from Hackage documentation)

- Network.UI.Kafka.Interpretation: instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Network.UI.Kafka.Interpretation.Interpretation a b)
- Network.UI.Kafka.Interpretation: instance (GHC.Read.Read b, GHC.Read.Read a) => GHC.Read.Read (Network.UI.Kafka.Interpretation.Interpretation a b)
- Network.UI.Kafka.Interpretation: instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Network.UI.Kafka.Interpretation.Interpretation a b)
+ Network.UI.Kafka.Interpretation: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Network.UI.Kafka.Interpretation.Interpretation a b)
+ Network.UI.Kafka.Interpretation: instance (GHC.Read.Read a, GHC.Read.Read b) => GHC.Read.Read (Network.UI.Kafka.Interpretation.Interpretation a b)
+ Network.UI.Kafka.Interpretation: instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Network.UI.Kafka.Interpretation.Interpretation a b)
- Network.UI.Kafka: type ConsumerCallback = Sensor The name of the sensor producing the event. -> Event The event. -> IO () The action for consuming the event.
+ Network.UI.Kafka: type ConsumerCallback = Sensor " The name of the sensor producing the event." -> Event " The event." -> IO () " The action for consuming the event."
- Network.UI.Kafka: type ProducerCallback = IO [Event] Action for producing events.
+ Network.UI.Kafka: type ProducerCallback = IO [Event] " Action for producing events."
- Network.UI.Kafka.Interpretation: type AnalogHandler a b = b The raw event. -> Maybe (Int, a) The axis number and value.
+ Network.UI.Kafka.Interpretation: type AnalogHandler a b = b " The raw event." -> Maybe (Int, a) " The axis number and value."
- Network.UI.Kafka.Interpretation: type ButtonHandler a b = b The raw event. -> Maybe (Int, Bool) The button number and whether the button is depressed.
+ Network.UI.Kafka.Interpretation: type ButtonHandler a b = b " The raw event." -> Maybe (Int, Bool) " The button number and whether the button is depressed."

Files

+ default.nix view
@@ -0,0 +1,20 @@+{+  mkDerivation, stdenv+, aeson, base, binary, bytestring, cereal, linear, milena, mtl+}:++mkDerivation {+  pname = "kafka-device";+  version = "1.0.0.0";+  src = ./.;+  isLibrary = true;+  isExecutable = true;+  libraryHaskellDepends = [+    aeson base binary bytestring cereal linear milena mtl+  ];+  executableHaskellDepends = [+  ];+  homepage = "https://bitbucket.org/functionally/kafka-device";+  description = "UI device events via a Kafka message broker";+  license = stdenv.lib.licenses.mit;+}
kafka-device.cabal view
@@ -1,67 +1,73 @@-name:                kafka-device-version:             0.2.1.2-synopsis:            UI device events via a Kafka message broker-description:         This package contains functions for passing UI device events to topics on a Kafka message broker \<<https://kafka.apache.org/>\>.  Also see \<<https://hackage.haskell.org/package/kafka-device-joystick/>\>, \<<https://hackage.haskell.org/package/kafka-device-glut/>\>, \<<https://hackage.haskell.org/package/kafka-device-spacenav/>\>, \<<https://hackage.haskell.org/package/kafka-device-leap/>\>.-license:             MIT-license-file:        LICENSE-author:              Brian W Bush <consult@brianwbush.info>-maintainer:          Brian W Bush <consult@brianwbush.info>-copyright:           (c) 2016-17 Brian W Bush-category:            Hardware-build-type:          Simple-cabal-version:       >= 1.10-stability:           Experimental-homepage:            https://bitbucket.org/functionally/kafka-device-bug-reports:         https://bwbush.atlassian.net/projects/HKAFDEV/issues/-package-url:         https://bitbucket.org/functionally/kafka-device/downloads/kafka-device-$version.tar.gz+name         : kafka-device+version      : 1.0.0.0+synopsis     : UI device events via a Kafka message broker+description  : This package contains functions for passing UI device events to topics on a Kafka message broker \<<https://kafka.apache.org/>\>.  Also see \<<https://hackage.haskell.org/package/kafka-device-joystick/>\>, \<<https://hackage.haskell.org/package/kafka-device-glut/>\>, \<<https://hackage.haskell.org/package/kafka-device-spacenav/>\>, \<<https://hackage.haskell.org/package/kafka-device-leap/>\>.+license      : MIT+license-file : LICENSE+author       : Brian W Bush <code@functionally.io>+maintainer   : Brian W Bush <code@functionally.io>+copyright    : (c) 2016-19 Brian W Bush+category     : Hardware+build-type   : Simple+cabal-version: >= 1.10+stability    : Production+homepage     : https://bitbucket.org/functionally/kafka-device+bug-reports  : https://bwbush.atlassian.net/projects/HKAFDEV/issues/+package-url  : https://bitbucket.org/functionally/kafka-device/downloads/kafka-device-$version.tar.gz -extra-source-files:  ReadMe.md+extra-source-files: ReadMe.md+                    default.nix  source-repository head-  type: git+  type    : git   location: https://bitbucket.org/functionally/kafka-device   library-  exposed-modules:  Network.UI.Kafka+  exposed-modules : Network.UI.Kafka                     Network.UI.Kafka.Interpretation                     Network.UI.Kafka.Keyboard                     Network.UI.Kafka.Types-  build-depends:    base         >= 4.8 && < 5-               ,    aeson        >= 0.11.3-               ,    binary       >= 0.7.2-               ,    bytestring   >= 0.10.6-               ,    cereal       >= 0.5.4-               ,    linear       >= 1.20.5-               ,    milena       >= 0.5.0-               ,    mtl          >= 2.2.1-  hs-source-dirs:   src-  ghc-options:      -Wall+  build-depends   : base       >= 4.10  && < 5+                  , aeson      >= 1.3.1+                  , binary     >= 0.8.5+                  , bytestring >= 0.10.8+                  , cereal     >= 0.5.7+                  , linear     >= 1.20.8+                  , milena     >= 0.5.2+                  , mtl        >= 2.2.2+  hs-source-dirs  : src+  ghc-options     : -Wall   default-language: Haskell2010  executable kafka-device-  main-is:          Main.hs-  build-depends:    base-               ,    aeson-               ,    binary-               ,    bytestring-               ,    cereal-               ,    linear-               ,    milena-               ,    mtl-  hs-source-dirs:   src-  ghc-options:      -Wall -threaded+  main-is         : Main.hs+  other-modules   : Network.UI.Kafka+                    Network.UI.Kafka.Types+  build-depends   : base       >= 4.10  && < 5+                  , aeson      >= 1.3.1+                  , binary     >= 0.8.5+                  , bytestring >= 0.10.8+                  , cereal     >= 0.5.7+                  , linear     >= 1.20.8+                  , milena     >= 0.5.2+                  , mtl        >= 2.2.2+  hs-source-dirs  : src+  ghc-options     : -Wall -threaded   default-language: Haskell2010  executable kafka-device-keyboard-  main-is:          MainKeyboard.hs-  build-depends:    base-               ,    aeson-               ,    binary-               ,    bytestring-               ,    cereal-               ,    linear-               ,    milena-               ,    mtl-  hs-source-dirs:   src-  ghc-options:      -Wall -threaded+  main-is         : MainKeyboard.hs+  other-modules   : Network.UI.Kafka+                    Network.UI.Kafka.Keyboard+                    Network.UI.Kafka.Types+  build-depends   : base       >= 4.10  && < 5+                  , aeson      >= 1.3.1+                  , binary     >= 0.8.5+                  , bytestring >= 0.10.8+                  , cereal     >= 0.5.7+                  , linear     >= 1.20.8+                  , milena     >= 0.5.2+                  , mtl        >= 2.2.2+  hs-source-dirs  : src+  ghc-options     : -Wall -threaded   default-language: Haskell2010
src/Main.hs view
@@ -1,10 +1,10 @@ {-| Module      :  $Header$-Copyright   :  (c) 2016-17 Brian W Bush+Copyright   :  (c) 2016-19 Brian W Bush License     :  MIT-Maintainer  :  Brian W Bush <consult@brianwbush.info>-Stability   :  Experimental-Portability :  Stable+Maintainer  :  Brian W Bush <code@functionally.io>+Stability   :  Production+Portability :  Portable  Simple consumer that echos UI events from a Kafka topic to the console. -}
src/MainKeyboard.hs view
@@ -1,10 +1,10 @@ {-| Module      :  $Header$-Copyright   :  (c) 2016-17 Brian W Bush+Copyright   :  (c) 2016-19 Brian W Bush License     :  MIT-Maintainer  :  Brian W Bush <consult@brianwbush.info>-Stability   :  Experimental-Portability :  Stable+Maintainer  :  Brian W Bush <code@functionally.io>+Stability   :  Production+Portability :  Portable  Simple producer of keyboard events from standard input to a Kafka topic. -}
src/Network/UI/Kafka.hs view
@@ -1,17 +1,18 @@ {-| Module      :  $Header$-Copyright   :  (c) 2016-17 Brian W Bush+Copyright   :  (c) 2016-19 Brian W Bush License     :  MIT-Maintainer  :  Brian W Bush <consult@brianwbush.info>-Stability   :  Experimental-Portability :  Stable+Maintainer  :  Brian W Bush <code@functionally.io>+Stability   :  Production+Portability :  Portable  Produce and consume events on Kafka topics. -}  -{-# LANGUAGE DeriveGeneric   #-}-{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric    #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE RecordWildCards  #-}   module Network.UI.Kafka (@@ -104,7 +105,7 @@           liftIO             $ do               mapM_ (uncurry consumer) messages-              threadDelay 7500 -- FIXME: Is a thread delay really necessary in order not to miss messages?  Why?+              threadDelay 100 -- FIXME: Is a thread delay really necessary in order not to miss messages?  Why?           running <- liftIO $ isEmptyMVar exitFlag           when running             $ loop offset'
src/Network/UI/Kafka/Interpretation.hs view
@@ -1,17 +1,16 @@ {-| Module      :  $Header$-Copyright   :  (c) 2016-17 Brian W Bush+Copyright   :  (c) 2016-19 Brian W Bush License     :  MIT-Maintainer  :  Brian W Bush <consult@brianwbush.info>-Stability   :  Experimental-Portability :  Stable+Maintainer  :  Brian W Bush <code@functionally.io>+Stability   :  Production+Portability :  Portable  Interpret user-interfaces events on Kafka topics. -}   {-# LANGUAGE DeriveGeneric        #-}-{-# LANGUAGE OverloadedStrings    #-} {-# LANGUAGE RecordWildCards      #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -160,6 +159,11 @@ fromQuaternion (Quaternion w (V3 x y z)) = OrientationEvent (realToFrac w, realToFrac x, realToFrac y, realToFrac z)  +-- | Convert from degrees to radians.+fromDegrees :: (Floating a, Num a) => a -> a+fromDegrees = (* pi) . (/ 180)++ -- | Location and orientation. type State a = (V3 a, Quaternion a) @@ -184,10 +188,10 @@ interpretationLoop analogHandler buttonHandler interpretation@TrackInterpretation{..} action =   do     first <- newMVar True-    state <- newMVar (location, fromEuler orientation)+    state <- newMVar (location, fromEuler $ fromDegrees <$> orientation)     producerLoop kafka sensor       $ do         isFirst <- readMVar first         if isFirst-          then swapMVar first False >> return [fromV3 location, fromQuaternion $ fromEuler orientation]+          then swapMVar first False >> return [fromV3 location, fromQuaternion $ fromEuler $ fromDegrees <$> orientation]           else action >>= translate state analogHandler buttonHandler interpretation
src/Network/UI/Kafka/Keyboard.hs view
@@ -1,10 +1,10 @@ {-| Module      :  $Header$-Copyright   :  (c) 2016-17 Brian W Bush+Copyright   :  (c) 2016-19 Brian W Bush License     :  MIT-Maintainer  :  Brian W Bush <consult@brianwbush.info>-Stability   :  Experimental-Portability :  Stable+Maintainer  :  Brian W Bush <code@functionally.io>+Stability   :  Production+Portability :  Portable  Produce events on a Kafka topic from standard input. -}@@ -30,8 +30,8 @@     hSetBuffering stdin NoBuffering     hSetEcho stdin False     producerLoop topicConnection sensor-      $ fmap (: [])-      $ KeyEvent+      .   fmap (: [])+      $   KeyEvent       <$> getChar       <*> return Nothing       <*> return Nothing
src/Network/UI/Kafka/Types.hs view
@@ -1,16 +1,16 @@ {-|-Module      :  Network.UI.Kafka.Types-Copyright   :  (c) 2016 Brian W Bush+Module      :  $Header$+Copyright   :  (c) 2016-19 Brian W Bush License     :  MIT-Maintainer  :  Brian W Bush <consult@brianwbush.info>-Stability   :  Experimental-Portability :  Stable+Maintainer  :  Brian W Bush <code@functionally.io>+Stability   :  Beta+Portability :  Portable  Event types. -}  -{-# LANGUAGE DeriveGeneric    #-}+{-# LANGUAGE DeriveGeneric #-}   module Network.UI.Kafka.Types (