Skip to content

Commit

Permalink
Fixed: Predefined was not respected in a codepath in toConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
mmhat committed Nov 19, 2023
1 parent eb683cd commit c16d54c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dhall/src/Dhall/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c16d54c

Please sign in to comment.