Skip to content

New wording for error message around associated type families

In https://github.com/haskell/error-messages/issues/13, several of us converged on taking the existing error message

Assoc.hs:20:8: error:
    ‘Genome’ is not a (visible) associated type of class ‘Reproductive’
   |
20 |   type Genome a = (Strand a, Strand a)
   |        

and changing it to become

Assoc.hs:20:8: error:
    A default equation for `Genome` was found, but `Genome` has not been declared. 
    You can declare the associated type `Genome` by adding:
      type Genome a
    to the class `Reproductive` in addition to the default equation:
      type Genome a = (Strand a, Strand a)
   |
20 |   type Genome a = (Strand a, Strand a)
   |  

Input:

{-# LANGUAGE TypeFamilies #-}

class Reproductive a where

  -- | A sequence of genetic information for an agent.
  type Strand a

  -- | Full set (both strands) of genetic information for an organism.
  type Genome a = (Strand a, Strand a)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information