Skip to content

Instantly share code, notes, and snippets.

View func-hs's full-sized avatar

松舘 剛志 func-hs

  • Sapporo, Japan
View GitHub Profile
@func-hs
func-hs / message.txt
Created February 16, 2018 01:59
マクロの引数を間違えた場合
$ 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!")`
|
@func-hs
func-hs / message.txt
Created February 15, 2018 15:15
型引数を返り値やメンバの型に使いまわせない奴
$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`
@func-hs
func-hs / DList.hs
Created April 23, 2016 07:36
Listを依存型っぽくしてみようとしただけの何か
{-#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