github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/testdata/generics/testb/testb.go (about)

     1  package testb
     2  
     3  import (
     4  	"github.com/tinygo-org/tinygo/testdata/generics/value"
     5  )
     6  
     7  func Test() {
     8  	v := value.New(1)
     9  	vm := value.Map(v, Plus500)
    10  	vm.Get(callback, callback)
    11  }
    12  
    13  func callback(v int) {
    14  	println("value:", v)
    15  }
    16  
    17  // Plus500 is a `Transform` that adds 500 to `value`.
    18  func Plus500(value int) int {
    19  	return value + 500
    20  }