# Free

``public final class Free<F, A> : FreeOf<F, A> where F : Functor``

Free is a type that, given any Functor, is able to provide a Monad instance, that can be interpreted into a more restrictive one.

• ``` _Free ```

Internal representation of a Free value

See more

#### Declaration

Swift

``public enum _Free<F, A> where F : Functor``
• ``` value ```

Undocumented

#### Declaration

Swift

``public let value: _Free<F, A>``
• ``` free(_:) ```

Creates a Free value.

#### Declaration

Swift

``public static func free(_ fa: Kind<F, Free<F, A>>) -> Free<F, A>``

#### Parameters

 ``` fa ``` Value to be embedded in Free.

#### Return Value

A Free value.

• ``` liftF(_:) ```

Lifts a value in the context of the Functor into the Free context.

#### Declaration

Swift

``public static func liftF(_ fa: Kind<F, A>) -> Free<F, A>``

#### Parameters

 ``` fa ``` A value in the context of the provided Functor.

#### Return Value

A Free value.

• ``` fix(_:) ```

Safe downcast.

#### Declaration

Swift

``public static func fix(_ fa: FreeOf<F, A>) -> Free<F, A>``

#### Parameters

 ``` fa ``` Value in the higher-kind form.

#### Return Value

Value cast to Free.

• ``` foldMapK(_:) ```

Interprets this Free value into the provided Monad.

#### Declaration

Swift

``public func foldMapK<M>(_ f: FunctionK<F, M>) -> Kind<M, A> where M : Monad``

#### Parameters

 ``` f ``` A natural transformation from the internal Functor into the desired Monad.

#### Return Value

A value in the interpreted Monad.

• ``` run() ```

Folds this free structure using the same Monad.

#### Declaration

Swift

``func run() -> Kind<F, A>``

#### Return Value

Folded value.