[Haskell-cafe] Re: Small displeasure with associated type synonyms

David Menendez dave at zednenem.com
Thu Mar 6 22:26:30 EST 2008


On Thu, Mar 6, 2008 at 3:57 PM, ChrisK <haskell at list.mightyreason.com> wrote:
> Okay, I get the difference.
>
>  The "T a" annotation in "val :: T a)"and "val :: T a" does not help choose the
>  "C a" dictionary.
>  But the "val :: a-> T a" and "val (undefined :: a)" allows "a" to successfully
>  choose the "C a" dictionary.
>
>  val :: T a fixes "T a" but does not imply "C a".
>  (undefined :: a) fixes "a" and does imply "C a".
>  I now see how the functional dependency works here (which I should have tried to
>  do in the first place -- I should have thought more and relied on the mailing
>  list less).
>
>  "class C a b | a -> b" is here "class C a where type T a = b".
>  So only knowing "T a" or "b" does not allow "a" to be determined.

Am I correct in thinking this would have worked if it were an
associated type instead of an associated type synonym?

ie,

class C a where
    data T a
    val :: T a

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list