<div>Thanks for the previous TR assist. <br></div><div>I tried manually annotating stuff inside the 'get' procedure below but can't seem to get it to type check.</div><div>Thanks again in advance.</div><div><br>
</div><div>(struct: (T) Try ())</div><div><br></div><div>(struct: (T) Failure Try ([exception : exn]))</div><div><br></div><div>(struct: (T) Success Try ([result : T]))</div><div><br></div><div>(: failed (All (T) (Try T) -> Boolean))</div>
<div>(define (failed try)</div><div> (Failure? try))</div><div><br></div><div>(: succeded (All (T) (Try T) -> Boolean))</div><div>(define (succeded try)</div><div> (Success? try))</div><div><br></div><div>(: get (All (T) (Try T) -> T))</div>
<div>(define (get try)</div><div> (cond</div><div> ((Failure? try) (raise (Failure-exception try)))</div><div> ((Success? try) (Success-result try))</div><div> (else (error "Can I not be 'sealed'"))))</div>
<div> </div><div>(: tmap (All (T U) (Try T) (T -> U) -> (Try U)))</div><div>(define (tmap try fn)</div><div> (cond </div><div> ((Success? try)</div><div> (Try (fn (Success-result try))))</div><div> ((Failure? try) try)</div>
<div> (else (error "hmmmm"))))</div><div> </div><div>(: attempt (Try String))</div><div>(define attempt (Success "Good to go"))</div><div> </div><div>(: test (-> String))</div><div>(define (test)</div>
<div> (if (succeded attempt)</div><div> (get attempt)</div><div> "aborted"))</div><div> </div>