@@ -48,17 +48,17 @@ module Data.ArrayBuffer.DataView
48
48
, whole
49
49
) where
50
50
51
- import Prelude (class Eq , (==), (<>))
52
-
53
51
import Data.ArrayBuffer.Types (ArrayBuffer , ByteLength , ByteOffset , DataView , Float32 , Float64 , Int16 , Int32 , Int8 , Uint16 , Uint32 , Uint8 , Uint8Clamped , kind ArrayViewType )
54
52
import Data.ArrayBuffer.ValueMapping (class BinaryValue , class BytesPerValue )
55
- import Data.Maybe (Maybe (..))
53
+ import Data.Float32 (Float32 ) as F
54
+ import Data.Maybe (Maybe )
55
+ import Data.Nullable (Nullable , toMaybe )
56
+ import Data.Symbol (SProxy (..), class IsSymbol , reflectSymbol )
56
57
import Data.Typelevel.Num (toInt' , class Nat )
57
58
import Data.UInt (UInt )
58
- import Data.Float32 (Float32 ) as F
59
- import Data.Symbol (SProxy (..), class IsSymbol , reflectSymbol )
60
59
import Effect (Effect )
61
60
import Effect.Uncurried (EffectFn2 , EffectFn3 , EffectFn4 , runEffectFn2 , runEffectFn3 , runEffectFn4 )
61
+ import Prelude (class Eq , (<$>), (<>), (==))
62
62
import Type.Proxy (Proxy (..))
63
63
64
64
@@ -122,24 +122,20 @@ instance showArrayViewTypeViewFloat32 :: ShowArrayViewType Float32 "Float32"
122
122
instance showArrayViewTypeViewFloat64 :: ShowArrayViewType Float64 " Float64"
123
123
124
124
foreign import getterImpl :: forall t
125
- . EffectFn3 { just :: t -> Maybe t
126
- , nothing :: Maybe t
127
- , functionName :: String
125
+ . EffectFn3 { functionName :: String
128
126
, littleEndian :: Boolean
129
127
, bytesPerValue :: ByteLength
130
- } DataView ByteOffset (Maybe t )
128
+ } DataView ByteOffset (Nullable t )
131
129
132
130
getter :: forall t .
133
131
{ functionName :: String
134
132
, bytesPerValue :: ByteLength
135
133
, littleEndian :: Boolean
136
134
}
137
135
-> DataView -> ByteOffset -> Effect (Maybe t )
138
- getter data' d o =
136
+ getter data' d o = toMaybe <$>
139
137
runEffectFn3 getterImpl
140
- { just: Just
141
- , nothing: Nothing
142
- , functionName: data'.functionName
138
+ { functionName: data'.functionName
143
139
, littleEndian: data'.littleEndian
144
140
, bytesPerValue: data'.bytesPerValue
145
141
} d o
0 commit comments