I'm having trouble
understanding recursive types (e.g., as described in Functional Programming
with Overloading and Higher-Order Polymorphism by
Jones.
He gives as an
example
> data Mu f = In
(f (Mu f))
> data NatF s =
Zero | Succ s
> type Nat = Mu
NatF
Among the things I
don't get are:
1. Comparing
this to the non-higher-order type:
> data NatX =
Zero | Succ NatX
What are the
advantages of the higher-order type? What are the disadvantages (incl.
runtime costs)?
2. How are
values of type Nat represented? (It helps me to think about these things
concretely.)
Thanks! --
Dave
