Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@inato/effect-fpts-interop

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inato/effect-fpts-interop

Helper functions to interoperate between the Effect framework and the fp-ts library

  • 0.9.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1K
decreased by-41.59%
Maintainers
4
Weekly downloads
 
Created
Source

@inato/effect-fpts-interop

Helper functions to interoperate between the Effect type and the ReaderTaskEither type.

[!NOTE] This repository acts as supporting document for this article that describe how at Inato we successfully migrated to Effect.

Installation

You can install this package via pnpm:

pnpm install @inato/effect-fpts-interop

Usage

portToEffect

import {
  getFptsMapping,
  portToEffect,
  type FptsAccess,
  type FptsConvertible,
} from "@inato/effect-fpts-interop";

interface MeasureString extends FptsConvertible<"measureString"> {
  measure: (value: string) => ReaderTaskEither<unknown, Error, number>
}

interface MeasureStringAccess extends FptsAccess<MeasureString> { }

declare const MeasureStringFpts: {
  measure: (value: string) => ReaderTaskEither<MeasureString, Error, number>
}

const Tag = Context.GenericTag<MeasureString>("MeasureString")

const MeasureString = portToEffect(
  MeasureStringFpts, 
  getFptsMapping(Tag, "measureString")
)

MeasureString.measure("hello 👋") // Effect<number, Error, MeasureString>

portToFpts

import {
  getFptsMapping,
  portToFpts,
  type FptsAccess,
  type FptsConvertible,
} from "@inato/effect-fpts-interop";

interface MeasureString extends FptsConvertible<"measureString"> {
  measure: (value: string) => Effect<number, Error>
}

interface MeasureStringAccess extends FptsAccess<MeasureString> { }

declare const MeasureStringFpts: {
  measure: (value: string) => ReaderTaskEither<MeasureString, Error, number>
}

const Tag = Context.GenericTag<MeasureString>("MeasureString")

const MeasureString = Effect.serviceFunctions(Tag)

const MeasureStringFpts = portToFpts(
  MeasureString, 
  getFptsMapping(Tag, "measureString")
)

MeasureStringFpts.measure("hello 👋") // ReaderTaskEither<MeasureStringAccess, Error, number>

And more.. Have a look at the example section!

Keywords

FAQs

Package last updated on 30 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc