[Haskell-cafe] type class constraints headache
Eduard Sergeev
Eduard.Sergeev at gmail.com
Thu Mar 4 06:24:09 EST 2010
Related question probably: why ghc compiles this:
> {-# LANGUAGE RankNTypes, ImpredicativeTypes #-}
> methods :: [(String, forall b. Eq b => b)]
> methods =
> [ ("method1", undefined )
> , ("method2", undefined) ]
> test:: [String]
> test= pmap methods
> where pmap = map fst
But when I change 'test' to:
> test:: [String]
> test= map fst methods
I get:
Cannot match a monotype with `forall b. (Eq b) => b'
Expected type: [(String, b)]
Inferred type: [(String, forall b1. (Eq b1) => b1)]
In the second argument of `map', namely `methods'
In the expression: map fst methods
Failed, modules loaded: none.
--
View this message in context: http://old.nabble.com/type-class-constraints-headache-tp27752745p27779518.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list