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
$ rustc test.rs | |
error[E0308]: mismatched types | |
--> test.rs:2:35 | |
| | |
2 | let r: Result<(), &str> = Err(format!("hello!")); | |
| ^^^^^^^^^^^^^^^^^ | |
| | | |
| expected &str, found struct `std::string::String` | |
| help: consider borrowing here: `&format!("hello!")` | |
| |
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
$rustc --version | |
rustc 1.23.0 (766bd11c8 2018-01-01) | |
$ rustc test.rs | |
... | |
error[E0308]: mismatched types | |
--> test.rs:12:31 | |
| | |
12 | self.m.insert("hoge", S2); | |
| ^^ expected type parameter, found struct `S2` |
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
{-#LANGUAGE GADTs, KindSignatures, DataKinds, TypeOperators, TypeFamilies#-} | |
import GHC.TypeLits | |
data DList :: Nat -> * -> * where | |
DNil :: DList 0 a | |
DCons :: a -> DList n a -> DList (n + 1) a | |
append :: DList n a -> DList m a -> DList (n + m) a | |
append = undefined |