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

A Plug should be uniquely identifiable #2

Open
igormoreno opened this issue May 26, 2021 · 1 comment
Open

A Plug should be uniquely identifiable #2

igormoreno opened this issue May 26, 2021 · 1 comment

Comments

@igormoreno
Copy link
Contributor

igormoreno commented May 26, 2021

Plugs are the endpoints of edges. They should be uniquely identifiable (i.e. contain unique ids). The code works now but the type doesn't reflect that uniqueness (currently Plug Int Int). The diagram could be created in an inconsistent state.

Currently, a Plug contains 2 Ints: one identifying the Node and another identifying the Hole within ​the Node. Pattern synonyms guarantee the second Int is appropriately set but not the first.

@igormoreno
Copy link
Contributor Author

https://hackage.haskell.org/package/uniqueid-0.1.1/docs/Data-Unique-Id.html
"The main idea gows back to L. Augustsson, M. Rittri, and D. Synek and is described in their paper 'On generating unique names' (Journal of Functional Programming 4(1), 1994. pp. 117-123)."

State in Haskell
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.52.3656&rep=rep1&type=pdf

http://hackage.haskell.org/package/base-4.15.0.0/docs/Data-Unique.html
(that one doesn't seem good because it creates an IO)

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

No branches or pull requests

1 participant