Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
robotlolita committed Jun 17, 2017
1 parent 47950ae commit 12b8b30
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
61 changes: 61 additions & 0 deletions docs/_docs/v2.0.0/migrating/from-early-v2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,64 @@ title: …from v2.0.0 pre-releases
prev_doc: v2.0.0/migrating/from-data.validation
---

Several breaking changes happened during the pre-releases of Folktale 2, these ensure that the future versions don't need to break anything or live with things that turned out to be bad design decisions. This lists these changes, and how to migrate.


## Contents
{:.no_toc}

* TOC
{:toc}


## Package re-organisation

Most modules in the Base package were moved to allow planned modules to be added without problems.

- `folktale/data/future` is now `folktale/concurrency/future`.
- `folktale/data/task` is now `folktale/concurrency/task`.
- `folktale/data/conversions` is now `folktale/conversions`.
- `folktale/core/fantasy-land` is now `folktale/fantasy-land`.
- `folktale/data/maybe` is now `folktale/maybe`.
- `folktale/data/result` is now `folktale/result`.
- `folktale/data/validation` is now `folktale/validation`.

There were no behaviour or name changes in the modules above, so the only thing that needs to change is your import expression.


## Core.ADT

In the beginning the `core/adt` module was used as a synonymous for tagged unions. To support both sum and product types in the future this has changed a bit.

The `folktale/core/adt` module is now `folktale/adt/union` module, which specifies that it creates union types. The `data` function was also renamed to `union`, and the `ADT` namespace was renamed to `Union` — although this one was used mostly internally.

**Previously:**

{% highlight js %}
const { data, derivations } = require('folktale/core/adt');

const List = data('List', {
Empty(){ },
Cons(value, rest) {
return { value, rest };
}
}).derive(derivations.Equality);
{% endhighlight %}

**Now:**

{% highlight js %}
const { union, derivations } = require('folktale/adt/union');

const List = union('List', {
Empty(){ },
Cons(value, rest) {
return { value, rest };
}
}).derive(derivations.Equality);
{% endhighlight %}


## Alpha versions

Quite a few breaking changes happened during the alpha releases in Folktale. Please see [the Folktale changelog]({% link _docs/v2.0.0/changelog.md %}) for the details.
2 changes: 1 addition & 1 deletion docs/_docs/v2.0.0/migrating/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Here you'll find detailed instructions of how to migrate your code from older Fo
- [Data.Maybe]({% link _docs/v2.0.0/migrating/from-data.maybe.md %})
- [Data.Task]({% link _docs/v2.0.0/migrating/from-data.task.md %})
- [Data.Validation]({% link _docs/v2.0.0/migrating/from-data.validation.md %})
- [Folktale v2.0.0 alpha/beta]({% link _docs/v2.0.0/migrating/from-early-v2.0.0.md %})
- [Folktale v2.0.0 beta]({% link _docs/v2.0.0/migrating/from-early-v2.0.0.md %})

0 comments on commit 12b8b30

Please sign in to comment.