6さいカンファレンスのレジュメ的な何か
はいはい、どうも、ちゅーんさんですよ。
| {-# 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 |
| module Main where | |
| contents::[(String, Int)] | |
| contents = | |
| [ ("start", 1) | |
| , ("string", 11) | |
| , ("number", 15) | |
| ] | |
| formatRec :: (Int, (String, Int)) -> String |
| {-# 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 | |
| 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 |
| " 検索文字列ハイライト | |
| set hlsearch | |
| """"""""""""""""""""""""""""""""""""""""""""""""" | |
| " 実行 | |
| :function ExecFile() | |
| :w | |
| :if &filetype == "haskell" |
| (define $maybe | |
| (lambda [$a] | |
| (matcher { | |
| ;; <primitive-pp> | |
| [,$val [a] {[$tgt | |
| (match [val tgt] [(maybe a) (maybe a)] { | |
| [[<just $x> <just ,x>] {[x]}] | |
| [[<nothing> <nothing>] {[]}] | |
| [_ {}]})]}] | |
| ;; <primitive-dp> |
| (define $maybe | |
| (lambda [$a] | |
| (matcher { | |
| ;; <primitive-pp> | |
| [,$val [a] {[$tgt | |
| (match [val tgt] [(maybe a) (maybe a)] { | |
| [[<just $x> <just ,x>] {[x]}] | |
| [[<nothing> <nothing>] {[]}] | |
| [_ {}]})]}] | |
| ;; <primitive-dp> |
| (define $maybe | |
| (lambda [$a] | |
| (matcher { | |
| ;; <primitive-pp> | |
| [,$val [a] {[$tgt | |
| (match [val tgt] [(maybe a) (maybe a)] { | |
| [[<just $x> <just ,x>] {[x]}] | |
| [[<nothing> <nothing>] {[]}] | |
| [_ {}]})]}] | |
| ;; <primitive-dp> |
| (define $hoge | |
| (matcher { | |
| ;; <primitive-pp> | |
| [,$val [] {[$tgt | |
| (match [val tgt] [hoge hoge] { | |
| [[<aaa> <aaa>] {[]}] | |
| [[<bbb> <bbb>] {[]}] | |
| [[<ccc> <ccc>] {[]}] | |
| [_ {}]})]}] | |
| ;; <primitive-dp> |