Decode a
Set from a
List with distinct elements.
>>> input (setFromDistinctList natural) "[1, 2, 3]"
fromList [1,2,3]
An error is thrown if the list contains duplicates.
>>> input (setFromDistinctList natural) "[1, 1, 3]"
*** Exception: Error: Failed extraction
The expression type-checked successfully but the transformation to the target
type failed with the following error:
One duplicate element in the list: 1
>>> input (setFromDistinctList natural) "[1, 1, 3, 3]"
*** Exception: Error: Failed extraction
The expression type-checked successfully but the transformation to the target
type failed with the following error:
2 duplicates were found in the list, including 1