https://github.com/typelift/operadics
Standard Operators for the working Swift Librarian.
https://github.com/typelift/operadics
Last synced: 11 months ago
JSON representation
Standard Operators for the working Swift Librarian.
- Host: GitHub
- URL: https://github.com/typelift/operadics
- Owner: typelift
- License: mit
- Created: 2015-07-08T02:39:07.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2021-11-13T21:15:20.000Z (over 4 years ago)
- Last Synced: 2025-04-12T22:03:17.139Z (about 1 year ago)
- Language: Swift
- Size: 14.6 KB
- Stars: 98
- Watchers: 7
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Operadics
Standard Operators for the working Swift Librarian.
Operators
---------
Operadics introduces the following operators at global scope
Operator | Name | Recommended Type
-------- | -------------- | ------------------------------------------
`•` | compose | `• (B -> C, A -> B) -> A -> C`
`§` | apply | `§ (A -> B, A) -> B`
`<\|` | apply | `<\| (A -> B, A) -> B`
`\|>` | thrush | `\|> (A, A -> B) -> B`
`<-` | extract | `<- (M, A) -> Void`
`\|*\|` | on | `\|*\| ((B, B) -> C, A -> B) -> A -> A -> C`
`<>` | op | `<> (A, A) -> A`
`<^` | replace | `<^ (A, F) -> F`
`^>` | replace | `^> (F, B) -> F`
`<^>` | fmap | `<^> (A -> B, F) -> F`
`<^^>` | imap | `<^^> (I -> J, F) -> F`
`` | contramap | `<^> (J -> I, F) -> F`
`<*>` | apply | `<*> (F B>, F) -> F`
`>>-` | bind | `>>- (F, A -> F) -> F`
`-<<` | bind | `-<< (A -> F, F) -> F`
`>>->>` | Kleisli | `>>->> (A -> F, B -> F) -> A -> F`
`<<-<<` | Kleisli | `<<-<< (B -> F, A -> F) -> A -> F`
`->>` | extend | `->> (F, F -> B) -> F`
`<<<` | r-t-l compose | `<<< (C, C) -> C`
`>>>` | l-t-r compose | `>>> (C, C) -> C`
`&&&` | split | `&&& (A, A) -> A`
`***` | fanout | `*** (A, A) -> A<(B, D), (C, E)>`
`+++` | splat | `+++ (A, A) -> A, Either>`
`\|\|\|` | fanin | `\|\|\| (A, A) -> A, D>`
`<+>` | op | `<+> (A, A) -> A`
`` | retrieve | ` (JSONValue, JSONKeypath) -> A?`
`?` | opt retrieve | `? (JSONValue, JSONKeypath) -> A??`
`(JSONValue, JSONKeypath) -> A`
`∪` | union | `∪ (Set, Set) -> Set`
`∩` | intersect | `∩ (Set, Set) -> Set`