Skip to content

Commit

Permalink
compiler: no !s at all. still have leftovers (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilin Chen authored and Zilin Chen committed Jan 12, 2017
1 parent df1da96 commit e3fb777
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions cogent/tests/pass_ticket-e31.cogent
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
type MountState
type OstoreState

type Buffer
type UbiVol
type OstoreState = {
next_inum : U32
, rbuf : Buffer
, wbuf_eb : U32
, ubi_vol : UbiVol
}

type ObjId = U64
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 -> ()
deserialise_Obj: (Buffer!, BufOffs) -> (Obj, BufOffs)
read_obj_pages_in_buf: (MountState!, UbiVol!, Buffer, ObjAddr!) -> Buffer
get_Obj : () -> Obj

type ObjAddr = #{ ebnum : U32, offs : U32, len : U32, sqnum : U64 }
type ObjAddr
index_get_addr : () -> ObjAddr

success : all (a, b). a -> R a b
success a = Success a

ostore_read: (MountState!, OstoreState, ObjId) -> RR OstoreState Obj ()
ostore_read (mount_st, ostore_st, oid) =
ostore_read: OstoreState -> RR OstoreState Obj ()
ostore_read ostore_st =
let addr = index_get_addr ()
and (ostore_st, r) =
let ostore_st {rbuf} = ostore_st
and rbuf = read_obj_pages_in_buf (mount_st, ostore_st.ubi_vol, rbuf, addr) !ostore_st
and (obj, sz) = deserialise_Obj (rbuf, 1) !rbuf
in (ostore_st {rbuf}, success obj)
let obj = get_Obj ()
in (ostore_st, success obj)
in r
| Success obj -> let _ = deep_freeObj obj in (ostore_st, Error)
| Error -> (ostore_st, Error)
Expand Down

0 comments on commit e3fb777

Please sign in to comment.