Skip to content

Type deduction panic

> {-# LANGUAGE DeriveFunctor #-}

> module Bug where 

> import qualified Data.Set as S 

> import Data.Foldable (fold, foldMap, toList)
> import Data.List.Split (splitOn)
> import Data.Monoid -- ((<>), Sum, mempty, mappend)
> import Data.Functor.Foldable

> newtype Component = Component (Int,Int) deriving (Eq, Ord, Show)

> data Day24State v a = Day24State {
>   valueToMatch :: Int,
>   componentsToUse :: S.Set Component,
>   componentMetric :: v,
>   nextStates :: [a]     
> } deriving (Functor, Show)

> type Day24StateFix v a = Fix (Day24State v) 

Now in GHCI type

:t Data.Functor.Foldable.ana f (undefined :: Day24StateFix Component)

Produces

ghc.EXE: panic! (the 'impossible' happened)

(GHC version 8.0.2 for x86_64-unknown-mingw32):

initTc: unsolved constraints WC {wc_insol = [W] f_akbJ :: t_akbI[tau:3] (CHoleCan: f)}

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

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information