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.

Hoogle backend oddities with type families #806

Closed
@RyanGlScott

Description

@RyanGlScott

Take this file:

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where

import Data.Proxy

-- | 'F' docs
type family F
-- | 'D' docs
data family D

v :: Int
v = 42

-- | 'C' docs
class C a where
  -- | 'AT' docs
  type AT a
  type AT a = Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy)))))))))

And run haddock --hoogle --package-name=bug --package-version=0.0.0 Bug.hs, you'll get the following bug.txt file:

-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

@package bug
@version 0.0.0

module Bug

-- | <a>F</a> docs

-- | <a>D</a> docs
v :: Int

-- | <a>C</a> docs
class C a where {
    type family AT a;
    type AT a =
        Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy)))))))));
}

There are many things wrong here:

  1. Neither F nor D show up at all! This causes v to have a completely incorrect docstring associated with it.
  2. AT does show up, but it's missing its Haddocks.
  3. The default definition for AT spans multiple lines. According to @ndmitchell (in Search doesn't find top-level type families ndmitchell/hoogle#249 (comment)), this should never happen, as Hoogle is line-orientated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions