You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(renamed from associated types because apparently haskell has that already)
A Related Type is a type defined in generic code that does not need a matching type from the specification source because it is can be concretely implemented by the implementation of the other types in the generic code. A Related Type would also require an _ to be part of the name somewhere in order to avoid collisions with other implementations. The _ gets replaced with some inferred identifier.
In the following code _Sorter would be considered an associated type. By solving for Slice and T, _Sorter can be fully rewritten by selecting an identifier to replace the _ with
Related Types
(renamed from associated types because apparently haskell has that already)
A Related Type is a type defined in generic code that does not need a matching type from the specification source because it is can be concretely implemented by the implementation of the other types in the generic code. A Related Type would also require an
_
to be part of the name somewhere in order to avoid collisions with other implementations. The_
gets replaced with some inferred identifier.In the following code
_Sorter
would be considered an associated type. By solving forSlice
andT
,_Sorter
can be fully rewritten by selecting an identifier to replace the_
withGiven these types
The expected implementation of
_Sorter
would beThis effectively eliminates the need for multiple sorting types, and allows for concise adhoc sorting
or even
Possible
_
replacement inference rulesThe text was updated successfully, but these errors were encountered: