File: slice.sail

package info (click to toggle)
sail-ocaml 0.19.1%2Bdfsg5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,008 kB
  • sloc: ml: 75,941; ansic: 8,848; python: 1,342; exp: 560; sh: 474; makefile: 218; cpp: 36
file content (39 lines) | stat: -rw-r--r-- 461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
default Order dec
$include <prelude.sail>

enum e1 = {ABC, DEF}
enum e2 = {GHI, JKL}

struct s1 = {
  fA : int,
  fB : e2,
}

struct s2 = {
  fC : int,
  fD : e1,
}

struct s3 = {
  fE : s1,
  fF : int,
}

val f : int -> int
function f(x) = 2 * x

val g : int -> int
function g(x) = 3 * x

val h : int -> int
function h(x) = x + f(x)

val j : s3 -> int
function j(x) = f(x.fF)

val k : int -> int
function k(x) = {
  s : s3 = undefined;
  s.fF = x;
  f(s.fF)
}