You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm thinking about whether I could use parameter to determine whether to have specific field.
Base on my last question, I could pass test argument to determine whether to have b field.
testFunction.dhall
let testFunction = \(args : { test : Bool }) ->
{ a = "123", b = if args.test then Some "test" else None Text }
in testFunction
I would like to make it to be more flexible more than just text but got the issue with mismatch field error.
Hope you guys could give me more context how to make it work.
a.dhall
let a = {
version = "123",
description = "456"
} in a
b.dhall
let testFunction = \(args : { test : Bool }) ->
{ a = "123", b = if args.test then ./a.dhall else None Text }
in testFunction
Error message
dhall-to-yaml-ng <<< './b.dhall {test=True}'
↳ ./b.dhall
Error: ❰if❱ branches must have matching types
- None
+ Optional
…
2│ if args.test then ./a.dhall else None Text
/Users/Projects/learning-dhall/b.dhall:2:20
1│ ./b.dhall
(input):1:1
Thanks!
The text was updated successfully, but these errors were encountered:
Hi team!
I'm thinking about whether I could use parameter to determine whether to have specific field.
Base on my last question, I could pass test argument to determine whether to have b field.
I would like to make it to be more flexible more than just text but got the issue with mismatch field error.
Hope you guys could give me more context how to make it work.
a.dhall
b.dhall
Error message
Thanks!
The text was updated successfully, but these errors were encountered: