Mercurial > urweb
annotate tests/type_class.lac @ 211:e86411f647c6
Initial type class support
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 16 Aug 2008 14:32:18 -0400 |
parents | |
children | ba4d7c33a45f |
rev | line source |
---|---|
adamc@211 | 1 class default t = t |
adamc@211 | 2 |
adamc@211 | 3 val string_default : default string = "" |
adamc@211 | 4 val int_default : default int = 0 |
adamc@211 | 5 |
adamc@211 | 6 val default : t :: Type -> default t -> t = |
adamc@211 | 7 fn t :: Type => fn d : default t => d |
adamc@211 | 8 val empty = default [string] _ |
adamc@211 | 9 val zero = default [int] _ |