1-module(order).
2
3-export([t1/0, t2/0, t3/0, t4/0, t5/0, t6/0]).
4
5t1() ->
6    case maps:get(a, #{a=>1, a=>b}) of
7	Int when is_integer(Int) -> fail;
8	Atom when is_atom(Atom) -> error(ok);
9	_Else -> fail
10    end.
11
12t2() ->
13    case maps:get(a, #{a=>id_1(1), a=>id_b(b)}) of
14	Int when is_integer(Int) -> fail;
15	Atom when is_atom(Atom) -> error(ok);
16	_Else -> fail
17    end.
18
19t3() ->
20    case maps:get(a, #{a=>id_1(1), id_a(a)=>id_b(b)}) of
21	Int when is_integer(Int) -> fail;
22	Atom when is_atom(Atom) -> error(ok);
23	_Else -> fail
24    end.
25
26t4() ->
27    case maps:get(a, #{a=>id_1(1), a_or_b()=>id_b(b)}) of
28	Int when is_integer(Int) -> ok;
29	Atom when is_atom(Atom) -> ok;
30	_Else -> fail
31    end.
32
33t5() ->
34    case maps:get(c, #{c=>id_1(1), a_or_b()=>id_b(b)}) of
35	Int when is_integer(Int) -> error(ok);
36	Atom when is_atom(Atom) -> fail;
37	_Else -> fail
38    end.
39
40t6() ->
41    case maps:get(a, #{a_or_b()=>id_1(1), id_a(a)=>id_b(b)}) of
42	Int when is_integer(Int) -> fail;
43	Atom when is_atom(Atom) -> error(ok);
44	_Else -> fail
45    end.
46
47id_1(X) -> X.
48
49id_a(X) -> X.
50
51id_b(X) -> X.
52
53any() -> binary_to_term(<<>>).
54
55-spec a_or_b() -> a | b.
56a_or_b() -> any().
57