@@ -393,7 +393,9 @@ toConstructor typeParams GenerateOptions{..} haskellTypes outerTypeName (constru
393
393
394
394
Just (Record kts) -> do
395
395
let process (key, dhallFieldType) = do
396
- haskellFieldType <- toNestedHaskellType typeParams haskellTypes dhallFieldType
396
+ haskellFieldType <- case fieldType key of
397
+ Nothing -> toNestedHaskellType typeParams haskellTypes dhallFieldType
398
+ Just haskellFieldType -> return haskellFieldType
397
399
398
400
return (Syntax. mkName (Text. unpack $ fieldModifier key), bang, haskellFieldType)
399
401
@@ -525,6 +527,8 @@ data GenerateOptions = GenerateOptions
525
527
-- Note: The `constructorName` of `SingleConstructor` will be passed to this function, too.
526
528
, fieldModifier :: Text -> Text
527
529
-- ^ How to map a Dhall record field names to a Haskell record field names.
530
+ , fieldType :: Text -> Maybe Type
531
+ -- ^ Override the Haskell type used for a particular field of a Dhall record.
528
532
, generateFromDhallInstance :: Bool
529
533
-- ^ Generate a `FromDhall` instance for the Haskell type
530
534
, generateToDhallInstance :: Bool
@@ -544,6 +548,7 @@ defaultGenerateOptions :: GenerateOptions
544
548
defaultGenerateOptions = GenerateOptions
545
549
{ constructorModifier = id
546
550
, fieldModifier = id
551
+ , fieldType = const Nothing
547
552
, generateFromDhallInstance = True
548
553
, generateToDhallInstance = True
549
554
, makeStrict = False
0 commit comments