Skip to content

Commit

Permalink
Refactor a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
sjakobi committed Aug 9, 2019
1 parent 74e281d commit 9d2b3cb
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions dhall-json/src/Dhall/JSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -447,24 +447,17 @@ dhallToJSON e0 = loop (Core.alphaNormalize (Core.normalize e0))
)
] | isInlineNesting nesting
, Just (alternativeName, mExpr) <- getContents contents -> do
let name = Core.TextLit (Core.Chunks [] alternativeName)

kvs <- case mExpr of
Just (Core.RecordLit kvs) ->
return
(Dhall.Map.insert
field
name
kvs)
kvs0 <- case mExpr of
Just (Core.RecordLit kvs) -> return kvs
Just alternativeContents ->
Left (InvalidInlineContents e alternativeContents)
Nothing ->
return
(Dhall.Map.singleton
field
name)
Nothing -> return mempty

let name = Core.TextLit (Core.Chunks [] alternativeName)

let kvs1 = Dhall.Map.insert field name kvs0

loop (Core.RecordLit kvs)
loop (Core.RecordLit kvs1)

_ -> do
a' <- traverse loop a
Expand Down

0 comments on commit 9d2b3cb

Please sign in to comment.