[Haskell-cafe] ghc: Var/Type length mismatch message - what does it mean?

John Lask jvlask at hotmail.com
Mon Mar 30 22:56:51 EDT 2009


consider the following types (from the paper:
 "Stream Fusion From Lists to Streams to Nothing at All")

> data Stream a = forall s. Stream ( s ->(Step a s)) s

> data Step a s =
>   Done
>   | Yield a s
>   | Skip s

an instance of this data type is:

> stream0 :: Stream ()
> stream0 = Stream (\ s -> Yield () s) ()

now consider:

> data StreamM m a = forall s. StreamM ( s ->m (Step a s)) s

and the following instance:

> stream0IO :: StreamM IO ()
> stream0IO = StreamM (\ s -> return (Yield () s)) () 

loads ok, but as soon as we introduce the following constraint:

> data Monad m => StreamM' m a = forall s. StreamM' ( s ->m (Step a s)) s

> stream0IO' :: StreamM' IO ()
> stream0IO' = StreamM' (\ s -> return (Yield () s)) () 

we get the following message when we load into ghci (6.8.2)

Var/Type length mismatch:
    []
    [base:GHC.Base.(){(w) tc 40}]

is this a bug? if not, what is this message telling us ? 


More information about the Haskell-Cafe mailing list