fp-go
https://gyazo.com/415e517ba957d45ae9ee0f232c40743c
↑このGopherくんのおもろさだけでメモったmrsekut.icon
Goでfunctional programming
fp-ts inspiredらしい
This library is strongly influenced by the awesome fp-ts.
github
IBM製
サンプル ref
code:go
func TestReadMultipleFiles(t *testing.T) {
data := F.Pipe2(
A.MakeBy(3, idxToFilename),
R.TraverseArray(F.Flow3(
file.ReadFile,
R.ChainEitherK(J.UnmarshalRecordType),
R.ChainFirstIOK(IO.LogfRecordType("Log Single: %v")),
)),
R.ChainFirstIOK(IO.Logf[[]RecordType]("Log Result: %v")),
)
result := data(context.Background())
assert.Equal(t, E.Oferror(A.From(RecordType{"file1"}, RecordType{"file2"}, RecordType{"file3"})), result())
}
ほんまにGo userに受けいられるのだろうかmrsekut.icon