Common functional data manipulation and abstraction patterns in Golang.

Overview

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

You might also like...
Distribute SafeSky data through WS.

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

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

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

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

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

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

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

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

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

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

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

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

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",

Releases(0.1.0)
Owner
Med Mouine
Med Mouine
🌇 High Performance Fibonacci Abstraction Layer + API

Fibonacci High Performance Fibonacci Abstraction Layer and an API.

Eliaz Bobadilla 8 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

yuhang 3 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

null 1 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

Papapetrou Patroklos 23 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

Ahmet Alp Balkan 84 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

Mustafa Ustaz 0 Jan 13, 2022
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

null 82 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.

Rakesh R 1 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

Paulo Lopes Estevão 2 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

Sean Hinchee 5 Oct 15, 2021