Re:Dependent Haskell
by joe_the_user on Tuesday December 18, 2018 @03:18AM
(#18705219)
When I see this definition, I scratch my head and wonder why this isn't a different way to introduce object orientation, generics, c++ parameterized templates and such.
Re:Dependent Haskell
by logicchains on Tuesday December 18, 2018 @05:36AM
(#18705645)
The key difference with C++ templates is that in C++ you can't have a type parameterised by a value that's only know at runtime, e.g. a std::array<N> where N is read from stdin. In a dependently typed language, you can. Object orientation is a different matter entirely; in the sense it implies Java-style class-based inheritance, it's almost in the opposite spirit to dependent types, as such late-binding (virtual methods) means it's possible to call methods such that the compiler has no idea which method will be called at compile time, making it hard to reason about the code at compile time.
Re:Dependent Haskell
by RossBencina on Tuesday December 18, 2018 @04:19AM
(#18705409)
Yes. C++ templates provide some subset of what you can do with dependent types in Idris.
Edwin Brady shows off some examples in Idris here[1]. I thought the matrix example was really impressive.
[1] https://www.youtube.com/watch?v=mOtKD7ml0NU