<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div style="font-family:Arial;">On Thu, 5 Jan 2017, at 18:13, Ankit Agarwal wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><div>Using swift module in REPL:<br></div>
</div>
</blockquote><div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">[...]<br></div>
<div style="font-family:Arial;"><br></div>
<blockquote type="cite"><div dir="ltr"><div>$ swift build<br></div>
<div>$ swift -I .build/debug -L .build/debug -lResult -I /usr/lib/clang/3.8/include<br></div>
<div>Welcome to Swift version 3.1-dev (LLVM 217eb6c2b6, Clang 34a98ce92e, Swift 1eb5648c46). Type :help for assistance.<br></div>
<div> 1> import Result<br></div>
<div> 2> let a = Result<String, AnyError>("a")<br></div>
<div>a: Result.Result<String, Result.AnyError> = success {<br></div>
<div> success = "a"<br></div>
<div>}<br></div>
</div>
</blockquote><div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Oh wait, this works for me! It was the specific thing I was trying to do (wrapping an NSError instance in an AnyError) that breaks which was leading me to think importing the Result library into the REPL wasn't working:<br></div>
<div style="font-family:Arial;"><br></div>
<div>$ swift -<a href="http://I.build/debug">I.build/debug</a> -<a href="http://L.build/debug">L.build/debug</a> -lResult <br></div>
<div>Welcome to Swift version 3.0.2 (swift-3.0.2-RELEASE). Type :help for assistance.<br></div>
<div> 1> import Foundation<br></div>
<div> 2> import Result<br></div>
<div> 3> let r = Result<String, AnyError>("a")<br></div>
<div>r: Result.Result<String, Result.AnyError> = success {<br></div>
<div> success = "a"<br></div>
<div>}<br></div>
<div> 4> let nse = NSError(domain: "Foo", code: 42, userInfo: nil)<br></div>
<div>nse: Foundation.NSError = {<br></div>
<div> Foundation.NSObject = {}<br></div>
<div> _domain = "Foo"<br></div>
<div> _code = 42<br></div>
<div> _userInfo = nil<br></div>
<div>}<br></div>
<div> 5> let ae = AnyError(nse)<br></div>
<div>ae: Result.AnyError = {<br></div>
<div> error = <extracting data from value failed><br></div>
<div><br></div>
<div>}<br></div>
<div>Execution interrupted. Enter code to recover and continue.<br></div>
<div>Enter LLDB commands to investigate (type :help for assistance.)<br></div>
<div> 6> <br></div>
<div><br></div>
<div style="font-family:Arial;">So it looks like I have a Foundation on Linux bug? I will do what the REPL suggests and see if I can figure out what's going on.<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Thanks, Robert.</div>
</body>
</html>