Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any language extensions or language descendants of Haskell, that favor expressiveness, particularly in instance handling?

At times, I run into the "feature" that Haskell only matches instance heads, namely,

instance (a ~ NewDataTyp b) => C a

will now match any type whatsoever, i.e. writing another instance declaration of C in your program will is an error, even if it cannot possibly conflict due to the context a ~ NewDataTyp b. At times, it takes a lot of effort to overcome; I've had to restructure hundreds of lines of code to avoid this limitation.

Are there any language extensions, or descendant languages (Curry? Agda?) that are designed with a higher priority for expressiveness? This could possibly sacrifice (a) openness of the typeclass world (b) polynomial time typechecking.

edit -- for those interested in the question, this page might also be of interest: http://www.haskell.org/haskellwiki/Future_of_Haskell

like image 251
gatoatigrado Avatar asked Jan 26 '12 02:01

gatoatigrado


1 Answers

For what it's worth, Scala accepts the more-or-less literal translation of what you just wrote. I'm not sure how useful it is.

trait C[T]
case class NewDataType[T]()

implicit def letItBeInjectiveWhyNot[K[_],T]: K[T] =:= K[T]

implicit def cIsh[A,S](implicit ev: A =:= NewDataType[S]): C[A]
implicit def another: C[Int]

implicitly[C[NewDataType[String]]]
implicitly[C[Int]]
like image 66
Owen Avatar answered Nov 10 '22 02:11

Owen