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
9898getInt32le = getter " getInt32" 4 true
9999
100100-- | Fetch uint8 value at a certain index in a `DataView`.
101- getUint8 :: Getter Int
101+ getUint8 :: Getter UInt
102102getUint8 = getter " getUint8" 1 false
103103
104104-- | Fetch uint16 value at a certain index in a `DataView`.
105- getUint16be :: Getter Int
105+ getUint16be :: Getter UInt
106106getUint16be = getter " getUint16" 2 false
107107
108- getUint16le :: Getter Int
108+ getUint16le :: Getter UInt
109109getUint16le = getter " getUint16" 2 true
110110
111111-- | Fetch uint32 value at a certain index in a `DataView`.
@@ -148,14 +148,14 @@ setInt32le :: Setter Int
148148setInt32le = setter " setInt32" true
149149
150150-- | Store uint8 value at a certain index in a `DataView`.
151- setUint8 :: Setter Int
151+ setUint8 :: Setter UInt
152152setUint8 = setter " setUint8" false
153153
154154-- | Store uint16 value at a certain index in a `DataView`.
155- setUint16be :: Setter Int
155+ setUint16be :: Setter UInt
156156setUint16be = setter " setUint16" false
157157
158- setUint16le :: Setter Int
158+ setUint16le :: Setter UInt
159159setUint16le = setter " setUint16" true
160160
161161-- | 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
5555 twoElementDataView <- do
5656 ab' <- AB .create 2
5757 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
6060 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
6363 assertEffEquals (Just $ fromInt 2 `pow` fromInt 32 - fromInt 1 ) $ do
6464 ab' <- AB .create 4
6565 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
7071 DV .getUint32be dv 0
You can’t perform that action at this time.
0 commit comments