-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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\" $ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Resolves #133
✅ Check list
hlint .
output is: No Hints .stylish-haskell
toolusing [stylish-haskell.yaml][stylish] file in the repository.
Start the first line of the commit with the issue number in square parentheses.