This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module type SlotsType = { | |
type t('slot, 'nextSlots); | |
let create: unit => t('slot, 'nextSlots); | |
let use: | |
(~default: 'slot, t('slot, t('slot2, 'nextSlots))) => | |
('slot, t('slot2, 'nextSlots)); | |
}; | |
module Slots: SlotsType = { | |
type t('slot, 'nextSlots) = ref(option(('slot, 'nextSlots))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module type SlotsType = { | |
type t('slot, 'nextSlots); | |
let create: unit => t('slot, 'nextSlots); | |
let use: | |
( | |
~default: 'slot, | |
('slot, t('slot2, 'nextSlots)) => 'c, | |
t('slot, t('slot2, 'nextSlots)) | |
) => | |
'c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module State: { | |
type t('a); | |
let createSlot: (t('a) => 'b) => 'b; | |
let useHook: ('a, t('a)) => ('a, 'a => unit); | |
} = { | |
type t('a) = ref(option('a)); | |
let createSlot = cont => cont(ref(None)); | |
let useHook = (initial: 'a, slot: t('a)) => { | |
let state = | |
switch (slot^) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HookTypes = { | |
type state('a); | |
type effect; | |
type t('t); | |
let addState: (t('t), ~state: 'state) => t(('t, state('state))) = | |
(x, ~state as _) => Obj.magic(x); | |
let addEffect: t('t) => t(('t, effect)) = Obj.magic; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = (~name, ~surname, _) => { | |
print_string("name: " ++ name); | |
print_string("surname: " ++ surname); | |
}; | |
module State: { | |
type t('a); | |
let init: 'a => t('a); | |
let get: t('a) => 'a; | |
let set: (t('a), 'a) => unit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type other; | |
let compareOther: (other, other) => int = assert(false); | |
let equalOther: (other, other) => bool = assert(false); | |
type runtimeValue = | |
| Undefined | |
| BoxUndefined(int) | |
| Null | |
| Other(other); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Button = { | |
type size = | |
| Small | |
| | |
| Medium | |
| Large; | |
}; | |
module Button = { | |
type size = |
NewerOlder