Skip to content
rpeszek edited this page Apr 28, 2018 · 35 revisions

IdrisTddNotes

There is a small portion of Java developers who dream about programming in Scala.
There is a sizable portion of Scala developers who dream about programming in Haskell.
All Haskell programmers want to program in Idris.

;)

Notes from reading Type Driven Development with Idris.
This Wiki contains test and example programs compiled to markdown.

WORK IN PROGRESS

These notes compare Idris code in the book against Haskell. My goal is to write Haskell code very closely mimicking Idris to see value added by dependent types.

This comparison is somewhat unfair to Haskell as I am converting examples from a book about Idris and I try to keep Haskell code as close to Idris as possible.
Idris is playing on its own turf so to speak.
The other reasons for the unfairness is a risky assumption that I know how to 'haskell' :), or that I know enough of it to make the comparison meaningful.

TOC

Part 1

Part 2

I used `GHC.TypeLits` at the beginning but decided to abandon them from here on [/src/Util/NonLitsNatAndVector](../blob/master/src/Util/NonLitsNatAndVector.hs)
`singletons` are used (more and more) from here on

Idris goodness

(TODO)

Some interesting links

https://personal.cis.strath.ac.uk/conor.mcbride/pub/hasochism.pdf
https://blog.jle.im/entry/introduction-to-singletons-1.html
https://blog.jle.im/entry/introduction-to-singletons-2.html
https://typesandkinds.wordpress.com/2012/12/01/decidable-propositional-equality-in-haskell/

Environment

Currently using ghc 8.2.2 and Idris 1.2.0

FYI about stack/ghc To play with newer version of TypeLits and singletons I have upped ghc/stack to lts-11.5 / 8.2.2. This is known to be a problem for older version of stack. If your stack come with ghc distribution, stack update may not work. I had to delete stack symbolic link in /usr/local/bin and reinstall it.

Idris instructions

  • To compile run make from root directory
  • To run repl navigate to src directory first and start repl there (idris repl)