タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

flowtypeとhaskellに関するteppeisのブックマーク (1)

  • Phantom types with Flow

    Adapted from “Phantom type” Haskell Wiki A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition, e.g class Data<M> { value: string; constructor(value: string) { this.value = value } }Here Data is a phantom type, because the M parameter doesn’t appear in its implementation. Why? An example: validating user inputSay you have a use(input: str

    teppeis
    teppeis 2019/05/06
    Phantom Typeは未使用の型パラメータをフラグとしてバリデーション済などの情報を持たせるHaskell由来のテクニック
  • 1