diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..99069e0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "Carthage/Checkouts/FileCheck"] + path = Carthage/Checkouts/FileCheck + url = https://github.com/trill-lang/FileCheck.git +[submodule "Carthage/Checkouts/SwiftCheck"] + path = Carthage/Checkouts/SwiftCheck + url = https://github.com/typelift/SwiftCheck.git +[submodule "Carthage/Checkouts/Operadics"] + path = Carthage/Checkouts/Operadics + url = https://github.com/typelift/Operadics.git diff --git a/Abstract.xcodeproj/project.pbxproj b/Abstract.xcodeproj/project.pbxproj index 24936ca..0c3d733 100644 --- a/Abstract.xcodeproj/project.pbxproj +++ b/Abstract.xcodeproj/project.pbxproj @@ -100,6 +100,12 @@ 38A14E501F2A2DAB00A2900C /* SwiftCheck.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0951F2421F09690200EA362C /* SwiftCheck.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 38A14E521F2A2DC300A2900C /* SwiftCheck.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0951F2441F09690200EA362C /* SwiftCheck.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 38A14E531F2A2DCB00A2900C /* SwiftCheck.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0951F2441F09690200EA362C /* SwiftCheck.framework */; }; + 38E185801FD7E50700208B0A /* Arbitrary.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387A1DBF1F7909A000928A8C /* Arbitrary.generated.swift */; }; + 38E185811FD7E50700208B0A /* CustomArbitraryTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387A1DC01F7909A000928A8C /* CustomArbitraryTypes.swift */; }; + 38E185821FD7E50800208B0A /* Arbitrary.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387A1DBF1F7909A000928A8C /* Arbitrary.generated.swift */; }; + 38E185831FD7E50800208B0A /* CustomArbitraryTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387A1DC01F7909A000928A8C /* CustomArbitraryTypes.swift */; }; + 38E185841FD7E50900208B0A /* Arbitrary.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387A1DBF1F7909A000928A8C /* Arbitrary.generated.swift */; }; + 38E185851FD7E50900208B0A /* CustomArbitraryTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387A1DC01F7909A000928A8C /* CustomArbitraryTypes.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -672,7 +678,9 @@ buildActionMask = 2147483647; files = ( 380A4B321F1BF83B002D70E0 /* SemiringTests.generated.swift in Sources */, + 38E185831FD7E50800208B0A /* CustomArbitraryTypes.swift in Sources */, 380A4B211F1BE383002D70E0 /* MonoidTests.generated.swift in Sources */, + 38E185821FD7E50800208B0A /* Arbitrary.generated.swift in Sources */, 380A4B1B1F1B775F002D70E0 /* WrapperTests.generated.swift in Sources */, 380A4B161F1B7336002D70E0 /* SemigroupTests.generated.swift in Sources */, 380A4B261F1BF5BE002D70E0 /* CommutativeMonoidTests.generated.swift in Sources */, @@ -709,7 +717,9 @@ buildActionMask = 2147483647; files = ( 380A4B331F1BF83B002D70E0 /* SemiringTests.generated.swift in Sources */, + 38E185851FD7E50900208B0A /* CustomArbitraryTypes.swift in Sources */, 380A4B221F1BE383002D70E0 /* MonoidTests.generated.swift in Sources */, + 38E185841FD7E50900208B0A /* Arbitrary.generated.swift in Sources */, 380A4B1C1F1B775F002D70E0 /* WrapperTests.generated.swift in Sources */, 380A4B171F1B7336002D70E0 /* SemigroupTests.generated.swift in Sources */, 380A4B271F1BF5BF002D70E0 /* CommutativeMonoidTests.generated.swift in Sources */, @@ -768,7 +778,9 @@ buildActionMask = 2147483647; files = ( 380A4B311F1BF83B002D70E0 /* SemiringTests.generated.swift in Sources */, + 38E185811FD7E50700208B0A /* CustomArbitraryTypes.swift in Sources */, 380A4B201F1BE383002D70E0 /* MonoidTests.generated.swift in Sources */, + 38E185801FD7E50700208B0A /* Arbitrary.generated.swift in Sources */, 380A4B1A1F1B775F002D70E0 /* WrapperTests.generated.swift in Sources */, 380A4B151F1B7336002D70E0 /* SemigroupTests.generated.swift in Sources */, 380A4B251F1BF5BD002D70E0 /* CommutativeMonoidTests.generated.swift in Sources */, @@ -848,7 +860,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_NAME = Abstract; SDKROOT = iphoneos; @@ -909,7 +920,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_NAME = Abstract; SDKROOT = iphoneos; @@ -1097,7 +1107,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; PRODUCT_NAME = Abstract; @@ -1166,7 +1175,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; PRODUCT_NAME = Abstract; @@ -1363,7 +1371,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; PRODUCT_NAME = Abstract; @@ -1432,7 +1439,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; PRODUCT_NAME = Abstract; @@ -1510,7 +1516,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = macosx; @@ -1579,7 +1584,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_SWIFT_FLAGS = "-DXCODE_BUILD"; PRODUCT_BUNDLE_IDENTIFIER = com.typelift.Abstract; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = macosx; diff --git a/Cartfile.resolved b/Cartfile.resolved index 58dbdc4..2fe61a5 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,3 @@ +github "trill-lang/FileCheck" "0.0.5" github "typelift/Operadics" "0.2.3" -github "typelift/SwiftCheck" "0.8.1" +github "typelift/SwiftCheck" "0.9.1" diff --git a/Carthage/Checkouts/FileCheck b/Carthage/Checkouts/FileCheck new file mode 160000 index 0000000..1c96658 --- /dev/null +++ b/Carthage/Checkouts/FileCheck @@ -0,0 +1 @@ +Subproject commit 1c966580c83cf2e41be802992d46fe2edfc5c95f diff --git a/Carthage/Checkouts/Operadics b/Carthage/Checkouts/Operadics new file mode 160000 index 0000000..bc8cdd8 --- /dev/null +++ b/Carthage/Checkouts/Operadics @@ -0,0 +1 @@ +Subproject commit bc8cdd83868c395b7075d0db5e930842172012ec diff --git a/Carthage/Checkouts/SwiftCheck b/Carthage/Checkouts/SwiftCheck new file mode 160000 index 0000000..df82fb8 --- /dev/null +++ b/Carthage/Checkouts/SwiftCheck @@ -0,0 +1 @@ +Subproject commit df82fb889864945c64458f38846702af729b3ee4 diff --git a/README.md b/README.md index a59db3f..2123dad 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The library also provides tools to test the concrete types for the axioms requir ## Setup -`Abstract` is compatible with [Carthage](https://github.com/Carthage/Carthage): please refer to Carthage documentation for how to add `Abstract` as a dependency of your project. +To clone `Abstract` please run `git clone REPOSITORY_URL --recursive` to properly clone submodules. ### SwiftPM Please add this line to your `Package.swift` file's dependencies section: @@ -30,6 +30,9 @@ Please add this line to your `Package.swift` file's dependencies section: To use the structures in this library, add `"Abstract"` to your target's dependencies. To additionally test algebraic laws with the framework, add `"Abstract"` as a dependency to the relevant `testTarget`s. +### Carthage +`Abstract` is compatible with [Carthage](https://github.com/Carthage/Carthage): please refer to Carthage documentation for how to add `Abstract` as a dependency of your project. + ------ ## How to use this @@ -323,7 +326,7 @@ struct Process { } ``` -Let's also assume that we have a bunch of processes that we want to run, and then combine all the values into a single one. Running all the processes in sequence and then collecting all the values could be tedious and inefficient, but running them in parallel, maybe in a distributed way, could be dangerous, unpredictable and hard to coordinate. +Let's also assume we have a bunch of processes that we want to run, and then combine all the values into a single one. Running all the processes in sequence and then collecting all the values could be tedious and inefficient, but running them in parallel, maybe in a distributed way, could be dangerous, unpredictable and hard to coordinate. We would like to take advantage of the abstract algebraic structures defined in `Abstract` to simplify the problem. Everything depends on the `T` value: it turns out that, if `T` has certain properties, we can actually run our processes in a distributed and efficient way without any risk. diff --git a/Sources/Abstract/BoundedSemilattice.swift b/Sources/Abstract/BoundedSemilattice.swift index 27d9685..7df7efc 100644 --- a/Sources/Abstract/BoundedSemilattice.swift +++ b/Sources/Abstract/BoundedSemilattice.swift @@ -6,7 +6,7 @@ A Bounded Semilattice is a Commutative Monoid in which the operation is idempote a <> b <> b = a <> b */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/CommutativeMonoid.swift b/Sources/Abstract/CommutativeMonoid.swift index b9698a5..10cdbce 100644 --- a/Sources/Abstract/CommutativeMonoid.swift +++ b/Sources/Abstract/CommutativeMonoid.swift @@ -6,7 +6,7 @@ A Commutative Monoid is a Monoid in which the operation is commutative, thus: a <> b = b <> a */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/Homomorphism.swift b/Sources/Abstract/Homomorphism.swift index d17f1b1..d50bce2 100644 --- a/Sources/Abstract/Homomorphism.swift +++ b/Sources/Abstract/Homomorphism.swift @@ -1,4 +1,4 @@ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/Magma.swift b/Sources/Abstract/Magma.swift index 6abf413..4efe103 100644 --- a/Sources/Abstract/Magma.swift +++ b/Sources/Abstract/Magma.swift @@ -12,7 +12,7 @@ Technically, to prove this, we could test the operation with a large number of r So let's keep it on word (for now). */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/Monoid.swift b/Sources/Abstract/Monoid.swift index 23bddac..1d5aeb3 100644 --- a/Sources/Abstract/Monoid.swift +++ b/Sources/Abstract/Monoid.swift @@ -8,7 +8,7 @@ The empty element (let's called it `e`) has to be neutral to the operation both a <> e = e <> a = a */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/Semigroup.swift b/Sources/Abstract/Semigroup.swift index 77c1f9f..b1376ae 100644 --- a/Sources/Abstract/Semigroup.swift +++ b/Sources/Abstract/Semigroup.swift @@ -6,7 +6,7 @@ A Semigroup is a Magma where the composition operation is associative, which mea To put it simply: (a <> b) <> c = a <> (b <> c) */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/Semiring.swift b/Sources/Abstract/Semiring.swift index 840d26a..9c5122a 100644 --- a/Sources/Abstract/Semiring.swift +++ b/Sources/Abstract/Semiring.swift @@ -13,7 +13,7 @@ In addition to the basic requirements for the underlying types (Commutative Mono - the `zero` element must "annihilate" an instance if applied with the multiplication operation, both left and right: - zero <>* a = a <>* zero = zero */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Sources/Abstract/Utilities/Collections.swift b/Sources/Abstract/Utilities/Collections.swift index e427372..3abe11d 100644 --- a/Sources/Abstract/Utilities/Collections.swift +++ b/Sources/Abstract/Utilities/Collections.swift @@ -4,7 +4,7 @@ Becuase we have a way to generically "compose" things, we can derive a bunch of interesting operations on collections of such things. */ -#if !XCODE_BUILD +#if SWIFT_PACKAGE import Operadics #endif diff --git a/Tests/AbstractTests/Utility/CustomArbitraryTypes.swift b/Tests/AbstractTests/Utility/CustomArbitraryTypes.swift index d589fb8..e2109af 100644 --- a/Tests/AbstractTests/Utility/CustomArbitraryTypes.swift +++ b/Tests/AbstractTests/Utility/CustomArbitraryTypes.swift @@ -1,9 +1,9 @@ import XCTest @testable import Abstract -#if !XCODE_BUILD - import Operadics -#endif import SwiftCheck +#if SWIFT_PACKAGE + import Operadics +#endif struct TestStructure: Arbitrary, BoundedSemilattice, Equatable { let get: Max diff --git a/deployments.xcconfig b/deployments.xcconfig deleted file mode 100644 index 5066587..0000000 --- a/deployments.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ - -IPHONEOS_DEPLOYMENT_TARGET = 8.3 - -TVOS_DEPLOYMENT_TARGET = 9.0 -