IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

2018-06-01から1ヶ月間の記事一覧

ラムダ計算のビデオ講義

www.youtube.com ラムダ計算とはなにか、なんで有用なのか、その由来 YコンビネータとDNAの相似 www.youtube.com 再帰 Yコンビネータ www.youtube.com 歴史を手短に解説 ものまね鳥の話

PutをBitPutにするとflushされてしまう

Binary処理が定義されているとします。 例えば、下記は1Byteの処理です。 > :t example_ColFlags example_ColFlags :: ColFlags > :t put example_ColFlags put example_ColFlags :: Put > > BSL.writeFile "work\\colflags.bin" (runPut $ put example_ColF…

いつも忘れるのでHaskellのテストの最小のひな型をメモ

package.yaml tastyだけでなくtastyから利用するテストパッケージもdependenciesに追加する。(これを忘れていつも嵌る) tests: testproj-test: main: Test.hs source-dirs: test ghc-options: - -threaded - -rtsopts - -with-rtsopts=-N dependencies: - …

Haskellタプルは実質15個まで

タプルでshowやeqが定義されているのは15個まで タプル15個 > type Foo = (Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool) > (True, False, True, True, True, True, True, True, True, True, True, True, Tru…

HaskellのBitの取り扱い

処理の流れ Binary.BitsからBinaryに直してBinary側でrunする。 パッケージで言えば Data.Binary.Bits.Put -> Data.Binary.Put -> Data.ByteString.Lazy Data.Binary.Bits.Get -> Data.Binary.Get -> Data.ByteString.Lazy 動作例 > BL.writeFile "work\\bit…