Enum with single value not supported as LF enum
See original GitHub issueIt’s not possible to use an enum with a single value in DAML that would translate to a LF enum, e.g. data myEnum = myEnumA
. The recommended workaround is to write data myEnum = myEnumA ()
, but this translates to a variant.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
It is proper to have an enum with a single value?
it means absence of a user ID, and if it's 42 , then that's the user ID. With an enum type with only...
Read more >enum — Support for enumerations — Python 3.11.1 ...
Allows Enum members to have attributes without conflicting with member names. unique(). Enum class decorator that ensures only one name is bound to...
Read more >Build Enumerations of Constants With Python's Enum
In this tutorial, you'll learn how to create and use enumerations of semantically related constants in Python. To do this, you'll use the ......
Read more >Documentation: 15: 8.7. Enumerated Types - PostgreSQL
Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in...
Read more >Handbook - Enums - TypeScript
It does not have an initializer and the preceding enum member was a numeric constant. In this case the value of the current...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correct. What I would like is that
data X = X
compiles to a singleton LFEnum
It won’t be a problem ifdata X = X ()
compiles to a variant, anddata X = X {}
compiles to an empty record although I struggle to see the utility of the two latter ones.I thought a bit about the implementation and I believe it should be fairly straightforward:
DataCon
) and look at the DALF for that module to see how we desugared it previously.