
#14076: cons operator for list give weird output -------------------------------------+------------------------------------- Reporter: AshHash | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: cons(:) Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): This is expected, someone could define a `Num` instance for lists in a separate module {{{#!hs instance Num a => Num [a] where fromInteger :: Integer -> [a] fromInteger i = [fromInteger] (+) :: [a] -> [a] -> [a] (+) = liftA2 (+) -- .. }}} at which point your expression reduces to `[1,2]` {{{
:t 1 : 2 1 : 2 :: Num a => [a] 1 : 2 [1,2] }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14076#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler