Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

Pattern matching #18

Open
CMCDragonkai opened this issue Jun 28, 2018 · 0 comments
Open

Pattern matching #18

CMCDragonkai opened this issue Jun 28, 2018 · 0 comments
Assignees
Labels

Comments

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jun 28, 2018

Just an issue to discuss pattern matching. Given the difference between hnix and haskell functions.

One thing we can do something where all functions are "anonymous" although they can be bound to names, and names can be within a recursive set. That's how nix works. There's also the use of :, I would prefer to use -> which is more obvious and frees up : to be used for other things (like list deconstruction.

[a, b] -> a + b
(a, b) -> a + b
{a, b} -> a + b
{a, b, ...c) -> a + b
(a: b) -> a + 1

Shall we have \ as a prefix to functions? It would make it easier to parse since we don't have to assume that : is an infix operator compared to Nix: x: x + 1. Although nix makes the left side an equivalent expression. It's just when the : is used, the meanings of the left side data constructors switch from construction to deconstruction.

(Cons a b): a + b

Would mean that Cons is deconstructing.

a: Cons a 1

Would mean that Cons is constructing.

Also like Haskell we would have syntax sugar for multiparmeter functions converted to nested lambdas.

@CMCDragonkai CMCDragonkai self-assigned this Aug 14, 2018
@CMCDragonkai CMCDragonkai added the enhancement New feature or request label Aug 14, 2018
@CMCDragonkai CMCDragonkai added development Coding and removed enhancement New feature or request labels Aug 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

1 participant