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 Apr 21, 2023
1 parent d465892 commit 9a3bd92
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 @@ -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
Expand Down

0 comments on commit 9a3bd92

Please sign in to comment.