Deal with nullable input arguments

We map nullable input arguments to (Maybe a) types, with the
convention that Nothing represents NULL, and (Just v) represents a
non-NULL value v.