GHCi :sprint command

The :sprint The s stands for “simple,” the idea being that :sprint is in some sense a simplified version of the :print command, since :sprint does less work.

command in GHCi prints a value without forcing any evaluation. This is useful for experimenting to find out which parts of a data structure are evaluated.

In this example, first we define a list from a to z. Initially, none of it has been evaluated, so when we :sprint it, all we see is _.

λ> x = ['a' .. 'z']

λ> :sprint x
_

If we do something that causes part of the list to be evaluated (like looking at the element at index 2), then :sprint now gives us the part of the list that has been evaluated so far.

λ> x !! 2
'c'

λ> :sprint x
x = 'a' : 'b' : 'c' : _

And so on.

λ> x !! 5
'f'

λ> :sprint x
x = 'a' : 'b' : 'c' : 'd' : 'e' : 'f' : _