packages feed

NXT 0.1.4 → 0.1.5

raw patch · 3 files changed

+15/−14 lines, 3 filesdep ~NXTdep ~basedep ~mtl

Dependency ranges changed: NXT, base, mtl

Files

NXT.cabal view
@@ -1,5 +1,5 @@ Name:                NXT-Version:             0.1.4+Version:             0.1.5 Synopsis:            A Haskell interface to Lego Mindstorms NXT Description:         A Haskell interface to Lego Mindstorms NXT over Bluetoooth. It supports direct commands, messages and                      many sensors (also unofficial). It has also support for a simple message-based control of a NXT brick@@ -33,8 +33,8 @@                        Robotics.NXT.Remote,                        Robotics.NXT.Sensor.Compass,                        Robotics.NXT.Sensor.Ultrasonic-  Build-depends:       base >= 4 && < 5,-                       mtl >= 1.1 && < 2,+  Build-depends:       base >= 4.3 && < 5,+                       mtl >= 1.1 && < 3,                        bytestring >= 0.9 && < 1,                        unix >= 2.4 && < 3,                        time >= 1.1 && < 2@@ -57,19 +57,19 @@ Executable nxt-shutdown   Main-is:             Shutdown.hs   HS-source-dirs:      src-  Build-depends:       base >= 4 && < 5,-                       mtl >= 1.1 && < 2,-                       NXT == 0.1.4+  Build-depends:       base >= 4.3 && < 5,+                       mtl >= 1.1 && < 3,+                       NXT == 0.1.5   GHC-options:         -Wall  Executable nxt-upload   Main-is:             UploadFiles.hs   HS-source-dirs:      src-  Build-depends:       base >= 4 && < 5,-                       mtl >= 1.1 && < 2,+  Build-depends:       base >= 4.3 && < 5,+                       mtl >= 1.1 && < 3,                        bytestring >= 0.9 && < 1,                        filepath >= 1.1 && < 2,-                       NXT == 0.1.4+                       NXT == 0.1.5   GHC-options:         -Wall   GHC-prof-options:    -Wall   GHC-shared-options:  -Wall
lib/Robotics/NXT/MotorControl.hs view
@@ -77,10 +77,12 @@   liftIO $ threadDelay (10 * 1000) -- 10 ms   replies <- mapM (\_ -> motorControlReceive) ports''   liftIO $ threadDelay (10 * 1000) -- 10 ms-  let replies' = map (\[p, r] -> ([p], r == '1')) replies+  let replies' = map ready replies   return $ map (fromJust . (`lookup` replies')) ports'     where ports' = map (show . fromEnum) ports           ports'' = nub ports'+          ready [p, r] = ([p], r == '1')+          ready _      = undefined  {-| Interface to @CLASSIC_MOTORCMD@ command which is very similar to 'setOutputState' but better interacts with @MotorControl@.
lib/Robotics/NXT/Protocol.hs view
@@ -131,7 +131,7 @@  -- TODO: All functions which requests ModuleInfo could populate module ID cache along the way -- TODO: Add an optional warning if direction of communication changes--- TODO: Implement all missing "confirm" versions+-- TODO: Implement all missing "confirm" versions of functions  -- Foreign function call for C function which initialize serial port device on POSIX systems foreign import ccall unsafe "initSerialPort" initSerialPort' :: Fd -> IO CInt@@ -175,15 +175,14 @@   hClose h   when debug $ hPutStrLn stderr "terminated" --- TODO: Change to mask/restore in GHC 7.0 {-| Function which initializes and terminates Bluetooth connection to the NXT brick (using 'initialize' and 'terminate') and in-between runs given computation. It terminates Bluetooth connection on an exception, too, rethrowing it afterwards. -} withNXT :: FilePath -> NXT a -> IO a-withNXT device action = block $ do+withNXT device action = mask $ \restore -> do   i <- initialize device-  (r, i') <- unblock (runNXT action i) `onException` terminate i+  (r, i') <- restore (runNXT action i) `onException` terminate i   terminate i'   return r