Are functional dependencies around to stay?

Hi everyone, I'm wondering if there is any chance that functional dependencies will not be around in the future. I do not actually understand the subject yet as such, but I'd like to make sure before I get deeper into it that it's something that will be around in the time to come. What I understand of Haskell is that it's not so much "engineered" like other languages but more "derived" from Math, well the very foundations anyway. But some things I can not determine whether or not they are derived from math and thus will stay, or are engineered and might go away, functional dependencies for instance. Günther

2009/12/21 Günther Schmidt
Hi everyone,
I'm wondering if there is any chance that functional dependencies will not be around in the future. I do not actually understand the subject yet as such, but I'd like to make sure before I get deeper into it that it's something that will be around in the time to come.
My understanding is that they might end up dropped in favor of type families, and that should happen about when chicken will start growing teeth. Obviously, my understanding is probably flawed. David.

2009/12/21 Günther Schmidt
What I understand of Haskell is that it's not so much "engineered" like other languages but more "derived" from Math, well the very foundations anyway. But some things I can not determine whether or not they are derived from math and thus will stay, or are engineered and might go away, functional dependencies for instance.
Hello Günther Provided you consider relations part of mathematics ('The Haskell Road' book certainly does as does, as does John O'Donnell et als. 'Discrete Mathematics Using a Computer'), then you might consider fundeps as much 'derived' from maths as engineered. See the paper from the 2008 Haskell Symposium. http://web.cecs.pdx.edu/~mpj/pubs/fundeps-design.html Best wishes Stephen

I believe, whenever this http://hackage.haskell.org/trac/ghc/ticket/2715 ticket is closed (with completition), we get a more general substitution to Functional Dependencies. I hope it happens really soon, because I need it already. =) So it's worth to prepare yourself better to Type Families. As for deriving of fundeps, outside of Haskell I saw them already used in methods used in a base of reasoning about RDB (relational data bases) structures. For more on that search web by keywords "normalization rules functional dependencies", that's an interesting subject if you possess it in practice. Regards, Andrey Günther Schmidt wrote:
I'm wondering if there is any chance that functional dependencies will not be around in the future. I do not actually understand the subject yet as such, but I'd like to make sure before I get deeper into it that it's something that will be around in the time to come.
What I understand of Haskell is that it's not so much "engineered" like other languages but more "derived" from Math, well the very foundations anyway. But some things I can not determine whether or not they are derived from math and thus will stay, or are engineered and might go away, functional dependencies for instance.
-- View this message in context: http://old.nabble.com/Are-functional-dependencies-around-to-stay--tp26873777... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Günther Schmidt wrote:
I'm wondering if there is any chance that functional dependencies will not be around in the future.
As was previously noted they are supposed to be replaced by type families, but for me the crucial difference between these two now is that currently type families do not allow overlapping instances "at all" while fundeps can be used with overlapping instances in GHC with -XOverlappingInstances flag.. Not sure how this difference is going to be changed in the future, but I am currently using fundeps because of it (I'd prefer type families otherwise). -- View this message in context: http://old.nabble.com/Are-functional-dependencies-around-to-stay--tp26873777... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

2009/12/22 Eduard Sergeev
As was previously noted they are supposed to be replaced by type families,
Hi Eduard Currently this seems a more like a rumour than a fact - from [1] Type Families and Fun Deps are equivalently expressive which seems a worthwhile point to restate. From [2] the Haskell prime committee want one or the other but not both, and will resolve matters sometime in the future. Best wishes Stephen [1] http://www.haskell.org/pipermail/haskell-cafe/2009-February/055890.html [2] http://www.haskell.org/pipermail/haskell-prime/2008-April/002434.html

Semi Off Topic:
If the ultimate nature of reality is mathematical, as many physicist say,
then everything is mathematical. Then the question must be rephrased to ¿is
this or that isomorphic with a mathematical structure powerful enough
(general enough, simple enough, but not more) or is out there another better
structure?.
How much of mathematical discovery, rather than engineering, are in
programming languages design ?
Merry christmas!
2009/12/22 Stephen Tetley
2009/12/22 Eduard Sergeev
: As was previously noted they are supposed to be replaced by type families,
Hi Eduard
Currently this seems a more like a rumour than a fact - from [1] Type Families and Fun Deps are equivalently expressive which seems a worthwhile point to restate. From [2] the Haskell prime committee want one or the other but not both, and will resolve matters sometime in the future.
Best wishes
Stephen
[1] http://www.haskell.org/pipermail/haskell-cafe/2009-February/055890.html [2] http://www.haskell.org/pipermail/haskell-prime/2008-April/002434.html _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi Stephen, Stephen Tetley-2 wrote:
Currently this seems a more like a rumour than a fact - from [1] Type Families and Fun Deps are equivalently expressive which seems a worthwhile point to restate.
I've got the same impresion initially and was keen to use TF in favor to FD. And I'm probably missing something here... but here is wiki example which, I think, gives an example of the 'difference' I was refering to: http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap (see '2 Notes and variations', last part). As an additional example I can point to Oleg Kiselyov's TypeCast implementation (http://okmij.org/ftp/Haskell/deepest-functor.lhs), here is its slightly modified version: {-# OPTIONS -fglasgow-exts #-} {-# OPTIONS -fallow-undecidable-instances #-} {-# OPTIONS -fallow-overlapping-instances #-} module FMAP where data Atom -- Check if a type is a collection type. This is the only typeclass that -- needs overlapping instances class IsCollection t coll | t -> coll instance IsCollection (m a) (m ()) instance Atom ~ coll => IsCollection t coll -- The desired deep functor. Needs no overlapping instances class Funct a b c1 c2 | c1 -> a, c1 b -> c2 where f_map :: (a -> b) -> c1 -> c2 instance (IsCollection c1 coll, Funct' coll a b c1 c2) => Funct a b c1 c2 where f_map = f_map' (undefined::coll) class Funct' coll a b c1 c2 | coll c1 -> a, coll c1 b -> c2 where f_map' :: coll -> (a -> b) -> c1 -> c2 instance Funct' Atom a b a b where f_map' _ = id instance (Functor m, Funct a b c d) => Funct' (m ()) a b (m c) (m d) where f_map' _ = fmap . f_map test1 = f_map (+1) [[[1::Int,2,3]]] test2 = f_map not [[True], [False]] test3 = f_map not (Just [Just True, Nothing]) test4 = f_map not (print "here" >> return (Just (Just [Just [True], Nothing]))) >>= print Still I am not sure how to rewrite this example using Type Families.. -- View this message in context: http://old.nabble.com/Are-functional-dependencies-around-to-stay--tp26873777... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Hi,
Not everyone in the community is keen on replacing functional
dependencies with type families. My advice would be to use whichever
language construct seems more suitable to your problem and disregard
the occasional posts by people claiming that functional dependencies
are obsolete or deprecated.
-Iavor
On Tue, Dec 22, 2009 at 9:18 AM, Eduard Sergeev
Hi Stephen,
Stephen Tetley-2 wrote:
Currently this seems a more like a rumour than a fact - from [1] Type Families and Fun Deps are equivalently expressive which seems a worthwhile point to restate.
I've got the same impresion initially and was keen to use TF in favor to FD. And I'm probably missing something here... but here is wiki example which, I think, gives an example of the 'difference' I was refering to: http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap (see '2 Notes and variations', last part).
As an additional example I can point to Oleg Kiselyov's TypeCast implementation (http://okmij.org/ftp/Haskell/deepest-functor.lhs), here is its slightly modified version:
{-# OPTIONS -fglasgow-exts #-} {-# OPTIONS -fallow-undecidable-instances #-} {-# OPTIONS -fallow-overlapping-instances #-}
module FMAP where
data Atom
-- Check if a type is a collection type. This is the only typeclass that -- needs overlapping instances class IsCollection t coll | t -> coll instance IsCollection (m a) (m ()) instance Atom ~ coll => IsCollection t coll
-- The desired deep functor. Needs no overlapping instances class Funct a b c1 c2 | c1 -> a, c1 b -> c2 where f_map :: (a -> b) -> c1 -> c2
instance (IsCollection c1 coll, Funct' coll a b c1 c2) => Funct a b c1 c2 where f_map = f_map' (undefined::coll)
class Funct' coll a b c1 c2 | coll c1 -> a, coll c1 b -> c2 where f_map' :: coll -> (a -> b) -> c1 -> c2
instance Funct' Atom a b a b where f_map' _ = id
instance (Functor m, Funct a b c d) => Funct' (m ()) a b (m c) (m d) where f_map' _ = fmap . f_map
test1 = f_map (+1) [[[1::Int,2,3]]] test2 = f_map not [[True], [False]] test3 = f_map not (Just [Just True, Nothing]) test4 = f_map not (print "here" >> return (Just (Just [Just [True], Nothing]))) >>= print
Still I am not sure how to rewrite this example using Type Families..
-- View this message in context: http://old.nabble.com/Are-functional-dependencies-around-to-stay--tp26873777... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

The referenced writings are a bit old. I wonder, what are the current plans and decisions (or at least dominating opinions) on FD and TF. And when the equality constraint will be ready. Andrey Stephen Tetley-2 wrote:
2009/12/22 Eduard Sergeev
: As was previously noted they are supposed to be replaced by type families,
Hi Eduard
Currently this seems a more like a rumour than a fact - from [1] Type Families and Fun Deps are equivalently expressive which seems a worthwhile point to restate. From [2] the Haskell prime committee want one or the other but not both, and will resolve matters sometime in the future.
Best wishes
Stephen
[1] http://www.haskell.org/pipermail/haskell-cafe/2009-February/055890.html [2] http://www.haskell.org/pipermail/haskell-prime/2008-April/002434.html _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- View this message in context: http://old.nabble.com/Are-functional-dependencies-around-to-stay--tp26873777... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
participants (7)
-
Alberto G. Corona
-
Andrey Sisoyev
-
David Virebayre
-
Eduard Sergeev
-
Günther Schmidt
-
Iavor Diatchki
-
Stephen Tetley