1{-# OPTIONS_GHC -O2 #-} 2{-# OPTIONS_GHC -fno-warn-missing-methods #-} 3{-# LANGUAGE NoImplicitPrelude #-} 4-- {-# OPTIONS_GHC -fno-spec-constr #-} -- Makes the problem go away. 5-- {-# OPTIONS_GHC -fspec-constr-count=1 #-} -- Makes the problem go away. 6 7module T10602 where 8 9-- Copy-pasting T10602b.hs into the current module makes the problem go away. 10import T10602b 11 12data PairS a = PairS a a 13 14-- Removing the '~' makes the problem go away. 15(PairS _ _) >> ~(PairS b g) = PairS b g 16 17class Binary t where 18 put :: t -> PairS () 19 20-- Not using a newtype makes the problem go away. 21newtype A a = A [a] 22 23instance Binary a => Binary (A a) where 24 put (A xs) = case splitAt 254 xs of 25 (_, []) -> foldr (>>) (PairS () ()) (map put xs) 26 (_, b) -> put (A b) 27