Reputation: 3749
I have got an error: Not a data constructor: "%:"
:
data KV = forall a. Show a => (%:) Text a
Interestingly, but :%
is fine as data constructor! %%
is not fine again. But %%
is fine to be infix function. Why is it treating as an error? What is the difference between these variants?
Upvotes: 2
Views: 282
Reputation: 27023
It's not a valid name for a data constructor. All infix operator data constructors must start with :
. So (:%)
would be fine.
This is just the operator equivalent of "constructors must start with capital letters", as a syntactic means to distinguish constructors from other names when pattern matching.
Upvotes: 4