[MLton-user] new warn unused anomoly

Sean McLaughlin seanmcl at gmail.com
Tue Oct 21 07:10:41 PDT 2008


Hi,

  I just wanted to contribute a warn-unused anomaly that doesn't occur
on http://mlton.org/WarnUnusedAnomalies.  It regards pattern matching
in records:

structure Tmp =
struct

datatype record = R of {x : int * int}

fun doit () =
    let
       val record = R {x = (1, 2)}
       val R {x as (y, z)} = record
    in
       print (Int.toString (y + z) ^ "\n")
    end

val _ = doit()

end

mlton -default-ann 'warnUnused true' tmp.sml

flags x as an unused variable, even when y, z are used and necessary to extract
y,z by pattern matching.

Best,

Sean



More information about the MLton-user mailing list