Are nat-dependent types possible?
See original GitHub issueI am writing a matrix type and a matrix multiplication function. What I would like is to have types Matrix<n,m>
indexed by positive integers n
, m
so that the multiplication has signature
Matrix<n,m> -> Matrix<m,p> -> Matrix<n,p>
(so trying to multiply matrices of incompatible dimensions is a type error).
I have seen an implementation of this in F# (https://www.youtube.com/watch?v=3zdlQ_HjKl4 ) but the approach is quite hacky… Is it possible to do this neatly with F#+?
Issue Analytics
- State:
- Created 4 years ago
- Comments:27 (22 by maintainers)
Top Results From Across the Web
haskell - Why not be dependently typed?
Dependent typing is really just the unification of the value and type levels, so you can parametrize values on types (already possible with ......
Read more >Dependent types and usability? : r/ProgrammingLanguages
Dependent types require you to write proofs. This is a huge limitation: writing proofs is much slower than writing code. I believe that ......
Read more >The reason is twofold. One, research into dependent types ...
There is no fundamental reason that a dependently typed language couldn't have the same type inference for non-dependently typed pieces of the program...
Read more >The Future of Programming is Dependent Types
You would have to have a type which depends on a value, or a dependent type . In mainstream languages, this isn't possible....
Read more >Is there a practical use for dependent types?
I tend to say no. All the example people provide are only useful when the value that the types depends on are known...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s great. To me the tuple version looks much better and flexible.
I think I can help with this (once #174 is done)