antitypical / result Goto Github PK
View Code? Open in Web Editor NEWSwift type modelling the success/failure of arbitrary operations.
License: MIT License
Swift type modelling the success/failure of arbitrary operations.
License: MIT License
I'm trying to install ReactiveCocoa through Carthage with no success, I've come to the conclusion that the problem is in building Result framework, so I tried with this cartfile:
github "antitypical/Result" == 0.4.2
This is what I do:
MacBook-Pro-de-Ricardo-2:RACTest Ricardo$ carthage update
*** Fetching Result
*** Fetching Box
*** Downloading Box at "1.2.2"
*** Checking out Result at "0.4.2"
*** xcodebuild output can be found in /var/folders/7g/3ysplhns0mndfwr4h535nfr00000gn/T/carthage-xcodebuild.mordHg.log
*** Building scheme "Result-iOS" in Result.xcworkspace
A shell task failed with exit code 65:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/Ricardo/Library/Developer/Xcode/DerivedData/Result-hktjintpcyyecvfaasfnmpejpkph/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/armv7/Box_vers.o /Users/Ricardo/Library/Developer/Xcode/DerivedData/Result-hktjintpcyyecvfaasfnmpejpkph/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/Ricardo/Library/Developer/Xcode/DerivedData/Result-hktjintpcyyecvfaasfnmpejpkph/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box_vers.o /Users/Ricardo/Library/Developer/Xcode/DerivedData/Result-hktjintpcyyecvfaasfnmpejpkph/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
And this is the log: https://gist.github.com/Odrakir/9f36dd16d7872bdb9c15
I've been searching around and I did everything I found as a possible solution: Deleting carthage cache, deleting Simulators, reinstalling Xcode... nothing seems to work
Now that Cocoa APIs map to throws
we should be able to remove these and rely entirely on materialize
.
please update the platforms in the pod spec to support watchOS for 0.6-beta.1
Will there ever be?
The tvOS
support should be punted to a 0.7 (or later) version because it's not compatible with Xcode 7. See ReactiveCocoa/ReactiveCocoa#2358 and Carthage/Carthage#754
We’ve had a few PRs along the lines of #123, where someone has submitted a scratch for a not-uncommon itch. We’ve been turning them down—mostly—thus far, but maybe we should instead be finding them a better home.
As I understand it, this is the sort of thing that git
’s contrib
dir exists to enable. Maybe we should consider something similar. Some ideas:
Contrib
(sub?)framework encapsulating conveniences and experimentsThese were convenient in LlamaKit and wondering how you would feel about adding them here.
quite a few changes were made since https://github.com/antitypical/Result/releases/tag/0.5 perhaps it's time to create a new releases...
I feel like we're waffling around a bit, and it'd be great to push a 1.0 release soon. Given that we have a brief window of Swift source stability before it breaks again, seems like we might want to do that sooner rather than later. Are there specific things that we want to have in place before cutting a 1.0 release?
There are a number of people with commit access to this repo now. Especially now that we're at 1.0 it seems like it'd be good to have some sort of guidelines around releasing, versioning, etc. Is there a good standard for this? Is there something we can steal from another project?
cc @antitypical/result
Although I like what Prelude is trying to accomplish, it seems out-of-place as a dependency for Result. Every added dependency is an additional burden for consumers, and Prelude specifically doesn't seem to add enough value here to justify it being a requirement.
c.f. the conversation from #reactivecocoa
/cc @NachoSoto @saniul @tony
Result
as a struct
is awkward to use and having a public Box
that isn’t a separate dependency will only lead to ambiguities.
So per discussion in that PR, we’ll restore Box
to Box.framework and Result
will be an enum
once more.
when integrating SDK using Carthage 0.7.4
get:
dyld: lazy symbol binding failed: Symbol not found:
and also carthage is showing this
Parse error: unexpected SDK key "(string)"
I don't know if it's Swift bug, but I cannot use Result in Swift 2.0 (Xcode 7 beta 3, Result 0.6-beta1)
Hi,
I just wanted to include Result in my project and am running across a few issues. It seems to me as if Alamofire (which is already a dependency) defines its own Result type throwing problems when trying to write functions that return results.
For example Xcode (7.0 beta 5) tells me that I can't write Result<MyDataType, MyErrorType>
because Generic type 'Result' specialized with too many type parameters (got 2, but expected 1)
. I'm basing my usage of Result on this.
Both are linked as frameworks installed via Carthage in a Swift 2.0 project.
I'm guessing issues like this shouldn't actually be occurring, but I'm doing something wrong here. Any pointers would be great, thank you!
I don't think theres a reason why only flatMap should be tied to the >>- operator. I think it's pretty clear that if you use the operator you want to map/flatMap depending on what you are returning from your function. I find it unlikely that someone would consciously want to map to Result<Result<T, ErrorTpe>,ErrorType>
just like its probably an error if you map to Optional<Optional<T>>
and you probably wanted to use flatMap. For extreme cases, they can just type the function name.
Create a cartfile like
github "antitypical/Result" ~> 0.1
Using carthage 0.6.4, run
carthage bootstrap --platform iOS
You'll get
*** Building scheme "Box-iOS" in Box.xcodeproj
*** Building scheme "Prelude-iOS" in Prelude.xcodeproj
*** Building scheme "Either-iOS" in Either.xcworkspace
*** Building scheme "Result-iOS" in Result.xcworkspace
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
There are a couple issues in the log file. It seems to be building the Mac versions of the frameworks as well as the iOS versions, despite telling Carthage the platform. As for the build failing, the last message of the log is
=== BUILD TARGET Prelude-Mac OF PROJECT Prelude WITH CONFIGURATION Release ===
Check dependencies
CodeSign error: code signing is required for product type 'Framework' in SDK 'iOS 8.3'
I would like to do something in the lines of the following:
typealias OperationResult = Result and just have any ErrorType as the error type.
But as it is now I have to declare a concrete ErrorType Result<valuetype, NSError>
Which means I can't use the feature of swift where every enum can just be an ErrorType. I have to use NSError only. Any workarounds?
Name Result
is very common in different libraries (e.g. old BrightFuture had its own result, Alamofire has Result, my own code had Result enum). It would make it easier to handle name collision if the name of the Result module would be different. Due to implicit namespace importing, Swift 2 compiler gets confused of the following
import Alamofire // implicitly exposes Result enum (Alamofire.Result)
import Result // implicitly exposes Result enum (Result.Result)
func foo() -> Result.Result<NSData, NSError> { ... } // compiler thinks the Result before dot refers to implictly exposed enums, not to the module
I am getting a build error when installing Result via Carthage (Xcode 6.3b4 for swift 1.2).
➜ carhage update --platform iOS
*** Fetching Result
*** Fetching Either
*** Fetching Box
*** Fetching Prelude
*** Checking out Box at "18d05a56845837eea90a36854c67de2520983bf8"
*** Checking out Result at "fdb2f9b7023647db606879119b09f4c732214592"
*** Checking out Prelude at "180e9ae5e60ec47abd8f3e0fa68cafbbbd160abe"
*** Checking out Either at "026d3471bca7c9573fdec46bab3d8f265d2ec001"
*** xcodebuild output can be found in /var/folders/80/316467jj2czbnz4cmvt0nw800000gn/T/carthage-xcodebuild.rOohbK.log
*** Building scheme "Box-iOS" in Box.xcodeproj
*** Building scheme "Prelude-iOS" in Prelude.xcodeproj
*** Building scheme "Either-iOS" in Either.xcworkspace
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Running carthage build --no-skip-current
yields
➜ carthage build --no-skip-current
*** xcodebuild output can be found in /var/folders/80/316467jj2czbnz4cmvt0nw800000gn/T/carthage-xcodebuild.1WaA9F.log
*** Building scheme "Result-iOS" in Result.xcworkspace
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64 /Users/aschuch/Downloads/Result-master/Result/Result.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
As a follow up to #41, it would be great if you could push 0.4.2 to CocoaPods. The latest version there currently is 0.4.
Thanks!
In version 0.4.4
thisgithub "robrix/Box"
should be changed to github "robrix/Box" ~> 1.2.2
. Because if not proyects including result (using Swift 1.2) should explicity add Box
to their Cartfile
because the latest version of box is not compatible with Swift 1.2
My Cartfile contains only:
github "ReactiveCocoa/ReactiveCocoa" "swift2"
Running cartage update
results in this error:
Failed to discover shared schemes in project Result.xcodeproj—either the project does not have any shared schemes, or xcodebuild never returned
If you believe this to be a project configuration error, please file an issue with the maintainers at https://github.com/antitypical/Result/issues/new
Running carthage update --platform iOS
avoids the problem, so I suspect there might be something in a non-iOS target of Result's Xcode project that's causing a problem.
I'm using:
Xcode 7 (7A218), and xcode-select is also configured to use those command-line tools
carthage version 0.9.1
My Cartfile.resolved contains:
github "antitypical/Result" "0.6.0-beta.3"
github "ReactiveCocoa/ReactiveCocoa" "50af8fec8d1825d65c81f13efee3bbfb808a1242"
Hi, not much of an issue but a general question, in the https://github.com/antitypical/Result/blob/master/Result/Result.swift file the import statements are at the bottom.. any particular reason for this?
Thanks
It looks like 1756b77 intended to remove the dependency on Prelude, but the tests still import it and use unit()
in ResultTests.testInitOptionalSuccess()
Would you be open to adding recover
and recoverWith
to Result
. They're similar to map
and flatMap
except that they are given closures that run when the Result
failed and then provide an opportunity to make it succeed. The implementation of recover
would actually be identical to the ??
operation.
If you are favorable of this change, I'd like to make a PR.
For more context, see Thomvis/BrightFutures#49, where we're discussing to replace a custom Result implementation with this library and identify the functions discussed here as the biggest missing piece.
The naming comes from Scala (http://www.scala-lang.org/api/2.10.1/index.html#scala.concurrent.Future), at least that's where I got it from.
I was trying to work on proyects that require XCode 6.4 and when executing carthage update --platform ios
I get the following error with result.
carthage update --platform ios
*** Cloning ReactiveCocoa
*** Cloning Result
*** Cloning Box
*** Checking out Result at "0.4.5"
*** Downloading Box.framework binary at "1.2.2"
*** Downloading ReactiveCocoa.framework binary at "v3.0"
*** xcodebuild output can be found in /var/folders/gf/dslbq4t94zg44sz7wnk2lg2r0000gp/T/carthage-xcodebuild.YvCHnr.log
A shell task failed with exit code 66:
xcodebuild: error: Scheme Result-watchOS is not currently configured for the build action.
github "ReactiveCocoa/ReactiveCocoa" ~> 3.0.0
github "robrix/Box" "1.2.2"
github "antitypical/Result" "0.4.5"
github "ReactiveCocoa/ReactiveCocoa" "v3.0.0"
Is this a Result issue or a Carthage issue?
I tried to install Result using the following Cartfile:
github "antitypical/Result" ~> 0.2
The result is the following output:
$ carthage update *** Fetching Result *** Fetching Either *** Fetching Box *** Fetching Prelude *** Checking out Box at "18d05a56845837eea90a36854c67de2520983bf8" *** Checking out Result at "0.2" *** Checking out Prelude at "180e9ae5e60ec47abd8f3e0fa68cafbbbd160abe" *** Checking out Either at "026d3471bca7c9573fdec46bab3d8f265d2ec001" *** xcodebuild output can be found in /var/folders/p2/v0630kzj4lb8v65d325zn5vh0000gn/T/carthage-xcodebuild.SE01YO.log *** Building scheme "Box-iOS" in Box.xcodeproj objc[36929]: Class XCBuildConfiguration is implemented in both /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Versions/A/DevToolsCore and /Users/jhack/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Peckham.xcplugin/Contents/Frameworks/MHImportBuster.framework/Versions/A/MHImportBuster. One of the two will be used. Which one is undefined. 2015-04-27 16:09:22.961 xcodebuild[36929:1141196] [MT] iPhoneSimulator: SimVerifier returned: Error Domain=NSPOSIXErrorDomain Code=53 "Simulator verification failed." UserInfo=0x7f87ba392f20 {NSLocalizedFailureReason=A connection to the simulator verification service could not be established., NSLocalizedRecoverySuggestion=Ensure that Xcode.app is installed on a volume with ownership enabled., NSLocalizedDescription=Simulator verification failed.} ** BUILD FAILED ** The following build commands failed: CompileC /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/armv7/Box_vers.o /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler CompileC /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box_vers.o /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler (2 failures)
where "/var/folders/p2/v0630kzj4lb8v65d325zn5vh0000gn/T/carthage-xcodebuild.SE01YO.log" contains
Build settings from command line: SDKROOT = iphonesimulator8.3 === BUILD TARGET Box-iOS OF PROJECT Box WITH CONFIGURATION Release === Check dependencies CompileC /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/armv7/Box_vers.o /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/jhack/workspace/uPen/Carthage/Checkouts/Box export LANG=en_US.US-ASCII export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:(null)/Users/jhack/.gem/ruby/2.0.0(null):(null)/Library/Ruby/Gems/2.0.0(null):(null)/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0(null):/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/Cellar/sonar-runner/2.4/libexec/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fmodules -fmodules-cache-path=/Users/jhack/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/jhack/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Xclang -fmodule-implementation-of -Xclang Box -fapplication-extension -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -fexceptions -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -mios-simulator-version-min=8.0 -iquote /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-generated-files.hmap -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-own-target-headers.hmap -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-all-non-framework-target-headers.hmap -ivfsoverlay /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/all-product-headers.yaml -iquote /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-project-headers.hmap -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Products/Release-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/armv7 -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources -F/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Products/Release-iphoneos -MMD -MT dependencies -MF /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/armv7/Box_vers.d --serialize-diagnostics /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/armv7/Box_vers.dia -c /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c -o /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/armv7/Box_vers.o clang: error: invalid architecture 'arm' for deployment target '-mios-simulator-version-min=8.0' CompileC /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box_vers.o /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/jhack/workspace/uPen/Carthage/Checkouts/Box export LANG=en_US.US-ASCII export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:(null)/Users/jhack/.gem/ruby/2.0.0(null):(null)/Library/Ruby/Gems/2.0.0(null):(null)/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0(null):/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/Cellar/sonar-runner/2.4/libexec/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fmodules -fmodules-cache-path=/Users/jhack/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/jhack/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Xclang -fmodule-implementation-of -Xclang Box -fapplication-extension -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -fexceptions -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -mios-simulator-version-min=8.0 -iquote /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-generated-files.hmap -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-own-target-headers.hmap -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-all-non-framework-target-headers.hmap -ivfsoverlay /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/all-product-headers.yaml -iquote /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Box-project-headers.hmap -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Products/Release-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/arm64 -I/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources -F/Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Products/Release-iphoneos -MMD -MT dependencies -MF /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box_vers.d --serialize-diagnostics /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box_vers.dia -c /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/DerivedSources/Box_vers.c -o /Users/jhack/Library/Developer/Xcode/DerivedData/Box-dhuserewjevjzmhhrmurzekzdvvl/Build/Intermediates/Box.build/Release-iphoneos/Box-iOS.build/Objects-normal/arm64/Box_vers.o clang: error: invalid architecture 'aarch64' for deployment target '-mios-simulator-version-min=8.0'
This happens on Mac OS X 10.10.3 (14D136), Xcode 6.3.1 (6D1002) (=> Swift 1.2).
It's indisputable that Result
is a kind of Either
, but every added dependency is an additional burden for consumers, who I'm not convinced will use the EitherType
functionality directly.
Furthermore, the Either README even suggests that its functionality can be trivially added as an extension upon a pre-existing Result
type. To me, this means that consumers should not be required to build and link Either just to use a standardized Result
type.
c.f. the conversation from #reactivecocoa
/cc @NachoSoto @saniul @tony
My Cartfile
github "ReactiveCocoa/ReactiveCocoa" "v3.0-RC.1"
Unfortunately, carthage update
gives this output:
$ carthage update
*** Fetching ReactiveCocoa
*** Fetching Result
*** Fetching Box
*** Checking out Result at "0.4.4"
*** Downloading Box at "1.2.2"
*** Downloading ReactiveCocoa at "v3.0 Release Candidate 1"
*** xcodebuild output can be found in /var/folders/jk/0zp2_vl57vz661xk_hm5klxr0000gp/T/carthage-xcodebuild.qWDqGQ.log
Failed to discover shared schemes in project Result.xcodeproj—either the project does not have any shared schemes, or xcodebuild never returned
If you believe this to be a project configuration error, please file an issue with the maintainers at https://github.com/antitypical/Result/issues/new
xcodebuild log is empty.
P.S. It's unclear who is to blame but let's start investigation from here. Can you please help me?
How to handle the use case when both result value and error are nil... For example when querying db yielding no result, it is not an error but we have nothing to return either. I know we can return an empty array to work around this issue, but seems like there should be a more elegant and clean solution...??
When I open the xcodeproj
, Result-watchOS shows up in the schemes list with a cog next to it.
Using 0.5
Hi,
I was planning to use Result for my internal framework that access to a remote API and defines model types with convenience functions to access that API. (e.g: user.fetchFriends()
).
This would give something like that: User.fetchFriends()
-> API.fetchFriends()
-> Alamofire.request(.GET, ...)
-> NSURLSession
...
However, the Error
generic parameter requires to define a specific ErrorType
for the Result
objects. In my case, an API call could result into several kinds of error:
NSError
)4xx
or 5xx
) (Could be NSError
or could be an enum in my API
class for standard HTTP errors)ErrorType
enum defined in my User
class for instance)My point is, I will have errors returned by NSURLSession
(cancelled, no internet connection, ...), my API
class (http error), my model classes (JSON Validation, form validation, ...) and they won't be of the same kind (type). All these errors will be of ErrorType
, but they won't share the same type.
To be able to use Result<T>
, I would have to add an "underlying error" mechanism that would wrap the error coming from the previous step (e.g. APIError
would wrap NSError
objects returned by NSURLSession
and then User.Error
would have a case like case API(error: APIError)
to wrap api errors, and so on).
I can understand that Result<T, Error: ErrorType>
will force some kind of automatic documentation about the kind of error returned, but this is restrictive as well. Result<T>
would be fine as well and let the developer decide whether all errors should be of the same type. After all, the whole do { try } catch { }
mechanism has been designed to handled several error types using multiple catch
statements (and these errors are not specified in the called function signature).
I know this would have a huge impact on the current implementation, but it's worth talking about it.
Hi,
This project looks great, but it really needs some examples, especially for those who are now to swift.
Tim
I've looked through the source code, since this got merged into ReactiveCocoa, and I don't understand why there is an internal state. I can't find the advantage of the extra level of nesting over simply using an enum — and neither commit that introduced the change gave a reason. Can someone explain or give a use case where this is an advantage, by any chance? Thanks!
Not sure how well this would work in practice but hopefully we can come up with something that's better than doing it manually at every call-site.
Hey! I'm trying to build Thomvis/BrightFutures
using Carthage, and I'm getting this error. I'm on Carthage 0.9.4.
*** Building scheme "BrightFutures-Mac" in BrightFutures.xcworkspace
Build settings from command line:
ONLY_ACTIVE_ARCH = NO
=== BUILD TARGET Result-Mac OF PROJECT Result WITH CONFIGURATION Release ===
Check dependencies
target 'Result-Mac' has bitcode enabled (ENABLE_BITCODE = YES), but it is not supported for the 'macosx' platform
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
A shell task failed with exit code 65:
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
for example:
func(){
let result: Result<String, NSError> = Result(try tryIsSuccess("success")) //This is OK in function
}
let simpleBlock: ()->Void = {
let result: Result<String, NSError> = Result(try tryIsSuccess("success")) //This is not OK in colure
}
simpleBlock()
So my suggestion is to add a init version without @autoclosure mark
extension Result{
public init(_ f: () throws -> T) {
self.init(try f())
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.