[Haskell] simulating dependent types; ghc/ghci discrepancy

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Wed Apr 14 19:41:53 EDT 2004


On Wed, Apr 14, 2004 at 06:29:38PM +0200, Tomasz Zielonka wrote:
> > 
> > Is it possible to unwrap an existential type in ghci?
> 
> For me this seems to be a bug in GHCi.
> I wonder if there a type in Haskell-with-extensions that could be
> assigned to x?

Probably GHCi could do the same as in this situation and report an
error:

*Exist> do Show' y <- return (Show' "QWrwer"); return y

<interactive>:1:
    Inferred type is less polymorphic than expected
        Quantified type variable `a' escapes
    When checking an existential match that binds
        y :: a
    The pattern(s) have type(s): Show'
    The body has type: m a
    In a 'do' expression: Show' y <- return (Show' "QWrwer")
    In the definition of `it':
        it = do
               Show' y <- return (Show' "QWrwer")
               return y

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links


More information about the Haskell mailing list