Skip to content

Instantly share code, notes, and snippets.

@shtaag
shtaag / AST.txt
Created February 18, 2012 05:55
AtsugiShortTrip
===============================
Short Trip Plan to Atsugi
Date : 2012/March/03 (Sat)
 ∬           ∬
        。。 ・・  。。  ・。。。 ∬
     o0o゚゚    ∧_∧   ゚゚oo
    。oO  ( (( (_, ・ω・) )) )  O0o
@shtaag
shtaag / gist:3160513
Created July 22, 2012 17:58
Start_Haskell_2 exercise in chap.5
問題13
リストのリストを取って、要素のリストを連結する関数concat :: [[a]] -> [a]は 第6章の演習問題で定義した。これをfoldrを使って実装した関数concatRを 定義せよ。さらに、foldlを使って実装した関数concatLを定義せよ。
以下の実行例で自分の定義が正しいことを確認せよ。
> concatR [[1,2],[3],[],[4,5]]
[1,2,3,4,5]
> concatL [[1,2],[3],[],[4,5]]
[1,2,3,4,5]
> concatR []
@shtaag
shtaag / yesod_errorHandler_logging
Created August 19, 2012 02:25
How to Log Exception in errorHandler of Yesod
instance Yesod App where
errorHandler (InternalError e) = do
$(logWarn) e
applyLayout "My Internal Server Error." [hamlet| <h1> my internal server error|]
where applyLayout :: Yesod master => Html -> HtmlUrl (Route master) -> GHandler sub master ChooseRep
applyLayout title body = fmap chooseRep $ defaultLayout $ do
setTitle title
toWidget body
@shtaag
shtaag / SmokeTest.hs
Created November 19, 2012 07:41
SmokeTest Data Generation with QuickCheck
{-# LANGUAGE FlexibleInstances, UndecidableInstances#-}
module SmokeTest where
import Control.Monad
import Control.Applicative
import System.IO
import Test.QuickCheck
import Test.QuickCheck.Poly
class Variant a where
@shtaag
shtaag / SmokeTest.hs
Created November 19, 2012 07:41
SmokeTest Data Generation with QuickCheck
{-# LANGUAGE FlexibleInstances, UndecidableInstances#-}
module SmokeTest where
import Control.Monad
import Control.Applicative
import System.IO
import Test.QuickCheck
import Test.QuickCheck.Poly
class Variant a where