並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 9465件

新着順 人気順

haskellの検索結果1 - 40 件 / 9465件

  • 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
    • The ultimate guide to Haskell Strings · Hasufell's blog

      © 2021. All rights reserved. Site created with Hakyll. Modified theme lanyon-hakyll based on Lanyon. The ultimate guide to Haskell Strings May 7, 2024, Posted by Julian Ospald This guide is aimed at Haskellers who seek to improve their understanding of String types, be it beginners or seasoned developers. It is also meant to be a quick reference/cheat sheet for deciding which string type to use in

      • TypeScript 関数型スタイルでバックエンド開発のリアル

        TSKaigi 2024 のスライドです

          TypeScript 関数型スタイルでバックエンド開発のリアル
        • Compiling higher order functions with GADTs

          Implementing first class functions in a bytecode interpreter is trivial. But how do compilers that generate machine code (or lower to C, or SSA) implement higher order functions? Back in 2021, I found an answer when contributing closures to the Pallene compiler. Today I was researching something loosely related, and found yet another neat trick called defunctionalization in this paper. Defunctiona

          • Development notes from xkcd's "Machine"

            On April 5th, xkcd released Machine, the 15th annual April Fools project I’ve made with them. It’s a game we’d been dreaming of for years: a giant rube goldberg machine builder in the style of the classic Incredible Machine games, made of a patchwork of machines created by individual xkcd readers. For more details, check out Explain xkcd’s wonderful writeup. This is the story of how we built Machi

              Development notes from xkcd's "Machine"
            • Lix

              declarative. reproducible. human-friendly.Lix is a modern, delicious implementation of the Nix package manager, focused on correctness, usability, and growth – and committed to doing right by its community. The Lix EcosystemLike other Nix ecosystems, Lix layers together multiple projects to create a full Lix stack — allowing you to forge your own systems on a base of community work. The Lix Packag

                Lix
              • CS SYD - Getting your Haskell executable statically linked with Nix

                I have been making my products statically linked over the past few days. This post presents why and how to statically link your Haskell executables and collects a mapping from obscure error to unexpected fixes. This work would not have been possible without the many-year-long effort of people like nh2. This issue on GitHub is a good summary of what went into making this possible. Why statically li

                • Direct-style Effects Explained

                  Direct-style Effects Explained By Noel Welsh on 24 Apr 2024 Direct-style effects, also known as algebraic effects and effect handlers, are the next big thing in programming languages. At the same time I see some confusion about direct-style effects. In this post I want to address this confusion by explaining the what, the why, and the how of direct-style effects using a Scala 3 implementation as a

                  • Choreographing a dance with the GHC specializer (Part 1)

                    Specialization is an optimization technique used by GHC to eliminate the performance overhead of ad-hoc polymorphism and enable other powerful optimizations. However, specialization is not free, since it requires more work by GHC during compilation and leads to larger executables. In fact, excessive specialization can result in significant increases in compilation cost and executable size with min

                      Choreographing a dance with the GHC specializer (Part 1)
                    • Knuth–Morris–Pratt illustrated | Journal of Functional Programming | Cambridge Core

                      We use cookies to distinguish you from other users and to provide you with a better experience on our websites. Close this message to accept cookies or find out how to manage your cookie settings.

                        Knuth–Morris–Pratt illustrated | Journal of Functional Programming | Cambridge Core
                      • Windowsで動くプログラミング言語に脆弱性、引数の扱い方の穴を突いて攻撃

                        CERT Coordination Center (CERT/CC, Carnegie Mellon University)は4月10日(米国時間)、「VU#123335 - Multiple programming languages fail to escape arguments properly in Microsoft Windows」において、Windows上で動作する複数のプログラミング言語から引数を適切にエスケープしない脆弱性を発見したと報じた。この脆弱性はアプリケーションのコマンドインジェクションにつながるとして注意を呼びかけている。 VU#123335 - Multiple programming languages fail to escape arguments properly in Microsoft Windows 脆弱性の詳細 多くのプログラミング言語にはオ

                          Windowsで動くプログラミング言語に脆弱性、引数の扱い方の穴を突いて攻撃
                        • Calling Haskell from Swift

                          struct User { let name: String let age: Int } // birthday(user: User(name: "Anton", age: 33)) = User(name: "Anton", age: 34) func birthday(user: User) -> User { // Calls Haskell function... } To support this workflow, we need a way to convert the User datatype from Haskell to Swift, and vice versa. We are going to serialize (most) inputs and outputs of a function. Even though the serialization as

                          • Flora :: [Package]

                            A package repository for the Haskell ecosystem

                            • ビジネスロジックを「型」で表現するOOPのための関数型DDD / Functional And Type-Safe DDD for OOP

                              Object-Oriented Conference 2024で発表した資料です。 https://fortee.jp/oocon-2024/proposal/b31c9818-3cb8-4350-adfe-cbc839cdf829 ビジネスの専門知識(ドメイン)を中心に据えたドメイン駆動設計に代数的データ型などの関数型のパラダイムを加えたよりタイプセーフな関数型DDDを紹介します。 本セッションではドメインモデリングによって発見したモデルやビジネスロジックをソフトウェアに反映する際により型を重視した設計を加えます。 型で表現する範囲が広がることでビジネスロジックをより明確にコードで表現できるようになります。 さらには型で表現されているためコンパイルフェーズで気付けるミスが増え、ソフトウェアの品質向上にもつながります。 関数型の考えをいれるといってもただ単にHaskellなどに代表される関

                                ビジネスロジックを「型」で表現するOOPのための関数型DDD / Functional And Type-Safe DDD for OOP
                              • GHC 9.10の新機能

                                GHC 9.10.1-alpha1が2024年3月14日にリリースされました。正式版のリリースは4月ごろを目指しているようです(9.10.1 · Milestones · Glasgow Haskell Compiler / GHC · GitLab)。 この記事では、GHC 9.10の新機能を確認していきます。過去の類似の記事は GHC 9.2の新機能と、GHCの動向2021 GHC 8.10とGHC 9.0の新機能 GHC 9.4の新機能 GHC 9.6の新機能 GHC 9.8の新機能 です。 この記事は網羅的な紹介記事とはなっていません。是非、公式のリリースノート類も参照してください: 2.1. Version 9.10.1 — Glasgow Haskell Compiler 9.10.0.20240313 User's Guide docs/users_guide/9.10.1-

                                  GHC 9.10の新機能
                                • 継続モナドで立ち向かうローンパターンとEither地獄 - 星にゃーんのブログ

                                  Haskellでファイルなどのリソースの解放を保証するテクニックとして、ローンパターン(Loan Pattern)がある。withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO rなどがその例だ。 ローンパターンによる関数を複数使ったプログラムは、無名関数のネストが深くなる。 main = do withFile "src.txt" ReadMode \src -> withFile "dst.txt" WriteMode \dst -> ... この問題には、継続モナドContTを使ったきれいな解決策が知られている。 main = evalContT do src <- ContT $ withFile "src.txt" ReadMode dst <- ContT $ withFile "dst.txt" WriteMode .

                                    継続モナドで立ち向かうローンパターンとEither地獄 - 星にゃーんのブログ
                                  • UTF-8のバリデーションとモノイドと半群

                                    この記事はUTF-8のバリデーションとオートマトンの続きです。 前回はUTF-8のバリデーションが8状態のオートマトン (DFA) で表現できることを見ました。状態と遷移を擬似コードで書けば次のようになるでしょう: -- 8つの状態 data State = START | TAILx1 | TAILx2 | TAILx3 | A | B | C | D -- 入力バイトに応じて次の状態を返す。次の状態が該当しなかったら Nothing を返す next :: Word8 -> State -> Maybe State +----+----+-----+----+ | a0 | a1 | ... | aN | 8ビット整数列 +----+----+-----+----+ | | | v v v +----+----+-----+----+ | m0 | m1 | ... | mN | モノ

                                      UTF-8のバリデーションとモノイドと半群
                                    • インターフェースと型クラスの違いを考える

                                      この記事では、JavaライクなインターフェースとHaskellライクな型クラスを比較します。どちらも、複数の異なる型を統一的に扱うための仕組みです。 インターフェース インターフェースはご存知の方も多いと思いますが、コード例を載せておきます。 // インターフェースの定義 interface Greetable { String greet(); } // 実装の例1 class Hello implements Greetable { String message; Hello(String m) { this.message = m; } public String greet() { return "Hello " + message + "!"; } } // 実装の例2 class Goodbye implements Greetable { public String gree

                                        インターフェースと型クラスの違いを考える
                                      • Unification-free ("keyword") type checking

                                        From my perspective, one of the biggest open problems in implementing programming languages is how to add a type system to the language without significantly complicating the implementation. For example, in my tutorial Fall-from-Grace implementation the type checker logic accounts for over half of the code. In the following lines of code report I’ve highlighted the modules responsible for type-che

                                          Unification-free ("keyword") type checking
                                        • Why is Prettier rock solid?

                                          Why is Prettier rock solid?I've always wondered why Prettier is so good. Yes, it learnt from gofmt what to do (note that gofmt doesn't indent, which is the hard part). Yes, it was announced in a real life conference, which helped get the initial momentum behind it. All that is fine, but what was a bit inexplicable to me is its quality. You might disagree with the defaults (I like them. The only on

                                          • 私とテストと自動化と - あどけない話

                                            何度か講演でこの話をしたのだが、気が向いたのでエッセンスを書き下しておこうと思う。 テスト駆動という言葉が流行る前にプログラマとなった私は、当初どのようにテストを書いてよいのか分からなかった。そんなとき、(当時はオーム社で現在はラムダノートの)鹿野さんから「ビューティフルコード」を献本していただいた。分厚い本なので、興味ある章から読んでいった。その一つがアルベルト・サボイア氏が書いた7章「ビューティフル・テスト」だ。 ビューティフルコード (THEORY/IN/PRACTICE) 作者:Brian Kernighan,Jon Bentley,まつもとゆきひろオライリージャパンAmazon この章では、例として二分探索が取り上げられる。二分探索のアイディアが出されたのは1946年だが、バグのない実装ができたのは12年後だという。実際に実装してみると分かるが、ソートされた配列の中に目的の要素が

                                              私とテストと自動化と - あどけない話
                                            • GitHub - ambulancja/mariposa: A toy programming language with time travel

                                              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 - ambulancja/mariposa: A toy programming language with time travel
                                              • F# ではじめる関数型プログラミング入門 (上巻)

                                                .NET ファミリーの関数型プログラミング言語である F# を利用した、全 3 巻構成の関数型プログラミング入門書籍となります。 上巻では F# の基本的な文法などの学習ができます。 なお、この書籍は本編をすべて無料で利用いただけますが、活動を応援いただける場合には最終チャプターをご購入いただけますと嬉しく思います。

                                                  F# ではじめる関数型プログラミング入門 (上巻)
                                                • GitHub - augustss/MicroHs: Haskell implemented with combinators

                                                  This repository contains an implementation of an extended subset of Haskell. It uses combinators for the runtime execution. The runtime system has minimal dependencies, and can be compiled even for micro-controllers. The boards/ directory contains some samples, e.g., some sample code for an STM32F407G-DISC1 board. The compiler can compile itself. There are two different ways to compile MicroHs: Us

                                                    GitHub - augustss/MicroHs: Haskell implemented with combinators
                                                  • AtCoder ガチ言語 Haskell 🔥

                                                    Haskell で AtCoder に入門しましょう

                                                      AtCoder ガチ言語 Haskell 🔥
                                                    • 2023年にHaskell関連で知ってよかったこと - あどけない話

                                                      これはHaskell Advent Calendar 2023の19番目の記事です。 フォーマッター 以前、フォーマッターをいくつか試しましたが、どれもイマイチでした。しかし、fourmoluはいけてます。fourmoluは、Ormoluのフォークで、Ormoluが偉大なのでしょう。両方試しましたが、僕はformoluに決めました。 Hackageに上がっているので好きな方法でインストールしてください。 % cabal install fourmolu formoluにHaskellのプログラムを渡すと、整形したプログラムを出力してくれます。ファイルの内容を直接書き換えたいときは、-iオプションを渡します。エディタやIDEと連動できますが、お試しでプロジェクト全体を整形するには、以下のようにするといいでしょう。 % find . -name "*.hs" | xargs fourmolu

                                                        2023年にHaskell関連で知ってよかったこと - あどけない話
                                                      • 2023年の Linear Haskell で純粋・並列 FFT を実装する──「Haskell は Rust になれるのか?」補遺

                                                        この記事は Haskell Advent Calendar 2023 14 日目の記事です[1]。 更新履歴 2023-12-15 並列化のパフォーマンスに関する追記。 2023-12-14 初版公開。 はじめに 先々月、Linear Haskell のまとまりのない記事を書いたところ、思ったよりも反響を頂いてびっくりしました。 ただかなりまとまりのない長文だった結果、「長い」「結局 Rust になれるのかようわからん」といった御叱りを頂きました。本当にすいません……。 冒頭に「RustのようになるにはLinear Constraintsに期待」とか、末尾に「2023年のHaskellはまだ Rust ではないが、近い将来 Rust になれる可能性が大きい」とか書きはしましたが、全体があまりにも長いのでこの結論を見つけ出すのも大変ですし、話題があんまり散漫に過ぎまたので論拠もすごくわかりづ

                                                          2023年の Linear Haskell で純粋・並列 FFT を実装する──「Haskell は Rust になれるのか?」補遺
                                                        • AI搭載エディタ「Cursor」にHaskellを書かせてみた

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

                                                            AI搭載エディタ「Cursor」にHaskellを書かせてみた
                                                          • TypeScriptでどこまで「関数型プログラミング」するか ─ 「手続き Haskell」から考察する - 一休.com Developers Blog

                                                            この記事は 一休.comのカレンダー | Advent Calendar 2023 - Qiita 10日目の記事です。 昨今は Web アプリケーション開発の世界でも、関数型プログラミングのエッセンスを取り入れるような機会が増えてきました。 とはいえ、一つのアプリケーションを 1 から 10 までがっちり関数型プログラミングで構成するというわけではなく、そのように書くこともあればそうでない従来からの手続き的スタイルで書くところもあるというのが現状で、どこまで関数型プログラミング的な手法を取り入れるかその塩梅もまちまちだと思います。まだ今はその過渡期という印象も受けます。 本稿ではこの辺りを少々考察してみたいと思います。 先日、Qiita Conference 2023 Autumn で以下のテーマで発表を行いました。 この発表では「関数型プログラミング最強!」という話をしたわけではなく、

                                                              TypeScriptでどこまで「関数型プログラミング」するか ─ 「手続き Haskell」から考察する - 一休.com Developers Blog
                                                            • Haskellのzip関数を一般化すると何になるか

                                                              この記事は Haskell Advent Calendar 2023 の7日目の記事です。 zip関数について Haskellには zip 関数というものがあります。この関数は、2つのリストを受け取って、それぞれから取り出した要素を組にしたリストを返します。

                                                                Haskellのzip関数を一般化すると何になるか
                                                              • 四元数ニューラルネットワークとGHR微積分

                                                                これは「FOLIO Advent Calendar 2023」6日目の記事です。 ニューラルネットワークで取り扱う数値を実数とは異なる数に拡張することは、機械学習や計算科学の発展における魅力的な課題の一つです。実数を用いた数値表現は多くのタスクにおいて十分な結果をもたらしてきましたが、新たな数値体系を導入することで、今までとは異なる問題が解決できるようになったり実数では見られなかった新たな現象が起こる可能性に期待することができるでしょう。例えば数値が取れる値を±1に制限したBinalized Neural Networksはハードウェアとの相性が良くメモリ効率の良い実装が可能であったり、拡大実数\bar{\mathbb R}={\mathbb R}\cup\{-\infty,\infty\}を用いた5層のReLUネットワークには任意の深さのReLUネットワークを埋め込むことができたりします

                                                                  四元数ニューラルネットワークとGHR微積分
                                                                • Haskell の Array

                                                                  Haskellのカレンダー | Advent Calendar 2023 - Qiita 3日目の記事です。 Haskell の Array (配列) について書こうと思います。Haskell の Array は索引が型クラスの Ix で抽象化されているため、特に配列の次元を拡張する際に柔軟性がありとても便利です。 そんな便利な Array ですが、もともと Haskell はリスト操作が強力ということもあってか、既存の参考書をみても Array の解説はほんの少しにとどまっているか、解説がないことがほとんどです。 Array が必要になる場面の多くは「リストだと !! によるインデックスアクセスで O(n) になってしまい間に合わない」という場面が多いと思います。しかし Haskell にはインデックスアクセスが O(1) の Vector (vector: Efficient Arra

                                                                    Haskell の Array
                                                                  • Haskellで、手軽にプロパティベーステスト

                                                                    はじめに Haskell Advent Calender 2023の2日めの記事です。カレンダーの枠が空いていたので、久しぶりに勢いで書いてみました。 さて、ラムダノート社から「実践プロパティベーステスト」が出版されたので、巷ではプロパティベーステストが流行っていることでしょう (紹介宣伝です)。 Haskellでは、プロパティベーステスト用のライブラリとして、例えばQuickCheckがあります。 この記事では、Haskellではソースコードのコメント中に簡単な記述をするだけで、プロパティベーステストを手軽に実行できることを改めて紹介します。 本格的なコードを開発している局面だけではなく、ちょっと頭の中を整理したい時などにも手軽で便利です。 (前準備) テストケースと期待値によるテスト Haskellでは、ソースコードのコメント中に埋め込まれたテストケースを実行できるdoctestという

                                                                      Haskellで、手軽にプロパティベーステスト
                                                                    • Reddit で振り返る今年の英語圏 Haskell 界隈の話題 - Qiita

                                                                      Haskel advent calendar 2023 の1日めの記事です. お仕事も情報系でなく,多忙を言い訳に数年ほとんどコード自体をかけていなかったのですが,最近 e-Gov 法令検索 で公開されている法令XMLを読みたい需要があって久しぶりに Haskell で書いてみたらやはり書きやすく,とても楽しくて改めて感動しました.書きながら自然に思考が整理される感じがよい. Hoogle は変わらぬ使いやすさでモリモリサポートしてくれるし,環境構築も GHCup などが噛み合って随分スムーズで,Haskell Language Server も成熟してきているようです.環境構築については,昨年の Advent Calendar の1日め @mod_poppo さんの記事 などが参考になります. 最近入った言語拡張にも,ちょっとだけコード書く位でも(大規模なあるいは高度なコードじゃなくても

                                                                        Reddit で振り返る今年の英語圏 Haskell 界隈の話題 - Qiita
                                                                      • F# 8 のリリースで F# が最強の言語になってしまった件 - Qiita

                                                                        おはようございます. 遅ればせながら,11/14/2023 の .NET 8 のリリースの内容を確認し,コードジェネレータの新しい最適化機構(PGO)のデフォルト有効化や AI/LLM のアプリケーションへの統合,各フレームワークのアップデートや,C# の方ではコレクション記法の統合など様々なトピックがある中で,付随してリリースされた F# 8 についても新機能をチェックしてみました. ヤバすぎました. 私は涙しました.これまであらゆる F#er が望んでも得られなかったものがそこにはありました.F# という言語がこれまでの不満点を一気に払拭し,至高の領域に到達しようというヤバみを感じるリリースだったので,今回は以下のブログポストに記載されている新機能から個人的に凄いと思ったものを抜粋して解説します. 11/24/2023 一部サンプルコードのミスを修正しました. F# および F# 8

                                                                          F# 8 のリリースで F# が最強の言語になってしまった件 - Qiita
                                                                        • A Fistful of Automata

                                                                          20 October 2023 Recently, I have been brushing up my knowledge of Formal Languages and stumbled again into the many different faces of finite automata. Most materials present DFAs, NFAs and company as distinct beasts, each with their own properties and theorems. Nevertheless, I couldn’t get out of my mind that all definitions seemed too similar. After hitting my head into a couple walls, I finally

                                                                          • 関数型プログラミングと型システムのメンタルモデル

                                                                            Qiita Conference 2023 Autumun での発表資料です 発表時間の見積もりが下手で後半全然説明できませんでした、すみません! 実際のプロダクト開発ではどうすればいいのか? というケースは以下のスライドを参照してください。 (本スライドは、こちらのプロダクト開発の経験をベースに基礎を再整理したものになります) https://speakerdeck.com/naoya/typescript-niyoru-graphql-batukuendokai-fa-75b3dab7-90a8-4169-a4dc-d1e7410b9dbd

                                                                              関数型プログラミングと型システムのメンタルモデル
                                                                            • λm.me - An alternative frontend for Haskell?

                                                                              In CppCon 2022, Herb Sutter gave a talk titled Can C++ be 10x Simpler & Safer? where he described an alterntive syntax that compiles to C++ (which he calls CppFront or Cpp2) that could remove much of the existing issues with C++ - reduce complexity, increase safety, and more. If you haven't seen it yet, it's worth a watch! With recent events and discussions in the Haskell community, my mind went b

                                                                                λm.me - An alternative frontend for Haskell?
                                                                              • unsafePerformIOではじめる愉快なHaskellプログラミング

                                                                                Haskellは「入出力のためにIOモナドを使う必要があるので難しい」というイメージを持たれがちです[要出典]。この記事ではそのイメージに異を唱えることを目指します。すなわち、モナドを使わずに入出力を含むプログラミングをやってみます。 と言っても、Haskell標準の入出力関数には IO 型がついていることに変わりはありません。ですが、 unsafePerformIO という魔法の関数を使うと、IO 型を外して値を取り出すことができるのです。この記事ではこれを最大限活用します。 module System.IO.Unsafe where -- 魔法の関数 unsafePerformIO :: IO a -> a

                                                                                  unsafePerformIOではじめる愉快なHaskellプログラミング
                                                                                • C#でエラー処理を実装するときにEither型を作ったら良い感じになった

                                                                                  要約 処理に失敗したことをメソッドの呼び出し元に通知するのに例外を使いたくなかった とはいえTupleでエラーオブジェクトを返すのもなんか取り回しが悪い そこで「2つの型のどちらかが設定されている」を保証するEither型を実装したらめちゃくちゃ書きやすくなった 背景 おそらくC#において「メソッドの処理が失敗した」ことを呼び出し元に通知する一番メジャーな方法は例外オブジェクトを投げる方法だと思います(標準ライブラリの多くがそうやってエラーを通知しています)。 しかし例外を投げるように実装すると、例外は分岐が見えにくく追いかけるのが面倒だし、呼び出し側でtry~catchをいちいち書くのが面倒だし、キャッチが漏れた例外がそのまま上に突き抜けたりとか、色々な問題を孕んでいます。 また、メソッドが例外を投げることがメソッドのシグネチャで表現されないので、あるメソッドを呼び出したときに例外をキャ

                                                                                    C#でエラー処理を実装するときにEither型を作ったら良い感じになった