Skip to content

Instantly share code, notes, and snippets.

View martinsandredev's full-sized avatar

André Martins martinsandredev

  • Rio de Janeiro, Rio de Janeiro, Brazil
View GitHub Profile
import * as RTE from "fp-ts/ReaderTaskEither";
import * as E from "fp-ts/Either";
import * as O from "fp-ts/Option";
import { Kind, URIS } from "fp-ts/HKT";
import { pipe } from "fp-ts/function";
import { Do } from "fp-ts-contrib/Do";
import { Monad1 } from "fp-ts/Monad";
interface MonadError<M extends URIS, E> extends Monad1<M> {
readonly throwError: <A>(e: E) => Kind<M, A>;
// scalaVersion := "3.2.0"
// libraryDependencies ++= Seq(
// libraryDependencies ++= Seq(
// "org.typelevel" %% "cats-core" % "2.8.0",
// "dev.zio" %% "zio" % "2.0.0",
// "org.typelevel" %% "cats-effect" % "3.3.14",
// "org.typelevel" %% "kittens" % "3.0.0",
// "dev.zio" %% "zio-json" % "0.3.0-RC10",
// "io.d11" %% "zhttp" % "2.0.0-RC10"
// )
@martinsandredev
martinsandredev / comparison-between-scala-and-haskell-pt-1.md
Last active May 5, 2022 13:20
Comparison between Scala and Haskell - Pt. 1

Comparison between Scala and Haskell - Pt. 1

Algebraic Data Types

Scala:

enum Status:
  case Ok
  case Error(err: String)
@martinsandredev
martinsandredev / clean-architecture-effect-ts.ts
Last active June 11, 2024 01:12
Clean Architecture and Functional Programming with ZIO inspired Effect-TS
import * as E from '@effect-ts/core/Either';
import * as O from '@effect-ts/core/Option';
import * as T from '@effect-ts/core/Effect';
import * as L from '@effect-ts/core/Effect/Layer';
import * as M from '@effect-ts/core/Effect/Managed';
import * as HashMap from '@effect-ts/core/Collections/Mutable/HashMap';
import { pipe, flow } from '@effect-ts/core/Function';
import { tag } from '@effect-ts/system/Has';
import express, { Request, Response, Router, Express } from 'express';
import { v4 as uuidv4 } from 'uuid';
import * as Free from 'fp-ts-contrib/Free';
import * as I from 'fp-ts/lib/Identity';
import * as O from 'fp-ts/Option';
import { Do } from 'fp-ts-contrib/Do';
import { pipe, flow } from 'fp-ts/function';
import { sequenceS } from 'fp-ts/lib/Apply';
declare module 'fp-ts/HKT' {
interface URItoKind<A> {
Store: StoreA;