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

@typed-f/functor

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typed-f/functor - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

<a name="0.1.0"></a>
# [0.1.0](https://github.com/Ailrun/typed-f/compare/v0.0.1...v0.1.0) (2018-08-14)
### Features
* **tagged:** add [@typed-f](https://github.com/typed-f)/tagged package ([#2](https://github.com/Ailrun/typed-f/issues/2)) ([91b914d](https://github.com/Ailrun/typed-f/commit/91b914d))
<a name="0.0.1"></a>

@@ -8,0 +20,0 @@ ## 0.0.1 (2018-08-11)

30

dist/Functor.d.ts
import { Fun } from '@typed-f/function';
export interface Functor<T> {
import * as T from '@typed-f/tagged';
interface FunctorBuilder<MapType> {
map: MapType;
/**
* @desc
* `Functor` methods
*/
map<U>(f: Fun<[T], U>): Functor<U>;
/**
* @desc
* alias of `map`
*/
lift<U>(f: Fun<[T], U>): Functor<U>;
lift: MapType;
/**

@@ -17,3 +14,20 @@ * @desc

*/
fmap<U>(f: Fun<[T], U>): Functor<U>;
fmap: MapType;
}
declare type FB<M> = FunctorBuilder<M>;
declare type F1M<Tag extends keyof T.Tag1List<any>, A0> = <R>(f: Fun<[A0], R>) => T.Tag1List<R>[Tag];
declare type F2M<Tag extends keyof T.Tag2List<any, any>, A0, A1> = <R>(f: Fun<[A1], R>) => T.Tag2List<A0, R>[Tag];
declare type F3M<Tag extends keyof T.Tag3List<any, any, any>, A0, A1, A2> = <R>(f: Fun<[A2], R>) => T.Tag3List<A0, A1, R>[Tag];
declare type F4M<Tag extends keyof T.Tag4List<any, any, any, any>, A0, A1, A2, A3> = <R>(f: Fun<[A3], R>) => T.Tag4List<A0, A1, A2, R>[Tag];
export interface Functor1<Tag extends keyof T.Tag1List<any>, A0> extends T.Tagged<Tag>, FB<F1M<Tag, A0>> {
}
export interface Functor2<Tag extends keyof T.Tag2List<any, any>, A0, A1> extends T.Tagged<Tag>, FB<F2M<Tag, A0, A1>> {
}
export interface Functor3<Tag extends keyof T.Tag3List<any, any, any>, A0, A1, A2> extends T.Tagged<Tag>, FB<F3M<Tag, A0, A1, A2>> {
}
export interface Functor4<Tag extends keyof T.Tag4List<any, any, any, any>, A0, A1, A2, A3> extends T.Tagged<Tag>, FB<F4M<Tag, A0, A1, A2, A3>> {
}
export declare namespace Functor {
function map<T, U>(f: Fun<[T], U>): <Tag extends keyof T.Tag1List<any>>(wa: Functor1<Tag, T>) => T.Tag1List<U>[Tag];
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Functor;
(function (Functor) {
function map(f) {
return function (wa) {
if ('map' in wa) {
return wa.map(f);
}
throw new Error('Parameter is not a functor. You cannot call the function map with non-functor.');
};
}
Functor.map = map;
})(Functor = exports.Functor || (exports.Functor = {}));
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./Functor"));
{
"name": "@typed-f/functor",
"version": "0.0.1",
"version": "0.1.0",
"keywords": [

@@ -24,2 +24,3 @@ "Functor",

"scripts": {
"clean": "rimraf dist",
"build": "tsc -p ./tsconfig.json",

@@ -29,5 +30,7 @@ "watch": "tsc -w -p ./tsconfig.json"

"dependencies": {
"@typed-f/function": "^0.0.1"
"@typed-f/function": "^0.1.0",
"@typed-f/tagged": "^0.1.0"
},
"devDependencies": {
"rimraf": "^2.6.2",
"typescript": "^3.0.1"

@@ -38,3 +41,3 @@ },

},
"gitHead": "90233b12d1b366e9103c7065ad4967adbe61e6be"
"gitHead": "a1925ab6cb01347972f566478cc9c0fc289c2e31"
}
import { Fun } from '@typed-f/function';
import * as T from '@typed-f/tagged';
export interface Functor<T> {
interface FunctorBuilder<MapType> {
map: MapType;
/**
* @desc
* `Functor` methods
*/
map<U>(f: Fun<[T], U>): Functor<U>;
/**
* @desc
* alias of `map`
*/
lift<U>(f: Fun<[T], U>): Functor<U>;
lift: MapType;
/**

@@ -19,3 +15,36 @@ * @desc

*/
fmap<U>(f: Fun<[T], U>): Functor<U>;
fmap: MapType;
}
type FB<M> = FunctorBuilder<M>;
type F1M<Tag extends keyof T.Tag1List<any>, A0> = <R>(
f: Fun<[A0], R>,
) => T.Tag1List<R>[Tag];
type F2M<Tag extends keyof T.Tag2List<any, any>, A0, A1> = <R>(
f: Fun<[A1], R>,
) => T.Tag2List<A0, R>[Tag];
type F3M<Tag extends keyof T.Tag3List<any, any, any>, A0, A1, A2> = <R>(
f: Fun<[A2], R>,
) => T.Tag3List<A0, A1, R>[Tag];
type F4M<Tag extends keyof T.Tag4List<any, any, any, any>, A0, A1, A2, A3> = <R>(
f: Fun<[A3], R>,
) => T.Tag4List<A0, A1, A2, R>[Tag];
export interface Functor1<Tag extends keyof T.Tag1List<any>, A0> extends T.Tagged<Tag>, FB<F1M<Tag, A0>> {}
export interface Functor2<Tag extends keyof T.Tag2List<any, any>, A0, A1> extends T.Tagged<Tag>, FB<F2M<Tag, A0, A1>> {}
export interface Functor3<Tag extends keyof T.Tag3List<any, any, any>, A0, A1, A2> extends T.Tagged<Tag>, FB<F3M<Tag, A0, A1, A2>> {}
export interface Functor4<Tag extends keyof T.Tag4List<any, any, any, any>, A0, A1, A2, A3> extends T.Tagged<Tag>, FB<F4M<Tag, A0, A1, A2, A3>> {}
export namespace Functor {
export function map<T, U>(f: Fun<[T], U>): <Tag extends keyof T.Tag1List<any>>(
wa: Functor1<Tag, T>,
) => T.Tag1List<U>[Tag] {
return function (wa) {
if ('map' in wa) {
return (wa as any).map(f);
}
throw new Error('Parameter is not a functor. You cannot call the function map with non-functor.');
}
}
}
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