Created
September 30, 2021 04:06
-
-
Save msakai/a7fa962c64cfa6166a845cfa62631e01 to your computer and use it in GitHub Desktop.
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
{-# LANGUAGE FlexibleContexts, GADTs, TypeFamilies #-} | |
class T a where | |
type Config a | |
getConfig :: a -> Config a | |
data D where | |
T :: T a => a -> D |
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
trait T { | |
type Config; | |
fn getConfig(&self) -> Self::Config; | |
} | |
enum D { | |
T(Box<dyn T>) | |
} | |
/* | |
error[E0191]: the value of the associated type `Config` (from trait `T`) must be specified | |
--> test_associated_types.rs:7:15 | |
| | |
2 | type Config; | |
| ------------ `Config` defined here | |
... | |
7 | T(Box<dyn T>) | |
| ^ help: specify the associated type: `T<Config = Type>` | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment