Intro to functional dependencies in Haskell?

Hi all, i'm having some trouble 'getting' functional dependencies in the Haskell context (although my understanding of them in the context of relational database theory isn't that great either). Could someone please point me to an introduction / tutorial in this regard? Thanks! Alexis.

On Thu, Apr 17, 2008 at 03:21:16PM +1000, Alexis Hazell wrote:
Hi all,
i'm having some trouble 'getting' functional dependencies in the Haskell context (although my understanding of them in the context of relational database theory isn't that great either). Could someone please point me to an introduction / tutorial in this regard?
I think you've already tried www.haskell.org -> wiki search ? http://haskell.org/haskellwiki/Functional_dependencies You can express this by specifying a functional dependency, or fundep for short: class Mult a b c | a b -> c where (*) :: a -> b -> c This tells Haskell that c is uniquely determined from a and b. So there you can't implement instances Mult Int Char Sting and Mult Int Char MyString of course, your programs will work withou t that | a b -> c as well, but you need to tell the compiler the result type of (*) fac1 fac2 wheeras using fundeps it knows the result type becaus there can only be one instance. (Which is what you want in this case when multiplying matrizes as well. HTH Marc Weber

Not so long ago, I had difficulties to understand functional dependecies.
Due to the (sometimes well-grounded) prejudgement of considering
research papers as an unfriendly and obscure source of information, I
stupidly ruled out reading Mark P Jones original paper. Then I learned
I was totally wrong, it is written in a friendly way, with lots of
examples, allowing me to finally understand how functional
dependencies work and what was the reason to introduce them:
http://web.cecs.pdx.edu/~mpj/pubs/fundeps.html
On Thu, Apr 17, 2008 at 7:21 AM, Alexis Hazell
Hi all,
i'm having some trouble 'getting' functional dependencies in the Haskell context (although my understanding of them in the context of relational database theory isn't that great either). Could someone please point me to an introduction / tutorial in this regard?
Thanks!
Alexis. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Alexis Hazell
-
Alfonso Acosta
-
Bulat Ziganshin
-
Marc Weber