Last active
January 26, 2018 23:08
-
-
Save jrsonline/098d169b67339e1a961289196ed3c6b8 to your computer and use it in GitHub Desktop.
Construct type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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