Created
February 13, 2020 20:51
-
-
Save bontaq/69be94d4706c2cd1f4d3869baddccec0 to your computer and use it in GitHub Desktop.
Revisions
-
bontaq created this gist
Feb 13, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ // in haskell class Repr a where repr :: a -> String data Sku = Sku { display :: String } instance Repr Sku where repr sku = (display sku) test = let sku = Sku { display = "shoes" } in repr sku // test prints "shoes" // in kotlin interface Repr<in F> { fun F.repr(b: F): String } @extension interface SkuEntityRepr : Repr<SkuEntity> { override fun SkuEntity.repr(b: SkuEntity): String { return "{ sku id }" } } // SkuEntity doesn't need any constructors btw val test = Repr.repr(SkuEntity()) // unresolved ref repr ? val test2 = SkuEntity().repr() // unresolved ref ?