isn't 0::uint1 casting an int as uint and '0'::uint1 is casting a text as a uint1 ?
The second one isn't casting, period. It is an alternate spelling of "uint1 '0'" which itself is how you write a typed literal in SQL (:: syntax is a PostgreSQL extension). The text between the single quotes is an untyped character string that gets passed directly into the declared type's constructor/_in function.
Since the first one is not quoted the value is interpreted as a number (special case reserved for core types, I think) and the :: is then interpreted as a cast in order to go from the number to the custom type.
David J.