2009-07-07から1日間の記事一覧
bind [] _ = [] bind [x] k = k x bind xs@(x:_) k = case k x of [_] -> xs >>= k otherwise -> reverse $ xs >>= k data MyList a = My { unMy :: [a] } deriving (Show,Eq) instance Monad MyList where return x = My [x] (My xs) >>= k = My $ xs `bind…