-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.scala
108 lines (83 loc) · 1.95 KB
/
Main.scala
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import dslparadise._
object Main extends App {
ImplicitContextPropagation
ScopePropagation
StaticScopeInjection
}
object ImplicitContextPropagation {
def f(a: Int `implicit =>` String) = println(a(5))
def g(implicit x: Int) = x.toString
f("Hi, " + g)
f { implicit imparg => "Hi, " + g }
}
object ScopePropagation {
class Thingy {
val u = 6
val v = 7
}
def f(a: Thingy `import =>` Int) = println(a(new Thingy))
f(4 + u - v)
f { imparg => import imparg._; 4 + u - v }
}
object StaticScopeInjection {
object Thingy {
val u = 6
}
def f(a: Int `import` Thingy.type) = println(a)
f(u + 1)
f { import Thingy._; u + 1 }
}
object JavaRegex {
class Pattern
object Pattern {
def compile(s: String, i: Int `import` Pattern): Pattern = new Pattern
val MULTILINE = 0
val CASE_INSENSITIVE = 0
}
val pattern = Pattern.compile(
"[a-z]",
MULTILINE | CASE_INSENSITIVE
)
}
object SprayHttpResponse {
class HttpResponse
object HttpResponse {
def apply(
a: StatusCode `import` StatusCodes.type,
b: HttpEntity `import` HttpEntity.type,
c: List[HttpHeader] `import` HttpHeaders.type,
d: HttpProtocol `import` HttpProtocols.type) = new HttpResponse
}
class StatusCode
object StatusCodes {
val OK = new StatusCode
}
class HttpEntity
object HttpEntity {
val Empty = new HttpEntity
}
class HttpHeader
object HttpHeaders {
def Accept(a: Seq[MediaRange] `import` MediaRanges.type) = new HttpHeader
}
class MediaRange
object MediaRanges {
val `video/*` = new MediaRange
val `application/*` = new MediaRange
}
class HttpProtocol
object HttpProtocols {
val `Http/1.1` = new HttpProtocol
}
HttpResponse(
OK,
Empty,
List(
Accept(Seq(
`video/*`,
`application/*`
))
),
`Http/1.1`
)
}