Hatena::Grouphaskell

suztomoの日記

 | 

2011-10-02

YesodのPersistent

19:01

よくできていらっしゃる。

Persistent :: Yesod Web Framework Book- Version 1.4

Template Haskellにより定義されたPersonAgeの情報がghciで試してみられない?

~/Documents/.../Haskell/Yesod $ ghci persistTest.hs          git[branch:master]
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Ok, modules loaded: Main.
Prelude Main> PersonAge

<interactive>:1:1: Not in scope: data constructor `PersonAge'

Template Haskell

18:39

Template Haskell - HaskellWikiから見つけたFirst stab at Template Haskellを読んで手を動かしてみた。

Prelude Language.Haskell.TH> runQ [| div 1  2  3 4 |]
AppE (AppE (AppE (AppE (VarE GHC.Real.div) (LitE (IntegerL 1))) (LitE (IntegerL 2))) (LitE (IntegerL 3))) (LitE (IntegerL 4))

ここで表されているHaskellの構文木では複数引数の関数適用がそれぞれの関数適用として表現されていることがわかる。かりーかりー。


他にもno titleには自分でExpQを返す関数を定義する方法が書かれている。

Prelude Language.Haskell.TH> :info ExpQ
type ExpQ = Q Exp 	-- Defined in Language.Haskell.TH.Lib

Quasi-quotationはTemplate Haskellの一つの機能らしい。7.9.?Template Haskell

liftIO

17:05

Prelude> import Control.Monad.IO.Class
Prelude Control.Monad.IO.Class> :type liftIO
liftIO :: MonadIO m => IO a -> m a
Prelude Control.Monad.IO.Class> :info liftIO
class Monad m => MonadIO m where liftIO :: IO a -> m a
  	-- Defined in Control.Monad.IO.Clas

import Control.Monad.Trans のほうがいい作法かもしれない。

Reader型クラス

16:53

import IO
import System

data Color = Red | Green | Blue
     deriving (Read, Show, Eq, Ord)

main :: IO ()
main = do
  args <- getArgs
  let t = args !! 0
  let c = (read t) :: [Color]
  putStrLn $ show c

{-
$ ./reader '[Red,Green]'
[Red,Green]
-}

digitToIntとunlines

16:11

Prelude> import Char
Prelude Char> :type digitToInt
digitToInt :: Char -> Int
Prelude Char> map digitToInt "12345"
[1,2,3,4,5]
Prelude Char> map intToDigit [1,2,3,4]
"1234"

Prelude> lines "ab\nc"
["ab","c"]
Prelude> putStrLn $ unlines ["aiueo", "kaki"]
aiueo
kaki

divと(/)

16:08

Prelude> :type (/)
(/) :: Fractional a => a -> a -> a
Prelude> :type div
div :: Integral a => a -> a -> a
Prelude> 3 / 2
1.5
Prelude> 3 `div` 2
1

divto

16:07

インモラルインモラル2013/09/23 11:25淫インモラル:http://immoral.hellokanpo.com
インモラル:http://immoral.hellokanpo.com
媚薬 淫インモラル:http://immoral.hellokanpo.com
媚薬 インモラル:http://immoral.hellokanpo.com
妖姫:http://youhi.hellokanpo.com
媚薬 妖姫:http://youhi.hellokanpo.com


花痴:http://花痴.happykanpo.com
花痴:http://xn--dtyr5y.happykanpo.com
威哥王:http://www.onbape.com
イカオウ:http://www.onbape.com
紅蜘蛛:http://www.shkanpo.com
紅蜘蛛:http://www.shkanpo.com


威哥王:http://www.hellokanpo.com/view/weigewang.html
巨人倍増:http://www.hellokanpo.com/view/jurenbeiceng.html
三便宝:http://www.hellokanpo.com/view/satibo-capsules.html
D10 媚薬:http://www.hellokanpo.com/view/D10-meiyao.html
RU486:http://www.hellokanpo.com/view/beijing-ru486.html
花痴:http://www.hellokanpo.com/view/huachi.html
紅蜘蛛:http://www.hellokanpo.com/view/hongzhizhu1.html

威哥王:http://www.hellokanpo.com/view/weigewang.html
キョジンバイゾウ:http://www.hellokanpo.com/view/jurenbeiceng.html
D10 催情剤:http://www.hellokanpo.com/view/D10-meiyao.html
さんべんぼう:http://www.hellokanpo.com/view/satibo-capsules.html
イーリーシン:http://www.hellokanpo.com/view/yilishen.html
狼1号:http://www.hellokanpo.com/view/langyihao.html
三體牛鞭:http://www.hellokanpo.com/view/santiniubian.html
韓国痩身1号:http://www.hellokanpo.com/view/hanguoshou-575.html


精力剤:http://www.hellokanpo.com/JingLiJi
媚薬:http://www.hellokanpo.com/meiyao
威哥王:http://www.hellokanpo.com/view/weigewang.html
巨人倍増:http://www.hellokanpo.com/view/jurenbeiceng.html
天天素:http://www.hellokanpo.com/view/tiantiansu.html
三便宝:http://www.hellokanpo.com/view/satibo-capsules.html
蟻力神:http://www.hellokanpo.com/view/yilishen.html
RU486:http://www.hellokanpo.com/view/beijing-ru486.html
韓国痩身1号:http://www.hellokanpo.com/view/hanguoshou-575.html
D10 媚薬:http://www.hellokanpo.com/view/D10-meiyao.html
福源春:http://www.hellokanpo.com/view/fuyuanchun.html
狼一号:http://www.hellokanpo.com/view/langyihao.html
花痴:http://www.hellokanpo.com/view/huachi.html
紅蜘蛛:http://www.hellokanpo.com/view/hongzhizhu1.html
巨根カプセル:http://www.hellokanpo.com/view/jugen.html
三體牛鞭:http://www.hellokanpo.com/view/santiniubian.html
三体牛鞭:http://www.hellokanpo.com/view/santiniubian.html
絶對高潮:http://www.hellokanpo.com/view/jueduigaochao.html
SEX DROPS:http://www.hellokanpo.com/view/sex-drops.html
D10 催情剤:http://www.hellokanpo.com/view/D10-meiyao.html
終極痩身:http://www.hellokanpo.com/view/zhongjishoushen.html
超級脂肪燃焼弾:http://www.hellokanpo.com/view/FATBURNING.html
SUPER FAT BURNING:http://www.hellokanpo.com/view/SUPERFATBURNING.html
D5 原液:http://www.hellokanpo.com/view/FLYD5yuan.html
新一粒神:http://www.hellokanpo.com/view/xinyilishen.html
ビグレックス:http://www.hellokanpo.com/view/Oil.html
蔵八宝:http://www.hellokanpo.com/view/zhangbabao.html
御秀堂:http://www.hellokanpo.com/view/yuxiutang.html
中絶薬:http://www.hellokanpo.com/zhongjue


イーリーシン:http://www.hellokanpo.com/view/yilishen.html
ED助勃:http://www.hellokanpo.com
催情:http://www.hellokanpo.com/view/D10-meiyao.html
五便宝:http://www.hellokanpo.com/view/wodibo-capsules.html
キョジンバイゾウ:http://www.hellokanpo.com/view/jurenbeiceng.html
蒼蝿水:http://www.hellokanpo.com/view/FLY-D5.html
催淫カプセル:http://www.hellokanpo.com/view/jueduigaochao.html
VigRx:http://www.hellokanpo.com/view/VigRx.html
五便宝カプセル:http://www.hellokanpo.com/view/wodibo-capsules.html
ウェイカワン:http://www.hellokanpo.com/view/weigewang.html
VVK:http://www.hellokanpo.com/view/VVK-Wenickman.html
狼1号:http://www.hellokanpo.com/view/langyihao.html
女性催情剤:http://www.hellokanpo.com/view/d10-meiyao.html
男宝:http://www.hellokanpo.com/view/nanbao.html
vigRx oil:http://www.hellokanpo.com/view/Oil.html
曲美:http://www.hellokanpo.com/view/qumei.html
SPANISCHE FLIEGE:http://www.hellokanpo.com/view/spanische-flieged5-1.html
Wenickman:http://www.hellokanpo.com/view/VVK-Wenickman.html
FLY D5:http://www.hellokanpo.com/view/FLY-D5.html
催情水:http://www.hellokanpo.com/view/Foot.html
ペニス増大:http://www.hellokanpo.com/JingLiJi/xingqi.html
蟻王:http://www.hellokanpo.com/view/antking.html
ナンパオ:http://www.hellokanpo.com/view/nanbao.html
ベニクモ:http://www.hellokanpo.com/view/hong-zhi-zhu.html
韓国痩身一号:http://www.hellokanpo.com/view/hanguoshou-575.html
ハナチ:http://www.hellokanpo.com/view/huachi.html
セックスドロップ:http://www.hellokanpo.com/view/sex-drops.html
男根増長素:http://www.hellokanpo.com/view/nangen.html
三鞭粒:http://www.hellokanpo.com/view/wei.html
九鞭粒:http://www.hellokanpo.com/view/jiubianli.html
V26:http://www.hellokanpo.com/view/V26.html
日本秀身堂:http://www.hellokanpo.com/view/xouzhentang.html
procomil spray:http://www.hellokanpo.com/view/procomil-spray.html
蒼蝿粉:http://www.hellokanpo.com/view/inverma.html
性霸2000:http://www.hellokanpo.com/view/xingba2000.html
v26 ダイエット:http://www.hellokanpo.com/view/V26.html
魔根:http://www.hellokanpo.com/view/muogen.html
花之欲:http://www.hellokanpo.com/view/huazhiyu.html
Xing霸:http://www.hellokanpo.com/view/xingba2000.html
美人豹:http://www.hellokanpo.com/view/meirenbao.html
アリ王:http://www.hellokanpo.com/view/antking.html
男露888:http://www.hellokanpo.com/view/nanlu888.html
消渇丸:http://www.hellokanpo.com/view/xiaokewan.html
RU486中絶薬:http://www.hellokanpo.com/view/beijing-ru486.html
西班牙昆虫粉:http://www.hellokanpo.com/view/kunchong-fen.html
壮三天:http://www.hellokanpo.com/view/zhuangsantian.html
モチベーター:http://www.hellokanpo.com/view/Motivat.html
小情人:http://www.hellokanpo.com/view/sex-drops5.html
motivator:http://www.hellokanpo.com/view/Motivat.html
早漏防止:http://www.hellokanpo.com/JingLiJi/zaoxie.html
漢方薬 通販:http://www.hellokanpo.com/hanfang
ED治療薬:http://www.hellokanpo.com
VOV催情液:http://www.hellokanpo.com/view/VOVcuiqingye.html
勃起促進:http://www.hellokanpo.com/view/weigewang.html
女性用媚薬:http://www.hellokanpo.com/meiyao
漢方ダイエット:http://www.hellokanpo.com/jianfei/hfjianfei.html
ダイエット薬:http://www.hellokanpo.com/jianfei/xinchendaixie.html
黒倍王:http://www.hellokanpo.com/view/heibeiwang.html
さんべんぼう:http://www.hellokanpo.com/view/satibo-capsules.html
リドスプレー:http://www.hellokanpo.com/view/Lidosprayer.html
魔鬼天使性欲粉:http://www.hellokanpo.com/view/mogui-tianshi.html
イカオウ:http://www.hellokanpo.com/view/wei.html
vigrx 効果:http://www.hellokanpo.com/view/vigrx.html
福源春カプセル:http://www.hellokanpo.com/view/fuyuanchun.html
威哥王 販売:http://www.hellokanpo.com/view/weigewang.html
紅蜘蛛 液体:http://www.hellokanpo.com/view/hong-zhi-zhu.html
紅蜘蛛 激安:http://www.hellokanpo.com/view/hong-zhi-zhu-meiyao.html
三便宝 激安:http://www.hellokanpo.com/view/satibo-capsules5.html
三便宝 販売:http://www.hellokanpo.com/view/satibo-capsules.html

 |