From 0dabb5044054d1071a812cecd716c98cc86b6b90 Mon Sep 17 00:00:00 2001 From: Gabriella Gonzalez Date: Fri, 24 Nov 2023 19:32:27 -0800 Subject: [PATCH] Fix `dhall-docs` panic Fixes https://github.com/dhall-lang/dhall-haskell/issues/2529 --- dhall-docs/src/Dhall/Docs/CodeRenderer.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dhall-docs/src/Dhall/Docs/CodeRenderer.hs b/dhall-docs/src/Dhall/Docs/CodeRenderer.hs index 789fcc3fb..51224bb64 100644 --- a/dhall-docs/src/Dhall/Docs/CodeRenderer.hs +++ b/dhall-docs/src/Dhall/Docs/CodeRenderer.hs @@ -245,16 +245,16 @@ fragments = Data.List.sortBy sorter . removeUnusedDecls . Writer.execWriter . in return NoInfo where - handleRecordLike l = RecordFields . Set.fromList <$> mapM f l + handleRecordLike l = RecordFields . Set.fromList . concat <$> mapM f l where f (key, RecordField (Just Src{srcEnd = startPos}) val (Just Src{srcStart = endPos}) _) = do dhallType <- infer context val let nameSrc = makeSrcForLabel startPos endPos key let nameDecl = NameDecl nameSrc key dhallType Writer.tell [SourceCodeFragment nameSrc (NameDeclaration nameDecl)] - return nameDecl + return [ nameDecl ] where - f _ = fileAnIssue "A `RecordField` of type `Expr Src Import` doesn't have `Just src*`" + f _ = return [ ] fileAsText :: File -> Text fileAsText File{..} = foldr (\d acc -> acc <> "/" <> d) "" (Core.components directory)