on master help sign in
Break dependency between Data.UUID.Internal and Data.Word.Util

Since this is the only place the w8to16 function is actually used, we can just move it from Data.Word.Util to Data.UUID.Internal.

commit12641b77f7acd5195980e12a0cb4e8c12e16ce63 authorBardur Arantsson <bardur@scientician.net> dateSun 4 Jan 2015, 12:24 (12 years ago) parentf02a166
2 files changed+8−8
Data/UUID/Internal.hs+8−1 Data/Word/Util.hs−7
Data/UUID/Internal.hs+8−1
@@ -62,7 +62,6 @@ import qualified Data.ByteString.Lazy as BL
6262import qualified Data.ByteString.Unsafe as BU
6363
6464import Data.UUID.Builder
65−import Data.Word.Util
6665
6766import System.Random
6867
@@ -167,6 +166,14 @@ word a b c d = (fromIntegral a `shiftL` 24)
167166byte :: Int -> Word32 -> Word8
168167byte i w = fromIntegral (w `shiftR` (i * 8))
169168
169+-- |Build a Word16 from two Word8 values, presented in big-endian order.
170+w8to16 :: Word8 -> Word8 -> Word16
171+w8to16 w0s w1s =
172+ (w0 `shiftL` 8) .|. w1
173+ where
174+ w0 = fromIntegral w0s
175+ w1 = fromIntegral w1s
176+
170177
171178-- |Make a UUID from sixteen Word8 values
172179makeFromBytes :: Word8 -> Word8 -> Word8 -> Word8
Data/Word/Util.hs−7
@@ -5,13 +5,6 @@ module Data.Word.Util where
55import Data.Bits
66import Data.Word
77
8−w8to16 :: Word8 -> Word8 -> Word16
9−w8to16 w0s w1s =
10− (w0 `shiftL` 8) .|. w1
11− where
12− w0 = fromIntegral w0s
13− w1 = fromIntegral w1s
14−
158w16to32 :: Word16 -> Word16 -> Word32
169w16to32 w0s w1s =
1710 (w0 `shiftL` 16) .|. w1