Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure pipeable/module implementations for all adts. #12

Closed
baetheus opened this issue May 28, 2021 · 0 comments · Fixed by #20
Closed

Restructure pipeable/module implementations for all adts. #12

baetheus opened this issue May 28, 2021 · 0 comments · Fixed by #20
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@baetheus
Copy link
Owner

Currently, the Type Class instances contain the canonical implementation of their associated functions. ie (for option.ts):

export const Functor: TC.Functor<URI> = {
    map: (fai) => (ta) => isNone(ta) ? ta : some(fai(ta.value)),
};

export const { map } = Functor;

Currently, the deno docs tool doesn't like the typing on export const constructs, let alone the destructured export consts. Thus, this issue if meant to track migrating the canonical map, ap, of, etc implementations to export functions like so:

export function map<A, I>(fai: (a: A) => I): ((ta: Option<A>) => Option<I>) {
    return ta => isLeft(ta) ? ta : some(fai(ta.value));
}

export const Functor: TC.Functor<URI> = { map };

This should allow us to pick up at least the type information in the automatic doc generation. Incidentally, this will make the types on the pipeable exports look nicer too. The downside is that the types for each function export must be declared manually for every function (as opposed to inferred from the eg TC.Functor<URI> type.)

@baetheus baetheus added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels May 28, 2021
@baetheus baetheus self-assigned this May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant