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

How can I use a Map or Dict or similar thing ? #65

Open
luochen1990 opened this issue Aug 27, 2024 · 1 comment
Open

How can I use a Map or Dict or similar thing ? #65

luochen1990 opened this issue Aug 27, 2024 · 1 comment

Comments

@luochen1990
Copy link
Contributor

No description provided.

@cdepillabout
Copy link
Member

cdepillabout commented Sep 14, 2024

PureScript has built-in extensible records, which might work for you depending on what you're trying to do: https://github.com/purescript/documentation/blob/master/language/Records.md. PureNix compiles PureScript's built-in records to Nix attrsets.

PureScript also has a foreign-object library, which effectively just wraps around JS objects in the JS backend. This library is not yet ported to PureNix, but you can imagine it would be straightforward(?) to port. (There is also a library called just foreign that is somewhat related depending on what you're trying to do.)

In cabal2nixWithoutIFD, I implemented my own AttrSet type:

https://github.com/cdepillabout/cabal2nixWithoutIFD/blob/484515bdec2ccf9dfc02b9a442b801bc2d17b9cc/purescript-parser-combinator/src/NixBuiltins.purs#L6-L8

This type of thing would ideally go into some sort of nix-builtins library instead.

There is also ordered-collections, which I believe is more similar to Haskell's Map type, and may be what you're looking for. This library also hasn't been ported to PureNix.

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

No branches or pull requests

2 participants