#2187: Top-level bindings are broken for polymorphic values
------------------------+---------------------------------------------------
    Reporter:  yallop   |       Owner:          
        Type:  bug      |      Status:  new     
    Priority:  normal   |   Component:  Compiler
     Version:  6.8.2    |    Severity:  major   
    Keywords:           |    Testcase:          
Architecture:  Unknown  |          Os:  Unknown 
------------------------+---------------------------------------------------
 Top-level pattern bindings don't work for polymorphic values.  Here's an
 example program:

 {{{
     [x] = [id]
 }}}

 ghci gives this the type

 {{{
    *Main> :t x
    x :: GHC.Prim.Any -> GHC.Prim.Any
 }}}

 which can't be used

 {{{
    *Main>  x ()

    <interactive>:1:2:
    Couldn't match expected type `GHC.Prim.Any'
           against inferred type `()'
    In the first argument of `x', namely `()'
    In the expression: x ()
    In the definition of `it': it = x ()
 }}}

 Adding a type signature doesn't help:

 {{{
    x :: a -> a
    [x] = [id]

    Couldn't match expected type `forall a. a -> a'
           against inferred type `a -> a'
    Probable cause: `id' is applied to too few arguments
    In the expression: id
    In the expression: [id]
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2187>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to