Common functional data manipulation and abstraction patterns in Golang.

GitHub go.mod Go version of a Go module GitHub go.mod Go version of a Go module Go Reference codecov

Functional Patterns in Golang

GOMAD (Early stage)

This package is still in an early stage of development. Feel free to open a PR and contribute or just open an issue to help me priorities features.

Following is a list of future modules coming up in no specific order:

  • Maybe
  • Either
  • Result
  • List
  • Pipe
  • HKT
  • Monad
  • IO
  • Task
  • Reader

Prerequisites

All these modules use the newly added features of Golang v1.18 (Still in beta as of today) notably type and function generics.

Install

go get github.com/medmouine/gomad/<Desired module>

i.e
go get github.com/medmouine/gomad/maybe

Modules

Maybe

Maybe is a monadic pattern allowing for data manipulation while abstracting whether or not the value actually exists or is nil. For example, if we fetch data from an external API that could be nil, we can still perform manipulation on it while disregarding its actual state. The Maybe struct will take care of managing the value itself. This is similar to the Maybe interface in Elm or Haskell or Optional in Java.

You can use the functions Just, None or Nillable to instanciate a Maybe struct. The type parameter will be determined by the passed argument or by specifying it. For example:

maybeNilInteger := maybe.Nillable[int](nil)

nilInteger := maybe.None[int]()

someInteger := maybe.Just[int](1)

Usage

TODO

Similar Resources

Distribute SafeSky data through WS.

safesky-ws Distribute SafeSky data through WS. How it works clients

Dec 12, 2021

Fetch input data for Advent of Code challenges.

Import the inputs for Advent of Code challenges straight into your code. Fetched data is cached by default. Usage Log into Advent of Code from your br

Oct 12, 2022

Helps me find good enough stocks that pay enough dividends using IEX Cloud data provider.

divyield Helps me find good enough stocks that pay enough dividends using IEX Cloud data provider. Create database using the postgres/scripts/createdb

Feb 4, 2022

Client-server-golang-sqs - Client Server with SQS and golang

Client Server with SQS and golang Multi-threaded client-server demo with Go What

Feb 14, 2022

A API scanner written in GOLANG to scan files recursively and look for API keys and IDs.

GO FIND APIS _____ ____ ______ _____ _ _ _____ _____ _____ _____ / ____|/ __ \ | ____|_ _| \ | | __ \ /\ | __ \_

Oct 25, 2021

Todo-list - In this project using golang and mySql to create todo-list to Add and remove

Todo-list - In this project using golang and mySql to create todo-list to Add and remove

TODO-Fullstack-App-Go-Gin-Postgres-React This fullstack application creates a TODO List Web Page using the Go/Gin/Postgres/React Stack. Starting the a

Apr 7, 2022

Desenvolvendo-Sistema-Planejamento-Financeiro-GoLang - Developing a Financial Planning System with Golang

dio-expert-session-finance Pré Desenvolvimento Vamos criar um projeto no Github

Jan 27, 2022

Golang-action - A template repository for writing custom GitHub Actions in Golang

Golang Action A template repository for writing custom GitHub Actions in Golang.

Feb 12, 2022

I try to make a Restfull-API with golang and interaction with json.file

{ "users": [ { "name": "Elliot", "type": "Reader", "age": 23, "social": { "facebook": "https://facebook.com",

Jan 5, 2022
🌇 High Performance Fibonacci Abstraction Layer + API

Fibonacci High Performance Fibonacci Abstraction Layer and an API.

Nov 2, 2022
A patterns expander for golang

ep A patterns expander Examples: eg1: $ ep 192.168.5.[1-3,8] 192.168.5.1 192.168

Aug 27, 2022
A small command line tool for testing grok patterns on file contents.

grogg A small command line tool for testing grok patterns on file contents. It uses the vjeantet/grok library for parsing and pterm for some extra glo

Feb 5, 2022
A go SDK for the data available via data.gov.gr

go-data-gov-gr-sdk A Go based SDK to access the public data provided by the Greek Government and are available at https://www.data.gov.gr/ Quick Start

Jan 24, 2022
Periodically collect data about my Twitter account and check in to github to preserve an audit trail.

Twitter audit trail backup This repository backs up my follower list, following list, blocked accounts list and muted accounts list periodically using

Dec 28, 2022
Groupie Trackers consists on receiving a given API and manipulate the data contained in it, in order to create a site, displaying the information.

groupie-tracker Objectives Groupie Trackers consists on receiving a given API and manipulate the data contained in it, in order to create a site, disp

Jan 13, 2022
Invidtui - An invidious client, which fetches data from invidious and displays a user interface in the terminal(TUI)
Invidtui - An invidious client, which fetches data from invidious and displays a user interface in the terminal(TUI)

invidtui invidtui is an invidious client, which fetches data from invidious and

Dec 27, 2022
Tiny go package for fetching high and low value of a stock for any given period range using kite connect historical data APIs.

Tiny go package for fetching high and low value of stock for any given period range using Kite connect Historical data APIs.

Apr 27, 2022
Api shows various data from the countries of the world

Microservice API Enza Enza API tem como objectivo apresentar informações dos Paises por Continentes . Informações como : Nome do Pais Bandeira Mapa Ca

Nov 26, 2021
Azure Data Lake Storage Account Share 9p File System

dlfs Azure storage account (data lake) v2 as a 9p file system. Fork of abfs. Written in Go. Created during the 2021 MS hackathon. Build Currently the

Oct 15, 2021