Skip to content

Commit d0b1f20

Browse files
committed
Fixed: Predefined was not respected in a codepath in toConstructor
1 parent eb1b806 commit d0b1f20

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dhall/src/Dhall/TH.hs

+6-4
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,17 @@ toConstructor typeParams GenerateOptions{..} haskellTypes outerTypeName (constru
379379

380380
case maybeAlternativeType of
381381
Just dhallType
382-
| let predicate Scoped{} = False
382+
| let predicate haskellType@Predefined{} = Core.judgmentallyEqual (code haskellType) dhallType
383+
predicate Scoped{} = False
383384
predicate haskellType =
384385
Core.judgmentallyEqual (code haskellType) dhallType
385386
&& typeName haskellType /= outerTypeName
386387
, Just haskellType <- List.find predicate haskellTypes -> do
387-
let innerName =
388-
Syntax.mkName (Text.unpack (typeName haskellType))
388+
let inner = case haskellType of
389+
Predefined{..} -> haskellSplice
390+
_ -> ConT (Syntax.mkName (Text.unpack (typeName haskellType)))
389391

390-
return (NormalC name [ (bang, ConT innerName) ])
392+
return (NormalC name [ (bang, inner) ])
391393

392394
Just (Record kts) -> do
393395
let process (key, dhallFieldType) = do

0 commit comments

Comments
 (0)