Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReScript interface extension '.resi' #6161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5582,6 +5582,7 @@ ReScript:
codemirror_mime_type: text/x-rustsrc
extensions:
- ".res"
- ".resi"
interpreters:
- ocaml
tm_scope: source.rescript
Expand Down
115 changes: 115 additions & 0 deletions samples/ReScript/RedBlackTree.resi
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
type nodeColor = Red | Black

type rec node<'value> = {
mutable left: option<node<'value>>,
mutable right: option<node<'value>>,
mutable parent: option<node<'value>>,
mutable sum: float,
mutable color: nodeColor,
mutable height: float,
mutable value: 'value,
}

type t<'value> = {
mutable size: int,
mutable root: option<node<'value>>,
compare: (. 'value, 'value) => int,
}

let createNode: (~color: nodeColor, ~value: 'a, ~height: float) => node<'a>

external castNotOption: option<'a> => 'a = "%identity"

let updateSumRecursive: ('a, node<'b>) => unit

let grandParentOf: node<'a> => option<node<'a>>

let isLeft: node<'a> => bool

let leftOrRightSet: (~node: node<'a>, node<'b>, option<node<'b>>) => unit

let siblingOf: node<'a> => option<node<'a>>

let uncleOf: node<'a> => option<node<'a>>

let findNode: (t<'a>, option<node<'a>>, 'a) => option<node<'a>>

let has: (t<'a>, 'a) => bool

let peekMinNode: option<node<'a>> => option<node<'a>>

let peekMaxNode: option<node<'a>> => option<node<'a>>

let rotateLeft: (t<'a>, node<'a>) => unit

let rotateRight: (t<'a>, node<'a>) => unit

let findInsert: (t<'a>, option<node<'a>>, node<'a>, 'a) => option<node<'a>>

let _addLoop: (t<'a>, node<'a>) => unit

let add: (t<'a>, 'a, ~height: float) => option<node<'a>>

let removeNode: (t<'a>, node<'a>) => unit

let remove: (t<'a>, 'a) => bool

let findNodeThroughCallback: ('a, option<node<'b>>, (. node<'b>) => int) => option<node<'b>>

let removeThroughCallback: (t<'a>, (. node<'a>) => int) => bool

let make: (~compare: (. 'a, 'a) => int) => t<'a>

let makeWith: (Js.Array2.t<('a, float)>, ~compare: (. 'a, 'a) => int) => t<'a>

let heightOfInterval: (t<'a>, option<'a>, option<'a>) => float

let firstVisibleNode: (option<node<'a>>, float) => option<node<'a>>

let lastVisibleNode: (option<node<'a>>, float) => option<node<'a>>

let firstVisibleValue: (t<'a>, ~top: float) => option<'a>

let leftmost: node<'a> => node<'a>

let firstRightParent: node<'a> => option<node<'a>>

let nextNode: node<'a> => option<node<'a>>

let sumLeftSpine: (node<'a>, ~fromRightChild: bool) => float

let getY: node<'a> => float

let iterate: (
~inclusive: bool,
option<node<'a>>,
option<node<'a>>,
~callback: (. node<'a>) => unit,
) => unit

let iterateWithY: (
~y: float=?,
~inclusive: bool,
option<node<'a>>,
option<node<'a>>,
~callback: (. node<'a>, float) => unit,
) => unit

let updateSum: (option<node<'a>>, ~delta: float) => unit

let updateHeight: (node<'a>, ~height: float) => unit

type oldNewVisible<'value> = {mutable old: array<'value>, mutable new: array<'value>}

let getAnchorDelta: (t<'a>, ~anchor: option<('a, float)>) => float

let onChangedVisible: (
~anchor: option<('a, float)>=?,
t<'a>,
~oldNewVisible: oldNewVisible<'a>,
~top: float,
~bottom: float,
~appear: (. node<'a>, float) => unit,
~remained: (. node<'a>, float) => unit,
~disappear: (. 'a) => unit,
) => unit