Ticket #2534 (closed bug: fixed)

Opened 5 years ago

Last modified 11 months ago

Odd probable cause given by type checker

Reported by: heatsink Owned by: simonpj
Priority: lowest Milestone: 7.6.1
Component: Compiler (Type checker) Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: typecheck/should_fail/T2534 Blocked By:
Blocking: Related Tickets:

Description

In the following code, a function has been applied to zero arguments, which the type checker suggests is too many.

Prelude> foldr (>>=) [] []

<interactive>:1:6:
    Occurs check: cannot construct the infinite type: b = a -> b
    Probable cause: `>>=' is applied to too many arguments
    In the first argument of `foldr', namely `(>>=)'
    In the expression: foldr (>>=) [] []

Change History

Changed 5 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.10 branch

Thanks for the example

Changed 5 years ago by simonpj

  • owner set to simonpj
  • milestone changed from 6.10 branch to 6.12 branch

I'm probably the right person to look at this, but not before 6.10.

Simon

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 3 years ago by igloo

  • milestone changed from 6.12 branch to 6.12.3

Changed 3 years ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.12.3 to 6.14.1

Changed 3 years ago by igloo

  • milestone changed from 7.0.1 to 7.0.2

Changed 2 years ago by igloo

  • milestone changed from 7.0.2 to 7.2.1

Changed 21 months ago by igloo

  • milestone changed from 7.2.1 to 7.4.1

Changed 16 months ago by igloo

  • priority changed from low to lowest
  • milestone changed from 7.4.1 to 7.6.1

Changed 11 months ago by guest

  • failure set to None/Unknown

7.4.1 gives

Prelude> foldr (>>=) [] []

<interactive>:2:13:
    Couldn't match expected type `a0 -> a0 -> b0'
                with actual type `[a1]'
    In the second argument of `foldr', namely `[]'
    In the expression: foldr (>>=) [] []
    In an equation for `it': it = foldr (>>=) [] []

I don't know whether the problem was fixed properly, but at least it does not manifest for this case.

Changed 11 months ago by simonpj

  • status changed from new to closed
  • testcase set to typecheck/should_fail/T2534
  • resolution set to fixed

The new constraint-solving type inference algorithm does indeed do a better job here. I'll a regression test and close.

Simon

Note: See TracTickets for help on using tickets.