This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"github.com/google/uuid" | |
) | |
// with this, the "value" field can't be accessed outside the package with PhantomID, | |
// which prevents PhantomID[T] from being compared to PhantomID[U] |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
) | |
// begin Option package | |
type Option[T any] struct { | |
hasValue bool |
This file contains hidden or 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
interface ILogger { | |
log: (str: string) => void; | |
} | |
class Logger implements ILogger { | |
log = (str: string): void => { | |
console.log(str); | |
}; | |
} |