Last active
June 15, 2017 16:11
-
-
Save kjnilsson/aebedfa382e849e1c4ee1c6a6f62060d to your computer and use it in GitHub Desktop.
Fez - use DUs or Enums to represent atoms.
This file contains hidden or 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 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