[Ur] Anonymous function remains at code generation?

David Snider david at davidsnider.net
Sun Jun 2 09:09:01 EDT 2013


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

)
On 06/01/2013 06:15 PM, Istvan Chung wrote:
> 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.
>




More information about the Ur mailing list