Releases: typelift/Abstract
Free Structures and Algebraic Data Types
This release focuses on two main topics: free structures and algebraic data types.
Free structures
4 free algebraic structures were defined as typealiases of existing and brand new data structures, that is:
NonEmptyArray
(brand new) ->FreeSemigroup
;Array
->FreeMonoid
;Multiset
(a.k.a.Bag
, brand new) ->FreeCommutativeMonoid
;Set
->FreeBoundedSemilattice
.
A free representation for Semiring
was also provided, with the type SetM
(a Set
where elements are monoids).
Algebraic data types
3 algebraic data types were added, that is, data types that exist only for combining other types in interesting ways, that is:
Product<A,B>
, representingA
andB
at the same time;Coproduct<A,B>
, representing eitherA
orB
;Inclusive<A,B>
, representing one of the following:- only type
A
; - only type
B
; - both types
A
andB
.
- only type
These types have definitions for the algebraic structures depending on the contained types: e.g. Product<A,B>
is a Monoid
if A
and B
are monoids.
Finally, the Function
type was included among the algebraic data types.
Update to Swift 4.1
Many changes:
- new project structure, focused on separation of abstractions from concrete types;
- use of conditional conformance throughout the whole project;
- new
Function
type that selectively conforms to the protocols depending on the output type; - a couple of new concrete types.
Carthage support
Now Abstract
properly builds with Carthage.
A nice starting point
The basics are done. I'm trying this release to see if I can integrate Abstract with another project via SwiftPM.