[Haskell-cafe] Strange type error with associated type synonyms
bulat.ziganshin at gmail.com
Wed May 27 15:59:02 EDT 2009
Wednesday, May 27, 2009, 11:42:22 PM, you wrote:
while we are here - i always had problems understanding what is
inferred and what is expected type. may be problem is just that i'm
not native speaker
are other, especially beginners, had the same problem?
> Claus made a suggestion about type error messages:
> | Apart from bracketing fully applied type synonyms, the error message
> | could be improved by providing the missing bit of information about
> | 'Memo':
> | D:\home\Haskell\tmp\desktop\types.hs:11:11:
> | Couldn't match expected type `Memo d1'
> | against inferred type `Memo d'
> | (type Memo d :: * -> *)
> | In the second argument of `(.)', namely `appl'
> | In the expression: abst . appl
> | In the definition of `f': f = abst . appl
> I've implemented this idea; note the "NB" line below:
> Couldn't match expected type `Memo d'
> against inferred type `Memo d1'
> NB: `Memo' is a (non-injective) type function
> In the second argument of `(.)', namely `appl'
> In the expression: abst . appl
> In the definition of `f': f = abst . appl
> (Rather than give its kind, I thought it was better to focus on the
> reason for the mis-match, namely the non-injectivity.)
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe