|
existantial types / attempt of using an unObj function/ no type in ghci: msg#00048lang.haskell.glasgow.bugs
My ghc version: Glasgow Haskell Compiler, Version 6.5.20060117, for Haskell 98, compiled by GHC version 6.5.20060117 load this into ghci module Main where class Table t where tableName :: t -> String data TableObj = forall f. (Table f) => TableObj { unObj::f } instance Table TableObj where tableName (TableObj t) = tableName t and do :t unObj result : marc@(none) ~/projects/haskell/HTTF/Font/TTF $ ghci -fglasgow-exts ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.5.20060117, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base-1.0 ... linking ... done. Prelude> :l Table.hs [1 of 1] Skipping Font.TTF.Table ( Table.hs, Table.o ) Ok, modules loaded: Font.TTF.Table. Prelude Font.TTF.Table> :t unObj <interactive>:1:0: Can't find interface-file declaration for TableObj 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 I got to this while trying to simplify from 1 to 1' which doesn't work of cause. 1,2 should only call the show and mappingFormat function of the Table class. data MappingObj=forall f. (Typeable f, Mapping f) => MappingObj f deriving (Typeable) instance Mapping MappingObj where mappingFormat (MappingObj mobj) = mappingFormat mobj -- 1 instance Show MappingObj where show (MappingObj obj) = show obj -- 2 instance Mapping MappingObj where mappingFormat = mappingFormat.unObj -- 1' instance Show MappingObj where show = show.unObj -- 2' unObj (MappingObj obj) = obj Wouldn't it be nice to just type this ? data MappingObj=forall f. (Typeable f, Mapping f) => MappingObj f deriving (Typeable, Table, Show) Marc PS: It's nice to see such a good error message!
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | HEAD: problems with suffix.mk for registerised hc-boot, Reilly Hayes |
|---|---|
| Next by Date: | HEAD: Problem with compat/cbits/unicode.c, Reilly Hayes |
| Previous by Thread: | HEAD: problems with suffix.mk for registerised hc-boot, Reilly Hayes |
| Next by Thread: | Re: existantial types / attempt of using an unObj function/ no type in ghci, Simon Marlow |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |