並び順

ブックマーク数

期間指定

  • から
  • まで

121 - 160 件 / 284件

新着順 人気順

haskellの検索結果121 - 160 件 / 284件

  • 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
    • Haskellで型レベルパーサー

      ghc-9.6.1です。 GHCはChar kindが9.2で入ったので型レベルパーサーが書ける様になってるんですよね。ということで書いてみました。 BNFは以下です: expr ::= term *('+' term) term ::= factor *('*' factor) factor ::= '(' expr ')' | nat nat ::= 0 | 1 | 2 | ... | 9 {-# Language TypeData #-} {-# Language DataKinds #-} {-# Language TypeFamilies #-} {-# Language UndecidableInstances #-} {-# Language TypeApplications #-} {-# Language MagicHash #-} {-# LANGUAGE NoStar

        Haskellで型レベルパーサー
      • 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.

          GitHub - fumieval/Haskell-breaking-changes
        • Windows10 HomeでDocker + VSCodeによるhaskellの環境構築 - Qiita

          はじめに いままでインタプリタ型・動的型付けの言語を使う機会の方が多かったです。 ただ、触っていくうちに「かっちりさ」に欠ける 気がしてしまったんです。 「70%の完成度でリリースできる」という言葉を聞いたことがあるくらいですからそれほど厳密さには焦点を絞っていないのだと思います。 もちろん、それがいいところだし、実社会ではその方がスピード感のあるリリースが可能になる分強いと思います。 ただ、コンパイラ型・静的型付けの言語も触ってみて両者の違いをつかんでみたいなという気持ちが湧いてきたんです。 (かっちりしてるものの方が扱いやすい気がするという好みの問題もあるんですが) しかも、オブジェクト指向に関してもJavaScript, Python, PHPと触っていくうちに雰囲気がつかめてきた(分かったとは言ってない)ので関数型なるものを触ってみたいという好奇心もあります。 そこでHaskell

            Windows10 HomeでDocker + VSCodeによるhaskellの環境構築 - Qiita
          • Simple Haskell

            Pure functions and strong types are the key to reliably delivering quality software. Industrial Haskell users are realizing that the key to delivering software on time and under budget is to keep it simple. We still have yet to fully leverage the value that Haskell98 has to offer through features like: Pure Functions Sum and Product Types Type Classes Polymorphism Accessibility Commercial software

            • regex-applicative: 内部DSLとしての正規表現(ブログ記事版) - Haskell-jp

              RegexFestaで発表した内容を詳しく紹介しますPosted by YAMAMOTO Yuji(@igrep) on December 30, 2019Tags: 正規表現 先日、といっても2019年10月18日のことなんでもう2ヶ月以上も経ってしまいましたが、私はRegex Festaというイベントで、「regex-applicative」というパッケージの紹介を致しました。 今回はその際使用したスライドを、ブログ記事として詳しく共有させていただきたいと思います! 発表時のスライドと比べて、よりHaskellを知っている人向けになってしまいますが、regex-applicativeの魅力を明確に伝えるために必要なのでご了承ください。 Applicativeスタイルを前提知識とします。 Link to hereはじめにまとめ regex-applicativeは、Haskellの式で正

                regex-applicative: 内部DSLとしての正規表現(ブログ記事版) - Haskell-jp
              • 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
                • AI搭載エディタ「Cursor」にHaskellを書かせてみた

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

                    AI搭載エディタ「Cursor」にHaskellを書かせてみた
                  • 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
                    • Implementing graceful-close in Haskell network library - あどけない話

                      Closing connections gracefully is an old and new problem in network programming. In the HTTP/1.1 days, this did not get attention since HTTP/1.1 is a synchronous protocol. However, as Niklas Hambüchen concretely and completely explained, HTTP/2 servers should close connections gracefully. This is because HTTP/2 is an asynchronous protocol. Unfortunately, most HTTP/2 server implementations do not c

                        Implementing graceful-close in Haskell network library - あどけない話
                      • 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 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

                          • 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
                            • HIW 2019で発表された、GHC 8.8で導入された機能 - Haskell-jp

                              こんにちは。 今回からいくつか、「Haskell Implementors’ Workshop 2019」に私が先月参加した際のレポートとして、印象深い発表をテーマごとに分けた短い記事を執筆します。 最近公開されたGHC 8.8の話はもちろん、未来のGHCやその他のHaskellの処理系を知るのによいイベントでしたので、その一部だけでも伝われば幸いです。 Link to hereそもそもHaskell Implementors’ Workshop (HIW)とは? シリーズ(?)第1回目なので、簡単にHIWそのものについて紹介しておきましょう。 HIWは、ICFP (International Conference on Functional Programming)という関数型プログラミングについての国際会議に併設された、Haskellの実装者のためのワークショップです。 名前の通り、G

                                HIW 2019で発表された、GHC 8.8で導入された機能 - Haskell-jp
                              • Named typeclasses in Haskell

                                One of the best features of Haskell are typeclasses. Still, it is not easily possible to have multiple implementation of the same typeclass for the same data type. For example, to define an additive and a multiplicative instance of Monoid on Int, one needs to use specific newtype wrappers such as Sum and Product. On the other hand, in Idris it is possible to define multiple named implementations o

                                  Named typeclasses in Haskell
                                • Holmusk | Haskell - An Experience Summary

                                  Holmusk is a digital healthcare startup based in Singapore with a focus on mental health and chronic conditions. Approximately a year ago, we chose to begin the process of migrating our backend into Haskell. As of March 2019, Holmusk is now powered fully by Haskell and this post is a summary of our experiences so far. These are all anecdotal, based just on our experience in this process. Generalis

                                  • Haskell vs OCaml

                                    haskell Published on December 6, 2019, last updated December 11, 2019 This is a comparison between the two languages by someone who has written code professionally in both. That said, I’m much more familiar with Haskell than with OCaml, so if you think there is a mistake in the text, let me know. Background and users Haskell is a niche, rarely used language. The situation is changing, but make no

                                    • Bringing TLS 1.3 to Haskell - あどけない話

                                      Haskell TLS library version 1.4.1 or earlier support SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1 and TLS 1.2. Here is brief summary of their security: SSL 2.0 is insecure and obsoleted by RFC 6176 SSL 3.0 is insecure and obsoleted by RFC 7568 TLS 1.0 is insecure due to lack of AEAD TLS 1.1 is insecure due to lack of AEAD TLS 1.2 is secure if it is used with proper parameters (using (EC)DHE and AEAD, disabl

                                        Bringing TLS 1.3 to Haskell - あどけない話
                                      • 余代数な有限機械のHaskell実装

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

                                          余代数な有限機械のHaskell実装
                                        • IDE: The State of Haskell IDEs

                                          Posted on May 8, 2020 by Luke Lau It is an exciting time for Haskell tooling. As many might be aware, the past year has seen a number of significant changes to the ecosystem, with one of the most noticeable ones being the marriage of ghcide and haskell-ide-engine. We now have contributors from both projects working towards a unified vision of a language server, the haskell-language-server, which a

                                          • HaskellとScottyで簡単にAPIを構築する - Qiita

                                            {-# LANGUAGE OverloadedStrings #-} module Sample where import Web.Scotty main :: IO () main = scotty 3000 $ get "/" $ html "<h1>Hello</h1>" http://localhost:3000/にアクセスしてみましょう。 ユーザのAPI 例としてユーザデータを参照/作成/削除をするAPIを実装してみます。簡単のためにDBなどは使わずにオンメモリにデータを保存することにします。 ユーザデータの定義 まず、JSONで扱えるユーザデータを定義します。また、参照/作成/削除の関数も実装しておきます。 data User = User { uid :: Integer, name :: String, age :: Integer } deriving (Generic,

                                              HaskellとScottyで簡単にAPIを構築する - Qiita
                                            • 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
                                              • 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
                                                  • Haskell で Union-Find とクラスカルのアルゴリズム

                                                    Haskell で、優先度付きキューを使ったダイクストラ法 でダイクストラ法を実装したので、続けて最少全域木問題に取り組んでみようと思います。 最少全域木問題といえばクラスカルのアルゴリズムです。以下に詳しい解説があります。 最小全域木(クラスカル法とUnionFind) - アルゴリズム講習会 そして、確かずいぶん前に一度実装したような記憶が朧気ながらあって、検索してみたところ過去に自分が書いたブログがヒットしその日付は2009年でした。内容については全く覚えていませんでした。 クラスカルのアルゴリズム 気をとりなおしてクラスカルのアルゴリズムですが、このアルゴリズムは直感的には割と簡単というのが面白いところです。 グラフの辺の中から、重みが小さい順に辺を選んでいく。このとき選んだ辺によりグラフに閉路ができるならそれは選ばない。これだけで、最少全域木が構成される。 直感的には簡単ですが、

                                                      Haskell で Union-Find とクラスカルのアルゴリズム
                                                    • 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
                                                      • GitHub - google-research/dex-lang: Research language for array processing in the Haskell/ML family

                                                        A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

                                                          GitHub - google-research/dex-lang: Research language for array processing in the Haskell/ML family
                                                        • 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

                                                          • VSCodeでHaskell Language Serverが動かない(Windows 10) - Qiita

                                                            VSCodeでHaskell Language Serverを使い始める際にドハマリしたので日本語文献を残しておきます。 環境 Windows 10 VSCode 1.38.1 Haskell Language Server 0.0.28 Haskell IDE Engine 0.12.0.0 この記事の続き 起きたこと Haskell IDE Engineをインストールしたのち、VSCodeを起動して拡張機能Haskell Language Serverを導入したところ、エラーも何も出ず動かない。 原因 Haskell IDE Engineがstty.exeを必要としている。 確認方法 コマンドプロンプトで以下の表示が出る: 対策 C:¥Users¥[username]¥AppData¥Local¥Programs¥stack¥x86_64-windows¥msys-[XXX]¥usr¥

                                                              VSCodeでHaskell Language Serverが動かない(Windows 10) - Qiita
                                                            • Haskell 教養としての関数型プログラミング - 秀和システム あなたの学びをサポート!

                                                              Haskellは、情報や論理を扱う上で非常に優れた特徴を持つ、関数型プログラミング言語です。本書は、知的好奇心を持ち、新しい考え方を身につけたいプログラマのために、Haskellを使った関数型プログラミングを体験しながら学ぶ入門書です。「対話環境に値をうちこむ」「かんたんな計算をしてみる」のように、ひとつずつ試しながらステップアップしていくため、プログラミング未経験者でも関数型プログラミングが理解できます。 【サポートはこちら】→https://www.shuwasystem.co.jp/support/7980html/4806.html 第0部 はじめに 第 i 章 ようこそ i-1 プログラミングのいくつもの顔 i-2 あなたにはできる 第 ii 章 この本の楽しみかた ii-1 誰のための本か ii-2 前提とする知識・技術 ii-3 対象とするOS ii-4 はじめから順に ii

                                                                Haskell 教養としての関数型プログラミング - 秀和システム あなたの学びをサポート!
                                                              • Default exception handler in Haskell

                                                                Default exception handler in Haskell by Taylor Fausak on April 03, 2021 Have you ever wanted to install a default exception handler in Haskell? Until recently I didn’t think that was possible. Then I found Ivan Gromakovsky’s Handling of Uncaught Exceptions in Haskell blog post, which describes how to print exceptions using displayException rather than show. Ivan accomplishes that with a little kno

                                                                  Default exception handler in Haskell
                                                                • Haskellでちょっとしたスクリプトを書く

                                                                  Haskellで本格的に開発する際はcabalなりstackなりでプロジェクトを作るわけですが、ファイル一つで済むような(書き捨て)スクリプトをHaskellで書きたい場合があります。 依存関係のないスクリプトであれば、普通にファイルを作って runghc/runhaskell すれば良いでしょう。しかし、Haskellには標準ライブラリー(base)以外にも「準標準」と呼べる外部のライブラリーが多数あり(例:bytestring, text, vector)、それらに明示的に依存することは runghc ではできません。 そこで使えるのが、cabal scriptやstack scriptと呼ばれる機能です。 cabal script cabal run コマンドを使うと、ファイル中に {- cabal: 形式の特殊なコメントを含むHaskellコードをその場でビルドして実行することがで

                                                                    Haskellでちょっとしたスクリプトを書く
                                                                  • HaskellのEitherについて - Qiita

                                                                    HaskellのEitherモナドとそれに関連するData.Eitherの関数についてまとめました。この記事で使われているGHCのバージョンは8.8.3です。 Eitherとは Eitherとは、Haskellに標準で入っているモナド・型の1つです。GHCiで定義を見てみましょう。

                                                                      HaskellのEitherについて - Qiita
                                                                    • Oleg's gists - Compiling Haskell to JavaScript, not in the way you'd expect

                                                                      #Step 1: Template Haskell splices The [d| ... |] is a syntax of Template Haskell declaration quote. For example, [d| answer = 42 |] would produce a value of type Q Dec, which is an abstract syntax representation of it. Relatedly, the $(...) is splice syntax. As it appears on the top level, it splices declarations (of the type Q [Dec], or expressions of the type Q Exp depending on the context) into

                                                                      • Haskell2020 Is Dead, but All Hope Is Not Lost :: Reasonably Polymorphic

                                                                        Haskell2020 is the long-awaited sequel to Haskell2010 — a formal, prescriptive standard of the Haskell language, that all implementations should adhere to. Today we have two previous standards, Haskell2010 and Haskell98, but neither is particularly in-line with the language as it’s written in this day and age. The aim of Haskell2020 is to bring these older standards in line with the way the langua

                                                                        • GitHub - NorfairKing/sydtest: A modern testing framework for Haskell with good defaults and advanced testing features.

                                                                          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 - NorfairKing/sydtest: A modern testing framework for Haskell with good defaults and advanced testing features.
                                                                          • Go製のToolをHaskellで実装する - Qiita

                                                                            初めに 最近Haskellの学習としてGo製のToolをHaskellで実装するようにしています。 Haskellでなにかしら作りたいと考えていて、そういえばGo製のToolはよく作られているから面白そうなものありそうだなと思ったのがきっかけです。 mockサーバであるhttplabをHaskellで作ることにしました。 まだ100%の実装ができていないのですが、ある程度形ができたので記事を書くことにしました。 ソースコードはこちらにあります。 Haskellでbrickというライブラリを使っていますが、使い方等は以前書いた記事を参考してください GoもHaskellも至らぬところがあるので間違った箇所はアドバイスや助言をいただけると嬉しいです。 HaskellとGoもさほど違いがない箇所があったので、比較していきます。 引数のパース Goではpflagを使ってパースしています。 pfla

                                                                              Go製のToolをHaskellで実装する - Qiita
                                                                            • Splittable pseudo-random number generators in Haskell: random v1.1 and v1.2

                                                                              This can arise when you have different threads. But it’s of prime importance in a lazy language like Haskell, since it makes it possible to generate deterministic random numbers lazily. For instance, split is used in QuickCheck’s Gen monad. An easy implementation of split is to duplicate the current state. But, the two parallel sequences will not be independent: indeed they will be identical. A sl

                                                                                Splittable pseudo-random number generators in Haskell: random v1.1 and v1.2
                                                                              • Unrolling data with Backpack - Well-Typed: The Haskell Consultants

                                                                                A co-worker of mine had a random thought on IRC: Is data type “unrolling” a valid performance optimization? Used anywhere? Something like: data List a = Nil | Cons a {-# Unroll 10 #-} (List a) I thought, that sounds like the vec package I wrote. One module there uses the GADT definition data Vec (n :: Nat) a where VNil :: Vec 'Z a (:::) :: a -> Vec n a -> Vec ('S n) a which in some cases optimizes

                                                                                • AtCoder Beginners Selection を Haskell で

                                                                                  AtCoder は、オンラインで参加できるプログラミングコンテスト(競技プログラミング)のひとつです。 わたしも、この AtCoder に Haskell で参戦してみたいと思い、そのために必要そうなことがらを調べてみました。 まずは、AtCoder の入門用に選出された10個の過去問からなる AtCoder Beginners Selection (通称 ABS)を Haskell で書いていき、 その後、そこで用いた技術要素を紹介していくことにしたいと思います。 また、Haskell で競技プログラミングに参戦するにあたって心配していたのは、実行速度の問題と、 DP (Dynamic Programming) のように配列を更新しながら計算していく方法についてだったので、 それらについても少し触れます。