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

Normalize construction patterns #64

Closed
mlhaufe opened this issue May 25, 2023 · 0 comments · Fixed by #66
Closed

Normalize construction patterns #64

mlhaufe opened this issue May 25, 2023 · 0 comments · Fixed by #66
Assignees
Milestone

Comments

@mlhaufe
Copy link
Owner

mlhaufe commented May 25, 2023

Current state:

traits are PascalCase:

const EvalTrait = trait('evaluate', {
    Lit({ value }) { return value },
    Add({ left, right }) {
        return left.evaluate() + right.evaluate()
    }
})

Data declarations are inconsistent:

const expData = data({
    Lit: { value: {} },
    Add: { left: {}, right: {} }
})

// camelCase or PascalCase?
const peanoData = data((Peano) => ({
    Zero: {},
    Succ: { pred: Peano }
}));

const ListData = data((List, T) => ({
    Nil: {},
    Cons: { head: T, tail: List(T) }
}));

When complected the casing can match:

const List = complect(ListData, [...])

const exp = complect(expData, [...])

// PascalCase?
const peano = complect(peanoData, [...])

data and trait should be consistent as PascalCase, which means data should be a constructor

This implies complect should also produce a constructor and not an instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant