Permalink
Browse files

[enhance] session: make channel comparable automatically

  • Loading branch information...
1 parent 23fed59 commit 2c1d2e562370e32fa863cee89b66b74d39331e9b @Aqua-Ye Aqua-Ye committed Apr 3, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 stdlib/core/rpc/core/session.opa
@@ -1,5 +1,5 @@
/*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of OPA.
@@ -184,6 +184,10 @@ type channelset('a) = ordered_set(channel('a), Channel.order)
compare_channel(a:channel('msg), b:channel('msg)) : Order.ordering =
Order.of_int(%%BslSession.compare_channels%%(a, b))
+@private @comparator(channel('msg)) _cmp(_f : 'msg, 'msg -> Order.comparison, ca, cb) =
+ compare_channel(ca, cb) <: Order.comparison
+
+
Channel = {{
order = @nonexpansive(Order.make(compare_channel)) : order(channel('message), Channel.order)
}}

0 comments on commit 2c1d2e5

Please sign in to comment.