Skip to content

Commit

Permalink
fix: OptionalFlatMap
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahKamara committed Mar 11, 2024
1 parent 936c408 commit adda76e
Show file tree
Hide file tree
Showing 139 changed files with 180 additions and 168 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"metadata":{"title":"CompoundPredicate","symbolKind":"module","modules":[{"name":"CompoundPredicate"}],"role":"collection","externalID":"CompoundPredicate","roleHeading":"Framework"},"kind":"symbol","sections":[],"schemaVersion":{"patch":0,"major":0,"minor":3},"primaryContentSections":[{"content":[{"level":2,"anchor":"Overview","type":"heading","text":"Overview"},{"inlineContent":[{"type":"text","text":"CompoundPredicate aims to improve the Predicate system to enable combining multiple predicates after constructing them:"}],"type":"paragraph"},{"code":["let notTooShort = #Predicate<Book> {"," $0.pages > 50","}","","let notTooLong = #Predicate<Book> {"," $0.pages <= 350","}","","let lengthFilter = [notTooShort, notTooShort].conjunction()","","\/\/ Match Books that are just the right length","let titleFilter = #Predicate<Book> {"," $0.title.contains(\"Swift\")","}","","\/\/ Match Books that contain \"Swift\" in the title or ","\/\/ are just the right length","let filter = [lengthFilter, titleFilter].disjunction()"],"syntax":"swift","type":"codeListing"}],"kind":"content"}],"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate"},"topicSections":[{"identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/conjunction()","doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/disjunction()"],"title":"Combining Predicates"},{"identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing","doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacingLeaf"],"title":"Custom Predicates"},{"title":"Extended Modules","identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation"]}],"variants":[{"paths":["\/documentation\/compoundpredicate"],"traits":[{"interfaceLanguage":"swift"}]}],"hierarchy":{"paths":[[]]},"references":{"doc://CompoundPredicate/documentation/CompoundPredicate":{"abstract":[],"url":"\/documentation\/compoundpredicate","title":"CompoundPredicate","type":"topic","kind":"symbol","role":"collection","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate"},"doc://CompoundPredicate/documentation/CompoundPredicate/Swift/Array/conjunction()":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/conjunction()","title":"conjunction()","kind":"symbol","type":"topic","abstract":[{"type":"text","text":"Joins multiple predicates with an "},{"code":"Conjunction","type":"codeVoice"}],"url":"\/documentation\/compoundpredicate\/swift\/array\/conjunction()","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"text":"conjunction","kind":"identifier"},{"text":"<","kind":"text"},{"text":"T","kind":"genericParameter"},{"text":">() -> ","kind":"text"},{"preciseIdentifier":"s:10Foundation9PredicateV","kind":"typeIdentifier","text":"Predicate"},{"text":"<","kind":"text"},{"text":"T","kind":"typeIdentifier"},{"text":">","kind":"text"}],"role":"symbol"},"doc://CompoundPredicate/documentation/CompoundPredicate/VariableReplacing/replacing(_:with:)-7r9rg":{"required":true,"kind":"symbol","type":"topic","abstract":[{"type":"text","text":"Recursively traverses itself and returns a copy where all occurences of "},{"type":"codeVoice","code":"variable"},{"type":"text","text":" were replaced with"},{"code":"replacement","type":"codeVoice"}],"url":"\/documentation\/compoundpredicate\/variablereplacing\/replacing(_:with:)-7r9rg","fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"replacing","kind":"identifier"},{"text":"<","kind":"text"},{"kind":"genericParameter","text":"T"},{"text":">(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"kind":"text","text":"."},{"text":"Variable","preciseIdentifier":"s:17CompoundPredicate17VariableReplacingP0C0a","kind":"typeIdentifier"},{"kind":"text","text":"<"},{"kind":"typeIdentifier","text":"T"},{"text":">, ","kind":"text"},{"text":"with","kind":"externalParam"},{"text":": ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":".","kind":"text"},{"kind":"typeIdentifier","text":"Variable","preciseIdentifier":"s:17CompoundPredicate17VariableReplacingP0C0a"},{"kind":"text","text":"<"},{"text":"T","kind":"typeIdentifier"},{"text":">) -> ","kind":"text"},{"text":"Self","kind":"typeIdentifier"}],"defaultImplementations":1,"role":"symbol","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing\/replacing(_:with:)-7r9rg","title":"replacing(_:with:)"},"doc://CompoundPredicate/documentation/CompoundPredicate/VariableReplacing":{"kind":"symbol","type":"topic","abstract":[{"text":"A PredicateExpression that can recursively replace a variable within itself","type":"text"}],"url":"\/documentation\/compoundpredicate\/variablereplacing","fragments":[{"text":"protocol","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"VariableReplacing"}],"navigatorTitle":[{"kind":"identifier","text":"VariableReplacing"}],"role":"symbol","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing","title":"VariableReplacing"},"doc://CompoundPredicate/documentation/CompoundPredicate/Swift/Array/disjunction()":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/disjunction()","type":"topic","role":"symbol","abstract":[{"type":"text","text":"Joins multiple predicates with an "},{"code":"Disjunction","type":"codeVoice"}],"title":"disjunction()","kind":"symbol","url":"\/documentation\/compoundpredicate\/swift\/array\/disjunction()","fragments":[{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"text":"disjunction","kind":"identifier"},{"kind":"text","text":"<"},{"text":"T","kind":"genericParameter"},{"text":">() -> ","kind":"text"},{"text":"Predicate","kind":"typeIdentifier","preciseIdentifier":"s:10Foundation9PredicateV"},{"text":"<","kind":"text"},{"kind":"typeIdentifier","text":"T"},{"text":">","kind":"text"}]},"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation","abstract":[],"role":"collection","kind":"symbol","url":"\/documentation\/compoundpredicate\/foundation","title":"Foundation","type":"topic"},"doc://CompoundPredicate/documentation/CompoundPredicate/VariableReplacingLeaf":{"kind":"symbol","type":"topic","abstract":[{"type":"text","text":"A PredicateExpression conforming to "},{"isActive":true,"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing","type":"reference"},{"type":"text","text":" "},{"type":"text","text":"where "},{"type":"reference","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing\/replacing(_:with:)-7r9rg","isActive":true},{"type":"text","text":" "},{"type":"text","text":"will aways return a copy of self"}],"url":"\/documentation\/compoundpredicate\/variablereplacingleaf","fragments":[{"text":"protocol","kind":"keyword"},{"text":" ","kind":"text"},{"text":"VariableReplacingLeaf","kind":"identifier"}],"navigatorTitle":[{"kind":"identifier","text":"VariableReplacingLeaf"}],"role":"symbol","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacingLeaf","title":"VariableReplacingLeaf"}}}
{"sections":[],"kind":"symbol","schemaVersion":{"minor":3,"patch":0,"major":0},"metadata":{"symbolKind":"module","role":"collection","modules":[{"name":"CompoundPredicate"}],"roleHeading":"Framework","externalID":"CompoundPredicate","title":"CompoundPredicate"},"primaryContentSections":[{"content":[{"text":"Overview","level":2,"type":"heading","anchor":"Overview"},{"inlineContent":[{"text":"CompoundPredicate aims to improve the Predicate system to enable combining multiple predicates after constructing them:","type":"text"}],"type":"paragraph"},{"syntax":"swift","type":"codeListing","code":["let notTooShort = #Predicate<Book> {"," $0.pages > 50","}","","let notTooLong = #Predicate<Book> {"," $0.pages <= 350","}","","let lengthFilter = [notTooShort, notTooShort].conjunction()","","\/\/ Match Books that are just the right length","let titleFilter = #Predicate<Book> {"," $0.title.contains(\"Swift\")","}","","\/\/ Match Books that contain \"Swift\" in the title or ","\/\/ are just the right length","let filter = [lengthFilter, titleFilter].disjunction()"]}],"kind":"content"}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/compoundpredicate"]}],"hierarchy":{"paths":[[]]},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate"},"topicSections":[{"title":"Combining Predicates","identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/conjunction()","doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/disjunction()"]},{"identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing","doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacingLeaf"],"title":"Custom Predicates"},{"identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation"],"title":"Extended Modules"}],"references":{"doc://CompoundPredicate/documentation/CompoundPredicate/VariableReplacing":{"title":"VariableReplacing","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing","navigatorTitle":[{"text":"VariableReplacing","kind":"identifier"}],"role":"symbol","fragments":[{"text":"protocol","kind":"keyword"},{"kind":"text","text":" "},{"text":"VariableReplacing","kind":"identifier"}],"abstract":[{"type":"text","text":"A PredicateExpression that can recursively replace a variable within itself"}],"kind":"symbol","type":"topic","url":"\/documentation\/compoundpredicate\/variablereplacing"},"doc://CompoundPredicate/documentation/CompoundPredicate/Swift/Array/conjunction()":{"title":"conjunction()","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/conjunction()","role":"symbol","fragments":[{"kind":"keyword","text":"func"},{"text":" ","kind":"text"},{"text":"conjunction","kind":"identifier"},{"text":"<","kind":"text"},{"text":"T","kind":"genericParameter"},{"text":">() -> ","kind":"text"},{"text":"Predicate","kind":"typeIdentifier","preciseIdentifier":"s:10Foundation9PredicateV"},{"kind":"text","text":"<"},{"text":"T","kind":"typeIdentifier"},{"kind":"text","text":">"}],"kind":"symbol","abstract":[{"type":"text","text":"Joins multiple predicates with an "},{"type":"codeVoice","code":"Conjunction"}],"type":"topic","url":"\/documentation\/compoundpredicate\/swift\/array\/conjunction()"},"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation":{"title":"Foundation","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation","role":"collection","abstract":[],"kind":"symbol","type":"topic","url":"\/documentation\/compoundpredicate\/foundation"},"doc://CompoundPredicate/documentation/CompoundPredicate/VariableReplacingLeaf":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacingLeaf","url":"\/documentation\/compoundpredicate\/variablereplacingleaf","navigatorTitle":[{"text":"VariableReplacingLeaf","kind":"identifier"}],"fragments":[{"text":"protocol","kind":"keyword"},{"text":" ","kind":"text"},{"text":"VariableReplacingLeaf","kind":"identifier"}],"kind":"symbol","type":"topic","title":"VariableReplacingLeaf","abstract":[{"type":"text","text":"A PredicateExpression conforming to "},{"type":"reference","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing","isActive":true},{"type":"text","text":" "},{"type":"text","text":"where "},{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing\/replacing(_:with:)-7r9rg","isActive":true,"type":"reference"},{"text":" ","type":"text"},{"text":"will aways return a copy of self","type":"text"}],"role":"symbol"},"doc://CompoundPredicate/documentation/CompoundPredicate/Swift/Array/disjunction()":{"title":"disjunction()","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Swift\/Array\/disjunction()","role":"symbol","fragments":[{"kind":"keyword","text":"func"},{"text":" ","kind":"text"},{"kind":"identifier","text":"disjunction"},{"kind":"text","text":"<"},{"text":"T","kind":"genericParameter"},{"text":">() -> ","kind":"text"},{"text":"Predicate","preciseIdentifier":"s:10Foundation9PredicateV","kind":"typeIdentifier"},{"text":"<","kind":"text"},{"text":"T","kind":"typeIdentifier"},{"kind":"text","text":">"}],"abstract":[{"text":"Joins multiple predicates with an ","type":"text"},{"type":"codeVoice","code":"Disjunction"}],"kind":"symbol","type":"topic","url":"\/documentation\/compoundpredicate\/swift\/array\/disjunction()"},"doc://CompoundPredicate/documentation/CompoundPredicate/VariableReplacing/replacing(_:with:)-7r9rg":{"title":"replacing(_:with:)","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/VariableReplacing\/replacing(_:with:)-7r9rg","required":true,"role":"symbol","kind":"symbol","abstract":[{"text":"Recursively traverses itself and returns a copy where all occurences of ","type":"text"},{"type":"codeVoice","code":"variable"},{"type":"text","text":" were replaced with"},{"type":"codeVoice","code":"replacement"}],"fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"replacing","kind":"identifier"},{"text":"<","kind":"text"},{"kind":"genericParameter","text":"T"},{"kind":"text","text":">("},{"text":"Self","kind":"typeIdentifier"},{"kind":"text","text":"."},{"preciseIdentifier":"s:17CompoundPredicate17VariableReplacingP0C0a","text":"Variable","kind":"typeIdentifier"},{"text":"<","kind":"text"},{"kind":"typeIdentifier","text":"T"},{"kind":"text","text":">, "},{"kind":"externalParam","text":"with"},{"text":": ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":".","kind":"text"},{"text":"Variable","kind":"typeIdentifier","preciseIdentifier":"s:17CompoundPredicate17VariableReplacingP0C0a"},{"kind":"text","text":"<"},{"text":"T","kind":"typeIdentifier"},{"kind":"text","text":">) -> "},{"kind":"typeIdentifier","text":"Self"}],"type":"topic","url":"\/documentation\/compoundpredicate\/variablereplacing\/replacing(_:with:)-7r9rg","defaultImplementations":1},"doc://CompoundPredicate/documentation/CompoundPredicate":{"title":"CompoundPredicate","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate","role":"collection","abstract":[],"kind":"symbol","type":"topic","url":"\/documentation\/compoundpredicate"}}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"kind":"symbol","schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"identifier":{"url":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation","interfaceLanguage":"swift"},"topicSections":[{"title":"Extended Types","identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/NSNotification","doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/PredicateExpressions"]}],"variants":[{"paths":["\/documentation\/compoundpredicate\/foundation"],"traits":[{"interfaceLanguage":"swift"}]}],"metadata":{"externalID":"s:m:s:e:s:e:s:10Foundation20PredicateExpressionsO018CollectionContainsD0V08CompoundB0AF17VariableReplacingRzAfGR_rlE9replacing_4withAEy_xq_GAC0G0Vy_qd__G_AMtlF","symbolKind":"extension","role":"collection","roleHeading":"Extended Module","modules":[{"name":"CompoundPredicate"}],"title":"Foundation"},"hierarchy":{"paths":[["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate"]]},"references":{"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation/NSNotification":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/NSNotification","navigatorTitle":[{"text":"NSNotification","kind":"identifier"}],"type":"topic","role":"symbol","abstract":[],"kind":"symbol","title":"NSNotification","url":"\/documentation\/compoundpredicate\/foundation\/nsnotification"},"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation/PredicateExpressions":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/PredicateExpressions","role":"symbol","navigatorTitle":[{"kind":"identifier","text":"PredicateExpressions"}],"abstract":[],"kind":"symbol","url":"\/documentation\/compoundpredicate\/foundation\/predicateexpressions","type":"topic","title":"PredicateExpressions"},"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation":{"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation","abstract":[],"role":"collection","kind":"symbol","url":"\/documentation\/compoundpredicate\/foundation","title":"Foundation","type":"topic"},"doc://CompoundPredicate/documentation/CompoundPredicate":{"abstract":[],"url":"\/documentation\/compoundpredicate","title":"CompoundPredicate","type":"topic","kind":"symbol","role":"collection","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate"}}}
{"hierarchy":{"paths":[["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate"]]},"kind":"symbol","schemaVersion":{"patch":0,"minor":3,"major":0},"sections":[],"identifier":{"url":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation","interfaceLanguage":"swift"},"metadata":{"externalID":"s:m:s:e:s:e:s:10Foundation20PredicateExpressionsO018CollectionContainsD0V08CompoundB0AF17VariableReplacingRzAfGR_rlE9replacing_4withAEy_xq_GAC0G0Vy_qd__G_AMtlF","modules":[{"name":"CompoundPredicate"}],"roleHeading":"Extended Module","symbolKind":"extension","role":"collection","title":"Foundation"},"topicSections":[{"identifiers":["doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/NSNotification","doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/PredicateExpressions"],"title":"Extended Types"}],"variants":[{"paths":["\/documentation\/compoundpredicate\/foundation"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation/PredicateExpressions":{"abstract":[],"role":"symbol","kind":"symbol","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/PredicateExpressions","type":"topic","title":"PredicateExpressions","url":"\/documentation\/compoundpredicate\/foundation\/predicateexpressions","navigatorTitle":[{"kind":"identifier","text":"PredicateExpressions"}]},"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation/NSNotification":{"title":"NSNotification","role":"symbol","kind":"symbol","abstract":[],"identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation\/NSNotification","url":"\/documentation\/compoundpredicate\/foundation\/nsnotification","type":"topic","navigatorTitle":[{"text":"NSNotification","kind":"identifier"}]},"doc://CompoundPredicate/documentation/CompoundPredicate":{"url":"\/documentation\/compoundpredicate","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate","title":"CompoundPredicate","type":"topic","abstract":[],"kind":"symbol","role":"collection"},"doc://CompoundPredicate/documentation/CompoundPredicate/Foundation":{"title":"Foundation","identifier":"doc:\/\/CompoundPredicate\/documentation\/CompoundPredicate\/Foundation","role":"collection","abstract":[],"kind":"symbol","type":"topic","url":"\/documentation\/compoundpredicate\/foundation"}}}
Loading

0 comments on commit adda76e

Please sign in to comment.