Opened 2 years ago

Closed 2 years ago

#13659 closed bug (fixed)

Bug report: "AThing evaluated unexpectedly tcTyVar a_alF"

Reported by: costaparas Owned by:
Priority: highest Milestone:
Component: Compiler Version: 8.0.1
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by costaparas)

The following code:

{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies, TypeOperators, DataKinds, FlexibleInstances #-}

{- Defines a C-like printf function using DataKinds extensions. -}

module Printf where

-- format string parameterized by a list of types
data Format (fmt :: [*]) where
  X :: Format '[]                   -- empty string, i.e. ""
  L :: a -> String -> Format '[]    -- string literal, e.g. "hello"
  S :: a -> Format '[String]        -- "%s"
  I :: Format a -> Format '[Int, a] -- "%d"

produces the following error:

GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Printf ( Printf.hs, interpreted )

Printf.hs:12:27:ghc: panic! (the 'impossible' happened)

(GHC version 7.10.3 for x86_64-unknown-linux):

AThing evaluated unexpectedly tcTyVar a_alF

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

when run using ghci Printf.hs

on Liunx Ubuntu 16.04 LTS 64-bit with Intel® Core™ i7-7500U CPU @ 2.70GHz

Change History (5)

comment:1 Changed 2 years ago by costaparas

Description: modified (diff)

comment:2 Changed 2 years ago by RyanGlScott

I can't reproduce this bug on GHC 8.0.1 or later:

$ /opt/ghc/8.0.1/bin/ghci Bug.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Printf           ( Bug.hs, interpreted )

Bug.hs:12:27: error:
    • Expected a type, but ‘a’ has kind ‘[*]’
    • In the first argument of ‘Format’, namely ‘'[Int, a]’
      In the type ‘Format '[Int, a]’
      In the definition of data constructor ‘I’
Failed, modules loaded: none.

Commit 5955510e5f57464b1f4f42b510e3558d6e691380 was what fixed it.

comment:3 Changed 2 years ago by simonpj

I'll add a regression test

comment:4 Changed 2 years ago by Simon Peyton Jones <simonpj@…>

In 6f26fe7/ghc:

Add regression test for Trac #13659

comment:5 Changed 2 years ago by simonpj

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.