Lens&Prism勉強会 http://connpass.com/event/13929/ の発表資料Read less
![Xpath in-lens](https://cdn-ak-scissors.b.st-hatena.com/image/square/0b263045d45f0b4f95137a29818c1f77ee08818d/height=288;version=1;width=512/https%3A%2F%2Fcdn.slidesharecdn.com%2Fss_thumbnails%2Fxpath-in-lens-150530083325-lva1-app6891-thumbnail.jpg%3Fwidth%3D640%26height%3D640%26fit%3Dbounds)
関数型言語Haskellにおいて、普通は計算の結果は関数の戻り値として扱うが、「結果を受け取る関数」 に渡すという継続渡しというスタイルもある。これは単なる冗長なやり方ではなく、様々な興味深い性質を持つ。 基本形は、aという値を渡すところを ∀r. (a -> r) -> r のような表現にする。たとえば、与えられた数の42倍を渡したいとき、そのまま\x -> x * 42ではなく、\x f -> f (x * 42)と書く。もちろんこれだけではありがたみが分からない。 さて、与えられた文字列の中のうち、大文字のアルファベットを取り出し、それがアルファベットの何番目か計算するプログラムを作りたい。普通はリストを使ってこのように書くかもしれない。 import Data.Char uppers :: [Char] -> [Int] uppers [] = [] uppers (x:xs) |
one of the most common complaints about the lens package is how many operators it defines. fortunately, you can get away with using a very minimal set and lens is still very powerful. here are some examples of use of the operators defined in the core Control.Lens.Lens part of the library (without all the category theory "nonsense" because you don't need to know that to use the library effectively)
続編:Lensで行こう!(2):Isoへの拡張 - みょんさんの。 Lensとは Lens(http://hackage.haskell.org/package/lens-3.7.1.2)というパッケージがあります。 非常に大きなパッケージで、中には非常に便利な函数群がたくさん揃っています。 私が調べた限りでは、 "Lens package in Haskell(HaskellのLensパッケージ)" の解説記事はData.Lens(http://hackage.haskell.org/package/lenses-0.1.6)がやたらとヒットするのですが、こちらよりもControl.Lensとその周りのパッケージ群(この段落の最初にリンクが貼ってある方です)の方が色々と便利でたくさんの函数が揃っているので、ぜひConrol.Lensの方を使ってください*1。 さて、Lensって何が出来る
wreq is a library that makes HTTP client programming in Haskell easy. Features Simple but powerful lens-based API Over 100 tests, and built on reliable libraries like http-client and lens Session handling includes connection keep-alive and pooling, and cookie persistence Automatic decompression Powerful multipart form and file upload handling Support for JSON requests and responses, including navi
This library can help you to get some data read and written in Office Open XML xlsx format. Small subset of xlsx format is supported. For examples look into Codec.Xlsx. Format is covered by ECMA-376 standard: https://ecma-international.org/publications-and-standards/standards/ecma-376/ 4th edition of the standard with the transitional schema is used for this library.
パッケージをインストールするぜ!そしてさっそくghciを起動するぜ! $ cabal install lens $ ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> import Control.Lens Prelude Control.Lens> タプルから値を取り出すぜ! > (1,1,4,5,1,4) ^. _3 4 リストの要素も取り出せるぜ!勿論範囲外の値は取れないけどな! > [1,1,4,5,1,4]
The Haskell programming language community. Daily news and info about all things Haskell related: practical stuff, theory, types, libraries, jobs, patches, releases, events and conferences and more...
Yesod is a Haskell web framework for productive development of type-safe, RESTful, high performance web applications. January 1, 2014By Michael SnoymanView source on Github I've just released version 1.3.1 of persistent-template, which adds a new options: mpsGenerateLenses. When enabled, this option will cause lenses to be generated instead of normal field accessors. An example is worth a thousand
Lenses, Stores, and Yoneda Posted by Bartosz Milewski under Category Theory, Functional Programming, Haskell, Lens, Programming [13] Comments Edward Kmett’s lens library made lenses talk of the town. This is, however, not a lens tutorial (let’s wait for the upcoming Simon Peyton Jones’s intro to lenses (edit: here it is)). I’m going to concentrate on one aspect of lenses that I’ve found intriguing
I took part in the Dagstuhl Seminar on Bidirectional Transformations “BX” earlier this month. It was a meeting of people from four communities—databases, graph transformations, programming languages, and software engineering—discussing their various perspectives—namely the view–update problem in databases, triple graph grammars, lenses, and model synchronization—on the common problem of “BX”. Whil
TL;DR: GHC HEAD (but not GHC 7.8) will soon support OverloadedRecordFields, an extension to permit datatypes to reuse field labels and even turn them into lenses. IntroductionThe Haskell records system is a frequent source of frustration to Haskell programmers working on large projects. On the face of it, it is simple: a datatype such as data Person = Person { id :: Int, name :: String } gives ris
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く