view tests/recBad.ur @ 1736:7ec8dab190a7

Better discovery of type class instances from recursive definitions
author Adam Chlipala <adam@chlipala.net>
date Wed, 02 May 2012 08:34:50 -0400
parents 71bafe66dbe1
children
line wrap: on
line source
datatype list a = Nil | Cons of a * list a

fun append (t ::: Type) (ls1 : list t) (ls2 : list t) : list t =
        case ls1 of
            Nil => ls2
          | Cons (h, t) => Cons (h, append t ls2)

(*val rec ones : list int = Cons (1, ones)*)
val rec ones = fn () => Cons (1, ones ())