Added primitive functions for `list?` `string?` etc

This code is very repetitive and we are trying to figure out a way to
DRY these functions, but it seems to be the kind of thing you can't do
in Haskell