Skip to content

Commit

Permalink
Merge pull request #42 from sellout/eliminate-null
Browse files Browse the repository at this point in the history
Remove `null`s from generated JSON
  • Loading branch information
philderbeast authored Sep 12, 2024
2 parents fa70fff + 502aba6 commit 13b283e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Hpack/Dhall.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import Dhall.Core (Expr)
import Dhall.Parser (Src, exprFromText)
import Dhall.Import (loadWith, emptyStatus)
import Dhall.TypeCheck (typeOf)
import Dhall.JSON (dhallToJSON)
import Dhall.JSON (dhallToJSON, omitNull)
import Dhall.Pretty (prettyExpr, layoutOpts)
import qualified Prettyprinter as PP
import qualified Prettyprinter.Render.Text as PP
Expand Down Expand Up @@ -129,7 +129,7 @@ textToJson
textToJson settings text = runExceptT $ do
expr <- liftIO $ check settings text
_ <- liftResult $ typeOf expr
liftResult $ ([],) <$> dhallToJSON expr
liftResult $ ([],) . omitNull <$> dhallToJSON expr
where
liftResult :: (Show b, Monad m) => Either b a -> ExceptT String m a
liftResult = ExceptT . return . first show
Expand Down

0 comments on commit 13b283e

Please sign in to comment.