Y
Hacker News
new
|
ask
|
show
|
jobs
by
alkonaut
3296 days ago
I know idris (apart from improving some haskell warts) also adds dependent types. Are there any good simple examples of dependent type use, that is
not
vectors-of-length-N?
2 comments
mej10
3296 days ago
The type safe printf implementation is pretty cool as another small example.
https://github.com/mukeshtiwari/Idris/blob/master/Printf.idr
link
nv-vn
3296 days ago
Yes. They're amazing for theorem proving (see Agda, Idris). They're also useful for refinement types, proving type class laws like for monads, etc.
link
alkonaut
3296 days ago
Is there a hello world-y example of refinement types, similar to Vectors with length?
link