Idris eager evaluation
In Haskell , I might implement if like this: if' True x y = x if' False x y = y spin 0 = () spin n = spin (n - 1) This behaves how I expect : haskell> if' True (spin 1000000) () -- takes a moment haskell> if' False (spin 1000000) () -- immediate In Racket , I could implement a flawed if like this: (define (if2 cond x y) (if cond x y)) (define (spin n) (if (= n 0) (void) (spin (- n 1)))) This behaves how I expect : racket> (if2 #t (spin 100000000) (void)) -- takes a moment racket> (if2 #f (spin 100000000) (void)) -- takes a moment In Idris , I might implement if like this: if' : Bool -> a -> a