From b7280ca86255a798e681e1fcfbc689efcc63ae4a Mon Sep 17 00:00:00 2001 From: "Dr. Carsten Leue" Date: Tue, 18 Jul 2023 16:27:05 +0200 Subject: [PATCH] fix: some docs Signed-off-by: Dr. Carsten Leue --- README.md | 12 +++++++++++- samples/README.md | 10 ++++++++++ samples/doc.go | 2 ++ samples/readfile/readfile_test.go | 2 ++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 samples/README.md create mode 100644 samples/doc.go diff --git a/README.md b/README.md index f0f72ec..a90727f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ # Functional programming library for golang -**🚧 Work in progress! 🚧** +**🚧 Work in progress! 🚧** Despite major version 1 because of https://github.com/semantic-release/semantic-release/issues/1507. Trying to not make breaking changes, but devil is in the details. ![logo](resources/images/logo.png) +This library is strongly influenced by the awesome [fp-ts](https://github.com/gcanti/fp-ts). + +## Getting started + +```bash +go get github.com/IBM/fp-go +``` + +Refer to the [samples](./samples/). + ## Design Goal This library aims to provide a set of data types and functions that make it easy and fun to write maintainable and testable code in golang. It encourages the following patterns: diff --git a/samples/README.md b/samples/README.md new file mode 100644 index 0000000..92b386b --- /dev/null +++ b/samples/README.md @@ -0,0 +1,10 @@ +# Samples + +This folder is meant to contain examples that illustrate how to use the library. I recommend the following reading to get an idea of the underlying concepts. These articles talk about [fp-ts](https://github.com/gcanti/fp-ts) but the concepts are very similar, only syntax differs. + +### References + +- [Ryan's Blog](https://rlee.dev/practical-guide-to-fp-ts-part-1) - practical introduction into FP concepts +- [Investigate Functional Programming Concepts in Go](https://betterprogramming.pub/investigate-functional-programming-concepts-in-go-1dada09bc913) - discussion around FP concepts in golang +- [Investigating the I/O Monad in Go](https://medium.com/better-programming/investigating-the-i-o-monad-in-go-3c0fabbb4b3d) - a closer look at I/O monads in golang +- \ No newline at end of file diff --git a/samples/doc.go b/samples/doc.go new file mode 100644 index 0000000..6f764b2 --- /dev/null +++ b/samples/doc.go @@ -0,0 +1,2 @@ +// Package sample contains examples that illustrate how to use fp-go +package samples diff --git a/samples/readfile/readfile_test.go b/samples/readfile/readfile_test.go index 73f1615..03a477b 100644 --- a/samples/readfile/readfile_test.go +++ b/samples/readfile/readfile_test.go @@ -17,6 +17,8 @@ type RecordType struct { Data string `json:"data"` } +// TestReadSingleFile reads the content of a file from disk and parses it into +// a struct func TestReadSingleFile(t *testing.T) { data := F.Pipe2(