Skip to content

Instantly share code, notes, and snippets.

@tokiwoousaka
tokiwoousaka / gist:6655082
Last active December 23, 2015 15:19
ちゅ〜りっぷ
module Main where
import Sound.Sarasvati.Base
sinl :: Float -> [Float]
sinl x = map sin $ f 0
where f v = v : f (v + (x / 4410))
zips :: [a] -> [(a, a)]
zips x = zip x x
@tokiwoousaka
tokiwoousaka / gist:6666757
Created September 23, 2013 05:30
(。ŏ﹏ŏ)ふぇぇ…
{-# LANGUAGE TypeSynonymInstances #-}
module Main where
class Hoge h where
hoge :: h a -> String
type Foo a = (a, a)
instance Hoge Foo where -- => Type synonym `Foo' should have 1 argument, but has been given none
hoge _ = "foooooo!"
module Main where
contents::[(String, Int)]
contents =
[ ("start", 1)
, ("string", 11)
, ("number", 15)
]
formatRec :: (Int, (String, Int)) -> String

テーマ「型」

6さいカンファレンスのレジュメ的な何か

自己紹介

はいはい、どうも、ちゅーんさんですよ。

@tokiwoousaka
tokiwoousaka / gist:8554260
Last active January 4, 2016 02:19
リストモナドのEff版的な
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ExistentialQuantification #-}
module Main where
newtype Eff a = Eff { runEff :: forall w. (a -> VE w) -> VE w }
instance Monad Eff where
--return :: a -> Eff a
return x = Eff $ \k -> k x
--(>>=) :: Eff a -> (a -> Eff b) -> Eff b
m >>= f = let
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ExistentialQuantification #-}
module Main where
----------
-- Eff
newtype Eff r a = Eff { runEff :: forall w. (a -> VE w r) -> VE w r}
instance Monad (Eff r) where
--return :: a -> Eff a
           (´・_・`)
          /,  /
         (ぃ9  |
          /    /、
         /   ∧_二つ
         /   /
        /    \
       /  /~\ \
       /  /   >  )
     / ノ    / /
 *      +     巛 ヽ
            〒 !   +    。     +    。     *     。
       +     。  |  |
    *      +   / /   イヤッッホォォォオオォオウ!
       / /
      (´・_・`/ / +    。     +    。   *     。
      ,-     f
      / ュヘ    | *     +    。     +   。 +
     〈_} )   |
        /    ! +    。     +    +     *
             / )
            ./ /
           / /
           / /
         ./ /      , -つ
         / /・_・`)   /__ノ
        /    \ / /
        .|    へ/ /
        |    レ'  /、二つ
        |     /
@tokiwoousaka
tokiwoousaka / gist:9783721
Last active August 29, 2015 13:57
"@zakky_dev: Aの処理に失敗したらBをやり、それにも失敗したらCをやり、そこで失敗したら例外をスローする。どの処理でも成功したらDの処理を実行する。こういったことやりたいのかなりあるんだけど、どうしよっかなー。" https://twitter.com/zakky_dev/status/448654622970753024
public class Main {
private static void procces(boolean success, String procName){
if(success){
System.out.println("処理 " + procName + " 成功");
throw new RuntimeException();
}
System.out.println("処理 " + procName + " 失敗。。。");
}