Functional Dependency in Haskell?

I thought this explains it fairly well. So basically if you have an FD relation of a -> be all it means is for type-class instance there can only be one 'b' with any 'a' so Int Int but you can't have Int Float as well. That's what they mean when it's said that 'b' is uniquely determined from 'a'.

This extends to any number of type paramters. The reason why it is needed is 1. Type inference 2.

Sometimes you want a constraint like that.

I thought this explains it fairly well. So basically if you have an FD relation of a -> be all it means is for type-class instance there can only be one 'b' with any 'a' so Int Int but you can't have Int Float as well. That's what they mean when it's said that 'b' is uniquely determined from 'a'.

This extends to any number of type paramters. The reason why it is needed is 1. Type inference 2.

Sometimes you want a constraint like that. An alternative to FDs is type families extension but not for all cases of FDs.

Thanks for your feedback. That article is great. Now I know exactly what is my real question.

You said 'sometimes you want a constraint like that'. I understand this part. But I don't understand why it is needed for type inference.

I've updated my question with another follow-up question. The example is from that wiki page you mentioned above. – aXqd Nov 26 '10 at 14:12 I finally figured it out.

The compiler is still trying to find the right instance of typeclass, hence it has nothing to do with that specific instance yet. I don't give the return type, hence it's ambiguous. – aXqd Nov 27 '10 at 15:23 If I add functional dependency, the compiler can be sure that as long as the type of container can find a match, the compiler can use that instance, because it can has only ONE kind of return type now.

– aXqd Nov 27 '10 at 15:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions