TypeProtocol

public protocol TypeProtocol : Hashable, Sendable

A protocol describing the API of a Hylo type.

  • Properties about the representation of self.

    Declaration

    Swift

    var flags: ValueFlags { get }
  • transformParts(mutating:_:) Default implementation

    Apply transform(_:_:) on m and the types that are part of self.

    Default Implementation

    Applies TypeProtocol.transform(mutating:_:) on m and the types that are part of self.

    Declaration

    Swift

    func transformParts<M>(
      mutating m: inout M, _ transformer: (inout M, AnyType) -> TypeTransformAction
    ) -> Self
  • init(_:) Extension method

    Creates an instance with the value of container.base or returns nil if that value has a different type.

    Declaration

    Swift

    public init?(_ container: AnyType)
  • init(_:) Extension method

    Creates an instance with the value of container.base or returns nil if either that value has a different type or container is nil.

    Declaration

    Swift

    public init?(_ container: AnyType?)
  • subscript(_:) Extension method

    Returns whether the specified flags are raised on this type.

    Declaration

    Swift

    public subscript(fs: ValueFlags) -> Bool { get }
  • isCanonical Extension method

    Indicates whether self is canonical.

    Declaration

    Swift

    public var isCanonical: Bool { get }
  • transform(mutating:_:) Extension method

    Returns this type transformed with transformer applied to m.

    This method visits the structure of the type and calls transformer on m and each type composing that structure. The result of the call is substituted for the visited type. If transformer returns stepInto(t), t is visited after the substitution. Otherwise, the method directly moves to the next type in the structure.

    Declaration

    Swift

    public func transform<M>(
      mutating m: inout M, _ transformer: (inout M, AnyType) -> TypeTransformAction
    ) -> AnyType
  • transform(_:) Extension method

    Returns this type transformed with transformer.

    This method visits the structure of the type and calls transformer on each type composing that structure. The result of the call is substituted for the visited type. If transformer returns stepInto(t), t is visited after the substitution. Otherwise, the method directly moves to the next type in the structure.

    Declaration

    Swift

    public func transform(_ transformer: (AnyType) -> TypeTransformAction) -> AnyType
  • transformParts(_:) Extension method

    Applies TypeProtocol.transformParts(mutating:_:) on a discarded value and the types that are part of self.

    Declaration

    Swift

    public func transformParts(_ transformer: (AnyType) -> TypeTransformAction) -> Self