Closed DanielAsher closed 9 years ago
Why are we not using rethrows
here?
(For my own memory, tying this to #29).
@pthariensflame : The swift-2.0 compiler complains with:
Error: Only function declarations may be marked 'rethrows'
.
did I break the Travis CI build?
The build is broken anyways because Travis is using 1.2 while swift-develop
is on 2.0. It's safe to ignore.
Your error is because the function is missing a throws
in argument position.
This definition compiles
public func fixt<A, B>(f : (A throws -> B) throws -> (A throws -> B)) rethrows -> A throws -> B {
return { x in try f(fixt(f))(x) }
}
Thanks for this. Looks better to me. I'll check this on my client code and submit if successful.
On Sun, Sep 6, 2015 at 9:30 PM Robert Widmann notifications@github.com wrote:
This definition compiles
public func fixt<A, B>(f : (A throws -> B) throws -> (A throws -> B)) rethrows -> A throws -> B { return { x in try f(fixt(f))(x) } }
— Reply to this email directly or view it on GitHub https://github.com/typelift/Swiftx/pull/30#issuecomment-138123756.
@pthariensflame @CodaFi thanks for the fix of fixt
:+1:
I'd love to have a clear idea about the difference in behaviour of the rethrows
version of fixt
.
Please do add any comments here that will help clarify this difference.
From the type signature you presented, it says the fixpoint of a throwing function always throws itself. While we're making that call, we may as well assume the body after the recur can throw too, in which case we shouldnt eat the error.
@DanielAsher It was an honor and a pleasure to be the outlet for your first github pull request. Thank you so much for the changes you've made here :sparkles:
:boat:
and add an exception enabled version
fixt