question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Are nat-dependent types possible?

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:27 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
gustycommented, Oct 14, 2019

That’s great. To me the tuple version looks much better and flexible.

3reactions
cannorincommented, Aug 10, 2019

I think I can help with this (once #174 is done)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found