Ticket #7727 (new bug)

Opened 4 months ago

Last modified 2 months ago

Nonsense evaluation: sequence [] = []

Reported by: drb226 Owned by: igloo
Priority: normal Milestone: 7.8.1
Component: GHCi Version: 7.6.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

$ ghci-7.6.2
GHCi, version 7.6.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
>>> sequence []
[]
>>> :t it
it :: [()]
>>> sequence [] :: [()]

<interactive>:4:1:
    Couldn't match type `[a0]' with `()'
    Expected type: [()]
      Actual type: [[a0]]
    In the return type of a call of `sequence'
    In the expression: sequence [] :: [()]
    In an equation for `it': it = sequence [] :: [()]

Wat. Where on earth did ghci get the idea that sequence [] = [] ?

Change History

Changed 4 months ago by igloo

  • difficulty set to Unknown
  • component changed from Compiler to GHCi

It's doing this:

Prelude> sequence [] :: IO [()]
[]

We do document this (http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/interactive-evaluation.html) but perhaps we should be clearer about precisely how statements are typechecked and executed at the GHCi prompt.

Changed 2 months ago by igloo

  • owner set to igloo
  • milestone set to 7.8.1
Note: See TracTickets for help on using tickets.