Skip to content

Constraint tuple regression in HEAD

The following file works in GHC 7.10.1, but fails in HEAD:

{-# LANGUAGE ConstraintKinds #-}
module ConstraintKinds where

type ManyEq a
  = (Eq a
    ,Eq a
    ,Eq a
    ,Eq a
    ,Eq a
    ,Eq a
    ,Eq a
    ,Eq a
    ,Eq a -- Comment this line to make compilation succeed in HEAD
    )

The error that I get on HEAD is:

[1 of 1] Compiling ConstraintKinds  ( ConstraintKinds.hs, interpreted )

ConstraintKinds.hs:5:5: error:
    Can't find interface-file declaration for type constructor or class (%,,,,,,,,%)
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the type ‘(Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a, Eq a,
                  Eq a)’
    In the type declaration for ‘ManyEq’
Failed, modules loaded: none.

This is most likely due to ffc21506, which has set a limit on constraint tuples to size 8.

I think we should either:

  • increase the size limit on constraint tuples to be the same as normal tuples (62), or,
  • automatically nest constraint kinds beyond 8-tuples, or,
  • carefully document this limitation for the next release.

Note that I encountered this limitation in my own code that I and others actually use: http://hackage.haskell.org/package/clash-prelude-0.7.5/docs/src/CLaSH-Sized-Fixed.html#ENumSFixedC

Edited by darchon
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information