2014-12-31から1日間の記事一覧

haskellでunix-timeの強制インストール

scottyとかのフレームワークがunix-timeに依存してるのでインストールしたい. https://github.com/kazu-yamamoto/unix-time autotoolsでconfig.hを生成できないのでインストールできなかった アレな方法でインストールしたのでその手順1. git clone https:/…

Haskellでhttpリクエスト

html-conduitを使う https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/tagsoup import Network.HTTP.Conduit (simpleHttp) import qualified Data.ByteString.Lazy.Char8 as L url = "http://www.bing.…

Haskellで文字列のSplitその2

Data.Listのwords関数がそれっぽい挙動をしている https://downloads.haskell.org/~ghc/7.4.1/docs/html/libraries/base/src/Data-List.html import Data.Char ( isSpace ) words :: String -> [String] words s = case dropWhile {-partain:Char.-}isSpace …

Haskellで文字列のsplit

isAlphaで判別する方法 import Data.Char main = do print $ filter (all isAlpha) . words $ "one , Two"

HaskellのData.List.SplitのsplitOnの実装

自分でsplitを実装できなかったのでソースを見てみた. もっと簡潔に実装できないのか {-# OPTIONS_HADDOCK prune #-} ----------------------------------------------------------------------------- -- | -- Module : Data.List.Split.Internals -- Copy…