package tablecloth-native
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Native OCaml library implementing Tablecloth, a cross-platform standard library for OCaml and Rescript
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.0.8.tar.gz
md5=0c71dd4035d6fa4978baabc3c932dba3
sha512=44ba09f1ff43e61403703cc244e91e0f8062bd9da998f031430d701a4de148b02878f7f881303f6ded261176f21926ab5ba00a313510ed8e2d2f252b3fd00054
doc/tablecloth-native/Tablecloth/Comparator/index.html
Module Tablecloth.Comparator
Comparator provide a way for custom data structures to be used with Maps and Sets
Say we have a module Book which we want to be able to create a Set of
module Book = struct
type t = {
isbn: string;
title: string;
}
let compare bookA bookB =
String.compare bookA.isbn bookb.isbn
endFirst we need to make our module conform to the S signature.
This can be done by using the Make functor.
module Book = struct
type t = {
isbn: string;
title: string;
}
let compare bookA bookB =
String.compare bookA.isbn bookb.isbn
include Comparator.Make(struct
type nonrec t = t
let compare = compare
end)
endNow we can create a Set of books
Set.fromList (module Book) [
{ isbn="9788460767923"; title="Moby Dick or The Whale" }
]A type alias that is useful typing functions which accept first class modules like Map.empty or Set.fromArray
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>