@@ -39,13 +39,13 @@ object Instances extends Common with
3939 if (fst != 0 ) fst else xs1.compareTo(ys1)
4040 end listOrd
4141
42- given stringOps : with
43- def ( xs : Seq [ String ]) longestStrings : Seq [String ] =
42+ given stringOps : ( xs : Seq [ String ]) with
43+ def longestStrings : Seq [String ] =
4444 val maxLength = xs.map(_.length).max
4545 xs.filter(_.length == maxLength)
4646
47- given with
48- def ( xs : List [ T ]) second[ T ] = xs.tail.head
47+ given [ T ]( xs : List [ T ]) with
48+ def second = xs.tail.head
4949
5050 given listMonad : Monad [List ] with
5151 def (xs : List [A ]) flatMap[A , B ] (f : A => List [B ]): List [B ] =
@@ -130,15 +130,11 @@ end Instances
130130object PostConditions with
131131 opaque type WrappedResult [T ] = T
132132
133- private given WrappedResult : with
134- def apply [T ](x : T ): WrappedResult [T ] = x
135- def (x : WrappedResult [T ]) unwrap[T ]: T = x
133+ def result [T ](given x : WrappedResult [T ]): T = x
136134
137- def result [T ](given wrapped : WrappedResult [T ]): T = wrapped.unwrap
138-
139- given with
140- def (x : T ) ensuring[T ] (condition : (given WrappedResult [T ]) => Boolean ): T =
141- assert(condition(given WrappedResult (x)))
135+ given [T ](x : T ) with
136+ def ensuring (condition : (given WrappedResult [T ]) => Boolean ): T =
137+ assert(condition(given x ))
142138 x
143139end PostConditions
144140
0 commit comments