Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2761 closed bug (invalid)

type checker bug

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.8.3
Keywords: Cc: sclv
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

This causes a type error:

    foo :: forall b. (b -> String, Int)
    foo = (const "hi", 0)
 
    bar :: (forall b. b -> String, Int)
    bar = foo

This should compile fine since the types are equivalent.

Change History (4)

comment:1 Changed 11 years ago by guest

Sorry about bad formatting before...

This produces a type error:

    foo :: forall b. (b -> String, Int)
    foo = (const "hi", 0)
 
    bar :: (forall b. b -> String, Int)
    bar = foo

But the types are equivalent.

comment:2 Changed 11 years ago by igloo

Description: modified (diff)
difficulty: Unknown

comment:3 Changed 11 years ago by igloo

Resolution: invalid
Status: newclosed

Thanks for the report! However, the types are not equivalent, e.g. this fails to typecheck:

foo :: forall b. (b -> String, Int)
foo = undefined

x :: (String, String)
x = case foo of
    (f, _) -> (f 'a', f True)

with:

    Couldn't match expected type `Char' against inferred type `Bool'
    In the first argument of `f', namely `True'
    In the expression: f True
    In the expression: (f 'a', f True)

but this does typecheck:

bar :: (forall b. b -> String, Int)
bar = undefined

x :: (String, String)
x = case bar of
    (f, _) -> (f 'a', f True)

(with -XImpredicativeTypes -XRank2Types)

comment:4 Changed 11 years ago by sclv

Cc: sclv added
Note: See TracTickets for help on using tickets.