     }
     
     @warn_unused_result
-    func replaceNil(with: Value.Wrapped) -> Distillate<Value.Wrapped> {
-        return replaceNil { with }
+    func replaceNil(@autoclosure(escaping) with: () -> Value.Wrapped) -> Distillate<Value.Wrapped> {
+        return replaceNil { with() }
     }
     
     @warn_unused_result

    }
    
    @warn_unused_result
    func catchReturn(value: Value) -> SecureDistillate<Value> {
        return catchReturn { _ in value }
    }
}

public extension DistillateType where Value: OptionalType {
    @warn_unused_result
    func replaceNil(@noescape with: () -> Value.Wrapped) throws -> Value.Wrapped {
        return try map { $0.optionalValue ?? with() }
    }
    
    @warn_unused_result

import Foundation

public struct Distillate<Value>: DistillateType {
    private let thunk: () throws -> Value
    
    init(_ thunk: () throws -> Value) {
        self.thunk = thunk
    }
    
    @warn_unused_result
    public func to(_: Value.Type) throws -> Value {
        return try thunk()
    }
    
    @warn_unused_result
    public func value() throws -> Value {
        return try thunk()
    }
}

public struct SecureDistillate<Value>: DistillateType {
    private let thunk: () -> Value
    
    init(_ thunk: () -> Value) {
        self.thunk = thunk
    }
    
    @warn_unused_result
    public func to(_: Value.Type) -> Value {
        return thunk()
    }
    
    @warn_unused_result
    public func value() throws -> Value {
        return thunk()
    }
}

