Giter Site home page Giter Site logo

fp-ts-std's People

Contributors

anthonyjoeseph avatar baoshan avatar forno avatar imcotton avatar imhoffd avatar jessekelly881 avatar magellol avatar miaxos avatar oliverjash avatar samhh avatar simonam avatar skeate avatar stefanocrmg avatar waynevanson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fp-ts-std's Issues

DOM APIs

Probably out of scope if we want to support Node? Or perhaps not, Node users would just need to not import those. Or fp-ts-dom?

Enforce examples in all exports

Descriptions and versions are now enforced but examples notably are not.

It's probably a good idea to do so, though there are some exports for which an example arguably poses no value.

See also: gcanti/docs-ts#45

parseInt proposal

Hello! I'm a big fan of this library!

Maybe it would be useful to have a parseInt function in Number.ts? It might help with #29

import {flow} from 'fp-ts/function'
import * as O from 'fp-ts/Option'
import {invert} from './Boolean'

const parseInt = flow(Number.parseInt, O.fromPredicate(invert(isNaN)))

Or is this too trivial to be worth it?

Datum / RemoteData

Datum/RemoteData are nice, it'd be nice to support them without adding any further dependencies.

"fork" function

Can't get this to work without thunking A (where ReturnTypes is just ReturnType over an array via mapped type):

const fork = <A, B, C extends Array<(x: A) => B>>(gs: [...C]) => (x: A): ReturnTypes<C> =>
  gs.map(applyTo(x)) as ReturnTypes<C>

Example of intended usage:

declare const sum: (x: number[]) => number
declare const length: (x: unknown[]) => number
declare const joined: (x: unknown[]) => string

fork([sum, length, joined]) // (xs: number[]) => [number, number, string]

This'd cross out juxt in the Ramda doc but be... better. Can probably then tackle converge too.

Task logDuration

To log a task duration. Something like this. I suppose it can be useful.

export const logDuration = <A>(ma: Task<A>): Task<A> => {
  return () => {
    const start = Date.now();
    return ma().then((a) => {
      // eslint-disable-next-line no-console
      console.log(`${(Date.now() - start) / 1000}s`);
      return a;
    });
  };
};

WebExtension module

Not sure how this'll work in terms of webextension-polyfill-ts. Don't want to include a dependency like that for anyone not using it.

Update Jest to 27.x

The tests using timers fail in 27.0.6 irrespective of which timer strategy is used.

Ord: minimum / maximum

e.g.

const minimum = <A>(ord: Ord<A>): ((xs: NonEmptyArray<A>) => A) => NEA.fold(getMeetSemigroup(ord))

Like Haskell's minimum and maximum, but total.

Narrow JSON decode output

Instead of unknown, could it be?:

type JSONType = null | string | boolean | number | JSONType[] | Record<string, JSONType>

Export unJSONString

Let's not make consumers do this themselves.

Probably don't export mkJSONString.

Unit newtype

Does anyone care about this? So we could do away with null/undefined entirely.

zipAll proposal

Zip currently only works for arrays of the same size, which is sometimes fine but sometimes you want to zip up uneven arrays and keep the parts that were uneven. How about a function like:

const zipWithAll = <A, B, C>(
  fa: ReadonlyArray<A>, 
  fb: ReadonlyArray<B>, 
  f: (a: O.Option<A>, b: O.Option<B>) => C): ReadonlyArray<C> => {
  const fc: Array<C> = []
  const len = Math.max(fa.length, fb.length)
  for (let i = 0; i < len; i++) {
    fc[i] = f(i < fa.length ? O.some(fa[i]) : O.none, i < fb.length ? O.some(fb[i]) : O.none)
  }
  return fc
}

// zip but just gives arrays of size 1 when its uneven
const zipAll = <A, B, C>(fa: ReadonlyArray<A>, fb: ReadonlyArray<B>) =>
  zipWithAll(fa, fb, (a, b) => A.compact<(A|B)>([a, b]))
zipAll([1,2,3], [4,5])
// => [[1,4], [2, 5], [3]]

Env module

Find myself having to rewrite a functional wrapper around accessing process.env quite often.

Array Concat

I'm a little tired of using a Monoid to concat arrays together all the time, how would y'all feel about a convenience function for Array like

const concat = <A>(a:A[]) => (b:A[]) => A.getMonoid<A>().concat(a, b)

just so we can pipe some stuff together like

pipe(R.keys(x), concat(R.keys(y)), A.uniq(eqString))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.