Quick actions

cmd+k|ctrl+k

Navigation

Languages

DataViewType Example

Snippet info

Language

Ats

Visibility

public

Author

steinwaywhw

Created

2018-05-01T02:31:53Z

Updated

2018-05-01T02:31:53Z

#include "share/atspre_staload.hats"

datavtype record = Record of (int, int)


extern fun show_and_incr (!record): void
implement show_and_incr (record) = let 
    val @Record (x, y) = record
    val _ = println! (x, y)
    val _ = x := x + 1
in 
    fold@ record
end


implement main0 () = let 
    val record = Record (0, 0)
    val _ = show_and_incr record
    val _ = show_and_incr record
in 
    case+ record of 
    | ~Record (x, y) => println! "freed"
end
    
INFO