Online demo Types bring order to code. For example, if a variable i:usize then we know i is a number that can be used to index a vector. Similarly, if v:vec<&str> then we can be sure that v is a collection of strings which may be indexed but of course, not used as an index. However, by itself usize doesn’t tell us how big or small the number and hence the programmer must still rely on their own wi
SoRの性質が強いBtoBアプリケーションでは、「堅く」作ることを求められる箇所がしばしばあります。 Scalaの型安全性が頼もしく感じられるのは、まさにこのような箇所においてです。 「堅く」作るために、私たちがいま注目しているのが refined と newtype というライブラリです。 この記事では、refinedとnewtypeを使ってScalaの型安全性をさらに引き出すテクニックを紹介します。 Value Class / Tagged Type refined + newtypeの話題に入る前に、これまでにどのようなテクニックが使われてきたかを簡単に振り返りましょう。 ここに、SNSのユーザーアカウントを表現するクラスがあります。 case class User(id: String, email: String, age: Int) val user1 = User("@tod
自分の tweets.zip をみてたら発掘された文章. Dependent Types (依存型) と Refinement Types (篩型) は目指すところは似ているが, 導入スタイルに根本的な違いがある. TL;DR Refinement types は (Curry-style typing のように) extrinsic で, Dependent types は (Church-style typing のように) intrinsic である. 前提 一般に, プログラム言語への型の導入スタイルには Curry-style と Church-style の2種類がある. Curry-style: 型付けは 既に存在する項を 分類するもの Church-style: 項が存在するとは 型付けされているということ 前者は動的型付き言語での型アノテーションなどが当てはまり, 型アノ
The key to scalable program synthesis is modular verification, which enables pruning inviable candidates for each component of the target program independently. In this talk I will present Synquid: a synthesizer that takes advantage of the modularity offered by refinement type checking to efficiently generate recursive functional programs that satisfy a given specification in the form of a refinem
Programming with Refinement Types Ranjit Jhala (University of California, San Diego) Well-Typed Programs Can Go Wrong Division By Zero λ> let average xs = sum xs `div` length xs λ> average [100, 202, 300] 2 λ> average [] *** Exception: divide by zero Missing Keys λ> :m +Data.Map λ> let m = fromList [ ("haskell" , "lazy") , ("javascript" , "eager")] λ> m ! "haskell" "lazy" λ> m ! "clojure" "*** Exc
Have you ever looked for a numeric type with a zero to hundred range to describe percentage? Maybe a zero to one to describe a proper fraction of something? A positive integer (without the zero) to enumerate something? A vector of a specific length? Here that comes and not only with the Haskell refinement types library (on GitHub, on Hackage)! The problem The “refined” library Why do we need all t
Programming with Refinement Types An Introduction to LiquidHaskell Ranjit Jhala, Eric Seidel, Niki Vazou [PDF] 1.Introduction {#intro} 1.1. Well-Typed Programs Do Go Wrong {#gowrong} 1.2. Refinement Types 1.3. Audience 1.4. Getting Started 2.Logic & SMT 2.1. Syntax 2.2. Semantics {#semantics} 2.3. Verification Conditions 2.4. Examples: Propositions 2.5. Examples: Arithmetic 2.6. Examples: Uninterp
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く