Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GHC 7.4 compatibility. Version bump.

  • Loading branch information...
commit 96be2f00c846984ce7f88084fdc9344445a52ca0 1 parent 7f2fb13
@mitar authored
Showing with 12 additions and 12 deletions.
  1. +6 −6 NXT.cabal
  2. +6 −6 lib/Robotics/NXT/Data.hs
View
12 NXT.cabal
@@ -1,5 +1,5 @@
Name: NXT
-Version: 0.2.1
+Version: 0.2.2
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
@@ -16,7 +16,7 @@ License: LGPL-3
License-file: LICENSE
Author: Mitar Milutinovic
Maintainer: mitar.haskell@tnode.com
-Copyright: (c) 2011 Mitar Milutinovic
+Copyright: (c) 2011-2012 Mitar Milutinovic
Category: Robotics
Build-type: Simple
Cabal-version: >= 1.10
@@ -69,7 +69,7 @@ Executable nxt-shutdown
HS-source-dirs: src
Build-depends: base >= 4.3 && < 5,
mtl >= 1.1 && < 3,
- NXT == 0.2.1
+ NXT == 0.2.2
GHC-options: -Wall
Default-language: Haskell2010
@@ -78,7 +78,7 @@ Executable nxt-status
HS-source-dirs: src
Build-depends: base >= 4.3 && < 5,
mtl >= 1.1 && < 3,
- NXT == 0.2.1
+ NXT == 0.2.2
GHC-options: -Wall
Default-language: Haskell2010
@@ -89,7 +89,7 @@ Executable nxt-upload
mtl >= 1.1 && < 3,
bytestring >= 0.9 && < 1,
filepath >= 1.1 && < 2,
- NXT == 0.2.1
+ NXT == 0.2.2
GHC-options: -Wall
Default-language: Haskell2010
@@ -106,7 +106,7 @@ Test-suite nxt-tests
time >= 1.2 && < 2,
bytestring >= 0.9 && < 1.0,
filepath >= 1.2 && < 2,
- NXT == 0.2.1
+ NXT == 0.2.2
GHC-options: -Wall -rtsopts
Default-language: Haskell2010
HS-source-dirs: tests
View
12 lib/Robotics/NXT/Data.hs
@@ -74,30 +74,30 @@ intToData x = unfoldr getByte x
where getByte 0x00 = Nothing
getByte y = Just (fromIntegral $ y `mod` 0x100, y `div` 0x100)
-toUByte :: Integral a => a -> [Word8] -- one byte, unsigned
+toUByte :: (Show a, Integral a) => a -> [Word8] -- one byte, unsigned
toUByte x | x >= 0x00 && x <= 0xFF = intToData x
| otherwise = throw . PatternMatchFail $ "toUByte: " ++ show x
-toUWord :: Integral a => a -> [Word8] -- two bytes, unsigned, least significant byte first
+toUWord :: (Show a, Integral a) => a -> [Word8] -- two bytes, unsigned, least significant byte first
toUWord x | x >= 0x00 && x <= 0xFFFF = take 2 . flip (++) (repeat 0x00) . intToData $ x
| otherwise = throw . PatternMatchFail $ "toUWord: " ++ show x
-toULong :: Integral a => a -> [Word8] -- four bytes, unsigned, least significant byte first
+toULong :: (Show a, Integral a) => a -> [Word8] -- four bytes, unsigned, least significant byte first
toULong x | x' >= 0x00 && x' <= 0xFFFFFFFF = take 4 . flip (++) (repeat 0x00) . intToData $ x'
| otherwise = throw . PatternMatchFail $ "toULong: " ++ show x
where x' = fromIntegral x :: Integer
-toSByte :: Integral a => a -> [Word8] -- one byte, signed
+toSByte :: (Show a, Integral a) => a -> [Word8] -- one byte, signed
toSByte x | x >= (-0x80) && x < 0x00 = intToData $ 0x100 + x
| x >= 0x00 && x <= 0x7F = intToData x
| otherwise = throw . PatternMatchFail $ "toSByte: " ++ show x
-toSWord :: Integral a => a -> [Word8] -- two bytes, signed, least significant byte first
+toSWord :: (Show a, Integral a) => a -> [Word8] -- two bytes, signed, least significant byte first
toSWord x | x >= (-0x8000) && x < 0x00 = take 2 . flip (++) (repeat 0x00) . intToData $ 0x10000 + x
| x >= 0x00 && x <= 0x7FFF = take 2 . flip (++) (repeat 0x00) . intToData $ x
| otherwise = throw . PatternMatchFail $ "toSWord: " ++ show x
-toSLong :: Integral a => a -> [Word8] -- four bytes, signed, least significant byte first
+toSLong :: (Show a, Integral a) => a -> [Word8] -- four bytes, signed, least significant byte first
toSLong x | x' >= (-0x80000000) && x' < 0x00 = take 4 . flip (++) (repeat 0x00) . intToData $ 0x100000000 + x'
| x' >= 0x00 && x' <= 0x7FFFFFFF = take 4 . flip (++) (repeat 0x00) . intToData $ x'
| otherwise = throw . PatternMatchFail $ "toSLong: " ++ show x
Please sign in to comment.
Something went wrong with that request. Please try again.