並び順

ブックマーク数

期間指定

  • から
  • まで

201 - 240 件 / 701件

新着順 人気順

haskellの検索結果201 - 240 件 / 701件

  • haskellでif文を使いたい

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

      haskellでif文を使いたい
    • 「Haskellのモナド完全に理解した」試験問題

      Haskellは勉強したけどモナドを本当に理解したって言えるのか自信がない… \そんな人向けの試験問題を作りました!/ これから実施する試験問題を、10問中8問正解すればあなたはHaskellのモナドを完全に理解しています。私が保証します! それではさっそく〜〜 第一問 まずは緊張をほぐしましょう。 Haskellの Monad は○○○○である ○○○○に当てはまるのは以下の選択肢のうちどれでしょう? 型 関数 型クラス 型シノニム 答え

        「Haskellのモナド完全に理解した」試験問題
      • とほほのHaskell入門 - とほほのWWW入門

        「ハスケル」と呼びます。 数学者・論理学者の Haskell Curry の名前に由来しています。 LISP, ML などの言語の影響を受けています。 関数型プログラミング言語 であり、特に 純粋関数型言語 に分類されます。 金融、セキュリティ、数学・科学解析、構文解析などの分野での利用例があります。 関数型プログラミングに慣れていない人にとっては、多少学習コストが高いようです。 遅延評価 を採用しており、式は記述されていても必要となるまで評価されません。 関数型言語ですが、モナド などを利用することにより、手続き型言語のような記述も可能です。 Haskell 1.0 (1990年)、Haskell 98 (1999年)、Haskell 2010 (2009年) などのバージョンがあります。 コンパイル型言語ですが、スクリプト言語の様にインタプリタで呼び出すこともできます。 処理系は、イン

        • Haskellで正格評価でループを回すには? - hiroki_f’s diary

          Haskellでは再帰的に定義された関数は遅延評価で計算される。 この遅延評価はHaskellの売りの一つであるが、これが時には仇となる。 たとえば、優雅な実装例で知られる次のフィボナッチ数の実装は遅く、メモリの消費量も多い。 fib n = fibs !! n fibs = 1:1:zipWith (+) fib (tail fib) これは、値が評価されるまで計算が待機してメモリが保持されつづけられることが原因だ。 これを解決するには、遅延評価ではなく正格評価で計算すれば良い。 Haskellの神話 - あどけない話 ではzipWithを正格化したzipWith’を定義して、計算を早くする例が提示されていた。 再帰でループを表現するのは、haskellならではの優雅な実装方法だけども、基本は遅延評価なので今あげた問題がついて回る。 例えば、C言語で old=init for (i=1;

            Haskellで正格評価でループを回すには? - hiroki_f’s diary
          • GitHub - graninas/The-Voids-Of-Haskell

            I often hear how happy Haskellers are because they have such a great and unique language. They must be proud of how the outer world respects this Haskell technical superiority, and how the language influences all the other languages. This is deserved for sure, and it’s definitely a reason for pride. But when it comes to the closer comparison with any other mainstream language, we see that not ever

              GitHub - graninas/The-Voids-Of-Haskell
            • Final tagless encodings have little to do with typeclasses – Foxhound Systems

              There’s a common misconception as to what final tagless, and more specifically, a final encoding is. A common claim I see is that final tagless means coding against typeclasses. The mtl library and code written in MTL style are raised as examples of final tagless. I would like to argue that what people are referring to as final tagless is in fact just coding against an interface and that the novel

                Final tagless encodings have little to do with typeclasses – Foxhound Systems
              • 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

                • Kowainik - Fix(ity) me

                  Overwhelmed by the huge number of custom operators in Haskell? Work with a popular library, but it looks overly intimidating due to the abundance of intricate-looking operators? For many Haskell engineers, these problems are real. Developers can experience massive anxiety, based solely on the fact that they need to deal with such API that throws a bunch of custom operators in their faces (we call

                    Kowainik - Fix(ity) me
                  • 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
                    • Shpadoinkle

                      Shpadoinkle does little work. The renderer is modular, so you can always benefit from the latest advances in virtual DOM rendering. Your Shpadoinkle code is high-level. You need not worry about low-level details, causality, or when DOM nodes get replaced.

                      • Oleg's gists - Do not default to HashMap

                        There are two widely used associative containers in Haskell: Map from containers HashMap from unordered-containers Map is using Ord (total order), and most operations are . HashMap is using Hashable (some hash), and most operations are . HashMap is obviously better! It depends. Sometimes HashMap is the only choice, for example when the keys are Unique which has Hashable instance but does not have

                        • Counterexamples in Type Systems - Counterexamples in Type Systems

                          collated by Stephen Dolan, with thanks to Andrej Bauer, Leo White and Jeremy Yallop

                          • Lensとは - Qiita

                            Lensとは、初級者Haskellerの苦い思い出 さあさあ、やって参りました。 Haskell何個目かの鬼門にして、素晴らしく便利なアイツ、Lensの時間です。 初級者HaskellerにとってのLensといえば、「これを知らなきゃ初級者Haskellerにもなれない」と突然突きつけられて、何かと思って蓋を開ければ地獄のような型が覗く、恐怖と畏怖の対象でしょう。 調べてみても、様々な言葉で説明されるLensは、いかにもつかみどころのないものに思えます。 Lensはgetterとsetterのペア 参考: Lensの仕組みがわかった#lensを自作してみる レンズは余状態余モナドの余代数だった type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t Control.Lens.Combinators#t:Lens よ

                              Lensとは - Qiita
                            • プログラング言語Idrisに入門させたい(v0.9)

                              これは筆者(κeen)がIdris Advent Calendar 2020に投稿した内容を土台とし、一冊の本になるように増補改訂を行なったものです。 本書では依存型のあるHaskellことIdrisについて紹介します。Idrisは純粋関数型言語であり構文もHaskellに似ていますが、大きな特徴として依存型があることが挙げられます。依存型があるとリストの長さを指定したり整数同士の割り算でゼロ除算が起きないことを保証したり、究極的には数学の証明をしたりもできます。また、依存型以外にもインタラクティブな開発環境を使った型駆動開発であったりElaborator Reflactionによるメタプログラミングだったりと注目に値する言語機能も揃っています。 総じてIdrisは非常に尖った言語です。作者がプログラミング言語理論の研究者ということもあり、かなり攻めた言語機能が入っています。依存型を搭載し

                                プログラング言語Idrisに入門させたい(v0.9)
                              • HaskellのCo/Yoneda型と米田の補題をきちんと繋げる - Qiita

                                概要 Haskell には Co/Yonda 型があり、圏論には米田の補題がある。両者の関連についての分かりやすい解説を見つけられなかったため、ここで米田の補題と Co/Yoneda 型をシームレスに繋ぐことを試みる。 圏論の基礎知識は仮定している。また Co/Yoneda 型は kan-extensions で定義されたものを参照している。 記法 圏論の記法は一般的なものを用いるが、Haskell コードとの比較のし易さのために、圏 $\mathcal C$ における対象 $A$ から対象 $B$ への射の集合 $\mathcal C (A,B)$ を $$ A\underset{\mathcal C}{\rightarrow}B $$ とも書くことにする。 米田の補題によると、圏 $\mathcal C$ とその対象 $A$ ならびに関手 $F:\mathcal C\rightarro

                                  HaskellのCo/Yoneda型と米田の補題をきちんと繋げる - Qiita
                                • 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

                                  • 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

                                    • 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
                                      • 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.
                                        • GitHub - ChrisPenner/slick: Static site generator built on Shake configured in Haskell

                                          Want to get started quickly? Check out the Slick site template! Slick is a static site generator written and configured using Haskell. It's the spiritual successor to my previous static-site generator project SitePipe; but is faster, simpler, and more easily used in combination with other tools. Slick provides a small set of tools and combinators for building static websites on top of the Shake bu

                                            GitHub - ChrisPenner/slick: Static site generator built on Shake configured in Haskell
                                          • An introduction to typeclass metaprogramming

                                            Typeclass metaprogramming is a powerful technique available to Haskell programmers to automatically generate term-level code from static type information. It has been used to great effect in several popular Haskell libraries (such as the servant ecosystem), and it is the core mechanism used to implement generic programming via GHC generics. Despite this, remarkably little material exists that expl

                                            • 新しいHaskellベースのWeb App Specification Languageがアルファ版でリリースされた

                                              Spring BootによるAPIバックエンド構築実践ガイド 第2版 何千人もの開発者が、InfoQのミニブック「Practical Guide to Building an API Back End with Spring Boot」から、Spring Bootを使ったREST API構築の基礎を学んだ。この本では、出版時に新しくリリースされたバージョンである Spring Boot 2 を使用している。しかし、Spring Boot3が最近リリースされ、重要な変...

                                                新しいHaskellベースのWeb App Specification Languageがアルファ版でリリースされた
                                              • Who still uses ReaderT

                                                Monad transformers are a pretty amazing skill in any haskellers tool set, and can be a pleasure to work with. However, after some experience digging around in the IHP codebase, which makes liberal use of the Implicit Parameters language extension, I've come to conclude that a monad stack with just a ReaderT can be simplified. This posts explores how. Our running example: the ol' env Consider we ar

                                                • GHCに初めてコントリビュートした/最近のGHC動向 | 雑記帳

                                                  事実上の標準デファクトスタンダードなHaskell処理系であるGHCに貢献するというのが去年掲げた目標だったが、それがようやく実現したので報告する。ついでに、最近のGHC開発状況についても簡単にまとめてみる。 「貢献」と言っても色々あって、バグ報告とかも立派な貢献なのだが、ここで目標としていたのは「書いたコードをGHC本体に取り込んでもらう」ことである。 一つ目:fromInteger :: Integer -> {Float,Double} 年末に書いた記事 Haskell/GHCでの浮動小数点数の扱い – Qiita にあるように、現行のGHCのfromIntegerは値の大きさによって丸め方法が違っている。それによってどういう問題が引き起こされるかというと、 import Numeric import Data.Word main = do putStrLn $ "literal :

                                                  • 協調型スケジューリング vs. 先取り型スケジューリング

                                                    この記事はCooperative vs. Preemptive: a quest to maximize concurrency powerの翻訳・意訳記事になっています。 動機 私のチームはJavaを多用しています。システムを構築するために、ウェブサーバやデータベースドライバなど、多くのものに、スレッドを介した同時実行機能を内蔵した、実績のあるオープンソースのJavaライブラリを使用しています。 また、ビジネス特有のロジックを実装する際には、Javaのスレッド化命令を利用して同時実行を実現しています。 しかし、時間が経つにつれ、パフォーマンスの問題が見えてきました。 Javaアプリには合計1万個のスレッドが実行されていたため、ホストのRAMをすべて占有してしまうサービスがありました。 64ビットのJVMのスレッドのスタックサイズが1024バイトであるため、スレッドが1万もあるとスタックだ

                                                      協調型スケジューリング vs. 先取り型スケジューリング
                                                    • 多相からプログラミング言語を見る - 趣味はデバッグ……

                                                      こんにちは。ホビー型システミストの岡本です。 最近 C++ の習得をしていて、なんとなく多相(polymorphism)の視点からいくつかのプログラミング言語をまとめてみようという気になったので書いてみます。 部分型多相(subtype polymorphism) クラスベースオブジェクト指向言語でよく使うのは部分型多相ですかね。 Java や C#・C++ にある、名称的部分型多相(nominal subtype polymorphism)はこんな感じ。次の例は Java です。 class A {} class B extends A {} public class Main { public static void main(string[] args) { A foo = new B(); } } 変数 foo は A 型だけど、型(クラス)B は A の部分型(サブクラス・派生ク

                                                        多相からプログラミング言語を見る - 趣味はデバッグ……
                                                      • 関数を組み合わせてシステムを組む「Haskell」。クセの強さがその魅力?〜エンジニアが語る技術愛 #01〜|ミクシル

                                                        ミクシィには、探究心溢れるエンジニアがたくさん在籍しています。 その探究心は業務で扱う技術にとどまらず、趣味で書いているプログラムだったり、個人的に研究している言語だったりと、自身の気になった技術への追求も留まることを知りません。 そこで、社内のエンジニアに“好きな技術”について、思う存分に語ってもらうシリーズを始めました。 ルールはこの通り。 ・業務で使っている技術でも、使われていない技術でもOK ・あくまでも個人的な見解で ・その技術のどこが面白いのか ・愛を込めて語り尽くしてもらう 第1回目は、「モンスターストライク(以下モンスト)」のサーバーエンジニアの松原に、関数型プログラミング言語「Haskell」についていったい何が面白いのか、どういうものなのか、好きなだけ語ってもらいました。 有名プログラミング言語のナレッジが通用しづらい独特な「Haskell」 ━━今日は好きな技術につい

                                                          関数を組み合わせてシステムを組む「Haskell」。クセの強さがその魅力?〜エンジニアが語る技術愛 #01〜|ミクシル
                                                        • Haskell base proposal: unifying vector-like types

                                                          Haskell base proposal: unifying vector-like types Published March 16, 2021 DISCUSSION I've opened up a Discourse thread to discuss this post. I'll likely respond to comments here and on Twitter, but I'd like to move towards using the more official discussion channels when possible. One of my greatest hopes for the Haskell Foundation is already beginning to be realized: better communication. I'm a

                                                            Haskell base proposal: unifying vector-like types
                                                          • 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

                                                            • モナドオリンピック1-トラック競技-

                                                              はじめに 最速のモナドを決めるモナドオリンピックを開催することになりました。 この大会では、各ライブラリの提供するモナドたちが 様々な競技(ベンチマーク)に挑戦します。 競技説明 今回は副作用のないシンプルなベンチマークで計算速度を測ります。 ベンチマーク おなじみのfibをつかいます。普通のfibは返り値が整数型ですが、次の理由から偶奇を表すブール値にしています。 Int型にするとReaderモナドやIdentityモナドで返り値がUnboxingされて有利になりすぎる。 Integer型にすると演算にかかる時間が無視できない xor :: Bool -> Bool -> Bool xor True x = not x xor False x = x fib :: Monad m => Int -> m Bool fib = go where go n | n <= 1 = pure $

                                                                モナドオリンピック1-トラック競技-
                                                              • ElixirとHaskellの根底にある同じもの、そして、Elixirが辿った道

                                                                本当のDXはSF的で未来志向、そしてサイバーパンク【from 総務省 ICT技術セミナー「自分ごとにするDX」】

                                                                  ElixirとHaskellの根底にある同じもの、そして、Elixirが辿った道
                                                                • Scalaを使っているプロジェクトにメンバーがジョインする時に勧めている資料まとめ | DevelopersIO

                                                                  はじめに 業務のメインプロジェクトではScalaを使うことが多く、チームに新しく加わったメンバーのオンボーディングではScala言語自体やライブラリ(主にtypelevel系)の資料を紹介する機会が少なくありません。毎回リンクのリストを作り、コメントを添えて共有するのですが、回数も増えてきたので記事にしてみることにしました。 Scala言語の入門 ScalaText 『Scala スケーラブルプログラミング』(第三版) 『Scala関数型デザイン&プログラミング ―Scalazコントリビューターによる関数型徹底ガイド』 1つ目のScalaTextは有名なドワンゴさんの研修資料が日本のScalaコミュニティに寄贈にされたものです。2つ目以降はScalaTextの冒頭でも言及がありますが、入門としては鉄板かなと思います。他のプログラミング言語を修得されているのであればScalaTextを一通り

                                                                    Scalaを使っているプロジェクトにメンバーがジョインする時に勧めている資料まとめ | DevelopersIO
                                                                  • はじめに|Rust入門

                                                                      はじめに|Rust入門
                                                                    • Tutorial: Cellular Automata And Comonads

                                                                      At the end of this blog post, you'll learn how to simulate and render pretty cellular automata such as these: and the really cool algebraic structure that these possess! They turn out to be the dual of a monad, known as a comonad. First, our magic incantations: {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-

                                                                        Tutorial: Cellular Automata And Comonads
                                                                      • 10年間使ってみて見えたHaskellの闇と光 - Qiita

                                                                        はじめに わたしがHaskellを使い始めてもうそろそろ10年目になります。(タイトルは多少サバを読んでいますね) これまで使ってきた感想をまとめます。 Haskellのつらいところ まずは愚痴らせてください。 コンパイルが遅い 依存モジュールはすべてソースコードからビルドする必要があります。(バイナリ形式のモジュールはありません) 最初のビルドに20分くらい待つのはザラです。 複雑な型システムをつかうと型推論や型レベル計算に時間がかかります。 高速なHaskellプログラムを書くためには多くの関数をインライン化する必要があります。最適化ビルドではインライン展開によってコードサイズが大きくなるので時間がかかります。 デバッグが難しい 公式のGHCiデバッガはありますが、今のところIDEから簡単に利用できるわけではないですし、コンパイル済みのライブラリはデバッグできないです。 近年スタックト

                                                                          10年間使ってみて見えたHaskellの闇と光 - Qiita
                                                                        • OSSへの貢献をさらに良い形にしたい | はてなで働く itchyny にアンケート [#13] - Hatena Developer Blog

                                                                          はてなで働くエンジニアにアンケートシリーズ第13回は、ブックマークチームのWebアプリケーションエンジニア、id:itchynyに話を聞きました。 はてなidはかぶらないように適当に付けた Haskellが得意な自分ならScalaも書けるだろうと思って チーム間で協力しながら新しいAPIの仕様を策定 TLとして、チーム横断での依頼の窓口にも 夕方から深夜にかけて頭が冴える より戦略的にOSSへ貢献する体制作りをしたい スプリントごとに常に方法を改善 実装力を活かして良いシステム構成にできた時に手応えが 意思決定の過程を書き残すのは重要なこと 意欲がある人はいくらでも学べる会社 はてなidはかぶらないように適当に付けた ── Q1. はてなidとその由来を教えてください id:itchyny (いちにぃ)です。本名ばれせず、かつかぶらないよう適当に付けたので、由来はありません。 Haskel

                                                                            OSSへの貢献をさらに良い形にしたい | はてなで働く itchyny にアンケート [#13] - Hatena Developer Blog
                                                                          • 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 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

                                                                                • Functorio

                                                                                  You might have heard people say that functional programming is more academic, and real engineering is done in imperative style. I’m going to show you that real engineering is functional, and I’m going to illustrate it using a computer game that is designed by engineers for engineers. It’s a simulation game called Factorio, in which you are given resources that you have to explore, build factories

                                                                                    Functorio