-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow type annotations on expressions (#60)
* compiler: wip - allow type annotations on exprs [skip ci] it won't pass! * compiler: mostly working now * cogent: use type annotation for #31. reenable tc test in ci
- Loading branch information
Zilin Chen
authored
Jan 19, 2017
1 parent
ff23824
commit 691597b
Showing
9 changed files
with
118 additions
and
37 deletions.
There are no files selected for viewing
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
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
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
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
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
File renamed without changes.
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
type OstoreState | ||
|
||
type Obj | ||
|
||
type R a b = <Success a | Error b> | ||
type RR c a b = (c, R a b) | ||
|
||
type BufOffs = U32 | ||
deep_freeObj: Obj -> () | ||
get_Obj : () -> Obj | ||
|
||
type ObjAddr | ||
index_get_addr : () -> #ObjAddr | ||
|
||
success : all (b, a). a -> R a b | ||
success a = Success a | ||
|
||
ostore_read: OstoreState -> RR OstoreState Obj () | ||
ostore_read ostore_st = | ||
let addr = index_get_addr () | ||
and (ostore_st, r) = | ||
(let obj = get_Obj () | ||
in (ostore_st, success[U8] obj) : RR OstoreState Obj U8) : RR OstoreState Obj U8 | ||
in (r : R Obj U8) | ||
| Success obj -> let _ = deep_freeObj obj in (ostore_st : OstoreState, Error ()) | ||
| Error _ -> (ostore_st, Error (() : ()) : R Obj ()) | ||
|