Skip to content

Instantly share code, notes, and snippets.

@jrsonline
Last active January 26, 2018 23:08
Show Gist options
  • Save jrsonline/098d169b67339e1a961289196ed3c6b8 to your computer and use it in GitHub Desktop.
Save jrsonline/098d169b67339e1a961289196ed3c6b8 to your computer and use it in GitHub Desktop.
Construct type
protocol HKTTag { /* a type to represent a Higher Kinded Type tag */ }
/// `ConstructorTag` represents a type constructor.
/// `TypeParameter` represents an argument to the type constructor.
struct Construct<ConstructorTag : HKTTag, TypeParameter> {
let tag: ConstructorTag
}
// The below is like Array<Int>
let intArrayConstructor = Construct<ArrayTag, Int>
// The below is like LinkedList<String>
let stringLinkedListConstructor = Construct<LinkedListTag, String>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment