Skip to content

Releases: true-myth/true-myth

Start fixing `elseFn`s. (But you want 1.1.3.)

01 Dec 19:48
09473c3
Compare
Choose a tag to compare

Publicize and privatize things

02 Nov 21:33
Compare
Choose a tag to compare

What's new?

  • Exported Unit from root, to match Maybe and Result, so you can do this (but please don't do this, because this is terrible and only an example):

    import { Result, Unit } from 'true-myth';
    
    const getAResult = (isValid: boolean): Result<Unit, Unit> =>
      isValid ? Result.ok() : Result.err();
  • Renamed the (private) field and classes: Brand.brand to _Brand._brand. Please don't access that directly. Not least since, as it's private API, I reserve the right to change that implementation detail as I like.

See v1.1.0 release notes for more.

This is just a simple `Unit` of change

02 Nov 21:24
Compare
Choose a tag to compare

What's new?

  • Adds a Unit type (which is basically just a simple object with a private field), so you can have a type to use with e.g. Result instead of re-infecting your system with void.
  • Supports nice construction of Result<Unit, E> or Result<T, Unit> with Result.ok() and Result.err() invocations respectively (don't worry: it still throws if you pass null to either of those, or if you pass either undefined or null or nothing at all to the Result.Ok or Result.Err constructors).
import Result, { ok, err } from 'true-myth/result';
import Unit from 'true-myth/unit';

const getAResultWithUnit = (isValid: boolean): Result<Unit, string> =>
  isValid ? Result.ok() : Result.err("this wasn't valid");

✨ `Maybe` this will give you better `Result`s in your programming! ✨

01 Nov 12:56
Compare
Choose a tag to compare

What's new?

Well, it depends. If this is your first time using True Myth (reasonably, given newly minted ✨1.0 status✨) then everything:

Both have all the helpers you could want, support curried/partially applied versions of every static function which takes more than one argument, and supply TypeScript type definitions and beta-level FlowType definitions.

On the other hand, if you're updating from 0.11.0, then there's nothing new other than some small improvements to the README. For earlier changes, see the Releases.

Upgrading from any pre-1.0 release

$ yarn upgrade [email protected]

or

$ npm install [email protected]

Most changes have been strictly backwards compatible during that time, with new functionality appearing in additive fashion.

Again, however, you should review earlier Releases. For example, if you're on e.g. 0.3.0, there are important, breaking changes in later releases – moving back to Just instead of Some in 0.6.0.

Curry all the things!

31 Oct 02:41
Compare
Choose a tag to compare
Curry all the things! Pre-release
Pre-release

What's new?

All the static functions which take more than one parameter now support automatic currying:

import Maybe from 'true-myth/maybe';

const double = (n: number) => n * 2;
const just12 = Maybe.just(12);
console.log(Maybe.map(double)(just12).toString()); // Just(24)
console.log(Maybe.map(double, just12).toString()); // Just(24)

This is convenient for use with e.g. _.flow or – someday, maybe! – a pipeline operator:

Maybe.of(12)
|> Maybe.map(n => n * 2)
|> Maybe.unwrapOr(0)
|> console.log;
// 24

This is probably identical with the 1.0 release! 🤞

Actually pack and publish updated lib. (╯°□°)╯︵ ┻━┻

30 Oct 15:29
Compare
Choose a tag to compare

What's new

The definitions and files actually are what v0.10.0 said they were now. npm scripts will be the death of me.

Oh, right. npmignore is a thing. (Fix Ember for 0.10 release.)

30 Oct 14:46
Compare
Choose a tag to compare

What's new

You, uhh, can use this with Ember again. I got overly clever while forgetting about .npmignore, and put the ember-addon.js file in a directory that gets excluded from the npm build. Fixed.

Better imports! 😍 Final pre-1.0 release, 🤞🏼

29 Oct 04:53
Compare
Choose a tag to compare

What's new?

  • The big one: updated imports. Instead of needing to do this:

    import * as Maybe from 'true-myth/maybe';
    type Maybe<T> = Maybe.Maybe<T>;
    
    const foo: Maybe<string> = Maybe.just('hello');

    …you can now do this:

    import Maybe from 'true-myth/maybe';
    
    const foo: Maybe<string> = Maybe.just('hello');

    Snazzy, right?

    Note that this is a backwards-compatible change: the old way still works, it's just that the new way is a lot nicer.

  • Updated the README substantially so it explains the library purpose a lot more clearly and so it distinguishes the value of Maybe and Result separately

Almost 1.0! Add `match` and `cata`

26 Oct 14:46
Compare
Choose a tag to compare
Pre-release

What's new?

  • Add match (with cata alias) for convenience (and for easy migration from Folktale 1.0) – thanks @bmakuh!
  • Support constructing Nothing with explicit null value
  • Improve docs!

Uhh, 0.9.1?

Yeah, I published 0.9.0 but without the FlowType definitions. Whoops. I promise I'll become competent at this eventually.

Undo publishing tsconfig.json. Yep. That kind of night.

25 Oct 03:51
Compare
Choose a tag to compare

v0.8.2 published tsconfig.json in hopes that it would resolve an imports issue. It doesn't. This issue sort of halfway explains why; but the solutions are gross. Sadly, they're all we have, so… that's what's in the README as of v0.8.3; and this reverts to not publishing the tsconfig.json file.