並び順

ブックマーク数

期間指定

  • から
  • まで

281 - 320 件 / 413件

新着順 人気順

haskellの検索結果281 - 320 件 / 413件

  • 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
    • 関数型まつりに行きました - Imaginantia

      2025.fp-matsuri.org 行ってきました。何やらみなさんブログを書いているみたいなので折角なので書いておこうと思います。 きっかけは最近ちょこちょこお話 (?) している Kory さんが何やら喋るということで。特に言語作ろうとしていたところなので (言語ランタイムどうしようか悩んでいたので) ちょうど良い話が聴けそうで、というところでした。 ちなみに私は…最近はすっかり VRChat 周辺に居ますが、元々 Haskell/Agda ユーザーで、CWM とか HoTT book とか (一人で寂しく) 読んでた人なので (そういえば名札には「直観主義」って書いていました)、まぁ関数型の話であれば (?) 色々面白そうな話が聴けそうという気持ちでした。本当か? ふと考えてみると、具体的な言語のカンファだとするとむしろ行って無さそうで…それは特に私が言語非依存な「概念」のほうが好

        関数型まつりに行きました - Imaginantia
      • Try.do for recoverable errors in Haskell

        UPDATE 2021-01-02: I have since written a GHC compiler plugin to implement an alternative ?-based syntax for early return. I prefer that one than use of Try.do, because it doesn’t require any type magic or special instances, and the ? is more readable. UPDATE: I’ve added a follow-up post to this here, where I address some criticisms of this post. The first half of this post is here. Please read th

        • lambda is not a four letter word - Fuzzing me wrong — How QuickCheck destroyed my favourite theory

          Fuzzing me wrong — How QuickCheck destroyed my favourite theory Introduction Quite a while back I wrote a larger article on the algebraic foundation of software patterns which also covered the MapReduce algorithm. During the research digged out a paper on algebraic properties of distributed big data analytics, which explained that a MapReduce will always work correctly when the intermediate data s

          • Leaving Haskell behind

            For almost a complete decade—starting with discovering Haskell in about 2009 and right up until switching to a job where I used primarily Ruby and C++ in about 2019—I would have called myself first and foremost a Haskell programmer. Not necessarily a dogmatic Haskeller! I was—and still am—proudly a polyglot who bounces between languages depending on the needs of the project. However, Haskell was m

              Leaving Haskell behind
            • 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

              • linear-base makes writing Linear Haskell easy and fun

                We’re announcing linear-base, a standard library for Linear Haskell programs. Our release accompanies the release of GHC 9.0 which supports -XLinearTypes. Linear base has been written by Bhavik Mehta, a former Tweag intern, Arnaud Spiwack, and ourselves. In the spirit of a standard library, linear-base is not a strict replica of base with linearly-typed variants of all the facilities in base. Inst

                  linear-base makes writing Linear Haskell easy and fun
                • Generalized Dijkstra in Haskell

                  This years’ Advent of Code has loads of 2D grids, and makes you traverse them all to find paths of various kinds. At some point I had to implement Dijkstra’s algorithm, in Haskell. In trying to make my implementation reusable for the following days, I realized that Dijkstra’s algorithm is actually way more general than I remembered (or was taught)! In short, weights don’t have to be real-valued! I

                  • GitHub - IHaskell/learn-you-a-haskell-notebook: Jupyter adaptation of Learn You a Haskell for Great Good!

                    Read the book right now on mybinder.org with this link: (Usually takes a minute to launch) This is a Jupyter notebook adaptation of the book Learn You a Haskell for Great Good! by Miran Lipovača. I learned Haskell from this book in 2014 by following along in GHCI, as the book suggested. In 2019, the Jupyter notebook format would be a nice way read this book. This is one of the best cases for Theod

                      GitHub - IHaskell/learn-you-a-haskell-notebook: Jupyter adaptation of Learn You a Haskell for Great Good!
                    • How does Prettyprinter print pretty?

                      >>> pretty $ Let [("x", 3), ("y", 5)] (Var "x" * Var "y") -- if it fits into a single line: let {x = 3; y = 5} in x * y -- otherwise: let x = 3 y = 5 in x * y Fancy! But a bit magical. What do the group and align functions do exactly? The core trick First let us summarize our goal. We want alternative layouts: The newline version is narrow but long, the flat version is short but wide. The layoutin

                      • Unifying Structured Recursion Schemes

                        Unifying Structured Recursion Schemes Ralf Hinze Nicolas Wu Jeremy Gibbons Department of Computer Science, University of Oxford, Wolfson Building, Parks Road, Oxford, OX1 3QD, England {ralf.hinze,nicolas.wu,jeremy.gibbons}@cs.ox.ac.uk Abstract Folds over inductive datatypes are well understood and widely used. In their plain form, they are quite restricted; but many dis- parate generalisations hav

                        • haskellでif文を使いたい

                          2つの引数の数字を比較して大きい方をx小さい方をyに入れて返すという関数をhaskellのif文で実装したいと考えています。引数1つのサンプルを参考にして下記を作成したのですが else temp=x x=y y=temp ---------- ^ Failed, no modules loaded. temp=xで上記のようなエラーが出ます. おそらく書き方が間違えていると予想しているのですが、どこが間違えているかわかりません。教えてください。 haskell

                            haskellでif文を使いたい
                          • 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関連で知ってよかったこと - あどけない話
                            • 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. Dismiss alert

                                GitHub - serokell/haskell-with-utf8: Get your IO right on the first try
                              • カリー化と部分適用の使い所や使い分けについて

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

                                  カリー化と部分適用の使い所や使い分けについて
                                • Compiling a subset of JavaScript to ARM assembly in Haskell - Micah Cantor

                                  A toy compiler for a subset of JavaScript to ARM assembly, using Haskell. Published: May 29, 2022 I recently got a copy of the book Compiling to Assembly from Scratch by Vladamir Keleshev, which details how to write a compiler for a subset of JavaScript to 32-bit ARM assembly code. The choice to use ARM assembly is mainly for its simplicity in comparison to x86. Keleshev elects to use TypeScript t

                                    Compiling a subset of JavaScript to ARM assembly in Haskell - Micah Cantor
                                  • What I have learned from 15 years of functional programming

                                    Like most people, I started my career by learning object-oriented programming, but for the last 15 years I have been doing functional programming. In this talk, I'll explain why learning functional programming has completely changed the way I design and write my programs. I believe that, thanks to functional programming, my code is easier to understand, less buggy, and more testable. To demonstrat

                                      What I have learned from 15 years of functional programming
                                    • Pipesライブラリ 超図解 - Qiita

                                      Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

                                        Pipesライブラリ 超図解 - Qiita
                                      • GitHub - digitallyinduced/ihp: 🔥 The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness

                                        IHP is a modern batteries-included haskell web framework, built on top of Haskell and Nix. We believe that functional programing is the future of software development and want to make functional programing with haskell and nix available to anyone. We try to offer a solution which can be used by developers who have not worked with haskell yet. IHP comes with everything you need to build great web a

                                          GitHub - digitallyinduced/ihp: 🔥 The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness
                                        • 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

                                          • HaskellでもDirectX12したい! - Qiita

                                            描けた! pic.twitter.com/3h0Jtmlw7U — 🌌S.Percentage🙀 (@Pctg_x8) September 15, 2020 リポジトリはこちら: https://github.com/Pctg-x8/haskell-d3d12-test HaskellのFFI 今回はDirectX12に主軸をおいた記事ではないため、DirectX12の初期化の方法などは解説しません。他の記事をご参照ください。 Haskellも実用的なプログラミング言語の例に漏れず、C言語など他の言語とのインターフェイス(FFI)の仕組みを持っています。 Haskellのそれはかなり「低レベル」かつ「なんでもあり」な感じになっています。 HaskellのFFIの詳細については他の記事を参照してもらうとして、大雑把には以下のような形でインターフェイスが提供されています。 基本データ型 F

                                              HaskellでもDirectX12したい! - Qiita
                                            • 関数型プログラミング~Phantom type(幽霊型)ってなんだろう~ - Qiita

                                              Haskellのコードでしばしば見かける幽霊型について。 Phantom type(幽霊型)の特徴 左辺で定義した型変数が右辺に全く現れない型 具体的な値に興味はなく、型の情報さえあれば十分な時などに使われる 型の情報だけでやりたいことを実現するため、型レベルプログラミングの一種と捉えられる Pantaom type(幽霊型)の例 例として、次のようなものを考えます。 時刻の「分」と「時間」を区別できる型を作りたい ただし、「分」・「時間」を表す値の型は同一の型としたい 時刻に関する計算の処理も同一のものとしたい 時刻を保持する型を定義 まず、時刻を保持する型を定義します。 -- 型変数unitは右辺に現れないので幽霊型と呼ぶ newtype Time unit = Time Int deriving (Num, Show) ここで注目すべきは、型変数の'unit'が右辺で使用されていない

                                                関数型プログラミング~Phantom type(幽霊型)ってなんだろう~ - Qiita
                                              • Parsing With Haskell (Part 1): Lexing With Alex

                                                This is the first of the two parts of our Parsing with Haskell series. Looking for the second part instead? You can find it here. This two-part tutorial will look into two tools often used together by Haskellers to parse programs: Alex and Happy. We’ll use them to parse a small programming language from scratch. Both Alex and Happy are industrial-strength tools powerful enough to parse even Haskel

                                                  Parsing With Haskell (Part 1): Lexing With Alex
                                                • Optics and Kleisli arrows

                                                  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

                                                    Optics and Kleisli arrows
                                                  • Create a Windows installer for your Haskell project · PatchGirl

                                                    Create a Windows installer for your Haskell projectIn this blog post, I’ll try to explain how you can create a really simple installer for your Haskell software on Windows and how to deal with external dependencies. IntroductionAlright, let’s get started. We are going to build a simple installer. It will install a desktop shortcut as well as a link shortcut in the start menu. We will be using Stac

                                                    • 米田の補題、Free theorem と病的な Haskell の関数 - Qiita

                                                      Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

                                                        米田の補題、Free theorem と病的な Haskell の関数 - Qiita
                                                      • Writer Monadで気軽にMonad則を破る - Haskell-jp

                                                        Tweet 🎅この記事は、Haskell Advent Calendar 2020 25日目の記事です。 🎄Happy Christmas!!🎄 今回は先日(といっても元の質問の投稿からもう何ヶ月も経ってしまいましたが…)StackOverflowに上がったこちら👇の質問に対する回答の、続きっぽい話を書こうと思います。長いし、質問の回答からスコープが大きく外れてしまうので記事にしました。 haskell - モナド則を崩してしまう例が知りたい - スタック・オーバーフロー MonadとMonoidにある重要な繋がりを説明した後、それを応用したWriter MonadがどうMonoidを使ってMonad則を満たしているのか証明します。そして、Writerのそうした性質を用いて簡単にMonad則を破る例を紹介することで、読者のみなさんがMonad則のみならずdo記法やMonadそのもの

                                                          Writer Monadで気軽にMonad則を破る - Haskell-jp
                                                        • Introduction to Free Monads

                                                          If you’ve been around Haskell circles for a bit, you’ve probably seen the term “free monads”. This article introduces free monads and explain why they are useful in Haskell development. To whet your appetite a little, free monads are basically a way to easily get a generic pure Monad instance for any Functor. This can be rather useful in many cases when you’re dealing with tree-like structures, bu

                                                            Introduction to Free Monads
                                                          • GitHub - wasp-lang/wasp: The fastest way to develop full-stack web apps with React & Node.js.

                                                            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 - wasp-lang/wasp: The fastest way to develop full-stack web apps with React & Node.js.
                                                            • Dynamic Exception Reporting in Haskell

                                                              Exceptions kind of suck in Haskell. You don’t get a stack trace. They don’t show up in the types of functions. They incorporate a subtyping mechanism that feels more like Java casting than typical Haskell programming. A partial solution to the problem is HasCallStack - that gives us a CallStack which gets attached to error calls. However, it only gets attached to error - so you can either have Str

                                                              • Haskellで競プロ鉄則本を解いていく

                                                                Haskellで書籍『競技プログラミングの鉄則』を解いていく本

                                                                  Haskellで競プロ鉄則本を解いていく
                                                                • Learn just enough about linear types

                                                                  By Artyom Kazak aka @availablegreen December 25, 2020 🧱 This post is written in Brick — a platform for writing pretty public notes, which I co-founded. If you try it out, I'd love to hear feedback on Twitter or at artyom@brick.do. IntroLinear types are coming to GHC. For a brief moment in time, everyone will feel like they are Haskell beginners again. This is a rare opportunity. After reading thi

                                                                  • Icicle Lang - Traversals as Optimisations

                                                                    Using traversals and a simple fixpoint monad, we can efficiently crunch Icicle expressions to a minimal, efficient kernel. This speeds up downstream compilation, reduces generated code size, and makes our queries run faster. Icicle is a high level language. The source language has mode polymorphism for error handling and runtime staging, type inference, function abstractions, and syntactic sugar t

                                                                    • 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.

                                                                      • ormolu-action

                                                                        へいしゃでは、ソースコードのフォーマッターに Ormolu を利用しています。 インデント時のスペース数すらカスタマイズ不可なので好き嫌いが分かれるところですが、プロジェクト全体のコードを統一しておくとコードレビューの際にも有用なので入れています。 ちなみにスペース幅を4にしたくてフォークされた fourmolu というフォーマッターもあります。現在ではスペース数以外の設定もできるみたいです。 どちらも hls から利用可能なので、興味がある人は試してみると良いと思います。 また、ormolu のフォーマット結果で末尾カンマが気に入らない場合は google/ormolu の gfork ブランチを使ってみると良いかもしれません (フォーマット結果)。fourmolu も Add option for leading commas (and expand test suite) #17 で

                                                                        • Announcing Ema - Static Sites in Haskell

                                                                          tldr: Announcing Ema, a new static site generator in Haskell with hot reload destined to develop an unique kind of apps. This post mostly goes over the background of choosing to create it. A little over a year ago I created the rib static site generator in Haskell based on Shake and ghcid. The idea was to be able to write a more intuitive (so no Makefile-like rules) set of instructions for buildin

                                                                          • Study Haskell 2025

                                                                            久しぶりに(10年ぶりに?)Haskell書きたくなったので環境構築していく。 TS がふわふわ言語仕様過ぎて、AIに好きに書かせると崩壊する。コンパイルの難易度が高くても型の表現力が高いHaskellでどこまでやれるかをテストしたい。 (今回 Rust でないのは、システムレベルではない意味論抽象に主にフォーカスしたいから。 具体的には Extensible Effects を使いたい) 初手でこういうプロンプトを書いた。 私は haskell のエキスパートで、ユーザーに haskell の使い方を教えながらコードを書きます。 ユーザーは TypeScript のエキスパートで、多少のRustの知識があります。Haskell は初心者です。 このプロジェクトは最新の cabal でセットアップされています。 stack を使わず、 cabal のみを使ってビルドと依存関係の管理を行いま

                                                                              Study Haskell 2025
                                                                            • safe-exceptions の仕組みとその限界

                                                                              この記事を書いている時点での最新バージョン: ghc-9.4.3 safe-exceptions-0.1.7.3 safe-exceptionsパッケージについて書かれている記事はいくつかありますが、その仕組みや限界について書かれている日本語記事はない様なので書いてみます。 safe-exceptionsの動機 Haskellでは例外のためのsyntaxは存在していません。例外用の特別なprimitive operations(raise#, catch#等)が存在し、そのwrapper関数がbaseパッケージ(Control.Exceptionモジュール)に用意されているため、ユーザーはそれを用います。 raise# catch# Control.Exception しかしこのControl.Exceptionには問題がありました。同期例外と非同期例外の区別がなされていないことです。 同

                                                                                safe-exceptions の仕組みとその限界
                                                                              • GitHub - augustss/MicroHs: Haskell implemented with combinators

                                                                                There are two different ways to compile MicroHs: Using GHC. Makefile target bin/gmhs Using the included combinator file and runtime. Makefile target bin/mhs These different ways of compiling need slightly different imports etc. This happens by GHC looking in the ghc/ subdirectory first for any extras/overrides. Compiling MicroHs is really best done using make, but there is also a MicroHs.cabal fil

                                                                                  GitHub - augustss/MicroHs: Haskell implemented with combinators
                                                                                • 関数型プログラミングの基礎 再帰のルールとパターンマッチング 最大公約数、ユークリッド互除法、剰余、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

                                                                                  新着記事