Changes between Initial Version and Version 2 of Ticket #1716


Ignore:
Timestamp:
Oct 16, 2007 3:39:54 PM (7 years ago)
Author:
simonpj
Comment:

Thanks for the report. I'm not certain what the original problem is, but there's a definite bug that show s up when compiling Port.hs on the way to reproducing the bug.

Below is a stand-alone cut-down version that gives a Core Lint error as a result of bogus evidence generation arising from type equalites. I'm changing the milestone to 6.10 (since we are not advertising type equalities for 6.8), and changing the owner to Manuel.

Simon

{-# OPTIONS  -fglasgow-exts #-}
{-# LANGUAGE UndecidableInstances #-}
module Graphics.UI.Grapefruit.Port ( ) where

---------------------------------------
    -- * Type equality
    type family TypeEq type1 type2 :: *

    typeEq :: type1 -> type2 -> TypeEq type1 type2
    typeEq _ _ = undefined

    class Singleton singleton where
        soleValue :: singleton

    class Boolean boolean

    data False

    instance Boolean False

    false :: False
    false = undefined

    data True

    instance Boolean True

    true :: True
    true = undefined

    data headName :& tail = !(Field headName) :& !tail
    infixr 1 :&

    data Field name = !name := Value name
    infix 2 :=

    -- * Names
    class (Singleton name) => Name name where
        type Value name :: *


---------------------------------------
    -- ** Isolation
    class Isolatable record lookupName where
        type Remainder record lookupName :: *

        isolate :: record -> lookupName -> (Field lookupName,Remainder record lookupName)

    instance (IsolatableHelper (TypeEq headName lookupName) headName tail lookupName) =>
             Isolatable (headName :& tail) lookupName where
        type Remainder (headName :& tail) lookupName
            = RemainderHelper (TypeEq headName lookupName) headName tail lookupName

        isolate (headField@(headName := _) :& tail) lookupName
            = isolateHelper (typeEq headName lookupName) headField tail lookupName

    class IsolatableHelper namesAreEqual headName tail lookupName where
        type RemainderHelper namesAreEqual headName tail lookupName :: *

	foo :: tail
        isolateHelper :: namesAreEqual
                      -> Field headName
                      -> tail
                      -> lookupName
                      -> (Field lookupName,RemainderHelper namesAreEqual headName tail lookupName)

    -- On error use lookupName and add (headName ~ lookupName) to the context.
    instance (headName ~ lookupName) =>
             IsolatableHelper True headName tail lookupName where
        type RemainderHelper True headName tail lookupName = tail

        isolateHelper _ headField tail _ = (headField,tail)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1716

    • Property Owner set to chak
    • Property Milestone changed from 6.8.1 to 6.10 branch
  • Ticket #1716 – Description

    initial v2  
    1 To reproduce this bug please install GHC 6.8.20070916 and Gtk2Hs 0.9.12 as currently described on http://haskell.org/haskellwiki/Grapefruit#Building.  There is a modified version of the development version of Grapefruit attached.  Sorry for this large code example but currently I really don’t have the time to reduce this any further. 
     1'''See the reply from Simon''' which gives a simple stand-alone repro case for this bug. 
     2 
     3Original report: To reproduce this bug please install GHC 6.8.20070916 and Gtk2Hs 0.9.12 as currently described on http://haskell.org/haskellwiki/Grapefruit#Building.  There is a modified version of the development version of Grapefruit attached.  Sorry for this large code example but currently I really don’t have the time to reduce this any further. 
    24 
    35Please unpack the attached file {{{bug.tar.bz2}}}, enter the directory {{{bug/Haskell}}} and run {{{ghci -cpp -farrows -fth -fglasgow-exts Examples/Simple.hs}}}.  Compilation to bytecode should be successful.  Then enter {{{main}}} on the GHCi command line.  You should get the following messages: