[MLton] Bug with tuple selection
Wesley W. Terpstra
terpstra at dvs1.informatik.tu-darmstadt.de
Sun Nov 25 09:02:59 PST 2007
The version: cvs HEAD/powerpc
The error:
> xmlSimplify starting
> typeCheck starting
> Type error: actual and formal not of same type
> actual: ('a_4092 * word32) * (word32 * word32)
> formal: (word32 * word32) * (word32 * word32)
> expression: f x_0
> typeCheck raised in 0.06 + 0.00 (0% GC)
The code:
> fun f (a, b) = Int.< (#value a, #value b)
>
> fun copyTo (array, record as {value, offset}) =
> Array.update (array, 1, { value=value, offset = 3 })
>
> fun fixTooBig (array, record) =
> let val left = Array.sub (array, 1)
> val right = Array.sub (array, 2)
> val small = if f (left, right) then left else right
> in if f (record, small)
> then copyTo (array, record)
> else copyTo (array, small)
> end
More information about the MLton
mailing list