Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Haddock doesn't properly handle stripped classes in .hs-boot files #680

Closed

Description

@hvr

consider the following modules

module M1 where

import {-# SOURCE #-} M2 (C3)

class C1 a where
  m1 :: C3 b => b -> a -> a
module M2 where

class C2 a where
  m2 :: a -> Bool

class C2 a => C3 a where
  m3 :: a -> Bool
  m3 = m2
module M2 {- BOOT -} where

class C2 a

class C3 a
module M3 where

import M1
import M2

instance C1 Int where
  m1 b a = if m2 b then a else 0 

GHCi happily loads M3:

$ ghci M3.hs 
GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/hvr/.ghci
[1 of 4] Compiling M2[boot]         ( M2.hs-boot, interpreted )
[2 of 4] Compiling M1               ( M1.hs, interpreted )
[3 of 4] Compiling M2               ( M2.hs, interpreted )
[4 of 4] Compiling M3               ( M3.hs, interpreted )
Ok, 4 modules loaded.

However, haddock chokes:

$ haddock M3.hs 
Haddock coverage:
   0% (  0 /  2) in 'M1'
  Missing documentation for:
    Module header
    C1 (./M1.hs:5)
   0% (  0 /  3) in 'M2'
  Missing documentation for:
    Module header
    C2 (./M2.hs:3)
    C3 (./M2.hs:6)

M3.hs:7:15: error:
    • Could not deduce (C2 b) arising from a use of ‘m2’
      from the context: C3 b
        bound by the type signature for:
                   m1 :: forall b. C3 b => b -> Int -> Int
        at M3.hs:7:3-4
      Possible fix:
        add (C2 b) to the context of
          the type signature for:
            m1 :: forall b. C3 b => b -> Int -> Int
    • In the expression: m2 b
      In the expression: if m2 b then a else 0
      In an equation for ‘m1’: m1 b a = if m2 b then a else 0
  |
7 |   m1 b a = if m2 b then a else 0 
  |               ^^^^

Activity

  1. mpickering commented on Jul 13, 2023

    @mpickering
    Collaborator

    I think this was just a bug in --make mode to do with hs-boot files (which has subsequently been fixed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions