Given:
data MyRecord a = MyRecord{list :: [a], other_fields :: Char, …}
I am trying to write a function which puts a new a
on list and returns a new MyRecord
:
pushOntoList :: a -> MyRecord -> MyRecord
Question:
Is there a way to write pushOntoList
is such a way that it does not depend on what is in the rest of the record, but simply gives it back unmodified?
Another way to ask this is can you write pushOntoList
without seeing the rest of the MyRecord
definition?