Remove rescript warning 102
This commit is contained in:
parent
6eddb5a4af
commit
cfb969f2b3
|
@ -37,7 +37,7 @@
|
||||||
},
|
},
|
||||||
"refmt": 3,
|
"refmt": 3,
|
||||||
"warnings": {
|
"warnings": {
|
||||||
"number": "+A-42-48-9-30-4-102"
|
"number": "+A-42-48-9-30-4"
|
||||||
},
|
},
|
||||||
"ppx-flags": [
|
"ppx-flags": [
|
||||||
["../../node_modules/bisect_ppx/ppx", "--exclude-files", ".*_test\\.res$$"]
|
["../../node_modules/bisect_ppx/ppx", "--exclude-files", ".*_test\\.res$$"]
|
||||||
|
|
|
@ -101,10 +101,16 @@ let toSparkline = (t: t, ~sampleCount: int, ~bucketCount: int=20, ()): result<st
|
||||||
)
|
)
|
||||||
|
|
||||||
module Truncate = {
|
module Truncate = {
|
||||||
let trySymbolicSimplification = (leftCutoff, rightCutoff, t: t): option<t> =>
|
let trySymbolicSimplification = (
|
||||||
|
leftCutoff: option<float>,
|
||||||
|
rightCutoff: option<float>,
|
||||||
|
t: t,
|
||||||
|
): option<t> =>
|
||||||
switch (leftCutoff, rightCutoff, t) {
|
switch (leftCutoff, rightCutoff, t) {
|
||||||
| (None, None, _) => None
|
| (None, None, _) => None
|
||||||
| (lc, rc, Symbolic(#Uniform(u))) if lc < rc =>
|
| (Some(lc), Some(rc), Symbolic(#Uniform(u))) if lc < rc =>
|
||||||
|
Some(Symbolic(#Uniform(SymbolicDist.Uniform.truncate(Some(lc), Some(rc), u))))
|
||||||
|
| (lc, rc, Symbolic(#Uniform(u))) =>
|
||||||
Some(Symbolic(#Uniform(SymbolicDist.Uniform.truncate(lc, rc, u))))
|
Some(Symbolic(#Uniform(SymbolicDist.Uniform.truncate(lc, rc, u))))
|
||||||
| _ => None
|
| _ => None
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ module Int = {
|
||||||
}
|
}
|
||||||
/* Utils */
|
/* Utils */
|
||||||
module U = {
|
module U = {
|
||||||
let isEqual = (a, b) => a == b
|
let isEqual = \"=="
|
||||||
let toA = a => [a]
|
let toA = a => [a]
|
||||||
let id = e => e
|
let id = e => e
|
||||||
}
|
}
|
||||||
|
@ -340,8 +340,6 @@ module A = {
|
||||||
let reduce = Belt.Array.reduce
|
let reduce = Belt.Array.reduce
|
||||||
let reducei = Belt.Array.reduceWithIndex
|
let reducei = Belt.Array.reduceWithIndex
|
||||||
let isEmpty = r => length(r) < 1
|
let isEmpty = r => length(r) < 1
|
||||||
let min = a => get(a, 0) |> O.fmap(first => Belt.Array.reduce(a, first, (i, j) => i < j ? i : j))
|
|
||||||
let max = a => get(a, 0) |> O.fmap(first => Belt.Array.reduce(a, first, (i, j) => i > j ? i : j))
|
|
||||||
let stableSortBy = Belt.SortArray.stableSortBy
|
let stableSortBy = Belt.SortArray.stableSortBy
|
||||||
let toRanges = (a: array<'a>) =>
|
let toRanges = (a: array<'a>) =>
|
||||||
switch a |> Belt.Array.length {
|
switch a |> Belt.Array.length {
|
||||||
|
@ -448,8 +446,11 @@ module A = {
|
||||||
| (Some(min), Some(max)) => Some(max -. min)
|
| (Some(min), Some(max)) => Some(max -. min)
|
||||||
| _ => None
|
| _ => None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let floatCompare: (float, float) => int = compare
|
||||||
|
|
||||||
let binarySearchFirstElementGreaterIndex = (ar: array<'a>, el: 'a) => {
|
let binarySearchFirstElementGreaterIndex = (ar: array<'a>, el: 'a) => {
|
||||||
let el = Belt.SortArray.binarySearchBy(ar, el, compare)
|
let el = Belt.SortArray.binarySearchBy(ar, el, floatCompare)
|
||||||
let el = el < 0 ? el * -1 - 1 : el
|
let el = el < 0 ? el * -1 - 1 : el
|
||||||
switch el {
|
switch el {
|
||||||
| e if e >= length(ar) => #overMax
|
| e if e >= length(ar) => #overMax
|
||||||
|
@ -460,13 +461,13 @@ module A = {
|
||||||
|
|
||||||
let concat = (t1: array<'a>, t2: array<'a>) => {
|
let concat = (t1: array<'a>, t2: array<'a>) => {
|
||||||
let ts = Belt.Array.concat(t1, t2)
|
let ts = Belt.Array.concat(t1, t2)
|
||||||
ts |> Array.fast_sort(compare)
|
ts |> Array.fast_sort(floatCompare)
|
||||||
ts
|
ts
|
||||||
}
|
}
|
||||||
|
|
||||||
let concatMany = (t1: array<array<'a>>) => {
|
let concatMany = (t1: array<array<'a>>) => {
|
||||||
let ts = Belt.Array.concatMany(t1)
|
let ts = Belt.Array.concatMany(t1)
|
||||||
ts |> Array.fast_sort(compare)
|
ts |> Array.fast_sort(floatCompare)
|
||||||
ts
|
ts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,6 +526,9 @@ module A = {
|
||||||
let diff = (max -. min) /. Belt.Float.fromInt(n - 1)
|
let diff = (max -. min) /. Belt.Float.fromInt(n - 1)
|
||||||
Belt.Array.makeBy(n, i => min +. Belt.Float.fromInt(i) *. diff)
|
Belt.Array.makeBy(n, i => min +. Belt.Float.fromInt(i) *. diff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let min = Js.Math.minMany_float
|
||||||
|
let max = Js.Math.maxMany_float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ let create = (relativeHeights: array<float>, ~maximum=?, ()) => {
|
||||||
if E.A.length(relativeHeights) === 0 {
|
if E.A.length(relativeHeights) === 0 {
|
||||||
""
|
""
|
||||||
} else {
|
} else {
|
||||||
let maximum = maximum->E.O2.default(E.A.max(relativeHeights)->E.O2.toExn(""))
|
let maximum = maximum->E.O2.default(E.A.Floats.max(relativeHeights))
|
||||||
|
|
||||||
relativeHeights
|
relativeHeights
|
||||||
->E.A2.fmap(_heightToTickIndex(maximum))
|
->E.A2.fmap(_heightToTickIndex(maximum))
|
||||||
|
|
|
@ -60,8 +60,8 @@ module T = {
|
||||||
|
|
||||||
module Ts = {
|
module Ts = {
|
||||||
type t = T.ts
|
type t = T.ts
|
||||||
let minX = (t: t) => t |> E.A.fmap(T.minX) |> E.A.min |> extImp
|
let minX = (t: t) => t |> E.A.fmap(T.minX) |> E.A.Floats.min
|
||||||
let maxX = (t: t) => t |> E.A.fmap(T.maxX) |> E.A.max |> extImp
|
let maxX = (t: t) => t |> E.A.fmap(T.maxX) |> E.A.Floats.max
|
||||||
let equallyDividedXs = (t: t, newLength) => E.A.Floats.range(minX(t), maxX(t), newLength)
|
let equallyDividedXs = (t: t, newLength) => E.A.Floats.range(minX(t), maxX(t), newLength)
|
||||||
let allXs = (t: t) => t |> E.A.fmap(T.xs) |> E.A.Sorted.concatMany
|
let allXs = (t: t) => t |> E.A.fmap(T.xs) |> E.A.Sorted.concatMany
|
||||||
}
|
}
|
||||||
|
@ -220,8 +220,8 @@ module XsConversion = {
|
||||||
|
|
||||||
module Zipped = {
|
module Zipped = {
|
||||||
type zipped = array<(float, float)>
|
type zipped = array<(float, float)>
|
||||||
let compareYs = ((_, y1), (_, y2)) => y1 > y2 ? 1 : 0
|
let compareYs = ((_, y1): (float, float), (_, y2): (float, float)) => y1 > y2 ? 1 : 0
|
||||||
let compareXs = ((x1, _), (x2, _)) => x1 > x2 ? 1 : 0
|
let compareXs = ((x1, _): (float, float), (x2, _): (float, float)) => x1 > x2 ? 1 : 0
|
||||||
let sortByY = (t: zipped) => t |> E.A.stableSortBy(_, compareYs)
|
let sortByY = (t: zipped) => t |> E.A.stableSortBy(_, compareYs)
|
||||||
let sortByX = (t: zipped) => t |> E.A.stableSortBy(_, compareXs)
|
let sortByX = (t: zipped) => t |> E.A.stableSortBy(_, compareXs)
|
||||||
let filterByX = (testFn: float => bool, t: zipped) => t |> E.A.filter(((x, _)) => testFn(x))
|
let filterByX = (testFn: float => bool, t: zipped) => t |> E.A.filter(((x, _)) => testFn(x))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user