[GHC] #16092: Bug when trying to combine two lists

GHC ghc-devs at haskell.org
Tue Feb 5 06:56:46 UTC 2019


#16092: Bug when trying to combine two lists
-------------------------------------+-------------------------------------
        Reporter:  sutbult           |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:  duplicate         |             Keywords:
Operating System:  MacOS X           |         Architecture:  x86_64
 Type of failure:  Building GHC      |  (amd64)
  failed                             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13819            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by bgamari:

Old description:

> I want to write a function that takes two lists and returns a list that
> includes every possible combination of elements from the two given lists,
> using a given function. I thought that this code would work:
>
> {{{#!hs
> combine :: (a -> b -> c) [a] -> [b] -> [c]
> combine fn alist blist = [fn a b | a <- alist, b <- blist]
> }}}
>
> However, when compiling, this message arises from GHC:
>
> Glasgow Haskell Compiler, Version 8.2.1, stage 2 booted by GHC version
> 7.10.3
> Using binary package database:
> /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d/package.cache
> Using binary package database:
> /Users/samuelutbult/.ghc/x86_64-darwin-8.2.1/package.conf.d/package.cache
> package flags []
> loading package database
> /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d
> loading package database
> /Users/samuelutbult/.ghc/x86_64-darwin-8.2.1/package.conf.d
> wired-in package ghc-prim mapped to ghc-prim-0.5.1.0
> wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
> wired-in package base mapped to base-4.10.0.0
> wired-in package rts mapped to rts
> wired-in package template-haskell mapped to template-haskell-2.12.0.0
> wired-in package ghc mapped to ghc-8.2.1
> wired-in package dph-seq not found.
> wired-in package dph-par not found.
> package flags []
> loading package database
> /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d
> loading package database
> /Users/samuelutbult/.ghc/x86_64-darwin-8.2.1/package.conf.d
> wired-in package ghc-prim mapped to ghc-prim-0.5.1.0
> wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
> wired-in package base mapped to base-4.10.0.0
> wired-in package rts mapped to rts-1.0
> wired-in package template-haskell mapped to template-haskell-2.12.0.0
> wired-in package ghc mapped to ghc-8.2.1
> wired-in package dph-seq not found.
> wired-in package dph-par not found.
> *** Chasing dependencies:
> Chasing modules from: *Combine.hs
> !!! Chasing dependencies: finished in 0.69 milliseconds, allocated 0.222
> megabytes
> Stable obj: []
> Stable BCO: []
> Ready for upsweep
>   [NONREC
>       ModSummary {
>          ms_hs_date = 2018-12-23 17:18:05.830132761 UTC
>          ms_mod = Main,
>          ms_textual_imps = [(Nothing, Prelude)]
>          ms_srcimps = []
>       }]
> *** Deleting temp files:
> Deleting:
> compile: input file Combine.hs
> *** Checking old interface for Main (use -ddump-hi-diffs for more
> details):
> [1 of 1] Compiling Main             ( Combine.hs, Combine.o )
> *** Parser [Main]:
> !!! Parser [Main]: finished in 1.05 milliseconds, allocated 0.171
> megabytes
> *** Renamer/typechecker [Main]:
> *** Deleting temp files:
> Deleting:
> *** Deleting temp dirs:
> Deleting:
> ghc: panic! (the 'impossible' happened)
>   (GHC version 8.2.1 for x86_64-apple-darwin):
>         repSplitAppTys
>   a_anL[sk:1]
>   b_anM[sk:1] -> c_anN[sk:1]
>   []
>   Call stack:
>       CallStack (from HasCallStack):
>         prettyCurrentCallStack, called at
> compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
>         callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
> ghc:Outputable
>         pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

New description:

 I want to write a function that takes two lists and returns a list that
 includes every possible combination of elements from the two given lists,
 using a given function. I thought that this code would work:

 {{{#!hs
 combine :: (a -> b -> c) [a] -> [b] -> [c]
 combine fn alist blist = [fn a b | a <- alist, b <- blist]
 }}}

 However, when compiling, this message arises from GHC:
 {{{
 Glasgow Haskell Compiler, Version 8.2.1, stage 2 booted by GHC version
 7.10.3
 Using binary package database:
 /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d/package.cache
 Using binary package database:
 /Users/samuelutbult/.ghc/x86_64-darwin-8.2.1/package.conf.d/package.cache
 package flags []
 loading package database
 /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d
 loading package database
 /Users/samuelutbult/.ghc/x86_64-darwin-8.2.1/package.conf.d
 wired-in package ghc-prim mapped to ghc-prim-0.5.1.0
 wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
 wired-in package base mapped to base-4.10.0.0
 wired-in package rts mapped to rts
 wired-in package template-haskell mapped to template-haskell-2.12.0.0
 wired-in package ghc mapped to ghc-8.2.1
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 package flags []
 loading package database
 /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/package.conf.d
 loading package database
 /Users/samuelutbult/.ghc/x86_64-darwin-8.2.1/package.conf.d
 wired-in package ghc-prim mapped to ghc-prim-0.5.1.0
 wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
 wired-in package base mapped to base-4.10.0.0
 wired-in package rts mapped to rts-1.0
 wired-in package template-haskell mapped to template-haskell-2.12.0.0
 wired-in package ghc mapped to ghc-8.2.1
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 *** Chasing dependencies:
 Chasing modules from: *Combine.hs
 !!! Chasing dependencies: finished in 0.69 milliseconds, allocated 0.222
 megabytes
 Stable obj: []
 Stable BCO: []
 Ready for upsweep
   [NONREC
       ModSummary {
          ms_hs_date = 2018-12-23 17:18:05.830132761 UTC
          ms_mod = Main,
          ms_textual_imps = [(Nothing, Prelude)]
          ms_srcimps = []
       }]
 *** Deleting temp files:
 Deleting:
 compile: input file Combine.hs
 *** Checking old interface for Main (use -ddump-hi-diffs for more
 details):
 [1 of 1] Compiling Main             ( Combine.hs, Combine.o )
 *** Parser [Main]:
 !!! Parser [Main]: finished in 1.05 milliseconds, allocated 0.171
 megabytes
 *** Renamer/typechecker [Main]:
 *** Deleting temp files:
 Deleting:
 *** Deleting temp dirs:
 Deleting:
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.1 for x86_64-apple-darwin):
         repSplitAppTys
   a_anL[sk:1]
   b_anM[sk:1] -> c_anN[sk:1]
   []
   Call stack:
       CallStack (from HasCallStack):
         prettyCurrentCallStack, called at
 compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
         callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
 ghc:Outputable
         pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

--

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16092#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list