Unfortunately the type for data containers is `data` so `datatype()` is sort of appropriate :)

I agree that it would be nice to handle primitive types, but we don't have symbols in the language.  So you'd have `datatype($(x))` in which case you're looking at the expanded `x`, not at the symbol called `x`.  Right now in the CFEngine core that makes no difference but in an upcoming release it probably will, according to @sigurdteigen 

So I would leave scalar types out for now.