2012-07-01から1ヶ月間の記事一覧

mod point free style

Prelude> filter ((0==).(`mod` 3)) [1..20][3,6,9,12,15,18]しかし、次の方が断然、読みやすい。Prelude> [x | x <- [1..20], x `mod` 3 == 0][3,6,9,12,15,18]

newtype 構成子 N は リフト されない。すなわち、N _|_ は _|_ である。

4.2.3 Datatype Renamings Unlike algebraic datatypes, the newtype constructor N is unlifted, so that N _|_ is the same as _|_.The Haskell 98 Report: Declarations 日本語 4.2.3 データ型名の付け替え 代数的データ型とはちがい、newtype 構成子 N …

Could not find module `System.FilePath'

Haskell エディタ Leksah でコンパイルしたところ、以下のエラーが発生。 src\Main.hs:3:8: Could not find module `System.FilePath' It is a member of the hidden package `filepath-1.3.0.0'. Perhaps you need to add `filepath' to the build-depends …

{-# LANGUAGE CPP #-} Main.hs:0:4: lexical error (UTF-8 decoding error)

See this page. haskell - Cabal install complains "<built-in>:0:4: lexical error (UTF-8 decoding error)" - Stack Overflow -- Test.hs {-# LANGUAGE CPP #-}この Haskell ソースファイルをロードすると以下のエラーが発生。Prelude> :load TestTest.hs:0:4: lexi</built-in>…