Created
July 20, 2019 22:41
-
-
Save calebh/13a47a5db77e4ac06fac6fdb78e57798 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
let rec kindStack numTyArgs = | |
match numTyArgs with | |
| 0 -> Star | |
| n -> KFun (Star, kindStack (n - 1)) | |
let tNumber = TConExpr (TyCon (TyConNumber, Star)) | |
let tBool = TConExpr (TyCon (TyConBool, Star)) | |
let tUnit = TConExpr (TyCon (TyConUnit, Star)) | |
let tArrow = TConExpr (TyCon (TyConFun, KFun (Star, KFun (Star, Star)))) | |
let tFun tArg tBody = TApExpr (TApExpr (tArrow, tArg), tBody) | |
let tComma numArgs = TConExpr (TyCon (TyConTuple, kindStack numArgs)) | |
let tTuple tArgs = | |
let numArgs = List.length tArgs | |
List.fold | |
(fun accumTyExpr tyArg -> | |
TApExpr (accumTyExpr, tyArg)) | |
(tComma numArgs) | |
tArgs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment