Releases: true-myth/true-myth
Start fixing `elseFn`s. (But you want 1.1.3.)
v1.1.2 v1.1.2
Publicize and privatize things
What's new?
-
Exported
Unit
from root, to matchMaybe
andResult
, 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
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 withvoid
. - Supports nice construction of
Result<Unit, E>
orResult<T, Unit>
withResult.ok()
andResult.err()
invocations respectively (don't worry: it stillthrow
s if you passnull
to either of those, or if you pass eitherundefined
ornull
or nothing at all to theResult.Ok
orResult.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! ✨
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!
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. (╯°□°)╯︵ ┻━┻
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.)
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, 🤞🏼
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
andResult
separately
Almost 1.0! Add `match` and `cata`
What's new?
- Add
match
(withcata
alias) for convenience (and for easy migration from Folktale 1.0) – thanks @bmakuh! - Support constructing
Nothing
with explicitnull
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.
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.