並び順

ブックマーク数

期間指定

  • から
  • まで

161 - 200 件 / 700件

新着順 人気順

haskellの検索結果161 - 200 件 / 700件

  • stack script も HLS に面倒見てほしい - Qiita

    Haskell Advent Calendar 2021, 7 日目の記事です。 はじめに - stack script はいいぞ Haskell を触り始めてだいぶ経ちますが、ようやく完全に理解した(分かってない)ので何かにつけて Haskell を使いたくなります。 しかしそうほいほいネタが出てくる程に発想が豊かなわけではありません。まさに「Twitterを巡回していてわかったHaskell初心者が躓きやすいポイント8つ」のうちの一つにはまってしまいそうになっていました。 そんな時、ちょっとしたスクリプトを Haskell で書いてみることに私は活路を見出しました。普段つい Bash や Python で書いちゃっているようなものを Haskell で書いちゃうわけです。そして Haskell ではそれが出来ます。stack script という便利なコマンドがあるのです。 ただ本記事

      stack script も HLS に面倒見てほしい - Qiita
    • Oath: 安全、高速、合成可能な並行処理 - モナドとわたしとコモナド

      TL;DR github.com 並行処理を簡潔かつ安全に記述できるライブラリを作った。ApplicativeDo拡張を使って、以下のようにoathの引数として与えたIOアクションを同時に実行し、結果を集める処理を書ける。いずれかが例外を投げた場合、残りをキャンセルするためリソースを漏らす心配がない。 evalOath $ do a <- oath $ ... b <- oath $ ... f a b 経緯 Haskellは並行処理が得意とされている。事実、軽量スレッド、MVar、STMといった処理系によるサポートが充実しており、HackageのConcurrencyカテゴリには235ものパッケージがあることからもユーザの関心の高さが窺える。 並行処理を実用する上では、単にスレッドをフォークするだけでなく、計算の結果を集める必要がある──Scalaなどで言うFutureに近いものがあると

        Oath: 安全、高速、合成可能な並行処理 - モナドとわたしとコモナド
      • Kernighanのトイ・マシン・シミュレータ

        Haskellで実装する関数的プログラミングのデモ

          Kernighanのトイ・マシン・シミュレータ
        • 仕事で使うHaskell

          TL;DR Haskellはいいぞ。ただ仕事で使うならビルド、デプロイ周辺は工夫する必要が色々出てくるぞ。 あ、nixもいいぞ。 はじめに Haskellを用いている会社HERPに転職してからそろそろ1年が経つので久しぶりに記事でも書いてみます。そういえばzennでは初投稿ですね。 最近はHERPでHaskellを書きつつシステム基盤整備みたいなことをやっています。あとマネージメントみたいなこともやってたりします。 僕の書いたHaskell microserviceは既に稼働して売り上げに貢献しています。 あ、HERPはHaskell FoundationのFunctorスポンサーになっています。スポンサーの名前が面白いですよね。 Haskellを仕事で使う感想 最高ですね。簡単便利十分速い保守楽拡張楽、という感じです。 並行プログラミングツールとしてstmが提供されているのがお気に入りで

            仕事で使うHaskell
          • 関数型はプログラミングスタイル

            「関数型プログラミングは関数型言語じゃないとできないんでしょ?」という質問をたまに受けます。答えは「いいえ」です。もちろん、言語のサポートはあれば越したことはないです。 そもそも命令型及び関数型はプログラミングスタイルです。そして、命令型と関数型の間は0/1ではなく、グラデーションがあります。 なので、関数型プログラミングは関数型言語以外でも使えますし、プログラムをよい設計へ導く考え方ですよ、というのがこの記事の主張です。コード例も交えて説明してみます。 関数型へのアプローチ ロジックを書くとき 可変の変数(var)を使わず、不変の変数(val)を使う 可変のオブジェクト(mutable)を使わず、不変のオブジェクト(immutable)を使う voidやUnitなどの戻り値のない関数は使わず、戻り値を返す(高階)関数を使う 関数を定義するとき 参照透明な関数を定義する 必ず意味のある戻り

              関数型はプログラミングスタイル
            • GitHub - serokell/haskell-with-utf8: Get your IO right on the first try

              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 - serokell/haskell-with-utf8: Get your IO right on the first try
              • 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
                • 関数型プログラミングの基礎 再帰のルールとパターンマッチング 最大公約数、ユークリッド互除法、剰余、mod関数、中間演算子、backquote - 計算機科学のブログ

                  入門Haskellプログラミング (Will Kurt(著)、株式会社クイープ(監修、翻訳)、翔泳社)のUNIT1(関数型プログラミングの基礎)、LESSON7(再帰のルールとパターンマッチング)、7.5(練習問題)Q7-2の解答を求めてみる。 コード myGCD :: Integral t => t -> t -> t myGCD a 0 = a myGCD a b = myGCD b $ a `mod` b main :: IO () main = do print $ myGCD 1 1 print $ myGCD 2 3 print $ myGCD 42 264

                  • UoPeopleでComparative Programming Languages(プログラミング言語比較論)を修了した - えんぴつぶろぐ

                    オンライン大学 University of the People でComparative Programming Languages (CS4402) を修了したのでその感想を書きます。 これまでのUoPeople関連の記事はこちら: UoPeople カテゴリーの記事一覧 - えんぴつぶろぐ はじめに プログラミング言語のパラダイムの変化を追いながら、命令型言語と非命令言語(関数型や論理型など)の特徴を学び比較を行うコースです。 各言語の歴史や特徴だけでなく、コンピューターシステムのアーキテクチャやコンパイルの仕組みなども触れるので、今までのCS系コースの総復習的な内容だと感じました。 #UoPeople プログラミング言語比較論(#CS2204)の感想。 言語の比較だけじゃなく今までのCS系コースの総復習的な内容だった。 ノイマンアーキテクチャ、チューリングチャーチ理論から始まるプロ

                      UoPeopleでComparative Programming Languages(プログラミング言語比較論)を修了した - えんぴつぶろぐ
                    • GHC 9.2の新機能と、GHCの動向2021

                      Haskell Day 2021で「GHCの動向2021」というタイトルで発表しました、mod_poppoです。この記事では、発表の補足としてGHC 9.2の新機能の紹介と、 Data.List の単相化に関する補足を行います。 Haskell Day 2021の動画と筆者のスライドは、それぞれ次のリンクから参照できます: Haskell Day 2021 - YouTube GHCの動向2021 「GHCの動向」のタイトル的な元ネタ(?)は、筆者が3月にブログに書いた GHCに初めてコントリビュートした/最近のGHC動向 です。時代遅れになった記述もあると思いますが、よかったら読んでみてください。 GHC 9.2の新機能 2021年10月29日に、待望のGHC 9.2.1がリリースされました。公式の変更点は 2.1. Version 9.2.1 — Glasgow Haskell Com

                        GHC 9.2の新機能と、GHCの動向2021
                      • Haskellのカレンダー | Advent Calendar 2021 - Qiita

                        プログラミング言語HaskellについてのAdvent Calendar Haskell関連の記事ならなんでも 記事はQiitaでも、自分のブログやgistなどに書いてリンクを貼ってもOKです! Haskell-jp Blog への寄稿も大歓迎です。 (寄稿方法はこちら) 去年のAdvent Calendar: https://qiita.com/advent-calendar/2020/haskell 予定日を過ぎても投稿がない場合、事前の通達なく他の方に代筆して頂きます。あらかじめご了承ください。 hask(_ _)eller edit_calendarHow to join the calendarYou can join the calendar by selecting an available date and registering the URL of the articl

                          Haskellのカレンダー | Advent Calendar 2021 - Qiita
                        • GHCのバックエンドについて | 雑記帳

                          先日リリースされたGHC 9.2.1で、64ビットArm(AArch64)向けのネイティブコード生成器(Native Code Generator; NCG)が実装された。これを機会にGHCのバックエンドについて簡単にまとめてみる。 概略 GHCでHaskellプログラムをコンパイルすると、いくつかの中間言語を経て最終的には機械語が出力される。 この工程の最後の部分を「バックエンド」と呼ぶ。 GHCには Native Code Generator (-fasm)LLVM backend (-fllvm)unregisterised via-C backend の3種類のバックエンドが存在する。このほか、バイトコードインタープリターと-fno-codeもデータ型的にはバックエンドの一種として扱われている。(参照:compiler/GHC/Driver/Backend.hs) Native C

                          • SPA Componentの推しディレクトリ構成について語る

                            こんにちは、よしこです。 この記事は 2020年に立ち上げたWebフロントエンド構成の振り返り の「Componentのディレクトリ構成」項の詳細記事です。単体でも読めますが、よければ元記事もあわせてどうぞ! この記事では、今わたしが 株式会社ナレッジワーク というスタートアップで開発・運用しているプロジェクトにおいてうまくいっていると感じているComponentのディレクトリ構成についてご紹介していきます。 ディレクトリ構成 Componentは src/components の中にまとめていて、その下に以下の4種類の分類ディレクトリを切っています。 src/components/page src/components/model src/components/ui src/components/functional 分類ディレクトリを考えるにあたって重視したポイントは以下。 新しくco

                              SPA Componentの推しディレクトリ構成について語る
                            • Tuning Haskell RTS for Kubernetes, Part 1

                              We’re running Haskell in production. We’ve told that story before. We are also running Haskell in production on Kubernetes, but we never talked about that. It was a long journey and it wasn’t all roses, so we’re going to share what we went through. TL;DRConfigure Haskell RTS settings: Match -N⟨x⟩ to your limits.cpuMatch -M⟨size⟩ to your limits.memoryYou can set them between +RTS ... -RTS arguments

                              • The "return a command" trick

                                This post illustrates a trick that I’ve taught a few times to minimize the “change surface” of a Haskell program. By “change surface” I mean the number of places Haskell code needs to be updated when adding a new feature. The motivation I’ll motivate the trick through the following example code for a simple REPL: import Control.Applicative ((<|>)) import Data.Void (Void) import Text.Megaparsec (Pa

                                • A Short Overview of Typed Template Haskell

                                  Welcome to our second post on Template Haskell! Today we will take a quick look at typed Template Haskell. This article assumes some familiarity with Template Haskell (TH) already. If this is your first journey with TH, then check out our introduction to Template Haskell first. For this article, we will be using GHC 8.10.4. However, we will also show the changes that are necessary so the code work

                                    A Short Overview of Typed Template Haskell
                                  • Walk around functional web frontend programming

                                    https://opt.connpass.com/event/222709/

                                      Walk around functional web frontend programming
                                    • Idris 2の数量的型が解決した問題、導入した問題 | κeenのHappy Hacκing Blog

                                      # Idris2の数量的型が解決した問題導入した問題 ---------------------- [第一回関数型プログラミング(仮)の会 - connpass](https://opt.connpass.com/event/222709/) === # About Me --------- ![κeenのアイコン](/images/kappa2_vest.png) * κeen * [@blackenedgold](https://twitter.com/blackenedgold) * GitHub: [KeenS](https://github.com/KeenS) * GitLab: [blackenedgold](https://gitlab.com/blackenedgold) * [Idein Inc.](https://idein.jp/)のエンジニア * Lisp, ML

                                      • Making LLVM GEP safer in Haskell

                                        In today's article, I will showcase how Haskell's typesystem can be used to simplify code generation and reduce the chance of bugs involving the LLVM getelementptr instruction. Intro to the GEP instruction LLVM as a compiler framework offers many different low-level instructions, one of which being the getelementptr instruction (commonly abbreviated as just "gep"). With gep, you can compute derive

                                          Making LLVM GEP safer in Haskell
                                        • Hedgehog will eat all your bugs

                                          Hedgehog automatically generates a comprehensive array of test cases, exercising your software in ways human testers would never imagine. Generate hundreds of test cases automatically, exposing even the most insidious of corner cases. Failures are automatically simplified, giving developers coherent, intelligible error messages.

                                          • 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
                                            • 世界のプログラミング言語(36) 純粋関数型言語Haskellは難しいが学ぶ価値がある言語

                                              Haskellは純粋関数型プログラミング言語です。本連載では既にLispやOCamlなどの関数型言語を紹介しましたが、Haskellは関数型言語の中でも特に人気の高い言語です。Stack Overflowの人気言語調査でも2020年は15位、2021年は22位と人気言語がひしめくなか健闘しています。Haskellは難しい言語としても有名ですが、その作法を学ぶならプログラマーの基礎体力の向上に役立つことでしょう。今回はHaskellを試してみよう。 HaskellのWebサイト Haskellとは Haskellは関数型プログラミング言語の一つです。 純粋関数型言語に分類されます。金融やセキュリティ、科学解析、プログラミング言語の開発などの分野で使われています。総じて信頼性が求められる分野の開発で採用されています。そのため、十分実用的な言語と言えます。 しかし、Haskellには「遅延評価」

                                                世界のプログラミング言語(36) 純粋関数型言語Haskellは難しいが学ぶ価値がある言語
                                              • CS SYD - JSON Vulnerability in Haskell's Aeson library

                                                This blogpost describes a DoS vulnerability in Haskell's aeson package. We have followed appropriate procedure for responsible disclosure but the problem was not fixed, so now we are releasing this to the public in the hope that it may still be fixed afterall. Disclaimer: This story is the result of a team effort at FP Complete in 2018. I have received explicit written permission to post it here.

                                                • Optics are monoids

                                                  This post documents my favorite lens trick of all time. Also, this trick works for any optics package based on van Laarhoven lenses, like lens-family-core or microlens. This post assumes some familiarity with lenses, so if you are new to lenses then you might want to first read: Control.Lens.Tutorial The title is slightly misleading and the precise statement is that Folds are Monoids, and all of t

                                                  • An Introduction to Type Level Programming

                                                    Posted on August 25, 2021 by Rebecca Skinner Prelude This blog post is a long-form article based on a talk I delivered at the haskell.love conference on 10 Sept 2021. Keep an eye out here and I will update this section with a link to the recording of the talk when it’s available. The original slides for this talk are available on github along with the complete source code for the examples used in

                                                      An Introduction to Type Level Programming
                                                    • How Dependent Haskell Can Improve Industry Projects

                                                      Dependent types are a hot topic in the Haskell community. Many voices advocate for adding dependent types to Haskell, and a lot of effort is being invested towards that end. At the same time, the sceptics raise various concerns, one being that dependent types are more of a research project than a tool applicable in industrial software development. That is, however, a false dichotomy. While depende

                                                        How Dependent Haskell Can Improve Industry Projects
                                                      • Levelsモナドを使った幅優先探索の仕組み

                                                        Haskellは関数型プログラミング言語と呼ばれますが、関数だけでなく型も重要な役割を担っています。アルゴリズムを考える時、手続きの最適化だけでなく、正しいデータ型を選択することがシンプルなアルゴリズムを導き、実装をコンパクトにできるというのはよくある話です。今回は非常に単純な型でありながら幅優先探索というアルゴリズムのエッセンスを詰め込んだ Levelsというデータ型 について紹介したいと思います。 ピタゴラス数を列挙する ピタゴラス数とはピタゴラスの定理における関係式 a^2 + b^2 = c^2 を満たす自然数の三つ組です。 Haskellのリストは遅延評価なので 全ての自然数の三つ組を列挙する 列挙した自然数の中から関係式を満たすものだけ抽出する という手順でピタゴラス数を列挙することを考えてみましょう。 実際この方法は有限な探索範囲ではうまく機能します。 pyth :: [(I

                                                          Levelsモナドを使った幅優先探索の仕組み
                                                        • Haskellのsomeを正格評価したら無限ループする話 - 星にゃーんのブログ

                                                          パーサコンビネータなんかでよく使う、 some と many という関数があります。それぞれ引数を1回以上/0回以上実行して結果のリストを返す関数で、これの単純な定義は some v = (:) <$> v <*> many v many v = some v <|> pure [] となります。 some は v : (many v) 、 many は some v または [] を返すイメージです。 パーサコンビネータでは、例えば英数字1文字以上の文字列をパースしたいとき some alphaNum と書いたりします。 面白いのは、一見とても自明に思えるこの定義は、遅延評価がないと無限ループしてしまう点です。 本当は v が失敗したら some v 自体が失敗してほしいところが、v が失敗するか否かに関わらず many v が実行されてしまいます。正格評価の気持ちで考えるとあたりまえで

                                                            Haskellのsomeを正格評価したら無限ループする話 - 星にゃーんのブログ
                                                          • SML#プロジェクト

                                                            SML#はオープンソースの関数型プログラミング言語です。Standard MLと互換性を保ちながら、C言語やデータベースとの連携など実用上重要な機能を備えています。詳しくは「SML#について」をご覧ください。 val puts = _import "puts" : string -> int fun f x = ignore (puts (#b x)) val _ = f {a = "Hi", b = "Hello"} val _ = f {b = "World", c = "SML#"} 最近のニュース SML#の教科書が出ました 2021年4月15日 「SML#で始める実践MLプログラミング」が発売されました。 もっと読む... GitHubへの移行が完了しました 2021年4月7日 SML#プロジェクトのGitHubへの移行が完了しました。 もっと読む... SML# 4.0.0 リ

                                                            • Elm at Rakuten | Rakuten Engineering Blog

                                                              In our team at Rakuten, we have been using Elm1 in production for almost two years now. This post is about our story, the lessons we learned, and our likes and dislikes. This post is quite long so if you prefer to see an overview, feel free to jump to the index. Everything started in the Berlin branch of Rakuten during the summer of 2017. We were maintaining a medium-size single-page application w

                                                                Elm at Rakuten | Rakuten Engineering Blog
                                                              • GitHub - luke-clifton/shh: Simple shell like scripting from Haskell

                                                                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 - luke-clifton/shh: Simple shell like scripting from Haskell
                                                                • 関数型プログラミングなんもわからん。を考えようと言うイベントを開きました。

                                                                  先日Connpassにて、関数型プログラミングなんもわからん。を考えようと言うイベントを開かせていただきました。 関数型プログラミングがわからない! と言う方達の疑問に対して、普段関数型プログラミング言語を使っているわかる人たちが回答をして行くと言うスタイルのイベントでした。関数型プログラミング言語と一口に行っても、Elm, Scala, Haskell, Clojure, Elixir, F#と様々な言語があり(これは今回参加した人たちの使っている言語で、関数型プログラミング言語の一部にしか過ぎません)何が正解かなどはわからない中での意見の集約といった形のため参考程度にご覧ください。結果イベントとしては様々な視点からの意見が聞けて満足という声が多かったです。私自身知らないことがたくさん知れて勉強になり楽しかったです。 イベントの内容は、Figma上で開けるFigJamファイルとして、公開

                                                                    関数型プログラミングなんもわからん。を考えようと言うイベントを開きました。
                                                                  • 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

                                                                    • カリー化と部分適用の使い所や使い分けについて

                                                                      Haskellは高い機能性をもった関数型プログラミング言語で、他の手続き型プログラミング言語では難しいとされている関数でも容易に行うことができます。強い静的型付け、遅延評価などに対応しています。

                                                                        カリー化と部分適用の使い所や使い分けについて
                                                                      • Hacker News folk wisdom on visual programming

                                                                        I’m a fairly frequent Hacker News lurker, especially when I have some other important task that I’m avoiding. I normally head to the Active page (lots of comments, good for procrastination) and pick a nice long discussion thread to browse. So over time I’ve ended up with a good sense of what topics come up a lot. “The Bay Area is too expensive.” “There are too many JavaScript frameworks.” “Bootcam

                                                                          Hacker News folk wisdom on visual programming
                                                                        • HMock: First Rate Mocks in Haskell

                                                                          At the end of Zurihac this year, I released a preview version of HMock, a new library for testing with mocks in Haskell. Let’s talk about what this is, why I wrote it, and how you can use it. A Toy ChatbotLet’s suppose I want to write a chatbot in Haskell. I might start with a few types, like so… newtype User = User String deriving (Eq, Show) data PermLevel = Guest | NormalUser | Admin deriving (E

                                                                            HMock: First Rate Mocks in Haskell
                                                                          • MorrowM's Blog

                                                                            instance Indexed [] where [] !? _ = Nothing (x:xs) !? n | n == 0 = Just x | n > 0 = xs !? (n - 1) | otherwise = Nothing instance Indexed Vector where (!?) = (V.!?) instance Indexed IntMap where (!?) = (IntMap.!?) But now, we decide that we also want to be able to index Maps as well. The issue is that we’ve already hard-coded the index type to be Int. Associated Type Families One way to allow arbit

                                                                              MorrowM's Blog
                                                                            • The tale of keepAlive# — The Glasgow Haskell Compiler

                                                                              bgamari - 2021-06-08 In GHC 9.0 we have reworked the primops used for guaranteeing heap object lifetime in the presence of off-heap references. The result is a new primop, keepAlive#, which largely replaces the venerable touch# operation. This post will give some background on touch#, describe the rationale for this change, discuss some of the alternatives that were evaluated on the way to this ne

                                                                              • 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 教養としての関数型プログラミング - 秀和システム あなたの学びをサポート!
                                                                                • Why I Support the Haskell Foundation

                                                                                  Last November at the Haskell eXchange conference, Simon Peyton Jones announced the Haskell Foundation. This can be understood as many things: an organization dedicated to the hard work of making Haskell more successful and useful, a touchpoint for different parts of the Haskell community to come together and cooperate, and a focus knob to direct general support (financial and otherwise) for the Ha

                                                                                    Why I Support the Haskell Foundation