From c16d54cf6131a094f65a07cee237437e644fa3d4 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 9e5c6f54c..d2b7d39d4 100644 --- a/dhall/src/Dhall/TH.hs +++ b/dhall/src/Dhall/TH.hs @@ -379,15 +379,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