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

[#133] Patching EDSL for arrays of tables #142

Merged
merged 3 commits into from
Nov 16, 2018

Conversation

jiegillet
Copy link
Collaborator

@jiegillet jiegillet commented Nov 13, 2018

Resolves #133

✅ Check list

  • CHANGELOG
  • New/fixed features work as expected (No new tests).
  • There are no warnings during compilation.
  • hlint . output is: No Hints .
  • The code is formatted with the stylish-haskell tool
    using [stylish-haskell.yaml][stylish] file in the repository.
  • The code style of the files you changed is preserved.
  • Commit messages are in the proper format.
    Start the first line of the commit with the issue number in square parentheses.

@jiegillet jiegillet changed the title [133] Patching EDSL for arrays of tables [#133] Patching EDSL for arrays of tables Nov 13, 2018
@jiegillet jiegillet self-assigned this Nov 13, 2018
@jiegillet jiegillet added the codec Conversion between TOML and custom user data types label Nov 13, 2018
@chshersh chshersh requested review from vrom911 and chshersh and removed request for vrom911 November 15, 2018 14:30
@chshersh chshersh added this to the v1.0.0: Public release milestone Nov 15, 2018
Copy link
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to update the CHANGELOG 😏

src/Toml/Edsl.hs Outdated

-- | Adds array of tables to the 'TDSL'.
array :: Key -> NonEmpty TDSL -> TDSL
array k = modify . insertTableArrays k . fmap mkToml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant' think of better API for inserting array of tables, so let's keep this type and this implementation.

src/Toml/Edsl.hs Outdated
-- | Adds key-value pair to the 'TDSL'.
(=:) :: Key -> Value a -> TDSL
(=:) k v = modify $ insertKeyVal k v

-- | Adds table to the 'TDSL'.
table :: Key -> TDSL -> TDSL
table k = modify . insertTable k . mkToml

-- | Adds array of tables to the 'TDSL'.
array :: Key -> NonEmpty TDSL -> TDSL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like array is not the best name because it conflicts with ordinary arrays in TOML.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tableArray?

src/Toml/Edsl.hs Outdated
@@ -9,20 +9,28 @@ exampleToml = mkToml $ do
\"key2\" =: Bool True
table \"tableName\" $
\"tableKey\" =: Array [\"Oh\", \"Hi\", \"Mark\"]
array \"arrayName\" $
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, it's also should be tableArray now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, thank you!

Copy link
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@chshersh chshersh merged commit be1a497 into kowainik:master Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codec Conversion between TOML and custom user data types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Road to Arrays of Tables - Patching EDSL
3 participants