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

let type aliases declared inside a function be available for parameters and the result type #8704

Closed
zpdDG4gta8XKpMCd opened this issue May 20, 2016 · 2 comments

Comments

@zpdDG4gta8XKpMCd
Copy link

zpdDG4gta8XKpMCd commented May 20, 2016

consider

// currently have to deal with
export function glueAllHomoDiffs<a>(diffs: edf.HomoDifference<NativeSet<a>>[]): edf.HomoDifference<NativeSet<a>> {
    return ea.fold(
        diffs,
        edf.toHomoNoneOf<NativeSet<a>>(),
        (result, diff) => edf.glueHomoDifference(result, diff, glue, shallowCopy)
    );
}


// wish could do
export function glueAllHomoDiffs<a>(diffs: Difference[]): Difference {

    type Selection = NativeSet<a>;
    type Difference = edf.HomoDifference<Selection>;

    return ea.fold(
        diffs,
        edf.toHomoNoneOf<Selection>(),
        (result, diff) => edf.glueHomoDifference(result, diff, glue, shallowCopy)
    );
}
@mhegazy
Copy link
Contributor

mhegazy commented May 20, 2016

Same as my response to #7061 (#7061 (comment)). This should be easily defined using a type alias declaration outside the function, and not worth changing the scopign rules e.g.:

type Selection<a> = NativeSet<a>;
type Difference<a> = edf.HomoDifference<Selection<a>>;
export function glueAllHomoDiffs<a>(diffs: Difference<a>[]): Difference<a> {
...

@zpdDG4gta8XKpMCd
Copy link
Author

it's all fun and games when there is only a which is indeed simple, let me close it and reopen when i find a better example

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants