-
-
Save anonymous/93e86d5c60b277729cfa6227e37c055a to your computer and use it in GitHub Desktop.
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 Connection = | |
struct | |
type connecting = { | |
when_initialized: int;} | |
type connected = { | |
session_id: string;} | |
type disconnected = { | |
when_disconnected: int;} | |
type state = | |
| Connecting of connecting | |
| Connected of connected | |
| Disconnected of disconnected | |
type t = { | |
state: state; | |
host: string;} | |
end | |
module App = | |
struct | |
open Connection | |
let connection = | |
{ | |
state = ((Connected ({ session_id = "ABC" }))[@explicit_arity ]); | |
host = "localhost" | |
} | |
let _ = print_endline connection.host | |
let _ = | |
print_endline | |
(match connection.state with | |
| ((Connected (p))[@explicit_arity ]) -> p.session_id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment