Created
July 29, 2022 03:01
-
-
Save derrickturk/27772b1429a1d26ba4dfa6007957ed32 to your computer and use it in GitHub Desktop.
"Abstract"-ish types in Koka (and module naming whatevers)
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
abstract type meat | |
Beef | |
pub Lamb(age: int) |
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
module use_abstype | |
import abstype | |
val x: abstype/meat = Lamb(3) | |
val z: int = match x | |
Lamb(n) -> n | |
_ -> 33 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment