[GHC] #13927: Panic!

GHC ghc-devs at haskell.org
Wed Jul 5 12:14:00 UTC 2017


#13927: Panic!
-------------------------------------+-------------------------------------
        Reporter:  Deus              |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by Deus:

@@ -73,0 +73,3 @@
+
+ EDIT:
+ It seems to be the part that belongs to 6

New description:

 Hi,
 I'm using haskell for an assignment and I createt this (which told me to
 do a bug report):
 [1 of 1] Compiling Main             ( plant.hs, plant.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.2 for x86_64-unknown-linux):
         initTc: unsolved constraints
   WC {wc_insol =
         [W] true_a1Gg :: t_a1Gf[tau:1] (CHoleCan: true)
         [W] false_a1Gj :: t_a1Gi[tau:1] (CHoleCan: false)
         [W] true_a1Qq :: t_a1Qp[tau:1] (CHoleCan: true)}

 {{{#!hs

 data Farbe = Rot | Rosa | Weis | Blau | Lila | Grun | Gelb
    deriving (Show, Eq)

 data Pflanze =
       Blatt
    |  Blute Farbe
    |  Stiel Pflanze Pflanze
    deriving (Show, Eq)

 fold_pflanze :: (a -> a -> a) -> (Farbe -> a) -> a -> Pflanze -> a
 fold_pflanze f g x (Blatt) = x
 fold_pflanze f g x (Blute fa) = (f x (g fa))
 fold_pflanze f g x (Stiel p1 p2) = fold_pflanze f g (fold_pflanze f g x
 p1) p2


 --4.
 farbezuliste :: Farbe -> [Farbe]
 farbezuliste f = [f]

 appendlisten :: [Farbe] -> [Farbe] -> [Farbe]
 appendlisten f1 f2 = f1 ++ f2

 blutenfarben :: Pflanze -> [Farbe]
 blutenfarben p = fold_pflanze appendlisten farbezuliste [] p

 --5.
 fold_pflanze2 :: (Farbe -> Int) -> Int -> Pflanze -> Int
 fold_pflanze2 f x (Blatt) = x + 1;
 fold_pflanze2 f x (Blute fa) =  x + (f fa)
 fold_pflanze2 f x (Stiel p1 p2) = (-2) + (fold_pflanze2 f (fold_pflanze2 f
 x p1) p2)

 evaluatefarbe :: Farbe -> Int
 evaluatefarbe Rot = 2
 evaluatefarbe Rosa = 3
 evaluatefarbe Weis = 5
 evaluatefarbe Blau = 1
 evaluatefarbe Lila = 10
 evaluatefarbe Grun = -1
 evaluatefarbe Gelb = 0

 schonheit :: Pflanze -> Int
 schonheit p = fold_pflanze2 evaluatefarbe 0 p

 --6.
 istrosa :: Farbe -> Bool
 istrosa Rosa = true
 istrosa otherwise = false

 und :: Bool -> Bool -> Bool
 und x y = x && y

 rosabluhend :: Pflanze -> Bool
 rosabluhend p = fold_pflanze und istrosa true p
 }}}
 I tryed to add the code as attechment bug it crashed (It also told me to
 do a bug report but I have an assignment to do).

 EDIT:
 It seems to be the part that belongs to 6

--

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


More information about the ghc-tickets mailing list