Why is single-use use of this type compiled, but its inclusion in the list fails?
ft1 :: (Foldable t, Num a) => t a -> a
ft1 = (F.foldl (+) 0)
fTest :: [(Foldable t, Num a) => t a -> a ]
fTest = [ F.foldl (+) 0 ]
The latter gives an error:
folding.hs:80:10:
Illegal polymorphic or qualified type:
(Foldable t, Num a) => t a -> a
Perhaps you intended to use ImpredicativeTypes
In the type signature for `fTest':
fTest :: [(Foldable t, Num a) => t a -> a]
Symmetrically, trying to call it unsuccessfully (in different ways):
type Ftst t a = (Foldable t, Num a) => t a -> a
folding.hs:80:1:
Illegal polymorphic or qualified type:
(Foldable t, Num a) => t a -> a
Perhaps you intended to use RankNTypes or Rank2Types
In the type declaration for `Ftst'
source
share