existantial types / attempt of using an unObj function/ no type
in ghci
Simon Marlow
simonmarhaskell at gmail.com
Wed May 10 09:09:02 EDT 2006
Marc Weber wrote:
> 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
This can't be right. The code you gave above says "module Main", but
GHCi is loading "Font.TTF.Table", and also it says "Skipping" so there
is an .hi file lying around too.
Can you tell us how to reproduce the problem starting in an empty directory?
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list