fp-ts icon indicating copy to clipboard operation
fp-ts copied to clipboard

Examples for deprecated after version 2.10

Open paulvitic opened this issue 4 years ago • 2 comments
trafficstars

📖 Documentation

I have a few deprecated implementations after upgrading to 2.10 but cant seem to find examples on how to upgrade. Would appreciate if I could get some examples to see how

export function concatIOQueries(queries: io.IO<string>[]): io.IO<string> {
    return monoid.fold(io.getMonoid<string>(monoid.monoidString))(queries)
}

export function concatIOQuery(head: io.IO<string>, tail: io.IO<string>): io.IO<string> {
    return io.getSemigroup(semigroup.semigroupString).concat(head, tail)
}

export function concatEitherQuery(head: either.Either<Error, string>, tail: either.Either<Error, string>):
    either.Either<Error, string> {
    return either.getApplySemigroup<Error, string>(semigroup.semigroupString).concat(head, tail)
}

export function concatEitherQueries(queries: either.Either<Error, string>[]): either.Either<Error, string> {
    return monoid.fold(either.getApplyMonoid<Error, string>(monoid.monoidString))(queries)
}

export const equalStringFieldValue:(field:string) => eq.Eq<any> = field => eq.getStructEq({ [field]: eq.eqString} );

## this is now eroounous
export const orderByStringValue = (field:string) => array.sort(ord.contramap(ord.ordString, (row:any) => row[field] as string))

paulvitic avatar May 11 '21 08:05 paulvitic

@paulvitic you can find some help (and links) in the documentation, so for example:

  • monoid.fold: "Use concatAll instead" (https://gcanti.github.io/fp-ts/modules/Monoid.ts.html#fold)
  • io.getMonoid: "Use getApplicativeMonoid instead" (https://gcanti.github.io/fp-ts/modules/IO.ts.html#getmonoid)

etc...

p.s. If you find some missing infos/links please let me know, I'll fix asap

gcanti avatar May 11 '21 13:05 gcanti

I also thing things like monoid.monoidString have been moved to their own module, so import { Monoid } from 'fp-ts/string'

kylegoetz avatar May 19 '21 17:05 kylegoetz