```ceylon
public class SimpleList<T> (T? head, SimpleList<T>? tail)
    satisfies Iterable<T>
{
    public T? car = head;
    public SimpleList<T> ? cdr = tail;

    public Iterator<T> iterator() {
        return SimpleIterator<T>(this);
    }

   public class SimpleIterator<T> (SimpleList<T> ? l)
       satisfies Iterator<T>
   {
        SimpleList<T> ? list = l;

        T? head() {
            if (exists list) {
                return list.car;
            } else {
                return null;
            }
        }

        Iterator<T> tail() {
            if (exists list) {
                return SimpleIterator<T>(list.cdr);
            } else {
                return SimpleIterator<T>(null);
            }
        }
    }
}
```

Fix optional types in back-end.
user
```ceylon
public class SimpleList<T> (T? head, SimpleList<T>? tail)
    satisfies Iterable<T>
{
    public Iterator<T> iterator() {
        return SimpleIterator<T>(this);
    }

   public class SimpleIterator<T> (SimpleList<T> ? list)
       satisfies Iterator<T>
   {
        T? head() {
            if (exists list) {
                return list.head;
            } else {
                return null;
            }
        }

        Iterator<T> tail() {
            if (exists list) {
                return SimpleIterator<T>(list.tail);
            } else {
                return SimpleIterator<T>(null);
            }
        }
    }
}
```
assistant