[Ur] How to serialize/deserialize data structures?

Artyom Shalkhakov artyom.shalkhakov at gmail.com
Fri Jan 15 06:34:47 EST 2010


Hello,

Looking through basis.urs in the latest stable version, one finds:

> con serialized :: Type -> Type
> val serialize : t ::: Type -> t -> serialized t
> val deserialize : t ::: Type -> serialized t -> t
> val sql_serialized : t ::: Type -> sql_injectable_prim (serialized t)

The question are
- what are type families
- how to use sql_serialized

Having played a bit with type families of Haskell, I tend to think
that they are type-level functions, defined by induction on the
structure of input types. That is, a type family is defined by
clauses, where each clause can employ some sort of pattern matching
over it's input types. Is this intuition correct? What are type
families in Ur?

Regarding the second question: the task is to (de)serialize a subset
of HTML. Could somebody provide minimal examples involving, say, basic
types, pairs and "either"?

Cheers,
Artyom Shalkhakov.



More information about the Ur mailing list