File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -98,14 +98,14 @@ getInt32le :: Getter Int
98
98
getInt32le = getter " getInt32" 4 true
99
99
100
100
-- | Fetch uint8 value at a certain index in a `DataView`.
101
- getUint8 :: Getter Int
101
+ getUint8 :: Getter UInt
102
102
getUint8 = getter " getUint8" 1 false
103
103
104
104
-- | Fetch uint16 value at a certain index in a `DataView`.
105
- getUint16be :: Getter Int
105
+ getUint16be :: Getter UInt
106
106
getUint16be = getter " getUint16" 2 false
107
107
108
- getUint16le :: Getter Int
108
+ getUint16le :: Getter UInt
109
109
getUint16le = getter " getUint16" 2 true
110
110
111
111
-- | Fetch uint32 value at a certain index in a `DataView`.
@@ -148,14 +148,14 @@ setInt32le :: Setter Int
148
148
setInt32le = setter " setInt32" true
149
149
150
150
-- | Store uint8 value at a certain index in a `DataView`.
151
- setUint8 :: Setter Int
151
+ setUint8 :: Setter UInt
152
152
setUint8 = setter " setUint8" false
153
153
154
154
-- | Store uint16 value at a certain index in a `DataView`.
155
- setUint16be :: Setter Int
155
+ setUint16be :: Setter UInt
156
156
setUint16be = setter " setUint16" false
157
157
158
- setUint16le :: Setter Int
158
+ setUint16le :: Setter UInt
159
159
setUint16le = setter " setUint16" true
160
160
161
161
-- | Store uint32 value at a certain index in a `DataView`.
Original file line number Diff line number Diff line change @@ -55,16 +55,17 @@ main = do
55
55
twoElementDataView <- do
56
56
ab' <- AB .create 2
57
57
let dv = DV .whole ab'
58
- DV .setUint8 dv 123 0
59
- DV .setUint8 dv 0 1
58
+ DV .setUint8 dv (fromInt 123 ) 0
59
+ DV .setUint8 dv (fromInt 0 ) 1
60
60
pure dv
61
- assertEffEquals (Just 123 ) $ DV .getUint16le twoElementDataView 0
62
- assertEffEquals (Just 31488 ) $ DV .getUint16be twoElementDataView 0
61
+ assertEffEquals (Just $ fromInt 123 ) $ DV .getUint16le twoElementDataView 0
62
+ assertEffEquals (Just $ fromInt 31488 ) $ DV .getUint16be twoElementDataView 0
63
63
assertEffEquals (Just $ fromInt 2 `pow` fromInt 32 - fromInt 1 ) $ do
64
64
ab' <- AB .create 4
65
65
let dv = DV .whole ab'
66
- DV .setUint8 dv 255 0
67
- DV .setUint8 dv 255 1
68
- DV .setUint8 dv 255 2
69
- DV .setUint8 dv 255 3
66
+ t = fromInt 255
67
+ DV .setUint8 dv t 0
68
+ DV .setUint8 dv t 1
69
+ DV .setUint8 dv t 2
70
+ DV .setUint8 dv t 3
70
71
DV .getUint32be dv 0
You can’t perform that action at this time.
0 commit comments