Ticket #2761 (closed bug: invalid)

Opened 5 years ago

Last modified 5 years ago

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: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

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

Changed 5 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.

Changed 5 years ago by igloo

  • difficulty set to Unknown
  • description modified (diff)

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to invalid

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)

Changed 5 years ago by sclv

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