Code from 2018-07-12 doesn't typecheck.

オープン
#59 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
haskell
領域
compilers

調査の方向性

レポートに示されている Mul の Pretty インスタンス付近の src/Lib.hs を開き、型検査エラーを再現してください。LANGUAGE pragma またはコードの変更が必要かどうかを調査してください。両方のオペランドについて、報告されたエラーなしにインスタンスの型検査が通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

The pretty instance for Mul:

instance (Pretty l, Pretty r) => Pretty (Mul l r) where
  pretty (Mul a b) = unwords [autoParens a, "*", autoParens b]
    where autoParens a@(Add _ _) = "(" ++ pretty a ++ ")"
               autoParens                   a = pretty a

Gives the following error:

    • Couldn't match expected type ‘Add l0 r0’ with actual type ‘l’
      ‘l’ is a rigid type variable bound by
        the instance declaration
        at /home/leif/Documents/type-level/src/Lib.hs:91:10-49
    • In the first argument of ‘autoParens’, namely ‘a’
      In the expression: autoParens a
      In the first argument of ‘unwords’, namely
        ‘[autoParens a, "*", autoParens b]’
    • Relevant bindings include
        a :: l (bound at /home/leif/Documents/type-level/src/Lib.hs:92:15)
        pretty :: Mul l r -> String
          (bound at /home/leif/Documents/type-level/src/Lib.hs:92:3)

And the same for autoParens b. I think I'm missing a LANGUAGE pragma somewhere that would prevent autoParens (Add _ _) from collapsing to Add l r -> String.

主要言語
Haskell
スター
18
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

haskell-servant/haskell-servant.github.io のほかの issue

haskell-servant/haskell-servant.github.io の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。