nil has Resource as its nominal type, and can be cast to any type except int, boolean, and double.
The function
boolean function nul(<Type> x)
determines whether x is a nul value. nul applies to all types except int, boolean, and double.
nil is not the same as the resource rdf:nil. The former indicates absence of an RDF resource, while the latter is a legitimate RDF resource used to indicate the end of an rdf:List.