12 Module Types for Stacks and Queues

Let's write a signature to describe the stacks we wrote before.

Now let's grab our code from before.

Yay, no error! The types match, but what about MyStack?

Uh oh... our signature required empty to have type 'a list.

The signature we wrote for stack wasn't general enough. Let's generalize it!

Now our signature is general enough for both of these!

Let's make one for queues.

And let's bring in our queues from earlier

We can also use modules as values