2009-07-10から1日間の記事一覧
import Monad(liftM) data MyList a = My { unMy :: [a] } deriving (Show,Eq) instance Monad MyList where return x = My [x,x] (My xs) >>= k = My $ xs >>= (unMy.k) -- sample f x = My [x,x+1] とすると > return 2 >>= f My {unMy = [2,3,2,3]} > f 2…