並び順

ブックマーク数

期間指定

  • から
  • まで

241 - 280 件 / 425件

新着順 人気順

haskellの検索結果241 - 280 件 / 425件

  • Functors and Monads For People Who Have Read Too Many "Tutorials" - iRi

    Celebrating Over 10 Years Of Being Too Lazy To Pick A Tagline Title is literally true. This may not be the best place to learn about these concepts for the first time, because I'm going to focus on knocking down the misconceptions about them. Then again, it may not be the worst place, for the same reason. I had promised myself I would not add to the pile of functor or monad "tutorials", but I've b

    • 文脈依存 PEG による Haskell パーサ

      前に PEG パーサジェネレータライブラリ ptera を作っているという話をしたが,今回はその第二弾.ptera で Haskell2010 の文法パーサを例に追加してみたんだが,その過程で色々あったのでその備忘録. 結論から言うと,ptera に前回から以下の拡張を加えた. 先読みを強化し,もうちょっとちゃんと機能するように 文脈依存でパースができるようにした 後は,Template Haskell で文法書けるようにしたりもしたが,まあそれはいいでしょ. Haskell2010 と ptera ptera でひとまず Template Haskell で文法が書けるフロントエンド部分作った後,Haskell 2010 ぐらいパースできないと使い物にならないなあと言う感じで Haskell の example project 書いてみたんだが,ここで色々つまづいてしまった.主に今回説明

        文脈依存 PEG による Haskell パーサ
      • 不動点コンビネータを用いた無名再帰関数の実行まとめ - Qiita

        諸般の理由で『Pythonのlambda式を用いたラムダ計算の基礎表現』を書いた後にHaskellに触れたところ,無名再帰関数を実行する不動点コンビネータfixがとんでもなく簡単に書けたため,同じ方法で他のプログラミング言語でもできないか試したところ,これまたあっさりできたので,まとめメモ的に新しく記事にした. このような内容がQiitaや書籍,ネット上に星の数の更に星の数乗ほどあることは承知しているが,この手の話はYコンビネータが大きな割合を占めており(実際,元記事でも取り上げている),関心のある人々の数多ある参考資料のひとつ程度に捉えてもらえると幸いである.ツッコミ,編集リクエスト歓迎. #不動点コンビネータの定義 不動点コンビネータとは,$f(g(f))=g(f)$が成り立つ関数$g$を指す.この記事では,Haskellの呼称であるfixを不動点コンビネータの関数名とする. ##Ha

          不動点コンビネータを用いた無名再帰関数の実行まとめ - Qiita
        • Haskellの型パズルで作るMini Interpreter

          「効率よく素数を計算するプログラムを作る課題」を出したら「コンパイル時に素数判定を行うプログラムが優勝した」なんて話がありますが[要出典]、今回は型レベル文字列で数式を渡すとコンパイル時に計算を行ってくれる型レベルインタプリタを作ってみようと思います[1] 動作イメージはこんな感じ > :kind! Calc "(1 + 1) * (2 + 0) + 10" Calc "(1 + 1) * (2 + 0) + 10" :: Nat = 14 GHCiで :kind! を使うと与えられた型の型シノニムや型族による変換を評価してくれます。つまり上記のプログラムは数式を表す型レベル文字列を評価してNatカインドの14という型に評価されているというわけです。 元ネタはQuramyさんのこの記事です 今朝この記事を引用した友人が 「文字列型を型レベルで扱える似たような機能って他の静的型付け言語にもあ

            Haskellの型パズルで作るMini Interpreter
          • https://kodimensional.dev/space-leak

            • C++にモナドはいらない - Qiita

              C++ Advent Calendar 2022 の 3 日目の記事 を読んだのですが、C++の規格を作っている人の中にモナドが好きな人がいるようで、仕様書の中にモナド的などという単語を必要もないのに入れようしているようです。それでモナドに興味を持った人もいるかと思って記事を書いてみることにしました。巷にモナドの説明自体はいっぱいあるんですが、Haskellを使って説明するものばかりで読みにくいですし、なんだか要領を得ないものが多いので、C++で説明する需要はあるだろうと思っています。ただし、C++でモナドを作っても意味がないよという否定的な意見を書きますので、そういうのがお好みでない方は許してください。 シンタックスシュガーがないのに、モナドを作るんですか? とりあえず説明のために簡単なIOモナドっぽいのものを書いてみます。まず、文字列を表示する動作を次のように書けるようにします。これは

                C++にモナドはいらない - Qiita
              • GitHub - fumieval/Haskell-breaking-changes

                You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                  GitHub - fumieval/Haskell-breaking-changes
                • LiquidHaskell Blog

                  LiquidHaskell is a GHC Plugin Posted by Ranjit Jhala Aug 20, 2020 I enjoy working with LH. However, I’d be the very first to confess that it has been incredibly tedious to get to work on existing code bases, for various reasons. LH ran one file at a time; it was a hassle to systematically analyze all the modules in a single package. LH had no notion of packages; it was impossible to import specifi

                  • Haskell: The Bad Parts, part 1

                    Haskell: The Bad Parts, part 1 Published October 28, 2020 There's a popular book called JavaScript: The Good Parts. And there's a common meme around the relative size of that book versus JavaScript: The Definitive Guide. Haskell is, in my opinion, a far more well designed and coherent language than JavaScript. However, it's also an old language with some historical baggage. In many ways, it's a bl

                      Haskell: The Bad Parts, part 1
                    • Haskell: The Bad Parts, part 2

                      Haskell: The Bad Parts, part 2 Published November 9, 2020 If you didn't see it, please check out part 1 of this series to understand the purpose of this. Now, for more bad parts! Partial functions (in general) Laziness very likely belongs in this list. My favorite part of criticizing laziness is how quickly people jump to defend it based on edge cases. So let's be a bit more nuanced before I later

                        Haskell: The Bad Parts, part 2
                      • 順を追って理解するStateモナドの実装

                        突然ですが、Stateモナドの実装を書けますか? Stateモナドは自由に読み書き可能なグローバル変数のような機能を、副作用を伴わない純粋な関数だけを使って実装するための便利な概念です。使うだけなら簡単なので普段から便利に利用してる人も多いかもしれませんが、いざ自分で実装しろと言われると手が止まってしまう方もいるのではないでしょうか。 今回はそんなStateモナドの実装を丁寧に見ていき、仕組みを理解することを目指したいと思います。 State さっそく以下に示すのがStateモナドの型の定義です[1]。 まずStateはnewtypeを使って関数と同じ型として定義されます。この関数は以下の構造を意識して作られています。 実行前後で状態の型は変わりませんが、値に関しては変更することが可能になっているのです。 モナドにするためにはFunctorとApplicativeのインスタンスにする必要が

                          順を追って理解するStateモナドの実装
                        • AI搭載エディタ「Cursor」にHaskellを書かせてみた

                          これは「Haskell Advent Calendar 2023」13日目の記事です。 日頃、私は趣味としてAIをHaskellで実装することに没頭しています。しかし、今回は少し違ったアプローチを試してみようと思います。逆に、AIにHaskellを使って自ら実装させ、その過程や成果を共有してみたいと考えています。この新たな取り組みがどのような結果を生むのか、一緒に探ってみましょう。 AI搭載エディタ「Cursor」 気を取り直して、今回は最近話題のAI搭載エディタ Cursor を使って実際に動くHaskellのアプリを0から作らせてみたいと思います!Cursorをまだ知らない人は以下の記事がオススメです(僕もまだこれしか読んでません🤫) Cursorのダウンロードとインストール、そしてアカウント登録が完了したらさっそくHaskellを書かせてみたいと思います。 それではレッツ・・・ ゴ

                            AI搭載エディタ「Cursor」にHaskellを書かせてみた
                          • Search Index in 150 Lines of Haskell

                            I stumbled over Bart de Goede’s article on building a full-text search engine in 150 lines of Python, and was reminded of my quest to show how useful Haskell is for solving real-world problems. Python is an eminently practical language, so nobody is surprised this can be done in Python. But Haskell? The Python code spends a lot of time updating mutable dictionaries. Surely we cannot easily port th

                            • Squeezing a sokoban game into 10 lines of code

                              If you’re only interested in seeing or playing the game, you can find it on my GitHub. The occasion The Haskell Tiny Game Jam is a game jam which challenges participants to write a video game in Haskell using 10 lines of 80 characters. I happen to love Haskell and code golf (abusing a programming language to produce disgustingly short code for fun) so I decided to enter the Feb ‘23 jam. My journey

                              • オンラインカジノ道しるべ

                                オンラインカジノは、その多様なギャンブル体験と手軽なアクセス性により、多くの人々に愛されています。しかし、愛されている一方で、オンラインカジノは資金と個人情報の取り扱いに関わるため、適切な管理が欠かせません。その管理を規制し、監査を行うのが、オンラインカジノの運営ライセンスです。 運営ライセンスは、ギャンブルサイトが法的に運営され、プレイヤーに安全な環境を提供することを保証するものです。運営ライセンスの重要性、信頼性の高いライセンス発行国、そしてプレイヤーが注意すべき運営ライセンスについて説明し、オンラインカジノを選ぶ際の注意事項を説明していきます。 運営ライセンスは、オンラインカジノが正規の事業として運営できるようにする許可証です。このライセンスは、各国の政府や特定の発行機関によって発行され、厳格な審査を経て取得されます。ライセンスを持つオンラインカジノは、以下の点について規制と監査を受

                                  オンラインカジノ道しるべ
                                • 型システム入門

                                  レビュー (日本語訳) 読み始めてから約3年ほどのゆったりペースで読み終わりました。 通称: TAPL (TaPL) (Haskell の) 型システムについて学習するために何か良い本ありませんか?と聞かれればたぶん全員がこの本をおすすめするんじゃないでしょうか。 最初から読めば最高にわかりやすい型システムの入門書です。しかし、多くの人が挫折している入門書です。(入門書詐欺という声もよく見かけますが、そんなことは無いです。ただたんに内容が難しい入門書というだけです) 特に書籍が分厚い (さらに1ページの情報量が多い) のでほとんどの人が11章の単純型付きラムダ計算の拡張の章を読み終わる前に途中で読むのをやめてしまっているような気がします。少なくとも11章までは読むべきです。この辺りまでであればインターネット上に解説などもあるため、ふんわりした理解でも読み進めることができると思います。また、

                                  • Seeking the reasons for segfaults of a Haskell program - あどけない話

                                    My open server of Haskell QUIC on Linux sometimes got segfaults. I saw two types of segfaults. One is a simple segfault by accessing a wrong address: mighty: segmentation fault The other is relating to free(): *** Error in `mighty': corrupted double-linked list: 0x00007fcdf0008f90 *** I guessed that a buffer overrun occurred against a buffer allocated by malloc() and this segfault happened when th

                                      Seeking the reasons for segfaults of a Haskell program - あどけない話
                                    • Haskell Day 2021

                                      日程の詳細はスケジュールをご覧ください。 発表者募集 発表者募集は締め切りました。 Haskell Day 2021 は YouTube プレミア公開を利用してオンラインで開催されます。発表をご希望の方は下記の要項をご確認の上、奮ってご応募ください。 応募資格 誰でも発表者として応募できます。 発表内容 Haskell に関する内容及び Haskell コミュニティが関心のありそうな内容であれば自由です。 参考(過去2回の発表タイトル): Haskell Day 2019 関数型(function type)を見つめるプログラミング HKD (Higher Kinded Datatype) 「しんさんきぼう」GHC の deriving テクノロジー Haskell メタプログラミングによる Egison のパターンマッチの実装 関数と型で理解する自動微分 GHCJS による Web フロ

                                        Haskell Day 2021
                                      • Haskell Database Implementation - Part 1, Growing a Tree

                                        Having started my career as a software developer in 2013 with an undergraduate degree in Mathematics, I never got the chance to take some of the higher-level courses on subjects like compilers, programming languages, or databases. In 2020 I set out to correct some of the gaps in my knowledge, and one of the ways I did so was by writing my own database, in Haskell, from scratch. This series of post

                                        • Using GHC low-latency garbage collection in production

                                          This is a guest post by Domen Kožar. In this post I’ll dive into how low-latency garbage collection (GC) has improved developer experience for Cachix users. The need for low latency Cachix serves the binary cache protocol for the Nix package manager. Before Nix builds a package, it will ask the binary cache if it contains the binary for a given package it wants to build. For a typical invocation o

                                          • A First Look at Info Table Profiling

                                            In this post, we are going to use a brand-new (at the time of writing) and still somewhat experimental profiling method in GHC to show how to identify a memory leak and the code causing it. This new profiling method, implemented by Matthew, allows us to map heap closures to source locations. A key feature of this new profiling mode is that it does not require a profiled build (i.e. building with -

                                            • Generalized Church is the Curry-Howard of Knaster-Tarski

                                              The proofs-as-programs principle (also known as the Curry-Howard isomorphism) sets up a correspondence between logical proof systems and type systems for programming languages. So occasionally a result is independently developed twice, once as a theorem and once as a program. Here’s a short and cute example of this phenomenon. (I read about it in this textbook, but I think it deserves to be better

                                                Generalized Church is the Curry-Howard of Knaster-Tarski
                                              • blog :: Brent -> [String] - Competitive Programming in Haskell: stacks, queues, and monoidal sliding windows

                                                Competitive Programming in Haskell: stacks, queues, and monoidal sliding windows Suppose we have a list of items of length \(n\), and we want to consider windows (i.e. contiguous subsequences) of width \(w\) within the list. ⊕A list of numbers, with contiguous size-3 windows highlighted We can compute the sum of each window by brute force in \(O(nw)\) time, by simply generating the list of all the

                                                • Applicative Computation Expressions

                                                  この記事は、F# Advent Calendar 2020の7日目の記事です。初日の記事であるF# 5.0の新機能でも触れられていますが、 コンピュテーション式でApplicativeな計算を扱えるようにして、より効率的にコンピュテーション式の処理をチューニングすることができる Applicative Computation Expressions について、少しだけ掘り下げてみようと思います。 Optionモナドのコンピュテーション式 まず、手ごろなサンプルとしてOptionモナドのコンピュテーション式の挙動をみてみましょう。 type OptionBuilder1 () = member __.Bind(x, f) = printfn "%s" $"{nameof(OptionBuilder1)}:Bind x:{x}" Option.bind f x member __.Return

                                                    Applicative Computation Expressions
                                                  • GHC 9.0.1 released

                                                    The GHC team is very pleased to announce the availability of GHC 9.0.1. Source and binary distributions are available at the usual place. In addition to numerous bug fixes, GHC 9.0.1 will bring a number of new features: A first cut of the new LinearTypes language extension, allowing use of linear function syntax and linear record fields. A new bignum library, ghc-bignum, improving portability and

                                                      GHC 9.0.1 released
                                                    • Implementing Unsure Calculator in 100 lines of Haskell

                                                      Implementing a calculator with normal ranges, embedded in Haskell, using a simplified probability monad. #haskell#probability 1 Unsure Calculator The recently trendy Unsure Calculator makes reasoning about numbers with some uncertainty just as easy as calculating with specific numbers. The key idea is to add a new “range” operator (written ~) to the vocabulary of a standard calculator. The range x

                                                      • 余代数な有限機械のHaskell実装

                                                        概要 この記事は Bart Jacobs による "Introduction to Coalgebra" という大変面白い本の一部を Haskell で実装し確認したメモである。余代数や終余代数の概念をHaskell での実装を弾幕としてできるだけさりげなく導入する。またその適用例としてStream と有限オートマトンを構成する。結果として余代数が時間発展の構造(structure)を与えるとき、終余代数はその振る舞い(behaviour)を与えることを見る。また余帰納的(余再帰的)定義ということについても補足する。圏論の語彙は本質的な理解には差し替えないと思われる範囲で未定義のまま用いている。 Stream と余代数 Stream 有限オートマトンを扱う前に Stream でウォーミングアップする。Stream とはある型の値の無限個数の列である。いま Pair Functor を次のよ

                                                          余代数な有限機械のHaskell実装
                                                        • Ema

                                                          Ema is a next-gen library for building jamstack-style static sites in Haskell. Ema sites are change-aware; in addition to good ol’ static site generation, Ema provides a live server supporting fast hot-reload in the browser, on code or data change. The ultimate purpose of ema is to facilitate creating with ease your own neuron 1 , or just about any app that creates a browser view of arbitrarily ch

                                                          • Competitive programming in Haskell: 2D cross product, part 1

                                                            Time for some more geometry! In my previous post I challenged you to solve Cookie Cutters, which asks us to scale the vertices of a polygon so that it has a certain prescribed area. It’s possible to solve this just by looking up an algorithm for computing the area of a polygon (see the “shoelace formula”). But the way to get good at solving geometry problems is not by memorizing a bunch of formula

                                                              Competitive programming in Haskell: 2D cross product, part 1
                                                            • Stealing Impl from Rust

                                                              With the new OverloadedRecordDot language extension, we can use the . character to access stuff on records. {-# language OverloadedRecordDot #-} data User = User { name :: String } main :: IO () main = do let user = User { name = "Matt" } putStrLn user.name This is syntax sugar for the following code: import GHC.Records data User = User { name :: String } instance HasField "name" User String where

                                                              • GitHub - swarm-game/swarm: Resource gathering + programming game

                                                                You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                                  GitHub - swarm-game/swarm: Resource gathering + programming game
                                                                • Free monads in the real world

                                                                  After finishing my master’s degree, I applied to several companies I was interested in. During one of the selection processes, the interviewer asked me to do the following exercise: “Write a stack-based interpreted language that includes: literals, arithmetic operations, variables, and control flow primitives. As a bonus, add asynchronous primitives such as fork and await.” Fortunately, I was alre

                                                                  • Generalizing 'jq' and Traversal Systems using optics and standard monads

                                                                    Hi folks! Today I'll be chatting about Traversal Systems like jq and XPath; we're going to discover which properties make them useful, then see how we can replicate their most useful behaviours in Haskell using (almost entirely) pre-ols!existing standard Haskell tools! Let's go! What's a Traversal System? First off I'll admit that "Traversal System" is a name I just came up with, you probably won'

                                                                    • Copilot 3 - NASA Technical Reports Server (NTRS)

                                                                      Copilot 3Ultra-critical systems require high-level assurance, which cannot always be guaranteed in compile time. The use of runtime verification (RV) enables monitoring these systems in runtime, to detect property violations early and limit their potential consequences. The introduction of monitors in ultra-critical systems poses a challenge, as failures and delays in the RV subsystem could affect

                                                                      • IDE: Haskell Language Server, binaries and installation

                                                                        Posted on July 24, 2020 by Luke Lau If you’ve ever had to install haskell-ide-engine or haskell-language-server, you might be aware that it is quite a lengthy process. There are several reasons for this, two of the most significant being: Both haskell-ide-engine and haskell-language-server act as a kitchen sink for plugins. These plugins all depend on the corresponding tool from Hackage, and as a

                                                                        • Inside the Cult of the Haskell Programmer

                                                                          A regular column about programming. Because if/when the machines take over, we should at least speak their language. Haskell. It sounded like a good name for a weapon—a well-sharpened blade, like scimitar or katana. The strong German-sounding plosive in its name, as in Nietzsche or Kafka, added a menacing edge. All I really knew about the language was that it was challenging and intended for math

                                                                            Inside the Cult of the Haskell Programmer
                                                                          • Kowainik - Haskell mini-patterns handbook

                                                                            Navigating in the ocean of Haskell possibilities is challenging even though Haskell is a powerful language that helps to implement robust and maintainable programs. The language supplies you with tons of awesome approaches, but it is not always trivial to see how and where to use them properly. Fortunately, like any other mainstream programming language, Haskell also has its best-practices and rec

                                                                              Kowainik - Haskell mini-patterns handbook
                                                                            • Re: 言語のはなし / jmuk - Message Passing

                                                                              話をふられてなんなんだけど、最近あんまりML系の言語を使ってみたりしていないんだよな。最後になにかやったのは、min-camlがwasmを吐けるようにしたことで、あれはOCamlで書いたのだったか(min-camlはセルフホストではなく、OCamlで書かれている)。公開もしていない……自分で書いた部分がかなりmessyで気が滅入る感じになってしまったので放置している。 Haskellの型クラス そういえばポッドキャストで最近、Haskellの歴史の論文を読んだのを紹介した。2カラムで50ページ以上という長大なる論文なので仕方なくかなりの部分を割愛したが、なかでも型クラスの話はほとんど触れずに飛ばしたように思う。ところがあの論文は “being lazy with class” という副題がついてるくらい、なにかと型クラスの話をする論文なのだった。論文著者の気持ちとしては、型クラスこそがHa

                                                                                Re: 言語のはなし / jmuk - Message Passing
                                                                              • Learn You a Haskell for Great Good! | A community version

                                                                                Hey yo! This is an up-to-date open-source fork of the original Learn You a Haskell (LYAH for short) by Miran Lipovača, "the funkiest way to learn Haskell, the best functional programming language around". This guide is meant for people who have programmed already, but have yet to try functional programming. Now, why did I create this fork? ("fork" means a copy of an original which may be modified

                                                                                • jaspervdj - Lazy Sort: Counting Comparisons

                                                                                  How good is Haskell's lazy sort actually? Published on September 17, 2020 under the tag haskell Haskell’s laziness allows you to do many cool things. I’ve talked about searching an infinite graph before. Another commonly mentioned example is finding the smallest N items in a list. Because programmers are lazy as well, this is often defined as: This happens regardless of the language of choice if w