Add SigBoolean and SBoolean?
Closed this issue · 9 comments
The current genericBool instance seems fine to me? I'm not sure the advantage of adding another special case constructor here...
The idea was to try to keep the Signature/Spine datatypes as tight as possible to make writing generic functions easier with fewer cases...
Yes, but Signature doesn't give the type constructor name, so I can't deserialize Boolean in a special way in generic-foreign for example.
Also, I think it makes sense to make a special case of Boolean, like we do for every other Prim type. They are built in, after all. Boolean isn't implemented as an ADT.
When you say, "signature doesn't give the type constructor name" -- isn't this what you're asking for?
toSignature _ = SigProd [{sigConstructor: "true",sigValues: []},
{sigConstructor: "false",sigValues: []}]
I'd like
toSignature _ = SigProd "Prim.Boolean"
[{sigConstructor: "True",sigValues: []},
{sigConstructor: "False",sigValues: []}]assuming it were a real ADT.
Yes, but this is the easier fix which doesn't need compiler changes. Moreover, I think this is a good change in its own right. Boolean looks like an ADT, but it's not, and why make a special case for every Prim type, but not Boolean? Generic should represent the internal structure of types, and it does, apart from this one case 😄
Ok, I buy it. 👍
Cool :) I'll test some more and merge my PR then.