0 | module JS.Buffer
  1 |
  2 | import JS.Marshall
  3 |
  4 | %default total
  5 |
  6 | export
  7 | data ArrayBuffer : Type where [external]
  8 |
  9 | export
 10 | ToFFI ArrayBuffer ArrayBuffer where toFFI = id
 11 |
 12 | export
 13 | FromFFI ArrayBuffer ArrayBuffer where fromFFI = Just
 14 |
 15 |
 16 | export
 17 | data UInt8ClampedArray : Type where [external]
 18 |
 19 | export
 20 | ToFFI UInt8ClampedArray UInt8ClampedArray where toFFI = id
 21 |
 22 | export
 23 | FromFFI UInt8ClampedArray UInt8ClampedArray where fromFFI = Just
 24 |
 25 | %foreign "javascript:lambda:x => new Uint8ClampedArray(x)"
 26 | prim__toUint8ClampedArray : ArrayBuffer -> UInt8ClampedArray
 27 |
 28 | export
 29 | Cast ArrayBuffer UInt8ClampedArray where
 30 |   cast = prim__toUint8ClampedArray
 31 |
 32 |
 33 | export
 34 | data UInt8Array : Type where [external]
 35 |
 36 | export
 37 | ToFFI UInt8Array UInt8Array where toFFI = id
 38 |
 39 | export
 40 | FromFFI UInt8Array UInt8Array where fromFFI = Just
 41 |
 42 | %foreign "javascript:lambda:x => new Uint8Array(x)"
 43 | prim__toUint8Array : ArrayBuffer -> UInt8Array
 44 |
 45 | export
 46 | Cast ArrayBuffer UInt8Array where
 47 |   cast = prim__toUint8Array
 48 |
 49 |
 50 | export
 51 | data UInt16Array : Type where [external]
 52 |
 53 | export
 54 | ToFFI UInt16Array UInt16Array where toFFI = id
 55 |
 56 | export
 57 | FromFFI UInt16Array UInt16Array where fromFFI = Just
 58 |
 59 | %foreign "javascript:lambda:x => new Uint16Array(x)"
 60 | prim__toUint16Array : ArrayBuffer -> UInt16Array
 61 |
 62 | export
 63 | Cast ArrayBuffer UInt16Array where
 64 |   cast = prim__toUint16Array
 65 |
 66 |
 67 | export
 68 | data UInt32Array : Type where [external]
 69 |
 70 | export
 71 | ToFFI UInt32Array UInt32Array where toFFI = id
 72 |
 73 | export
 74 | FromFFI UInt32Array UInt32Array where fromFFI = Just
 75 |
 76 | %foreign "javascript:lambda:x => new Uint32Array(x)"
 77 | prim__toUint32Array : ArrayBuffer -> UInt32Array
 78 |
 79 | export
 80 | Cast ArrayBuffer UInt32Array where
 81 |   cast = prim__toUint32Array
 82 |
 83 |
 84 | export
 85 | data Int8Array : Type where [external]
 86 |
 87 | export
 88 | ToFFI Int8Array Int8Array where toFFI = id
 89 |
 90 | export
 91 | FromFFI Int8Array Int8Array where fromFFI = Just
 92 |
 93 | %foreign "javascript:lambda:x => new Int8Array(x)"
 94 | prim__toInt8Array : ArrayBuffer -> Int8Array
 95 |
 96 | export
 97 | Cast ArrayBuffer Int8Array where
 98 |   cast = prim__toInt8Array
 99 |
100 |
101 | export
102 | data Int16Array : Type where [external]
103 |
104 | export
105 | ToFFI Int16Array Int16Array where toFFI = id
106 |
107 | export
108 | FromFFI Int16Array Int16Array where fromFFI = Just
109 |
110 | %foreign "javascript:lambda:x => new Int16Array(x)"
111 | prim__toInt16Array : ArrayBuffer -> Int16Array
112 |
113 | export
114 | Cast ArrayBuffer Int16Array where
115 |   cast = prim__toInt16Array
116 |
117 |
118 | export
119 | data Int32Array : Type where [external]
120 |
121 | export
122 | ToFFI Int32Array Int32Array where toFFI = id
123 |
124 | export
125 | FromFFI Int32Array Int32Array where fromFFI = Just
126 |
127 | %foreign "javascript:lambda:x => new Int32Array(x)"
128 | prim__toInt32Array : ArrayBuffer -> Int32Array
129 |
130 | export
131 | Cast ArrayBuffer Int32Array where
132 |   cast = prim__toInt32Array
133 |
134 |
135 | export
136 | data Float32Array : Type where [external]
137 |
138 | export
139 | ToFFI Float32Array Float32Array where toFFI = id
140 |
141 | export
142 | FromFFI Float32Array Float32Array where fromFFI = Just
143 |
144 | %foreign "javascript:lambda:x => new Float32Array(x)"
145 | prim__toFloat32Array : ArrayBuffer -> Float32Array
146 |
147 | export
148 | Cast ArrayBuffer Float32Array where
149 |   cast = prim__toFloat32Array
150 |
151 |
152 | export
153 | data Float64Array : Type where [external]
154 |
155 | export
156 | ToFFI Float64Array Float64Array where toFFI = id
157 |
158 | export
159 | FromFFI Float64Array Float64Array where fromFFI = Just
160 |
161 | %foreign "javascript:lambda:x => new Float64Array(x)"
162 | prim__toFloat64Array : ArrayBuffer -> Float64Array
163 |
164 | export
165 | Cast ArrayBuffer Float64Array where
166 |   cast = prim__toFloat64Array
167 |
168 |
169 | export
170 | data DataView : Type where [external]
171 |
172 | export
173 | ToFFI DataView DataView where toFFI = id
174 |
175 | export
176 | FromFFI DataView DataView where fromFFI = Just
177 |