willbasky / hibet

Tibetan-English translator for CLI
BSD 3-Clause "New" or "Revised" License
13 stars 4 forks source link

Replace JSON with TOML using tomland #78

Closed silverweed closed 4 years ago

silverweed commented 4 years ago

Addresses #77.

I removed the dependency from Aeson and transformed stuff.json into TOML format. In doing so I added the path key (which was the dictionary key before) and turned the Json dictionary itself into an array named titles.

From:

{
  <path>: { /* entry */ },
  ...
}

to (conceptually):

[
  {
    "path": <path>,
    /* entry */
  },
   ...
]

I (manually) tested the change and it seems to work fine.


This change is Reviewable

willbasky commented 4 years ago

src/Labels.hs, line 3 at r1 (raw file):

{-# LANGUAGE LambdaCase           #-}
{-# LANGUAGE OverloadedStrings    #-}

This pragmas are included in .cabal file already.

willbasky commented 4 years ago

src/Labels.hs, line 1 at r1 (raw file): Is there any unused functions in this module?

willbasky commented 4 years ago

src/Labels.hs, line 23 at r1 (raw file): Let use meta <- T.decodeUtf8 <$> BS.readFile file where T and BS is from

import qualified Data.ByteString as BS
import qualified Data.Text as T

because of https://www.snoyman.com/blog/2016/12/beware-of-readfile

willbasky commented 4 years ago

src/Labels.hs, line 1 at r1 (raw file):

Previously, willbasky (Vladislav Sabanov) wrote…
Is there any unused functions in this module?

https://guide.aelve.com/haskell/how-to-make-code-warning-free-qkostv6r#item-ogh2yr1a

silverweed commented 4 years ago

Thanks for the reviews and explanations, I'll push the fixes as soon as I have time :)

willbasky commented 4 years ago

Thank you very much for contributing!

willbasky commented 4 years ago
:lgtm: