
Am Donnerstag 03 Dezember 2009 19:51:31 schrieb builes.adolfo@googlemail.com:
You need to tell the compiler explicitly that a and Build r should be the same type.
Thanks Daniel :). That was the trick .
It's the first time that I see "~", is that from -XUndecidableInstances ? .
No, it's part of the TypeFamilies extension. http://www.haskell.org/haskellwiki/GHC/Type_families#Equality_constraints and http://www.haskell.org/ghc/docs/latest/html/users_guide/type-families.html (much overlap). It requires UndecidableInstances ( http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class- extensions.html#undecidable-instances ) because both type variables from the instance head appear in the constraints, so the compiler can't prove that type inference will terminate. You tell it that you think it will terminate, and it goes forth. Which reminds me:
{-# OPTIONS -fglasgow-exts #-}
is deprecated. Use LANGUAGE pragmas, in this case {-# LANGUAGE TypeFamilies, UndecidableInstances #-} ({-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} for the FunDep version).