Kotoblog - is a tech blog about programming

How to shoot your leg with lazy in Haskell

21/08/2015

This code compile and works fine:

Until we try to run this code with some not expected x (with minus) it will crash by memory limit, and not immediately.
Run this:

> take' (-5) [1 .. ]

And get the infinity list on your screen.
However we can obtain this situation by add one guard expression:

Comments

© 2010-2017 Kotoblog
Work on Silex
Using Twitter Bootstrap