🤓 Articles Forward application |> and method composition >>> https://www.pointfree.co/episodes/ep1-functions Single-type composition <> https://www.pointfree.co/episodes/ep2-side-effects Single-type composition with UIKit https://www.pointfree.co/episodes/ep3-uikit-styling-with-functions
🏗 Libraries swift-overture: https://github.com/pointfreeco/swift-overture
- with (aka: |>): https://github.com/pointfreeco/swift-overture/blob/master/Sources/Overture/With.swift
- pipe (aka: >>>): https://github.com/pointfreeco/swift-overture/blob/master/Sources/Overture/Pipe.swift
- concat (aka: <>): https://github.com/pointfreeco/swift-overture/blob/master/Sources/Overture/Concat.swift swift-prelude: https://github.com/pointfreeco/swift-prelude
- https://github.com/pointfreeco/swift-prelude/blob/master/Sources/Prelude/Function.swift Prelude: https://github.com/robrix/Prelude
- |>: https://github.com/robrix/Prelude/blob/master/Prelude/Application.swift
-
: https://github.com/robrix/Prelude/blob/master/Prelude/Compose.swift
>>> : Compõe funções. Se tiveres duas funções g e f, a sua composição g >>> f resulta em g(f(x)) (edited)
O <> é semelhante mas é chamado de single-type composition
Enquanto que o primeiro te deixa fazer A -> B e B -> C, o segundo transforma sempre o mesmo tipo, ou seja A -> A
Mas se vires, internamente é igual ao >>>
Temos uma excepção que essa não é tão comum, que é A -> Void
Mas o resultado é o mesmo, aplicamos primeiro f e depois g