func (m matchResult) When(f func(input interface{}) bool, a func() interface{}) matchResult {
	if m.isMatched {
		return m
	}
	if f(m.input) {
		m.output = a()
		m.isMatched = true
	}
	return m
}
when param is "func(input interface{}) bool" used to match a condition
a param is "func() interface{}" used to run an action
package patternmatch
import "reflect"
type match struct {
	input     interface{}
	isMatched bool
}
type matchResult struct {
	input     interface{}
	output    interface{}
	isMatched bool
}
func Match(input interface{}) match {
	return match{reflect.ValueOf(input).Interface(), false}
}
func (m match) When(f func(input interface{}) bool, a func()) match {
	if m.isMatched {
		return m
	}
	if f(m.input) {
		a()
		m.isMatched = true
	}
	return m
}
func (m match) WhenValue(val interface{}, a func()) match {
	if m.isMatched {
		return m
	}
	if m.input == val {
		a()
		m.isMatched = true
	}
	return m
}
func (m match) OtherwiseThrow() {
	if !m.isMatched {
		panic("pattern not matched")
	}
}
func ResultMatch(input interface{}) matchResult {
	return matchResult{reflect.ValueOf(input).Interface(), nil, false}
}