Skip to content

GHC doesn't like 'inline' type function applications

{-# LANGUAGE TypeFamilies #-}

import Prelude hiding (foldl, foldr, foldl1, foldr1, mapM_, sequence_,
		elem, notElem, concat, concatMap, and, or, any, all,
		sum, product, maximum, minimum)
import Data.Monoid

type family Element t

class Foldable t where
        foldMap :: Monoid m => (Element t -> m) -> t -> m

	foldr :: (Element t -> b -> b) -> b -> t -> b
	-- foldr :: Element t ~ a => (a -> b -> b) -> b -> t -> b
	foldr f z t = appEndo (foldMap (Endo . f) t) z

GHC chokes on the above module. If the signature of foldr is replaced by the commented one, GHC is happy. It seems to me that the two expressions should be equivalent.

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