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, 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 HookTypes = { | |
type state('a); | |
type effect; | |
type t('t); | |
let addState: (~state: 'state, t('t)) => t(('t, state('state))) = | |
(~state as _, x) => 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
type startOptionsJS; | |
[@bs.obj] | |
external makeStartOptionsJS : | |
( | |
~host: string=?, | |
~port: int=?, | |
~serialoscHost: string=?, | |
~serialoscPort: int=?, | |
~startDevices: Js.boolean=?, |
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 ReactComponent = { | |
let component: ReasonReact.componentSpec(ReasonReact.stateless, ReasonReact.stateless, ReasonReact.noRetainedProps, ReasonReact.noRetainedProps, ReasonReact.actionless); | |
/* This is the main issue, each component has its own make signature */ | |
let make: 'a => ReasonReact.componentSpec(ReasonReact.stateless, ReasonReact.stateless, ReasonReact.noRetainedProps, ReasonReact.noRetainedProps, ReasonReact.actionless); | |
}; | |
module Greeting: ReactComponent = { | |
let component = ReasonReact.statelessComponent("Greeting"); | |
let make = (_children) => { | |
...component, |
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 tokenizer input => { | |
let rec tok input current tokens => | |
switch input { | |
| [] => List.rev tokens | |
| _ => | |
let head = List.hd input; | |
let tail = List.tl input; | |
let next = tok tail; | |
switch (head, current, tokens) { | |
/* State: None */ |
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 explode s => { | |
let rec exp i l => | |
if (i < 0) { | |
l | |
} else { | |
exp (i - 1) [s.[i], ...l] | |
}; | |
exp (String.length s - 1) [] | |
}; |
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 tokenMachine = { | |
current: option token, | |
parsed: list token | |
}; | |
let machine = {current: None, parsed: []}; |
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 token = | |
| OpenParen | |
| CloseParen | |
| Number string | |
| String string | |
| Name string; |
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 shape = | |
| Circle float | |
| Rectangle float float | |
| Prism float float float; | |
let rect = Rectangle 2.5 5.0; |