Initial typing. Check it with check-ns

Commented out the rest of the module so check-ns works.
Made entity lists into linked lists living inside the state monad, implemented code to map state functions over such lists.