annotate tests/type_class.lac @ 218:a3413288cce1

Signature ascription for type classes
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 16:57:21 -0400
parents ba4d7c33a45f
children
rev   line source
adamc@211 1 class default t = t
adamc@211 2
adamc@212 3 val string_default : default string = "Hi"
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@212 8 val hi = default [string] _
adamc@211 9 val zero = default [int] _
adamc@212 10
adamc@212 11 val frob : t :: Type -> default t -> t =
adamc@212 12 fn t :: Type => fn _ : default t => default [t] _
adamc@212 13 val hi_again = frob [string] _
adamc@212 14 val zero_again = frob [int] _
adamc@212 15
adamc@212 16 val main : unit -> page = fn () => <html><body>
adamc@212 17 {cdata hi_again}
adamc@212 18 </body></html>