Skip to content

Instantly share code, notes, and snippets.

@kjnilsson
Last active June 15, 2017 16:11
Show Gist options
  • Select an option

  • Save kjnilsson/aebedfa382e849e1c4ee1c6a6f62060d to your computer and use it in GitHub Desktop.

Select an option

Save kjnilsson/aebedfa382e849e1c4ee1c6a6f62060d to your computer and use it in GitHub Desktop.
Fez - use DUs or Enums to represent atoms.
type TU =
| second = 0L
| millisecond = 99L
[<ErlangTerm>]
type TimeUnit =
| Second
| Millisecond
| Microsecond
| Nanosecond
| Native
| Perf_counter
| Integer of int //erased to value
| SomeTuple of int * string //erased to tuple
[<ModCall("os", "system_time")>]
let os_system_time (opt : TimeUnit) =
0L //dummy
[<ModCall("erlang", "system_time")>]
let erlang_system_time (opt : TU) =
0L //dummy
let now () =
erlang_system_time(TU.millisecond),
os_system_time(SomeTuple (1, "adf")),
os_system_time(Second),
os_system_time(Integer 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment