並び順

ブックマーク数

期間指定

  • から
  • まで

281 - 320 件 / 700件

新着順 人気順

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

  • ユースケース層が投げうるエラーの型を「量化した open union」にしておけば複数のユースケースを合成したときに上の層でエラーハンドリングが楽にできて最高です! - ryota-ka's blog

    この記事は以下のページに移転しました. blog.ryota-ka.me この記事は Haskell Advent Calendar 2020 20日目の記事です. TL; DR タイトル 問題設定 ユースケース層とサーバ層が存在する Web アプリケーションを考える.サーバ層はユースケース層を呼び出すことができるが,ユースケース層はサーバ層について無知でなければならない. +----------------+ | server layer | +-------+--------+ | depends on +-------v--------+ | use case layer | +----------------+ このようなアプリケーションのAPI リクエストハンドラにおいて,複数のユースケースを合成して呼び出すケースを例に挙げ,それぞれのユースケースが投げうるエラーをうまく扱う o

      ユースケース層が投げうるエラーの型を「量化した open union」にしておけば複数のユースケースを合成したときに上の層でエラーハンドリングが楽にできて最高です! - ryota-ka's blog
    • 動的配列の無難なHaskell実装 - モナドとわたしとコモナド

      qiita.com C++、Rust、Pythonなど、他の言語では当たり前のように多用される動的配列だが、Haskell実装は(開発を始めた時点では)見当たらなかったので作ってみたお話*1。 動的配列とはミュータブルな配列の一種で、通常の配列操作だけでなく、末尾への要素の追加・削除が定数時間で行える構造である。確保しておいた領域がいっぱいになったら、その2倍の大きさの領域を確保するという方法によって、漸近的には要素の追加は定数時間となる。 内部の配列には、デファクトスタンダードであるvectorパッケージを用いる。Vectorには無印(boxed)、Unboxed、Storableの三種類の変種があり、それぞれ以下のように使い分ける。 無印(Data.Vector): サンク含め、任意のHaskellのオブジェクトを格納できる。Traversableなどのインスタンスであり、汎用性が高い

        動的配列の無難なHaskell実装 - モナドとわたしとコモナド
      • 【これからiOS頑張りたい方向け】2年半iOSアプリ開発をしてハッとした瞬間まとめ - Qiita

        はじめに iOS Advent Calendar 2020 17日目です。 2年半くらいiOSアプリ開発してきてハッとした瞬間をまとめました。(iOSとかswiftに限った話じゃない学びもあるけど。) がんばらなくても読めるけど、なんとなく勉強にもなる記事を目指しました。 タイトルに近い方が初歩的なやつです。 もし時間あればみていただけると嬉しいです。 お品書き 返り値でBoolを返す時はそのBool自身を返せばいい 三項演算子を使うとif else がワンライナーで書ける var +=は計算型プロパティにできる。 ネストは早期returnで減らせる 2重否定はifでいい。 型が明確な時のinitializerは.initに省略できる trailing closureは引数から省略できる enumとswitchを組み合わせて網羅性をチェックする Bool値が複数ある場合の場合分けはswit

          【これからiOS頑張りたい方向け】2年半iOSアプリ開発をしてハッとした瞬間まとめ - Qiita
        • Kowainik - Foo to Bar: Naming Conventions in Haskell

          Developers spend most of their time reading code, understanding it and exploring other ways to use existing solutions. Frankly, in our profession, there is very little time on actually writing new libraries and creating new interfaces in real-life development. So it is quite important to have some help in the most common activities. Naming conventions is one such thing that improves readability an

            Kowainik - Foo to Bar: Naming Conventions in Haskell
          • Android むけ Haskell コンパイラをリリースしました!

            4 年まえに「Haskell コンパイラを書こう!」 という記事で紹介した自作コンパイラを、いよいよリリースしますというお話です。 その記事で述べた通り、Haskell 2010 仕様を満たし、かつ、FFI をサポートしたら Version 1 にしようと思っているのですが、まだそこまで至っていないため、 今回は 0.9.0 版としてリリースします。 Bunny は、Android 上で動くアプリケーションの作成をターゲットとした Haskell コンパイラです。このコンパイラを作成するにあたって、基礎的な部分を「最新コンパイラ構成技法」という本で勉強したので、 その本の通称である Tiger Book にちなんで Bunny という名前にしました。 Bunny は、Haskell で書かれた Haskell コンパイラです。Haskell プログラムをソースコードとし、オブジェクトコード

            • とりとめのない GHC 線形型メモ - 趣味はデバッグ……

              GHC 9.0.1 alpha 1 がリリースされたときに線形型をいじってみていたことをメモしていなかったので思い出しながらメモしていく。 mail.haskell.org 使用バージョン GHC 9.0.0.20200925 上記リンクのもの ghcup ならそれ経由でインストールできる。 ghcups の場合は手動インストール後、下記のような設定ファイルで切り替えができるようになる1。 ghc: 9.0.1-alpha1: H:\programs\ghc-9.0.0.20200925-x86_64-unknown-mingw32\bin 線形型とは GHC では引数が1回しか使えない(1回は使わないといけない)関数型として線形型が実装されている。 一般の関数: 線形型の関数: 線形型の GHC プロポーザルはこちら。 github.com は Haskell 文法としては a %1 -

                とりとめのない GHC 線形型メモ - 趣味はデバッグ……
              • GitHub - matsumonkie/izuna: Show Haskell type annotations when doing code review on Github

                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 - matsumonkie/izuna: Show Haskell type annotations when doing code review on Github
                • Applicative Computation Expressions

                  この記事は、F# Advent Calendar 2020の7日目の記事です。初日の記事であるF# 5.0の新機能でも触れられていますが、 コンピュテーション式でApplicativeな計算を扱えるようにして、より効率的にコンピュテーション式の処理をチューニングすることができる Applicative Computation Expressions について、少しだけ掘り下げてみようと思います。 Optionモナドのコンピュテーション式 まず、手ごろなサンプルとしてOptionモナドのコンピュテーション式の挙動をみてみましょう。 type OptionBuilder1 () = member __.Bind(x, f) = printfn "%s" $"{nameof(OptionBuilder1)}:Bind x:{x}" Option.bind f x member __.Return

                    Applicative Computation Expressions
                  • LLVM の Kaleidoscope を育てながら作る - Qiita

                    この記事は言語実装 Advent Calendar 2020 3日目の記事です。前回は sisshiki1969 さんの「ruruby: RustでつくっているRuby」、次回は yharaさんの「Shiika進捗」です。 趣旨 LLVM を使って小さな言語を実装してみます。 方針としては、最小限の機能の言語から出発して動くものを少しづつ大きくしていきます。ゴールは LLVM 公式のチュートリアルである Kaleidoscope の序盤相当の部分で、次のプログラムが動くことを目標とします。 def fib(n) if n < 3 then 1 else fib(n-1) + fib(n-2); fib(10) #=> 55 想定する読者 LLVM や LLVM IR がどういうものか何となく知っている Haskell がなんとなく分かる ただしコードにはコメントを入れて、LLVM IR や

                      LLVM の Kaleidoscope を育てながら作る - Qiita
                    • Haskell Stack プロジェクトを Bazel でビルドしてみる

                      仕事では Bazel を使ってビルドすることが多くなり,自分でも Bazel ルールを自作するようになったので,実験も兼ねて趣味の Haskell Stack プロジェクトを Bazel を使ってビルドしてみることにしました. 本記事はそのメモ書きです. あとこれは Haskell Advent Calendar 2020 の2日目の記事です. Bazel Bazel は Google のエンジニアが中心になって開発している OSS のビルドツールだ. 以下のような特徴がある: 必要なコマンドのインストール・バイナリのビルド・コマンドの実行などを記述できる それらは全て専用のサンドボックス内で実行されるため再現性が高い Starlark という Python 風な独自言語で記述する キャッシュなどが工夫されており二度目以降のビルドが高速になりやすい 依存関係を明確に記述する必要がある また

                      • A Modern Compiler for the French Tax Code

                        In France, income tax is computed from taxpayers' individual returns, using an algorithm that is authored, designed and maintained by the French Public Finances Directorate (DGFiP). This algorithm relies on a legacy custom language and compiler originally designed in 1990, which unlike French wine, did not age well with time. Owing to the shortcomings of the input language and the technical limita

                        • 経験5年のHaskellユーザがScalaを仕事で半年使ってみた

                          haskell-scala-java ちょっと前までScalaを書いていたので、 Haskell好きな人がScalaを書いた感想を書きます。 タイトルは経験15年のOCaml ユーザーが Haskell を仕事で半年使ってみた - camlspotter’s blogの模倣です。 あくまで1ユーザの感想です。 Scalaに慣れてしまうと違和感を忘れてしまうと思ったので、当時箇条書きで雑にメモしていたものを参照して書いています。 逆にScala使いがHaskellを知るメモに役立つかもしれません。 Haskell歴 when: 2013年から知って学び始めましたが、本格的に使い始めたのは2015年からで、5年ほど使っています where: どの言語を使っても良くて新しい言語を学ぶ必要がなければ基本的にHaskellを使っています what: 趣味OSSプロジェクトの大半 現在一番スターもらっ

                            経験5年のHaskellユーザがScalaを仕事で半年使ってみた
                          • Pure destination-passing style in Linear Haskell

                            My goal today is to convince you that destination-passing style is neat, actually. And that linear types make destination-passing purely functional. But first, I must answer a question. What is destination-passing style? If you’ve ever programmed in C, C++, or Fortran, you are sure to have encountered the style of programming which sometimes goes by the name destination-passing style. It is the pr

                              Pure destination-passing style in Linear Haskell
                            • 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.
                              • Wasp

                                app todoApp { title: "ToDo App", // visible in the browser tab auth: { // full-stack auth out-of-the-box userEntity: User, methods: { google: {}, gitHub: {}, email: {...} } } } route RootRoute { path: "/", to: MainPage } page MainPage { authRequired: true, // Limit access to logged in users. component: import Main from "@client/Main.tsx" // Your React code. } query getTasks { fn: import { getTasks

                                  Wasp
                                • 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
                                  • Real World Haskell — Monday Morning Haskell

                                    Real World HaskellA lot of people think day-to-day tasks like running a web app are difficult or impossible in Haskell! But of course this isn't true! In our Real World Haskell series, we'll take you through a whole slew of libraries that allow you to write a web backend. These libraries use Haskell's features to approach things like database queries and API building in unique ways. Part 1: Databa

                                      Real World Haskell — Monday Morning Haskell
                                    • Why Dark didn't choose Rust

                                      Welcome again HN! Dark is a programming language, structured editor, and infrastructure—all in one—whose goal is to make it 100x easier to build backend services. Check out the website, our What is Dark post, and How Dark deploys in 50ms for more. Thanks for checking us out! This is the third or a 3-part series: Leaving OCaml and Dark's new backend will be in F#. You can enjoy this without reading

                                        Why Dark didn't choose Rust
                                      • Haskell Foundation

                                        An independent, non-profit organization dedicated to broadening the adoption of Haskell, by supporting its ecosystem of tools, libraries, education, and research. Stackage Handover Completed I’m happy to announce the completion of the handover of Stackage.org to the Haskell Foundation. Thanks to FP Complete’s effort and dedication, Stack and Stackage have been part of the Haskell community for ten

                                        • Pipesライブラリ 超図解 - Qiita

                                          data Proxy a' a b' b m r = Request a' (a -> Proxy a' a b' b m r ) | Respond b (b' -> Proxy a' a b' b m r ) | M (m (Proxy a' a b' b m r)) | Pure r (+>>) :: (Monad m) => (b' -> Proxy a' a b' b m r) -> Proxy b' b c' c m r -> Proxy a' a c' c m r fb' +>> p = case p of Request b' fb -> fb' b' >>~ fb Respond c fc' -> Respond c (\c' -> fb' +>> fc' c') M m -> M (m >>= \p' -> return (fb' +>> p')) Pure r ->

                                            Pipesライブラリ 超図解 - Qiita
                                          • Names are not type safety

                                            Haskell programmers spend a lot of time talking about type safety. The Haskell school of program construction advocates “capturing invariants in the type system” and “making illegal states unrepresentable,” both of which sound like compelling goals, but are rather vague on the techniques used to achieve them. Almost exactly one year ago, I published Parse, Don’t Validate as an initial stab towards

                                            • Composable filters using Witherable optics

                                              One of my favourite things about Haskell is that its structures and abstractions are very principled, and they have laws dictating correct behaviour. In my experience, this means that when you find a new way to piece together those abstractions it almost always ends up doing something reasonable... or at the very least interesting! As it turns out, optics have a lot of different "slots" where we c

                                                Composable filters using Witherable optics
                                              • オンラインカジノ道しるべ

                                                オンラインカジノは、その多様なギャンブル体験と手軽なアクセス性により、多くの人々に愛されています。しかし、愛されている一方で、オンラインカジノは資金と個人情報の取り扱いに関わるため、適切な管理が欠かせません。その管理を規制し、監査を行うのが、オンラインカジノの運営ライセンスです。 運営ライセンスは、ギャンブルサイトが法的に運営され、プレイヤーに安全な環境を提供することを保証するものです。運営ライセンスの重要性、信頼性の高いライセンス発行国、そしてプレイヤーが注意すべき運営ライセンスについて説明し、オンラインカジノを選ぶ際の注意事項を説明していきます。 運営ライセンスは、オンラインカジノが正規の事業として運営できるようにする許可証です。このライセンスは、各国の政府や特定の発行機関によって発行され、厳格な審査を経て取得されます。ライセンスを持つオンラインカジノは、以下の点について規制と監査を受

                                                  オンラインカジノ道しるべ
                                                • 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

                                                  • 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
                                                    • #88: A History of Haskell: being lazy with class

                                                      Haskell の長い歴史を向井が辿ります。感想などはハッシュタグ #misreading か hello@misreading.chat にお寄せください。iTunes のレビューや星も歓迎です。 A History of Haskell: being lazy with class – Microsoft ResearchHaskell LanguageHome — The Glasgow Haskell Compilerhttps://www.haskell.org/onlinereport/haskell2010/Changes since Haskell ’98

                                                        #88: A History of Haskell: being lazy with class
                                                      • Windows10 HomeでDocker + VSCodeによるhaskellの環境構築 - Qiita

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

                                                          Windows10 HomeでDocker + VSCodeによるhaskellの環境構築 - Qiita
                                                        • Making GHCIDE smarter and faster: a fellowship summary

                                                          As a Tweag Open Source fellow, I aimed to improve and build on the Haskell IDE experience, mainly by contributing to the ghcide and haskell-language-server projects. My main goals were to polish up the overall experience, and integrate hiedb, a product of a Summer of Code project last year, into ghcide. The product of this fellowship was a good selection of ghcide and haskell-language-server featu

                                                            Making GHCIDE smarter and faster: a fellowship summary
                                                          • Robot - a fast 1kB functional library for creating Finite State Machines

                                                            Fast 1kB functional library for creating Finite State Machines # Robot Getting Started Why Finite State Machines With Robot you can build finite state machines in a simple and flexible way. import { createMachine, state, transition } from 'robot3'; const machine = createMachine({ inactive: state( transition('toggle', 'active') ), active: state( transition('toggle', 'inactive') ) }); export default

                                                            • 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
                                                              • ベクトルからリストを作る方法 〜次数付きモナドのカン拡張〜

                                                                ベクトルとリスト 要素を並べたデータ構造を考える時、 ベクトルは長さが予め(型レベルで)決められたもの リストは任意の長さを取れるもの と区別することがあります。 Haskellの型で表すと、

                                                                  ベクトルからリストを作る方法 〜次数付きモナドのカン拡張〜
                                                                • 自動printfデバッグ - モナドとわたしとコモナド

                                                                  関数をデバッグするために、引数と戻り値をそれぞれ表示するというのを誰しもやったことがあると思う。今回はそれを自動化するからくりをHaskellで実装してみる。 目標となるのは、関数が与えられたとき、その引数と結果をターミナルに出力する関数に変換する高階関数、probe :: Traceable a => String -> a -> aである。 testDelay :: Double -> Double -> IO () testDelay dur dur' = threadDelay $ round $ (dur + dur') * 1000000 *Probe> probe "testDelay" testDelay 1 2 testDelay 1.0 2.0: () これは型クラスを活用すればお茶の子さいさいである。以下のように型によって挙動を切り替える関数withTraceData

                                                                    自動printfデバッグ - モナドとわたしとコモナド
                                                                  • リスト内包表記 - Wikipedia

                                                                    リスト内包表記とは、一部のプログラミング言語で使用可能な構文構造であり、既存のリストから新たなリストを作成するために用いられるものである。 これは、 map関数やfilter関数などとは異なり、数学における集合内包表記 (en:Set-builder notation) に準拠したものである。 概要[編集] 次の集合内包表記の例を考える。 あるいは この表記は、「は、が自然数の集合 () の元であり、かつの二乗がより大きいようなすべての『の2倍』なる数」を意味する。 最小の自然数x=1は、条件x2>3を満たさない(12>3は偽)ため、2・1はSに含まれない。次の自然数2は、条件を満たす(22>3)。他のすべての自然数も同様である。 したがって、xは 2, 3, 4, 5... で構成される。集合Sは「xの2倍」なるすべての数値で構成されるため、S = {4, 6, 8, 10...} で与

                                                                    • The Cubix Framework

                                                                      Building a Programming Tool? Build for 5 languages at once -- | Inserts "blocksCovered[n] = true" printouts for test-coverage -- at every basic block -- -- Runs on C, Java, JavaScript, Lua, and Python instrumentTestCoverage :: forall fs l. (CanInstrument fs) => ProgInfo fs -> TermLab fs l -> Annotater (TermLab fs l) instrumentTestCoverage progInfo t = performCfgInsertions @(StatSort fs) progInfo $

                                                                      • Generalizing 'jq' and Traversal Systems using optics and standard monads

                                                                        Hi folks! Today I'll be chatting about Traversal Systems like jq and XPath; we're going to discover which properties make them useful, then see how we can replicate their most useful behaviours in Haskell using (almost entirely) pre-ols!existing standard Haskell tools! Let's go! What's a Traversal System? First off I'll admit that "Traversal System" is a name I just came up with, you probably won'

                                                                        • 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
                                                                          • Haskellの子供たち

                                                                            Owenのブログより。 もし、私が4年前にタイムスリップして、昔の自分にHaskellが輝きを失い始めていると言ったら、私はそれを信じないでしょう。私はHaskellで育ち、カテゴリ理論への欲求はHaskellによって刺激され、私の最大のプログラミング・プロジェクトはHaskellであり、Haskellを使った会社で働くのが夢でした。 しかし今では、以前ほどHaskellに興奮していないことに気が付きました。何が変わったのでしょうか? いくつか要因があると思います。主な要因の1つは、Haskellが本当に得意としているプログラミングの種類だと思います。つまり、抽象的で正しいインタフェースを作ることは、私にとって興味のあるタイプのプログラミングではないと言うことです。キャリアとしてソフトウェアに携わりたいと思ったとき、自分を繰り返さないようにする素晴らしい機能を持った言語はとても役に立ちまし

                                                                            • 随伴を使って理解するStateモナドの実装

                                                                              前回の記事は魔法のように見えるStateモナドの実装も、順を追って見ていけば理解することは難しくないという話でした。 しかし状態の変更を順番に処理するというような手続き的な考え方にかなり近い構造が、うまくモナドになってくれるというのは少し不思議ですよね。 この記事では タプル (a, b) 関数 a -> b カリー化 curry :: ((a, b) -> c) -> a -> b -> c uncurry :: (a -> b -> c) -> (a, b) -> c といったHaskellの基本的な要素が随伴と呼ばれる関係を構成することを見て、 その随伴からStateモナドが導かれることを説明していきたいと思います。 随伴 二つの圏 C, D と二つの関手 F : C \rightarrow D, G : D \rightarrow C が与えられたとしましょう。 もし GF = {

                                                                                随伴を使って理解するStateモナドの実装
                                                                              • jaspervdj - Lazy Sort: Counting Comparisons

                                                                                How good is Haskell's lazy sort actually? Published on September 17, 2020 under the tag haskell Haskell’s laziness allows you to do many cool things. I’ve talked about searching an infinite graph before. Another commonly mentioned example is finding the smallest N items in a list. Because programmers are lazy as well, this is often defined as: This happens regardless of the language of choice if w

                                                                                • Developing QUIC Loss Detection and Congestion Control in Haskell - あどけない話

                                                                                  For last two months, I have been trying to implement "QUIC Loss Detection and Congestion Control" in Haskell. This blog article describes a brief summary on what I have done. ACK handling Before loss detection and congestion control were developed, QUIC packets were retransmitted, if necessary, by a simple resender lightweight thread based on timeout. The internal data structure was, of course, Pr

                                                                                    Developing QUIC Loss Detection and Congestion Control in Haskell - あどけない話