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

Help with help #19

Open
yaitskov opened this issue Sep 8, 2023 · 1 comment
Open

Help with help #19

yaitskov opened this issue Sep 8, 2023 · 1 comment

Comments

@yaitskov
Copy link

yaitskov commented Sep 8, 2023

Hi,

There is no doc or test with generics.

data SumOfConst
  = SumOfConstA
  | SumOfConstB
derive instance eqActivationFun :: Eq SumOfConst
derive instance genericActivationFun :: Generic SumOfConst _
instance showActivationFun :: Show SumOfConst where
  show u = genericShow u

instance EncodeAeson SumOfConst where
  encodeAeson x = gEncodeAeson x (Proxy :: Proxy _)

gEncodeAeson returns Object a. I could get a via Foreign.Object.values but it returns an array which could be empty. So to avoid partial function some empty Aeson should be returned if array is empty. It doesn't look like correct way of using the library.

@yaitskov
Copy link
Author

yaitskov commented Sep 8, 2023

I see I need to wrap Object Aeson into encoeAeson though SumOfConst type is not a record :(

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

1 participant