Haskell. Why is :info (:) returns the definition twice?
Asked Answered
A

1

12

I'm new to haskell.

If I type in GHCi (7.10.3):

:info (:)

I get result:

*** Parser:
data [] a = ... | a : [a]   -- Defined in ‘GHC.Types’
infixr 5 :

data [] a = ... | a : [a]   -- Defined in ‘GHC.Types’
infixr 5 :

Does it means that operator is defined twice? I didn't find any suspicious things in the source =/

Amice answered 7/3, 2016 at 23:34 Comment(4)
The definition of [] is full of magic; I'd take anything GHCi says about it with a grain of salt.Odilia
I would call this a bug. Feel free to report it on the bug tracker.Dickinson
Same issue with ghc 7.8.4.Homiletics
@gallais can you provide that as an answer?Lanilaniard
S
3

Pay no attention to this, it's certainly a bug. I can reproduce this behavior on GHC 7.10.3, but the current GHC 8.0 development snapshot doesn't suffer from this issue:

GHCi, version 8.0.0.20160316: http://www.haskell.org/ghc/  :? for help
Prelude> :info (:)
data [] a = ... | a : [a]   -- Defined in ‘GHC.Types’
infixr 5 :
Samford answered 22/3, 2016 at 23:25 Comment(1)
Another one bites the dust! I wonder what got it fixed--if it only caused this one peculiarity, I doubt anyone would've bothered. Perhaps the code was rewritten for some more substantial reason.Odilia

© 2022 - 2024 — McMap. All rights reserved.