Skip to content

Functions

Jonathan edited this page Nov 2, 2018 · 1 revision
interface Sender {
  fun send<M>(message: M) :{
    To(user: User)
    _
  }
}

class ChannelSender(val channel: Channel) : Sender {
  impl fun send<M>(message: M) :{
    To(user: User) = 
        channel.send(message, user)
    _ = channel.broadcast(message)
  }
}

send(message, To(user))
// Or
send(message) to(user)

send(message) // Broadcast
Clone this wiki locally