From 9a3bd92d8ffd10e0d1134a4c58d35efa065b8b00 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Fri, 21 Apr 2023 16:31:56 +0200 Subject: [PATCH] Fixed: Predefined was not respected in a codepath in toConstructor --- dhall/src/Dhall/TH.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dhall/src/Dhall/TH.hs b/dhall/src/Dhall/TH.hs index b6790f79e..c29b7b071 100644 --- a/dhall/src/Dhall/TH.hs +++ b/dhall/src/Dhall/TH.hs @@ -372,15 +372,17 @@ toConstructor typeParams GenerateOptions{..} haskellTypes outerTypeName (constru case maybeAlternativeType of Just dhallType - | let predicate Scoped{} = False + | let predicate haskellType@Predefined{} = Core.judgmentallyEqual (code haskellType) dhallType + predicate Scoped{} = False predicate haskellType = Core.judgmentallyEqual (code haskellType) dhallType && typeName haskellType /= outerTypeName , Just haskellType <- List.find predicate haskellTypes -> do - let innerName = - Syntax.mkName (Text.unpack (typeName haskellType)) + let inner = case haskellType of + Predefined{..} -> haskellSplice + _ -> ConT (Syntax.mkName (Text.unpack (typeName haskellType))) - return (NormalC name [ (bang, ConT innerName) ]) + return (NormalC name [ (bang, inner) ]) Just (Record kts) -> do let process (key, dhallFieldType) = do