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

Need some guidance / documentation #25

Open
ddssff opened this issue Feb 14, 2020 · 2 comments
Open

Need some guidance / documentation #25

ddssff opened this issue Feb 14, 2020 · 2 comments

Comments

@ddssff
Copy link

ddssff commented Feb 14, 2020

I'm sorry to say I'm a bit mystified by the API. I would like to use this to build sets of error types. Suppose I had a value of type s, where s was a set of error types. How do I write functions to (1) lift an error type into a set type: Member e s => e -> s, and (2) decompose an error set value: Member e s => s -> Either e (Delete e s)? Am I barking up the wrong tree?

@dorchard
Copy link
Owner

Hi @ddssff ,
The way this library works is that a type level set is a data type Set xs where xs is a list of a type level things,. For example, you can have type level sets of nats as shown in the example here: https://hackage.haskell.org/package/type-level-sets

If you already have some type s then it will need to be something that is promotable so that the constructors of s can be put inside type level sets. Do you have a particular s in mind?

@ddssff
Copy link
Author

ddssff commented Feb 26, 2020

What we ended up doing is writing this: https://github.com/seereason/sr-extra/blob/master/Extra/Errors.hs. It lets us create a type with is the sum of a set of named (error) types, and manipulate values of that sum type. The only thing missing is sorting of the type list, but I see code around that could do it.

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