[Ur] Anonymous function remains at code generation?

Istvan Chung istvan at vivatropolis.org
Sat Jun 1 18:15:56 EDT 2013


Hello,

I'm getting the error

    test.ur:13:16: (to 13:27) Anonymous function remains at code
    generation
    Function:  (fn _ : {} => None)

For this code (sorry it's big!): <<EOF

con tC = [ Id = int, Next = option int ]
type tT = $tC
table theTable : tC

fun getRowById (id : int) : transaction (option tT) =
    rOpt <- oneOrNoRows (SELECT *
                         FROM theTable
                         WHERE theTable.Id={[id]});
    case rOpt of
        None => return None
      | Some row => return (Some row.TheTable)

fun getRowByOptionId (idOpt : option int) : transaction (option tT) =
    case idOpt of
        None => return None (* Line 13; Error message points here *)
      | Some nextId => (getRowById nextId)

fun deleteRow (id : int) : transaction unit =
    thisRowOpt <- getRowById id;
    case thisRowOpt of
	None => return ()
      | Some thisRow => (a <- (getRowByOptionId thisRow.Next);
                               (* snip deleting logic *)
                               return ())

fun deleteRowHandler r =
    deleteRow 0;
    return <xml/>

fun main () =
    return
      <xml>
        <head><title>Example</title></head>
        <body>
          <form><submit action={deleteRowHandler}/></form>
        </body>
    </xml>
EOF

This file contains a small portion of the code relating to row deleting,
with as much taken out as I could without the error mysteriously
disappearing. I have absolutely no idea what's causing this error; it
doesn't seem (to me) that there's anything unusual about this code.

-- 
Istvan Chung



More information about the Ur mailing list